38 parent::__construct($p_table);
54 [
"value"=>
"text",
"label"=>
_(
"Texte")],
55 [
"value"=>
"date",
"label"=>
_(
"Date")],
56 [
"value"=>
"numeric",
"label"=>
_(
"Nombre")],
57 [
"value"=>
"select",
"label"=>
_(
"Choix")],
58 [
"value"=>
"card",
"label"=>
_(
"Fiche")],
59 [
"value"=>
"zone",
"label"=>
_(
"Zone de texte")],
60 [
"value"=>
"check",
"label"=>
_(
"Coche")],
61 [
"value"=>
"poste",
"label"=>
_(
"Poste comptable")]
65 $this->dossier_id=Dossier::id();
66 $this->
set_order([
'ad_id',
'ad_text',
"ad_type",
"ad_default_order",
"ad_size",
"ad_extra",
"ad_search_followup"]);
76 tracedebug(
"card_attribute.log",
$row);
77 if (
$row[
'ad_id']>=9000)
88 parent::display_row(
$row);
102 if ($p_key==
"ad_search_followup")
105 $ic->set_callback(
"ajax_misc.php");
106 $ic->add_json_param(
"op",
"card");
107 $ic->add_json_param(
"gDossier", $this->dossier_id);
108 $ic->add_json_param(
"op2",
"attribute");
109 $ic->add_json_param(
"action",
"enable_search");
110 $ic->add_json_param(
"ad_id",
$p_id);
111 $ic->add_json_param(
"ctl",
$p_id);
116 if ($p_key==
"ad_text")
120 if ($p_key==
"ad_extra")
138 if ($p_key==
"ad_search_followup")
141 $ic=
new InputSwitch(
"ad_search_followup", $p_value);
144 elseif ($p_key==
"ad_text")
153 elseif ($p_key==
"ad_extra")
167 if ($object_sql->get(
"ad_id")<9000&&$object_sql->get(
"ad_id")!=-1)
176 upper(trim(ad1.ad_text)) = upper(trim($1))
179 $count_duplicate=$object_sql->cn->get_value(
$count, [$object_sql->ad_text, $object_sql->ad_id]);
180 if ($count_duplicate>0)
185 if (in_array($object_sql->get(
"ad_type"),
186 array(
'date',
'text',
'numeric',
'zone',
'poste',
'card',
'select',
'check'))==
false)
188 $this->
set_error(
"ad_type",
_(
"Type invalide"));
192 if (trim($object_sql->ad_text)==
"")
194 $this->
set_error(
"ad_text",
_(
"Description ne peut pas être vide"));
197 if ($object_sql->ad_size==
"")
199 $object_sql->ad_size=22;
201 if ($object_sql->ad_type==
'numeric')
203 $object_sql->ad_extra=(trim($object_sql->ad_extra)==
'')?
'2':$object_sql->ad_extra;
204 if (
isNumber($object_sql->ad_extra)==0)
206 $this->
set_error(
"ad_text",
_(
"La précision doit être un chiffre"));
210 if ($object_sql->ad_type==
'select')
212 if (trim($object_sql->ad_extra)==
"")
215 $this->
set_error(
"ad_extra",
_(
"La requête SQL est vide "));
221 $sql=$object_sql->ad_extra;
222 $sql=str_ireplace(
"delete",
"del.ete",
$sql);
223 $sql=str_ireplace(
"insert",
"del.ete",
$sql);
224 $sql=str_ireplace(
"update",
"del.ete",
$sql);
225 $sql=str_ireplace(
"truncate",
"del.ete",
$sql);
226 $sql=str_ireplace(
"drop",
"del.ete",
$sql);
229 }
catch (\Exception
$e) {
230 $this->
set_error(
"ad_extra",
_(
"ERREUR SQL : ")
231 .$object_sql->ad_extra);
237 if (preg_match(
'/^\h*select/i', $object_sql->ad_extra)==0)
242 if ( $object_sql->ad_default_order < 11 || $object_sql->ad_default_order > 9998) {
243 $this->
set_error(
"ad_default_order",
_(
"Valeur entre 11 et 9998"));
256 if ($object_sql->getp(
"ad_id")<9000)
258 throw new Exception(
_(
"Effacement bloqué"));
265 $sql=$db->exec_sql(
"delete from fiche_detail where ad_id=$1 ", array($object_sql->ad_id));
267 $sql=
"delete from jnt_fic_attr where ad_id=$1";
268 $res=$db->exec_sql(
$sql, array($object_sql->ad_id));
270 $sql=
"delete from attr_def where ad_id=$1";
271 $res=$db->exec_sql(
$sql, array($object_sql->ad_id));
273 $object_sql=$this->
get_table()->delete();
276 catch (Exception
$ex)
279 throw new Exception(
_(
"Effacement bloqué : attribut utilisé"));
td($p_string='', $p_extra='')
surround the string with td
_("actif, passif,charge,...")
manage the table attr_def
input_custom($p_key, $p_value)
For the type custom , we can call a function to display properly the value.
__construct(\Data_SQL $p_table)
display_row_custom($p_key, $p_value, $p_id=0)
For the type custom , we can call a function to display properly the value.
display_row($row)
Display row of table attr_def.
this an abstract class , all the SQL class, like noalyss_sql (table), Acc_Plan_SQL (based on a SQL no...
Manage the TEXTAREA html element.
A switch let you switch between 2 values : 0 and 1, it is used to replace the check.
Purpose is to propose a librairy to display a table content and allow to update and delete row ,...
count_error()
returns the nb of errors found
set_delete_row($p_value)
Enable or disable the deletion of rows.
set_col_sort($p_num)
When adding an element ,we place it thanks the DOM Attribute sort_value set it to -1 if you want one ...
set_property_updatable($p_key, $p_value)
set a column of the data row updatable or not
set_col_tips($p_key, $p_comment)
Set the info for a column, use Icon_Action\infobulle the message are in message_javascript....
set_col_type($p_key, $p_value, $p_array=NULL)
set the type of a column , it will change in the input db box , the select must supply an array of po...
set_update_row($p_value)
Enable or disable the updating of rows.
set_property_visible($p_key, $p_value)
set a column of the data row visible or not
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
if( $delta< 0) elseif( $delta==0)