Custom fields were not saving

This commit is contained in:
drigato 2014-06-24 12:46:11 -04:00
parent 3307cc8645
commit 73724bdd04
2 changed files with 11 additions and 6 deletions

View File

@ -125,13 +125,16 @@ class BillingController extends Zend_Controller_Action {
if ($request->isPost()) { if ($request->isPost()) {
$formData = $request->getPost(); $formData = $request->getPost();
if ($form->isValid($formData)) { if ($form->isValid($formData)) {
$credentials = self::getAPICredentials(); $credentials = self::getAPICredentials();
$postfields = array(); $postfields = array();
$postfields["username"] = $credentials["username"]; $postfields["username"] = $credentials["username"];
$postfields["password"] = md5($credentials["password"]); $postfields["password"] = md5($credentials["password"]);
$postfields["action"] = "updateclient"; $postfields["action"] = "updateclient";
$postfields["customfields"] = base64_encode(serialize($formData["customfields"]));
unset($formData["customfields"]);
//$postfields["clientid"] = Application_Model_Preference::GetClientId(); //$postfields["clientid"] = Application_Model_Preference::GetClientId();
$postfields["clientid"] = 1846; $postfields["clientid"] = 1846;
@ -140,7 +143,7 @@ class BillingController extends Zend_Controller_Action {
$postfields = array_merge($postfields, $formData); $postfields = array_merge($postfields, $formData);
unset($postfields["password2verify"]); unset($postfields["password2verify"]);
unset($postfields["submit"]); unset($postfields["submit"]);
$query_string = ""; $query_string = "";
foreach ($postfields as $k=>$v) $query_string .= "$k=".urlencode($v)."&"; foreach ($postfields as $k=>$v) $query_string .= "$k=".urlencode($v)."&";

View File

@ -140,15 +140,16 @@ class Application_Form_BillingClient extends Zend_Form
$this->addElement($securityqans); $this->addElement($securityqans);
foreach ($client["customfields"] as $field) { foreach ($client["customfields"] as $field) {
if ($field["id"] == 7) { if ($field["id"] == "7") {
$vatvalue = $field["value"]; $vatvalue = $field["value"];
} elseif ($field["id"] == 71) { } elseif ($field["id"] == "71") {
$subscribevalue = $field["value"]; $subscribevalue = $field["value"];
} }
} }
$vat = new Zend_Form_Element_Text('customfield7'); $vat = new Zend_Form_Element_Text("7");
$vat->setLabel(_('VAT/Tax ID (EU only)')) $vat->setLabel(_('VAT/Tax ID (EU only)'))
->setBelongsTo('customfields')
->setValue($vatvalue) ->setValue($vatvalue)
->setAttrib('class', 'input_text') ->setAttrib('class', 'input_text')
//->setRequired(true) //->setRequired(true)
@ -156,9 +157,10 @@ class Application_Form_BillingClient extends Zend_Form
->addFilter('StringTrim'); ->addFilter('StringTrim');
$this->addElement($vat); $this->addElement($vat);
$subscribe = new Zend_Form_Element_Checkbox('customfield71'); $subscribe = new Zend_Form_Element_Checkbox('71');
$subscribe->setLabel(_('Subscribe to Sourcefabric newsletter')) $subscribe->setLabel(_('Subscribe to Sourcefabric newsletter'))
->setValue($subscribevalue) ->setValue($subscribevalue)
->setBelongsTo('customfields')
->setAttrib('class', 'input_text') ->setAttrib('class', 'input_text')
->setRequired(true) ->setRequired(true)
->addValidator($notEmptyValidator) ->addValidator($notEmptyValidator)