contact_delete($_SESSION['user']['PARTY_ID'], ORDER_CONTACTS); contact_add($_SESSION['user']['PARTY_ID'], COMPANY_CONTACT, array(CNT_ATTR_NAME => $_POST['NAME'], CNT_ATTR_STREET => $_POST['STREET'], CNT_ATTR_POSTAL => $_POST['POSTAL'], CNT_ATTR_CITY => $_POST['CITY'], CNT_ATTR_COUNTRY => $_POST['COUNTRY'], CNT_ATTR_PHONE => $_POST['PHONE'])); contact_add($_SESSION['user']['PARTY_ID'], CONTACT_PERSON_CONTACT, array(CNT_ATTR_EMAIL => $_POST['CONTACT_EMAIL'], CNT_ATTR_PHONE => $_POST['CONTACT_PHONE'])); contact_add($_SESSION['user']['PARTY_ID'], ORDER_CONTACTS, array(CNT_ATTR_EMAIL => $_POST['ORDER_EMAIL'], CNT_ATTR_FTP_ADDR => $_POST['ORDER_FTP_ADDRESS'], CNT_ATTR_FTP_USER => $_POST['ORDER_FTP_USER'], CNT_ATTR_FTP_PASS => $_POST['ORDER_FTP_PASS'])); $success[] = 'Your profile has been updated'; } catch (Exception $e) { $errors[] = $e->getMessage(); } } } // Getting clients data $customer = person_get($_SESSION['user']['PARTY_ID']); $user_login = users_get_login($_SESSION['user']['PARTY_ID']); $affiliate = person_affiliate_get($_SESSION['user']['PARTY_ID']); $contacts = contact_mech_get($_SESSION['user']['PARTY_ID'], COMPANY_CONTACT); $contact_attributes = array(); foreach ($contacts['attributes'] as $_attr) { $contact_attributes[$_attr['ATTR_NAME']] = $_attr['ATTR_VALUE']; } $contact_person_contacts = contact_mech_get($_SESSION['user']['PARTY_ID'], CONTACT_PERSON_CONTACT); foreach ($contact_person_contacts['attributes'] as $_attr) { $contact_person['CONTACT_' . $_attr['ATTR_NAME']] = $_attr['ATTR_VALUE']; } $order_contacts = contact_mech_get($_SESSION['user']['PARTY_ID'], ORDER_CONTACTS); foreach ($order_contacts['attributes'] as $_attr) { $order_contacts_attributes['ORDER_' . $_attr['ATTR_NAME']] = $_attr['ATTR_VALUE']; } } $template = set_template('users', 'profile'); $link = THEME . 'template.php'; require_once $link;
if (trim($_val) == '') { $errors[] = 'Please fill in all mandatory fields for the new alernative address!'; break; } } } // If everything has gone OK we add the address to the order // shipment record if (empty($errors)) { $dest_address = contact_add($_SESSION['user']['PARTY_ID'], ALTERNATIVE_CONTACT, $_POST[ALTERNATIVE_CONTACT]); } break; case 'company': // Nothing much to do here, if the user has selected company we add // the company address to the delivery options $company_address = contact_mech_get($_SESSION['user']['PARTY_ID'], COMPANY_CONTACT); $dest_address = $company_address['CONTACT_MECH_ID']; $requisition_uploaded = true; break; default: $errors[] = 'You have to select address for delivery!'; break; } } // Checking the additional email $additional_email = forms_post('HANDLING_INSTRUCTIONS'); if (!empty($additional_email)) { if (!filter_var($additional_email, FILTER_VALIDATE_EMAIL)) { $errors[] = 'The additional email provided is incorrect'; } }