/** * * makeBean * @param array $resultset * @return \Application\Model\Bean\Inspection */ protected function makeBean($resultset) { return InspectionFactory::createFromArray($resultset); }
/** * * @return array */ public function updateAction() { if ($this->getRequest()->isPost()) { $params = $this->getRequest()->getParams(); $idProformaInvoice = $params['id_proforma_invoice']; $filePrePro = '2'; $fileDuPro = '3'; $filePreShip = '4'; try { $this->getInspectionCatalog()->beginTransaction(); $inspection = InspectionQuery::create()->findByPK($params['id_inspection']); InspectionFactory::populate($inspection, $params); if ($inspection->getResult() == 1 || $inspection->getResult() == 4) { $inspection->setStatus(Inspection::$Status["Inactive"]); } else { if ($inspection->getResult() == 2) { $inspection->setStatus(Inspection::$Status["Rescheduled"]); } } $date = new Zend_Date(); $inspection->setDateOn($date->get('Y-M-d')); $this->getInspectionCatalog()->update($inspection); $this->newLogForUpdate($inspection); if ($params['id_inspection_type'] == $filePrePro) { $this->savefileAction($inspection->getIdInspection(), $inspection->getIdProformaInvoice() . "-" . $inspection->getIdProformaInvoiceEntry()); } if ($params['id_inspection_type'] == $fileDuPro) { $this->savefileAction($inspection->getIdInspection(), $inspection->getIdProformaInvoice() . "-" . $inspection->getIdProformaInvoiceEntry()); } if ($params['id_inspection_type'] == $filePreShip) { $this->savefileAction($inspection->getIdInspection(), $inspection->getIdProformaInvoice() . "-" . $inspection->getIdProformaInvoiceEntry()); } $proformaInvoiceEntry = ProformaInvoiceEntryQuery::create()->whereAdd(ProformaInvoiceEntry::ID_PROFORMA_INVOICE, $inspection->getIdProformaInvoice())->whereAdd(ProformaInvoiceEntry::LINE, $inspection->getIdProformaInvoiceEntry())->findOne(); $this->getInspectionCatalog()->commit(); $this->setFlash('ok', $this->i18n->_("The inspection has been updated")); } catch (Exception $e) { $this->getInspectionCatalog()->rollBack(); $this->setFlash('error', $this->i18n->_($e->getMessage())); } } $this->_redirect('inspection/rate/id/' . $inspection->getIdProformaInvoice() . "/idLine/" . $inspection->getIdProformaInvoiceEntry()); }