From 612ee8577f5f64b0e82fefb4ba7db09e7ec7b6a3 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Thu, 10 Apr 2014 12:31:47 +0300 Subject: Added $lang argument --- .gitignore | 1 + gsxlib.php | 20 ++++++++++---------- runtests.php | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e419776 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +simpletest \ No newline at end of file diff --git a/gsxlib.php b/gsxlib.php index dfea4e3..b4eec45 100644 --- a/gsxlib.php +++ b/gsxlib.php @@ -32,7 +32,8 @@ class GsxLib $password, $environment = '', $region = 'emea', - $tz = 'CEST') + $tz = 'CEST', + $lang = 'en') { if(!(self::$_instance instanceof self)) { self::$_instance = new self( @@ -41,7 +42,8 @@ class GsxLib $password, $environment, $region, - $tz + $tz, + $lang ); } @@ -57,7 +59,8 @@ class GsxLib $password, $environment = '', $region = 'emea', - $tz = 'CEST' ) + $tz = 'CEST', + $lang = 'en' ) { if(!class_exists('SoapClient')) { throw new GsxException('Looks like your PHP lacks SOAP support'); @@ -110,7 +113,7 @@ class GsxLib 'userId' => $username, 'password' => $password, 'serviceAccountNo' => $account, - 'languageCode' => 'en', + 'languageCode' => $lang, 'userTimeZone' => $tz, ) ); @@ -124,7 +127,7 @@ class GsxLib if($environment == '2') $environment = 'production'; $error = 'Authentication with GSX failed. Does this account have access to ' - .$environment."?\n"; + .$environment." environment?\n"; throw new GsxException($error); } @@ -290,8 +293,7 @@ class GsxLib 'lookupRequestData' => $query )); - $response = $this->client->RepairLookup($req) - ->RepairLookupResponse; + $response = $this->client->RepairLookup($req)->RepairLookupResponse; return $response->lookupResponseData; } @@ -436,9 +438,7 @@ class GsxLib } - $req = array('PartsLookup' => array( - 'lookupRequestData' => $query - )); + $req = array('PartsLookup' => array('lookupRequestData' => $query)); $result = $this->request($req)->parts; // always return an array diff --git a/runtests.php b/runtests.php index c1323e8..6619cc5 100644 --- a/runtests.php +++ b/runtests.php @@ -7,7 +7,7 @@ class GsxlibTest extends UnitTestCase { function setUp() { global $argv; - $this->gsx = GsxLib::getInstance($argv[1], $argv[2], $argv[3], 'ut'); + $this->gsx = GsxLib::getInstance($argv[1], $argv[2], $argv[3], 'ut', 'emea', 'CEST', 'es'); } function testWarranty() { -- cgit v1.2.3