From d2f574d8c46989dda2338d6a4bef10e34db3731f Mon Sep 17 00:00:00 2001 From: sparkyx Date: Sat, 22 Nov 2025 14:54:42 +0100 Subject: [PATCH] QuickCode : default = base for accounting + card name --- include/class/card_property.class.php | 18 ++++++++++++++---- include/class/fiche.class.php | 14 ++++++++++++-- include/lib/icard.class.php | 2 +- include/lib/message_javascript.php | 2 +- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/include/class/card_property.class.php b/include/class/card_property.class.php index c1b239aee..6a887a570 100644 --- a/include/class/card_property.class.php +++ b/include/class/card_property.class.php @@ -230,6 +230,19 @@ class Card_Property $result['label']=$this->ad_text; return $result; } + // Warning length quickcode + if ($this->ad_id == ATTR_DEF_QUICKCODE) { + $result['input'] = new IText(); + $result['input']->css_size = "100%"; + $result['input']->label = $this->ad_text; + $result['input']->name = "av_text" . $this->ad_id; + $result['input']->value = $this->av_text; + $result['input']->placeholder= "999NOM"; + $result['bulle'] = Icon_Action::warnbulle(76); + $result['label']=$this->ad_text; + return $result; + } + switch ($this->ad_type) { case 'text': $result['input'] = new IText(); @@ -303,10 +316,7 @@ class Card_Property $result['bulle'] = Icon_Action::infobulle(21); } - // Warning length quickcode - if ($this->ad_id == ATTR_DEF_QUICKCODE) { - $result['bulle'] = Icon_Action::warnbulle(76); - } + return $result; } diff --git a/include/class/fiche.class.php b/include/class/fiche.class.php index b5e349ff7..f9a031cda 100644 --- a/include/class/fiche.class.php +++ b/include/class/fiche.class.php @@ -524,6 +524,16 @@ class Fiche { $p_array["av_text".ATTR_DEF_QUICKCODE]=""; } + // by default the quick_code is the base account of the class + first letters of the name + if ( $p_array["av_text".ATTR_DEF_QUICKCODE] =="") + { + $base_acc=$this->cn->get_value("select fd_class_base from fiche_def where fd_id = $1", + [$p_fiche_def]); + $p_array["av_text".ATTR_DEF_QUICKCODE]=sprintf("%s%s" + , substr($base_acc,0, 3) + , substr($p_array["av_text".ATTR_DEF_NAME], 0, 4) + ); + } $sql=sprintf("select insert_quick_code(%d,'%s')", $fiche_id, sql_string($p_array['av_text'.ATTR_DEF_QUICKCODE])); $this->cn->exec_sql($sql); @@ -553,9 +563,9 @@ class Fiche } catch (Exception $e) { - record_log("FIC603".$e->getMessage()." ".$e->getTraceAsString()); + record_log($e); $this->cn->rollback(); - throw ($e); + throw (new \Exception ("F561 ". __CLASS__.".".__FUNCTION__,561,$e)); return; } return; diff --git a/include/lib/icard.class.php b/include/lib/icard.class.php index ce842b72e..184eb41b8 100644 --- a/include/lib/icard.class.php +++ b/include/lib/icard.class.php @@ -65,7 +65,7 @@ $W1->set_attribute('typecard','deb'); $W1->extra='deb'; - +O // Add the callback function to filter the card on the jrn $W1->set_callback('filter_card'); diff --git a/include/lib/message_javascript.php b/include/lib/message_javascript.php index 55539721b..0e8ff660b 100644 --- a/include/lib/message_javascript.php +++ b/include/lib/message_javascript.php @@ -107,7 +107,7 @@ content[72]=""; content[74]=""; content[75]=""; -content[76]=""; +content[76]=""; content[77]=""; content[78]="";