aboutsummaryrefslogtreecommitdiffstats
path: root/gsxcl
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2011-05-04 15:58:53 +0300
committerFilipp Lepalaan <filipp@mac.com>2011-05-04 15:58:53 +0300
commit248d00244eb6ea6905eb16f0545404612b626df5 (patch)
tree60ef2807cae3c541ef3653223f761567403aa2d3 /gsxcl
parent00c0f79d93ee7c33c57d8749d297ec5fd3a33af3 (diff)
downloadgsxlib-248d00244eb6ea6905eb16f0545404612b626df5.tar.gz
gsxlib-248d00244eb6ea6905eb16f0545404612b626df5.tar.bz2
gsxlib-248d00244eb6ea6905eb16f0545404612b626df5.zip
Added more modes
Diffstat (limited to 'gsxcl')
-rwxr-xr-xgsxcl40
1 files changed, 34 insertions, 6 deletions
diff --git a/gsxcl b/gsxcl
index 591b8d6..fb35459 100755
--- a/gsxcl
+++ b/gsxcl
@@ -8,10 +8,13 @@
* @author Filipp Lepalaan <filipp@mcare.fi>
*/
-if (false) {
+if (FALSE) {
error_reporting(E_ALL|E_STRICT);
}
+$modes = array('warranty', 'parts', 'pending', 'repair', 'lookup', 'status', 'label');
+$modes_str = implode(', ', $modes);
+
require 'gsxlib.php';
if (count($argv) < 6) {
@@ -24,7 +27,7 @@ usage: gsxcl -s sold-to -u username -p password [-r region] [-e environment] [-m
-r region Either "am" (America), "emea" (Europe, Middle-East, Africa)
"apac" (Asia-Pacific) or "la" (Latin America). Defaults to "emea".
-e environment the GSX environment. Either empty (production), "it" or "ut". Defaults to production.
- -m mode What to search for. Currently either "warranty" (default) or "parts"
+ -m mode What to search for. Currently one of: {$modes_str}. Defaults to "warranty".
-q query A query string (serial number, order confirmation, repair number, EEE code, etc.
Defaults to current serial number.
@@ -32,20 +35,45 @@ EOT;
exit();
}
-$opts = getopt('s:u:p:r:e:m:q::');
+$opts = getopt('s:u:p:r:e:m:q:');
$gsx = new GsxLib($opts['s'], $opts['u'], $opts['p'], $opts['e'], $opts['r']);
if (empty($opts['q'])) {
- $opts['q'] = `system_profiler SPHardwareDataType | awk '/Serial Number/ {print $4}'`;
+ $opts['q'] = `/usr/sbin/system_profiler SPHardwareDataType | awk '/Serial Number/ {print $4}'`;
}
-switch ($opts['m']) {
+switch ($opts['m'])
+{
case 'warranty':
print_r($gsx->warrantyStatus($opts['q']));
break;
case 'parts':
print_r($gsx->partsLookup($opts['q']));
break;
+ case 'pending':
+ print_r($gsx->partsPendingReturn($opts['q']));
+ break;
+ case 'repair':
+ print_r($gsx->repairDetails($opts['q']));
+ break;
+ case 'lookup':
+ print_r($gsx->repairLookup($opts['q']));
+ break;
+ case 'status':
+ print_r($gsx->repairStatus($opts['q']));
+ break;
+ case 'comptia':
+ print_r($gsx->compTiaCodes());
+ break;
+ case 'label':
+ list($order, $part) = explode(':', $opts['q']);
+ $result = $gsx->returnLabel($order, $part);
+ $name = $result->returnLabelFileName;
+ echo $result->returnLabelFileData;
+ break;
+ default:
+ print_r($gsx->warrantyStatus($opts['q']));
+ break;
}
-?> \ No newline at end of file
+?>