/**
  * Returns the forms fields.
  * 
  * @param bool $withUpdate Call the method with extension updates or not?
  *
  * @return array
  */
 public function getFormFields($withUpdate = true)
 {
     if (!array_key_exists('emailaddress', $this->formFields)) {
         $this->formFields = array('emailaddress' => array('type' => 'TextField', 'title' => _t('SilvercartPage.EMAIL_ADDRESS'), 'value' => '', 'checkRequirements' => array('isFilledIn' => true)), 'password' => array('type' => 'PasswordField', 'title' => _t('SilvercartPage.PASSWORD'), 'value' => '', 'checkRequirements' => array('isFilledIn' => true)));
     }
     return parent::getFormFields($withUpdate);
 }
 /**
  * Returns the form fields.
  * 
  * @param bool $withUpdate Call extensions to update fields?
  * 
  * @return array
  */
 public function getFormFields($withUpdate = true)
 {
     if (!array_key_exists('Salutation', $this->formFields)) {
         $birthdayFields = array();
         $businessFields = array();
         if ($this->demandBirthdayDate()) {
             $birthdayDays = array('' => _t('SilvercartEditAddressForm.EMPTYSTRING_PLEASECHOOSE'));
             $birthdayMonths = array('' => _t('SilvercartEditAddressForm.EMPTYSTRING_PLEASECHOOSE'), '1' => _t('SilvercartPage.JANUARY'), '2' => _t('SilvercartPage.FEBRUARY'), '3' => _t('SilvercartPage.MARCH'), '4' => _t('SilvercartPage.APRIL'), '5' => _t('SilvercartPage.MAY'), '6' => _t('SilvercartPage.JUNE'), '7' => _t('SilvercartPage.JULY'), '8' => _t('SilvercartPage.AUGUST'), '9' => _t('SilvercartPage.SEPTEMBER'), '10' => _t('SilvercartPage.OCTOBER'), '11' => _t('SilvercartPage.NOVEMBER'), '12' => _t('SilvercartPage.DECEMBER'));
             for ($idx = 1; $idx < 32; $idx++) {
                 $birthdayDays[$idx] = $idx;
             }
             $birthdayFields = array('BirthdayDay' => array('type' => 'DropdownField', 'title' => _t('SilvercartPage.DAY'), 'value' => $birthdayDays, 'checkRequirements' => array('isFilledIn' => true)), 'BirthdayMonth' => array('type' => 'DropdownField', 'title' => _t('SilvercartPage.MONTH'), 'value' => $birthdayMonths, 'checkRequirements' => array('isFilledIn' => true)), 'BirthdayYear' => array('type' => 'TextField', 'title' => _t('SilvercartPage.YEAR'), 'maxLength' => 4, 'checkRequirements' => array('isFilledIn' => true, 'isNumbersOnly' => true, 'hasLength' => 4)));
         }
         if ($this->EnableBusinessCustomers()) {
             $businessFields = array('IsBusinessAccount' => array('type' => 'CheckboxField', 'title' => _t('SilvercartCustomer.ISBUSINESSACCOUNT')), 'TaxIdNumber' => array('type' => 'TextField', 'title' => _t('SilvercartAddress.TAXIDNUMBER'), 'maxLength' => 30, 'checkRequirements' => array('isFilledInDependantOn' => array('field' => 'IsBusinessAccount', 'hasValue' => '1'))), 'Company' => array('type' => 'TextField', 'title' => _t('SilvercartAddress.COMPANY'), 'maxLength' => 50, 'checkRequirements' => array('isFilledInDependantOn' => array('field' => 'IsBusinessAccount', 'hasValue' => '1'))));
         }
         $backlink = '';
         if (isset($_GET['backlink'])) {
             $backlink = Convert::raw2sql($_GET['backlink']);
         }
         $formFields = array('Salutation' => array('type' => 'DropdownField', 'title' => _t('SilvercartAddress.SALUTATION'), 'value' => array('' => _t('SilvercartEditAddressForm.EMPTYSTRING_PLEASECHOOSE'), 'Frau' => _t('SilvercartAddress.MISSES'), 'Herr' => _t('SilvercartAddress.MISTER')), 'checkRequirements' => array('isFilledIn' => true)), 'AcademicTitle' => array('type' => 'TextField', 'title' => _t('SilvercartAddress.AcademicTitle', 'Academic title')), 'FirstName' => array('type' => 'TextField', 'title' => _t('SilvercartAddress.FIRSTNAME', 'firstname'), 'checkRequirements' => array('isFilledIn' => true, 'hasMinLength' => 3)), 'Surname' => array('type' => 'TextField', 'title' => _t('SilvercartAddress.SURNAME', 'surname'), 'checkRequirements' => array('isFilledIn' => true, 'hasMinLength' => 3)), 'Addition' => array('type' => 'TextField', 'title' => _t('SilvercartAddress.ADDITION', 'Addition')), 'Street' => array('type' => 'TextField', 'title' => _t('SilvercartAddress.STREET', 'street'), 'checkRequirements' => array('isFilledIn' => true)), 'StreetNumber' => array('type' => 'TextField', 'title' => _t('SilvercartAddress.STREETNUMBER', 'streetnumber'), 'maxLength' => 10, 'checkRequirements' => array('isFilledIn' => true)), 'Postcode' => array('type' => 'TextField', 'title' => _t('SilvercartAddress.POSTCODE', 'postcode'), 'maxLength' => 10, 'checkRequirements' => array('isFilledIn' => true)), 'City' => array('type' => 'TextField', 'title' => _t('SilvercartAddress.CITY', 'city'), 'checkRequirements' => array('isFilledIn' => true)), 'Country' => array('type' => 'DropdownField', 'title' => _t('SilvercartCountry.SINGULARNAME'), 'value' => SilvercartCountry::getPrioritiveDropdownMap(true, _t('SilvercartCheckoutFormStep2.EMPTYSTRING_COUNTRY')), 'checkRequirements' => array('isFilledIn' => true)), 'Email' => array('type' => 'TextField', 'title' => _t('SilvercartAddress.EMAIL', 'email address'), 'checkRequirements' => array('isEmailAddress' => true, 'isFilledIn' => true, 'callBack' => 'doesEmailExistAlready')), 'EmailCheck' => array('type' => 'TextField', 'title' => _t('SilvercartAddress.EMAIL_CHECK', 'email address check'), 'checkRequirements' => array('isFilledIn' => true, 'mustEqual' => 'Email')), 'PhoneAreaCode' => array('type' => 'TextField', 'title' => _t('SilvercartAddress.PHONEAREACODE', 'phone area code'), 'checkRequirements' => array('isFilledIn' => true, 'isNumbersOnly' => true)), 'Phone' => array('type' => 'TextField', 'title' => _t('SilvercartAddress.PHONE', 'phone'), 'checkRequirements' => array('isFilledIn' => true, 'isNumbersOnly' => true)), 'Fax' => array('type' => 'TextField', 'title' => _t('SilvercartAddress.FAX')), 'Password' => array('type' => 'PasswordField', 'title' => _t('SilvercartPage.PASSWORD'), 'checkRequirements' => array('isFilledIn' => true, 'hasMinLength' => 6, 'mustNotEqual' => 'Email')), 'PasswordCheck' => array('type' => 'PasswordField', 'title' => _t('SilvercartPage.PASSWORD_CHECK'), 'checkRequirements' => array('isFilledIn' => true, 'mustEqual' => 'Password')), 'SubscribedToNewsletter' => array('type' => 'CheckboxField', 'title' => _t('SilvercartCheckoutFormStep.I_SUBSCRIBE_NEWSLETTER')), 'backlink' => array('type' => 'HiddenField', 'value' => $backlink));
         $this->formFields = array_merge($this->formFields, $formFields, $businessFields, $birthdayFields);
     }
     return parent::getFormFields($withUpdate);
 }
 /**
  * Returns the forms fields.
  * 
  * @param bool $withUpdate Call the method with decorator updates or not?
  *
  * @return array
  */
 public function getFormFields($withUpdate = true)
 {
     parent::getFormFields(false);
     if (!array_key_exists('SearchQuery', $this->formFields)) {
         $this->formFields['SearchQuery'] = array('type' => 'SilvercartTextField', 'title' => '', 'value' => '', 'maxLength' => '30', 'checkRequirements' => array('isFilledIn' => true));
         if ($withUpdate) {
             $this->extend('updateFormFields', $this->formFields);
         }
     }
     return $this->formFields;
 }
 /**
  * Returns the form fields
  * 
  * @param bool $withUpdate Execute update method of decorators?
  * 
  * @return array
  * 
  * @author Sebastian Diel <*****@*****.**>
  * @since 09.10.2012
  */
 public function getFormFields($withUpdate = true)
 {
     if (empty($this->formFields)) {
         $address = singleton('SilvercartAddress');
         $this->formFields = array('Salutation' => array('type' => 'DropdownField', 'title' => $address->fieldLabel('Salutation'), 'value' => array('' => _t('SilvercartEditAddressForm.EMPTYSTRING_PLEASECHOOSE'), "Frau" => _t('SilvercartAddress.MISSES'), "Herr" => _t('SilvercartAddress.MISTER')), 'checkRequirements' => array('isFilledIn' => true)), 'AcademicTitle' => array('type' => 'TextField', 'title' => $address->fieldLabel('AcademicTitle')), 'FirstName' => array('type' => 'TextField', 'title' => $address->fieldLabel('FirstName'), 'checkRequirements' => array('isFilledIn' => true)), 'Surname' => array('type' => 'TextField', 'title' => $address->fieldLabel('Surname'), 'checkRequirements' => array('isFilledIn' => true)), 'Addition' => array('type' => 'TextField', 'title' => $address->fieldLabel('Addition')), 'Street' => array('type' => 'TextField', 'title' => $address->fieldLabel('Street'), 'checkRequirements' => array('isFilledIn' => true)), 'StreetNumber' => array('type' => 'TextField', 'title' => $address->fieldLabel('StreetNumber'), 'checkRequirements' => array('isFilledIn' => true)), 'Postcode' => array('type' => 'TextField', 'title' => $address->fieldLabel('Postcode'), 'checkRequirements' => array('isFilledIn' => true)), 'City' => array('type' => 'TextField', 'title' => $address->fieldLabel('City'), 'checkRequirements' => array('isFilledIn' => true)), 'PhoneAreaCode' => array('type' => 'TextField', 'title' => $address->fieldLabel('PhoneAreaCode'), 'checkRequirements' => array('isFilledIn' => true)), 'Phone' => array('type' => 'TextField', 'title' => $address->fieldLabel('Phone'), 'checkRequirements' => array('isFilledIn' => true)), 'Fax' => array('type' => 'TextField', 'title' => $address->fieldLabel('Fax')), 'Country' => array('type' => 'DropdownField', 'title' => $address->fieldLabel('SilvercartCountry'), 'value' => SilvercartCountry::getPrioritiveDropdownMap(true, _t('SilvercartEditAddressForm.EMPTYSTRING_PLEASECHOOSE')), 'checkRequirements' => array('isFilledIn' => true)));
         if ($this->EnableBusinessCustomers()) {
             $this->formFields = array_merge($this->formFields, array('IsBusinessAccount' => array('type' => 'CheckboxField', 'title' => $address->fieldLabel('IsBusinessAccount')), 'TaxIdNumber' => array('type' => 'TextField', 'title' => $address->fieldLabel('TaxIdNumber'), 'maxLength' => 30, 'checkRequirements' => array('isFilledInDependantOn' => array('field' => 'IsBusinessAccount', 'hasValue' => '1'))), 'Company' => array('type' => 'TextField', 'title' => $address->fieldLabel('Company'), 'maxLength' => 50, 'checkRequirements' => array('isFilledInDependantOn' => array('field' => 'IsBusinessAccount', 'hasValue' => '1')))));
         }
         if ($this->EnablePackstation()) {
             $this->formFields = array_merge($this->formFields, array('IsPackstation' => array('type' => 'OptionsetField', 'title' => $address->fieldLabel('AddressType'), 'selectedValue' => '0', 'value' => array('0' => $address->fieldLabel('UseAbsoluteAddress'), '1' => $address->fieldLabel('UsePackstation')), 'checkRequirements' => array('isFilledIn' => true)), 'PostNumber' => array('type' => 'TextField', 'title' => $address->fieldLabel('PostNumber'), 'checkRequirements' => array('isFilledIn' => true)), 'Packstation' => array('type' => 'TextField', 'title' => $address->fieldLabel('Packstation'), 'checkRequirements' => array('isFilledIn' => true))));
         } else {
             $this->formFields = array_merge($this->formFields, array('IsPackstation' => array('type' => 'HiddenField', 'title' => $address->fieldLabel('AddressType'), 'value' => '0')));
         }
     }
     return parent::getFormFields($withUpdate);
 }
 /**
  * Returns the form fields for this form
  *
  * @param bool $withUpdate Call the method with decorator updates or not?
  * 
  * @return array
  * 
  * @author Sebastian Diel <*****@*****.**>
  * @since 13.09.2013
  */
 public function getFormFields($withUpdate = true)
 {
     if (!array_key_exists('SortOrder', $this->formFields)) {
         $productsPerPage = $this->controller->getProductsPerPageSetting();
         if ($productsPerPage == SilvercartConfig::getProductsPerPageUnlimitedNumber()) {
             $productsPerPage = 0;
         }
         $product = singleton('SilvercartProduct');
         $sortableFrontendFields = $product->sortableFrontendFields();
         $sortableFrontendFieldValues = array_keys($sortableFrontendFields);
         $sortableFrontendFieldValues = array_flip($sortableFrontendFieldValues);
         if (!array_key_exists($product->getDefaultSort(), $sortableFrontendFieldValues)) {
             $sortableFrontendFieldValues[$product->getDefaultSort()] = 0;
         }
         $sortOrder = $sortableFrontendFieldValues[$product->getDefaultSort()];
         $sortableFrontendFieldsForDropdown = array_values($sortableFrontendFields);
         asort($sortableFrontendFieldsForDropdown);
         $this->formFields = array('SortOrder' => array('type' => 'DropdownField', 'title' => _t('SilvercartProductGroupPageSelector.SORT_ORDER'), 'value' => $sortableFrontendFieldsForDropdown, 'selectedValue' => $sortOrder, 'checkRequirements' => array()));
         $productsPerPageOptions = SilvercartConfig::getProductsPerPageOptions();
         if (!empty($productsPerPageOptions)) {
             $this->formFields['productsPerPage'] = array('type' => 'DropdownField', 'title' => _t('SilvercartProductGroupPageSelector.PRODUCTS_PER_PAGE'), 'value' => SilvercartConfig::getProductsPerPageOptions(), 'selectedValue' => $productsPerPage, 'checkRequirements' => array());
         } else {
             $this->formFields['productsPerPage'] = array('type' => 'HiddenField', 'value' => SilvercartConfig::getProductsPerPageDefault());
         }
     }
     return parent::getFormFields($withUpdate = true);
 }
 /**
  * Returns the form fields
  * 
  * @param bool $withUpdate Execute update method of decorators?
  * 
  * @return array
  * 
  * @author Sebastian Diel <*****@*****.**>
  * @since 05.06.2014
  */
 public function getFormFields($withUpdate = true)
 {
     if (empty($this->formFields)) {
         $email = '';
         $orderDate = '';
         $orderNumber = '';
         $orderPositions = '';
         $orderID = '';
         $customer = SilvercartCustomer::currentRegisteredCustomer();
         if ($customer instanceof Member) {
             $email = $customer->Email;
             $address = $customer->SilvercartInvoiceAddress();
             $existingOrder = array('type' => 'DropdownField', 'title' => _t('SilvercartRevocationForm.OrderHistory'), 'value' => $customer->SilvercartOrder()->map('ID', 'Title', ' '));
             if (array_key_exists('ExistingOrder', $_POST)) {
                 $orderID = $_POST['ExistingOrder'];
             } elseif (array_key_exists('o', $_GET)) {
                 $orderID = $_GET['o'];
                 if (!is_numeric($orderID)) {
                     $orderID = '';
                 }
             }
             if (!empty($orderID)) {
                 $order = $customer->SilvercartOrder()->find('ID', $orderID);
                 if ($order instanceof SilvercartOrder && $order->exists()) {
                     $existingOrder['selectedValue'] = $orderID;
                     $address = $order->SilvercartInvoiceAddress();
                     $orderDate = date(_t('Silvercart.DATEFORMAT'), strtotime($order->Created));
                     $orderNumber = $order->OrderNumber;
                     $orderPositions = $order->getPositionsAsString(false, true);
                 }
             }
         } else {
             $address = singleton('SilvercartAddress');
             $existingOrder = array();
         }
         $this->formFields = array('RevocationOrderData' => array('type' => 'TextareaField', 'title' => _t('SilvercartRevocationForm.RevocationOrderData'), 'value' => $orderPositions), 'Email' => array('type' => 'TextField', 'title' => _t('SilvercartAddress.EMAIL'), 'value' => $email, 'checkRequirements' => array('isFilledIn' => true)), 'OrderDate' => array('type' => 'TextField', 'title' => _t('SilvercartRevocationForm.OrderDate'), 'value' => $orderDate), 'OrderNumber' => array('type' => 'TextField', 'title' => _t('SilvercartRevocationForm.OrderNumber'), 'value' => $orderNumber), 'Salutation' => array('type' => 'DropdownField', 'title' => $address->fieldLabel('Salutation'), 'value' => array('' => _t('SilvercartEditAddressForm.EMPTYSTRING_PLEASECHOOSE'), "Frau" => _t('SilvercartAddress.MISSES'), "Herr" => _t('SilvercartAddress.MISTER')), 'selectedValue' => $address->Salutation), 'FirstName' => array('type' => 'TextField', 'title' => $address->fieldLabel('FirstName'), 'value' => $address->FirstName, 'checkRequirements' => array('isFilledIn' => true)), 'Surname' => array('type' => 'TextField', 'title' => $address->fieldLabel('Surname'), 'value' => $address->Surname, 'checkRequirements' => array('isFilledIn' => true)), 'Addition' => array('type' => 'TextField', 'title' => $address->fieldLabel('Addition'), 'value' => $address->Addition), 'Street' => array('type' => 'TextField', 'title' => $address->fieldLabel('Street'), 'value' => $address->Street), 'StreetNumber' => array('type' => 'TextField', 'title' => $address->fieldLabel('StreetNumber'), 'value' => $address->StreetNumber), 'Postcode' => array('type' => 'TextField', 'title' => $address->fieldLabel('Postcode'), 'value' => $address->Postcode), 'City' => array('type' => 'TextField', 'title' => $address->fieldLabel('City'), 'value' => $address->City), 'Country' => array('type' => 'DropdownField', 'title' => $address->fieldLabel('SilvercartCountry'), 'value' => SilvercartCountry::getPrioritiveDropdownMap(true, _t('SilvercartEditAddressForm.EMPTYSTRING_PLEASECHOOSE')), 'selectedValue' => $address->SilvercartCountryID));
         if (!empty($existingOrder)) {
             $this->formFields['ExistingOrder'] = $existingOrder;
         }
     }
     return parent::getFormFields($withUpdate);
 }
 /**
  * Returns the preferences for this form
  * 
  * @param bool $withUpdate Call the method with decorator updates or not?
  *
  * @return array
  * 
  * @author Sebastian Diel <*****@*****.**>
  * @since 27.04.2012
  */
 public function getFormFields($withUpdate = true)
 {
     $this->formFields = array('Language' => array('type' => 'SilvercartLanguageDropdownField', 'title' => _t('Silvercart.LANGUAGE'), 'value' => array(), 'checkRequirements' => array('isFilledIn' => true)));
     return parent::getFormFields($withUpdate);
 }
 /**
  * Returns the form fields
  * 
  * @param bool $withUpdate Execute update method of decorators?
  * 
  * @return array
  * 
  * @author Sebastian Diel <*****@*****.**>
  * @since 15.11.2014
  */
 public function getFormFields($withUpdate = true)
 {
     if (empty($this->formFields)) {
         if (Member::currentUserID() > 0) {
             $member = SilvercartCustomer::currentUser();
         } else {
             $member = singleton('Member');
         }
         $address = singleton('SilvercartAddress');
         $this->formFields = array('Salutation' => array('type' => 'DropdownField', 'title' => $address->fieldLabel('Salutation'), 'selectedValue' => $member->Salutation, 'value' => array('' => _t('SilvercartEditAddressForm.EMPTYSTRING_PLEASECHOOSE'), "Frau" => _t('SilvercartAddress.MISSES'), "Herr" => _t('SilvercartAddress.MISTER')), 'checkRequirements' => array('isFilledIn' => true)), 'FirstName' => array('type' => 'TextField', 'title' => $address->fieldLabel('FirstName'), 'value' => $member->FirstName, 'checkRequirements' => array('isFilledIn' => true, 'hasMinLength' => 3)), 'Surname' => array('type' => 'TextField', 'title' => $address->fieldLabel('Surname'), 'value' => $member->Surname, 'checkRequirements' => array('isFilledIn' => true, 'hasMinLength' => 3)), 'Email' => array('type' => 'TextField', 'title' => $member->fieldLabel('Email'), 'value' => $member->Email, 'checkRequirements' => array('isFilledIn' => true, 'isEmailAddress' => true)), 'Message' => array('type' => 'TextareaField', 'title' => _t('SilvercartPage.MESSAGE', 'message'), 'checkRequirements' => array('isFilledIn' => true, 'hasMinLength' => 3)));
         if ($this->EnableStreet()) {
             $requirements = array();
             if ($this->StreetIsRequired()) {
                 $requirements = array('isFilledIn' => true);
             }
             $this->formFields = array_merge($this->formFields, array('Street' => array('type' => 'TextField', 'title' => $address->fieldLabel('Street') . ' / ' . $address->fieldLabel('StreetNumber'), 'checkRequirements' => $requirements), 'StreetNumber' => array('type' => 'TextField', 'title' => $address->fieldLabel('StreetNumber'), 'checkRequirements' => $requirements)));
         }
         if ($this->EnableCity()) {
             $requirements = array();
             if ($this->CityIsRequired()) {
                 $requirements = array('isFilledIn' => true);
             }
             $this->formFields = array_merge($this->formFields, array('Postcode' => array('type' => 'TextField', 'title' => $address->fieldLabel('Postcode'), 'checkRequirements' => $requirements), 'City' => array('type' => 'TextField', 'title' => $address->fieldLabel('Postcode') . ' - ' . $address->fieldLabel('City'), 'checkRequirements' => $requirements)));
         }
         if ($this->EnableCountry()) {
             $requirements = array();
             if ($this->CountryIsRequired()) {
                 $requirements = array('isFilledIn' => true);
             }
             $this->formFields = array_merge($this->formFields, array('SilvercartCountryID' => array('type' => 'DropdownField', 'title' => $address->fieldLabel('SilvercartCountry'), 'value' => SilvercartCountry::getPrioritiveDropdownMap(true, _t('SilvercartEditAddressForm.EMPTYSTRING_PLEASECHOOSE')), 'checkRequirements' => $requirements)));
         }
         if ($this->EnablePhoneNumber()) {
             $requirements = array();
             if ($this->PhoneNumberIsRequired()) {
                 $requirements = array('isFilledIn' => true);
             }
             $this->formFields = array_merge($this->formFields, array('Phone' => array('type' => 'TextField', 'title' => $address->fieldLabel('Phone'), 'checkRequirements' => $requirements)));
         }
     }
     return parent::getFormFields($withUpdate);
 }