aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2011-12-03 23:49:08 +0200
committerFilipp Lepalaan <filipp@mac.com>2011-12-03 23:49:08 +0200
commit1682659a37c29820bc44e3e9646f0e99abbe0fd7 (patch)
treeeb4a721b5dc95715dd741691209949276e352077
parent5ac597d3d0b3f44699f96b47bc6c62348f5b0d26 (diff)
downloadgsxlib-1682659a37c29820bc44e3e9646f0e99abbe0fd7.tar.gz
gsxlib-1682659a37c29820bc44e3e9646f0e99abbe0fd7.tar.bz2
gsxlib-1682659a37c29820bc44e3e9646f0e99abbe0fd7.zip
Fixed repair status lookup
-rw-r--r--gsxlib.php36
1 files changed, 21 insertions, 15 deletions
diff --git a/gsxlib.php b/gsxlib.php
index 07e5018..60d57e5 100644
--- a/gsxlib.php
+++ b/gsxlib.php
@@ -97,7 +97,7 @@ class GsxLib
* Get current GSX status of repair
* @param mixed $dispatchId
*/
- public function repairStatus($dispatchId)
+ public function repairStatus( $dispatchId )
{
$toCheck = array();
@@ -128,7 +128,7 @@ class GsxLib
}
- public function repairLookup($query)
+ public function repairLookup( $query )
{
$fields = array(
'repairConfirmationNumber' => '',
@@ -151,22 +151,26 @@ class GsxLib
'unreceivedModules' => 'N',
);
- if (!is_array($query)) {
- if (self::looksLike($query, 'dispatchId')) {
- $query = array('repairConfirmationNumber' => $query);
- } else {
- exit('Invalid query for repair lookup: ' . $query);
- }
- }
+ $like = self::looksLike( $query );
- foreach ($fields as $k => $v) {
- if (array_key_exists($k, $query)) {
- $fields[$k] = $query[$k];
- }
+ switch( $like ) {
+ case 'dispatchId':
+ $query = array( 'repairConfirmationNumber' => $query );
+ break;
+ case 'serialNumber':
+ $query = array( 'serialNumber' => $query );
+ break;
}
- $req = array('RepairLookup' => array('lookupRequestData' => $fields));
- return $this->request($req)->lookupResponseData;
+ $query = array_merge( $fields, $query );
+
+ $req = array( 'RepairLookupRequest' =>
+ array( 'userSession' => array( 'userSessionId' => $this->session_id ), 'lookupRequestData' => $query )
+ );
+
+ $response = $this->client->RepairLookup( $req )->RepairLookupResponse;
+
+ return $response->lookupResponseData;
}
@@ -314,6 +318,8 @@ class GsxLib
}
+
+
public function onsiteDispatchDetail( $query )
{
if( !self::looksLike( $query, 'dispatchId' )) {