dolibarr  16.0.5
inventory.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2007-2019 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2014-2016 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  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19  */
20 
27 // Put here all includes required by your class file
28 require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.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 Inventory extends CommonObject
37 {
41  public $element = 'inventory';
42 
46  public $table_element = 'inventory';
47 
51  public $ismultientitymanaged = 1;
52 
56  public $isextrafieldmanaged = 0;
57 
61  public $picto = 'inventory';
62 
63  const STATUS_DRAFT = 0; // Draft
64  const STATUS_VALIDATED = 1; // Inventory is in process
65  const STATUS_RECORDED = 2; // Inventory is finisged. Stock movement has been recorded.
66  const STATUS_CANCELED = 9; // Canceled
67 
94  // BEGIN MODULEBUILDER PROPERTIES
98  public $fields = array(
99  'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-1, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',),
100  'ref' => array('type'=>'varchar(64)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>'Reference of object', 'css'=>'maxwidth200'),
101  'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,),
102  'title' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>25, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax200'),
103  'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Warehouse', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'index'=>1, 'help'=>'InventoryForASpecificWarehouse', 'picto'=>'stock', 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'csslist'=>'tdoverflowmax200'),
104  'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'visible'=>1, 'enabled'=>1, 'position'=>32, 'index'=>1, 'help'=>'InventoryForASpecificProduct', 'picto'=>'product', 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'csslist'=>'tdoverflowmax200'),
105  'date_inventory' => array('type'=>'date', 'label'=>'DateValue', 'visible'=>1, 'enabled'=>'$conf->global->STOCK_INVENTORY_ADD_A_VALUE_DATE', 'position'=>35), // This date is not used so disabled by default.
106  'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500),
107  'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501),
108  'date_validation' => array('type'=>'datetime', 'label'=>'DateValidation', 'visible'=>-2, 'enabled'=>1, 'position'=>502),
109  'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510, 'foreignkey'=>'user.rowid', 'csslist'=>'tdoverflowmax200'),
110  'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511, 'csslist'=>'tdoverflowmax200'),
111  'fk_user_valid' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'visible'=>-2, 'enabled'=>1, 'position'=>512, 'csslist'=>'tdoverflowmax200'),
112  'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000),
113 
114  'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>4, 'enabled'=>1, 'position'=>1000, 'notnull'=>1, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 2=>'Closed', 9=>'Canceled'))
115  );
116 
120  public $rowid;
121 
125  public $ref;
126 
130  public $entity;
131 
135  public $fk_warehouse;
136 
140  public $fk_product;
141 
142  public $date_inventory;
143  public $title;
144 
148  public $status;
149 
153  public $date_creation;
154 
158  public $date_validation;
159 
160 
161  public $tms;
162 
166  public $fk_user_creat;
167 
171  public $fk_user_modif;
172 
176  public $fk_user_valid;
177 
181  public $import_key;
182  // END MODULEBUILDER PROPERTIES
183 
184 
185 
186  // If this object has a subtable with lines
187 
191  public $table_element_line = 'inventorydet';
192 
196  public $fk_element = 'fk_inventory';
197 
201  public $class_element_line = 'Inventoryline';
202 
206  protected $childtables = array();
210  protected $childtablesoncascade = array('inventorydet');
211 
215  public $lines = array();
216 
217 
218 
224  public function __construct(DoliDB $db)
225  {
226  global $conf;
227 
228  $this->db = $db;
229 
230  if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
231  $this->fields['rowid']['visible'] = 0;
232  }
233  if (empty($conf->multicompany->enabled)) {
234  $this->fields['entity']['enabled'] = 0;
235  }
236  }
237 
238 
246  public function create(User $user, $notrigger = false)
247  {
248  $result = $this->createCommon($user, $notrigger);
249 
250  return $result;
251  }
252 
260  public function validate(User $user, $notrigger = false)
261  {
262  global $conf;
263  $this->db->begin();
264 
265  $result = 0;
266 
267  if ($this->status == self::STATUS_DRAFT) {
268  // Delete inventory
269  $sql = 'DELETE FROM '.$this->db->prefix().'inventorydet WHERE fk_inventory = '.((int) $this->id);
270  $resql = $this->db->query($sql);
271  if (!$resql) {
272  $this->error = $this->db->lasterror();
273  $this->db->rollback();
274  return -1;
275  }
276 
277  // Scan existing stock to prefill the inventory
278  $sql = "SELECT ps.rowid, ps.fk_entrepot as fk_warehouse, ps.fk_product, ps.reel,";
279  $sql .= " pb.batch, pb.qty";
280  $sql .= " FROM ".$this->db->prefix()."product_stock as ps";
281  $sql .= " LEFT JOIN ".$this->db->prefix()."product_batch as pb ON pb.fk_product_stock = ps.rowid,";
282  $sql .= " ".$this->db->prefix()."product as p, ".$this->db->prefix()."entrepot as e";
283  $sql .= " WHERE p.entity IN (".getEntity('product').")";
284  $sql .= " AND ps.fk_product = p.rowid AND ps.fk_entrepot = e.rowid";
285  if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
286  $sql .= " AND p.fk_product_type = 0";
287  }
288  if ($this->fk_product > 0) {
289  $sql .= " AND ps.fk_product = ".((int) $this->fk_product);
290  }
291  if ($this->fk_warehouse > 0) {
292  $sql .= " AND ps.fk_entrepot = ".((int) $this->fk_warehouse);
293  }
294 
295  $inventoryline = new InventoryLine($this->db);
296 
297  $resql = $this->db->query($sql);
298  if ($resql) {
299  $num = $this->db->num_rows($resql);
300 
301  $i = 0;
302  while ($i < $num) {
303  $obj = $this->db->fetch_object($resql);
304 
305  $inventoryline->fk_inventory = $this->id;
306  $inventoryline->fk_warehouse = $obj->fk_warehouse;
307  $inventoryline->fk_product = $obj->fk_product;
308  $inventoryline->batch = $obj->batch;
309  $inventoryline->datec = dol_now();
310 
311  if (isModEnabled('productbatch')) {
312  $inventoryline->qty_stock = ($obj->batch ? $obj->qty : $obj->reel); // If there is batch detail, we take qty for batch, else global qty
313  } else {
314  $inventoryline->qty_stock = $obj->reel;
315  }
316 
317  $resultline = $inventoryline->create($user);
318  if ($resultline <= 0) {
319  $this->error = $inventoryline->error;
320  $this->errors = $inventoryline->errors;
321  $result = -1;
322  break;
323  }
324 
325  $i++;
326  }
327  } else {
328  $result = -1;
329  $this->error = $this->db->lasterror();
330  }
331  }
332 
333  if ($result >= 0) {
334  $result = $this->setStatut($this::STATUS_VALIDATED, null, '', 'INVENTORY_VALIDATED');
335  }
336 
337  if ($result > 0) {
338  $this->db->commit();
339  } else {
340  $this->db->rollback();
341  }
342  return $result;
343  }
344 
352  public function setDraft(User $user, $notrigger = false)
353  {
354  $this->db->begin();
355 
356  // Delete inventory
357  $sql = 'DELETE FROM '.$this->db->prefix().'inventorydet WHERE fk_inventory = '.((int) $this->id);
358  $resql = $this->db->query($sql);
359  if (!$resql) {
360  $this->error = $this->db->lasterror();
361  $this->db->rollback();
362  return -1;
363  }
364 
365  $result = $this->setStatut($this::STATUS_DRAFT, null, '', 'INVENTORY_DRAFT');
366 
367  if ($result > 0) {
368  $this->db->commit();
369  } else {
370  $this->db->rollback();
371  }
372  return $result;
373  }
374 
382  public function setRecorded(User $user, $notrigger = false)
383  {
384  $this->db->begin();
385 
386  $result = $this->setStatut($this::STATUS_RECORDED, null, '', 'INVENTORY_RECORDED');
387 
388  if ($result > 0) {
389  $this->db->commit();
390  } else {
391  $this->db->rollback();
392  return -1;
393  }
394  return $result;
395  }
396 
404  public function setCanceled(User $user, $notrigger = false)
405  {
406  $this->db->begin();
407 
408  $result = $this->setStatut($this::STATUS_CANCELED, null, '', 'INVENTORY_CANCELED');
409 
410  if ($result > 0) {
411  $this->db->commit();
412  } else {
413  $this->db->rollback();
414  return -1;
415  }
416  return $result;
417  }
418 
426  public function createFromClone(User $user, $fromid)
427  {
428  global $hookmanager, $langs;
429  $error = 0;
430 
431  dol_syslog(__METHOD__, LOG_DEBUG);
432 
433  $object = new self($this->db);
434 
435  $this->db->begin();
436 
437  // Load source object
438  $object->fetchCommon($fromid);
439  // Reset some properties
440  unset($object->id);
441  unset($object->fk_user_creat);
442  unset($object->import_key);
443 
444  // Clear fields
445  $object->ref = "copy_of_".$object->ref;
446  $object->title = $langs->trans("CopyOf")." ".$object->title;
447  // ...
448 
449  // Create clone
450  $object->context['createfromclone'] = 'createfromclone';
451  $result = $object->createCommon($user);
452  if ($result < 0) {
453  $error++;
454  $this->error = $object->error;
455  $this->errors = $object->errors;
456  }
457 
458  unset($object->context['createfromclone']);
459 
460  // End
461  if (!$error) {
462  $this->db->commit();
463  return $object;
464  } else {
465  $this->db->rollback();
466  return -1;
467  }
468  }
469 
477  public function fetch($id, $ref = null)
478  {
479  $result = $this->fetchCommon($id, $ref);
480  //if ($result > 0 && ! empty($this->table_element_line)) $this->fetchLines();
481  return $result;
482  }
483 
489  /*public function fetchLines()
490  {
491  $this->lines=array();
492 
493  // Load lines with object MyObjectLine
494 
495  return count($this->lines)?1:0;
496  }*/
497 
505  public function update(User $user, $notrigger = false)
506  {
507  return $this->updateCommon($user, $notrigger);
508  }
509 
517  public function delete(User $user, $notrigger = false)
518  {
519  return $this->deleteCommon($user, $notrigger);
520  }
521 
530  public function deleteLine(User $user, $idline, $notrigger = false)
531  {
532  if ($this->status < 0) {
533  $this->error = 'ErrorDeleteLineNotAllowedByObjectStatus';
534  return -2;
535  }
536 
537  return $this->deleteLineCommon($user, $idline, $notrigger);
538  }
539 
550  public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
551  {
552  global $db, $conf, $langs;
553  global $dolibarr_main_authentication, $dolibarr_main_demo;
554  global $menumanager;
555 
556  if (!empty($conf->dol_no_mouse_hover)) {
557  $notooltip = 1; // Force disable tooltips
558  }
559 
560  $result = '';
561  $companylink = '';
562 
563  $label = '<u>'.$langs->trans("Inventory").'</u>';
564  $label .= '<br>';
565  $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
566 
567  $url = dol_buildpath('/product/inventory/card.php', 1).'?id='.$this->id;
568 
569  $linkclose = '';
570  if (empty($notooltip)) {
571  if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
572  $label = $langs->trans("ShowInventory");
573  $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
574  }
575  $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
576  $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
577  } else {
578  $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
579  }
580 
581  $linkstart = '<a href="'.$url.'"';
582  $linkstart .= $linkclose.'>';
583  $linkend = '</a>';
584 
585  $result .= $linkstart;
586  if ($withpicto) {
587  $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);
588  }
589  if ($withpicto != 2) {
590  $result .= $this->ref;
591  }
592  $result .= $linkend;
593  //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
594 
595  return $result;
596  }
597 
604  public function getLibStatut($mode = 0)
605  {
606  return $this->LibStatut($this->status, $mode);
607  }
608 
609  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
617  public static function LibStatut($status, $mode = 0)
618  {
619  // phpcs:enable
620  global $langs;
621 
622  $labelStatus = array();
623  $labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
624  $labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Validated').' ('.$langs->transnoentitiesnoconv('InventoryStartedShort').')';
625  $labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Canceled');
626  $labelStatus[self::STATUS_RECORDED] = $langs->transnoentitiesnoconv('Closed');
627  $labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
628  $labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('InventoryStartedShort');
629  $labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Canceled');
630  $labelStatusShort[self::STATUS_RECORDED] = $langs->transnoentitiesnoconv('Closed');
631 
632  $statusType = 'status'.$status;
633  if ($status == self::STATUS_RECORDED) {
634  $statusType = 'status6';
635  }
636 
637  return dolGetStatus($labelStatus[$status], $labelStatusShort[$status], '', $statusType, $mode);
638  }
639 
646  public function info($id)
647  {
648  $sql = "SELECT rowid, date_creation as datec, tms as datem, date_validation as datev,";
649  $sql .= " fk_user_creat, fk_user_modif, fk_user_valid";
650  $sql .= " FROM ".$this->db->prefix().$this->table_element." as t";
651  $sql .= " WHERE t.rowid = ".((int) $id);
652  $result = $this->db->query($sql);
653  if ($result) {
654  if ($this->db->num_rows($result)) {
655  $obj = $this->db->fetch_object($result);
656 
657  $this->id = $obj->rowid;
658 
659  if ($obj->fk_user_creat > 0) {
660  $cuser = new User($this->db);
661  $cuser->fetch($obj->fk_user_creat);
662  $this->user_creation = $cuser;
663  }
664 
665  if ($obj->fk_user_modif > 0) {
666  $muser = new User($this->db);
667  $muser->fetch($obj->fk_user_modif);
668  $this->user_creation = $muser;
669  }
670 
671  if ($obj->fk_user_valid > 0) {
672  $vuser = new User($this->db);
673  $vuser->fetch($obj->fk_user_valid);
674  $this->user_validation = $vuser;
675  }
676 
677  $this->date_creation = $this->db->jdate($obj->datec);
678  $this->date_modification = $this->db->jdate($obj->datem);
679  $this->date_validation = $this->db->jdate($obj->datev);
680  }
681 
682  $this->db->free($result);
683  } else {
684  dol_print_error($this->db);
685  }
686  }
687 
694  public function initAsSpecimen()
695  {
696  $this->initAsSpecimenCommon();
697  $this->title = '';
698  }
699 }
700 
705 {
709  public $element = 'inventoryline';
710 
714  public $table_element = 'inventorydet';
715 
719  public $ismultientitymanaged = 0;
720 
724  public $isextrafieldmanaged = 0;
725 
729  public $picto = 'stock';
730 
748  // BEGIN MODULEBUILDER PROPERTIES
752  public $fields = array(
753  'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-1, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',),
754  'fk_inventory' => array('type'=>'integer:Inventory:product/inventory/class/inventory.class.php', 'label'=>'Inventory', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'index'=>1, 'help'=>'LinkToInventory'),
755  'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Warehouse', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'index'=>1, 'help'=>'LinkToThirparty'),
756  'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'visible'=>1, 'enabled'=>1, 'position'=>32, 'index'=>1, 'help'=>'LinkToProduct'),
757  'batch' => array('type'=>'string', 'label'=>'Batch', 'visible'=>1, 'enabled'=>1, 'position'=>32, 'index'=>1, 'help'=>'LinkToProduct'),
758  'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500),
759  'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501),
760  'qty_stock' => array('type'=>'double', 'label'=>'QtyFound', 'visible'=>1, 'enabled'=>1, 'position'=>32, 'index'=>1, 'help'=>'Qty we found/want (to define during draft edition)'),
761  'qty_view' => array('type'=>'double', 'label'=>'QtyBefore', 'visible'=>1, 'enabled'=>1, 'position'=>33, 'index'=>1, 'help'=>'Qty before (filled once movements are validated)'),
762  'qty_regulated' => array('type'=>'double', 'label'=>'QtyDelta', 'visible'=>1, 'enabled'=>1, 'position'=>34, 'index'=>1, 'help'=>'Qty aadded or removed (filled once movements are validated)'),
763  'pmp_real' => array('type'=>'double', 'label'=>'PMPReal', 'visible'=>1, 'enabled'=>1, 'position'=>35),
764  'pmp_expected' => array('type'=>'double', 'label'=>'PMPExpected', 'visible'=>1, 'enabled'=>1, 'position'=>36),
765  );
766 
770  public $rowid;
771 
772  public $fk_inventory;
773  public $fk_warehouse;
774  public $fk_product;
775  public $batch;
776  public $datec;
777  public $tms;
778  public $qty_stock;
779  public $qty_view;
780  public $qty_regulated;
781  public $pmp_real;
782  public $pmp_expected;
783 
784 
792  public function create(User $user, $notrigger = false)
793  {
794  return $this->createCommon($user, $notrigger);
795  }
796 
804  public function fetch($id, $ref = null)
805  {
806  $result = $this->fetchCommon($id, $ref);
807  //if ($result > 0 && ! empty($this->table_element_line)) $this->fetchLines();
808  return $result;
809  }
810 
818  public function update(User $user, $notrigger = false)
819  {
820  return $this->updateCommon($user, $notrigger);
821  }
822 
830  public function delete(User $user, $notrigger = false)
831  {
832  return $this->deleteCommon($user, $notrigger);
833  //return $this->deleteCommon($user, $notrigger, 1);
834  }
835 }
InventoryLine\update
update(User $user, $notrigger=false)
Update object into database.
Definition: inventory.class.php:818
CommonObject\deleteCommon
deleteCommon(User $user, $notrigger=false, $forcechilddeletion=0)
Delete object in database.
Definition: commonobject.class.php:9406
db
$conf db
API class for accounts.
Definition: inc.php:41
CommonObject\fetchCommon
fetchCommon($id, $ref=null, $morewhere='')
Load object in memory from the database.
Definition: commonobject.class.php:9202
Inventory\getNomUrl
getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
Return a link to the object card (with optionaly the picto)
Definition: inventory.class.php:550
InventoryLine\fetch
fetch($id, $ref=null)
Load object in memory from the database.
Definition: inventory.class.php:804
DoliDB
Class to manage Dolibarr database access.
Definition: DoliDB.class.php:30
dol_print_error
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Definition: functions.lib.php:4844
Inventory\validate
validate(User $user, $notrigger=false)
Validate inventory (start it)
Definition: inventory.class.php:260
dol_buildpath
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
Definition: functions.lib.php:1062
Inventory\fetch
fetch($id, $ref=null)
Load object in memory from the database.
Definition: inventory.class.php:477
CommonObject\setStatut
setStatut($status, $elementId=null, $elementType='', $trigkey='', $fieldstatus='fk_statut')
Set status of an object.
Definition: commonobject.class.php:4364
Inventory\setDraft
setDraft(User $user, $notrigger=false)
Go back to draft.
Definition: inventory.class.php:352
CommonObject\initAsSpecimenCommon
initAsSpecimenCommon()
Initialise object with example values Id must be 0 if object instance is a specimen.
Definition: commonobject.class.php:9733
Inventory
Class for Inventory.
Definition: inventory.class.php:36
CommonObjectLine
Parent class for class inheritance lines of business objects This class is useless for the moment so ...
Definition: commonobjectline.class.php:32
CommonObject
Parent class of all other business classes (invoices, contracts, proposals, orders,...
Definition: commonobject.class.php:44
Inventory\update
update(User $user, $notrigger=false)
Load object lines in memory from the database.
Definition: inventory.class.php:505
Inventory\LibStatut
static LibStatut($status, $mode=0)
Return the status.
Definition: inventory.class.php:617
Inventory\getLibStatut
getLibStatut($mode=0)
Retourne le libelle du status d'un user (actif, inactif)
Definition: inventory.class.php:604
Inventory\create
create(User $user, $notrigger=false)
Create object into database.
Definition: inventory.class.php:246
CommonObject\createCommon
createCommon(User $user, $notrigger=false)
Create object into database.
Definition: commonobject.class.php:9035
Inventory\info
info($id)
Charge les informations d'ordre info dans l'objet commande.
Definition: inventory.class.php:646
Inventory\setCanceled
setCanceled(User $user, $notrigger=false)
Set to Canceled.
Definition: inventory.class.php:404
dol_syslog
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
Definition: functions.lib.php:1603
InventoryLine\create
create(User $user, $notrigger=false)
Create object in database.
Definition: inventory.class.php:792
Inventory\setRecorded
setRecorded(User $user, $notrigger=false)
Set to inventory to status "Closed".
Definition: inventory.class.php:382
CommonObject\updateCommon
updateCommon(User $user, $notrigger=false)
Update object into database.
Definition: commonobject.class.php:9308
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition: functions.lib.php:105
User
Class to manage Dolibarr users.
Definition: user.class.php:44
InventoryLine
Class InventoryLine.
Definition: inventory.class.php:704
dolGetStatus
dolGetStatus($statusLabel='', $statusLabelShort='', $html='', $statusType='status0', $displayMode=0, $url='', $params=array())
Output the badge of a status.
Definition: functions.lib.php:10338
Inventory\initAsSpecimen
initAsSpecimen()
Initialise object with example values Id must be 0 if object instance is a specimen.
Definition: inventory.class.php:694
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
Inventory\__construct
__construct(DoliDB $db)
Constructor.
Definition: inventory.class.php:224
CommonObject\deleteLineCommon
deleteLineCommon(User $user, $idline, $notrigger=false)
Delete a line of object in database.
Definition: commonobject.class.php:9622
Inventory\deleteLine
deleteLine(User $user, $idline, $notrigger=false)
Delete a line of object in database.
Definition: inventory.class.php:530
Inventory\createFromClone
createFromClone(User $user, $fromid)
Clone and object into another one.
Definition: inventory.class.php:426