Пример #1
0
 public function editAction()
 {
     $this->view->action = "update";
     $this->view->contentTitle = 'Edit Supplier';
     $this->view->setTpl('Form');
     $cardcode = $this->getRequest()->getParam('id');
     $supplier = SapSupplierQuery::create()->findByPK($cardcode);
     // 		echo '<pre>';
     // 		print_r($supplier->toArray());
     // 		die;
     if (SapSupplierAddressQuery::create()->whereAdd(SapSupplierAddress::TABLENAME . '.' . SapSupplierAddress::CARDCODE, $cardcode)->count()) {
         $address = SapSupplierAddressQuery::create()->whereAdd(SapSupplierAddress::TABLENAME . '.' . SapSupplierAddress::CARDCODE, $cardcode)->findOne();
     } else {
         $address = new SapSupplierAddress();
     }
     $contacts = SapSupplierContactEmployeeQuery::create()->whereAdd(SapSupplierContactEmployee::CARDCODE, $cardcode)->orderBy(SapSupplierContactEmployee::ID_CONTACT_EMPLOYEE, SapSupplierContactEmployeeQuery::ASC)->find();
     $this->view->setupForm = SupplierFileQuery::create()->whereAdd(SupplierFile::ID_SUPPLIER, $cardcode)->whereAdd(SupplierFile::DOCUMENT_TYPE, SapSupplier::$FileTypes['SetupForm'])->count();
     $this->view->profileForm = SupplierFileQuery::create()->whereAdd(SupplierFile::ID_SUPPLIER, $cardcode)->whereAdd(SupplierFile::DOCUMENT_TYPE, SapSupplier::$FileTypes['ProfileForm'])->count();
     $this->view->auditReport = SupplierFileQuery::create()->whereAdd(SupplierFile::ID_SUPPLIER, $cardcode)->whereAdd(SupplierFile::DOCUMENT_TYPE, SapSupplier::$FileTypes['AuditReport'])->count();
     $this->view->supplier = $supplier->toArray();
     $this->view->address = $address->toArray();
     $this->view->contacts = $contacts->toArray();
     $this->view->CardCode = $cardcode;
     $this->view->portCustom = $portCustom = array('' => $this->i18n->_("Select Port")) + PortCustomQuery::create()->find()->toCombo();
     $this->view->paymentTerm = $paymentTerm = array('' => $this->i18n->_("Select Payment Term")) + PaymentTermQuery::create()->find()->toCombo();
     $this->view->selectOption = self::$AprovalStatus;
     $this->view->finalOption = self::$FinalGrandRisk;
     $this->view->currencies = self::getCurrencies();
     $this->view->typePersons = self::getTypePersons();
     $this->view->country = self::getCountries();
     if ($supplier->getCurrency() == '##') {
         $this->view->editCurrency = false;
     } else {
         $this->view->editCurrency = true;
     }
     $this->view->groupCodes = $this->getGroupCodeCombo();
 }