Beispiel #1
0
 /**
  *
  * @static
  * @param Supplier supplier
  * @param array $fields
  */
 public static function populate($supplier, $fields)
 {
     parent::populate($supplier, $fields);
     if (!$supplier instanceof Supplier) {
         static::throwException("El objecto no es un Supplier");
     }
     if (isset($fields['id_supplier'])) {
         $supplier->setIdSupplier($fields['id_supplier']);
     }
     if (isset($fields['id_payment_term'])) {
         $supplier->setIdPaymentTerm($fields['id_payment_term']);
     }
     if (isset($fields['id_default_port'])) {
         $supplier->setIdDefaultPort($fields['id_default_port']);
     }
     if (isset($fields['id_company'])) {
         $supplier->setIdCompany($fields['id_company']);
     }
     if (isset($fields['id_invoice_address'])) {
         $supplier->setIdInvoiceAddress($fields['id_invoice_address']);
     }
     if (isset($fields['card_name'])) {
         $supplier->setCardName($fields['card_name']);
     }
     if (isset($fields['rfc'])) {
         $supplier->setRfc($fields['rfc']);
     }
     if (isset($fields['type_person'])) {
         $supplier->setTypePerson($fields['type_person']);
     }
     if (isset($fields['paydays'])) {
         $supplier->setPaydays($fields['paydays']);
     }
     if (isset($fields['id_currency'])) {
         $supplier->setIdCurrency($fields['id_currency']);
     }
     if (isset($fields['id_final_grand_risk'])) {
         $supplier->setIdFinalGrandRisk($fields['id_final_grand_risk']);
     }
     if (isset($fields['id_approval_status'])) {
         $supplier->setIdApprovalStatus($fields['id_approval_status']);
     }
     if (isset($fields['quality'])) {
         $supplier->setQuality($fields['quality']);
     }
     if (isset($fields['consistency'])) {
         $supplier->setConsistency($fields['consistency']);
     }
     if (isset($fields['time'])) {
         $supplier->setTime($fields['time']);
     }
     if (isset($fields['type_supplier'])) {
         $supplier->setTypeSupplier($fields['type_supplier']);
     }
 }
 /**
  *
  * @static
  * @param CustomsBroker customsBroker
  * @param array $fields
  */
 public static function populate($customsBroker, $fields)
 {
     parent::populate($customsBroker, $fields);
     if (!$customsBroker instanceof CustomsBroker) {
         static::throwException("El objecto no es un CustomsBroker");
     }
     if (isset($fields['id_customs_broker'])) {
         $customsBroker->setIdCustomsBroker($fields['id_customs_broker']);
     }
     if (isset($fields['id_company'])) {
         $customsBroker->setIdCompany($fields['id_company']);
     }
     if (isset($fields['id_last_fee_file'])) {
         $customsBroker->setIdLastFeeFile($fields['id_last_fee_file']);
     }
     if (isset($fields['payment'])) {
         $customsBroker->setPayment($fields['payment']);
     }
     if (isset($fields['status'])) {
         $customsBroker->setStatus($fields['status']);
     }
 }
Beispiel #3
0
 /**
  *
  * @static
  * @param Forwarder forwarder
  * @param array $fields
  */
 public static function populate($forwarder, $fields)
 {
     parent::populate($forwarder, $fields);
     if (!$forwarder instanceof Forwarder) {
         static::throwException("El objecto no es un Forwarder");
     }
     if (isset($fields['id_forwarder'])) {
         $forwarder->setIdForwarder($fields['id_forwarder']);
     }
     if (isset($fields['id_company'])) {
         $forwarder->setIdCompany($fields['id_company']);
     }
     if (isset($fields['name'])) {
         $forwarder->setName($fields['name']);
     }
     if (isset($fields['last_fee'])) {
         $forwarder->setLastFee($fields['last_fee']);
     }
     if (isset($fields['status'])) {
         $forwarder->setStatus($fields['status']);
     }
 }
Beispiel #4
0
 /**
  *
  * @static
  * @param Creditor creditor
  * @param array $fields
  */
 public static function populate($creditor, $fields)
 {
     parent::populate($creditor, $fields);
     if (!$creditor instanceof Creditor) {
         static::throwException("El objecto no es un Creditor");
     }
     if (isset($fields['id_creditor'])) {
         $creditor->setIdCreditor($fields['id_creditor']);
     }
     if (isset($fields['id_company'])) {
         $creditor->setIdCompany($fields['id_company']);
     }
     if (isset($fields['payment_method'])) {
         $creditor->setPaymentMethod($fields['payment_method']);
     }
     if (isset($fields['account'])) {
         $creditor->setAccount($fields['account']);
     }
     if (isset($fields['status'])) {
         $creditor->setStatus($fields['status']);
     }
 }
Beispiel #5
0
 /**
  *
  * @return array
  */
 public function updateAction()
 {
     $form = $this->getForm();
     if ($this->getRequest()->isPost()) {
         $params = $this->getRequest()->getParams();
         if (!$form->isValid($params)) {
             $this->view->setTpl("New");
             $this->view->form = $form;
             return;
         }
         $id = $this->getRequest()->getParam('id');
         $company = CompanyQuery::create()->findByPKOrThrow($id, $this->i18n->_("It does not exist the Company with id {$id}"));
         try {
             $this->getCompanyCatalog()->beginTransaction();
             CompanyFactory::populate($company, $form->getValues());
             $this->getCompanyCatalog()->update($company);
             $this->getCompanyCatalog()->commit();
             $this->setFlash('ok', $this->i18n->_("Se actualizo correctamente el Company"));
         } catch (Exception $e) {
             $this->getCompanyCatalog()->rollBack();
             $this->setFlash('error', $this->i18n->_($e->getMessage()));
         }
     }
     $this->_redirect('company/list');
 }