28require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobject.class.php';
38 public $element =
'productfournisseurprice';
43 public $table_element =
'product_fournisseur_price';
48 public $picto =
'productfournisseurprice@buypricehistory';
51 const STATUS_DRAFT = 0;
52 const STATUS_VALIDATED = 1;
53 const STATUS_CANCELED = 9;
86 public $fields = array(
87 'rowid' => array(
'type' =>
'integer',
'label' =>
'TechnicalID',
'enabled' =>
'1',
'position' => 10,
'notnull' => 1,
'visible' => 0,),
88 'entity' => array(
'type' =>
'integer',
'label' =>
'Entity',
'enabled' =>
'1',
'position' => 15,
'notnull' => 1,
'visible' => -2,
'default' =>
'1',
'index' => 1,),
89 'datec' => array(
'type' =>
'datetime',
'label' =>
'DateCreation',
'enabled' =>
'1',
'position' => 20,
'notnull' => 0,
'visible' => -1,),
90 'tms' => array(
'type' =>
'timestamp',
'label' =>
'DateModification',
'enabled' =>
'1',
'position' => 25,
'notnull' => 1,
'visible' => -1,),
91 'fk_product' => array(
'type' =>
'integer:Product:product/class/product.class.php:1',
'label' =>
'Fkproduct',
'enabled' =>
'1',
'position' => 30,
'notnull' => 0,
'visible' => -1,),
92 'fk_soc' => array(
'type' =>
'integer:Societe:societe/class/societe.class.php',
'label' =>
'ThirdParty',
'enabled' =>
'1',
'position' => 35,
'notnull' => 0,
'visible' => -1,),
93 'ref_fourn' => array(
'type' =>
'varchar(255)',
'label' =>
'Reffourn',
'enabled' =>
'1',
'position' => 40,
'notnull' => 0,
'visible' => -1,),
94 'desc_fourn' => array(
'type' =>
'text',
'label' =>
'Descfourn',
'enabled' =>
'1',
'position' => 45,
'notnull' => 0,
'visible' => -1,),
95 'fk_availability' => array(
'type' =>
'integer',
'label' =>
'Fkavailability',
'enabled' =>
'1',
'position' => 50,
'notnull' => 0,
'visible' => -1,),
96 'price' => array(
'type' =>
'double(24,8)',
'label' =>
'Price',
'enabled' =>
'1',
'position' => 55,
'notnull' => 0,
'visible' => -1,),
97 'quantity' => array(
'type' =>
'double',
'label' =>
'Quantity',
'enabled' =>
'1',
'position' => 60,
'notnull' => 0,
'visible' => -1,),
98 'remise_percent' => array(
'type' =>
'double',
'label' =>
'Remisepercent',
'enabled' =>
'1',
'position' => 65,
'notnull' => 1,
'visible' => -1,),
99 'remise' => array(
'type' =>
'double',
'label' =>
'Remise',
'enabled' =>
'1',
'position' => 70,
'notnull' => 1,
'visible' => -1,),
100 'unitprice' => array(
'type' =>
'double(24,8)',
'label' =>
'Unitprice',
'enabled' =>
'1',
'position' => 75,
'notnull' => 0,
'visible' => -1,),
101 'charges' => array(
'type' =>
'double(24,8)',
'label' =>
'Charges',
'enabled' =>
'1',
'position' => 80,
'notnull' => 0,
'visible' => -1,),
102 'default_vat_code' => array(
'type' =>
'varchar(10)',
'label' =>
'Defaultvatcode',
'enabled' =>
'1',
'position' => 85,
'notnull' => 0,
'visible' => -1,),
103 'tva_tx' => array(
'type' =>
'double(6,3)',
'label' =>
'Tvatx',
'enabled' =>
'1',
'position' => 90,
'notnull' => 1,
'visible' => -1,),
104 'info_bits' => array(
'type' =>
'integer',
'label' =>
'Infobits',
'enabled' =>
'1',
'position' => 95,
'notnull' => 1,
'visible' => -1,),
105 'fk_user' => array(
'type' =>
'integer:User:user/class/user.class.php',
'label' =>
'Fkuser',
'enabled' =>
'1',
'position' => 100,
'notnull' => 0,
'visible' => -1,),
106 'fk_supplier_price_expression' => array(
'type' =>
'integer',
'label' =>
'Fksupplierpriceexpression',
'enabled' =>
'1',
'position' => 105,
'notnull' => 0,
'visible' => -1,),
107 'import_key' => array(
'type' =>
'varchar(14)',
'label' =>
'ImportId',
'enabled' =>
'1',
'position' => 900,
'notnull' => 0,
'visible' => -2,),
108 'delivery_time_days' => array(
'type' =>
'integer',
'label' =>
'Deliverytimedays',
'enabled' =>
'1',
'position' => 115,
'notnull' => 0,
'visible' => -1,),
109 'supplier_reputation' => array(
'type' =>
'varchar(10)',
'label' =>
'Supplierreputation',
'enabled' =>
'1',
'position' => 120,
'notnull' => 0,
'visible' => -1,),
110 'fk_multicurrency' => array(
'type' =>
'integer',
'label' =>
'Fkmulticurrency',
'enabled' =>
'1',
'position' => 125,
'notnull' => 0,
'visible' => -1,),
111 'multicurrency_code' => array(
'type' =>
'varchar(255)',
'label' =>
'Multicurrencycode',
'enabled' =>
'1',
'position' => 130,
'notnull' => 0,
'visible' => -1,),
112 'multicurrency_tx' => array(
'type' =>
'double(24,8)',
'label' =>
'Multicurrencytx',
'enabled' =>
'1',
'position' => 135,
'notnull' => 0,
'visible' => -1,),
113 'multicurrency_price' => array(
'type' =>
'double(24,8)',
'label' =>
'Multicurrencyprice',
'enabled' =>
'1',
'position' => 140,
'notnull' => 0,
'visible' => -1,),
114 'multicurrency_unitprice' => array(
'type' =>
'double(24,8)',
'label' =>
'Multicurrencyunitprice',
'enabled' =>
'1',
'position' => 145,
'notnull' => 0,
'visible' => -1,),
115 'localtax1_tx' => array(
'type' =>
'double(6,3)',
'label' =>
'Localtax1tx',
'enabled' =>
'1',
'position' => 150,
'notnull' => 0,
'visible' => -1,),
116 'localtax1_type' => array(
'type' =>
'varchar(10)',
'label' =>
'Localtax1type',
'enabled' =>
'1',
'position' => 155,
'notnull' => 1,
'visible' => -1,),
117 'localtax2_tx' => array(
'type' =>
'double(6,3)',
'label' =>
'Localtax2tx',
'enabled' =>
'1',
'position' => 160,
'notnull' => 0,
'visible' => -1,),
118 'localtax2_type' => array(
'type' =>
'varchar(10)',
'label' =>
'Localtax2type',
'enabled' =>
'1',
'position' => 165,
'notnull' => 1,
'visible' => -1,),
119 'barcode' => array(
'type' =>
'varchar(180)',
'label' =>
'Barcode',
'enabled' =>
'1',
'position' => 170,
'notnull' => 0,
'visible' => -1,),
120 'fk_barcode_type' => array(
'type' =>
'integer',
'label' =>
'Fkbarcodetype',
'enabled' =>
'1',
'position' => 175,
'notnull' => 0,
'visible' => -1,),
121 'packaging' => array(
'type' =>
'varchar(64)',
'label' =>
'Packaging',
'enabled' =>
'1',
'position' => 180,
'notnull' => 0,
'visible' => -1,),
154 public $fk_availability;
166 public $remise_percent;
182 public $default_vat_code;
198 public $fk_supplier_price_expression;
206 public $delivery_time_days;
210 public $supplier_reputation;
214 public $fk_multicurrency;
218 public $multicurrency_code;
222 public $multicurrency_tx;
226 public $multicurrency_price;
230 public $multicurrency_unitprice;
234 public $localtax1_tx;
238 public $localtax1_type;
242 public $localtax2_tx;
246 public $localtax2_type;
254 public $fk_barcode_type;
270 $this->ismultientitymanaged = 1;
271 $this->isextrafieldmanaged = 1;
274 $this->fields[
'rowid'][
'visible'] = 0;
276 if (!isModEnabled(
'multicompany') && isset($this->fields[
'entity'])) {
277 $this->fields[
'entity'][
'enabled'] = 0;
281 foreach ($this->fields as $key => $val) {
282 if (isset($val[
'enabled']) && empty($val[
'enabled'])) {
283 unset($this->fields[$key]);
309 global $langs, $extrafields;
319 $result =
$object->fetchCommon($fromid);
320 if ($result > 0 && !empty(
$object->table_element_line)) {
331 unset(
$object->user_creation_id);
335 if (property_exists(
$object,
'ref')) {
336 $object->ref = empty($this->fields[
'ref'][
'default']) ?
"Copy_Of_".$object->ref : $this->fields[
'ref'][
'default'];
341 if (property_exists(
$object,
'status')) {
342 $object->status = self::STATUS_DRAFT;
344 if (property_exists(
$object,
'date_creation')) {
347 if (property_exists(
$object,
'date_modification')) {
348 $object->date_modification =
null;
352 if (is_array(
$object->array_options) && count(
$object->array_options) > 0) {
353 $extrafields->fetch_name_optionals_label($this->table_element);
354 foreach (
$object->array_options as $key => $option) {
355 $shortkey = preg_replace(
'/options_/',
'', $key);
356 if (!empty($extrafields->attributes[$this->table_element][
'unique'][$shortkey])) {
359 unset(
$object->array_options[$key]);
365 $object->context[
'createfromclone'] =
'createfromclone';
366 $result =
$object->createCommon($user);
370 $this->errors =
$object->errors;
382 if (property_exists($this,
'socid') && $this->socid ==
$object->socid) {
389 unset(
$object->context[
'createfromclone']);
396 $this->db->rollback();
423 public function fetchAll($sortorder =
'', $sortfield =
'', $limit = 0, $offset = 0, $filter =
'', $filtermode =
'AND')
431 $sql .=
" FROM ".$this->db->prefix().$this->table_element.
" as t";
432 if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
433 $sql .=
" WHERE t.entity IN (".getEntity($this->element).
")";
435 $sql .=
" WHERE 1 = 1";
439 if (is_array($filter)) {
441 if (count($filter) > 0) {
442 foreach ($filter as $key => $value) {
443 if ($key ==
't.rowid') {
444 $sqlwhere[] = $this->db->sanitize($key).
" = ".((int) $value);
445 } elseif (array_key_exists($key, $this->fields) && in_array($this->fields[$key][
'type'], array(
'date',
'datetime',
'timestamp'))) {
446 $sqlwhere[] = $this->db->sanitize($key).
" = '".$this->db->idate($value).
"'";
447 } elseif (strpos($value,
'%') ===
false) {
448 $sqlwhere[] = $this->db->sanitize($key).
' IN ('.$this->db->sanitize($this->db->escape($value)).
')';
450 $sqlwhere[] = $this->db->sanitize($key).
" LIKE '%".$this->db->escape($this->db->escapeforlike($value)).
"%'";
454 if (count($sqlwhere) > 0) {
455 $sql .=
' AND ('.implode(
' '.$this->db->escape($filtermode).
' ', $sqlwhere).
')';
465 $this->errors[] = $errormessage;
466 dol_syslog(__METHOD__.
' '.implode(
',', $this->errors), LOG_ERR);
470 if (!empty($sortfield)) {
471 $sql .= $this->db->order($sortfield, $sortorder);
473 if (!empty($limit)) {
474 $sql .= $this->db->plimit($limit, $offset);
477 $resql = $this->db->query($sql);
479 $num = $this->db->num_rows($resql);
481 while ($i < ($limit ? min($limit, $num) : $num)) {
482 $obj = $this->db->fetch_object($resql);
484 $record =
new self($this->db);
485 $record->setVarsFromFetchObj($obj);
487 $records[$record->id] = $record;
491 $this->db->free($resql);
495 $this->errors[] =
'Error '.$this->db->lasterror();
496 dol_syslog(__METHOD__.
' '.implode(
',', $this->errors), LOG_ERR);
521 public function delete(
User $user, $notrigger = 0)
537 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
542 if ($this->
status == self::STATUS_VALIDATED) {
543 dol_syslog(get_class($this).
"::validate action abandoned: already validated", LOG_WARNING);
552 if (!$error && (preg_match(
'/^[\(]?PROV/i', $this->
ref) || empty($this->
ref))) {
557 $this->newref = $num;
561 $sql =
"UPDATE ".$this->db->prefix().$this->table_element;
562 $sql .=
" SET ref = '".$this->db->escape($num).
"',";
563 $sql .=
" status = ".self::STATUS_VALIDATED;
564 if (!empty($this->fields[
'date_validation'])) {
565 $sql .=
", date_validation = '".$this->db->idate($now).
"'";
567 if (!empty($this->fields[
'fk_user_valid'])) {
568 $sql .=
", fk_user_valid = ".((int) $user->id);
570 $sql .=
" WHERE rowid = ".((int) $this->
id);
572 dol_syslog(get_class($this).
"::validate()", LOG_DEBUG);
573 $resql = $this->db->query($sql);
576 $this->error = $this->db->lasterror();
580 if (!$error && !$notrigger) {
582 $result = $this->
call_trigger(
'PRODUCTFOURNISSEURPRICE_VALIDATE', $user);
591 $this->oldref = $this->ref;
594 if (preg_match(
'/^[\(]?PROV/i', $this->
ref)) {
596 $sql =
'UPDATE '.$this->db->prefix().
"ecm_files set filename = CONCAT('".$this->db->escape($this->newref).
"', SUBSTR(filename, ".(strlen($this->
ref) + 1).
")), filepath = 'productfournisseurprice/".$this->db->escape($this->newref).
"'";
597 $sql .=
" WHERE filename LIKE '".$this->db->escape($this->
ref).
"%' AND filepath = 'productfournisseurprice/".$this->db->escape($this->
ref).
"' and entity = ".$conf->entity;
598 $resql = $this->db->query($sql);
601 $this->error = $this->db->lasterror();
603 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"ecm_files set filepath = 'productfournisseurprice/".$this->db->escape($this->newref).
"'";
604 $sql .=
" WHERE filepath = 'productfournisseurprice/".$this->db->escape($this->
ref).
"' and entity = ".$conf->entity;
605 $resql = $this->db->query($sql);
608 $this->error = $this->db->lasterror();
614 $dirsource =
$conf->buypricehistory->dir_output.
'/productfournisseurprice/'.$oldref;
615 $dirdest =
$conf->buypricehistory->dir_output.
'/productfournisseurprice/'.$newref;
616 if (!$error && file_exists($dirsource)) {
617 dol_syslog(get_class($this).
"::validate() rename dir ".$dirsource.
" into ".$dirdest);
619 if (@rename($dirsource, $dirdest)) {
622 $listoffiles =
dol_dir_list(
$conf->buypricehistory->dir_output.
'/productfournisseurprice/'.$newref,
'files', 1,
'^'.preg_quote($oldref,
'/'));
623 foreach ($listoffiles as $fileentry) {
624 $dirsource = $fileentry[
'name'];
625 $dirdest = preg_replace(
'/^'.preg_quote($oldref,
'/').
'/', $newref, $dirsource);
626 $dirsource = $fileentry[
'path'].
'/'.$dirsource;
627 $dirdest = $fileentry[
'path'].
'/'.$dirdest;
628 @rename($dirsource, $dirdest);
638 $this->
status = self::STATUS_VALIDATED;
645 $this->db->rollback();
661 if ($this->
status <= self::STATUS_DRAFT) {
665 return $this->
setStatusCommon($user, self::STATUS_DRAFT, $notrigger,
'PRODUCTFOURNISSEURPRICE_UNVALIDATE');
675 public function cancel($user, $notrigger = 0)
678 if ($this->
status != self::STATUS_VALIDATED) {
682 return $this->
setStatusCommon($user, self::STATUS_CANCELED, $notrigger,
'PRODUCTFOURNISSEURPRICE_CANCEL');
692 public function reopen($user, $notrigger = 0)
695 if ($this->
status != self::STATUS_CANCELED) {
699 return $this->
setStatusCommon($user, self::STATUS_VALIDATED, $notrigger,
'PRODUCTFOURNISSEURPRICE_REOPEN');
712 public function getNomUrl($withpicto = 0, $option =
'', $notooltip = 0, $morecss =
'', $save_lastsearch_value = -1)
714 global
$conf, $langs, $hookmanager;
716 if (!empty(
$conf->dol_no_mouse_hover)) {
722 $label =
img_picto(
'', $this->picto).
' <u>'.$langs->trans(
"ProductFournisseurPrice").
'</u>';
723 if (isset($this->
status)) {
724 $label .=
' '.$this->getLibStatut(5);
727 $label .=
'<b>'.$langs->trans(
'Ref').
':</b> '.$this->ref;
729 $url =
dol_buildpath(
'/buypricehistory/productfournisseurprice_card.php', 1).
'?id='.$this->id;
731 if ($option !=
'nolink') {
733 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
734 if ($save_lastsearch_value == -1 && isset($_SERVER[
"PHP_SELF"]) && preg_match(
'/list\.php/', $_SERVER[
"PHP_SELF"])) {
735 $add_save_lastsearch_values = 1;
737 if ($add_save_lastsearch_values) {
738 $url .=
'&save_lastsearch_values=1';
743 if (empty($notooltip)) {
745 $label = $langs->trans(
"ShowProductFournisseurPrice");
746 $linkclose .=
' alt="'.dolPrintHTMLForAttribute($label).
'"';
748 $linkclose .=
' title="'.dolPrintHTMLForAttribute($label).
'"';
749 $linkclose .=
' class="classfortooltip'.($morecss ?
' '.$morecss :
'').
'"';
751 $linkclose = ($morecss ?
' class="'.$morecss.
'"' :
'');
754 $linkstart =
'<a href="'.$url.
'"';
755 $linkstart .= $linkclose.
'>';
758 $result .= $linkstart;
760 if (empty($this->showphoto_on_popup)) {
762 $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);
766 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
768 list($class, $module) = explode(
'@', $this->picto);
771 $filename = $filearray[0][
'name'];
772 if (!empty($filename)) {
773 $pospoint = strpos($filearray[0][
'name'],
'.');
775 $pathtophoto = $class.
'/'.$this->
ref.
'/thumbs/'.substr($filename, 0, $pospoint).
'_mini'.substr($filename, $pospoint);
777 $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>';
779 $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>';
784 $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);
789 if ($withpicto != 2) {
790 $result .= $this->ref;
796 global $action, $hookmanager;
797 $hookmanager->initHooks(array(
'productfournisseurpricedao'));
798 $parameters = array(
'id' => $this->
id,
'getnomurl' => &$result);
799 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
801 $result = $hookmanager->resPrint;
803 $result .= $hookmanager->resPrint;
831 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
834 $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Draft');
835 $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Enabled');
836 $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv(
'Disabled');
837 $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Draft');
838 $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Enabled');
839 $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv(
'Disabled');
842 $statusType =
'status'.$status;
844 if ($status == self::STATUS_CANCELED) {
845 $statusType =
'status6';
848 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status],
'', $statusType, $mode);
859 $sql =
"SELECT rowid, date_creation as datec, tms as datem,";
860 $sql .=
" fk_user_creat, fk_user_modif";
861 $sql .=
" FROM ".$this->db->prefix().$this->table_element.
" as t";
862 $sql .=
" WHERE t.rowid = ".((int) $id);
863 $result = $this->db->query($sql);
865 if ($this->db->num_rows($result)) {
866 $obj = $this->db->fetch_object($result);
868 $this->
id = $obj->rowid;
870 $this->user_creation_id = $obj->fk_user_author;
871 $this->user_validation_id = $obj->fk_user_valid;
873 $this->date_creation = $this->db->jdate($obj->datec);
874 $this->date_modification = $this->db->jdate($obj->datem);
877 $this->db->free($result);
901 global $langs,
$conf;
902 $langs->load(
"buypricehistory@buypricehistory");
905 $conf->global->BUYPRICEHISTORY_PRODUCTFOURNISSEURPRICE_ADDON =
'mod_productfournisseurprice_standard';
915 $dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
916 foreach ($dirmodels as $reldir) {
917 $dir =
dol_buildpath($reldir.
"core/modules/buypricehistory/");
920 $mybool = ((bool) @include_once $dir.$file) || $mybool;
928 if (class_exists($classname)) {
929 $obj =
new $classname();
930 '@phan-var-force CommonNumRefGenerator $obj';
931 $numref = $obj->getNextValue($this);
933 if ($numref !=
'' && $numref !=
'-1') {
936 $this->error = $obj->error;
941 print $langs->trans(
"Error").
" ".$langs->trans(
"ClassNotFound").
' '.$classname;
945 print $langs->trans(
"ErrorNumberingModuleNotSetup", $this->element);
961 public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams =
null)
966 $includedocgeneration = 0;
968 $langs->load(
"buypricehistory@buypricehistory");
971 $modele =
'standard_productfournisseurprice';
973 if (!empty($this->model_pdf)) {
974 $modele = $this->model_pdf;
980 $modelpath =
"core/modules/buypricehistory/doc/";
982 if ($includedocgeneration && !empty($modele)) {
983 $result = $this->
commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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.
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.
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.
call_trigger($triggerName, $user)
Call trigger based on this instance.
Class to manage Dolibarr database access.
Class for ProductFournisseurPrice.
createFromClone(User $user, $fromid)
Clone an object into another one.
reopen($user, $notrigger=0)
Set back to validated 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.
create(User $user, $notrigger=0)
Create object into database.
validate($user, $notrigger=0)
Validate object.
fetch($id)
Load object in memory from the database.
getLibStatut($mode=0)
Return the label of the status.
getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
Return a link to the object card (with optionally the picto)
setDraft($user, $notrigger=0)
Set draft status.
cancel($user, $notrigger=0)
Set cancel status.
initAsSpecimen()
Initialise object with example values Id must be 0 if object instance is a specimen.
LibStatut($status, $mode=0)
Return the status.
update(User $user, $notrigger=0)
Update object into database.
__construct(DoliDB $db)
Constructor.
generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null)
Create a document onto disk according to template module.
getNextNumRef()
Returns the reference to the following non used object depending on the active numbering module.
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.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
forgeSQLFromUniversalSearchCriteria($filter, &$errorstr='', $noand=0, $nopar=0, $noerror=0)
forgeSQLFromUniversalSearchCriteria
dol_now($mode='auto')
Return date for now.
dolGetStatus($statusLabel='', $statusLabelShort='', $html='', $statusType='status0', $displayMode=0, $url='', $params=array())
Output the badge of a status.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...