57 $this->display_mode=
'window';
61 return "card_property".var_export($this,
true);
65 if ( ! in_array($p_mode,array(
"window",
"large"))) {
66 throw new Exception(
"FIC70 invalide display mode");
68 $this->display_mode=$p_mode;
158 $result = [
'msg' =>
'',
'input' =>
null,
'label' =>
'',
'class' =>
'input_text',
'bulle'=>
''];
160 $result[
'class'] =
" input_text highlight info";
163 if ( $p_fiche_def ==
null ) {
164 throw new \Exception (
"CP162.p_fiche_def is null");
167 $result[
'input']->id = uniqid(
'accounting');
168 $result[
'input']->set_attribute(
'ipopup',
'ipop_account');
169 $result[
'input']->set_attribute(
'jrn',
'0');
171 $result[
'input']->dbl_click_history();
174 $sql =
"select account_auto($p_fiche_def->id)";
175 $ret_sql = $this->
cn->exec_sql(
$sql);
178 $result[
'label']->name =
"av_text" . $this->ad_id .
"_label";
179 $p_fiche_def->load();
180 if (
$a[
'account_auto'] ==
't') {
181 $result[
'msg'] .=
$result[
'label']->input() .
" <span style=\"color:red;font-size:80%;display:block\">" .
182 _(
"Rappel: Poste créé automatiquement à partir de ")
183 . $p_fiche_def->class_base .
" </span> ";
188 $result[
'msg'] .=
" <span style=\"color:red;font-size:80%;display:block\">" .
_(
"Rappel: Poste par défaut sera ") .
189 $p_fiche_def->class_base .
194 $result[
'label']=
_(
"Poste comptable");
195 $result[
'class']=
" highlight input_text";
212 $result[
'input']=
new IText(
"av_text" . $this->ad_id,$this->av_text);
213 $array=$this->
cn->get_array(
"select qc_code,format('%s %s',qc_code,qc_label) label from quantity_code_ref order by qc_label",p_mode: PGSQL_NUM);
236 $result[
'input']->css_size =
"100%";
240 $result[
'input']->placeholder=
"999NOM";
246 switch ($this->ad_type) {
249 $result[
'input']->css_size =
"100%";
263 $result[
'input'] =
new ITextArea();
264 $result[
'input']->style =
' class="itextarea" style="margin:0px;width:100%"';
269 $result[
'input']->set_attribute(
'ipopup',
'ipop_account');
270 $result[
'input']->set_attribute(
'account',
"av_text" . $this->ad_id);
277 $result[
'input']->value = (empty($this->av_text) ) ? 0 : 1;
281 $result[
'input']->value = $this->
cn->make_array($this->ad_extra);
282 $result[
'input']->style =
'style="width:100%"';
290 $result[
'input']->id = uniqid();
297 $result[
'label']->name =
"av_text" . $this->ad_id .
$result[
'input']->id .
"_label";
298 $result[
'input']->set_attribute(
'ipopup',
'ipopcard');
299 $result[
'input']->set_attribute(
'typecard', $this->ad_extra);
301 $result[
'input']->set_attribute(
'label',
"av_text" . $this->ad_id .
$result[
'input']->
id .
"_label");
302 $result[
'input']->autocomplete = 1;
303 $result[
'input']->dblclick =
"fill_ipopcard(this);";
315 if ($this->ad_id == 21 || $this->ad_id == 22 || $this->ad_id == 20 || $this->ad_id == 31) {
340 $fiche->attribut=$aProperty;
350 natural join fiche_detail
351 join jnt_fic_attr on (jnt_fic_attr.fd_id=fiche.fd_id and fiche_detail.ad_id=jnt_fic_attr.ad_id)
352 join attr_def on (attr_def.ad_id=fiche_detail.ad_id) where f_id= $1".
353 " order by jnt_order";
365 $t->ad_text=
$row[
'ad_text'];
366 $t->av_text=
$row[
'ad_value'];
367 $t->ad_type=
$row[
'ad_type'];
368 $t->ad_size=
$row[
'ad_size'];
369 $t->ad_extra=
$row[
'ad_extra'];
370 $t->jnt_order=
$row[
'jnt_order'];
374 $e->load_attribute();
376 if (
sizeof(
$fiche->attribut)!=
sizeof(
$e->attribut))
382 foreach (
$e->attribut as
$f)
385 foreach (
$fiche->attribut as $g)
387 if ($g->ad_id==
$f->ad_id)
395 $t->ad_text=
$f->ad_text;
396 $t->jnt_order=
$f->jnt_order;
397 $t->ad_type=
$f->ad_type;
398 $t->ad_size=
$f->ad_size;
400 $t->ad_extra=
$f->ad_extra;
419 $url=
'<td>'.$this->add_link($this->ad_id,$this->av_text).
'</td>';
422 ' class="'.
$result[
'class'].
'" ').
444 if ($this->ad_id==21||$this->ad_id==22||$this->ad_id==20||$this->ad_id==31)
456 $class=
" input_text highlight info";
462 switch ($this->ad_type)
466 $x->value=$this->
cn->make_array($this->ad_extra);
474 $w->value=(trim(
$w->value)==
"")?1:
$w->value;
479 $url=
"<td>".$this->add_link($this->ad_id,$this->av_text).
'</td>';
480 $ret.=
"<TR>".td(
_($this->ad_text).
" $bulle",
' class="'.
$class.
'" ').td(
$value.
" $msg",
481 'style="border:1px solid blue"').
'<td>'.
$url.
'</td>'.
" </TR>";
501 if ($p_fiche->cn->status()==PGSQL_TRANSACTION_IDLE)
503 $p_fiche->cn->start();
507 $p_fiche->cn->exec_sql(
"update fiche set f_enable=$1 where f_id=$2",
513 foreach ($p_fiche->attribut as
$value)
516 $sql=
" select jft_id from fiche_detail where ad_id=$1 and f_id=$2";
517 $Ret=$p_fiche->cn->exec_sql(
$sql, [
$value->ad_id, $p_fiche->id]);
523 $jft_id=$p_fiche->cn->get_next_seq(
's_jnt_fic_att_value');
525 $sql2=
"insert into fiche_detail(jft_id,ad_id,f_id,ad_value) values ($1,$2,$3,NULL)";
527 $ret2=$p_fiche->cn->exec_sql($sql2, array($jft_id,
$value->ad_id, $p_fiche->id));
533 $jft_id=
$tmp[
'jft_id'];
540 $used = $p_fiche->cn->get_value(
"select count(*) from jrnx where j_qcode= $1",[
$value->av_text]);
543 $p_fiche->cn->exec_sql(
$sql);
555 $v=mb_strtoupper(
$value->av_text??
"");
559 if (strpos($v,
',')!=0)
561 $ac_array=explode(
",", $v);
562 if (count($ac_array)<>2)
563 throw new Exception(
'Désolé, il y a trop de virgule dans le poste comptable '.
h($v));
566 $part1=$p_fiche->cn->get_value(
'select format_account($1)', array($part1));
567 $part2=$p_fiche->cn->get_value(
'select format_account($1)', array($part2));
569 if (mb_strlen($part1)>40)
570 throw new Exception(
"CP475.".
_(
"Poste comptable trop long"), 1);
571 if (mb_strlen($part2)>40)
572 throw new Exception(
"CP476.".
_(
"Poste comptable trop long"), 1);
574 $acc_account1=
new Acc_Account($p_fiche->cn, $part1);
576 if ($acc_account1->get_parameter(
"id")==-1)
579 $acc_account1->set_parameter(
"pcm_lib", $account_name);
580 $acc_account1->set_parameter(
'pcm_direct_use',
"Y");
581 $parent=$acc_account1->find_parent();
582 $acc_account1->set_parameter(
"pcm_val_parent", $parent);
583 $acc_account1->save();
586 if ($acc_account1->get_parameter(
'pcm_direct_use')==
'N')
588 throw new Exception(
"CP493.".
_(
"Utilisation directe interdite du poste comptable $part1"));
591 $acc_account2=
new Acc_Account($p_fiche->cn, $part2);
593 if ($acc_account2->get_parameter(
"id")==-1)
596 $acc_account2->set_parameter(
"pcm_lib", $account_name);
597 $acc_account2->set_parameter(
'pcm_direct_use',
"Y");
598 $parent=$acc_account2->find_parent();
599 $acc_account2->set_parameter(
"pcm_val_parent", $parent);
600 $acc_account2->save();
604 if ($acc_account2->get_parameter(
'pcm_direct_use')==
'N')
606 throw new Exception(
"CP511.".
_(
"Utilisation directe interdite du poste comptable $part2"));
608 $v=$part1.
','.$part2;
612 if (mb_strlen($v)>40)
613 throw new Exception(
"CP520.".
_(
"Poste comptable trop long"), 1);
616 if ($acc_account->get_parameter(
"id")==-1)
619 $acc_account->set_parameter(
"pcm_lib", $account_name);
621 $acc_account->set_parameter(
'pcm_direct_use',
"Y");
622 $parent=$acc_account->find_parent();
623 $acc_account->set_parameter(
"pcm_val_parent", $parent);
624 $acc_account->save();
628 if ($acc_account->get_parameter(
'pcm_direct_use')==
'N')
630 throw new Exception(
"CP537.".
_(
"Utilisation directe interdite du poste comptable $v"));
633 $sql=sprintf(
"select account_insert(%d,'%s')", $p_fiche->id, $v);
636 $p_fiche->cn->exec_sql(
$sql);
640 throw new Exception(
"CP546.".
_(
"opération annulée").
" ".
$e->getMessage());
647 $sql=sprintf(
"select account_insert(%d,null)", $p_fiche->id);
650 $Ret=$p_fiche->cn->exec_sql(
$sql);
654 throw new Exception(
"CP560.".
_(
"Erreur : Aucun compte parent ").
"[$v]");
667 if ($acc_tva->tva_id==-1)
674 $sql=
"update fiche_detail set ad_value=$1 where jft_id=$2";
679 $p_fiche->cn->commit();
684 echo
'<span class="error">'.
687 record_log(
"CP597.".
$e->getMessage().$e->getTraceAsString());
688 if ($commit) { $p_fiche->cn->rollback(); }
722 $nb = count($a_property);
724 if ($a_property[
$i]->
get_ad_id() == $attr_def_id)
return $a_property[
$i];
737 $r=$conx->
get_value(
"select ad_value from fiche_detail where
738 ad_id = $1 and f_id=$2",[$property_id,
$card_id]);
739 if ( $conx->
count() == 0) {
return false;}
mailTo($p_email)
compose a HTML string with email
noalyss_strip_tags($p_string)
noalyss_strlentrim($p_string)
record_log($p_message)
Record an error message into the log file of the server or in the log folder of NOALYSS Record also t...
sql_string($p_string)
Fix the problem with the quote char for the database.
td($p_string='', $p_extra='')
surround the string with td
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
h( $row[ 'oa_description'])
foreach($array as $idx=> $m) $w
_("actif, passif,charge,...")
$class
Display the Plugin and for each profile were it is installed or not.
Manage the account from the table tmp_pcmn.
static build($db, $p_code)
retrieve TVA rate thanks the code that could be the tva_id or tva_code.
contains the attributes of a card , manage them, save them , ...
$display_mode
display mode values are large , window , display Property depending of this mode.
build_input($p_fiche_def=null)
build the needed elements to display
static update(Fiche $p_fiche)
update all the data of the card , including f_enable. if we are in a transaction we don't commit here...
set_jnt_order($jnt_order)
static get_attribute(\Database $conx, $card_id, $property_id)
returns the property value of a card without creating a card
$ad_extra
ad_extra extra info for a attribute
$ad_text
ad_text string label of the attribute attr_def.ad_def
$jnt_order
jnt_order order to display
$ad_size
ad_size int size of the attribute
$av_text
av_text string value of this attribute
$ad_type
ad_type string : type of this attribute (select, text ,...)
$ad_id
ad_id int id of the attribute attr_def.ad_id
print()
Compute a HTML string in a TR element with information of this card property.
static load(Fiche $fiche)
Load all the attribute of a card , it modifies the parameter $fiche.
static findProperty($attr_def_id, $a_property)
return the Property of an array of property with the right ad_id
input($p_fiche_def=null)
input a property of a card
__construct($cn, $ad_id=0)
add_link($p_ad_id, $p_text)
add a link
get_value($p_sql, $p_array=null)
return the value of the sql, the sql will return only one value with the value
count($p_ret=null)
synomym for size()
static fetch_array($ret, $p_indice=0, $p_mode=PGSQL_ASSOC)
wrapper for the function pg_fetch_array
static num_row($ret)
wrapper for the function pg_num_rows
contains the class for connecting to Noalyss
define Class fiche and fiche def, those class are using class attribut
define Class fiche and fiche def, those class are using class attribut. When adding or modifing new c...
get_attribute($p_ad_id, $p_return=1)
return the string of the given attribute (attr_def.ad_id)
Input HTML for the card show buttons, in the file, you have to add card.js How to use :
Html Input : Input a date format dd.mm.yyyy The property title should be set to indicate what it is e...
This class handles only the numeric input, the input will call a javascript to change comma to period...
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 warnbulle($p_comment)
Display a warning in a bubble, text is in message_javascript.
static infobulle($p_comment)
Display a info in a bubble, text is in message_javascript.
const ATTR_DEF_QUANTITY_TYPE
if( $delta< 0) elseif( $delta==0)