Exemplo n.º 1
0
$oID = $_GET['oID'];
$payment_mode = $_GET['payment_mode'];
$action = isset($_GET['action']) ? $_GET['action'] : '';
$so = new super_order($oID);
// the following "if" clause actually inputs data into the DB
if ($_GET['process'] == '1') {
    switch ($action) {
        // add a new payment entry
        case 'add':
            $update_status = isset($_GET['update_status']) ? $_GET['update_status'] : false;
            $notify_customer = isset($_GET['notify_customer']) ? $_GET['notify_customer'] : false;
            //update_status($oID, $new_status, $notified = 0, $comments = '')
            switch ($payment_mode) {
                case 'payment':
                    // input new data
                    $new_index = $so->add_payment($_GET['payment_number'], $_GET['payment_name'], $_GET['payment_amount'], $_GET['payment_type'], $_GET['purchase_order_id']);
                    // update order status
                    if ($update_status) {
                        if ($_GET['purchase_order_id']) {
                            update_status($oID, AUTO_STATUS_PO_PAYMENT, $notify_customer, sprintf(AUTO_COMMENTS_PO_PAYMENT, $_GET['payment_number']));
                        } else {
                            update_status($oID, AUTO_STATUS_PAYMENT, $notify_customer, sprintf(AUTO_COMMENTS_PAYMENT, $_GET['payment_number']));
                        }
                    }
                    // notify the customer
                    if ($notify_customer) {
                        $_POST['notify_comments'] = 'on';
                        email_latest_status($oID);
                    }
                    // redirect to confirmation screen
                    zen_redirect(zen_href_link(FILENAME_SUPER_PAYMENTS, 'oID=' . $so->oID . '&payment_mode=' . $payment_mode . '&index=' . $new_index . '&action=confirm', 'NONSSL'));