aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xgsxcl10
-rw-r--r--gsxlib.php13
2 files changed, 13 insertions, 10 deletions
diff --git a/gsxcl b/gsxcl
index 2bbace3..78a5add 100755
--- a/gsxcl
+++ b/gsxcl
@@ -116,10 +116,10 @@ switch( $noun ) {
$result = $gsx->repairLookup( $data );
break;
case 'details':
- $result = $gsx->partsPendingReturn( $data );
+ $result = $gsx->repairDetails( $data );
break;
case 'status':
- $result = $gsx->repairStatus( $query );
+ $result = $gsx->repairStatus( $data );
break;
case 'create':
$json = file_get_contents( $opts['d'] );
@@ -129,13 +129,13 @@ switch( $noun ) {
}
case 'model':
- $result = $gsx->productModel( $query );
+ $result = $gsx->productModel( $data );
break;
case 'osdispatchdetail':
- $result = $gsx->onsiteDispatchDetail( $query );
+ $result = $gsx->onsiteDispatchDetail( $data );
break;
case 'label':
- list($order, $part) = explode( ':', $query );
+ list($order, $part) = explode( ':', $data );
$result = $gsx->returnLabel( $order, $part );
$name = $result->returnLabelFileName;
echo $result->returnLabelFileData;
diff --git a/gsxlib.php b/gsxlib.php
index f405fed..dfea4e3 100644
--- a/gsxlib.php
+++ b/gsxlib.php
@@ -375,13 +375,16 @@ class GsxLib
*/
public function repairDetails($dispatchId)
{
- $dispatchId = trim($dispatchId);
-
- if( !self::looksLike( $dispatchId, 'dispatchId' )) {
- exit( 'Invalid dispatch ID: ' . $dispatchId );
+ if (is_string($dispatchId)) {
+ $dispatchId = trim($dispatchId);
+ if( !self::looksLike( $dispatchId, 'dispatchId' )) {
+ $error = sprintf('Invalid dispatch ID: %s', $dispatchId);
+ throw new InvalidArgumentException($error);
+ }
+ $dispatchId = array('dispatchId' => $dispatchId);
}
- $req = array('RepairDetails' => array('dispatchId' => $dispatchId));
+ $req = array('RepairDetails' => $dispatchId);
return $this->request($req)->lookupResponseData;
}