dolibarr  17.0.4
productlot.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) 2014 Juanjo Menent <jmenent@2byte.es>
4  * Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
5  * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
6  * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20  */
21 
28 // Put here all includes required by your class file
29 require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
30 //require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
31 //require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
32 
36 class Productlot extends CommonObject
37 {
41  public $element = 'productlot';
42 
46  public $table_element = 'product_lot';
47 
51  public $picto = 'lot';
52 
57  public $ismultientitymanaged = 1;
58 
59 
88  public $fields = array(
89  'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'noteditable'=>1, 'notnull'=> 1, 'index'=>1, 'position'=>1, 'comment'=>'Id', 'css'=>'left'),
90  'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>5, 'notnull'=>1, 'index'=>1, 'searchall'=>1),
91  'batch' => array('type'=>'varchar(30)', 'label'=>'Batch', 'enabled'=>1, 'visible'=>1, 'notnull'=>0, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'comment'=>'Batch', 'searchall'=>1),
92  'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20),
93  'sellby' => array('type'=>'date', 'label'=>'SellByDate', 'enabled'=>'empty($conf->global->PRODUCT_DISABLE_SELLBY)?1:0', 'visible'=>5, 'position'=>60),
94  'eol_date' => array('type'=>'date', 'label'=>'EndOfLife', 'enabled'=>'empty($conf->global->PRODUCT_ENABLE_TRACEABILITY)?0:1', 'visible'=>5, 'position'=>70),
95  'manufacturing_date' => array('type'=>'date', 'label'=>'ManufacturingDate', 'enabled'=>'empty($conf->global->PRODUCT_ENABLE_TRACEABILITY)?0:1', 'visible'=>5, 'position'=>80),
96  'scrapping_date' => array('type'=>'date', 'label'=>'DestructionDate', 'enabled'=>'empty($conf->global->PRODUCT_ENABLE_TRACEABILITY)?0:1', 'visible'=>5, 'position'=>90),
97  //'commissionning_date' => array('type'=>'date', 'label'=>'FirstUseDate', 'enabled'=>'empty($conf->global->PRODUCT_ENABLE_TRACEABILITY)?0:1', 'visible'=>5, 'position'=>100),
98  //'qc_frequency' => array('type'=>'varchar(6)', 'label'=>'QCFrequency', 'enabled'=>'empty($conf->global->PRODUCT_ENABLE_QUALITYCONTROL)?1:0', 'visible'=>5, 'position'=>110),
99  'eatby' => array('type'=>'date', 'label'=>'EatByDate', 'enabled'=>'empty($conf->global->PRODUCT_DISABLE_EATBY)?1:0', 'visible'=>5, 'position'=>62),
100  'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>500),
101  'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501),
102  'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510, 'foreignkey'=>'llx_user.rowid'),
103  'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511),
104  'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000)
105  );
106 
110  public $entity;
111 
115  public $fk_product;
116 
120  public $batch;
121  public $eatby = '';
122  public $sellby = '';
123  public $eol_date = '';
124  public $manufacturing_date = '';
125  public $scrapping_date = '';
126  //public $commissionning_date = '';
127  //public $qc_frequency = '';
128  public $datec = '';
129  public $tms = '';
130 
134  public $fk_user_creat;
135 
139  public $fk_user_modif;
140 
144  public $import_key;
145 
146 
152  public function __construct(DoliDB $db)
153  {
154  $this->db = $db;
155  }
156 
165  public function create(User $user, $notrigger = false)
166  {
167  global $conf;
168  dol_syslog(__METHOD__, LOG_DEBUG);
169 
170  $error = 0;
171 
172  // Clean parameters
173 
174  if (isset($this->entity)) {
175  $this->entity = (int) $this->entity;
176  }
177  if (isset($this->fk_product)) {
178  $this->fk_product = (int) $this->fk_product;
179  }
180  if (isset($this->batch)) {
181  $this->batch = trim($this->batch);
182  }
183  if (isset($this->fk_user_creat)) {
184  $this->fk_user_creat = (int) $this->fk_user_creat;
185  }
186  if (isset($this->fk_user_modif)) {
187  $this->fk_user_modif = (int) $this->fk_user_modif;
188  }
189  if (isset($this->import_key)) {
190  $this->import_key = trim($this->import_key);
191  }
192 
193  // Check parameters
194  // Put here code to add control on parameters values
195 
196  // Insert request
197  $sql = 'INSERT INTO '.$this->db->prefix().$this->table_element.'(';
198  $sql .= 'entity,';
199  $sql .= 'fk_product,';
200  $sql .= 'batch,';
201  $sql .= 'eatby,';
202  $sql .= 'sellby,';
203  $sql .= 'eol_date,';
204  $sql .= 'manufacturing_date,';
205  $sql .= 'scrapping_date,';
206  //$sql .= 'commissionning_date,';
207  //$sql .= 'qc_frequency,';
208  $sql .= 'datec,';
209  $sql .= 'fk_user_creat,';
210  $sql .= 'fk_user_modif,';
211  $sql .= 'import_key';
212  $sql .= ') VALUES (';
213  $sql .= ' '.(!isset($this->entity) ? $conf->entity : $this->entity).',';
214  $sql .= ' '.(!isset($this->fk_product) ? 'NULL' : $this->fk_product).',';
215  $sql .= ' '.(!isset($this->batch) ? 'NULL' : "'".$this->db->escape($this->batch)."'").',';
216  $sql .= ' '.(!isset($this->eatby) || dol_strlen($this->eatby) == 0 ? 'NULL' : "'".$this->db->idate($this->eatby)."'").',';
217  $sql .= ' '.(!isset($this->sellby) || dol_strlen($this->sellby) == 0 ? 'NULL' : "'".$this->db->idate($this->sellby)."'").',';
218  $sql .= ' '.(!isset($this->eol_date) || dol_strlen($this->eol_date) == 0 ? 'NULL' : "'".$this->db->idate($this->eol_date)."'").',';
219  $sql .= ' '.(!isset($this->manufacturing_date) || dol_strlen($this->manufacturing_date) == 0 ? 'NULL' : "'".$this->db->idate($this->manufacturing_date)."'").',';
220  $sql .= ' '.(!isset($this->scrapping_date) || dol_strlen($this->scrapping_date) == 0 ? 'NULL' : "'".$this->db->idate($this->scrapping_date)."'").',';
221  //$sql .= ' '.(!isset($this->commissionning_date) || dol_strlen($this->commissionning_date) == 0 ? 'NULL' : "'".$this->db->idate($this->commissionning_date)."'").',';
222  //$sql .= ' '.(!isset($this->qc_frequency) ? 'NULL' : $this->qc_frequency).',';
223  $sql .= ' '."'".$this->db->idate(dol_now())."'".',';
224  $sql .= ' '.(!isset($this->fk_user_creat) ? 'NULL' : $this->fk_user_creat).',';
225  $sql .= ' '.(!isset($this->fk_user_modif) ? 'NULL' : $this->fk_user_modif).',';
226  $sql .= ' '.(!isset($this->import_key) ? 'NULL' : $this->import_key);
227  $sql .= ')';
228 
229  $this->db->begin();
230 
231  $resql = $this->db->query($sql);
232  if (!$resql) {
233  $error++;
234  $this->errors[] = 'Error '.$this->db->lasterror();
235  dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
236  }
237 
238  if (!$error) {
239  $this->id = $this->db->last_insert_id($this->db->prefix().$this->table_element);
240 
241  // Actions on extra fields
242  if (!$error) {
243  $result = $this->insertExtraFields();
244  if ($result < 0) {
245  $error++;
246  }
247  }
248 
249  if (!$error && !$notrigger) {
250  // Call triggers
251  $result = $this->call_trigger('PRODUCTLOT_CREATE', $user);
252  if ($result < 0) {
253  $error++;
254  }
255  // End call triggers
256  }
257  }
258 
259  // Commit or rollback
260  if ($error) {
261  $this->db->rollback();
262 
263  return -1 * $error;
264  } else {
265  $this->db->commit();
266 
267  return $this->id;
268  }
269  }
270 
280  public function fetch($id = 0, $product_id = 0, $batch = '')
281  {
282  global $conf;
283  dol_syslog(__METHOD__, LOG_DEBUG);
284 
285  $sql = "SELECT";
286  $sql .= " t.rowid,";
287  $sql .= " t.entity,";
288  $sql .= " t.fk_product,";
289  $sql .= " t.batch,";
290  $sql .= " t.eatby,";
291  $sql .= " t.sellby,";
292  $sql .= " t.eol_date,";
293  $sql .= " t.manufacturing_date,";
294  $sql .= " t.scrapping_date,";
295  //$sql .= " t.commissionning_date,";
296  //$sql .= " t.qc_frequency,";
297  $sql .= " t.datec,";
298  $sql .= " t.tms,";
299  $sql .= " t.fk_user_creat,";
300  $sql .= " t.fk_user_modif,";
301  $sql .= " t.import_key,";
302  $sql .= " t.note_public,";
303  $sql .= " t.note_private";
304  $sql .= " FROM ".$this->db->prefix().$this->table_element." as t";
305  if ($product_id > 0 && $batch != '') {
306  $sql .= " WHERE t.batch = '".$this->db->escape($batch)."' AND t.fk_product = ".((int) $product_id);
307  } else {
308  $sql .= " WHERE t.rowid = ".((int) $id);
309  }
310 
311  $resql = $this->db->query($sql);
312  if ($resql) {
313  $numrows = $this->db->num_rows($resql);
314  if ($numrows) {
315  $obj = $this->db->fetch_object($resql);
316 
317  $this->id = $obj->rowid;
318  $this->ref = $obj->rowid;
319  //$this->ref = $obj->fk_product.'_'.$obj->batch;
320 
321  $this->batch = $obj->batch;
322  $this->entity = (!empty($obj->entity) ? $obj->entity : $conf->entity); // Prevent "null" entity
323  $this->fk_product = $obj->fk_product;
324  $this->eatby = $this->db->jdate($obj->eatby);
325  $this->sellby = $this->db->jdate($obj->sellby);
326  $this->eol_date = $this->db->jdate($obj->eol_date);
327  $this->manufacturing_date = $this->db->jdate($obj->manufacturing_date);
328  $this->scrapping_date = $this->db->jdate($obj->scrapping_date);
329  //$this->commissionning_date = $this->db->jdate($obj->commissionning_date);
330  //$this->qc_frequency = $obj->qc_frequency;
331 
332  $this->datec = $this->db->jdate($obj->datec);
333  $this->tms = $this->db->jdate($obj->tms);
334  $this->fk_user_creat = $obj->fk_user_creat;
335  $this->fk_user_modif = $obj->fk_user_modif;
336  $this->import_key = $obj->import_key;
337  $this->note_public = $obj->note_public;
338  $this->note_private = $obj->note_private;
339 
340  // Retrieve all extrafield
341  // fetch optionals attributes and labels
342  $this->fetch_optionals();
343  }
344  $this->db->free($resql);
345 
346  if ($numrows) {
347  return 1;
348  } else {
349  return 0;
350  }
351  } else {
352  $this->errors[] = 'Error '.$this->db->lasterror();
353  dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
354 
355  return -1;
356  }
357  }
358 
367  public function update(User $user, $notrigger = false)
368  {
369  $error = 0;
370 
371  dol_syslog(__METHOD__, LOG_DEBUG);
372 
373  // Clean parameters
374 
375  if (isset($this->entity)) {
376  $this->entity = (int) $this->entity;
377  }
378  if (isset($this->fk_product)) {
379  $this->fk_product = (int) $this->fk_product;
380  }
381  if (isset($this->batch)) {
382  $this->batch = trim($this->batch);
383  }
384  if (isset($this->fk_user_creat)) {
385  $this->fk_user_creat = (int) $this->fk_user_creat;
386  }
387  if (isset($this->fk_user_modif)) {
388  $this->fk_user_modif = (int) $this->fk_user_modif;
389  }
390  if (isset($this->import_key)) {
391  $this->import_key = trim($this->import_key);
392  }
393 
394  // $this->oldcopy should have been set by the caller of update (here properties were already modified)
395  if (empty($this->oldcopy)) {
396  $this->oldcopy = dol_clone($this);
397  }
398 
399  // Update request
400  $sql = 'UPDATE '.$this->db->prefix().$this->table_element.' SET';
401  $sql .= ' entity = '.(isset($this->entity) ? $this->entity : "null").',';
402  $sql .= ' fk_product = '.(isset($this->fk_product) ? $this->fk_product : "null").',';
403  $sql .= ' batch = '.(isset($this->batch) ? "'".$this->db->escape($this->batch)."'" : "null").',';
404  $sql .= ' eatby = '.(!isset($this->eatby) || dol_strlen($this->eatby) != 0 ? "'".$this->db->idate($this->eatby)."'" : 'null').',';
405  $sql .= ' sellby = '.(!isset($this->sellby) || dol_strlen($this->sellby) != 0 ? "'".$this->db->idate($this->sellby)."'" : 'null').',';
406  $sql .= ' eol_date = '.(!isset($this->eol_date) || dol_strlen($this->eol_date) != 0 ? "'".$this->db->idate($this->eol_date)."'" : 'null').',';
407  $sql .= ' manufacturing_date = '.(!isset($this->manufacturing_date) || dol_strlen($this->manufacturing_date) != 0 ? "'".$this->db->idate($this->manufacturing_date)."'" : 'null').',';
408  $sql .= ' scrapping_date = '.(!isset($this->scrapping_date) || dol_strlen($this->scrapping_date) != 0 ? "'".$this->db->idate($this->scrapping_date)."'" : 'null').',';
409  //$sql .= ' commissionning_date = '.(!isset($this->first_use_date) || dol_strlen($this->first_use_date) != 0 ? "'".$this->db->idate($this->first_use_date)."'" : 'null').',';
410  //$sql .= ' qc_frequency = '.(!isset($this->qc_frequency) || dol_strlen($this->qc_frequency) != 0 ? "'".$this->db->escape($this->qc_frequency)."'" : 'null').',';
411  $sql .= ' datec = '.(!isset($this->datec) || dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').',';
412  $sql .= ' tms = '.(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : "'".$this->db->idate(dol_now())."'").',';
413  $sql .= ' fk_user_creat = '.(isset($this->fk_user_creat) ? $this->fk_user_creat : "null").',';
414  $sql .= ' fk_user_modif = '.(isset($this->fk_user_modif) ? $this->fk_user_modif : "null").',';
415  $sql .= ' import_key = '.(isset($this->import_key) ? $this->import_key : "null");
416  $sql .= ' WHERE rowid='.((int) $this->id);
417 
418  $this->db->begin();
419 
420  $resql = $this->db->query($sql);
421  if (!$resql) {
422  $error++;
423  $this->errors[] = 'Error '.$this->db->lasterror();
424  dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
425  }
426 
427  // Actions on extra fields
428  if (!$error) {
429  $result = $this->insertExtraFields();
430  if ($result < 0) {
431  $error++;
432  }
433  }
434 
435  if (!$error && !$notrigger) {
436  // Call triggers
437  $result = $this->call_trigger('PRODUCTLOT_MODIFY', $user);
438  if ($result < 0) {
439  $error++;
440  }
441  // End call triggers
442  }
443 
444  // Commit or rollback
445  if ($error) {
446  $this->db->rollback();
447 
448  return -1 * $error;
449  } else {
450  $this->db->commit();
451 
452  return 1;
453  }
454  }
455 
464  public function delete(User $user, $notrigger = false)
465  {
466  dol_syslog(__METHOD__, LOG_DEBUG);
467 
468  $error = 0;
469 
470  $this->db->begin();
471 
472  //if (!$error) {
473  //if (!$notrigger) {
474  // Uncomment this and change PRODUCTLOT to your own tag if you
475  // want this action calls a trigger.
476 
478  //$result=$this->call_trigger('PRODUCTLOT_DELETE',$user);
479  //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
481  //}
482  //}
483 
484  if (!$error) {
485  $sql = 'DELETE FROM '.$this->db->prefix().$this->table_element;
486  $sql .= ' WHERE rowid='.((int) $this->id);
487 
488  $resql = $this->db->query($sql);
489  if (!$resql) {
490  $error++;
491  $this->errors[] = 'Error '.$this->db->lasterror();
492  dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
493  }
494  }
495 
496  // Commit or rollback
497  if ($error) {
498  $this->db->rollback();
499 
500  return -1 * $error;
501  } else {
502  $this->db->commit();
503 
504  return 1;
505  }
506  }
507 
515  public function createFromClone(User $user, $fromid)
516  {
517  dol_syslog(__METHOD__, LOG_DEBUG);
518 
519  $error = 0;
520  $object = new Productlot($this->db);
521 
522  $this->db->begin();
523 
524  // Load source object
525  $object->fetch($fromid);
526  // Reset object
527  $object->id = 0;
528 
529  // Clear fields
530  // ...
531 
532  // Create clone
533  $object->context['createfromclone'] = 'createfromclone';
534  $result = $object->create($user);
535 
536  // Other options
537  if ($result < 0) {
538  $error++;
539  $this->errors = $object->errors;
540  dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
541  }
542 
543  unset($object->context['createfromclone']);
544 
545  // End
546  if (!$error) {
547  $this->db->commit();
548 
549  return $object->id;
550  } else {
551  $this->db->rollback();
552 
553  return -1;
554  }
555  }
556 
557 
564  public function getLibStatut($mode = 0)
565  {
566  return $this->LibStatut(0, $mode);
567  }
568 
569  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
577  public function LibStatut($status, $mode = 0)
578  {
579  // phpcs:enable
580  global $langs;
581 
582  //$langs->load('stocks');
583 
584  return '';
585  }
586 
587 
600  public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $maxlen = 24, $morecss = '', $save_lastsearch_value = -1)
601  {
602  global $langs, $conf, $db;
603  global $dolibarr_main_authentication, $dolibarr_main_demo;
604  global $menumanager;
605 
606  $result = '';
607 
608  $label = img_picto('', $this->picto).' <u>'.$langs->trans("Batch").'</u>';
609  $label .= '<div width="100%">';
610  $label .= '<b>'.$langs->trans('Batch').':</b> '.$this->batch;
611  if ($this->eatby && empty($conf->global->PRODUCT_DISABLE_EATBY)) {
612  $label .= '<br><b>'.$langs->trans('EatByDate').':</b> '.dol_print_date($this->eatby, 'day');
613  }
614  if ($this->sellby && empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
615  $label .= '<br><b>'.$langs->trans('SellByDate').':</b> '.dol_print_date($this->sellby, 'day');
616  }
617 
618  $url = DOL_URL_ROOT.'/product/stock/productlot_card.php?id='.$this->id;
619 
620  if ($option != 'nolink') {
621  // Add param to save lastsearch_values or not
622  $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
623  if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
624  $add_save_lastsearch_values = 1;
625  }
626  if ($add_save_lastsearch_values) {
627  $url .= '&save_lastsearch_values=1';
628  }
629  }
630 
631  $linkclose = '';
632  if (empty($notooltip)) {
633  if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
634  $label = $langs->trans("ShowMyObject");
635  $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
636  }
637  $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
638  $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
639  } else {
640  $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
641  }
642 
643  if ($option == 'nolink') {
644  $linkstart = '<span';
645  } else {
646  $linkstart = '<a href="'.$url.'"';
647  }
648  $linkstart .= $linkclose.'>';
649  if ($option == 'nolink') {
650  $linkend = '</span>';
651  } else {
652  $linkend = '</a>';
653  }
654 
655  $result .= $linkstart;
656  if ($withpicto) {
657  $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
658  }
659  if ($withpicto != 2) {
660  $result .= $this->batch;
661  }
662  $result .= $linkend;
663 
664  return $result;
665  }
666 
667 
674  public function initAsSpecimen()
675  {
676  $this->id = 0;
677 
678  $this->entity = null;
679  $this->fk_product = null;
680  $this->batch = '';
681  $this->eatby = '';
682  $this->sellby = '';
683  $this->datec = '';
684  $this->tms = '';
685  $this->fk_user_creat = null;
686  $this->fk_user_modif = null;
687  $this->import_key = '';
688  }
689 }
$object ref
Definition: info.php:78
Parent class of all other business classes (invoices, contracts, proposals, orders,...
fetch_optionals($rowid=null, $optionsArray=null)
Function to get extra fields of an object into $this->array_options This method is in most cases call...
insertExtraFields($trigger='', $userused=null)
Add/Update all extra fields values for the current object.
call_trigger($triggerName, $user)
Call trigger based on this instance.
Class to manage Dolibarr database access.
Class with list of lots and properties.
getLibStatut($mode=0)
Return label of status of object.
fetch($id=0, $product_id=0, $batch='')
Load object in memory from the database.
LibStatut($status, $mode=0)
Return label of a given status.
getNomUrl($withpicto=0, $option='', $notooltip=0, $maxlen=24, $morecss='', $save_lastsearch_value=-1)
Return a link to the a lot card (with optionaly the picto) Use this->id,this->lastname,...
__construct(DoliDB $db)
Constructor.
initAsSpecimen()
Initialise object with example values Id must be 0 if object instance is a specimen.
createFromClone(User $user, $fromid)
Load an object from its id and create a new one in database.
create(User $user, $notrigger=false)
Create object into database.
update(User $user, $notrigger=false)
Update object into database.
Class to manage Dolibarr users.
Definition: user.class.php:47
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:745
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
$conf db
API class for accounts.
Definition: inc.php:41