} list($check, $errors, $error_fields) = forms_check_mandatory($mandatory, $_POST); if ($check) { try { person_update_ltd($_SESSION['user']['PARTY_ID'], $_POST['FIRST_NAME'], $_POST['LAST_NAME'], '', '', ''); users_update_login($_SESSION['user']['PARTY_ID'], $_POST['USER_LOGIN_ID'], $_POST['CURRENT_PASSWORD']); if (isset($_SESSION['FAKE_LOGIN']) && $_SESSION['FAKE_LOGIN']) { person_affiliate_update($_SESSION['user']['PARTY_ID'], $_POST['AFFILIATE_NAME'], $_POST['AFFILIATE_DESCRIPTION'], $_POST['AFFILIATE_EMAIL']); } // Saving contacts contact_delete($_SESSION['user']['PARTY_ID'], COMPANY_CONTACT); contact_delete($_SESSION['user']['PARTY_ID'], CONTACT_PERSON_CONTACT); 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']; }
$dest_address = $_POST['OLD_ALTERNATIVE_CONTACT']; break; } // Add the address to the list of the alternative addresses foreach ($_POST[ALTERNATIVE_CONTACT] as $_attr => $_val) { if ($_attr != CNT_ATTR_COUNTRY) { 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