QuickCode : default = base for accounting + card name

This commit is contained in:
sparkyx 2025-11-22 14:54:42 +01:00
parent 44c9fd005c
commit d2f574d8c4
4 changed files with 28 additions and 8 deletions

View file

@ -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;
}

View file

@ -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;

View file

@ -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');

View file

@ -107,7 +107,7 @@ content[72]="<?php echo htmlspecialchars(_("Pour les journaux FIN, ce sera la fi
content[73]="<?php echo htmlspecialchars(_("Mettre à oui pour un journal dédié uniquement aux notes de crédit ou de débit, il affichera un avertissement si le montant n'est pas en négatif"),ENT_QUOTES);?>";
content[74]="<?php echo htmlspecialchars(_('TVA due ou récupérable quand l\'opération est payée ou exécutée'),ENT_QUOTES)?>";
content[75]="<?php echo htmlspecialchars(_('Journaux Achat ou vente en mode simple, TVA ou détaillé'),ENT_QUOTES)?>";
content[76]="<?php echo htmlspecialchars(_('Il est conseillé d\'avoir un quickcode de moins de 9 car.'),ENT_QUOTES)?>";
content[76]="<?php echo htmlspecialchars(_('Conseil : quickcode de moins de 9 car. commençant pas les 2 ou 3 premiers chiffres du poste comptable'),ENT_QUOTES)?>";
content[77]="<?php echo htmlspecialchars(_("Permet de chercher dans le suivi pour les contacts multiples"),ENT_QUOTES)?>";
<?php $file_too_large=sprintf("Fichier trop grand , taille max = %s mb total = %s",(round(MAX_FILE_SIZE/1024/1024,2)),ini_get("post_max_size"));?>
content[78]="<?php echo htmlspecialchars($file_too_large,ENT_QUOTES)?>";