X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sales%2Fincludes%2Fcart_class.inc;h=40fb2a3f2fef9bf9798e92440b23cf2d76280467;hb=aa2ff78063656a7843d763859e3b9b4c15a3f920;hp=cc7d15675b660a8437f6f08c7e8fbd94c0d6d58c;hpb=6dd72f4aebd5f2650c485e7e2b1a7326e9d6e384;p=fa-stable.git diff --git a/sales/includes/cart_class.inc b/sales/includes/cart_class.inc index cc7d1567..40fb2a3f 100644 --- a/sales/includes/cart_class.inc +++ b/sales/includes/cart_class.inc @@ -243,6 +243,11 @@ class cart // $policy - 0 or 1: writeoff/return for IV, back order/cancel for DN function write($policy=0) { begin_transaction(); // prevents partial database changes in case of direct delivery/invoice + if ($this->reference != 'auto' && $this->trans_no == 0 && !is_new_reference($this->reference, $this->trans_type)) + { + commit_transaction(); + return -1; + } if (count($this->src_docs) == 0 && ($this->trans_type == ST_SALESINVOICE || $this->trans_type == ST_CUSTDELIVERY)) { // this is direct document - first add parent $ref = $this->reference;