git-svn-id: http://svn.cleancode.org/svn/pickles@129 4d10bc64-7434-11dc-a737-d2d0f8310089
50 lines
1.4 KiB
PHP
50 lines
1.4 KiB
PHP
<?php
|
|
|
|
class store_admin_orders_save extends store_admin {
|
|
|
|
protected $display = DISPLAY_JSON;
|
|
|
|
public function __default() {
|
|
|
|
// Breaks apart the status into the ID and text
|
|
list($status_id, $status) = split('\|', $_REQUEST['status']);
|
|
|
|
// Breaks apart the shipping method into the ID and text
|
|
list($shipping_id, $shipping_method) = split('\|', $_REQUEST['shipping_method']);
|
|
|
|
// Update orders.shipping_id, orders.shipping_note, orders.tracking_number
|
|
$this->db->execute('
|
|
UPDATE orders
|
|
SET
|
|
shipping_id = "' . $shipping_id . '",
|
|
tracking_number = "' . $_REQUEST['tracking_number'] . '"
|
|
WHERE id = "' . $_REQUEST['id'] . '";
|
|
');
|
|
|
|
// Insert a record into the order status updates table
|
|
$this->db->execute('
|
|
INSERT INTO order_status_updates (
|
|
order_id, user_id, status_id, note, update_time
|
|
) VALUES (
|
|
"' . $_REQUEST['id'] . '",
|
|
"' . $_SESSION['user_id'] . '",
|
|
"' . $status_id . '",
|
|
"' . $_REQUEST['shipping_note'] . '",
|
|
NOW()
|
|
);
|
|
');
|
|
|
|
// Generates the email to the customer and the packing slip
|
|
$sender = new store_admin_orders_send($this->config, $this->db, $this->mailer, $this->error);
|
|
|
|
// Sends the message to the customer
|
|
$sender->send($status_id, $status, $shipping_id, $shipping_method, $_REQUEST['shipping_note']);
|
|
|
|
$this->packing_slip = $sender->packing_slip;
|
|
|
|
$this->setPublic('status', 'Success');
|
|
$this->setPublic('message', 'The order has been updated successfully.');
|
|
}
|
|
}
|
|
|
|
?>
|