示例#1
0
function handle_submit(&$selected_id)
{
    global $path_to_root, $Ajax, $auto_create_branch;
    if (!can_process()) {
        return;
    }
    if ($selected_id) {
        update_customer($_POST['customer_id'], $_POST['CustName'], $_POST['cust_ref'], $_POST['address'], $_POST['tax_id'], $_POST['curr_code'], $_POST['dimension_id'], $_POST['dimension2_id'], $_POST['credit_status'], $_POST['payment_terms'], input_num('discount') / 100, input_num('pymt_discount') / 100, input_num('credit_limit'), $_POST['sales_type'], $_POST['notes']);
        update_record_status($_POST['customer_id'], $_POST['inactive'], 'debtors_master', 'debtor_no');
        $Ajax->activate('customer_id');
        // in case of status change
        display_notification(_("Customer has been updated."));
    } else {
        //it is a new customer
        begin_transaction();
        add_customer($_POST['CustName'], $_POST['cust_ref'], $_POST['address'], $_POST['tax_id'], $_POST['curr_code'], $_POST['dimension_id'], $_POST['dimension2_id'], $_POST['credit_status'], $_POST['payment_terms'], input_num('discount') / 100, input_num('pymt_discount') / 100, input_num('credit_limit'), $_POST['sales_type'], $_POST['notes']);
        $selected_id = $_POST['customer_id'] = db_insert_id();
        if (isset($auto_create_branch) && $auto_create_branch == 1) {
            add_branch($selected_id, $_POST['CustName'], $_POST['cust_ref'], $_POST['address'], $_POST['salesman'], $_POST['area'], $_POST['tax_group_id'], '', get_company_pref('default_sales_discount_act'), get_company_pref('debtors_act'), get_company_pref('default_prompt_payment_act'), $_POST['location'], $_POST['address'], 0, 0, $_POST['ship_via'], $_POST['notes']);
            $selected_branch = db_insert_id();
            add_crm_person($_POST['CustName'], $_POST['cust_ref'], '', $_POST['address'], $_POST['phone'], $_POST['phone2'], $_POST['fax'], $_POST['email'], '', '');
            add_crm_contact('cust_branch', 'general', $selected_branch, db_insert_id());
        }
        commit_transaction();
        display_notification(_("A new customer has been added."));
        if (isset($auto_create_branch) && $auto_create_branch == 1) {
            display_notification(_("A default Branch has been automatically created, please check default Branch values by using link below."));
        }
        $Ajax->activate('_page_body');
    }
}
示例#2
0
     if (empty($first_name)) {
         display_error('First name is a required field.');
     }
     if (empty($last_name)) {
         display_error('Last name is a required field.');
     }
     // Only validate the passwords if they are NOT empty
     if (!empty($password_1) && !empty($password_2)) {
         if ($password_1 !== $password_2) {
             display_error('Passwords do not match.');
         } elseif (strlen($password_1) < 6) {
             display_error('Password must be at least six characters.');
         }
     }
     // Update the customer data
     update_customer($customer_id, $email, $first_name, $last_name, $password_1, $password_2);
     // Set the new customer data in the session
     $_SESSION['user'] = get_customer($customer_id);
     redirect('.');
     break;
 case 'view_address_edit':
     // Set up variables for address type
     $billing = $_POST['address_type'] == 'billing';
     if ($billing) {
         $address_id = $_SESSION['user']['billingAddressID'];
         $heading = 'Update Billing Address';
     } else {
         $address_id = $_SESSION['user']['shipAddressID'];
         $heading = 'Update Shipping Address';
     }
     // Get the data for the address
             $row = db_fetch_assoc($result);
             if (!$row) {
                 add_customer($name, $name, $addr, $tax_id, $currency, $_POST['dimension_id'], $_POST['dimension2_id'], 1, $_POST['payment_terms'], 0, 0, input_num('credit_limit'), $_POST['sales_type'], NULL);
                 if ($debug_sql) {
                     display_notification("INSERT DM " . $sql);
                 }
                 db_query($sql, "The customer could not be added");
                 $id = db_insert_id();
                 add_branch($id, $name, $name, $addr, $_POST['salesman'], $area_code, $taxgid, $_POST['sales_account'], $_POST['sales_discount_account'], $_POST['receivables_account'], $_POST['payment_discount_account'], $_POST['default_location'], $addr, 0, 0, 1, NULL);
                 if ($debug_sql) {
                     display_notification("INSERT BR " . $sql);
                 }
                 display_notification("Added New Customer {$name}");
                 $i++;
             } else {
                 update_customer($row['debtor_no'], $name, $name, $addr, $tax_id, $currency, $_POST['dimension_id'], $_POST['dimension2_id'], 1, $_POST['payment_terms'], 0, 0, input_num('credit_limit'), $_POST['sales_type'], NULL);
                 if ($debug_sql) {
                     display_notification("UPDATE DM " . $sql);
                 }
                 display_notification("Updated Customer {$name}");
                 $j++;
             }
             if ((int) $cust['customers_id'] > $lastcid) {
                 $sql = "UPDATE  " . TB_PREF . "oscommerce SET value = " . $cust['customers_id'] . " WHERE name = 'lastcid'";
                 db_query($sql, "Update 'lastcid'");
             }
         }
         display_notification("{$i} customer posts created, {$j} customer posts updated.");
     }
 }
 if ($action == 'o_import') {
示例#4
0
                    header("Location: .?action=list_customer");
                }
            } else {
                if ($action == 'show_add_form') {
                    include 'customer_add.php';
                } else {
                    if ($action == 'customer_set_update') {
                        $customerID = filter_input(INPUT_POST, 'customerID');
                        $firstName = filter_input(INPUT_POST, 'firstName');
                        $lastName = filter_input(INPUT_POST, 'lastName');
                        $address = filter_input(INPUT_POST, 'address');
                        $city = filter_input(INPUT_POST, 'city');
                        $state = filter_input(INPUT_POST, 'state');
                        $postalCode = filter_input(INPUT_POST, 'postalCode');
                        $countryCode = filter_input(INPUT_POST, 'countryCode');
                        $phone = filter_input(INPUT_POST, 'phone');
                        $email = filter_input(INPUT_POST, 'email');
                        $password = filter_input(INPUT_POST, 'password');
                        if ($customerID == NULL || $customerID == FALSE || $firstName == NULL || $firstName == FALSE || $address == NULL || $address == FALSE || $city == NULL || $city == FALSE || $state == NULL || $state == FALSE || $state == NULL || $state == FALSE || $postalCode == NULL || $postalCode == FALSE || $countryCode == NULL || $countryCode == FALSE || $phone == NULL || $phone == FALSE || $email == NULL || $email == FALSE || $password == NULL || $password == FALSE) {
                            $error = "Missing or incorrect technician informatino.";
                            include '../errors/error.php';
                        } else {
                            update_customer($customerID, $firstName, $lastName, $address, $city, $state, $postalCode, $countryCode, $phone, $email, $password);
                            header("Location: .?action=list_customer");
                        }
                    }
                }
            }
        }
    }
}
示例#5
0
     $responseArray['response'] = get_users($values);
     $responseArray['message'] = 'Users successfully read';
     break;
 case 'update_user':
     include_once __DIR__ . '/customers/update_user.php';
     $responseArray['response'] = update_user($values);
     $responseArray['message'] = 'User updated.';
     break;
 case 'add_customer':
     include_once __DIR__ . '/customers/add_customer.php';
     $responseArray['response'] = add_customer($values);
     $responseArray['message'] = 'Customer successfully added';
     break;
 case 'update_customer':
     include_once __DIR__ . '/customers/update_customer.php';
     $responseArray['response'] = update_customer($values);
     $responseArray['message'] = 'Customer updated.';
     break;
 case 'get_customers':
     include_once __DIR__ . '/customers/get_customers.php';
     $responseArray['response'] = get_customers($values);
     $responseArray['message'] = 'Customers successfully read';
     break;
 case 'verify_user':
     include_once __DIR__ . '/customers/verify_user.php';
     $responseArray['response'] = verify_user($values);
     $responseArray['message'] = 'User verified';
     break;
 case "verify_admin":
     include_once __DIR__ . '/customers/verify_admin.php';
     $responseArray['response'] = verify_admin($values);
