dolibarr  7.0.0-beta
ecmdirectory.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2008-2012 Regis Houssin <regis.houssin@capnetworks.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
28 class EcmDirectory // extends CommonObject
29 {
30  public $element='ecm_directories';
31  //public $table_element='ecm_directories'; //!< Name of table without prefix where object is stored
32  var $picto = 'dir';
33 
34  var $id;
35 
36  var $label;
37  var $fk_parent;
38  var $description;
39  var $cachenbofdoc=-1; // By default cache initialized with value 'not calculated'
40  var $date_c;
41  var $date_m;
42  public $fk_user_m;
43  public $fk_user_c;
44  public $ref;
45 
46  var $cats=array();
47  var $motherof=array();
48 
49  var $forbiddenchars = array('<','>',':','/','\\','?','*','|','"');
50  var $forbiddencharsdir = array('<','>',':','?','*','|','"');
51 
52  public $full_arbo_loaded;
53 
54  public $error;
55  public $errors;
56 
57 
63  function __construct($db)
64  {
65  $this->db = $db;
66  return 1;
67  }
68 
69 
76  function create($user)
77  {
78  global $conf, $langs;
79 
80  $error=0;
81  $now=dol_now();
82 
83  // Clean parameters
84  $this->label=dol_sanitizeFileName(trim($this->label));
85  $this->fk_parent=trim($this->fk_parent);
86  $this->description=trim($this->description);
87  $this->date_c=$now;
88  $this->fk_user_c=$user->id;
89  if ($this->fk_parent <= 0) $this->fk_parent=0;
90 
91 
92  // Check if same directory does not exists with this name
93  $relativepath=$this->label;
94  if ($this->fk_parent)
95  {
96  $parent = new EcmDirectory($this->db);
97  $parent->fetch($this->fk_parent);
98  $relativepath=$parent->getRelativePath().$relativepath;
99  }
100  $relativepath=preg_replace('/([\/])+/i','/',$relativepath); // Avoid duplicate / or \
101  //print $relativepath.'<br>';
102 
103  $cat = new EcmDirectory($this->db);
104  $cate_arbo = $cat->get_full_arbo(1);
105  $pathfound=0;
106  foreach ($cate_arbo as $key => $categ)
107  {
108  $path=str_replace($this->forbiddencharsdir, '_', $categ['fullrelativename']);
109  //print $relativepath.' - '.$path.'<br>';
110  if ($path == $relativepath)
111  {
112  $pathfound=1;
113  break;
114  }
115  }
116 
117  if ($pathfound)
118  {
119  $this->error="ErrorDirAlreadyExists";
120  dol_syslog(get_class($this)."::create ".$this->error, LOG_WARNING);
121  return -1;
122  }
123  else
124  {
125  $this->db->begin();
126 
127  // Insert request
128  $sql = "INSERT INTO ".MAIN_DB_PREFIX."ecm_directories(";
129  $sql.= "label,";
130  $sql.= "entity,";
131  $sql.= "fk_parent,";
132  $sql.= "description,";
133  $sql.= "cachenbofdoc,";
134  $sql.= "date_c,";
135  $sql.= "fk_user_c";
136  $sql.= ") VALUES (";
137  $sql.= " '".$this->db->escape($this->label)."',";
138  $sql.= " '".$this->db->escape($conf->entity)."',";
139  $sql.= " '".$this->db->escape($this->fk_parent)."',";
140  $sql.= " '".$this->db->escape($this->description)."',";
141  $sql.= " ".$this->cachenbofdoc.",";
142  $sql.= " '".$this->db->idate($this->date_c)."',";
143  $sql.= " '".$this->db->escape($this->fk_user_c)."'";
144  $sql.= ")";
145 
146  dol_syslog(get_class($this)."::create", LOG_DEBUG);
147  $resql=$this->db->query($sql);
148  if ($resql)
149  {
150  $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."ecm_directories");
151 
152  $dir=$conf->ecm->dir_output.'/'.$this->getRelativePath();
153  $result=dol_mkdir($dir);
154  if ($result < 0) { $error++; $this->error="ErrorFailedToCreateDir"; }
155 
156  // Call trigger
157  $result=$this->call_trigger('MYECMDIR_CREATE',$user);
158  if ($result < 0) { $error++; }
159  // End call triggers
160 
161  if (! $error)
162  {
163  $this->db->commit();
164  return $this->id;
165  }
166  else
167  {
168  $this->db->rollback();
169  return -1;
170  }
171  }
172  else
173  {
174  $this->error="Error ".$this->db->lasterror();
175  $this->db->rollback();
176  return -1;
177  }
178  }
179  }
180 
188  function update($user=null, $notrigger=0)
189  {
190  global $conf, $langs;
191 
192  $error=0;
193 
194  // Clean parameters
195  $this->label=trim($this->label);
196  $this->fk_parent=trim($this->fk_parent);
197  $this->description=trim($this->description);
198 
199  // Check parameters
200  // Put here code to add control on parameters values
201 
202  $this->db->begin();
203 
204  // Update request
205  $sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories SET";
206  $sql.= " label='".$this->db->escape($this->label)."',";
207  $sql.= " fk_parent='".$this->db->escape($this->fk_parent)."',";
208  $sql.= " description='".$this->db->escape($this->description)."'";
209  $sql.= " WHERE rowid=".$this->id;
210 
211  dol_syslog(get_class($this)."::update", LOG_DEBUG);
212  $resql = $this->db->query($sql);
213  if (! $resql)
214  {
215  $error++;
216  $this->error="Error ".$this->db->lasterror();
217  }
218 
219  if (! $error && ! $notrigger)
220  {
221  // Call trigger
222  $result=$this->call_trigger('MYECMDIR_MODIFY',$user);
223  if ($result < 0) { $error++; }
224  // End call triggers
225  }
226 
227  if (! $error)
228  {
229  $this->db->commit();
230  return 1;
231  }
232  else
233  {
234  $this->db->rollback();
235  return -1;
236  }
237  }
238 
239 
246  function changeNbOfFiles($value)
247  {
248  // Update request
249  $sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories SET";
250  if (preg_match('/[0-9]+/', $value)) $sql.= " cachenbofdoc = ".(int) $value;
251  else $sql.= " cachenbofdoc = cachenbofdoc ".$value." 1";
252  $sql.= " WHERE rowid = ".$this->id;
253 
254  dol_syslog(get_class($this)."::changeNbOfFiles", LOG_DEBUG);
255  $resql = $this->db->query($sql);
256  if (! $resql)
257  {
258  $this->error="Error ".$this->db->lasterror();
259  return -1;
260  }
261  else
262  {
263  if (preg_match('/[0-9]+/', $value)) $this->cachenbofdoc = (int) $value;
264  else if ($value == '+') $this->cachenbofdoc++;
265  else if ($value == '-') $this->cachenbofdoc--;
266  }
267 
268  return 1;
269  }
270 
271 
278  function fetch($id)
279  {
280  $sql = "SELECT";
281  $sql.= " t.rowid,";
282  $sql.= " t.label,";
283  $sql.= " t.fk_parent,";
284  $sql.= " t.description,";
285  $sql.= " t.cachenbofdoc,";
286  $sql.= " t.fk_user_c,";
287  $sql.= " t.fk_user_m,";
288  $sql.= " t.date_c as date_c,";
289  $sql.= " t.date_m as date_m";
290  $sql.= " FROM ".MAIN_DB_PREFIX."ecm_directories as t";
291  $sql.= " WHERE t.rowid = ".$id;
292 
293  dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
294  $resql=$this->db->query($sql);
295  if ($resql)
296  {
297  $obj = $this->db->fetch_object($resql);
298  if ($obj)
299  {
300  $this->id = $obj->rowid;
301  $this->ref = $obj->rowid;
302 
303  $this->label = $obj->label;
304  $this->fk_parent = $obj->fk_parent;
305  $this->description = $obj->description;
306  $this->cachenbofdoc = $obj->cachenbofdoc;
307  $this->fk_user_m = $obj->fk_user_m;
308  $this->fk_user_c = $obj->fk_user_c;
309  $this->date_c = $this->db->jdate($obj->date_c);
310  $this->date_m = $this->db->jdate($obj->date_m);
311  }
312 
313  $this->db->free($resql);
314 
315  return $obj?1:0;
316  }
317  else
318  {
319  $this->error="Error ".$this->db->lasterror();
320  return -1;
321  }
322  }
323 
324 
332  function delete($user, $mode='all')
333  {
334  global $conf, $langs;
335  require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
336 
337  $error=0;
338 
339  if ($mode != 'databaseonly') $relativepath=$this->getRelativePath(1); // Ex: dir1/dir2/dir3
340 
341  dol_syslog(get_class($this)."::delete remove directory id=".$this->id." mode=".$mode.(($mode == 'databaseonly')?'':' relativepath='.$relativepath));
342 
343  $this->db->begin();
344 
345  $sql = "DELETE FROM ".MAIN_DB_PREFIX."ecm_directories";
346  $sql.= " WHERE rowid=".$this->id;
347 
348  dol_syslog(get_class($this)."::delete", LOG_DEBUG);
349  $resql = $this->db->query($sql);
350  if (! $resql)
351  {
352  $this->db->rollback();
353  $this->error="Error ".$this->db->lasterror();
354  return -2;
355  }
356  else
357  {
358  // Call trigger
359  $result=$this->call_trigger('MYECMDIR_DELETE',$user);
360  if ($result < 0)
361  {
362  $this->db->rollback();
363  return -2;
364  }
365  // End call triggers
366  }
367 
368  if ($mode != 'databaseonly')
369  {
370  $file = $conf->ecm->dir_output . "/" . $relativepath;
371  $result=@dol_delete_dir($file);
372  }
373 
374  if ($result || ! @is_dir(dol_osencode($file)))
375  {
376  $this->db->commit();
377  }
378  else
379  {
380  $this->error='ErrorFailToDeleteDir';
381  dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
382  $this->db->rollback();
383  $error++;
384  }
385 
386  if (! $error) return 1;
387  else return -1;
388  }
389 
390 
398  function initAsSpecimen()
399  {
400  $this->id=0;
401 
402  $this->label='MyDirectory';
403  $this->fk_parent='0';
404  $this->description='This is a directory';
405  }
406 
407 
418  function getNomUrl($withpicto=0, $option='', $max=0, $more='', $notooltip=0)
419  {
420  global $langs;
421 
422  $result='';
423  //$newref=str_replace('_',' ',$this->ref);
424  $newref=$this->ref;
425  $label=$langs->trans("ShowECMSection").': '.$newref;
426  $linkclose='"'.($more?' '.$more:'').' title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
427 
428  $linkstart = '<a href="'.DOL_URL_ROOT.'/ecm/dir_card.php?section='.$this->id.$linkclose;
429  if ($option == 'index') $linkstart = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&amp;sectionexpand=true'.$linkclose;
430  if ($option == 'indexexpanded') $linkstart = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&amp;sectionexpand=false'.$linkclose;
431  if ($option == 'indexnotexpanded') $linkstart = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&amp;sectionexpand=true'.$linkclose;
432  $linkend='</a>';
433 
434  //$picto=DOL_URL_ROOT.'/theme/common/treemenu/folder.gif';
435  $picto='dir';
436 
437  $result .= $linkstart;
438  if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
439  if ($withpicto != 2) $result.= ($max?dol_trunc($newref,$max,'middle'):$newref);
440  $result .= $linkend;
441 
442  return $result;
443  }
444 
451  function getRelativePath($force=0)
452  {
453  $this->get_full_arbo($force);
454 
455  $ret='';
456  $idtosearch=$this->id;
457  $i=0;
458  do {
459  // Get index cursor in this->cats for id_mere
460  $cursorindex=-1;
461  foreach ($this->cats as $key => $val)
462  {
463  if ($this->cats[$key]['id'] == $idtosearch)
464  {
465  $cursorindex=$key;
466  break;
467  }
468  }
469  //print "c=".$idtosearch."-".$cursorindex;
470 
471  if ($cursorindex >= 0)
472  {
473  // Path is label sanitized (no space and no special char) and concatenated
474  $ret=dol_sanitizeFileName($this->cats[$cursorindex]['label']).'/'.$ret;
475 
476  $idtosearch=$this->cats[$cursorindex]['id_mere'];
477  $i++;
478  }
479  }
480  while ($cursorindex >= 0 && ! empty($idtosearch) && $i < 100); // i avoid infinite loop
481 
482  return $ret;
483  }
484 
490  function load_motherof()
491  {
492  global $conf;
493 
494  $this->motherof=array();
495 
496  // Load array[child]=parent
497  $sql = "SELECT fk_parent as id_parent, rowid as id_son";
498  $sql.= " FROM ".MAIN_DB_PREFIX."ecm_directories";
499  $sql.= " WHERE fk_parent != 0";
500  $sql.= " AND entity = ".$conf->entity;
501 
502  dol_syslog(get_class($this)."::load_motherof", LOG_DEBUG);
503  $resql = $this->db->query($sql);
504  if ($resql)
505  {
506  // This assignment in condition is not a bug. It allows walking the results.
507  while ($obj=$this->db->fetch_object($resql))
508  {
509  $this->motherof[$obj->id_son]=$obj->id_parent;
510  }
511  return 1;
512  }
513  else
514  {
515  dol_print_error($this->db);
516  return -1;
517  }
518  }
519 
520 
527  function getLibStatut($mode=0)
528  {
529  return $this->LibStatut($this->status,$mode);
530  }
531 
539  static function LibStatut($status,$mode=0)
540  {
541  global $langs;
542  return '';
543  }
544 
545 
565  function get_full_arbo($force=0)
566  {
567  global $conf;
568 
569  if (empty($force) && ! empty($this->full_arbo_loaded))
570  {
571  return $this->cats;
572  }
573 
574  // Init this->motherof that is array(id_son=>id_parent, ...)
575  $this->load_motherof();
576 
577  // Charge tableau des categories
578  $sql = "SELECT c.rowid as rowid, c.label as label,";
579  $sql.= " c.description as description, c.cachenbofdoc,";
580  $sql.= " c.fk_user_c,";
581  $sql.= " c.date_c,";
582  $sql.= " u.login as login_c,";
583  $sql.= " ca.rowid as rowid_fille";
584  $sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."ecm_directories as c";
585  $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."ecm_directories as ca";
586  $sql.= " ON c.rowid = ca.fk_parent";
587  $sql.= " WHERE c.fk_user_c = u.rowid";
588  $sql.= " AND c.entity = ".$conf->entity;
589  $sql.= " ORDER BY c.label, c.rowid";
590 
591  dol_syslog(get_class($this)."::get_full_arbo", LOG_DEBUG);
592  $resql = $this->db->query($sql);
593  if ($resql)
594  {
595  $this->cats = array();
596  $i=0;
597  // This assignment in condition is not a bug. It allows walking the results.
598  while ($obj = $this->db->fetch_object($resql))
599  {
600  $this->cats[$obj->rowid]['id'] = $obj->rowid;
601  $this->cats[$obj->rowid]['id_mere'] = (isset($this->motherof[$obj->rowid])?$this->motherof[$obj->rowid]:'');
602  $this->cats[$obj->rowid]['label'] = $obj->label;
603  $this->cats[$obj->rowid]['description'] = $obj->description;
604  $this->cats[$obj->rowid]['cachenbofdoc'] = $obj->cachenbofdoc;
605  $this->cats[$obj->rowid]['date_c'] = $this->db->jdate($obj->date_c);
606  $this->cats[$obj->rowid]['fk_user_c'] = $obj->fk_user_c;
607  $this->cats[$obj->rowid]['login_c'] = $obj->login_c;
608 
609  if (! empty($obj->rowid_fille))
610  {
611  if (isset($this->cats[$obj->rowid]['id_children']) && is_array($this->cats[$obj->rowid]['id_children']))
612  {
613  $newelempos=count($this->cats[$obj->rowid]['id_children']);
614  //print "this->cats[$i]['id_children'] est deja un tableau de $newelem elements<br>";
615  $this->cats[$obj->rowid]['id_children'][$newelempos]=$obj->rowid_fille;
616  }
617  else
618  {
619  //print "this->cats[".$obj->rowid."]['id_children'] n'est pas encore un tableau<br>";
620  $this->cats[$obj->rowid]['id_children']=array($obj->rowid_fille);
621  }
622  }
623  $i++;
624 
625  }
626  }
627  else
628  {
629  dol_print_error($this->db);
630  return -1;
631  }
632 
633  // We add properties fullxxx to all elements
634  foreach($this->cats as $key => $val)
635  {
636  if (isset($motherof[$key])) continue;
637  $this->build_path_from_id_categ($key,0);
638  }
639 
640  $this->cats=dol_sort_array($this->cats, 'fulllabel', 'asc', true, false);
641  $this->full_arbo_loaded=1;
642 
643  return $this->cats;
644  }
645 
654  function build_path_from_id_categ($id_categ,$protection=0)
655  {
656  // Define fullpath
657  if (! empty($this->cats[$id_categ]['id_mere']))
658  {
659  $this->cats[$id_categ]['fullpath'] =$this->cats[$this->cats[$id_categ]['id_mere']]['fullpath'];
660  $this->cats[$id_categ]['fullpath'].='_'.$id_categ;
661  $this->cats[$id_categ]['fullrelativename'] =$this->cats[$this->cats[$id_categ]['id_mere']]['fullrelativename'];
662  $this->cats[$id_categ]['fullrelativename'].='/'.$this->cats[$id_categ]['label'];
663  $this->cats[$id_categ]['fulllabel'] =$this->cats[$this->cats[$id_categ]['id_mere']]['fulllabel'];
664  $this->cats[$id_categ]['fulllabel'].=' >> '.$this->cats[$id_categ]['label'];
665  }
666  else
667  {
668  $this->cats[$id_categ]['fullpath']='_'.$id_categ;
669  $this->cats[$id_categ]['fullrelativename']=$this->cats[$id_categ]['label'];
670  $this->cats[$id_categ]['fulllabel']=$this->cats[$id_categ]['label'];
671  }
672  // We count number of _ to have level (we use strlen that is faster than dol_strlen)
673  $this->cats[$id_categ]['level']=strlen(preg_replace('/([^_])/i','',$this->cats[$id_categ]['fullpath']));
674 
675  // Traite ces enfants
676  $protection++;
677  if ($protection > 20) return; // On ne traite pas plus de 20 niveaux
678  if (isset($this->cats[$id_categ]['id_children']) && is_array($this->cats[$id_categ]['id_children']))
679  {
680  foreach($this->cats[$id_categ]['id_children'] as $key => $val)
681  {
682  $this->build_path_from_id_categ($val,$protection);
683  }
684  }
685  }
686 
693  function refreshcachenboffile($all=0)
694  {
695  global $conf;
696  include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
697 
698  $dir=$conf->ecm->dir_output.'/'.$this->getRelativePath();
699  $filelist=dol_dir_list($dir,'files',0,'','(\.meta|_preview.*\.png)$');
700 
701  // Test if filelist is in database
702 
703 
704  // Update request
705  $sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories SET";
706  $sql.= " cachenbofdoc = '".count($filelist)."'";
707  if (empty($all)) // By default
708  {
709  $sql.= " WHERE rowid = ".$this->id;
710  }
711  else
712  {
713  $sql.= " WHERE entity = ".$conf->entity;
714  }
715 
716  dol_syslog(get_class($this)."::refreshcachenboffile", LOG_DEBUG);
717  $resql = $this->db->query($sql);
718  if ($resql)
719  {
720  $this->cachenbofdoc=count($filelist);
721  return $this->cachenbofdoc;
722  }
723  else
724  {
725  $this->error="Error ".$this->db->lasterror();
726  return -1;
727  }
728  }
729 
741  function call_trigger($trigger_name, $user)
742  {
743  global $langs,$conf;
744 
745  include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
746  $interface=new Interfaces($this->db);
747  $result=$interface->run_triggers($trigger_name,$this,$user,$langs,$conf);
748  if ($result < 0) {
749  if (!empty($this->errors))
750  {
751  $this->errors=array_merge($this->errors,$interface->errors);
752  }
753  else
754  {
755  $this->errors=$interface->errors;
756  }
757  }
758  return $result;
759 
760  }
761 
762 
763 }
dol_osencode($str)
Return a string encoded into OS filesystem encoding.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '...' if string larger than length.
get_full_arbo($force=0)
Reconstruit l'arborescence des categories sous la forme d'un tableau à partir de la base de donnée Re...
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
</td >< tdclass="liste_titre"align="right"></td ></tr >< trclass="liste_titre">< inputtype="checkbox"onClick="toggle(this)"/> Ref p ref Label p label Duration p duration warehouseinternal SELECT description FROM product_lang WHERE qty< br > qty qty qty StockTooLow img yes disabled img no img no< trclass="oddeven">< td >< inputtype="checkbox"class="check"name="'.$i.'"'.$disabled.'></td >< td >< inputtype="checkbox"class="check"name="choose'.$i.'"></td >< tdclass="nowrap"></td >< td >< inputtype="hidden"name="desc'.$i.'"value="'.dol_escape_htmltag($objp-> description
Only used if Module[ID]Desc translation string is not found.
Definition: replenish.php:554
$element
Id that identify managed objects.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
build_path_from_id_categ($id_categ, $protection=0)
Define properties fullpath, fullrelativename, fulllabel of a directory of array this->cats and all it...
getRelativePath($force=0)
Return relative path of a directory on disk.
dol_print_error($db='', $error='', $errors=null)
Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remonte...
refreshcachenboffile($all=0)
Refresh value for cachenboffile.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...
initAsSpecimen()
Initialise an instance with random values.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="")
Scan a directory and return a list of files/directories.
Definition: files.lib.php:58
fetch($id)
Load object in memory from database.
getNomUrl($withpicto=0, $option='', $max=0, $more='', $notooltip=0)
Return directory name you can click (and picto)
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='')
Write log message into outputs.
getLibStatut($mode=0)
Retourne le libelle du status d'un user (actif, inactif)
img_object($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
__construct($db)
Constructor.
static LibStatut($status, $mode=0)
Return the status.
dol_now($mode='gmt')
Return date for now.
create($user)
Create record into database.
call_trigger($trigger_name, $user)
Call trigger based on this instance.
changeNbOfFiles($value)
Update cache of nb of documents into database.
dol_mkdir($dir, $dataroot='', $newmask=null)
Creation of a directory (this can create recursive subdir)
update($user=null, $notrigger=0)
Update database.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if(!empty($conf->fournisseur->enabled)&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->societe->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if(!empty($conf->fournisseur->enabled)&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1013
load_motherof()
Load this->motherof that is array(id_son=>id_parent, ...)
dol_delete_dir($dir, $nophperrors=0)
Remove a directory (not recursive, so content must be empty).
Definition: files.lib.php:1210
Class to manage ECM directories.
Class to manage triggers.