28require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobject.class.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/class/commonincoterm.class.php';
43 public $element =
'stocktransfer';
48 public $table_element =
'stocktransfer_stocktransfer';
53 public $table_element_line =
'stocktransfer_stocktransferline';
58 public $fk_element =
'fk_stocktransfer';
65 protected $childtablesoncascade = array(
'stocktransfer_stocktransferline');
82 public $picto =
'stock';
87 public $date_prevue_depart;
92 public $date_prevue_arrivee;
97 public $date_reelle_depart;
102 public $date_reelle_arrivee;
110 const STATUS_DRAFT = 0;
111 const STATUS_VALIDATED = 1;
112 const STATUS_TRANSFERED = 2;
113 const STATUS_CLOSED = 3;
145 public $fields = array(
146 'rowid' => array(
'type' =>
'integer',
'label' =>
'TechnicalID',
'enabled' => 1,
'position' => 1,
'notnull' => 1,
'visible' => 0,
'noteditable' => 1,
'index' => 1,
'comment' =>
"Id"),
147 'entity' => array(
'type' =>
'integer',
'label' =>
'Entity',
'enabled' => 1,
'position' => 1,
'default' =>
'1',
'notnull' => 1,
'visible' => 0,
'noteditable' => 1,
'index' => 1,
'comment' =>
"Id"),
148 'ref' => array(
'type' =>
'varchar(128)',
'label' =>
'Ref',
'enabled' => 1,
'position' => 10,
'notnull' => 1,
'visible' => 4,
'noteditable' => 1,
'default' =>
'(PROV)',
'index' => 1,
'searchall' => 1,
'showoncombobox' => 1,
'comment' =>
"Reference of object"),
149 'label' => array(
'type' =>
'varchar(255)',
'label' =>
'Label',
'enabled' => 1,
'position' => 30,
'notnull' => 0,
'visible' => 1,
'searchall' => 1,
'showoncombobox' => 1,
'css' =>
'minwidth100',
'csslist' =>
'tdoverflowmax125',
'autofocusoncreate' => 1),
150 'description' => array(
'type' =>
'text',
'label' =>
'Description',
'enabled' => 1,
'position' => 31,
'notnull' => 0,
'visible' => 3,),
151 'fk_project' => array(
'type' =>
'integer:Project:projet/class/project.class.php:1',
'label' =>
'Project',
'enabled' =>
'isModEnabled("project")',
'position' => 32,
'notnull' => -1,
'visible' => -1,
'index' => 1,
'picto' =>
'project',
'css' =>
'maxwidth500 widthcentpercentminusxx',
'csslist' =>
'tdoverflowmax125'),
152 'fk_soc' => array(
'type' =>
'integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))',
'label' =>
'ThirdParty',
'enabled' => 1,
'position' => 50,
'notnull' => -1,
'visible' => 1,
'index' => 1,
'picto' =>
'company',
'css' =>
'maxwidth500 widthcentpercentminusxx',
'csslist' =>
'tdoverflowmax100'),
153 'fk_warehouse_source' => array(
'type' =>
'integer:Entrepot:product/stock/class/entrepot.class.php',
'label' =>
'WarehouseSource',
'enabled' => 1,
'position' => 50,
'notnull' => 0,
'visible' => 1,
'help' =>
'HelpWarehouseStockTransferSource',
'picto' =>
'stock',
'css' =>
'maxwidth500 widthcentpercentminusxx',
'csslist' =>
'tdoverflowmax125'),
154 'fk_warehouse_destination' => array(
'type' =>
'integer:Entrepot:product/stock/class/entrepot.class.php',
'label' =>
'WarehouseDestination',
'enabled' => 1,
'position' => 51,
'notnull' => 0,
'visible' => 1,
'help' =>
'HelpWarehouseStockTransferDestination',
'picto' =>
'stock',
'css' =>
'maxwidth500 widthcentpercentminusxx',
'csslist' =>
'tdoverflowmax125'),
155 'note_public' => array(
'type' =>
'html',
'label' =>
'NotePublic',
'enabled' => 1,
'position' => 61,
'notnull' => 0,
'visible' => 0,),
156 'note_private' => array(
'type' =>
'html',
'label' =>
'NotePrivate',
'enabled' => 1,
'position' => 62,
'notnull' => 0,
'visible' => 0,),
157 'date_creation' => array(
'type' =>
'datetime',
'label' =>
'DateCreation',
'enabled' => 1,
'position' => 500,
'notnull' => 1,
'visible' => -2,),
158 'date_prevue_depart' => array(
'type' =>
'date',
'label' =>
'DatePrevueDepart',
'enabled' => 1,
'position' => 100,
'notnull' => 0,
'visible' => 1,),
159 'date_reelle_depart' => array(
'type' =>
'date',
'label' =>
'DateReelleDepart',
'enabled' => 1,
'position' => 101,
'notnull' => 0,
'visible' => 5,),
160 'date_prevue_arrivee' => array(
'type' =>
'date',
'label' =>
'DatePrevueArrivee',
'enabled' => 1,
'position' => 102,
'notnull' => 0,
'visible' => 1,),
161 'date_reelle_arrivee' => array(
'type' =>
'date',
'label' =>
'DateReelleArrivee',
'enabled' => 1,
'position' => 103,
'notnull' => 0,
'visible' => 5,),
162 'lead_time_for_warning' => array(
'type' =>
'integer',
'label' =>
'LeadTimeForWarning',
'enabled' => 1,
'position' => 200,
'default' =>
'0',
'notnull' => 0,
'visible' => -1),
163 'tms' => array(
'type' =>
'timestamp',
'label' =>
'DateModification',
'enabled' => 1,
'position' => 501,
'notnull' => 0,
'visible' => -2,),
164 'fk_user_creat' => array(
'type' =>
'integer:User:user/class/user.class.php',
'label' =>
'UserAuthor',
'enabled' => 1,
'position' => 510,
'notnull' => 1,
'visible' => -2,
'foreignkey' =>
'user.rowid',),
165 'fk_user_modif' => array(
'type' =>
'integer:User:user/class/user.class.php',
'label' =>
'ChangedBy',
'enabled' => 1,
'position' => 511,
'notnull' => -1,
'visible' => -2,),
166 'import_key' => array(
'type' =>
'varchar(14)',
'label' =>
'ImportId',
'enabled' => 1,
'position' => 1000,
'notnull' => -1,
'visible' => -2,),
167 'model_pdf' => array(
'type' =>
'varchar(255)',
'label' =>
'Model pdf',
'enabled' => 1,
'position' => 1010,
'notnull' => -1,
'visible' => 0,),
168 'fk_incoterms' => array(
'type' =>
'integer',
'label' =>
'IncotermCode',
'enabled' =>
'isModEnabled("incoterm")',
'visible' => -2,
'position' => 220),
169 'location_incoterms' => array(
'type' =>
'varchar(255)',
'label' =>
'IncotermLabel',
'enabled' =>
'isModEnabled("incoterm")',
'visible' => -2,
'position' => 225),
170 'status' => array(
'type' =>
'smallint',
'label' =>
'Status',
'enabled' => 1,
'position' => 1000,
'notnull' => 1,
'visible' => 5,
'index' => 1,
'arrayofkeyval' => array(
'0' =>
'Draft',
'1' =>
'Validated',
'2' =>
'StockStransferDecremented',
'3' =>
'StockStransferIncremented'),),
203 public $lead_time_for_warning;
218 public $fk_warehouse_source;
223 public $fk_warehouse_destination;
238 $this->ismultientitymanaged = 0;
239 $this->isextrafieldmanaged = 1;
241 $this->origin_type =
'StockTransfer@product/stock/stocktransfer';
244 $this->fields[
'rowid'][
'visible'] = 0;
246 if (!
isModEnabled(
'multicompany') && isset($this->fields[
'entity'])) {
247 $this->fields[
'entity'][
'enabled'] = 0;
257 foreach ($this->fields as $key => $val) {
258 if (isset($val[
'enabled']) && empty($val[
'enabled'])) {
259 unset($this->fields[$key]);
264 if (is_object($langs)) {
265 foreach ($this->fields as $key => $val) {
266 if (isset($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
267 foreach ($val[
'arrayofkeyval'] as $key2 => $val2) {
268 $this->fields[$key][
'arrayofkeyval'][$key2] = $langs->trans($val2);
285 if ($this->fk_warehouse_source <= 0) {
286 $this->fk_warehouse_source = 0;
288 if ($this->fk_warehouse_destination <= 0) {
289 $this->fk_warehouse_destination = 0;
303 global $langs, $extrafields;
313 $result =
$object->fetchCommon($fromid);
314 if ($result > 0 && !empty(
$object->table_element_line)) {
326 unset(
$object->date_prevue_depart);
327 unset(
$object->date_prevue_arrivee);
328 unset(
$object->date_reelle_depart);
329 unset(
$object->date_reelle_arrivee);
334 $object->ref = empty($this->fields[
'ref'][
'default']) ?
"copy_of_".$object->ref : $this->fields[
'ref'][
'default'];
336 $object->label = empty($this->fields[
'label'][
'default']) ? $langs->trans(
"CopyOf").
" ".
$object->label : $this->fields[
'label'][
'default'];
337 $object->status = self::STATUS_DRAFT;
340 if (is_array(
$object->array_options) && count(
$object->array_options) > 0) {
341 $extrafields->fetch_name_optionals_label($this->table_element);
342 foreach (
$object->array_options as $key => $option) {
343 $shortkey = preg_replace(
'/options_/',
'', $key);
344 if (!empty($extrafields->attributes[$this->table_element][
'unique'][$shortkey])) {
345 unset(
$object->array_options[$key]);
351 $object->context[
'createfromclone'] =
'createfromclone';
352 $result =
$object->createCommon($user);
367 if (property_exists($this,
'socid') && $this->socid ==
$object->socid) {
374 unset(
$object->context[
'createfromclone']);
381 $this->db->rollback();
393 public function fetch($id, $ref =
null)
397 $this->socid = $this->fk_soc;
399 if ($result > 0 && !empty($this->table_element_line)) {
412 require_once DOL_DOCUMENT_ROOT .
'/product/stock/stocktransfer/class/stocktransferline.class.php';
413 $this->lines = array();
416 usort($this->lines, array(
'StockTransfer',
'stocktransferCmpRank'));
429 if ($a->rang == $b->rang) {
432 return ($a->rang < $b->rang) ? -1 : 1;
444 if (empty($this->lines)) {
447 if (!empty($this->lines)) {
448 foreach ($this->lines as $l) {
449 $total_pmp += ($l->pmp * $l->qty);
468 public function fetchAll($sortorder =
'', $sortfield =
'', $limit = 0, $offset = 0, $filter =
'', $filtermode =
'AND')
476 $sql .=
' FROM '.MAIN_DB_PREFIX.$this->table_element.
' as t';
477 if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
478 $sql .=
' WHERE t.entity IN ('.getEntity($this->element).
')';
480 $sql .=
' WHERE 1 = 1';
487 $this->errors[] = $errormessage;
488 dol_syslog(__METHOD__.
' '.implode(
',', $this->errors), LOG_ERR);
492 if (!empty($sortfield)) {
493 $sql .= $this->db->order($sortfield, $sortorder);
495 if (!empty($limit)) {
496 $sql .=
' '.$this->db->plimit($limit, $offset);
499 $resql = $this->db->query($sql);
501 $num = $this->db->num_rows($resql);
503 while ($i < ($limit ? min($limit, $num) : $num)) {
504 $obj = $this->db->fetch_object($resql);
506 $record =
new self($this->db);
507 $record->setVarsFromFetchObj($obj);
509 $records[$record->id] = $record;
513 $this->db->free($resql);
517 $this->errors[] =
'Error '.$this->db->lasterror();
518 dol_syslog(__METHOD__.
' '.implode(
',', $this->errors), LOG_ERR);
535 if (($this->socid > 0 || $this->fk_soc > 0) && empty($this->thirdparty)) {
538 if (empty($this->socid) && empty($this->fk_soc)) {
539 unset($this->thirdparty);
551 public function delete(
User $user, $notrigger = 0)
553 if ($this->
status > self::STATUS_VALIDATED) {
571 $this->error =
'ErrorDeleteLineNotAllowedByObjectStatus';
592 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
597 if ($this->
status == self::STATUS_VALIDATED) {
598 dol_syslog(get_class($this).
"::validate action abandoned: already validated", LOG_WARNING);
607 if (preg_match(
'/^[\(]?PROV/i', $this->
ref) || empty($this->
ref)) {
612 $this->newref = $num;
616 $sql =
"UPDATE ".MAIN_DB_PREFIX.$this->table_element;
617 $sql .=
" SET ref = '".$this->db->escape($num).
"',";
618 $sql .=
" status = ".self::STATUS_VALIDATED;
619 if (!empty($this->fields[
'date_validation'])) {
620 $sql .=
", date_validation = '".$this->db->idate($now).
"',";
622 if (!empty($this->fields[
'fk_user_valid'])) {
623 $sql .=
", fk_user_valid = ".((int) $user->id);
625 $sql .=
" WHERE rowid = ".((int) $this->
id);
627 dol_syslog(get_class($this).
"::validate()", LOG_DEBUG);
628 $resql = $this->db->query($sql);
631 $this->error = $this->db->lasterror();
635 if (!$error && !$notrigger) {
637 $result = $this->call_trigger(
'STOCKTRANSFER_VALIDATE', $user);
646 $this->oldref = $this->ref;
649 if (preg_match(
'/^[\(]?PROV/i', $this->
ref)) {
651 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"ecm_files set filename = CONCAT('".$this->db->escape($this->newref).
"', SUBSTR(filename, ".(strlen($this->
ref) + 1).
")), filepath = 'stocktransfer/".$this->db->escape($this->newref).
"'";
652 $sql .=
" WHERE filename LIKE '".$this->db->escape($this->
ref).
"%' AND filepath = 'stocktransfer/".$this->db->escape($this->
ref).
"' and entity = ".((int)
$conf->entity);
653 $resql = $this->db->query($sql);
656 $this->error = $this->db->lasterror();
658 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"ecm_files set filepath = 'stocktransfer/".$this->db->escape($this->newref).
"'";
659 $sql .=
" WHERE filepath = 'stocktransfer/".$this->db->escape($this->
ref).
"' and entity = ".((int)
$conf->entity);
660 $resql = $this->db->query($sql);
663 $this->error = $this->db->lasterror();
669 $dirsource =
$conf->stocktransfer->dir_output.
'/stocktransfer/'.$oldref;
670 $dirdest =
$conf->stocktransfer->dir_output.
'/stocktransfer/'.$newref;
671 if (!$error && file_exists($dirsource)) {
672 dol_syslog(get_class($this).
"::validate() rename dir ".$dirsource.
" into ".$dirdest);
674 if (@rename($dirsource, $dirdest)) {
677 $listoffiles =
dol_dir_list(
$conf->stocktransfer->dir_output.
'/stocktransfer/'.$newref,
'files', 1,
'^'.preg_quote($oldref,
'/'));
678 foreach ($listoffiles as $fileentry) {
679 $dirsource = $fileentry[
'name'];
680 $dirdest = preg_replace(
'/^'.preg_quote($oldref,
'/').
'/', $newref, $dirsource);
681 $dirsource = $fileentry[
'path'].
'/'.$dirsource;
682 $dirdest = $fileentry[
'path'].
'/'.$dirdest;
683 @rename($dirsource, $dirdest);
693 $this->
status = self::STATUS_VALIDATED;
700 $this->db->rollback();
716 if ($this->
status <= self::STATUS_DRAFT) {
720 return $this->
setStatusCommon($user, self::STATUS_DRAFT, $notrigger,
'STOCKTRANSFER_UNVALIDATE');
730 public function cancel($user, $notrigger = 0)
733 if ($this->
status != self::STATUS_VALIDATED) {
737 return $this->
setStatusCommon($user, self::STATUS_CLOSED, $notrigger,
'STOCKTRANSFER_CLOSE');
747 public function reopen($user, $notrigger = 0)
750 if ($this->
status != self::STATUS_CLOSED) {
754 return $this->
setStatusCommon($user, self::STATUS_VALIDATED, $notrigger,
'STOCKTRANSFER_REOPEN');
767 public function getNomUrl($withpicto = 0, $option =
'', $notooltip = 0, $morecss =
'', $save_lastsearch_value = -1)
769 global
$conf, $langs, $hookmanager;
771 if (!empty(
$conf->dol_no_mouse_hover)) {
777 $label =
'<u>'.$langs->trans(
"StockTransfer").
'</u>';
779 $label .=
'<b>'.$langs->trans(
'Ref').
':</b> '.$this->ref;
780 if (isset($this->
status)) {
781 $label .=
'<br><b>'.$langs->trans(
"Status").
":</b> ".$this->
getLibStatut(5);
784 $url =
dol_buildpath(
'/product/stock/stocktransfer/stocktransfer_card.php', 1).
'?id='.$this->id;
786 if ($option !=
'nolink') {
788 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
789 if ($save_lastsearch_value == -1 && isset($_SERVER[
"PHP_SELF"]) && preg_match(
'/list\.php/', $_SERVER[
"PHP_SELF"])) {
790 $add_save_lastsearch_values = 1;
792 if ($add_save_lastsearch_values) {
793 $url .=
'&save_lastsearch_values=1';
798 if (empty($notooltip)) {
800 $label = $langs->trans(
"ShowStockTransfer");
801 $linkclose .=
' alt="'.dolPrintHTMLForAttribute($label).
'"';
803 $linkclose .=
' title="'.dolPrintHTMLForAttribute($label).
'"';
804 $linkclose .=
' class="classfortooltip'.($morecss ?
' '.$morecss :
'').
'"';
806 $linkclose = ($morecss ?
' class="'.$morecss.
'"' :
'');
809 $linkstart =
'<a href="'.$url.
'"';
810 $linkstart .= $linkclose.
'>';
813 $result .= $linkstart;
815 if (empty($this->showphoto_on_popup)) {
817 $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);
821 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
823 list($class, $module) = explode(
'@', $this->picto);
826 $filename = $filearray[0][
'name'];
827 if (!empty($filename)) {
828 $pospoint = strpos($filearray[0][
'name'],
'.');
830 $pathtophoto = $class.
'/'.$this->
ref.
'/thumbs/'.substr($filename, 0, $pospoint).
'_mini'.substr($filename, $pospoint);
832 $result .=
'<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo'.$module.
'" alt="No photo" border="0" src="'.DOL_URL_ROOT.
'/viewimage.php?modulepart='.$module.
'&entity='.
$conf->entity.
'&file='.urlencode($pathtophoto).
'"></div></div>';
834 $result .=
'<div class="floatleft inline-block valignmiddle divphotoref"><img class="photouserphoto userphoto" alt="No photo" border="0" src="'.DOL_URL_ROOT.
'/viewimage.php?modulepart='.$module.
'&entity='.
$conf->entity.
'&file='.urlencode($pathtophoto).
'"></div>';
839 $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);
844 if ($withpicto != 2) {
845 $result .= $this->ref;
851 global $action, $hookmanager;
852 $hookmanager->initHooks(array(
'stocktransferdao'));
853 $parameters = array(
'id' => $this->
id,
'getnomurl' => $result);
854 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
856 $result = $hookmanager->resPrint;
858 $result .= $hookmanager->resPrint;
886 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
889 $this->labelStatus[self::STATUS_DRAFT] = $langs->trans(
'Draft');
890 $this->labelStatus[self::STATUS_VALIDATED] = $langs->trans(
'Validated');
891 $this->labelStatus[self::STATUS_TRANSFERED] = $langs->trans(
'StockStransferDecremented');
892 $this->labelStatus[self::STATUS_CLOSED] = $langs->trans(
'StockStransferIncremented');
893 $this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans(
'Draft');
894 $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->trans(
'Validated');
895 $this->labelStatusShort[self::STATUS_TRANSFERED] = $langs->trans(
'StockStransferDecremented');
896 $this->labelStatusShort[self::STATUS_CLOSED] = $langs->trans(
'StockStransferIncremented');
899 $statusType =
'status'.$status;
901 if ($status == self::STATUS_CLOSED) {
902 $statusType =
'status6';
905 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status],
'', $statusType, $mode);
916 $sql =
'SELECT rowid, date_creation as datec, tms as datem,';
917 $sql .=
' fk_user_creat, fk_user_modif';
918 $sql .=
' FROM '.MAIN_DB_PREFIX.$this->table_element.
' as t';
919 $sql .=
' WHERE t.rowid = '.((int) $id);
920 $result = $this->db->query($sql);
922 if ($this->db->num_rows($result)) {
923 $obj = $this->db->fetch_object($result);
924 $this->
id = $obj->rowid;
926 $this->user_creation_id = $obj->fk_user_creat;
927 $this->user_modification_id = $obj->fk_user_modif;
928 $this->date_creation = $this->db->jdate($obj->datec);
929 $this->date_modification = empty($obj->datem) ?
'' : $this->db->jdate($obj->datem);
932 $this->db->free($result);
956 $this->lines = array();
959 $result = $objectline->fetchAll(
'ASC',
'rang', 0, 0,
"(fk_stocktransfer:=:".((
int) $this->
id).
")");
961 if (is_numeric($result)) {
962 $this->error = $objectline->error;
963 $this->errors = $objectline->errors;
966 $this->lines = $result;
978 global $langs,
$conf;
979 $langs->load(
"stocks");
982 $conf->global->STOCKTRANSFER_STOCKTRANSFER_ADDON =
'mod_stocktransfer_standard';
992 $dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
993 foreach ($dirmodels as $reldir) {
997 $mybool = ((bool) @include_once $dir.$file) || $mybool;
1005 if (class_exists($classname)) {
1006 $obj =
new $classname();
1007 '@phan-var-force ModeleNumRefStockTransfer $obj';
1008 $numref = $obj->getNextValue($this);
1010 if ($numref !=
'' && $numref !=
'-1') {
1013 $this->error = $obj->error;
1018 print $langs->trans(
"Error").
" ".$langs->trans(
"ClassNotFound").
' '.$classname;
1022 print $langs->trans(
"ErrorNumberingModuleNotSetup", $this->element);
1038 public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams =
null)
1042 $langs->load(
"stocks");
1047 if ($this->model_pdf) {
1048 $modele = $this->model_pdf;
1054 $modelpath =
"core/modules/stocktransfer/doc/";
1056 $result = $this->
commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
if(! $sortfield) if(! $sortorder) $object
line_order($renum=false, $rowidorder='ASC', $fk_parent_line=true)
Save a new position (field rang) for details lines.
deleteLineCommon(User $user, $idline, $notrigger=0)
Delete a line of object in database.
commonGenerateDocument($modelspath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams=null)
Common function for all objects extending CommonObject for generating documents.
fetch_thirdparty($force_thirdparty_id=0)
Load the third party of object, from id $this->socid or $this->fk_soc, into this->thirdparty.
setErrorsFromObject($object)
setErrorsFromObject
createCommon(User $user, $notrigger=0)
Create object in the database.
getFieldList($alias='', $excludefields=array())
Function to concat keys of fields.
updateCommon(User $user, $notrigger=0)
Update object into 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.
fetchLinesCommon($morewhere='', $noextrafields=0)
Load object in memory from the database.
fetchCommon($id, $ref=null, $morewhere='', $noextrafields=0)
Load object in memory from the database.
deleteCommon(User $user, $notrigger=0, $forcechilddeletion=0)
Delete object in database.
Class to manage Dolibarr database access.
getValorisationTotale()
Used to get total PMP amount of all quantities of products of Stock Transfer.
update(User $user, $notrigger=0)
Update object into database.
static stocktransferCmpRank($a, $b)
Used to sort lines by rank.
fetch($id, $ref=null)
Load object in memory from the database.
deleteLine(User $user, $idline, $notrigger=0)
Delete a line of object in database.
LibStatut($status, $mode=0)
Return the status.
fetchLines()
Load object lines in memory from the database.
validate($user, $notrigger=0)
Validate object.
generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null)
Create a document onto disk according to template module.
setDraft($user, $notrigger=0)
Set draft status.
initAsSpecimen()
Initialise object with example values Id must be 0 if object instance is a specimen.
create(User $user, $notrigger=0)
Create object into database.
reopen($user, $notrigger=0)
Set back to validated status.
getLibStatut($mode=0)
Return label of the status.
info($id)
Load the info information in the object.
fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, $filter='', $filtermode='AND')
Load list of objects in memory from the database.
getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
Return a link to the object card (with optionally the picto)
getNextNumRef()
Returns the reference to the following non used object depending on the active numbering module.
__construct(DoliDB $db)
Constructor.
createFromClone(User $user, $fromid)
Clone an object into another one.
getLinesArray()
Create an array of lines.
cancel($user, $notrigger=0)
Set cancel status.
Class for StockTransferLine.
Class to manage Dolibarr users.
print $langs trans("Ref").' m titre as m m statut as status
Or an array listing all the potential status of the object: array: int of the status => translated la...
dol_dir_list($utf8_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.
dol_now($mode='gmt')
Return date for now.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
forgeSQLFromUniversalSearchCriteria($filter, &$errorstr='', $noand=0, $nopar=0, $noerror=0, $forbiddenfields=array())
forgeSQLFromUniversalSearchCriteria
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
dolGetStatus($statusLabel='', $statusLabelShort='', $html='', $statusType='status0', $displayMode=0, $url='', $params=array())
Output the badge of a status.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string