public static function getReportByPath($path) { if (!file_exists($path)) { $rtn = null; } else { $f = file_get_contents($path); $php = unserialize($f); $rtn = CalemJson::setJson($php); } return $rtn; }
/** * Checkout */ public function BatchSchedule() { $param = $this->getParamValue(0); if ($this->logger->isDebugEnabled()) { $this->logger->debug("Invoking BatchSchedule, param=" . var_export($param, true)); } $result = array(); //Processing each row by iterating the param object. foreach ($param as $key => $row) { $tran = CalemJson::objToArray($row); try { $this->schedBo->batchSchedule($tran); $result[] = array('status' => 0); } catch (Exception $e) { $result[] = array('status' => 100, 'errorInfo' => $e->getErrorInfo()->getData()); } } return $result; }
/** * Checkout */ public function GenInOrderRequest() { $param = $this->getParamValue(0); if ($this->logger->isDebugEnabled()) { $this->logger->debug("Invoking GenInOrderRequest, param=" . var_export($param, true)); } $result = array(); //Processing each row by iterating the param object. foreach ($param as $key => $row) { $inId = $row->in_id; $reqRow = CalemJson::objToArray($row->reqRow); try { $this->inOrderGenBo->manualGenOrderRequest($inId, $reqRow); $result[] = array('status' => 0); } catch (Exception $e) { $result[] = array('status' => 100, 'errorInfo' => $e->getErrorInfo()->getData()); } } return $result; }
/** * VerifyReqStatusChange */ public function VerifyReqStatusChange() { $param = $this->getParamValue(0); if ($this->logger->isDebugEnabled()) { $this->logger->debug("Invoking VerifyReqStatusChange, param=" . var_export($param, true)); } $result = array(); //Processing each row by iterating the param object. foreach ($param as $key => $row) { $tran = CalemJson::objToArray($row); try { $this->reqBo->verifyReqStatusChange($tran); $result[] = array('status' => 0); } catch (CalemDataBoException $e) { $result[] = array('status' => 100, 'errorInfo' => $e->getErrorInfo()->getData()); } catch (Exception $ex) { $e = new CalemDataBoException('requisition', $ex); $result[] = array('status' => 100, 'errorInfo' => $e->getErrorInfo()->getData()); } } return $result; }
public function setJson($obj) { $this->itemMap = CalemJson::setJsonByMap($obj); }
/** * Remove PO item from client request */ public function removePoItemByClient($tran) { $poId = $tran['po_id']; $reqItem = base64_decode($tran['req_item']); $ids = CalemJson::jsonToPhp($reqItem); if ($this->logger->isInfoEnabled()) { $this->logger->info("removePoItemByClient: po_id=" . $poId . ", req ids=" . var_export($ids, true)); } try { $poDbo = CalemFactory::getDbo('po'); $poRow = $poDbo->fetchById($poId); } catch (CalemDboDataNotFoundException $ex) { throw new CalemDataBoException('po', $ex, null); } $piDbo = CalemFactory::getDbo('po_item'); $reqDbo = CalemFactory::getDbo('requisition'); try { //Start a transaction here $poDbo->beginTransaction(); $poDbo->executeBySqlParam('select id from po where id=? for update', $poRow['id']); //processing each req item $riDbo = CalemFactory::getDbo('req_item'); foreach ($ids as $id) { try { $riRow = $riDbo->fetchById($id); } catch (CalemDboDataNotFoundExcpetion $e) { if ($this->logger->isDebugEnabled()) { $this->logger->debug("Req item=" . $id . " cannot be found."); } continue; //Ignore that an item does not exist anymore. } //process this line $poRow = $this->removePoItemFromReq($poRow, $riRow, $piDbo, $poDbo, $riDbo, $reqDbo); } //commit $poDbo->commit(); } catch (Exception $exo) { $poDbo->rollback(); throw new CalemDataBoException('req_item', $exo, null); } }
public function setJson($obj) { $this->noMaximize = !isset($obj['noMaximize']) ? true : $obj['noMaximize']; $this->colList = CalemJson::setJsonAsArray($obj['colList']); }
public function SwapDropdown() { $param = $this->getParamValue(0); if ($this->logger->isDebugEnabled()) { $this->logger->debug("Swap field name, param=" . var_export($param, true)); } $result = array(); //Processing each row by iterating the param object. foreach ($param as $key => $fldObj) { $fldAr = CalemJson::objToArray($fldObj); //Update dropdown $result[] = $this->swapDropdownEntry($fldAr); } return $result; }
public function EditLabel() { $param = $this->getParamValue(0); if ($this->logger->isDebugEnabled()) { $this->logger->debug("Edit label, param=" . var_export($param, true)); } $result = array(); //Processing each row by iterating the param object. foreach ($param as $key => $fldObj) { $fldAr = CalemJson::objToArray($fldObj); //Update text $result[] = $this->updateMessage($fldAr); } return $result; }
public function setJson($obj) { $this->id = $obj['id']; $this->link = CalemJson::setJson($obj['link']); }
} public function getSql() { return 'SELECT ' . CalemJson::arrayToSql($this->select, ',');
public function setJson($obj) { $this->id = $obj['id']; $this->acl = CalemJson::setJson($obj['acl']); $this->layout = $obj['layout'] ? CalemJson::setJson($obj['layout']) : null; }
public function getSql() { return '(' . CalemJson::arrayToSql($this->exprs, $this->type) . ")"; }
public static function setJsonByMap($map) { if (!$map) { return null; } $rtn = array(); foreach ($map as $key => $val) { $o = CalemJson::setJson($val); $rtn[$key] = $o; } return $rtn; }
public function setJson($obj) { $this->viewLayout = CalemJson::setJsonAsArray($obj['viewLayout']); $this->gridLayout = CalemJson::setJson($obj['gridLayout']); }
public function setJson($obj) { $this->dows = CalemJson::setJsonAsArray($obj); }
public function processUpdateData($param) { $result = array(); //Processing each row by iterating the param object. foreach ($param as $key => $row) { $base = $row->base; $custom = $row->custom; $sql = $row->sql; $baseTable = $base->table; $baseCurrent = CalemJson::objToArray($base->current); $baseUpdate = CalemJson::objToArray($base->update); if ($custom) { $customTable = $custom->table; $customCurrent = CalemJson::objToArray($custom->current); $customUpdate = CalemJson::objToArray($custom->update); } try { $bo = CalemFactory::getDataBo($baseTable); $feedback = $bo->update($baseTable, $baseCurrent, $baseUpdate, $customTable, $customCurrent, $customUpdate, $sql); $result[] = array('table' => $baseTable, 'status' => 0, 'feedback' => $feedback); } catch (CalemDboUpdateConflictException $e) { $result[] = array('table' => $baseTable, 'status' => $e->getStatus(), 'feedback' => array('table' => $baseTable, 'server' => $e->getServer(), 'update' => $baseTable, 'conflict' => $e->getConflict())); } catch (Exception $e) { $result[] = array('table' => $baseTable, 'status' => 400, 'errorInfo' => $e->getErrorInfo()->getData()); } } return $result; }