Beispiel #1
0
/**
 * note: i5_userspace_delete does not exist in old toolkit
 * 
 * @return bool
 */
function i5_open()
{
    i5ErrorActivity(TO_BE_IMPLEMENTED, 0, "Record level access has not been implemented.", "Record level access has not been implemented.");
    return false;
}
 /**
  * Take the previously given data description and match up with values and output params
  * to make a parameter array/object that can be presented to a program or data queue, etc.
  * If any error or validation problem occurs (such as a value not matching data type), return false.
  *
  *
  * @param array $input                 Data input params
  * @param array $description[optional] Description of data, if want to specify explicitly
  *                                     rather than to use description from class member.
  * @return array|boolean Return the param array or, if an error occurs, false.
  */
 public function generateNewToolkitParams($input = array(), $description = null)
 {
     $paramsForNewToolkit = array();
     // store input value array for safekeeping.
     // could be blank.
     $this->setInputValues($input);
     // use specified description if available, otherwise class member description.
     $description = $description ? $description : $this->_description;
     // do one at a time
     foreach ($description as $key => $descParam) {
         // convert top-level keys to lower case for consistency.
         $descParam = array_change_key_case($descParam, CASE_LOWER);
         // if an input value wasn't specified for a param definition/description,
         // set a flag to provide default input values (often used as a placeholder).
         $needDefaultInput = false;
         // default
         // if not globally specified as needing default input values
         if (!$this->getIsReceiverOnly()) {
             // desc name can be given under the index "name" or "dsname".
             if (isset($descParam['name']) && $descParam['name']) {
                 $name = $descParam['name'];
             } elseif (isset($descParam['dsname']) && $descParam['dsname']) {
                 $name = $descParam['dsname'];
             } else {
                 i5ErrorActivity(I5_ERR_PHP_TYPEPARAM, I5_CAT_PHP, "Parameter name in description is missing or blank", "Parameter name in description is missing or blank");
                 return false;
             }
             // if corresponding input param not given, set flag for using default.
             $needDefaultInput = !isset($input[$name]);
         }
         if ($needDefaultInput) {
             // only set this if didn't already turn on receiver-only globally. We don't want to interfere then.
             $this->setIsReceiverOnly(true);
         }
         // Build array of new style parameters
         // as we convert each param from old toolkit style to new.
         $paramsForNewToolkit[] = $this->oldToNewDescriptionItem($descParam);
         if ($needDefaultInput) {
             // revert back to false.
             $this->setIsReceiverOnly(false);
         }
     }
     // Determine if any "CountRef" field references were found.
     // If so, apply "enddo" label to those countref fields that were referenced.
     if ($countRefNames = $this->getCountRefNames()) {
         foreach ($countRefNames as $countRefName) {
             // for each countRefName, find data definition (new toolkit params now)
             // where that fieldname is defined.
             // If not defined, write error to error log.
             // If found, set the enddo label there.
             foreach ($paramsForNewToolkit as $param) {
                 // check name of param for a match
                 if ($param->getParamName() == $countRefName) {
                     if (!$param->isDS()) {
                         // Good, we found matching field name that's a regular field.
                         // Use the count ref name as the label.
                         // Should work as long as there aren't two identically named countRef fields.
                         $param->setParamProperties(array('enddo' => $countRefName));
                     } else {
                         // no good. Count must be in a regular variable, not a DS.
                         $this->getConnection()->logThis("countRef {$countRefName} cannot be specified by a data structure. Must be a scalar variable type to hold the count.");
                     }
                     break;
                     // we found what we wanted
                 }
             }
         }
     }
     // TODO: when count/dim is specified, use it as max array size. otherwise error 38 should occur.
     return $paramsForNewToolkit;
 }