From e2b640420083cf3e2531914d0b81d4b1356a6f14 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Sun, 11 Feb 2024 16:59:01 +0100 Subject: [PATCH] Fix : auto numbering receipt --- include/class/acc_ledger.class.php | 2 +- include/class/acc_ledger_purchase.class.php | 4 ++-- include/class/acc_ledger_sale.class.php | 8 +++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/class/acc_ledger.class.php b/include/class/acc_ledger.class.php index 1ee0c9ab0..c6db9798f 100644 --- a/include/class/acc_ledger.class.php +++ b/include/class/acc_ledger.class.php @@ -1534,7 +1534,7 @@ class Acc_Ledger extends jrn_def_sql $acc_end->pj=$e_pj; /* if e_suggest != e_pj then do not increment sequence */ - if (strcmp($e_pj, $e_pj_suggest)==0&&noalyss_strlentrim($e_pj)!=0) + if ($e_pj == $e_pj_suggest &&noalyss_strlentrim($e_pj)!=0) { $this->inc_seq_pj(); } diff --git a/include/class/acc_ledger_purchase.class.php b/include/class/acc_ledger_purchase.class.php index 9722f4ee7..e0f1323c9 100644 --- a/include/class/acc_ledger_purchase.class.php +++ b/include/class/acc_ledger_purchase.class.php @@ -920,8 +920,8 @@ class Acc_Ledger_Purchase extends Acc_Ledger $this->db->exec_sql('update quant_purchase set qp_internal = $1 where j_id in (select j_id from jrnx where j_grpt=$2)', array($internal,$seq)); - /**= e_pj then do not increment sequence */ - if ( strcmp($e_pj,$e_pj_suggest) == 0 && noalyss_strlentrim($e_pj) != 0 ) + /**= e_pj then do not increment sequence , if the given receipt number is equal to one computed then increment */ + if ($e_pj == $this->pj && noalyss_strlentrim($e_pj) != 0) { { $this->inc_seq_pj(); } diff --git a/include/class/acc_ledger_sale.class.php b/include/class/acc_ledger_sale.class.php index bfee92fa6..a50876206 100644 --- a/include/class/acc_ledger_sale.class.php +++ b/include/class/acc_ledger_sale.class.php @@ -619,9 +619,11 @@ class Acc_Ledger_Sale extends Acc_Ledger { $this->pj = $acc_operation->set_pj(); - /* * = e_pj then do not increment sequence */ - /* and e_pj is not null */ - if (strcmp($e_pj, $e_pj_suggest) == 0 && noalyss_strlentrim($e_pj) != 0) { + /** + * + * if the given receipt number is equal to one computed then increment + */ + if ($e_pj == $this->pj && noalyss_strlentrim($e_pj) != 0) { $this->inc_seq_pj(); }