dolibarr  16.0.5
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 
117  public $batch;
118  public $eatby = '';
119  public $sellby = '';
120  public $eol_date = '';
121  public $manufacturing_date = '';
122  public $scrapping_date = '';
123  //public $commissionning_date = '';
124  //public $qc_frequency = '';
125  public $datec = '';
126  public $tms = '';
127 
131  public $fk_user_creat;
132 
136  public $fk_user_modif;
137 
138  public $import_key;
139 
140 
146  public function __construct(DoliDB $db)
147  {
148  $this->db = $db;
149  }
150 
159  public function create(User $user, $notrigger = false)
160  {
161  global $conf;
162  dol_syslog(__METHOD__, LOG_DEBUG);
163 
164  $error = 0;
165 
166  // Clean parameters
167 
168  if (isset($this->entity)) {
169  $this->entity = (int) $this->entity;
170  }
171  if (isset($this->fk_product)) {
172  $this->fk_product = (int) $this->fk_product;
173  }
174  if (isset($this->batch)) {
175  $this->batch = trim($this->batch);
176  }
177  if (isset($this->fk_user_creat)) {
178  $this->fk_user_creat = (int) $this->fk_user_creat;
179  }
180  if (isset($this->fk_user_modif)) {
181  $this->fk_user_modif = (int) $this->fk_user_modif;
182  }
183  if (isset($this->import_key)) {
184  $this->import_key = trim($this->import_key);
185  }
186 
187  // Check parameters
188  // Put here code to add control on parameters values
189 
190  // Insert request
191  $sql = 'INSERT INTO '.$this->db->prefix().$this->table_element.'(';
192  $sql .= 'entity,';
193  $sql .= 'fk_product,';
194  $sql .= 'batch,';
195  $sql .= 'eatby,';
196  $sql .= 'sellby,';
197  $sql .= 'eol_date,';
198  $sql .= 'manufacturing_date,';
199  $sql .= 'scrapping_date,';
200  //$sql .= 'commissionning_date,';
201  //$sql .= 'qc_frequency,';
202  $sql .= 'datec,';
203  $sql .= 'fk_user_creat,';
204  $sql .= 'fk_user_modif,';
205  $sql .= 'import_key';
206  $sql .= ') VALUES (';
207  $sql .= ' '.(!isset($this->entity) ? $conf->entity : $this->entity).',';
208  $sql .= ' '.(!isset($this->fk_product) ? 'NULL' : $this->fk_product).',';
209  $sql .= ' '.(!isset($this->batch) ? 'NULL' : "'".$this->db->escape($this->batch)."'").',';
210  $sql .= ' '.(!isset($this->eatby) || dol_strlen($this->eatby) == 0 ? 'NULL' : "'".$this->db->idate($this->eatby)."'").',';
211  $sql .= ' '.(!isset($this->sellby) || dol_strlen($this->sellby) == 0 ? 'NULL' : "'".$this->db->idate($this->sellby)."'").',';
212  $sql .= ' '.(!isset($this->eol_date) || dol_strlen($this->eol_date) == 0 ? 'NULL' : "'".$this->db->idate($this->eol_date)."'").',';
213  $sql .= ' '.(!isset($this->manufacturing_date) || dol_strlen($this->manufacturing_date) == 0 ? 'NULL' : "'".$this->db->idate($this->manufacturing_date)."'").',';
214  $sql .= ' '.(!isset($this->scrapping_date) || dol_strlen($this->scrapping_date) == 0 ? 'NULL' : "'".$this->db->idate($this->scrapping_date)."'").',';
215  //$sql .= ' '.(!isset($this->commissionning_date) || dol_strlen($this->commissionning_date) == 0 ? 'NULL' : "'".$this->db->idate($this->commissionning_date)."'").',';
216  //$sql .= ' '.(!isset($this->qc_frequency) ? 'NULL' : $this->qc_frequency).',';
217  $sql .= ' '."'".$this->db->idate(dol_now())."'".',';
218  $sql .= ' '.(!isset($this->fk_user_creat) ? 'NULL' : $this->fk_user_creat).',';
219  $sql .= ' '.(!isset($this->fk_user_modif) ? 'NULL' : $this->fk_user_modif).',';
220  $sql .= ' '.(!isset($this->import_key) ? 'NULL' : $this->import_key);
221  $sql .= ')';
222 
223  $this->db->begin();
224 
225  $resql = $this->db->query($sql);
226  if (!$resql) {
227  $error++;
228  $this->errors[] = 'Error '.$this->db->lasterror();
229  dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
230  }
231 
232  if (!$error) {
233  $this->id = $this->db->last_insert_id($this->db->prefix().$this->table_element);
234 
235  // Actions on extra fields
236  if (!$error) {
237  $result = $this->insertExtraFields();
238  if ($result < 0) {
239  $error++;
240  }
241  }
242 
243  if (!$error && !$notrigger) {
244  // Uncomment this and change MYOBJECT to your own tag if you
245  // want this action to call a trigger.
246 
247  // Call triggers
248  $result = $this->call_trigger('PRODUCTLOT_CREATE', $user);
249  if ($result < 0) {
250  $error++;
251  }
252  // End call triggers
253  }
254  }
255 
256  // Commit or rollback
257  if ($error) {
258  $this->db->rollback();
259 
260  return -1 * $error;
261  } else {
262  $this->db->commit();
263 
264  return $this->id;
265  }
266  }
267 
277  public function fetch($id = 0, $product_id = 0, $batch = '')
278  {
279  global $conf;
280  dol_syslog(__METHOD__, LOG_DEBUG);
281 
282  $sql = "SELECT";
283  $sql .= " t.rowid,";
284  $sql .= " t.entity,";
285  $sql .= " t.fk_product,";
286  $sql .= " t.batch,";
287  $sql .= " t.eatby,";
288  $sql .= " t.sellby,";
289  $sql .= " t.eol_date,";
290  $sql .= " t.manufacturing_date,";
291  $sql .= " t.scrapping_date,";
292  //$sql .= " t.commissionning_date,";
293  //$sql .= " t.qc_frequency,";
294  $sql .= " t.datec,";
295  $sql .= " t.tms,";
296  $sql .= " t.fk_user_creat,";
297  $sql .= " t.fk_user_modif,";
298  $sql .= " t.import_key";
299  $sql .= " FROM ".$this->db->prefix().$this->table_element." as t";
300  if ($product_id > 0 && $batch != '') {
301  $sql .= " WHERE t.batch = '".$this->db->escape($batch)."' AND t.fk_product = ".((int) $product_id);
302  } else {
303  $sql .= " WHERE t.rowid = ".((int) $id);
304  }
305 
306  $resql = $this->db->query($sql);
307  if ($resql) {
308  $numrows = $this->db->num_rows($resql);
309  if ($numrows) {
310  $obj = $this->db->fetch_object($resql);
311 
312  $this->id = $obj->rowid;
313  $this->ref = $obj->rowid;
314  //$this->ref = $obj->fk_product.'_'.$obj->batch;
315 
316  $this->batch = $obj->batch;
317  $this->entity = (!empty($obj->entity) ? $obj->entity : $conf->entity); // Prevent "null" entity
318  $this->fk_product = $obj->fk_product;
319  $this->eatby = $this->db->jdate($obj->eatby);
320  $this->sellby = $this->db->jdate($obj->sellby);
321  $this->eol_date = $this->db->jdate($obj->eol_date);
322  $this->manufacturing_date = $this->db->jdate($obj->manufacturing_date);
323  $this->scrapping_date = $this->db->jdate($obj->scrapping_date);
324  //$this->commissionning_date = $this->db->jdate($obj->commissionning_date);
325  //$this->qc_frequency = $obj->qc_frequency;
326 
327  $this->datec = $this->db->jdate($obj->datec);
328  $this->tms = $this->db->jdate($obj->tms);
329  $this->fk_user_creat = $obj->fk_user_creat;
330  $this->fk_user_modif = $obj->fk_user_modif;
331  $this->import_key = $obj->import_key;
332 
333  // Retrieve all extrafield
334  // fetch optionals attributes and labels
335  $this->fetch_optionals();
336  }
337  $this->db->free($resql);
338 
339  if ($numrows) {
340  return 1;
341  } else {
342  return 0;
343  }
344  } else {
345  $this->errors[] = 'Error '.$this->db->lasterror();
346  dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
347 
348  return -1;
349  }
350  }
351 
360  public function update(User $user, $notrigger = false)
361  {
362  $error = 0;
363 
364  dol_syslog(__METHOD__, LOG_DEBUG);
365 
366  // Clean parameters
367 
368  if (isset($this->entity)) {
369  $this->entity = (int) $this->entity;
370  }
371  if (isset($this->fk_product)) {
372  $this->fk_product = (int) $this->fk_product;
373  }
374  if (isset($this->batch)) {
375  $this->batch = trim($this->batch);
376  }
377  if (isset($this->fk_user_creat)) {
378  $this->fk_user_creat = (int) $this->fk_user_creat;
379  }
380  if (isset($this->fk_user_modif)) {
381  $this->fk_user_modif = (int) $this->fk_user_modif;
382  }
383  if (isset($this->import_key)) {
384  $this->import_key = trim($this->import_key);
385  }
386 
387  // Check parameters
388  // Put here code to add a control on parameters values
389 
390  if (empty($this->oldcopy)) {
391  $org = new self($this->db);
392  $org->fetch($this->id);
393  $this->oldcopy = $org;
394  }
395 
396  // Update request
397  $sql = 'UPDATE '.$this->db->prefix().$this->table_element.' SET';
398  $sql .= ' entity = '.(isset($this->entity) ? $this->entity : "null").',';
399  $sql .= ' fk_product = '.(isset($this->fk_product) ? $this->fk_product : "null").',';
400  $sql .= ' batch = '.(isset($this->batch) ? "'".$this->db->escape($this->batch)."'" : "null").',';
401  $sql .= ' eatby = '.(!isset($this->eatby) || dol_strlen($this->eatby) != 0 ? "'".$this->db->idate($this->eatby)."'" : 'null').',';
402  $sql .= ' sellby = '.(!isset($this->sellby) || dol_strlen($this->sellby) != 0 ? "'".$this->db->idate($this->sellby)."'" : 'null').',';
403  $sql .= ' eol_date = '.(!isset($this->eol_date) || dol_strlen($this->eol_date) != 0 ? "'".$this->db->idate($this->eol_date)."'" : 'null').',';
404  $sql .= ' manufacturing_date = '.(!isset($this->manufacturing_date) || dol_strlen($this->manufacturing_date) != 0 ? "'".$this->db->idate($this->manufacturing_date)."'" : 'null').',';
405  $sql .= ' scrapping_date = '.(!isset($this->scrapping_date) || dol_strlen($this->scrapping_date) != 0 ? "'".$this->db->idate($this->scrapping_date)."'" : 'null').',';
406  //$sql .= ' commissionning_date = '.(!isset($this->first_use_date) || dol_strlen($this->first_use_date) != 0 ? "'".$this->db->idate($this->first_use_date)."'" : 'null').',';
407  //$sql .= ' qc_frequency = '.(!isset($this->qc_frequency) || dol_strlen($this->qc_frequency) != 0 ? "'".$this->db->escape($this->qc_frequency)."'" : 'null').',';
408  $sql .= ' datec = '.(!isset($this->datec) || dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').',';
409  $sql .= ' tms = '.(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : "'".$this->db->idate(dol_now())."'").',';
410  $sql .= ' fk_user_creat = '.(isset($this->fk_user_creat) ? $this->fk_user_creat : "null").',';
411  $sql .= ' fk_user_modif = '.(isset($this->fk_user_modif) ? $this->fk_user_modif : "null").',';
412  $sql .= ' import_key = '.(isset($this->import_key) ? $this->import_key : "null");
413  $sql .= ' WHERE rowid='.((int) $this->id);
414 
415  $this->db->begin();
416 
417  $resql = $this->db->query($sql);
418  if (!$resql) {
419  $error++;
420  $this->errors[] = 'Error '.$this->db->lasterror();
421  dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
422  }
423 
424  // Actions on extra fields
425  if (!$error) {
426  $result = $this->insertExtraFields();
427  if ($result < 0) {
428  $error++;
429  }
430  }
431 
432  if (!$error && !$notrigger) {
433  // Call triggers
434  $result = $this->call_trigger('PRODUCTLOT_MODIFY', $user);
435  if ($result < 0) {
436  $error++;
437  }
438  // End call triggers
439  }
440 
441  // Commit or rollback
442  if ($error) {
443  $this->db->rollback();
444 
445  return -1 * $error;
446  } else {
447  $this->db->commit();
448 
449  return 1;
450  }
451  }
452 
461  public function delete(User $user, $notrigger = false)
462  {
463  dol_syslog(__METHOD__, LOG_DEBUG);
464 
465  $error = 0;
466 
467  $this->db->begin();
468 
469  //if (!$error) {
470  //if (!$notrigger) {
471  // Uncomment this and change PRODUCTLOT to your own tag if you
472  // want this action calls a trigger.
473 
475  //$result=$this->call_trigger('PRODUCTLOT_DELETE',$user);
476  //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
478  //}
479  //}
480 
481  if (!$error) {
482  $sql = 'DELETE FROM '.$this->db->prefix().$this->table_element;
483  $sql .= ' WHERE rowid='.((int) $this->id);
484 
485  $resql = $this->db->query($sql);
486  if (!$resql) {
487  $error++;
488  $this->errors[] = 'Error '.$this->db->lasterror();
489  dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
490  }
491  }
492 
493  // Commit or rollback
494  if ($error) {
495  $this->db->rollback();
496 
497  return -1 * $error;
498  } else {
499  $this->db->commit();
500 
501  return 1;
502  }
503  }
504 
512  public function createFromClone(User $user, $fromid)
513  {
514  dol_syslog(__METHOD__, LOG_DEBUG);
515 
516  $error = 0;
517  $object = new Productlot($this->db);
518 
519  $this->db->begin();
520 
521  // Load source object
522  $object->fetch($fromid);
523  // Reset object
524  $object->id = 0;
525 
526  // Clear fields
527  // ...
528 
529  // Create clone
530  $object->context['createfromclone'] = 'createfromclone';
531  $result = $object->create($user);
532 
533  // Other options
534  if ($result < 0) {
535  $error++;
536  $this->errors = $object->errors;
537  dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
538  }
539 
540  unset($object->context['createfromclone']);
541 
542  // End
543  if (!$error) {
544  $this->db->commit();
545 
546  return $object->id;
547  } else {
548  $this->db->rollback();
549 
550  return -1;
551  }
552  }
553 
554 
561  public function getLibStatut($mode = 0)
562  {
563  return $this->LibStatut(0, $mode);
564  }
565 
566  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
574  public function LibStatut($status, $mode = 0)
575  {
576  // phpcs:enable
577  global $langs;
578 
579  //$langs->load('stocks');
580 
581  return '';
582  }
583 
584 
597  public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $maxlen = 24, $morecss = '', $save_lastsearch_value = -1)
598  {
599  global $langs, $conf, $db;
600  global $dolibarr_main_authentication, $dolibarr_main_demo;
601  global $menumanager;
602 
603  $result = '';
604 
605  $label = img_picto('', $this->picto).' <u>'.$langs->trans("Batch").'</u>';
606  $label .= '<div width="100%">';
607  $label .= '<b>'.$langs->trans('Batch').':</b> '.$this->batch;
608  if ($this->eatby && empty($conf->global->PRODUCT_DISABLE_EATBY)) {
609  $label .= '<br><b>'.$langs->trans('EatByDate').':</b> '.dol_print_date($this->eatby, 'day');
610  }
611  if ($this->sellby && empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
612  $label .= '<br><b>'.$langs->trans('SellByDate').':</b> '.dol_print_date($this->sellby, 'day');
613  }
614 
615  $url = DOL_URL_ROOT.'/product/stock/productlot_card.php?id='.$this->id;
616 
617  if ($option != 'nolink') {
618  // Add param to save lastsearch_values or not
619  $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
620  if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
621  $add_save_lastsearch_values = 1;
622  }
623  if ($add_save_lastsearch_values) {
624  $url .= '&save_lastsearch_values=1';
625  }
626  }
627 
628  $linkclose = '';
629  if (empty($notooltip)) {
630  if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
631  $label = $langs->trans("ShowMyObject");
632  $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
633  }
634  $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
635  $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
636  } else {
637  $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
638  }
639 
640  if ($option == 'nolink') {
641  $linkstart = '<span';
642  } else {
643  $linkstart = '<a href="'.$url.'"';
644  }
645  $linkstart .= $linkclose.'>';
646  if ($option == 'nolink') {
647  $linkend = '</span>';
648  } else {
649  $linkend = '</a>';
650  }
651 
652  $result .= $linkstart;
653  if ($withpicto) {
654  $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);
655  }
656  if ($withpicto != 2) {
657  $result .= $this->batch;
658  }
659  $result .= $linkend;
660 
661  return $result;
662  }
663 
664 
671  public function initAsSpecimen()
672  {
673  $this->id = 0;
674 
675  $this->entity = null;
676  $this->fk_product = null;
677  $this->batch = '';
678  $this->eatby = '';
679  $this->sellby = '';
680  $this->datec = '';
681  $this->tms = '';
682  $this->fk_user_creat = null;
683  $this->fk_user_modif = null;
684  $this->import_key = '';
685  }
686 }
Productlot\LibStatut
LibStatut($status, $mode=0)
Return label of a given status.
Definition: productlot.class.php:574
db
$conf db
API class for accounts.
Definition: inc.php:41
DoliDB
Class to manage Dolibarr database access.
Definition: DoliDB.class.php:30
Productlot\createFromClone
createFromClone(User $user, $fromid)
Load an object from its id and create a new one in database.
Definition: productlot.class.php:512
Productlot\update
update(User $user, $notrigger=false)
Update object into database.
Definition: productlot.class.php:360
Productlot\create
create(User $user, $notrigger=false)
Create object into database.
Definition: productlot.class.php:159
ref
$object ref
Definition: info.php:77
Productlot\fetch
fetch($id=0, $product_id=0, $batch='')
Load object in memory from the database.
Definition: productlot.class.php:277
CommonObject
Parent class of all other business classes (invoices, contracts, proposals, orders,...
Definition: commonobject.class.php:44
Productlot
Class with list of lots and properties.
Definition: productlot.class.php:36
dol_print_date
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
Definition: functions.lib.php:2514
img_picto
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Definition: functions.lib.php:3880
CommonObject\insertExtraFields
insertExtraFields($trigger='', $userused=null)
Add/Update all extra fields values for the current object.
Definition: commonobject.class.php:6156
Productlot\getLibStatut
getLibStatut($mode=0)
Return label of status of object.
Definition: productlot.class.php:561
Productlot\initAsSpecimen
initAsSpecimen()
Initialise object with example values Id must be 0 if object instance is a specimen.
Definition: productlot.class.php:671
dol_syslog
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
Definition: functions.lib.php:1603
Productlot\__construct
__construct(DoliDB $db)
Constructor.
Definition: productlot.class.php:146
CommonObject\fetch_optionals
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...
Definition: commonobject.class.php:6007
dol_strlen
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
Definition: functions.lib.php:3747
User
Class to manage Dolibarr users.
Definition: user.class.php:44
Productlot\getNomUrl
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,...
Definition: productlot.class.php:597
img_object
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
Definition: functions.lib.php:4211
dol_now
dol_now($mode='auto')
Return date for now.
Definition: functions.lib.php:2845
$resql
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice') && $user->rights->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->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:742
CommonObject\call_trigger
call_trigger($triggerName, $user)
Call trigger based on this instance.
Definition: commonobject.class.php:5791