示例#6
0
             if ($status) {
                 $output .= "發送報價單給客戶中";
             } else {
                 $output .= "報價單傳送發生錯誤";
             }
             /* ############################### */
         } else {
             $data = array();
             // Reset data
         }
     }
 } else {
     /* ##### Change Customer Data ##### */
     if (isset($_POST["change"]) && $_POST["change"] == "修改") {
         $cid = $data["select_cid"];
         if (update_customer($data)) {
             $output = "客戶資料更新完成~";
         } else {
             $output = "客戶資料更新發生問題";
         }
     } else {
         if (isset($_POST["delete"]) && $_POST["delete"] == "刪除") {
             $cid = $data["select_cid"];
             if (delete_customer($cid)) {
                 $output = "資料刪除完成~";
                 unset($cid);
                 $data = array();
                 $_POST["display_form"] = "no";
             } else {
                 $output = "客戶資料刪除發生問題";
             }
示例#7
0
    $customer['billingStreet'] = $_POST['billingStreet'];
    $customer['billingCity'] = $_POST['billingCity'];
    $customer['billingState'] = $_POST['billingState'];
    $customer['billingZipCode'] = $_POST['billingZipCode'];
    if ($order['pickupType'] == 'D') {
        $customer['shippingStreet'] = $_POST['shippingStreet'];
        $customer['shippingCity'] = $_POST['shippingCity'];
        $customer['shippingState'] = $_POST['shippingState'];
        $customer['shippingZipCode'] = $_POST['shippingZipCode'];
    }
    $customer['cardTypeID'] = $_POST['cardTypeID'];
    $customer['cardNumber'] = $_POST['cardNumber'];
    $customer['cardExpMonth'] = $_POST['cardExpMonth'];
    $customer['cardExpYear'] = $_POST['cardExpYear'];
    if ($formValidation) {
        update_customer($customer);
        header("Location:step5.php");
    }
}
?>

<div class="container">
    <div class="back">
        <div class="resultContainer">

            <h1 class="text-center">Order Summary</h1>
            <form action="step4.php" method="post" id="placeOrderForm">
                <input type="hidden" name="placeOrder" value="true"/>
                <div id="orderedItems" class="resultItem">
                    <h4 class="title">Ordered Items:</h4>
                    <table class="ordertable">
示例#8
0
<?php

require_once 'include.php';
if (!xml2php("customer")) {
    $smarty->assign('error_msg', "Error in language file");
}
/* load customer details */
$customer_details = display_customer_info($db, $VAR['customer_id']);
if (isset($VAR['submit'])) {
    if (!update_customer($db, $VAR)) {
        force_page('customer', 'edit&error_msg=Falied to Update Customer Information&customer_id=' . $VAR['customer_id']);
        exit;
    } else {
        force_page('customer', 'customer_details&msg=The Customers information was updated&customer_id=' . $VAR['customer_id'] . '&page_title=' . $VAR['displayName']);
        exit;
    }
} else {
    $smarty->assign('customer', $customer_details);
    $smarty->display('customer' . SEP . 'edit.tpl');
}
 public function put($rest, $id)
 {
     $req = $rest->request();
     $info = $req->post();
     $cust = get_customer($id);
     if ($cust == null) {
         api_error(400, 'Invalid Customer ID');
     }
     // Validate Required Fields
     if (!isset($info['custname'])) {
         api_error(412, 'Customer Name is required [custname]');
     }
     if (!isset($info['cust_ref'])) {
         api_error(412, 'Customer Reference is required [cust_ref]');
     }
     if (!isset($info['address'])) {
         api_error(412, 'Address is required [address]');
     }
     if (!isset($info['tax_id'])) {
         api_error(412, 'Tax Id is required [tax_id]');
     }
     if (!isset($info['curr_code'])) {
         api_error(412, 'Currency Code is required [curr_code]');
     }
     if (!isset($info['credit_status'])) {
         // TODO Set a default initial credit status
         api_error(412, 'Credit Status is required [credit_status]');
     }
     if (!isset($info['payment_terms'])) {
         api_error(412, 'Payment Terms is required [payment_terms]');
     }
     if (!isset($info['discount'])) {
         // TODO Set default discount as 0
         api_error(412, 'Discount is required [discount]');
     }
     if (!isset($info['pymt_discount'])) {
         // TODO Set default payment discount as 0
         api_error(412, 'Payment Discount is required [pymt_discount]');
     }
     if (!isset($info['credit_limit'])) {
         // TODO Set default credit limit from company configuration
         api_error(412, 'Credit Limit is required [credit_limit]');
     }
     if (!isset($info['sales_type'])) {
         api_error(412, 'Sales Type is required [sales_type]');
     }
     if (!isset($info['notes'])) {
         $info['notes'] = '';
     }
     /*
      * $customer_id, $CustName, $cust_ref, $address, $tax_id, $curr_code, $dimension_id, $dimension2_id,
      * $credit_status, $payment_terms, $discount, $pymt_discount, $credit_limit, $sales_type, $notes
      */
     update_customer($id, $info['custname'], $info['cust_ref'], $info['address'], $info['tax_id'], $info['curr_code'], 0, 0, $info['credit_status'], $info['payment_terms'], $info['discount'], $info['pymt_discount'], $info['credit_limit'], $info['sales_type'], $info['notes']);
     api_success_response("Customer has been updated");
 }