Beispiel #1
0
 public function editAction()
 {
     $objDataCustomer = new GSALES_DATA_CUSTOMER();
     $objCustomer = $objDataCustomer->getCustomerById($this->objUserAuth->getCustomerId());
     // read customer data
     $objCustomer->overriteProposalWithCurrentValues();
     // load existent proposals
     $objForm = new HTMLFORM($this, 'mydataedit');
     // form for customer data edit
     $objForm->setAction('mydata/edit');
     $objForm->addField('Firma', 'input', 'company', $objCustomer->getCompany(), false, '', '', '');
     $objForm->addField('Vorname', 'input', 'firstname', $objCustomer->getFirstname(), true, '', '', '');
     $objForm->addField('Nachname', 'input', 'lastname', $objCustomer->getLastname(), true, '', '', '');
     $objForm->addField('Anschrift', 'input', 'address', $objCustomer->getAddress(), true, '', '', '');
     $objForm->addField('PLZ', 'input', 'zip', $objCustomer->getZIP(), true, '', '', '');
     $objForm->addField('Ort', 'input', 'city', $objCustomer->getCity(), true, '', '', '');
     $objForm->addField('Land', 'input', 'country', $objCustomer->getCountry(), false, '', '', '');
     $objForm->addField('Homepage', 'input', 'homepage', $objCustomer->getHomepage(), false, '', '', '');
     $objForm->addField('E-Mail', 'input', 'email', $objCustomer->getEMail(), true, '', '', '');
     $objForm->addField('Telefon', 'input', 'phone', $objCustomer->getPhone(), true, '', '', '');
     $objForm->addField('Fax', 'input', 'fax', $objCustomer->getFax(), false, '', '', '');
     $objForm->addField('Kontonummer', 'input', 'bank_account_no', $objCustomer->getBankAccountNo(), false, '', '', '');
     $objForm->addField('BLZ', 'input', 'bank_code', $objCustomer->getBankCode(), false, '', '', '');
     $objForm->addField('Inhaber', 'input', 'bank_account_owner', $objCustomer->getBankAccountOwner(), false, '', '', '');
     $objForm->addField('IBAN', 'input', 'bank_iban', $objCustomer->geBankIBAN(), false, '', '', '');
     $objForm->addField('BIC', 'input', 'bank_bic', $objCustomer->getBankBIC(), false, '', '', '');
     $objForm->addSubmitButton('Änderungen speichern');
     // save button
     $objForm->output();
     if ($objForm->isSubmittedAndValid()) {
         $arrData = $_POST;
         unset($arrData['submitted']);
         // unset "garbage" of HTMLFORM Class
         unset($arrData['submitButton']);
         $arrResult = $objDataCustomer->updateCustomerProposal($this->objUserAuth->getCustomerId(), $arrData);
         if (false != $arrResult->getProposedChanges()) {
             $this->setMessage('Wir haben Ihre Änderungen erhalten und werden diese nach einer Überprüfung endgültig in unser System aufnehmen');
             $this->redirectTo('mydata', 'index');
         }
     } else {
         if (false != $objCustomer->getProposedChanges()) {
             $this->setMessage('Ihre zuvor übermittelten Änderungen wurden noch nicht endgültig ins unser System übernommen', 'error');
         }
     }
 }