display_heading(_("Purchase Order") . " #" . $_GET['trans_no']);
-if (isset($_SESSION['Items']))
-{
- unset ($_SESSION['Items']);
-}
-
$purchase_order = new purch_order;
read_po($_GET['trans_no'], $purchase_order);
var $trans_type; // invoice, order, delivery note ...
var $trans_no = array();// array (num1=>ver1,..) or 0 for new
var $so_type = 0; // for sales order: simple=0 template=1
-
+ var $cart_id; // used to detect multi-tab edition conflits
var $line_items; //array of objects of class line_details
var $src_docs = array(); // array of arrays(num1=>ver1,...) or 0 for no src
$this->dimension_id = 0;
$this->dimension2_id = 0;
$this->read($type, $trans_no, $view );
+ $this->cart_id = uniqid('');
}
//-------------------------------------------------------------------------
{
return (isset($_SESSION['Processing']) && $_SESSION['Processing']==$_SERVER['PHP_SELF']);
}
+/*
+ Check if the cart was not destroyed during opening the edition page in
+ another browser tab.
+*/
+function check_edit_conflicts($cartname='Items')
+{
+ global $Ajax;
+
+ if (isset($_POST['cart_id']) && $_POST['cart_id'] != $_SESSION[$cartname]->cart_id) {
+ display_error(_('This edit session has been abandoned by opening sales document in another browser tab. You cannot edit more than one sales document at once.'));
+ $Ajax->activate('_page_body');
+ display_footer_exit();
+ }
+}
?>
\ No newline at end of file
if (!isset($_POST['ref']))
$_POST['ref'] = references::get_next(11);
- if ($_SESSION['Items']->trans_no==0)
+ if ($order->trans_no==0)
ref_row(_("Reference").':', 'ref');
else
label_row(_("Reference").':', $_POST['ref'] );
$taxes = $order->get_taxes($_POST['ChargeFreightCost']);
- $tax_total = display_edit_tax_items($taxes, 6, $_SESSION['Items']->tax_included);
+ $tax_total = display_edit_tax_items($taxes, 6, $order->tax_included);
$display_total = price_format(($subtotal + $_POST['ChargeFreightCost'] + $tax_total));
//---------------------------------------------------------------------------------
-function credit_options_controls()
+function credit_options_controls($credit)
{
global $table_style2, $Ajax;
echo "<br>";
/*if the credit note is a return of goods then need to know which location to receive them into */
if (!isset($_POST['Location']))
- $_POST['Location'] = $_SESSION['Items']->Location;
+ $_POST['Location'] = $credit->Location;
locations_list_row(_("Items Returned to Location"), 'Location', $_POST['Location']);
}
else
} // changed branch
}
- if ($_SESSION['Items']->trans_type!=30) {
+ if ($order->trans_type != 30) {
ref_cells(_("Reference").':', 'ref', _('Reference number unique for this document type'), null, '');
}
if ($display_tax_group)
{
label_row(_("Tax Group:"), $order->tax_group_name);
- hidden('tax_group_id', $_SESSION['Items']->tax_group_id);
+ hidden('tax_group_id', $order->tax_group_id);
}
end_outer_table(1); // outer table