30 require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobject.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/class/commonincoterm.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/mouvementstock.class.php';
34 if (!empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
35 if (!empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
48 public $element =
"delivery";
53 public $fk_element =
"fk_delivery";
58 public $table_element =
"delivery";
63 public $table_element_line =
"deliverydet";
68 public $picto =
'sending';
88 public $date_delivery;
93 public $date_creation;
105 public $lines = array();
118 $this->statuts[-1] =
'StatusDeliveryCanceled';
119 $this->statuts[0] =
'StatusDeliveryDraft';
120 $this->statuts[1] =
'StatusDeliveryValidated';
135 if (empty($this->model_pdf)) $this->model_pdf = $conf->global->DELIVERY_ADDON_PDF;
148 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"delivery (";
152 $sql .=
", ref_customer";
153 $sql .=
", date_creation";
154 $sql .=
", fk_user_author";
155 $sql .=
", date_delivery";
156 $sql .=
", fk_address";
157 $sql .=
", note_private";
158 $sql .=
", note_public";
159 $sql .=
", model_pdf";
160 $sql .=
", fk_incoterms, location_incoterms";
161 $sql .=
") VALUES (";
163 $sql .=
", ".$conf->entity;
164 $sql .=
", ".$this->socid;
165 $sql .=
", '".$this->db->escape($this->ref_customer).
"'";
166 $sql .=
", '".$this->db->idate($now).
"'";
167 $sql .=
", ".$user->id;
168 $sql .=
", ".($this->date_delivery ?
"'".$this->db->idate($this->date_delivery).
"'" :
"null");
169 $sql .=
", ".($this->fk_delivery_address > 0 ? $this->fk_delivery_address :
"null");
170 $sql .=
", ".(!empty($this->note_private) ?
"'".$this->db->escape($this->note_private).
"'" :
"null");
171 $sql .=
", ".(!empty($this->note_public) ?
"'".$this->db->escape($this->note_public).
"'" :
"null");
172 $sql .=
", ".(!empty($this->model_pdf) ?
"'".$this->db->escape($this->model_pdf).
"'" :
"null");
173 $sql .=
", ".(int) $this->fk_incoterms;
174 $sql .=
", '".$this->db->escape($this->location_incoterms).
"'";
181 $this->
id = $this->
db->last_insert_id(MAIN_DB_PREFIX.
"delivery");
183 $numref =
"(PROV".$this->id.
")";
185 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"delivery ";
186 $sql .=
"SET ref = '".$this->db->escape($numref).
"'";
187 $sql .=
" WHERE rowid = ".$this->id;
193 if (!$conf->expedition_bon->enabled)
196 $commande->id = $this->commande_id;
197 $commande->fetch_lines();
204 $num = count($this->lines);
205 for ($i = 0; $i < $num; $i++)
207 $origin_id = $this->lines[$i]->origin_line_id;
208 if (!$origin_id) $origin_id = $this->lines[$i]->commande_ligne_id;
210 if (!$this->
create_line($origin_id, $this->lines[$i]->qty, $this->lines[$i]->fk_product, $this->lines[$i]->
description))
216 if (!$error && $this->
id && $this->origin_id)
224 if (!$conf->expedition_bon->enabled)
227 $ret = $this->
setStatut(2, $this->origin_id, $this->origin);
241 $this->error = $this->
db->lasterror().
" - sql=".$this->
db->lastqueryerror;
242 $this->
db->rollback();
247 $this->error = $this->
db->lasterror().
" - sql=".$this->
db->lastqueryerror;
248 $this->
db->rollback();
253 $this->error = $this->
db->lasterror().
" - sql=".$this->
db->lastqueryerror;
254 $this->
db->rollback();
269 public function create_line($origin_id, $qty, $fk_product, $description)
273 $idprod = $fk_product;
276 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"deliverydet (fk_delivery, fk_origin_line,";
277 $sql .=
" fk_product, description, qty)";
278 $sql .=
" VALUES (".$this->id.
",".$origin_id.
",";
279 $sql .=
" ".($idprod > 0 ? $idprod :
"null").
",";
280 $sql .=
" ".($description ?
"'".$this->db->escape($description).
"'" :
"null").
",";
283 dol_syslog(get_class($this).
"::create_line", LOG_DEBUG);
284 if (!$this->
db->query($sql))
305 $sql =
"SELECT l.rowid, l.fk_soc, l.date_creation, l.date_valid, l.ref, l.ref_customer, l.fk_user_author,";
306 $sql .=
" l.total_ht, l.fk_statut, l.fk_user_valid, l.note_private, l.note_public";
307 $sql .=
", l.date_delivery, l.fk_address, l.model_pdf";
308 $sql .=
", el.fk_source as origin_id, el.sourcetype as origin";
309 $sql .=
', l.fk_incoterms, l.location_incoterms';
310 $sql .=
", i.libelle as label_incoterms";
311 $sql .=
" FROM ".MAIN_DB_PREFIX.
"delivery as l";
312 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"element_element as el ON el.fk_target = l.rowid AND el.targettype = '".$this->
db->escape($this->element).
"'";
313 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_incoterms as i ON l.fk_incoterms = i.rowid';
314 $sql .=
" WHERE l.rowid = ".$id;
316 dol_syslog(get_class($this).
"::fetch", LOG_DEBUG);
317 $result = $this->
db->query($sql);
320 if ($this->
db->num_rows($result))
322 $obj = $this->
db->fetch_object($result);
324 $this->
id = $obj->rowid;
325 $this->date_delivery = $this->
db->jdate($obj->date_delivery);
326 $this->date_creation = $this->
db->jdate($obj->date_creation);
327 $this->date_valid = $this->
db->jdate($obj->date_valid);
328 $this->ref = $obj->ref;
329 $this->ref_customer = $obj->ref_customer;
330 $this->socid = $obj->fk_soc;
331 $this->
statut = $obj->fk_statut;
332 $this->user_author_id = $obj->fk_user_author;
333 $this->user_valid_id = $obj->fk_user_valid;
334 $this->fk_delivery_address = $obj->fk_address;
335 $this->
note = $obj->note_private;
336 $this->note_private = $obj->note_private;
337 $this->note_public = $obj->note_public;
338 $this->model_pdf = $obj->model_pdf;
339 $this->modelpdf = $obj->model_pdf;
340 $this->origin = $obj->origin;
341 $this->origin_id = $obj->origin_id;
344 $this->fk_incoterms = $obj->fk_incoterms;
345 $this->location_incoterms = $obj->location_incoterms;
346 $this->label_incoterms = $obj->label_incoterms;
347 $this->
db->free($result);
349 if ($this->
statut == 0) $this->draft = 1;
364 $this->error =
'Delivery with id '.$id.
' not found sql='.$sql;
365 dol_syslog(get_class($this).
'::fetch Error '.$this->error, LOG_ERR);
369 $this->error = $this->
db->error();
381 public function valid($user, $notrigger = 0)
383 global $conf, $langs;
384 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
392 if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery->creer))
393 || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery_advance->validate)))
395 if (!empty($conf->global->DELIVERY_ADDON_NUMBER))
398 $modName = $conf->global->DELIVERY_ADDON_NUMBER;
400 if (is_readable(DOL_DOCUMENT_ROOT.
'/core/modules/delivery/'.$modName.
'.php'))
402 require_once DOL_DOCUMENT_ROOT.
'/core/modules/delivery/'.$modName.
'.php';
407 $objMod =
new $modName($this->
db);
409 $soc->fetch($this->socid);
411 if (preg_match(
'/^[\(]?PROV/i', $this->ref) || empty($this->ref))
413 $numref = $objMod->delivery_get_num($soc, $this);
415 $numref = $this->ref;
421 $sql .=
" FROM ".MAIN_DB_PREFIX.
"delivery";
422 $sql .=
" WHERE ref = '".$this->db->escape($numref).
"'";
423 $sql .=
" AND fk_statut <> 0";
424 $sql .=
" AND entity = ".$conf->entity;
436 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"delivery SET";
437 $sql .=
" ref='".$this->db->escape($numref).
"'";
438 $sql .=
", fk_statut = 1";
439 $sql .=
", date_valid = '".$this->db->idate($now).
"'";
440 $sql .=
", fk_user_valid = ".$user->id;
441 $sql .=
" WHERE rowid = ".$this->id;
442 $sql .=
" AND fk_statut = 0";
448 $this->error = $this->
db->lasterror();
452 if (!$error && !$notrigger)
455 $result = $this->
call_trigger(
'DELIVERY_VALIDATE', $user);
456 if ($result < 0) $error++;
462 $this->oldref = $this->ref;
465 if (preg_match(
'/^[\(]?PROV/i', $this->ref))
468 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"ecm_files set filename = CONCAT('".$this->
db->escape($this->newref).
"', SUBSTR(filename, ".(strlen($this->ref) + 1).
")), filepath = 'expedition/receipt/".$this->
db->escape($this->newref).
"'";
469 $sql .=
" WHERE filename LIKE '".$this->db->escape($this->ref).
"%' AND filepath = 'expedition/receipt/".$this->
db->escape($this->ref).
"' and entity = ".$conf->entity;
471 if (!
$resql) { $error++; $this->error = $this->
db->lasterror(); }
476 $dirsource = $conf->expedition->dir_output.
'/receipt/'.$oldref;
477 $dirdest = $conf->expedition->dir_output.
'/receipt/'.$newref;
478 if (!$error && file_exists($dirsource))
480 dol_syslog(get_class($this).
"::valid rename dir ".$dirsource.
" into ".$dirdest);
482 if (@rename($dirsource, $dirdest))
486 $listoffiles =
dol_dir_list($conf->expedition->dir_output.
'/receipt/'.$newref,
'files', 1,
'^'.preg_quote($oldref,
'/'));
487 foreach ($listoffiles as $fileentry)
489 $dirsource = $fileentry[
'name'];
490 $dirdest = preg_replace(
'/^'.preg_quote($oldref,
'/').
'/', $newref, $dirsource);
491 $dirsource = $fileentry[
'path'].
'/'.$dirsource;
492 $dirdest = $fileentry[
'path'].
'/'.$dirdest;
493 @rename($dirsource, $dirdest);
502 $this->ref = $numref;
514 $this->
db->rollback();
520 $this->error =
"Non autorise";
521 dol_syslog(get_class($this).
"::valid ".$this->error, LOG_ERR);
538 $result = $expedition->fetch($sending_id);
540 $this->lines = array();
542 $num = count($expedition->lines);
543 for ($i = 0; $i < $num; $i++)
546 $line->origin_line_id = $expedition->lines[$i]->origin_line_id;
547 $line->label = $expedition->lines[$i]->label;
548 $line->description = $expedition->lines[$i]->description;
549 $line->qty = $expedition->lines[$i]->qty_shipped;
550 $line->fk_product = $expedition->lines[$i]->fk_product;
552 $this->lines[$i] = $line;
555 $this->origin = $expedition->element;
556 $this->origin_id = $expedition->id;
557 $this->note_private = $expedition->note_private;
558 $this->note_public = $expedition->note_public;
559 $this->fk_project = $expedition->fk_project;
560 $this->date_delivery = $expedition->date_delivery;
561 $this->fk_delivery_address = $expedition->fk_delivery_address;
562 $this->socid = $expedition->socid;
563 $this->ref_customer = $expedition->ref_customer;
566 $this->fk_incoterms = $expedition->fk_incoterms;
567 $this->location_incoterms = $expedition->location_incoterms;
569 return $this->
create($user);
586 if ($id > 0 && !$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0)
589 $line->array_options = $array_options;
591 $result = $line->insertExtraFields();
595 $this->error[] = $line->error;
600 if (!$error)
return 1;
614 $num = count($this->lines);
617 $line->origin_id = $origin_id;
620 $this->lines[$num] = $line;
633 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"commandedet";
634 $sql .=
" WHERE rowid = ".$lineid;
636 if ($this->
db->query($sql))
652 public function delete()
654 global $conf, $langs, $user;
656 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
661 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"deliverydet";
662 $sql .=
" WHERE fk_delivery = ".$this->id;
663 if ($this->
db->query($sql))
667 if ($res < 0) $error++;
671 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"delivery";
672 $sql .=
" WHERE rowid = ".$this->id;
673 if ($this->
db->query($sql))
679 if (!empty($conf->expedition->dir_output))
681 $dir = $conf->expedition->dir_output.
'/receipt/'.$ref;
682 $file = $dir.
'/'.$ref.
'.pdf';
683 if (file_exists($file))
690 if (file_exists($dir))
694 $this->error = $langs->trans(
"ErrorCanNotDeleteDir", $dir);
701 $result = $this->
call_trigger(
'DELIVERY_DELETE', $user);
704 $this->
db->rollback();
711 $this->error = $this->
db->lasterror().
" - sql=$sql";
712 $this->
db->rollback();
716 $this->error = $this->
db->lasterror().
" - sql=$sql";
717 $this->
db->rollback();
721 $this->error = $this->
db->lasterror().
" - sql=$sql";
722 $this->
db->rollback();
734 public function getNomUrl($withpicto = 0, $save_lastsearch_value = -1)
740 $label =
img_picto(
'', $this->picto).
' <u>'.$langs->trans(
"ShowReceiving").
'</u>:<br>';
741 $label .=
'<b>'.$langs->trans(
"Status").
'</b>: '.$this->ref;
743 $url = DOL_URL_ROOT.
'/delivery/card.php?id='.$this->id;
748 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
749 if ($save_lastsearch_value == -1 && preg_match(
'/list\.php/',
$_SERVER[
"PHP_SELF"])) $add_save_lastsearch_values = 1;
750 if ($add_save_lastsearch_values) $url .=
'&save_lastsearch_values=1';
754 $linkstart =
'<a href="'.$url.
'" title="'.
dol_escape_htmltag($label, 1).
'" class="classfortooltip">';
757 if ($withpicto) $result .= ($linkstart.img_object($label, $this->picto,
'class="classfortooltip"').$linkend);
758 if ($withpicto && $withpicto != 2) $result .=
' ';
759 $result .= $linkstart.$this->ref.$linkend;
772 $this->lines = array();
774 $sql =
"SELECT ld.rowid, ld.fk_product, ld.description, ld.subprice, ld.total_ht, ld.qty as qty_shipped, ld.fk_origin_line, ";
775 $sql .=
" cd.qty as qty_asked, cd.label as custom_label, cd.fk_unit,";
776 $sql .=
" p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc,";
777 $sql .=
" p.weight, p.weight_units, p.width, p.width_units, p.length, p.length_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tobatch as product_tobatch";
778 $sql .=
" FROM ".MAIN_DB_PREFIX.
"commandedet as cd, ".MAIN_DB_PREFIX.
"deliverydet as ld";
779 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p on p.rowid = ld.fk_product";
780 $sql .=
" WHERE ld.fk_origin_line = cd.rowid";
781 $sql .=
" AND ld.fk_delivery = ".$this->id;
783 dol_syslog(get_class($this).
"::fetch_lines", LOG_DEBUG);
793 $obj = $this->
db->fetch_object(
$resql);
795 $line->id = $obj->rowid;
796 $line->label = $obj->custom_label;
797 $line->description = $obj->description;
798 $line->fk_product = $obj->fk_product;
799 $line->qty_asked = $obj->qty_asked;
800 $line->qty_shipped = $obj->qty_shipped;
802 $line->ref = $obj->product_ref;
803 $line->libelle = $obj->product_label;
804 $line->product_label = $obj->product_label;
805 $line->product_ref = $obj->product_ref;
806 $line->product_desc = $obj->product_desc;
807 $line->product_type = $obj->fk_product_type;
808 $line->fk_origin_line = $obj->fk_origin_line;
810 $line->price = $obj->price;
811 $line->total_ht = $obj->total_ht;
814 $line->weight = $obj->weight;
815 $line->weight_units = $obj->weight_units;
816 $line->width = $obj->width;
817 $line->width_units = $obj->width_units;
818 $line->height = $obj->height;
819 $line->height_units = $obj->height_units;
820 $line->length = $obj->length;
821 $line->length_units = $obj->length_units;
822 $line->surface = $obj->surface;
823 $line->surface_units = $obj->surface_units;
824 $line->volume = $obj->volume;
825 $line->volume_units = $obj->volume_units;
827 $line->fk_unit = $obj->fk_unit;
828 $line->fetch_optionals();
830 $this->lines[$i] = $line;
865 if (empty($this->labelStatus) || empty($this->labelStatusShort))
869 $this->labelStatus[-1] = $langs->trans(
'StatusDeliveryCanceled');
870 $this->labelStatus[0] = $langs->trans(
'StatusDeliveryDraft');
871 $this->labelStatus[1] = $langs->trans(
'StatusDeliveryValidated');
872 $this->labelStatusShort[-1] = $langs->trans(
'StatusDeliveryCanceled');
873 $this->labelStatusShort[0] = $langs->trans(
'StatusDeliveryDraft');
874 $this->labelStatusShort[1] = $langs->trans(
'StatusDeliveryValidated');
877 $statusType =
'status0';
878 if ($status == -1) $statusType =
'status5';
879 if ($status == 1) $statusType =
'status4';
881 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status],
'', $statusType, $mode);
894 global $user, $langs, $conf;
901 $sql =
"SELECT rowid";
902 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product";
903 $sql .=
" WHERE entity IN (".getEntity(
'product').
")";
904 $sql .=
" AND tosell = 1";
905 $sql .= $this->
db->plimit(100);
910 $num_prods = $this->
db->num_rows(
$resql);
912 while ($i < $num_prods)
915 $row = $this->
db->fetch_row(
$resql);
916 $prodids[$i] = $row[0];
922 $this->ref =
'SPECIMEN';
925 $this->date_delivery = $now;
926 $this->note_public =
'Public note';
927 $this->note_private =
'Private note';
931 $line->fk_product = $prodids[0];
932 $line->qty_asked = 10;
933 $line->qty_shipped = 9;
934 $line->ref =
'REFPROD';
935 $line->label =
'Specimen';
936 $line->description =
'Description';
938 $line->total_ht = 100;
940 $this->lines[$i] = $line;
957 $sqlSourceLine =
"SELECT st.rowid, st.description, st.qty";
958 $sqlSourceLine .=
", p.ref, p.label";
959 $sqlSourceLine .=
" FROM ".MAIN_DB_PREFIX.$this->linkedObjectsIds[0][
'type'].
"det as st";
960 $sqlSourceLine .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON st.fk_product = p.rowid";
961 $sqlSourceLine .=
" WHERE fk_".$this->linked_object[0][
'type'].
" = ".$this->linked_object[0][
'linkid'];
963 $resultSourceLine = $this->
db->query($sqlSourceLine);
964 if ($resultSourceLine)
966 $num_lines = $this->
db->num_rows($resultSourceLine);
968 $resultArray = array();
969 while ($i < $num_lines)
971 $objSourceLine = $this->
db->fetch_object($resultSourceLine);
974 $sql =
"SELECT ld.fk_origin_line, sum(ld.qty) as qty";
975 $sql .=
" FROM ".MAIN_DB_PREFIX.
"deliverydet as ld, ".MAIN_DB_PREFIX.
"delivery as l,";
976 $sql .=
" ".MAIN_DB_PREFIX.$this->linked_object[0][
'type'].
" as c";
977 $sql .=
", ".MAIN_DB_PREFIX.$this->linked_object[0][
'type'].
"det as cd";
978 $sql .=
" WHERE ld.fk_delivery = l.rowid";
979 $sql .=
" AND ld.fk_origin_line = cd.rowid";
980 $sql .=
" AND cd.fk_".$this->linked_object[0][
'type'].
" = c.rowid";
981 $sql .=
" AND cd.fk_".$this->linked_object[0][
'type'].
" = ".$this->linked_object[0][
'linkid'];
982 $sql .=
" AND ld.fk_origin_line = ".$objSourceLine->rowid;
983 $sql .=
" GROUP BY ld.fk_origin_line";
985 $result = $this->
db->query($sql);
986 $row = $this->
db->fetch_row($result);
988 if ($objSourceLine->qty - $row[1] > 0)
990 if ($row[0] == $objSourceLine->rowid)
992 $array[$i][
'qty'] = $objSourceLine->qty - $row[1];
994 $array[$i][
'qty'] = $objSourceLine->qty;
997 $array[$i][
'ref'] = $objSourceLine->ref;
998 $array[$i][
'label'] = $objSourceLine->label ? $objSourceLine->label : $objSourceLine->description;
999 } elseif ($objSourceLine->qty - $row[1] < 0)
1001 $array[$i][
'qty'] = $objSourceLine->qty - $row[1].
" Erreur livraison !";
1002 $array[$i][
'ref'] = $objSourceLine->ref;
1003 $array[$i][
'label'] = $objSourceLine->label ? $objSourceLine->label : $objSourceLine->description;
1010 $this->error = $this->
db->error().
" - sql=$sqlSourceLine";
1024 if ($user->rights->expedition->creer)
1026 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"delivery";
1027 $sql .=
" SET date_delivery = ".($delivery_date ?
"'".$this->db->idate($delivery_date).
"'" :
'null');
1028 $sql .=
" WHERE rowid = ".$this->id;
1030 dol_syslog(get_class($this).
"::setDeliveryDate", LOG_DEBUG);
1034 $this->date_delivery = $delivery_date;
1037 $this->error = $this->
db->error();
1055 public function generateDocument($modele, $outputlangs =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
1057 global $conf, $user, $langs;
1059 $langs->load(
"deliveries");
1060 $outputlangs->load(
"products");
1065 if ($this->model_pdf) {
1066 $modele = $this->model_pdf;
1067 } elseif (!empty($conf->global->DELIVERY_ADDON_PDF)) {
1068 $modele = $conf->global->DELIVERY_ADDON_PDF;
1072 $modelpath =
"core/modules/delivery/doc/";
1074 return $this->
commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
1110 public $element =
'deliverydet';
1115 public $table_element =
'deliverydet';
1120 public $qty_shipped;
1133 public $description;
1146 public $origin_line_id;
1148 public $product_ref;
1149 public $product_label;
__construct($db)
Constructor.
Class to manage receptions.
__construct($db)
Constructor.
valid($user, $notrigger=0)
Validate object and update stock if option enabled.
if(!empty($arrayfields['u.datec']['checked'])) print_liste_field_titre("DateCreationShort"u if(!empty($arrayfields['u.tms']['checked'])) print_liste_field_titre("DateModificationShort"u if(!empty($arrayfields['u.statut']['checked'])) print_liste_field_titre("Status"u statut
static replaceThirdparty(DoliDB $db, $origin_id, $dest_id)
Function used to replace a thirdparty id with another one.
getNomUrl($withpicto=0, $save_lastsearch_value=-1)
Return clicable name (with picto eventually)
</td > param sortfield sortorder printFieldListOption< tdclass="liste_titremaxwidthsearchright"></td ></tr >< trclass="liste_titre">< inputtype="checkbox"onClick="toggle(this)"/> Ref p ref Label p label Duration p duration center DesiredStock p desiredstock right StockLimitShort p seuil_stock_alerte right stock_physique right stock_real_warehouse right Ordered right StockToBuy right SupplierRef right param sortfield sortorder printFieldListTitle warehouseinternal SELECT description FROM product_lang WHERE qty< br > qty qty qty StockTooLow StockTooLow help help help< trclass="oddeven">< td >< inputtype="checkbox"class="check"name="choose'.$i.'"></td >< tdclass="nowrap"> stock</td >< td >< inputtype="hidden"name="desc'.$i.'"value="'.dol_escape_htmltag($objp-> description
Only used if Module[ID]Desc translation string is not found.
create($user)
Create delivery receipt in database.
dol_now($mode= 'auto')
Return date for now.
getLibStatut($mode=0)
Retourne le libelle du statut d'une expedition.
Management class of delivery note lines.
Class to manage Dolibarr database access.
commonGenerateDocument($modelspath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams=null)
Common function for all objects extending CommonObject for generating documents.
generateDocument($modele, $outputlangs= '', $hidedetails=0, $hidedesc=0, $hideref=0)
Create object on disk.
LibStatut($status, $mode)
Renvoi le libelle d'un statut donne.
initAsSpecimen()
Initialise an instance with random values.
$conf db
API class for accounts.
setDeliveryDate($user, $delivery_date)
Set the planned delivery date.
Parent class for class inheritance lines of business objects This class is useless for the moment so ...
update_line($id, $array_options=0)
Update a livraison line (only extrafields)
Class to manage third parties objects (customers, suppliers, prospects...)
dol_strlen($string, $stringencoding= 'UTF-8')
Make a strlen call.
getRemainingDelivered()
Renvoie la quantite de produit restante a livrer pour une commande.
addline($origin_id, $qty)
Add line.
Class to manage shipments.
static commonReplaceThirdparty(DoliDB $db, $origin_id, $dest_id, array $tables, $ignoreerrors=0)
Function used to replace a thirdparty id with another one.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Class to manage customers orders.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
fetchObjectLinked($sourceid=null, $sourcetype= '', $targetid=null, $targettype= '', $clause= 'OR', $alsosametype=1, $orderby= 'sourcetype', $loadalsoobjects=1)
Fetch array of objects linked to current object (object of enabled modules only). ...
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1)
Remove a file or several files with a mask.
deleteline($lineid)
Delete line.
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0)
Scan a directory and return a list of files/directories.
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...
deleteObjectLinked($sourceid=null, $sourcetype= '', $targetid=null, $targettype= '', $rowid= '')
Delete all links between an object $this.
print $_SERVER["PHP_SELF"]
Edit parameters.
trait CommonIncoterm
Superclass for incoterm classes.
call_trigger($triggerName, $user)
Call trigger based on this instance.
create_line($origin_id, $qty, $fk_product, $description)
Create a line.
fetch($id)
Load a delivery receipt.
setStatut($status, $elementId=null, $elementType= '', $trigkey= '')
Set status of an object.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
create_from_sending($user, $sending_id)
Creating the delivery slip from an existing shipment.
dolGetStatus($statusLabel= '', $statusLabelShort= '', $html= '', $statusType= 'status0', $displayMode=0, $url= '', $params=array())
Output the badge of a status.
add_object_linked($origin=null, $origin_id=null)
Add objects linked in llx_element_element.
dol_delete_dir($dir, $nophperrors=0)
Remove a directory (not recursive, so content must be empty).
update_price($exclspec=0, $roundingadjust= 'none', $nodatabaseupdate=0, $seller=null)
Update total_ht, total_ttc, total_vat, total_localtax1, total_localtax2 for an object (sum of lines)...
Parent class of all other business classes (invoices, contracts, proposals, orders, ...)
if(!empty($search_group)) natural_search(array("g.nom"g note
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $keepmoretags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...