Пример #1
0
 /**
  *
  * @param SapSupplierAddress $address
  * @return array
  */
 private function createSapSupplierAddress(SapSupplierAddress $address)
 {
     return array('Address' => 'Main supplier address', 'Street' => utf8_encode($address->getStreet()), 'City' => utf8_encode($address->getCity()), 'ZipCode' => utf8_encode($address->getZipCode()), 'StreetNo' => utf8_encode($address->getStreetNumber()), 'Building' => 1, 'Block' => 1, 'County' => utf8_encode($address->getCounty()), 'State' => utf8_encode($address->getState()), 'Country' => utf8_encode($address->getCountry()));
 }
Пример #2
0
 /**
  *
  * @static
  * @param SapSupplierAddress $sapSupplierAddress
  * @param array $fields
  */
 public static function populate($sapSupplierAddress, $fields)
 {
     if (!$sapSupplierAddress instanceof SapSupplierAddress) {
         static::throwException("El objecto no es un SapSupplierAddress");
     }
     if (isset($fields['Cardcode'])) {
         $sapSupplierAddress->setCardcode($fields['Cardcode']);
     }
     if (isset($fields['Address'])) {
         $sapSupplierAddress->setAddressName($fields['Address']);
     }
     if (isset($fields['Street'])) {
         $sapSupplierAddress->setStreet($fields['Street']);
     }
     if (isset($fields['Block'])) {
         $sapSupplierAddress->setBlock($fields['Block']);
     }
     if (isset($fields['ZipCode'])) {
         $sapSupplierAddress->setZipCode($fields['ZipCode']);
     }
     if (isset($fields['City'])) {
         $sapSupplierAddress->setCity($fields['City']);
     }
     if (isset($fields['County'])) {
         $sapSupplierAddress->setCounty($fields['County']);
     }
     if (isset($fields['Country'])) {
         $sapSupplierAddress->setCountry($fields['Country']);
     }
     if (isset($fields['Address2'])) {
         $sapSupplierAddress->setState($fields['Address2']);
     }
     if (isset($fields['Building'])) {
         $sapSupplierAddress->setBuilding($fields['Building']);
     }
     if (isset($fields['StreetNo'])) {
         $sapSupplierAddress->setStreetNumber($fields['StreetNo']);
     }
 }
Пример #3
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();
 }