noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 02/10: If card already used in accountancy, c


From: dwm
Subject: [Noalyss-commit] [noalyss] 02/10: If card already used in accountancy, cannot changed the quickcode
Date: Sun, 25 Feb 2024 13:17:42 -0500 (EST)

sparkyx pushed a commit to branch devel
in repository noalyss.

commit 1c6fcf0561b027caff9c7b653c1a06f20aa529a5
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Sun Feb 18 17:59:21 2024 +0100

    If card already used in accountancy, cannot changed the quickcode
---
 include/class/card_property.class.php | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/include/class/card_property.class.php 
b/include/class/card_property.class.php
index 7a30159c7..58c7f73d0 100644
--- a/include/class/card_property.class.php
+++ b/include/class/card_property.class.php
@@ -494,11 +494,14 @@ class Card_Property
                 }
                 
                 // Special traitement
-                // quickcode
+                // quickcode , if already used in ledger , it cannot be changed
                 if ($value->ad_id==ATTR_DEF_QUICKCODE)
                 {
-                    $sql=sprintf("select update_quick_code(%d,'%s')", $jft_id, 
sql_string($value->av_text));
-                    $p_fiche->cn->exec_sql($sql);
+                    $used = $p_fiche->cn->get_value("select count(*) from jrnx 
where j_qcode= $1",[$value->av_text]);
+                    if ($used == 0) {
+                        $sql=sprintf("select update_quick_code(%d,'%s')", 
$jft_id, sql_string($value->av_text));
+                        $p_fiche->cn->exec_sql($sql);
+                    }
                     continue;
                 }
                 // name



reply via email to

[Prev in Thread] Current Thread [Next in Thread]