27 require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobject.class.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobjectline.class.php';
40 public $element =
'mo';
45 public $table_element =
'mrp_mo';
50 public $ismultientitymanaged = 1;
55 public $isextrafieldmanaged = 1;
60 public $picto =
'mrp';
63 const STATUS_DRAFT = 0;
64 const STATUS_VALIDATED = 1;
65 const STATUS_INPROGRESS = 2;
66 const STATUS_PRODUCED = 3;
67 const STATUS_CANCELED = 9;
100 public $fields = array(
101 'rowid' => array(
'type'=>
'integer',
'label'=>
'TechnicalID',
'enabled'=>1,
'visible'=>-2,
'position'=>1,
'notnull'=>1,
'index'=>1,
'comment'=>
"Id",),
102 'entity' => array(
'type'=>
'integer',
'label'=>
'Entity',
'enabled'=>1,
'visible'=>0,
'position'=>5,
'notnull'=>1,
'default'=>
'1',
'index'=>1),
103 'ref' => array(
'type'=>
'varchar(128)',
'label'=>
'Ref',
'enabled'=>1,
'visible'=>4,
'position'=>10,
'notnull'=>1,
'default'=>
'(PROV)',
'index'=>1,
'searchall'=>1,
'comment'=>
"Reference of object",
'showoncombobox'=>
'1',
'noteditable'=>1),
104 'fk_bom' => array(
'type'=>
'integer:Bom:bom/class/bom.class.php:0:t.status=1',
'filter'=>
'active=1',
'label'=>
'BOM',
'enabled'=>
'$conf->bom->enabled',
'visible'=>1,
'position'=>33,
'notnull'=>-1,
'index'=>1,
'comment'=>
"Original BOM",
'css'=>
'minwidth100 maxwidth300',
'csslist'=>
'nowraponall',
'picto'=>
'bom'),
105 'mrptype' => array(
'type'=>
'integer',
'label'=>
'Type',
'enabled'=>1,
'visible'=>1,
'position'=>34,
'notnull'=>1,
'default'=>
'0',
'arrayofkeyval'=>array(0=>
'Manufacturing', 1=>
'Disassemble'),
'css'=>
'minwidth150',
'csslist'=>
'minwidth150 center'),
106 'fk_product' => array(
'type'=>
'integer:Product:product/class/product.class.php:0',
'label'=>
'Product',
'enabled'=>
'$conf->product->enabled',
'visible'=>1,
'position'=>35,
'notnull'=>1,
'index'=>1,
'comment'=>
"Product to produce",
'css'=>
'maxwidth300',
'csslist'=>
'tdoverflowmax100',
'picto'=>
'product'),
107 'qty' => array(
'type'=>
'real',
'label'=>
'QtyToProduce',
'enabled'=>1,
'visible'=>1,
'position'=>40,
'notnull'=>1,
'comment'=>
"Qty to produce",
'css'=>
'width75',
'default'=>1,
'isameasure'=>1),
108 'label' => array(
'type'=>
'varchar(255)',
'label'=>
'Label',
'enabled'=>1,
'visible'=>1,
'position'=>42,
'notnull'=>-1,
'searchall'=>1,
'showoncombobox'=>
'2',
'css'=>
'maxwidth300',
'csslist'=>
'tdoverflowmax200',
'alwayseditable'=>1),
109 'fk_soc' => array(
'type'=>
'integer:Societe:societe/class/societe.class.php:1',
'label'=>
'ThirdParty',
'picto'=>
'company',
'enabled'=>
'$conf->societe->enabled',
'visible'=>-1,
'position'=>50,
'notnull'=>-1,
'index'=>1,
'css'=>
'maxwidth400',
'csslist'=>
'tdoverflowmax150'),
110 'fk_project' => array(
'type'=>
'integer:Project:projet/class/project.class.php:1:fk_statut=1',
'label'=>
'Project',
'picto'=>
'project',
'enabled'=>
'$conf->project->enabled',
'visible'=>-1,
'position'=>51,
'notnull'=>-1,
'index'=>1,
'css'=>
'minwidth200 maxwidth400',
'csslist'=>
'tdoverflowmax100'),
111 'fk_warehouse' => array(
'type'=>
'integer:Entrepot:product/stock/class/entrepot.class.php:0',
'label'=>
'WarehouseForProduction',
'picto'=>
'stock',
'enabled'=>
'$conf->stock->enabled',
'visible'=>1,
'position'=>52,
'css'=>
'maxwidth400',
'csslist'=>
'tdoverflowmax200'),
112 'note_public' => array(
'type'=>
'html',
'label'=>
'NotePublic',
'enabled'=>1,
'visible'=>0,
'position'=>61,
'notnull'=>-1,),
113 'note_private' => array(
'type'=>
'html',
'label'=>
'NotePrivate',
'enabled'=>1,
'visible'=>0,
'position'=>62,
'notnull'=>-1,),
114 'date_creation' => array(
'type'=>
'datetime',
'label'=>
'DateCreation',
'enabled'=>1,
'visible'=>-2,
'position'=>500,
'notnull'=>1,),
115 'tms' => array(
'type'=>
'timestamp',
'label'=>
'DateModification',
'enabled'=>1,
'visible'=>-2,
'position'=>501,
'notnull'=>1,),
116 'date_valid' => array(
'type'=>
'datetime',
'label'=>
'DateValidation',
'enabled'=>1,
'visible'=>-2,
'position'=>502,),
117 'fk_user_creat' => array(
'type'=>
'integer:User:user/class/user.class.php',
'label'=>
'UserAuthor',
'enabled'=>1,
'visible'=>-2,
'position'=>510,
'notnull'=>1,
'foreignkey'=>
'user.rowid',
'csslist'=>
'tdoverflowmax100'),
118 'fk_user_modif' => array(
'type'=>
'integer:User:user/class/user.class.php',
'label'=>
'UserModif',
'enabled'=>1,
'visible'=>-2,
'position'=>511,
'notnull'=>-1,
'csslist'=>
'tdoverflowmax100'),
119 'date_start_planned' => array(
'type'=>
'datetime',
'label'=>
'DateStartPlannedMo',
'enabled'=>1,
'visible'=>1,
'position'=>55,
'notnull'=>-1,
'index'=>1,
'help'=>
'KeepEmptyForAsap',
'alwayseditable'=>1),
120 'date_end_planned' => array(
'type'=>
'datetime',
'label'=>
'DateEndPlannedMo',
'enabled'=>1,
'visible'=>1,
'position'=>56,
'notnull'=>-1,
'index'=>1,
'alwayseditable'=>1),
121 'import_key' => array(
'type'=>
'varchar(14)',
'label'=>
'ImportId',
'enabled'=>1,
'visible'=>-2,
'position'=>1000,
'notnull'=>-1,),
122 'model_pdf' =>array(
'type'=>
'varchar(255)',
'label'=>
'Model pdf',
'enabled'=>1,
'visible'=>0,
'position'=>1010),
123 'status' => array(
'type'=>
'integer',
'label'=>
'Status',
'enabled'=>1,
'visible'=>2,
'position'=>1000,
'default'=>0,
'notnull'=>1,
'index'=>1,
'arrayofkeyval'=>array(
'0'=>
'Draft',
'1'=>
'Validated',
'2'=>
'InProgress',
'3'=>
'StatusMOProduced',
'9'=>
'Canceled')),
124 'fk_parent_line' => array(
'type'=>
'integer:MoLine:mrp/class/mo.class.php',
'label'=>
'ParentMo',
'enabled'=>1,
'visible'=>0,
'position'=>1020,
'default'=>0,
'notnull'=>0,
'index'=>1,
'showoncombobox'=>0),
132 public $fk_warehouse;
144 public $note_private;
149 public $date_creation;
153 public $fk_user_creat;
154 public $fk_user_modif;
162 public $date_start_planned;
167 public $date_end_planned;
180 public $table_element_line =
'mrp_production';
185 public $fk_element =
'fk_mo';
190 public $class_element_line =
'MoLine';
195 protected $childtables = array();
200 protected $childtablesoncascade = array(
'mrp_production');
205 public $lines = array();
211 public $fk_parent_line;
221 global $conf, $langs;
225 if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields[
'rowid'])) {
226 $this->fields[
'rowid'][
'visible'] = 0;
228 if (!
isModEnabled(
'multicompany') && isset($this->fields[
'entity'])) {
229 $this->fields[
'entity'][
'enabled'] = 0;
233 foreach ($this->fields as $key => $val) {
234 if (isset($val[
'enabled']) && empty($val[
'enabled'])) {
235 unset($this->fields[$key]);
240 foreach ($this->fields as $key => $val) {
241 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
242 foreach ($val[
'arrayofkeyval'] as $key2 => $val2) {
243 $this->fields[$key][
'arrayofkeyval'][$key2] = $langs->trans($val2);
266 if (empty($conf->global->ALLOW_USE_KITS_INTO_BOM_AND_MO) && $this->fk_product > 0) {
267 include_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
269 $tmpproduct->fetch($this->fk_product);
270 if ($tmpproduct->hasFatherOrChild(1) > 0) {
271 $this->error =
'ErrorAVirtualProductCantBeUsedIntoABomOrMo';
272 $this->errors[] = $this->error;
273 $this->
db->rollback();
278 if ($this->fk_bom > 0) {
280 $tmpbom =
new BOM($this->
db);
281 $tmpbom->fetch($this->fk_bom);
283 $this->mrptype = $tmpbom->bomtype;
288 if ($idcreated <= 0) {
303 $this->
db->rollback();
318 global $langs, $extrafields;
323 $object =
new self($this->db);
328 $result = $object->fetchCommon($fromid);
329 if ($result > 0 && !empty($object->table_element_line)) {
330 $object->fetchLines();
339 unset($object->fk_user_creat);
340 unset($object->import_key);
343 $object->ref = empty($this->fields[
'ref'][
'default']) ?
"copy_of_".$object->ref : $this->fields[
'ref'][
'default'];
344 $object->label = empty($this->fields[
'label'][
'default']) ? $langs->trans(
"CopyOf").
" ".$object->label : $this->fields[
'label'][
'default'];
345 $object->status = self::STATUS_DRAFT;
348 if (is_array($object->array_options) && count($object->array_options) > 0) {
349 $extrafields->fetch_name_optionals_label($this->table_element);
350 foreach ($object->array_options as $key => $option) {
351 $shortkey = preg_replace(
'/options_/',
'', $key);
352 if (!empty($extrafields->attributes[$this->element][
'unique'][$shortkey])) {
355 unset($object->array_options[$key]);
361 $object->context[
'createfromclone'] =
'createfromclone';
362 $result = $object->createCommon($user);
365 $this->error = $object->error;
366 $this->errors = $object->errors;
378 if (property_exists($this,
'socid') && $this->socid == $object->socid) {
385 unset($object->context[
'createfromclone']);
392 $this->
db->rollback();
404 public function fetch($id, $ref =
null)
407 if ($result > 0 && !empty($this->table_element_line)) {
411 $this->socid = $this->fk_soc;
423 $this->lines = array();
441 public function fetchAll($sortorder =
'', $sortfield =
'', $limit = 0, $offset = 0, array $filter = array(), $filtermode =
'AND')
451 $sql .=
' FROM '.MAIN_DB_PREFIX.$this->table_element.
' as t';
452 if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
453 $sql .=
' WHERE t.entity IN ('.getEntity($this->table_element).
')';
455 $sql .=
' WHERE 1 = 1';
459 if (count($filter) > 0) {
460 foreach ($filter as $key => $value) {
461 if ($key ==
't.rowid') {
462 $sqlwhere[] = $key.
" = ".((int) $value);
463 } elseif (strpos($key,
'date') !==
false) {
464 $sqlwhere[] = $key.
" = '".$this->
db->idate($value).
"'";
465 } elseif ($key ==
'customsql') {
466 $sqlwhere[] = $value;
468 $sqlwhere[] = $key.
" LIKE '%".$this->
db->escape($value).
"%'";
472 if (count($sqlwhere) > 0) {
473 $sql .=
' AND ('.implode(
' '.$this->
db->escape($filtermode).
' ', $sqlwhere).
')';
476 if (!empty($sortfield)) {
477 $sql .= $this->
db->order($sortfield, $sortorder);
479 if (!empty($limit)) {
480 $sql .= $this->
db->plimit($limit, $offset);
487 while ($i < min($limit, $num)) {
488 $obj = $this->
db->fetch_object(
$resql);
490 $record =
new self($this->db);
491 $record->setVarsFromFetchObj($obj);
493 $records[$record->id] = $record;
501 $this->errors[] =
'Error '.$this->db->lasterror();
502 dol_syslog(__METHOD__.
' '.join(
',', $this->errors), LOG_ERR);
521 $sql .= $mostatic->getFieldList();
522 $sql .=
' FROM '.MAIN_DB_PREFIX.$mostatic->table_element.
' as t';
523 $sql .=
" WHERE t.role = '".$this->db->escape($role).
"'";
525 $sql .=
' AND t.fk_mrp_production = '.((int) $lineid);
527 $sql .=
'AND t.fk_mo = '.((int) $this->
id);
536 $obj = $this->
db->fetch_object(
$resql);
539 'rowid'=> $obj->rowid,
540 'date'=> $this->db->jdate($obj->date_creation),
542 'role' => $obj->role,
543 'fk_product' => $obj->fk_product,
544 'fk_warehouse' => $obj->fk_warehouse,
545 'batch' => $obj->batch,
546 'fk_stock_movement' => $obj->fk_stock_movement
555 $this->error = $this->
db->lasterror();
570 $sql =
'SELECT COUNT(rowid) as nb FROM '.MAIN_DB_PREFIX.
'stock_mouvement as sm';
571 $sql .=
" WHERE sm.origintype = 'mo' and sm.fk_origin = ".((int) $this->
id);
579 $obj = $this->
db->fetch_object(
$resql);
587 $this->error = $this->
db->lasterror();
623 $this->
db->rollback();
640 if ($this->status != self::STATUS_DRAFT) {
652 $sql =
'DELETE FROM '.MAIN_DB_PREFIX.
'mrp_production WHERE fk_mo = '.((int) $this->
id);
653 $this->
db->query($sql);
658 $moline->fk_mo = $this->id;
659 $moline->qty = $this->qty;
660 $moline->fk_product = $this->fk_product;
661 $moline->position = 1;
663 if ($this->fk_bom > 0) {
664 include_once DOL_DOCUMENT_ROOT.
'/bom/class/bom.class.php';
665 $bom =
new Bom($this->
db);
666 $bom->fetch($this->fk_bom);
667 if ($bom->bomtype == 1) {
669 $moline->role =
'toconsume';
672 $moline->role =
'toproduce';
675 if ($this->mrptype == 1) {
676 $moline->role =
'toconsume';
678 $moline->role =
'toproduce';
682 $resultline = $moline->create($user,
false);
683 if ($resultline <= 0) {
685 $this->error = $moline->error;
686 $this->errors = $moline->errors;
690 if ($this->fk_bom > 0) {
694 foreach ($bom->lines as $line) {
697 $moline->fk_mo = $this->id;
698 $moline->origin_id = $line->id;
699 $moline->origin_type =
'bomline';
700 if ($line->qty_frozen) {
701 $moline->qty = $line->qty;
703 $moline->qty =
price2num(($line->qty / ( !empty($bom->qty) ? $bom->qty : 1 ) ) * $this->qty / ( !empty($line->efficiency) ? $line->efficiency : 1 ),
'MS');
705 if ($moline->qty <= 0) {
707 $this->error =
"BadValueForquantityToConsume";
710 $moline->fk_product = $line->fk_product;
711 $moline->role = $role;
712 $moline->position = $line->position;
713 $moline->qty_frozen = $line->qty_frozen;
714 $moline->disable_stock_change = $line->disable_stock_change;
716 $resultline = $moline->create($user,
false);
717 if ($resultline <= 0) {
719 $this->error = $moline->error;
720 $this->errors = $moline->errors;
735 $this->
db->rollback();
748 public function delete(
User $user, $notrigger =
false)
765 $langs->load(
'stocks');
767 if ($this->status < 0) {
768 $this->error =
'ErrorDeleteLineNotAllowedByObjectStatus';
773 $fk_movement =
GETPOST(
'fk_movement',
'int');
776 if (!empty($arrayoflines)) {
780 $stockmove->setOrigin($this->element, $this->
id);
782 if (!empty($fk_movement)) {
784 $TArrayMoLine = $moline->fetchAll(
'',
'', 1, 0, array(
'customsql' =>
'fk_stock_movement ='.$fk_movement));
785 $moline = array_shift($TArrayMoLine);
788 $movement->fetch($fk_movement);
789 $productstatic->fetch($movement->product_id);
790 $qtytoprocess = $movement->qty;
793 $labelmovementCancel = $langs->trans(
"CancelProductionForRef", $productstatic->ref);
794 $codemovementCancel = $langs->trans(
"StockIncrease");
796 if (($qtytoprocess >= 0)) {
797 $idstockmove = $stockmove->reception($user, $movement->product_id, $movement->warehouse_id, $qtytoprocess, 0, $labelmovementCancel,
'',
'', $movement->batch,
dol_now(), 0, $codemovementCancel);
799 $idstockmove = $stockmove->livraison($user, $movement->product_id, $movement->warehouse_id, $qtytoprocess, 0, $labelmovementCancel,
dol_now(),
'',
'', $movement->batch, 0, $codemovementCancel);
801 if ($idstockmove < 0) {
803 $this->
db->rollback();
808 return $moline->delete($user, $notrigger);
810 foreach ($arrayoflines as $key => $arrayofline) {
811 $lineDetails = $arrayoflines[$key];
812 $productstatic->fetch($lineDetails[
'fk_product']);
813 $qtytoprocess = $lineDetails[
'qty'];
816 $labelmovementCancel = $langs->trans(
"CancelProductionForRef", $productstatic->ref);
817 $codemovementCancel = $langs->trans(
"StockIncrease");
819 if ($qtytoprocess >= 0) {
820 $idstockmove = $stockmove->reception($user, $lineDetails[
'fk_product'], $lineDetails[
'fk_warehouse'], $qtytoprocess, 0, $labelmovementCancel,
'',
'', $lineDetails[
'batch'],
dol_now(), 0, $codemovementCancel);
822 $idstockmove = $stockmove->livraison($user, $lineDetails[
'fk_product'], $lineDetails[
'fk_warehouse'], $qtytoprocess, 0, $labelmovementCancel,
dol_now(),
'',
'', $lineDetails[
'batch'], 0, $codemovementCancel);
824 if ($idstockmove < 0) {
826 $this->
db->rollback();
849 global $langs, $conf;
852 if (!empty($conf->global->MRP_MO_ADDON)) {
855 $file = $conf->global->MRP_MO_ADDON.
".php";
856 $classname = $conf->global->MRP_MO_ADDON;
859 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
860 foreach ($dirmodels as $reldir) {
864 $mybool |= @include_once $dir.$file;
867 if ($mybool ===
false) {
872 $obj =
new $classname();
873 $numref = $obj->getNextValue($prod, $this);
878 $this->error = $obj->error;
883 print $langs->trans(
"Error").
" ".$langs->trans(
"Error_MRP_MO_ADDON_NotDefined");
897 global $conf, $langs;
899 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
904 if ($this->status == self::STATUS_VALIDATED) {
905 dol_syslog(get_class($this).
"::validate action abandonned: already validated", LOG_WARNING);
922 if (!$error && (preg_match(
'/^[\(]?PROV/i', $this->
ref) || empty($this->
ref))) {
928 $this->newref = $num;
931 $sql =
"UPDATE ".MAIN_DB_PREFIX.$this->table_element;
932 $sql .=
" SET ref = '".$this->db->escape($num).
"',";
933 $sql .=
" status = ".self::STATUS_VALIDATED.
",";
934 $sql .=
" date_valid='".$this->db->idate($now).
"',";
935 $sql .=
" fk_user_valid = ".$user->id;
936 $sql .=
" WHERE rowid = ".((int) $this->
id);
938 dol_syslog(get_class($this).
"::validate()", LOG_DEBUG);
942 $this->error = $this->
db->lasterror();
946 if (!$error && !$notrigger) {
948 $result = $this->
call_trigger(
'MRP_MO_VALIDATE', $user);
956 $this->oldref = $this->ref;
959 if (preg_match(
'/^[\(]?PROV/i', $this->
ref)) {
961 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"ecm_files set filename = CONCAT('".$this->
db->escape($this->newref).
"', SUBSTR(filename, ".(strlen($this->
ref) + 1).
")), filepath = 'mrp/".$this->
db->escape($this->newref).
"'";
962 $sql .=
" WHERE filename LIKE '".$this->db->escape($this->
ref).
"%' AND filepath = 'mrp/".$this->
db->escape($this->
ref).
"' and entity = ".$conf->entity;
965 $error++; $this->error = $this->
db->lasterror();
971 $dirsource = $conf->mrp->dir_output.
'/'.$oldref;
972 $dirdest = $conf->mrp->dir_output.
'/'.$newref;
973 if (!$error && file_exists($dirsource)) {
974 dol_syslog(get_class($this).
"::validate() rename dir ".$dirsource.
" into ".$dirdest);
976 if (@rename($dirsource, $dirdest)) {
979 $listoffiles =
dol_dir_list($conf->mrp->dir_output.
'/'.$newref,
'files', 1,
'^'.preg_quote($oldref,
'/'));
980 foreach ($listoffiles as $fileentry) {
981 $dirsource = $fileentry[
'name'];
982 $dirdest = preg_replace(
'/^'.preg_quote($oldref,
'/').
'/', $newref, $dirsource);
983 $dirsource = $fileentry[
'path'].
'/'.$dirsource;
984 $dirdest = $fileentry[
'path'].
'/'.$dirdest;
985 @rename($dirsource, $dirdest);
995 $this->status = self::STATUS_VALIDATED;
1002 $this->
db->rollback();
1017 if ($this->status <= self::STATUS_DRAFT) {
1028 return $this->
setStatusCommon($user, self::STATUS_DRAFT, $notrigger,
'MRP_MO_UNVALIDATE');
1038 public function cancel($user, $notrigger = 0)
1041 if ($this->status != self::STATUS_VALIDATED && $this->status != self::STATUS_INPROGRESS) {
1052 return $this->
setStatusCommon($user, self::STATUS_CANCELED, $notrigger,
'MRP_MO_CANCEL');
1062 public function reopen($user, $notrigger = 0)
1065 if ($this->status != self::STATUS_PRODUCED && $this->status != self::STATUS_CANCELED) {
1076 return $this->
setStatusCommon($user, self::STATUS_VALIDATED, $notrigger,
'MRP_MO_REOPEN');
1089 public function getNomUrl($withpicto = 0, $option =
'', $notooltip = 0, $morecss =
'', $save_lastsearch_value = -1)
1091 global $conf, $langs, $hookmanager;
1093 if (!empty($conf->dol_no_mouse_hover)) {
1099 $label =
img_picto(
'', $this->picto).
' <u class="paddingrightonly">'.$langs->trans(
"ManufacturingOrder").
'</u>';
1100 if (isset($this->status)) {
1101 $label .=
' '.$this->getLibStatut(5);
1104 $label .=
'<b>'.$langs->trans(
'Ref').
':</b> '.$this->ref;
1105 if (isset($this->label)) {
1106 $label .=
'<br><b>'.$langs->trans(
'Label').
':</b> '.$this->label;
1109 $url = DOL_URL_ROOT.
'/mrp/mo_card.php?id='.$this->id;
1110 if ($option ==
'production') {
1111 $url = DOL_URL_ROOT.
'/mrp/mo_production.php?id='.$this->id;
1114 if ($option !=
'nolink') {
1116 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
1117 if ($save_lastsearch_value == -1 && preg_match(
'/list\.php/', $_SERVER[
"PHP_SELF"])) {
1118 $add_save_lastsearch_values = 1;
1120 if ($add_save_lastsearch_values) {
1121 $url .=
'&save_lastsearch_values=1';
1126 if (empty($notooltip)) {
1127 if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
1128 $label = $langs->trans(
"ShowMo");
1129 $linkclose .=
' alt="'.dol_escape_htmltag($label, 1).
'"';
1131 $linkclose .=
' title="'.dol_escape_htmltag($label, 1).
'"';
1132 $linkclose .=
' class="classfortooltip'.($morecss ?
' '.$morecss :
'').
'"';
1134 $linkclose = ($morecss ?
' class="'.$morecss.
'"' :
'');
1137 $linkstart =
'<a href="'.$url.
'"';
1138 $linkstart .= $linkclose.
'>';
1141 $result .= $linkstart;
1143 $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);
1145 if ($withpicto != 2) {
1146 $result .= $this->ref;
1148 $result .= $linkend;
1151 global $action, $hookmanager;
1152 $hookmanager->initHooks(array(
'modao'));
1153 $parameters = array(
'id'=>$this->
id,
'getnomurl' => &$result);
1154 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
1156 $result = $hookmanager->resPrint;
1158 $result .= $hookmanager->resPrint;
1172 return $this->
LibStatut($this->status, $mode);
1186 if (empty($this->labelStatus)) {
1189 $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Draft');
1190 $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'ValidatedToProduce');
1191 $this->labelStatus[self::STATUS_INPROGRESS] = $langs->transnoentitiesnoconv(
'InProgress');
1192 $this->labelStatus[self::STATUS_PRODUCED] = $langs->transnoentitiesnoconv(
'StatusMOProduced');
1193 $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv(
'Canceled');
1195 $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Draft');
1196 $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Validated');
1197 $this->labelStatusShort[self::STATUS_INPROGRESS] = $langs->transnoentitiesnoconv(
'InProgress');
1198 $this->labelStatusShort[self::STATUS_PRODUCED] = $langs->transnoentitiesnoconv(
'StatusMOProduced');
1199 $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv(
'Canceled');
1202 $statusType =
'status'.$status;
1203 if ($status == self::STATUS_VALIDATED) {
1204 $statusType =
'status1';
1206 if ($status == self::STATUS_INPROGRESS) {
1207 $statusType =
'status4';
1209 if ($status == self::STATUS_PRODUCED) {
1210 $statusType =
'status6';
1212 if ($status == self::STATUS_CANCELED) {
1213 $statusType =
'status9';
1216 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status],
'', $statusType, $mode);
1227 $sql =
'SELECT rowid, date_creation as datec, tms as datem,';
1228 $sql .=
' fk_user_creat, fk_user_modif';
1229 $sql .=
' FROM '.MAIN_DB_PREFIX.$this->table_element.
' as t';
1230 $sql .=
' WHERE t.rowid = '.((int) $id);
1231 $result = $this->
db->query($sql);
1233 if ($this->
db->num_rows($result)) {
1234 $obj = $this->
db->fetch_object($result);
1235 $this->
id = $obj->rowid;
1237 $this->user_creation_id = $obj->fk_user_creat;
1238 $this->user_modification_id = $obj->fk_user_modif;
1239 $this->date_creation = $this->
db->jdate($obj->datec);
1240 $this->date_modification = empty($obj->datem) ?
'' : $this->
db->jdate($obj->datem);
1243 $this->
db->free($result);
1259 $this->lines = array();
1269 $this->lines = array();
1271 $objectline =
new MoLine($this->
db);
1273 $TFilters = array(
'customsql'=>
'fk_mo = '.((
int) $this->
id));
1274 if (!empty($rolefilter)) $TFilters[
'role'] = $rolefilter;
1275 $result = $objectline->fetchAll(
'ASC',
'position', 0, 0, $TFilters);
1277 if (is_numeric($result)) {
1278 $this->error = $objectline->error;
1279 $this->errors = $objectline->errors;
1282 $this->lines = $result;
1283 return $this->lines;
1298 public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams =
null)
1300 global $conf, $langs;
1302 $langs->load(
"mrp");
1308 if ($this->model_pdf) {
1309 $modele = $this->model_pdf;
1310 } elseif (!empty($conf->global->MO_ADDON_PDF)) {
1311 $modele = $conf->global->MO_ADDON_PDF;
1315 $modelpath =
"core/modules/mrp/doc/";
1317 if (empty($modele)) {
1321 return $this->
commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
1333 global $conf, $langs;
1349 $this->
db->commit();
1366 global $langs, $hookmanager, $conf,
$form;
1368 $langs->load(
'stocks');
1369 $text_stock_options = $langs->trans(
"RealStockDesc").
'<br>';
1370 $text_stock_options .= $langs->trans(
"RealStockWillAutomaticallyWhen").
'<br>';
1371 $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE) ?
'- '.$langs->trans(
"DeStockOnShipment").
'<br>' :
'');
1372 $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) ?
'- '.$langs->trans(
"DeStockOnValidateOrder").
'<br>' :
'');
1373 $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_BILL) ?
'- '.$langs->trans(
"DeStockOnBill").
'<br>' :
'');
1374 $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) ?
'- '.$langs->trans(
"ReStockOnBill").
'<br>' :
'');
1375 $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) ?
'- '.$langs->trans(
"ReStockOnValidateOrder").
'<br>' :
'');
1376 $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) ?
'- '.$langs->trans(
"ReStockOnDispatchOrder").
'<br>' :
'');
1377 $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE) ?
'- '.$langs->trans(
"StockOnReception").
'<br>' :
'');
1379 print
'<tr class="liste_titre">';
1381 print
'<td class="linecoldescription">'.$langs->trans(
'Ref');
1382 if (!empty($conf->global->BOM_SUB_BOM)) {
1383 print
' <a id="show_all" href="#">'.img_picto(
'',
'folder-open',
'class="paddingright"').$langs->trans(
"ExpandAll").
'</a> ';
1384 print
'<a id="hide_all" href="#">'.img_picto(
'',
'folder',
'class="paddingright"').$langs->trans(
"UndoExpandAll").
'</a> ';
1388 print
'<td class="right">'.$langs->trans(
'Qty');
1389 if ($this->bom->bomtype == 0) {
1390 print
' <span class="opacitymedium">('.$langs->trans(
"ForAQuantityOf", $this->bom->qty).
')</span>';
1392 print
' <span class="opacitymedium">('.$langs->trans(
"ForAQuantityToConsumeOf", $this->bom->qty).
')</span>';
1395 print
'<td class="center">'.$form->textwithpicto($langs->trans(
"PhysicalStock"), $text_stock_options, 1).
'</td>';
1396 print
'<td class="center">'.$form->textwithpicto($langs->trans(
"VirtualStock"), $langs->trans(
"VirtualStockDesc")).
'</td>';
1397 print
'<td class="center">'.$langs->trans(
'QtyFrozen').
'</td>';
1398 print
'<td class="center">'.$langs->trans(
'DisableStockChange').
'</td>';
1399 print
'<td class="center">'.$langs->trans(
'MoChildGenerate').
'</td>';
1405 if (!empty($this->lines)) {
1406 foreach ($this->lines as $line) {
1408 if (is_object($hookmanager)) {
1409 $parameters = array(
'line'=>$line,
'i'=>$i,
'restrictlist'=>$restrictlist,
'selectedLines'=> $selectedLines);
1410 if (!empty($line->fk_parent_line)) { $parameters[
'fk_parent_line'] = $line->fk_parent_line; }
1411 $reshook = $hookmanager->executeHooks(
'printOriginObjectLine', $parameters, $this, $action);
1413 if (empty($reshook)) {
1414 $this->
printOriginLine($line,
'', $restrictlist,
'/core/tpl', $selectedLines);
1436 public function printOriginLine($line, $var, $restrictlist =
'', $defaulttpldir =
'/core/tpl', $selectedLines = array())
1438 global $langs, $conf;
1440 $this->tpl[
'id'] = $line->id;
1442 $this->tpl[
'label'] =
'';
1443 if (!empty($line->fk_product)) {
1444 $productstatic =
new Product($this->
db);
1445 $productstatic->fetch($line->fk_product);
1446 $productstatic->load_virtual_stock();
1447 $this->tpl[
'label'] .= $productstatic->getNomUrl(1);
1454 $this->tpl[
'qty_bom'] = 1;
1455 if (is_object($this->bom) && $this->bom->qty > 1) {
1456 $this->tpl[
'qty_bom'] = $this->bom->qty;
1459 $this->tpl[
'stock'] = $productstatic->stock_reel;
1460 $this->tpl[
'seuil_stock_alerte'] = $productstatic->seuil_stock_alerte;
1461 $this->tpl[
'virtual_stock'] = $productstatic->stock_theorique;
1462 $this->tpl[
'qty'] = $line->qty;
1463 $this->tpl[
'qty_frozen'] = $line->qty_frozen;
1464 $this->tpl[
'disable_stock_change'] = $line->disable_stock_change;
1465 $this->tpl[
'efficiency'] = $line->efficiency;
1467 $tpl = DOL_DOCUMENT_ROOT.
'/mrp/tpl/originproductline.tpl.php';
1468 $res = include $tpl;
1481 $tables = array(
'mrp_mo');
1495 $TMoChilds = array();
1498 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"mrp_mo as mo_child";
1499 $sql.=
" WHERE fk_parent_line IN ";
1500 $sql.=
" (SELECT rowid FROM ".MAIN_DB_PREFIX.
"mrp_production as line_parent";
1501 $sql.=
" WHERE fk_mo=".((int) $this->
id).
")";
1506 if ($this->
db->num_rows(
$resql) > 0) {
1507 while ($obj = $this->
db->fetch_object(
$resql)) {
1508 $MoChild =
new Mo($this->
db);
1509 $res = $MoChild->fetch($obj->rowid);
1510 if ($res > 0) $TMoChilds[$MoChild->id] = $MoChild;
1532 $MoParent =
new Mo($this->
db);
1535 $sql =
"SELECT lineparent.fk_mo as id_moparent FROM ".MAIN_DB_PREFIX.
"mrp_mo as mo";
1536 $sql.=
" LEFT JOIN ".MAIN_DB_PREFIX.
"mrp_production lineparent ON mo.fk_parent_line = lineparent.rowid";
1537 $sql.=
" WHERE mo.rowid = ".((int) $this->
id);
1542 if ($this->
db->num_rows(
$resql) > 0) {
1543 $obj = $this->
db->fetch_object(
$resql);
1544 $res = $MoParent->fetch($obj->id_moparent);
1545 if ($res < 0) $error++;
1569 public $element =
'mrp_production';
1574 public $table_element =
'mrp_production';
1579 public $ismultientitymanaged = 0;
1584 public $isextrafieldmanaged = 0;
1586 public $fields = array(
1587 'rowid' =>array(
'type'=>
'integer',
'label'=>
'ID',
'enabled'=>1,
'visible'=>-1,
'notnull'=>1,
'position'=>10),
1588 'fk_mo' =>array(
'type'=>
'integer',
'label'=>
'Mo',
'enabled'=>1,
'visible'=>-1,
'notnull'=>1,
'position'=>15),
1589 'origin_id' =>array(
'type'=>
'integer',
'label'=>
'Origin',
'enabled'=>1,
'visible'=>-1,
'notnull'=>0,
'position'=>17),
1590 'origin_type' =>array(
'type'=>
'varchar(10)',
'label'=>
'Origin type',
'enabled'=>1,
'visible'=>-1,
'notnull'=>0,
'position'=>18),
1591 'position' =>array(
'type'=>
'integer',
'label'=>
'Position',
'enabled'=>1,
'visible'=>-1,
'notnull'=>1,
'position'=>20),
1592 'fk_product' =>array(
'type'=>
'integer',
'label'=>
'Product',
'enabled'=>1,
'visible'=>-1,
'notnull'=>1,
'position'=>25),
1593 'fk_warehouse' =>array(
'type'=>
'integer',
'label'=>
'Warehouse',
'enabled'=>1,
'visible'=>-1,
'position'=>30),
1594 'qty' =>array(
'type'=>
'real',
'label'=>
'Qty',
'enabled'=>1,
'visible'=>-1,
'notnull'=>1,
'position'=>35),
1595 'qty_frozen' => array(
'type'=>
'smallint',
'label'=>
'QuantityFrozen',
'enabled'=>1,
'visible'=>1,
'default'=>0,
'position'=>105,
'css'=>
'maxwidth50imp',
'help'=>
'QuantityConsumedInvariable'),
1596 'disable_stock_change' => array(
'type'=>
'smallint',
'label'=>
'DisableStockChange',
'enabled'=>1,
'visible'=>1,
'default'=>0,
'position'=>108,
'css'=>
'maxwidth50imp',
'help'=>
'DisableStockChangeHelp'),
1597 'batch' =>array(
'type'=>
'varchar(30)',
'label'=>
'Batch',
'enabled'=>1,
'visible'=>-1,
'position'=>140),
1598 'role' =>array(
'type'=>
'varchar(10)',
'label'=>
'Role',
'enabled'=>1,
'visible'=>-1,
'position'=>145),
1599 'fk_mrp_production' =>array(
'type'=>
'integer',
'label'=>
'Fk mrp production',
'enabled'=>1,
'visible'=>-1,
'position'=>150),
1600 'fk_stock_movement' =>array(
'type'=>
'integer',
'label'=>
'StockMovement',
'enabled'=>1,
'visible'=>-1,
'position'=>155),
1601 'date_creation' =>array(
'type'=>
'datetime',
'label'=>
'DateCreation',
'enabled'=>1,
'visible'=>-2,
'notnull'=>1,
'position'=>160),
1602 'tms' =>array(
'type'=>
'timestamp',
'label'=>
'Tms',
'enabled'=>1,
'visible'=>-1,
'notnull'=>1,
'position'=>165),
1603 'fk_user_creat' =>array(
'type'=>
'integer',
'label'=>
'UserCreation',
'enabled'=>1,
'visible'=>-1,
'notnull'=>1,
'position'=>170),
1604 'fk_user_modif' =>array(
'type'=>
'integer',
'label'=>
'UserModification',
'enabled'=>1,
'visible'=>-1,
'position'=>175),
1605 'import_key' =>array(
'type'=>
'varchar(14)',
'label'=>
'ImportId',
'enabled'=>1,
'visible'=>-1,
'position'=>180),
1611 public $origin_type;
1614 public $fk_warehouse;
1617 public $disable_stock_change;
1620 public $fk_mrp_production;
1621 public $fk_stock_movement;
1622 public $date_creation;
1624 public $fk_user_creat;
1625 public $fk_user_modif;
1635 global $conf, $langs;
1639 if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields[
'rowid'])) {
1640 $this->fields[
'rowid'][
'visible'] = 0;
1642 if (!
isModEnabled(
'multicompany') && isset($this->fields[
'entity'])) {
1643 $this->fields[
'entity'][
'enabled'] = 0;
1647 foreach ($this->fields as $key => $val) {
1648 if (isset($val[
'enabled']) && empty($val[
'enabled'])) {
1649 unset($this->fields[$key]);
1654 if (is_object($langs)) {
1655 foreach ($this->fields as $key => $val) {
1656 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
1657 foreach ($val[
'arrayofkeyval'] as $key2 => $val2) {
1658 $this->fields[$key][
'arrayofkeyval'][$key2] = $langs->trans($val2);
1674 if (empty($this->qty)) {
1675 $this->error =
'BadValueForQty';
1706 public function fetchAll($sortorder =
'', $sortfield =
'', $limit = 0, $offset = 0, array $filter = array(), $filtermode =
'AND')
1716 $sql .=
' FROM '.MAIN_DB_PREFIX.$this->table_element.
' as t';
1717 if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
1718 $sql .=
' WHERE t.entity IN ('.getEntity($this->table_element).
')';
1720 $sql .=
' WHERE 1 = 1';
1723 $sqlwhere = array();
1724 if (count($filter) > 0) {
1725 foreach ($filter as $key => $value) {
1726 if ($key ==
't.rowid') {
1727 $sqlwhere[] = $key.
" = ".((int) $value);
1728 } elseif (strpos($key,
'date') !==
false) {
1729 $sqlwhere[] = $key.
" = '".$this->
db->idate($value).
"'";
1730 } elseif ($key ==
'customsql') {
1731 $sqlwhere[] = $value;
1733 $sqlwhere[] = $key.
" LIKE '%".$this->
db->escape($value).
"%'";
1737 if (count($sqlwhere) > 0) {
1738 $sql .=
' AND ('.implode(
' '.$this->
db->escape($filtermode).
' ', $sqlwhere).
')';
1741 if (!empty($sortfield)) {
1742 $sql .= $this->
db->order($sortfield, $sortorder);
1744 if (!empty($limit)) {
1745 $sql .= $this->
db->plimit($limit, $offset);
1750 $num = $this->
db->num_rows(
$resql);
1752 while ($i < ($limit ? min($limit, $num) : $num)) {
1753 $obj = $this->
db->fetch_object(
$resql);
1755 $record =
new self($this->db);
1756 $record->setVarsFromFetchObj($obj);
1758 $records[$record->id] = $record;
1766 $this->errors[] =
'Error '.$this->db->lasterror();
1767 dol_syslog(__METHOD__.
' '.join(
',', $this->errors), LOG_ERR);
1792 public function delete(
User $user, $notrigger =
false)
Parent class of all other business classes (invoices, contracts, proposals, orders,...
commonGenerateDocument($modelspath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams=null)
Common function for all objects extending CommonObject for generating documents.
deleteLineCommon(User $user, $idline, $notrigger=false)
Delete a line of object in database.
getFieldList($alias='')
Function to concat keys of fields.
fetchCommon($id, $ref=null, $morewhere='')
Load object in memory from the database.
createCommon(User $user, $notrigger=false)
Create object into database.
deleteCommon(User $user, $notrigger=false, $forcechilddeletion=0)
Delete object in database.
setStatusCommon($user, $status, $notrigger=0, $triggercode='')
Set to a status.
initAsSpecimenCommon()
Initialise object with example values Id must be 0 if object instance is a specimen.
copy_linked_contact($objFrom, $source='internal')
Copy contact from one element to current.
static commonReplaceThirdparty(DoliDB $dbs, $origin_id, $dest_id, array $tables, $ignoreerrors=0)
Function used to replace a thirdparty id with another one.
fetch_product()
Load the product with id $this->fk_product into this->product.
updateCommon(User $user, $notrigger=false)
Update object into database.
fetchLinesCommon($morewhere='')
Load object in memory from the database.
call_trigger($triggerName, $user)
Call trigger based on this instance.
Parent class for class inheritance lines of business objects This class is useless for the moment so ...
Class to manage Dolibarr database access.
__construct(DoliDB $db)
Constructor.
update(User $user, $notrigger=false)
Update object into database.
fetchLinesLinked($role, $lineid=0)
Get list of lines linked to current line for a defined role.
getMoChilds()
Function used to return childs of Mo.
static replaceThirdparty($db, $origin_id, $dest_id)
Function used to replace a thirdparty id with another one.
printOriginLinesList($restrictlist='', $selectedLines=array())
Return HTML table table of source object lines TODO Move this and previous function into output html ...
fetchLines()
Load object lines in memory from the database.
getNextNumRef($prod)
Returns the reference to the following non used MO depending on the active numbering module defined i...
deleteLine(User $user, $idline, $notrigger=false)
Delete a line of object in database.
cancel($user, $notrigger=0)
Set cancel status.
fetch($id, $ref=null)
Load object in memory from the database.
initAsSpecimen()
Initialise object with example values Id must be 0 if object instance is a specimen.
reopen($user, $notrigger=0)
Set back to validated status.
updateProduction(User $user, $notrigger=true)
Erase and update the line to consume and to produce.
getMoParent()
Function used to return childs of Mo.
getLinesArray($rolefilter='')
Create an array of lines.
LibStatut($status, $mode=0)
Return the status.
setDraft($user, $notrigger=0)
Set draft status.
printOriginLine($line, $var, $restrictlist='', $defaulttpldir='/core/tpl', $selectedLines=array())
Return HTML with a line of table array of source object lines TODO Move this and previous function in...
fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, array $filter=array(), $filtermode='AND')
Load list of objects in memory from the database.
validate($user, $notrigger=0)
Validate Mo.
doScheduledJob()
Action executed by scheduler CAN BE A CRON TASK.
generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null)
Create a document onto disk according to template module.
getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
Return a link to the object card (with optionaly the picto)
getLibStatut($mode=0)
Return label of the status.
info($id)
Load the info information in the object.
create(User $user, $notrigger=false)
Create object into database.
countMovements()
Count number of movement with origin of MO.
createFromClone(User $user, $fromid)
Clone an object into another one.
create(User $user, $notrigger=false)
Create object into database.
update(User $user, $notrigger=false)
Update object into database.
fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, array $filter=array(), $filtermode='AND')
Load list of objects in memory from the database.
__construct(DoliDB $db)
Constructor.
fetch($id, $ref=null)
Load object in memory from the database.
Class to manage stock movements.
Class to manage products or services.
Class to manage Dolibarr users.
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.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
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)
dolGetStatus($statusLabel='', $statusLabelShort='', $html='', $statusType='status0', $displayMode=0, $url='', $params=array())
Output the badge of a status.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
$conf db
API class for accounts.