예제 #1
0
 /**
  *
  * makeBean
  * @param array $resultset
  * @return \Application\Model\Bean\Inspection
  */
 protected function makeBean($resultset)
 {
     return InspectionFactory::createFromArray($resultset);
 }
예제 #2
0
 public function createModalAction()
 {
     if ($this->getRequest()->isPost()) {
         $params = $this->getRequest()->getParams();
         //die("<pre>".print_r($params, true)."</pre>");
         try {
             $this->getInspectionCatalog()->beginTransaction();
             $inspection = InspectionQuery::create()->findByPKOrThrow($params["id_inspection"], $this->i18n->_("The inspection with id {$params["id_inspection"]} does not exist."));
             $inspection->setStatus(Inspection::$Status["Inactive"]);
             $this->getInspectionCatalog()->update($inspection);
             $newInspection = InspectionFactory::createFromArray(array(Inspection::ID_INSPECTION_TYPE => $params["id_inspection_type"], Inspection::ID_PROFORMA_INVOICE => $params["id_proforma_invoice"], Inspection::ID_PROFORMA_INVOICE_ENTRY => $params["id_proforma_invoice_entry"], Inspection::STATUS => Inspection::$Status["Active"], Inspection::PLANNED_DATE => $params["planned_date"], Inspection::ID_INSPECTOR => $params["id_inspector"]));
             if ($params['id_inspector'] == '') {
                 $newInspection->setIdInspector(null);
             }
             $this->getInspectionCatalog()->create($newInspection);
             $this->newLogForCreate($newInspection);
             $this->getInspectionCatalog()->commit();
             $this->setFlash('ok', $this->i18n->_("The Inspection has been reagend"));
         } catch (Exception $e) {
             $this->getInspectionCatalog()->rollBack();
             $this->setFlash('error', $this->i18n->_($e->getMessage()));
         }
     }
     $this->_redirect('proforma-invoice/list');
 }