noalyss Version-9
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
card_property.class.php
Go to the documentation of this file.
1<?php
2
3/*
4 * This file is part of NOALYSS.
5 *
6 * PhpCompta is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * PhpCompta is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with PhpCompta; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20// Copyright (2002-2021) Author Dany De Bontridder <danydb@noalyss.eu>
21
22/**
23 * @file
24 * @brief manage the attribute of a card
25 */
26
27/**
28 * @class Card_Property
29 * @brief contains the attributes of a card , manage them, save them , ...
30 *
31 */
33{
34
35 var $ad_id;
36 //!< ad_id int id of the attribute attr_def.ad_id
38 //!< ad_text string label of the attribute attr_def.ad_def
40 //!< av_text string value of this attribute
42 //!< ad_type string : type of this attribute (select, text ,...)
44 //!< ad_size int size of the attribute
46 //!< ad_extra extra info for a attribute
48 //!< jnt_order order to display
49 var $cn;
50 //!< cn database connexion
51 protected $display_mode;
52 //!< display mode values are large , window , display Property depending of this mode.
53 function __construct($cn, $ad_id=0)
54 {
55 $this->cn=$cn;
56 $this->ad_id=$ad_id;
57 $this->display_mode='window';
58 }
59 public function __toString(): string
60 {
61 return "card_property".var_export($this,true);
62 }
63 public function setDisplayMode($p_mode)
64 {
65 if ( ! in_array($p_mode,array("window","large"))) {
66 throw new Exception("FIC70 invalide display mode");
67 }
68 $this->display_mode=$p_mode;
69 return $this;
70 }
71 public function getDisplayMode()
72 {
74 }
75
76 public function get_ad_id()
77 {
78 return $this->ad_id;
79 }
80
81 public function get_ad_text()
82 {
83 return $this->ad_text;
84 }
85
86 public function get_av_text()
87 {
88 return $this->av_text;
89 }
90
91 public function get_ad_type()
92 {
93 return $this->ad_type;
94 }
95
96 public function get_ad_size()
97 {
98 return $this->ad_size;
99 }
100
101 public function get_ad_extra()
102 {
103 return $this->ad_extra;
104 }
105
106 public function get_jnt_order()
107 {
108 return $this->jnt_order;
109 }
110
111 public function set_ad_id($ad_id): void
112 {
113 $this->ad_id=$ad_id;
114 }
115
116 public function set_ad_text($ad_text): void
117 {
118 $this->ad_text=$ad_text;
119 }
120
121 public function set_av_text($av_text): void
122 {
123 $this->av_text=$av_text;
124 }
125
126 public function set_ad_type($ad_type): void
127 {
128 $this->ad_type=$ad_type;
129 }
130
131 public function set_ad_size($ad_size): void
132 {
133 $this->ad_size=$ad_size;
134 }
135
136 public function set_ad_extra($ad_extra): void
137 {
138 $this->ad_extra=$ad_extra;
139 }
140
141 public function set_jnt_order($jnt_order): void
142 {
143 $this->jnt_order=$jnt_order;
144 }
145
146 /**
147 * @brief build the needed elements to display
148 * @param Object Fiche_Def $p_fiche_def
149 * @return array
150 * - $result['msg'] message to display,
151 * - $result['label'] label of the CardProperty (ad_text),
152 * - $result['input' is the HtmlInput object
153 * - $result['class'] is the CSS class to use
154 * - $result['bulle'] is the infobulle
155 */
156 public function build_input($p_fiche_def=null)
157 {
158 $result = ['msg' => '', 'input' => null, 'label' => '', 'class' => 'input_text','bulle'=>''];
159 if ($this->ad_id == ATTR_DEF_NAME || $this->ad_id == ATTR_DEF_QUICKCODE) {
160 $result['class'] = " input_text highlight info";
161 }
162 if ($this->ad_id == ATTR_DEF_ACCOUNT) {
163 if ( $p_fiche_def == null ) {
164 throw new \Exception ("CP162.p_fiche_def is null");
165 }
166 $result['input'] = new IPoste("av_text" . $this->ad_id);
167 $result['input']->id = uniqid('accounting');
168 $result['input']->set_attribute('ipopup', 'ipop_account');
169 $result['input']->set_attribute('jrn', '0');
170 $result['input']->set_attribute('account', $result['input']->id);
171 $result['input']->dbl_click_history();
172 $result['input']->value = $this->av_text;
173 // account created automatically
174 $sql = "select account_auto($p_fiche_def->id)";
175 $ret_sql = $this->cn->exec_sql($sql);
176 $a = Database::fetch_array($ret_sql, 0);
177 $result['label'] = new ISpan();
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> ";
184 } else {
185 // if there is a class base in fiche_def_ref, this account will be the
186 // the default one
187 if (noalyss_strlentrim($p_fiche_def->class_base) != 0) {
188 $result['msg'] .= " <span style=\"color:red;font-size:80%;display:block\">" . _("Rappel: Poste par défaut sera ") .
189 $p_fiche_def->class_base .
190 " !</span> ";
191 $result['input']->value = (empty ($result['input']->value)) ?$p_fiche_def->class_base:$result['input']->value;
192 }
193 }
194 $result['label']=_("Poste comptable");
195 $result['class']=" highlight input_text";
196 return $result;
197
198 }
199 elseif ($this->ad_id == ATTR_DEF_NUMTVA) {
200 /// Propose a button to check VAT
201 $result['input']=new IVATNumber( "av_text" . $this->ad_id,$this->av_text);
202 $result['label']=$this->ad_text;
203 return $result;
204 }
205 elseif ($this->ad_id == ATTR_DEF_TVA) {
206 $result['input'] = new ITva_Popup('popup_tva');
207 $result['input']->table = 0;
208 $result['input']->value = $this->av_text;
209 $result['label']=$this->ad_text;
210 } else {
211 switch ($this->ad_type) {
212 case 'text':
213 $result['input'] = new IText();
214 $result['input']->css_size = "100%";
215 $result['input']->value = $this->av_text;
216 break;
217 case 'numeric':
218 $result['input'] = new INum();
219 $result['input']->prec = ($this->ad_extra == "") ? 2 : $this->ad_extra;
220 $result['input']->size = $this->ad_size;
221 $result['input']->value = $this->av_text;
222 break;
223 case 'date':
224 $result['input'] = new IDate();
225 $result['input']->value = $this->av_text;
226 break;
227 case 'zone':
228 $result['input'] = new ITextArea();
229 $result['input']->style = ' class="itextarea" style="margin:0px;width:100%"';
230 $result['input']->value = $this->av_text;
231 break;
232 case 'poste':
233 $result['input'] = new IPoste("av_text" . $this->ad_id);
234 $result['input']->set_attribute('ipopup', 'ipop_account');
235 $result['input']->set_attribute('account', "av_text" . $this->ad_id);
236 $result['input']->table = 1;
237 $bulle = Icon_Action::infobulle(14);
238 $result['input']->value = $this->av_text;
239 break;
240 case 'check':
241 $result['input'] = new InputSwitch("av_text" . $this->ad_id);
242 $result['input']->value = (empty($this->av_text) ) ? 0 : 1;
243 break;
244 case 'select':
245 $result['input'] = new ISelect("av_text" . $this->ad_id);
246 $result['input']->value = $this->cn->make_array($this->ad_extra);
247 $result['input']->style = 'style="width:100%"';
248 $result['input']->selected = $this->av_text;
249 break;
250 case 'card':
251 $result['input'] = new ICard("av_text" . $this->ad_id);
252 // filter on frd_id
253 $result['input']->extra = $this->ad_extra;
254 $result['input']->extra2 = 0;
255 $result['input']->id = uniqid();
256 $result['label'] = new ISpan();
258 $result['input']->width = $this->ad_size;
259 $result['input']->extra = $filter;
260 $result['input']->extra2 = 0;
261 $result['input']->limit = 6;
262 $result['label']->name = "av_text" . $this->ad_id . $result['input']->id . "_label";
263 $result['input']->set_attribute('ipopup', 'ipopcard');
264 $result['input']->set_attribute('typecard', $this->ad_extra);
265 $result['input']->set_attribute('inp', $result['input']->id);
266 $result['input']->set_attribute('label', "av_text" . $this->ad_id . $result['input']->id . "_label");
267 $result['input']->autocomplete = 1;
268 $result['input']->dblclick = "fill_ipopcard(this);";
269 $result['msg'] = $result['input']->search();
270 $result['msg'] .= $result['label']->input();
271 $result['input']->value = $this->av_text;
272 break;
273 }
274 $result['input']->table = 0;
275 $result['label']=$this->ad_text;
276 }
277
278 $result['input']->label = $this->ad_text;
279 $result['input']->name = "av_text" . $this->ad_id;
280 if ($this->ad_id == 21 || $this->ad_id == 22 || $this->ad_id == 20 || $this->ad_id == 31) {
281 $result['bulle'] = Icon_Action::infobulle(21);
282 }
283
284 // Warning length quickcode
285 if ($this->ad_id == ATTR_DEF_QUICKCODE) {
286 $result['bulle'] = Icon_Action::warnbulle(76);
287 }
288
289 return $result;
290 }
291 /**
292 * @brief Load all the attribute of a card , it modifies the parameter $fiche. Usually called from fiche::insert
293 * and fiche::update . In the same time, it will synchronize the attributes which the database.
294 * The attributes (public.fiche_detail) will be ordered in the member attribute $fiche->attribut
295 * @param $fiche Fiche Full fill this card with all the attributes
296 * @see Fiche::update Fiche::insert
297 * @note it is not possible to compute the default attributes for a new card without the card
298 * category, so it returns nothing
299 *
300 */
301 static function load(Fiche $fiche)
302 {
303 // if card is not yet saved then we don't load it from database but all the properties are set to empty
304 if ($fiche->id==0 && $fiche->fiche_def !=0 )
305 {
306 $fiche_def=new Fiche_Def($fiche->cn,$fiche->fiche_def);
307 $aProperty=$fiche_def->getAttribut();
308 $fiche->attribut=$aProperty;
309 return;
310 } elseif ($fiche->id==0 && $fiche->fiche_def ==0 )
311 {
312 return;
313// throw new Exception("CP147. Card category cannot be empty (fiche->set_fiche_def)",EXC_PARAM_VALUE);
314 }
315 $sql="select *
316 from
317 fiche
318 natural join fiche_detail
319 join jnt_fic_attr on (jnt_fic_attr.fd_id=fiche.fd_id and fiche_detail.ad_id=jnt_fic_attr.ad_id)
320 join attr_def on (attr_def.ad_id=fiche_detail.ad_id) where f_id= $1".
321 " order by jnt_order";
322
323 $Ret=$fiche->cn->exec_sql($sql, [$fiche->id]);
324 if (($Max=Database::num_row($Ret))==0)
325 return;
326 for ($i=0; $i<$Max; $i++)
327 {
329 $fiche->fiche_def=$row['fd_id'];
330 $fiche->set_f_enable($row['f_enable']);
331 $t=new Card_Property($fiche->cn);
332 $t->ad_id=$row['ad_id'];
333 $t->ad_text=$row['ad_text'];
334 $t->av_text=$row['ad_value'];
335 $t->ad_type=$row['ad_type'];
336 $t->ad_size=$row['ad_size'];
337 $t->ad_extra=$row['ad_extra'];
338 $t->jnt_order=$row['jnt_order'];
339 $fiche->attribut[$i]=$t;
340 }
341 $e=new Fiche_Def($fiche->cn, $fiche->fiche_def);
342 $e->GetAttribut();
343
344 if (sizeof($fiche->attribut)!=sizeof($e->attribut))
345 {
346
347 /*
348 * !! Missing attribute
349 */
350 foreach ($e->attribut as $f)
351 {
352 $flag=0;
353 foreach ($fiche->attribut as $g)
354 {
355 if ($g->ad_id==$f->ad_id)
356 $flag=1;
357 }
358 if ($flag==0)
359 {
360 // there's a missing one, we insert it
361 $t=new Card_Property($fiche->cn, $f->ad_id);
362 $t->av_text="";
363 $t->ad_text=$f->ad_text;
364 $t->jnt_order=$f->jnt_order;
365 $t->ad_type=$f->ad_type;
366 $t->ad_size=$f->ad_size;
367 $t->ad_id=$f->ad_id;
368 $t->ad_extra=$f->ad_extra;
369 $fiche->attribut[$Max]=$t;
370 $Max++;
371 } // if flag == 0
372 }// foreach
373 }//missing attribut
374 }
375
376 /**
377 * @brief input a property of a card
378 * @param Fiche_Def $p_fiche_def
379 * @return string HTML string with the right input type
380 */
381 function input($p_fiche_def=null)
382 {
383
384 $result=$this->build_input($p_fiche_def);
385
386
387 $url='<td>'.$this->add_link($this->ad_id,$this->av_text).'</td>';
388 $r="<TR>".
389 td(_($result["label"]). $result['bulle'],
390 ' class="'.$result['class'].'" ').
391 td($result["input"]->input().$result["msg"]).
392 $url.
393 " </TR>";
394 return $r;
395 }
396
397 /**
398 * @brief Compute a HTML string in a TR element with information of this card property
399 *
400 * @return string HTML into tr
401 */
402 function print()
403 {
404 $w=new IText();
405 $w->table=1;
406 $w->readOnly=true;
407 $w->css_size="100%";
408 $msg="";
409 $bulle="";
410 $ret="";
412 if ($this->ad_id==21||$this->ad_id==22||$this->ad_id==20||$this->ad_id==31)
413 {
414 $bulle=Icon_Action::infobulle(21);
415 }
416
417 // Warning length quickcode
418 if ($this->ad_id==ATTR_DEF_QUICKCODE)
419 {
420 $bulle=Icon_Action::warnbulle(76);
421 }
422 if ($this->ad_id==ATTR_DEF_NAME||$this->ad_id==ATTR_DEF_QUICKCODE)
423 {
424 $class=" input_text highlight info";
425 }
426 else
427 {
428 $class="input_text";
429 }
430 switch ($this->ad_type)
431 {
432 case 'select':
433 $x=new ISelect();
434 $x->value=$this->cn->make_array($this->ad_extra);
435 $x->selected=$this->av_text;
436 $value=$x->display();
437 $w->value=$value;
438 break;
439 case 'check':
440 $w=new InputSwitch("av_text".$this->ad_id);
441 $w->value=$this->av_text;
442 $w->value=(trim($w->value)=="")?1:$w->value;
443 break;
444 default:
445 $w->value=$this->av_text;
446 }
447 $url="<td>".$this->add_link($this->ad_id,$this->av_text).'</td>';
448 $ret.="<TR>".td(_($this->ad_text)." $bulle", ' class="'.$class.'" ').td($value." $msg",
449 'style="border:1px solid blue"').'<td>'.$url.'</td>'." </TR>";
450 return $ret;
451 }
452
453 /*!
454 * \brief update all the data of the card , including f_enable. if we are in a transaction
455 * we don't commit here , else if not then a transaction is started and committed . The member attributes
456 * $p_fiche->attribut will be saved into fiche_detail after transforming if needed.
457 * If a transaction is started if there is none, so updating a card is always in a transaction.
458 *
459 *
460 */
461
462 static function update(Fiche $p_fiche)
463 {
464 //transaction in the function or from the caller
465 $commit=false;
466 try
467 {
468 // are we inside a transaction (between BEGIN - COMMIT )
469 if ($p_fiche->cn->status()==PGSQL_TRANSACTION_IDLE)
470 {
471 $p_fiche->cn->start();
472 $commit=true;
473 }
474
475 $p_fiche->cn->exec_sql("update fiche set f_enable=$1 where f_id=$2",
476 array($p_fiche->get_f_enable(), $p_fiche->id));
477
478 $name = $p_fiche->strAttribut(ATTR_DEF_NAME);
479
480 // parse the attribute
481 foreach ($p_fiche->attribut as $value)
482 {
483 // retrieve jft_id to update table attr_value
484 $sql=" select jft_id from fiche_detail where ad_id=$1 and f_id=$2";
485 $Ret=$p_fiche->cn->exec_sql($sql, [$value->ad_id, $p_fiche->id]);
486
487 // if attribute doesn't exist, then we insert one,
488 if (Database::num_row($Ret)==0)
489 {
490 // we need to insert this new attribut , $jft_id contains the PK of fiche_detail
491 $jft_id=$p_fiche->cn->get_next_seq('s_jnt_fic_att_value');
492
493 $sql2="insert into fiche_detail(jft_id,ad_id,f_id,ad_value) values ($1,$2,$3,NULL)";
494
495 $ret2=$p_fiche->cn->exec_sql($sql2, array($jft_id, $value->ad_id, $p_fiche->id));
496 }
497 else
498 {
500 // $jft_id contains the PK of fiche_detail
501 $jft_id=$tmp['jft_id'];
502 }
503
504 // Special traitement
505 // quickcode , if already used in ledger , it cannot be changed
506 if ($value->ad_id==ATTR_DEF_QUICKCODE)
507 {
508 $used = $p_fiche->cn->get_value("select count(*) from jrnx where j_qcode= $1",[$value->av_text]);
509 if ($used == 0) {
510 $sql=sprintf("select update_quick_code(%d,'%s')", $jft_id, sql_string($value->av_text));
511 $p_fiche->cn->exec_sql($sql);
512 }
513 continue;
514 }
515 // name
516 if ($value->ad_id==ATTR_DEF_NAME && noalyss_strlentrim($value->av_text)==0 )
517 {
518 continue;
519 }
520 // account
521 if ($value->ad_id==ATTR_DEF_ACCOUNT)
522 {
523 $v=mb_strtoupper($value->av_text??"");
524 // 2 accounts given
525 if (trim($v)!='')
526 {
527 if (strpos($v, ',')!=0)
528 {
529 $ac_array=explode(",", $v);
530 if (count($ac_array)<>2)
531 throw new Exception('Désolé, il y a trop de virgule dans le poste comptable '.h($v));
532 $part1=$ac_array[0];
533 $part2=$ac_array[1];
534 $part1=$p_fiche->cn->get_value('select format_account($1)', array($part1));
535 $part2=$p_fiche->cn->get_value('select format_account($1)', array($part2));
536
537 if (mb_strlen($part1)>40)
538 throw new Exception("CP475."._("Poste comptable trop long"), 1);
539 if (mb_strlen($part2)>40)
540 throw new Exception("CP476."._("Poste comptable trop long"), 1);
541
542 $acc_account1=new Acc_Account($p_fiche->cn, $part1);
543
544 if ($acc_account1->get_parameter("id")==-1)
545 {
546 $account_name=$name;
547 $acc_account1->set_parameter("pcm_lib", $account_name);
548 $acc_account1->set_parameter('pcm_direct_use', "Y");
549 $parent=$acc_account1->find_parent();
550 $acc_account1->set_parameter("pcm_val_parent", $parent);
551 $acc_account1->save();
552 }
553 // Check that the accounting can be used directly
554 if ($acc_account1->get_parameter('pcm_direct_use')=='N')
555 {
556 throw new Exception("CP493."._("Utilisation directe interdite du poste comptable $part1"));
557 }
558 // Part 2
559 $acc_account2=new Acc_Account($p_fiche->cn, $part2);
560
561 if ($acc_account2->get_parameter("id")==-1)
562 {
563 $account_name=$name;
564 $acc_account2->set_parameter("pcm_lib", $account_name);
565 $acc_account2->set_parameter('pcm_direct_use', "Y");
566 $parent=$acc_account2->find_parent();
567 $acc_account2->set_parameter("pcm_val_parent", $parent);
568 $acc_account2->save();
569 }
570
571 // Check that the accounting can be used directly
572 if ($acc_account2->get_parameter('pcm_direct_use')=='N')
573 {
574 throw new Exception("CP511."._("Utilisation directe interdite du poste comptable $part2"));
575 }
576 $v=$part1.','.$part2;
577 }
578 else
579 {
580 if (mb_strlen($v)>40)
581 throw new Exception("CP520."._("Poste comptable trop long"), 1);
582 $acc_account=new Acc_Account($p_fiche->cn, $v);
583 // Set default for new accounting
584 if ($acc_account->get_parameter("id")==-1)
585 {
586 $account_name=$name;
587 $acc_account->set_parameter("pcm_lib", $account_name);
588 // By Default can be used directly
589 $acc_account->set_parameter('pcm_direct_use', "Y");
590 $parent=$acc_account->find_parent();
591 $acc_account->set_parameter("pcm_val_parent", $parent);
592 $acc_account->save();
593 }
594
595 $acc_account=new Acc_Account($p_fiche->cn, $v);
596 if ($acc_account->get_parameter('pcm_direct_use')=='N')
597 {
598 throw new Exception("CP537."._("Utilisation directe interdite du poste comptable $v"));
599 }
600 }
601 $sql=sprintf("select account_insert(%d,'%s')", $p_fiche->id, $v);
602 try
603 {
604 $p_fiche->cn->exec_sql($sql);
605 }
606 catch (Exception $e)
607 {
608 throw new Exception("CP546."._("opération annulée")." ".$e->getMessage());
609 }
610 continue;
611 }
612 if (noalyss_strlentrim($v)==0)
613 {
614
615 $sql=sprintf("select account_insert(%d,null)", $p_fiche->id);
616 try
617 {
618 $Ret=$p_fiche->cn->exec_sql($sql);
619 }
620 catch (Exception $e)
621 {
622 throw new Exception("CP560."._("Erreur : Aucun compte parent ")."[$v]");
623 }
624
625 continue;
626 }
627 }
628 // TVA
629 if ($value->ad_id==ATTR_DEF_TVA)
630 {
631 // Verify if the rate exists, if not then do not update
632 if (noalyss_strlentrim($value->av_text)!=0)
633 {
634 $acc_tva=Acc_Tva::build($p_fiche->cn,$value->av_text );
635 if ($acc_tva->tva_id==-1)
636 {
637 continue;
638 }
639 }
640 }
641 // Normal traitement
642 $sql="update fiche_detail set ad_value=$1 where jft_id=$2";
643 $p_fiche->cn->exec_sql($sql, array(noalyss_strip_tags($value->av_text), $jft_id));
644 }
645 if ($commit)
646 {
647 $p_fiche->cn->commit();
648 }
649 }
650 catch (Exception $e)
651 {
652 echo '<span class="error">'.
653 $e->getMessage().
654 '</span>';
655 record_log("CP597.".$e->getMessage().$e->getTraceAsString());
656 if ($commit) { $p_fiche->cn->rollback(); }
657 return;
658 }
659
660 return;
661 }
662
663 /**
664 * @brief add a link
665 * @param $p_ad_id
666 * @param $p_text
667 * @return false|mixed|string
668 */
669 private function add_link($p_ad_id,$p_text) {
670 if ( $this->display_mode=="large" && $p_ad_id == ATTR_DEF_WEBSITE) {
671 $url=linkTo($p_text);
672 }elseif ( $this->display_mode=="large" && $p_ad_id == ATTR_DEF_EMAIL) {
673 $url=mailTo($p_text);
674 }elseif ( $this->display_mode=="large" && $p_ad_id == ATTR_DEF_FAX) {
675 $url=faxTo($p_text);
676 }else {
677 return "";
678 }
679 return $url;
680 }
681
682 /**
683 * @brief return the Property of an array of property with the right ad_id
684 * @param int $attr_def_id the search attr_def_id
685 * @param array $a_property array of Card_Property
686 * @return mixed|null
687 */
688 static function findProperty($attr_def_id, $a_property)
689 {
690 $nb = count($a_property);
691 for ($i = 0; $i < $nb; $i++) {
692 if ($a_property[$i]->get_ad_id() == $attr_def_id) return $a_property[$i];
693 }
694 return null;
695 }
696}
mailTo($p_email)
compose a HTML string with email
noalyss_strip_tags($p_string)
noalyss_strlentrim($p_string)
linkTo($p_url)
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
Definition ac_common.php:83
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
h( $row[ 'oa_description'])
foreach($array as $idx=> $m) $w
$filter
$input_from cn
_("actif, passif,charge,...")
$fiche_def
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)
$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.
$cn
cn database connexion
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
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
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...
strAttribut($p_ad_id, $p_return=1)
get_f_enable()
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...
Html Input.
Html Input.
let you choose a TVA in a popup
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.
show a switch, when you click on it an hidden field is changed, the value is 1 or 0
$t
Definition compute.php:46
const ATTR_DEF_NUMTVA
Definition constant.php:222
const ATTR_DEF_NAME
Definition constant.php:216
const ATTR_DEF_TVA
Definition constant.php:221
const ATTR_DEF_EMAIL
Definition constant.php:228
const ATTR_DEF_WEBSITE
Definition constant.php:239
const ATTR_DEF_FAX
Definition constant.php:231
const ATTR_DEF_QUICKCODE
Definition constant.php:237
const ATTR_DEF_ACCOUNT
Definition constant.php:215
$flag
Definition install.php:536
if( $delta< 0) elseif( $delta==0)