From 240534904d619270293018696ba88229d705832c Mon Sep 17 00:00:00 2001 From: Scott Campbell Date: Sat, 22 Nov 2014 07:42:52 -0700 Subject: [PATCH 1/3] Custom changes to process the way I like: 1 - i5_spool_list - do not require an outq library use *LIBL if one is not provided 2 - listRead - remove error logging when no more entries found, just clogs the log. --- ToolkitApi/CW/cw.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ToolkitApi/CW/cw.php b/ToolkitApi/CW/cw.php index 4f7f4e4..eaf414d 100644 --- a/ToolkitApi/CW/cw.php +++ b/ToolkitApi/CW/cw.php @@ -2266,9 +2266,11 @@ function i5_spool_list($description = array(), $connection = null) // if outq is not *ALL, it should have a library name if (($outq != '*ALL') && empty($outqLibName)) { + // Try *LIBL + $outqLibName = '*LIBL'; // if no libname, result set will be empty, so might as well alert the user. - i5ErrorActivity(I5_ERR_PHP_ELEMENT_MISSING, I5_CAT_PHP, 'Missing outq library', 'You specified an outq but did not qualify it with a library name.'); - return false; + //i5ErrorActivity(I5_ERR_PHP_ELEMENT_MISSING, I5_CAT_PHP, 'Missing outq library', 'You specified an outq but did not qualify it with a library name.'); + // return false; } } @@ -2755,7 +2757,8 @@ function listRead(&$list) // we simply have no more records to receive. $errorCode = $connection->getErrorCode(); if ($errorCode == '' || $errorCode == 'GUI0006' || $errorCode == 'GUI0001') { - i5ErrorActivity(I5_ERR_BEOF, I5_CAT_PHP, 'No more entries.', 'No more entries.'); + // EOF is not an error, just clogs the log, completely normal, happens to everyone... + //i5ErrorActivity(I5_ERR_BEOF, I5_CAT_PHP, 'No more entries.', 'No more entries.'); } else { // a real error. i5CpfError($errorCode, $connection->getErrorMsg()); From 211368a283e880744a45b5a2e1b9de77413ce7b5 Mon Sep 17 00:00:00 2001 From: Scott Campbell Date: Sat, 22 Nov 2014 07:49:12 -0700 Subject: [PATCH 2/3] oldToNewDescriptionItem - fix bug that returns errors when looking for values in the input array. Changed to compare explicityly to null. --- ToolkitApi/CW/cwclasses.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ToolkitApi/CW/cwclasses.php b/ToolkitApi/CW/cwclasses.php index 3ee69bb..255d296 100644 --- a/ToolkitApi/CW/cwclasses.php +++ b/ToolkitApi/CW/cwclasses.php @@ -778,8 +778,9 @@ protected function oldToNewDescriptionItem($oldDataDescription = array(), $input // Look up its value (could be another data structure or a single value) // in the input array, based on data structure name. $dsData = $this->findValueInArray($dsName, $inputValues); - - if (!$dsData) { + // Compare with null since this is what findValueInArray returns on error + // this will prevent things such as empty arrays from causing errors + if ($dsData === null) { // ds has no description to match value! i5ErrorActivity(I5_ERR_PARAMNOTFOUND, I5_CAT_PHP, "Requested parameter '$dsName' does not exist in the input data", "Requested parameter $dsName does not exist in the input data"); return false; From e1e0d90ffb8648f4c2e24cfd6a751670c5782e5a Mon Sep 17 00:00:00 2001 From: Scott Campbell Date: Tue, 25 Nov 2014 20:14:04 -0700 Subject: [PATCH 3/3] Changed findValueInArray to return false instead of null, updated oldToNewDescriptionItem to reflect change in return value. --- ToolkitApi/CW/cwclasses.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ToolkitApi/CW/cwclasses.php b/ToolkitApi/CW/cwclasses.php index 255d296..8a79913 100644 --- a/ToolkitApi/CW/cwclasses.php +++ b/ToolkitApi/CW/cwclasses.php @@ -585,7 +585,7 @@ public function splitPcmlProgramPath($path) * and return the value associated with the key name provided. * * @param string $searchKey key to search for - * @return string|array|null value found in input array for array key. null if failed + * @return string|array|false value found in input array for array key. false if failed */ protected function findValueInArray($searchKey, $valueArray) { @@ -594,7 +594,7 @@ protected function findValueInArray($searchKey, $valueArray) // ensure that array is not empty if (!count($valueArray)) { i5ErrorActivity(I5_ERR_PHP_TYPEPARAM, I5_CAT_PHP, "Array of input values must not be empty", "Array of input values must not be empty"); - return null; + return false; } foreach ($valueArray as $key=>$value) { @@ -608,7 +608,7 @@ protected function findValueInArray($searchKey, $valueArray) // if failed, return null // $connection->logThis("findValueInArray: searchKey: $searchKey. no value found"); - return null; + return false; } /** @@ -778,9 +778,9 @@ protected function oldToNewDescriptionItem($oldDataDescription = array(), $input // Look up its value (could be another data structure or a single value) // in the input array, based on data structure name. $dsData = $this->findValueInArray($dsName, $inputValues); - // Compare with null since this is what findValueInArray returns on error + // Compare with false since this is what findValueInArray returns on error // this will prevent things such as empty arrays from causing errors - if ($dsData === null) { + if ($dsData === false) { // ds has no description to match value! i5ErrorActivity(I5_ERR_PARAMNOTFOUND, I5_CAT_PHP, "Requested parameter '$dsName' does not exist in the input data", "Requested parameter $dsName does not exist in the input data"); return false;