22require_once NOALYSS_INCLUDE.
'/database/fiche_def_ref_sql.class.php';
38 $this->
table=$p_table;
39 parent::__construct($p_table);
42 $this->
set_col_label(
"frd_class_base", _(
"Poste comptable de base"));
46 $this->a_order=[
"frd_id",
"frd_text",
"frd_class_base"];
53 if (
$cn->get_value(
"select count(*) from fiche_def where frd_id=$1",
54 [$this->table->frd_id])>0)
56 throw new Exception(_(
"Effacement impossible : catégorie utilisée"));
58 $cn->exec_sql(
"delete from attr_min where frd_id=$1",[$this->
table->frd_id]);
59 $this->
table->delete();
70 if (trim($this->
table->frd_text)==
"")
72 $this->
set_error(
"frd_text", _(
"Le nom ne peut pas être vide"));
75 if (trim($this->
table->frd_class_base)!=
"")
77 $cnt=
$cn->get_value(
"select count(*) from tmp_pcmn where pcm_val=$1"
78 , [$this->
table->frd_class_base]);
82 _(
"Poste comptable n'existe pas"));
101 echo
"<br><font color=\"red\"> ";
102 echo _(
"Attention, ne pas changer la signification de ce poste.");
103 echo
hi(_(
"par exemple ne pas changer Client par fournisseur")).
"<br>";
104 echo _(
"sinon le programme fonctionnera mal, ".
105 "utiliser uniquement des chiffres pour la classe de base ou rien").
"</font>";
106 $error_name=$this->
get_error(
"frd_text");
107 $error_account=$this->
get_error(
"frd_class_base");
116 $account->set_attribute(
'account',
'frd_class_base');
117 $name_label=_(
"Nom");
118 $account_label=_(
"Poste comptable de base");
127 <
td> {$name_label} {$error_name}</
td>
133 <
td> {$account_label} {$error_account}</
td>
145 if ($this->
table->frd_id!=-1)
147 echo
h2(_(
"Attribut minimum pour les catégories de fiches"));
151 $a_attribut=
$cn->get_array(
"select ad_id,ad_text,ad_type from attr_min join attr_def using (ad_id) where frd_id=$1 order by 2",
152 [$this->
table->frd_id]);
153 $nb_attribut=count($a_attribut);
154 printf(
'<ul id="%s_list"> ',
$objname);
155 $used=
$cn->get_value(
"select count(*) from jnt_fic_attr join fiche_def using (fd_id) where frd_id=$1",
156 [$this->
table->frd_id]);
159 echo _(
"Catégorie utilisée, les attributs ne peuvent pas être modifiés");
161 for (
$i=0;
$i<$nb_attribut;
$i++)
163 printf(
'<li id="%s_elt%d">',
$objname
164 , $a_attribut[
$i][
'ad_id']);
165 echo $a_attribut[
$i][
'ad_text'];
170 $js=sprintf(
"category_card.remove_attribut('%s','%s','%s',%d)",
181 $sel_attribut->value=
$cn->make_array(
"select ad_id,ad_text
188 frd_id=$1 and ad_id=attr_def.ad_id)", NULL,
189 [$this->
table->frd_id]);
190 echo _(
"Attribut à ajouter");
191 echo $sel_attribut->input();
192 $js_script=sprintf(
"category_card.add_attribut('%s','%s','%s')",
208 $cn->exec_sql(
"insert into attr_min (frd_id,ad_id) values ($1,$2)",
210 $cn->exec_sql(
"insert into attr_min (frd_id,ad_id) values ($1,$2)",
h2($p_string, $p_class="", $raw="")
tr($p_string, $p_extra='')
td($p_string='', $p_extra='')
surround the string with td
static id()
return the 'gDossier' value after a check
ORM Manage the table public.fiche_def_ref , which concerns the template of category of card.
show a button, for selecting a account and a input text for manually inserting an account the differe...
Html Input , create a tag <SELECT> ... </SELECT> if readonly == true then display the label correspon...
static icon_add($id, $p_javascript, $p_style="")
static trash($p_id, $p_javascript)
Display the icon of a trashbin.
Purpose is to propose a librairy to display a table content and allow to update and delete row ,...
set_property_updatable($p_key, $p_value)
set a column of the data row updatable or not
get_error($p_col)
retrieve the error message
set_error($p_col, $p_message)
set the error message for a wrong input
set_col_label($p_key, $p_display)
set the name to display for a column
Manage the template of card category.
input()
display into a dialog box the datarow in order to be appended or modified.
__construct(Fiche_def_ref_SQL $p_table)
check()
Check before inserting or updating, return TRUE if ok otherwise FALSE.
add_mandatory_attr()
When adding a template of category of card, the minimum is the name and the quickcode,...