/** * Edit a Customer * @author Reto Kohli <*****@*****.**> */ function view_customer_edit() { global $_ARRAYLANG; self::$objTemplate->loadTemplateFile("module_shop_edit_customer.html"); $customer_id = isset($_REQUEST['customer_id']) ? intval($_REQUEST['customer_id']) : null; if (isset($_POST['store'])) { $customer_id = $this->storeCustomerFromPost(); } $username = isset($_POST['username']) ? trim(strip_tags(contrexx_input2raw($_POST['username']))) : null; $password = isset($_POST['password']) ? trim(strip_tags(contrexx_input2raw($_POST['password']))) : null; $company = isset($_POST['company']) ? trim(strip_tags(contrexx_input2raw($_POST['company']))) : null; $gender = isset($_POST['gender']) ? trim(strip_tags(contrexx_input2raw($_POST['gender']))) : null; $firstname = isset($_POST['firstname']) ? trim(strip_tags(contrexx_input2raw($_POST['firstname']))) : null; $lastname = isset($_POST['lastname']) ? trim(strip_tags(contrexx_input2raw($_POST['lastname']))) : null; $address = isset($_POST['address']) ? trim(strip_tags(contrexx_input2raw($_POST['address']))) : null; $city = isset($_POST['city']) ? trim(strip_tags(contrexx_input2raw($_POST['city']))) : null; $zip = isset($_POST['zip']) ? trim(strip_tags(contrexx_input2raw($_POST['zip']))) : null; $country_id = isset($_POST['country_id']) ? intval($_POST['country_id']) : null; $phone = isset($_POST['phone']) ? trim(strip_tags(contrexx_input2raw($_POST['phone']))) : null; $fax = isset($_POST['fax']) ? trim(strip_tags(contrexx_input2raw($_POST['fax']))) : null; $email = isset($_POST['email']) ? trim(strip_tags(contrexx_input2raw($_POST['email']))) : null; $companynote = isset($_POST['companynote']) ? trim(strip_tags(contrexx_input2raw($_POST['companynote']))) : null; $is_reseller = isset($_POST['customer_type']) ? intval($_POST['customer_type']) : null; $registerdate = time(); $active = !empty($_POST['active']); $customer_group_id = isset($_POST['customer_group_id']) ? intval($_POST['customer_group_id']) : null; $lang_id = isset($_POST['customer_lang_id']) ? intval($_POST['customer_lang_id']) : FRONTEND_LANG_ID; if ($customer_id) { $objCustomer = Customer::getById($customer_id); if (!$objCustomer) { return \Message::error($_ARRAYLANG['TXT_SHOP_CUSTOMER_ERROR_LOADING']); } self::$pageTitle = $_ARRAYLANG['TXT_EDIT_CUSTOMER']; $username = $objCustomer->username(); $password = ''; $company = $objCustomer->company(); $gender = $objCustomer->gender(); $firstname = $objCustomer->firstname(); $lastname = $objCustomer->lastname(); $address = $objCustomer->address(); $city = $objCustomer->city(); $zip = $objCustomer->zip(); $country_id = $objCustomer->country_id(); $phone = $objCustomer->phone(); $fax = $objCustomer->fax(); $email = $objCustomer->email(); $companynote = $objCustomer->companynote(); $is_reseller = $objCustomer->is_reseller(); $registerdate = $objCustomer->getRegistrationDate(); $active = $objCustomer->active(); $customer_group_id = $objCustomer->group_id(); $lang_id = $objCustomer->getFrontendLanguage(); } else { self::$pageTitle = $_ARRAYLANG['TXT_ADD_NEW_CUSTOMER']; self::$objTemplate->setVariable('SHOP_SEND_LOGING_DATA_STATUS', \Html::ATTRIBUTE_CHECKED); $customer_id = null; } self::$objTemplate->setVariable(array('SHOP_CUSTOMERID' => $customer_id, 'SHOP_COMPANY' => $company, 'SHOP_GENDER_MENUOPTIONS' => Customers::getGenderMenuoptions($gender), 'SHOP_LASTNAME' => $lastname, 'SHOP_FIRSTNAME' => $firstname, 'SHOP_ADDRESS' => $address, 'SHOP_ZIP' => $zip, 'SHOP_CITY' => $city, 'SHOP_EMAIL' => $email, 'SHOP_PHONE' => $phone, 'SHOP_FAX' => $fax, 'SHOP_USERNAME' => $username, 'SHOP_PASSWORD' => $password, 'SHOP_COMPANY_NOTE' => $companynote, 'SHOP_REGISTER_DATE' => date(ASCMS_DATE_FORMAT_DATETIME, $registerdate), 'SHOP_COUNTRY_MENUOPTIONS' => \Cx\Core\Country\Controller\Country::getMenuoptions($country_id), 'SHOP_DISCOUNT_GROUP_CUSTOMER_MENUOPTIONS' => Discount::getMenuOptionsGroupCustomer($customer_group_id), 'SHOP_CUSTOMER_TYPE_MENUOPTIONS' => Customers::getTypeMenuoptions($is_reseller), 'SHOP_CUSTOMER_ACTIVE_MENUOPTIONS' => Customers::getActiveMenuoptions($active), 'SHOP_LANG_ID_MENUOPTIONS' => \FWLanguage::getMenuoptions($lang_id))); return true; }