X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sales%2Fincludes%2Fcart_class.inc;h=64a237f320aa824db88f3377e653e6615cbc7132;hb=84ebe8b3ebc1fc3e6508d75a4f39ce4a868b0b14;hp=4b01809feba94a838edcec70a395ef0c93241c61;hpb=09914b87d1eaf8e59b0fea604e277706bd2c1f06;p=fa-stable.git diff --git a/sales/includes/cart_class.inc b/sales/includes/cart_class.inc index 4b01809f..64a237f3 100644 --- a/sales/includes/cart_class.inc +++ b/sales/includes/cart_class.inc @@ -71,7 +71,8 @@ class cart var $payment; var $payment_terms; // cached payment terms var $credit; - + var $ex_rate; + //------------------------------------------------------------------------- // // $trans_no==0 => open new/direct document @@ -92,7 +93,28 @@ class cart $this->read($type, $trans_no, $prep_child); $this->cart_id = uniqid(''); } - + + /* + Optional sorting items by stock_id. + */ + function _cmp_lines($a, $b) + { + return strcmp($a->stock_id, $b->stock_id); + } + + /* + Returns items array optionally sorted by item code. + */ + function get_items() + { + global $sort_sales_items; + + $items = $this->line_items; + if (@$sort_sales_items) + uasort($items, array($this, '_cmp_lines')); + + return $items; + } // // Prepare cart to new child document entry, just after initial parent doc read. //