26require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobject.class.php';
36 public $element =
'productfournisseurprice';
41 public $table_element =
'product_fournisseur_price';
47 public $ismultientitymanaged = 1;
52 public $isextrafieldmanaged = 1;
57 public $picto =
'productfournisseurprice@buypricehistory';
60 const STATUS_DRAFT = 0;
61 const STATUS_VALIDATED = 1;
62 const STATUS_CANCELED = 9;
96 'rowid' => array(
'type'=>
'integer',
'label'=>
'TechnicalID',
'enabled'=>
'1',
'position'=>10,
'notnull'=>1,
'visible'=>0,),
97 'entity' => array(
'type'=>
'integer',
'label'=>
'Entity',
'enabled'=>
'1',
'position'=>15,
'notnull'=>1,
'visible'=>-2,
'default'=>
'1',
'index'=>1,),
98 'datec' => array(
'type'=>
'datetime',
'label'=>
'DateCreation',
'enabled'=>
'1',
'position'=>20,
'notnull'=>0,
'visible'=>-1,),
99 'tms' => array(
'type'=>
'timestamp',
'label'=>
'DateModification',
'enabled'=>
'1',
'position'=>25,
'notnull'=>1,
'visible'=>-1,),
100 'fk_product' => array(
'type'=>
'integer:Product:product/class/product.class.php:1',
'label'=>
'Fkproduct',
'enabled'=>
'1',
'position'=>30,
'notnull'=>0,
'visible'=>-1,),
101 'fk_soc' => array(
'type'=>
'integer:Societe:societe/class/societe.class.php',
'label'=>
'ThirdParty',
'enabled'=>
'1',
'position'=>35,
'notnull'=>0,
'visible'=>-1,),
102 'ref_fourn' => array(
'type'=>
'varchar(255)',
'label'=>
'Reffourn',
'enabled'=>
'1',
'position'=>40,
'notnull'=>0,
'visible'=>-1,),
103 'desc_fourn' => array(
'type'=>
'text',
'label'=>
'Descfourn',
'enabled'=>
'1',
'position'=>45,
'notnull'=>0,
'visible'=>-1,),
104 'fk_availability' => array(
'type'=>
'integer',
'label'=>
'Fkavailability',
'enabled'=>
'1',
'position'=>50,
'notnull'=>0,
'visible'=>-1,),
105 'price' => array(
'type'=>
'double(24,8)',
'label'=>
'Price',
'enabled'=>
'1',
'position'=>55,
'notnull'=>0,
'visible'=>-1,),
106 'quantity' => array(
'type'=>
'double',
'label'=>
'Quantity',
'enabled'=>
'1',
'position'=>60,
'notnull'=>0,
'visible'=>-1,),
107 'remise_percent' => array(
'type'=>
'double',
'label'=>
'Remisepercent',
'enabled'=>
'1',
'position'=>65,
'notnull'=>1,
'visible'=>-1,),
108 'remise' => array(
'type'=>
'double',
'label'=>
'Remise',
'enabled'=>
'1',
'position'=>70,
'notnull'=>1,
'visible'=>-1,),
109 'unitprice' => array(
'type'=>
'double(24,8)',
'label'=>
'Unitprice',
'enabled'=>
'1',
'position'=>75,
'notnull'=>0,
'visible'=>-1,),
110 'charges' => array(
'type'=>
'double(24,8)',
'label'=>
'Charges',
'enabled'=>
'1',
'position'=>80,
'notnull'=>0,
'visible'=>-1,),
111 'default_vat_code' => array(
'type'=>
'varchar(10)',
'label'=>
'Defaultvatcode',
'enabled'=>
'1',
'position'=>85,
'notnull'=>0,
'visible'=>-1,),
112 'tva_tx' => array(
'type'=>
'double(6,3)',
'label'=>
'Tvatx',
'enabled'=>
'1',
'position'=>90,
'notnull'=>1,
'visible'=>-1,),
113 'info_bits' => array(
'type'=>
'integer',
'label'=>
'Infobits',
'enabled'=>
'1',
'position'=>95,
'notnull'=>1,
'visible'=>-1,),
114 'fk_user' => array(
'type'=>
'integer:User:user/class/user.class.php',
'label'=>
'Fkuser',
'enabled'=>
'1',
'position'=>100,
'notnull'=>0,
'visible'=>-1,),
115 'fk_supplier_price_expression' => array(
'type'=>
'integer',
'label'=>
'Fksupplierpriceexpression',
'enabled'=>
'1',
'position'=>105,
'notnull'=>0,
'visible'=>-1,),
116 'import_key' => array(
'type'=>
'varchar(14)',
'label'=>
'ImportId',
'enabled'=>
'1',
'position'=>900,
'notnull'=>0,
'visible'=>-2,),
117 'delivery_time_days' => array(
'type'=>
'integer',
'label'=>
'Deliverytimedays',
'enabled'=>
'1',
'position'=>115,
'notnull'=>0,
'visible'=>-1,),
118 'supplier_reputation' => array(
'type'=>
'varchar(10)',
'label'=>
'Supplierreputation',
'enabled'=>
'1',
'position'=>120,
'notnull'=>0,
'visible'=>-1,),
119 'fk_multicurrency' => array(
'type'=>
'integer',
'label'=>
'Fkmulticurrency',
'enabled'=>
'1',
'position'=>125,
'notnull'=>0,
'visible'=>-1,),
120 'multicurrency_code' => array(
'type'=>
'varchar(255)',
'label'=>
'Multicurrencycode',
'enabled'=>
'1',
'position'=>130,
'notnull'=>0,
'visible'=>-1,),
121 'multicurrency_tx' => array(
'type'=>
'double(24,8)',
'label'=>
'Multicurrencytx',
'enabled'=>
'1',
'position'=>135,
'notnull'=>0,
'visible'=>-1,),
122 'multicurrency_price' => array(
'type'=>
'double(24,8)',
'label'=>
'Multicurrencyprice',
'enabled'=>
'1',
'position'=>140,
'notnull'=>0,
'visible'=>-1,),
123 'multicurrency_unitprice' => array(
'type'=>
'double(24,8)',
'label'=>
'Multicurrencyunitprice',
'enabled'=>
'1',
'position'=>145,
'notnull'=>0,
'visible'=>-1,),
124 'localtax1_tx' => array(
'type'=>
'double(6,3)',
'label'=>
'Localtax1tx',
'enabled'=>
'1',
'position'=>150,
'notnull'=>0,
'visible'=>-1,),
125 'localtax1_type' => array(
'type'=>
'varchar(10)',
'label'=>
'Localtax1type',
'enabled'=>
'1',
'position'=>155,
'notnull'=>1,
'visible'=>-1,),
126 'localtax2_tx' => array(
'type'=>
'double(6,3)',
'label'=>
'Localtax2tx',
'enabled'=>
'1',
'position'=>160,
'notnull'=>0,
'visible'=>-1,),
127 'localtax2_type' => array(
'type'=>
'varchar(10)',
'label'=>
'Localtax2type',
'enabled'=>
'1',
'position'=>165,
'notnull'=>1,
'visible'=>-1,),
128 'barcode' => array(
'type'=>
'varchar(180)',
'label'=>
'Barcode',
'enabled'=>
'1',
'position'=>170,
'notnull'=>0,
'visible'=>-1,),
129 'fk_barcode_type' => array(
'type'=>
'integer',
'label'=>
'Fkbarcodetype',
'enabled'=>
'1',
'position'=>175,
'notnull'=>0,
'visible'=>-1,),
130 'packaging' => array(
'type'=>
'varchar(64)',
'label'=>
'Packaging',
'enabled'=>
'1',
'position'=>180,
'notnull'=>0,
'visible'=>-1,),
140 public $fk_availability;
143 public $remise_percent;
147 public $default_vat_code;
151 public $fk_supplier_price_expression;
153 public $delivery_time_days;
154 public $supplier_reputation;
155 public $fk_multicurrency;
156 public $multicurrency_code;
157 public $multicurrency_tx;
158 public $multicurrency_price;
159 public $multicurrency_unitprice;
160 public $localtax1_tx;
161 public $localtax1_type;
162 public $localtax2_tx;
163 public $localtax2_type;
165 public $fk_barcode_type;
176 global $conf, $langs;
181 $this->fields[
'rowid'][
'visible'] = 0;
183 if (!isModEnabled(
'multicompany') && isset($this->fields[
'entity'])) {
184 $this->fields[
'entity'][
'enabled'] = 0;
188 foreach ($this->fields as $key => $val) {
189 if (isset($val[
'enabled']) && empty($val[
'enabled'])) {
190 unset($this->fields[$key]);
216 global $langs, $extrafields;
221 $object =
new self($this->db);
226 $result = $object->fetchCommon($fromid);
227 if ($result > 0 && !empty($object->table_element_line)) {
228 $object->fetchLines();
237 unset($object->fk_user_creat);
238 unset($object->import_key);
241 if (property_exists($object,
'ref')) {
242 $object->ref = empty($this->fields[
'ref'][
'default']) ?
"Copy_Of_".$object->ref : $this->fields[
'ref'][
'default'];
244 if (property_exists($object,
'label')) {
245 $object->label = empty($this->fields[
'label'][
'default']) ? $langs->trans(
"CopyOf").
" ".$object->label : $this->fields[
'label'][
'default'];
247 if (property_exists($object,
'status')) {
248 $object->status = self::STATUS_DRAFT;
250 if (property_exists($object,
'date_creation')) {
251 $object->date_creation =
dol_now();
253 if (property_exists($object,
'date_modification')) {
254 $object->date_modification =
null;
258 if (is_array($object->array_options) && count($object->array_options) > 0) {
259 $extrafields->fetch_name_optionals_label($this->table_element);
260 foreach ($object->array_options as $key => $option) {
261 $shortkey = preg_replace(
'/options_/',
'', $key);
262 if (!empty($extrafields->attributes[$this->table_element][
'unique'][$shortkey])) {
265 unset($object->array_options[$key]);
271 $object->context[
'createfromclone'] =
'createfromclone';
272 $result = $object->createCommon($user);
275 $this->error = $object->error;
276 $this->errors = $object->errors;
288 if (property_exists($this,
'socid') && $this->socid == $object->socid) {
295 unset($object->context[
'createfromclone']);
302 $this->db->rollback();
329 public function fetchAll($sortorder =
'', $sortfield =
'', $limit = 0, $offset = 0, array $filter = array(), $filtermode =
'AND')
339 $sql .=
" FROM ".$this->db->prefix().$this->table_element.
" as t";
340 if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
341 $sql .=
" WHERE t.entity IN (".getEntity($this->element).
")";
343 $sql .=
" WHERE 1 = 1";
347 if (count($filter) > 0) {
348 foreach ($filter as $key => $value) {
349 if ($key ==
't.rowid') {
350 $sqlwhere[] = $key.
" = ".((int) $value);
351 } elseif (array_key_exists($key, $this->fields) && in_array($this->fields[$key][
'type'], array(
'date',
'datetime',
'timestamp'))) {
352 $sqlwhere[] = $key.
" = '".$this->db->idate($value).
"'";
353 } elseif ($key ==
'customsql') {
354 $sqlwhere[] = $value;
355 } elseif (strpos($value,
'%') ===
false) {
356 $sqlwhere[] = $key.
' IN ('.$this->db->sanitize($this->db->escape($value)).
')';
358 $sqlwhere[] = $key.
" LIKE '%".$this->db->escape($value).
"%'";
362 if (count($sqlwhere) > 0) {
363 $sql .=
' AND ('.implode(
' '.$this->db->escape($filtermode).
' ', $sqlwhere).
')';
366 if (!empty($sortfield)) {
367 $sql .= $this->db->order($sortfield, $sortorder);
369 if (!empty($limit)) {
370 $sql .= $this->db->plimit($limit, $offset);
373 $resql = $this->db->query($sql);
375 $num = $this->db->num_rows($resql);
377 while ($i < ($limit ? min($limit, $num) : $num)) {
378 $obj = $this->db->fetch_object($resql);
380 $record =
new self($this->db);
381 $record->setVarsFromFetchObj($obj);
383 $records[$record->id] = $record;
387 $this->db->free($resql);
391 $this->errors[] =
'Error '.$this->db->lasterror();
392 dol_syslog(__METHOD__.
' '.join(
',', $this->errors), LOG_ERR);
417 public function delete(
User $user, $notrigger =
false)
431 global $conf, $langs;
433 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
438 if ($this->
status == self::STATUS_VALIDATED) {
439 dol_syslog(get_class($this).
"::validate action abandonned: already validated", LOG_WARNING);
448 if (!$error && (preg_match(
'/^[\(]?PROV/i', $this->
ref) || empty($this->
ref))) {
453 $this->newref = $num;
457 $sql =
"UPDATE ".$this->db->prefix().$this->table_element;
458 $sql .=
" SET ref = '".$this->db->escape($num).
"',";
459 $sql .=
" status = ".self::STATUS_VALIDATED;
460 if (!empty($this->fields[
'date_validation'])) {
461 $sql .=
", date_validation = '".$this->db->idate($now).
"'";
463 if (!empty($this->fields[
'fk_user_valid'])) {
464 $sql .=
", fk_user_valid = ".$user->id;
466 $sql .=
" WHERE rowid = ".((int) $this->
id);
468 dol_syslog(get_class($this).
"::validate()", LOG_DEBUG);
469 $resql = $this->db->query($sql);
472 $this->error = $this->db->lasterror();
476 if (!$error && !$notrigger) {
478 $result = $this->
call_trigger(
'PRODUCTFOURNISSEURPRICE_VALIDATE', $user);
487 $this->oldref = $this->ref;
490 if (preg_match(
'/^[\(]?PROV/i', $this->
ref)) {
492 $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).
"'";
493 $sql .=
" WHERE filename LIKE '".$this->db->escape($this->
ref).
"%' AND filepath = 'productfournisseurprice/".$this->db->escape($this->
ref).
"' and entity = ".$conf->entity;
494 $resql = $this->db->query($sql);
497 $this->error = $this->db->lasterror();
499 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"ecm_files set filepath = 'productfournisseurprice/".$this->db->escape($this->newref).
"'";
500 $sql .=
" WHERE filepath = 'productfournisseurprice/".$this->db->escape($this->
ref).
"' and entity = ".$conf->entity;
501 $resql = $this->db->query($sql);
504 $this->error = $this->db->lasterror();
510 $dirsource = $conf->buypricehistory->dir_output.
'/productfournisseurprice/'.$oldref;
511 $dirdest = $conf->buypricehistory->dir_output.
'/productfournisseurprice/'.$newref;
512 if (!$error && file_exists($dirsource)) {
513 dol_syslog(get_class($this).
"::validate() rename dir ".$dirsource.
" into ".$dirdest);
515 if (@rename($dirsource, $dirdest)) {
518 $listoffiles =
dol_dir_list($conf->buypricehistory->dir_output.
'/productfournisseurprice/'.$newref,
'files', 1,
'^'.preg_quote($oldref,
'/'));
519 foreach ($listoffiles as $fileentry) {
520 $dirsource = $fileentry[
'name'];
521 $dirdest = preg_replace(
'/^'.preg_quote($oldref,
'/').
'/', $newref, $dirsource);
522 $dirsource = $fileentry[
'path'].
'/'.$dirsource;
523 $dirdest = $fileentry[
'path'].
'/'.$dirdest;
524 @rename($dirsource, $dirdest);
534 $this->
status = self::STATUS_VALIDATED;
541 $this->db->rollback();
557 if ($this->
status <= self::STATUS_DRAFT) {
561 return $this->
setStatusCommon($user, self::STATUS_DRAFT, $notrigger,
'PRODUCTFOURNISSEURPRICE_UNVALIDATE');
571 public function cancel($user, $notrigger = 0)
574 if ($this->
status != self::STATUS_VALIDATED) {
578 return $this->
setStatusCommon($user, self::STATUS_CANCELED, $notrigger,
'PRODUCTFOURNISSEURPRICE_CANCEL');
588 public function reopen($user, $notrigger = 0)
591 if ($this->
status != self::STATUS_CANCELED) {
595 return $this->
setStatusCommon($user, self::STATUS_VALIDATED, $notrigger,
'PRODUCTFOURNISSEURPRICE_REOPEN');
608 public function getNomUrl($withpicto = 0, $option =
'', $notooltip = 0, $morecss =
'', $save_lastsearch_value = -1)
610 global $conf, $langs, $hookmanager;
612 if (!empty($conf->dol_no_mouse_hover)) {
618 $label =
img_picto(
'', $this->picto).
' <u>'.$langs->trans(
"ProductFournisseurPrice").
'</u>';
619 if (isset($this->
status)) {
620 $label .=
' '.$this->getLibStatut(5);
623 $label .=
'<b>'.$langs->trans(
'Ref').
':</b> '.$this->ref;
625 $url =
dol_buildpath(
'/buypricehistory/productfournisseurprice_card.php', 1).
'?id='.$this->id;
627 if ($option !=
'nolink') {
629 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
630 if ($save_lastsearch_value == -1 && isset($_SERVER[
"PHP_SELF"]) && preg_match(
'/list\.php/', $_SERVER[
"PHP_SELF"])) {
631 $add_save_lastsearch_values = 1;
633 if ($add_save_lastsearch_values) {
634 $url .=
'&save_lastsearch_values=1';
639 if (empty($notooltip)) {
641 $label = $langs->trans(
"ShowProductFournisseurPrice");
642 $linkclose .=
' alt="'.dol_escape_htmltag($label, 1).
'"';
644 $linkclose .=
' title="'.dol_escape_htmltag($label, 1).
'"';
645 $linkclose .=
' class="classfortooltip'.($morecss ?
' '.$morecss :
'').
'"';
647 $linkclose = ($morecss ?
' class="'.$morecss.
'"' :
'');
650 $linkstart =
'<a href="'.$url.
'"';
651 $linkstart .= $linkclose.
'>';
654 $result .= $linkstart;
656 if (empty($this->showphoto_on_popup)) {
658 $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);
662 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
664 list($class, $module) = explode(
'@', $this->picto);
667 $filename = $filearray[0][
'name'];
668 if (!empty($filename)) {
669 $pospoint = strpos($filearray[0][
'name'],
'.');
671 $pathtophoto = $class.
'/'.$this->
ref.
'/thumbs/'.substr($filename, 0, $pospoint).
'_mini'.substr($filename, $pospoint);
673 $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>';
675 $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>';
680 $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);
685 if ($withpicto != 2) {
686 $result .= $this->ref;
692 global $action, $hookmanager;
693 $hookmanager->initHooks(array(
'productfournisseurpricedao'));
694 $parameters = array(
'id'=>$this->
id,
'getnomurl' => &$result);
695 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
697 $result = $hookmanager->resPrint;
699 $result .= $hookmanager->resPrint;
727 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
730 $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Draft');
731 $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Enabled');
732 $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv(
'Disabled');
733 $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Draft');
734 $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Enabled');
735 $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv(
'Disabled');
738 $statusType =
'status'.$status;
740 if ($status == self::STATUS_CANCELED) {
741 $statusType =
'status6';
744 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status],
'', $statusType, $mode);
755 $sql =
"SELECT rowid, date_creation as datec, tms as datem,";
756 $sql .=
" fk_user_creat, fk_user_modif";
757 $sql .=
" FROM ".$this->db->prefix().$this->table_element.
" as t";
758 $sql .=
" WHERE t.rowid = ".((int) $id);
759 $result = $this->db->query($sql);
761 if ($this->db->num_rows($result)) {
762 $obj = $this->db->fetch_object($result);
764 $this->
id = $obj->rowid;
766 $this->user_creation_id = $obj->fk_user_author;
767 $this->user_validation_id = $obj->fk_user_valid;
769 $this->date_creation = $this->db->jdate($obj->datec);
770 $this->date_modification = $this->db->jdate($obj->datem);
773 $this->db->free($result);
797 global $langs, $conf;
798 $langs->load(
"buypricehistory@buypricehistory");
801 $conf->global->BUYPRICEHISTORY_PRODUCTFOURNISSEURPRICE_ADDON =
'mod_productfournisseurprice_standard';
808 $classname = $conf->global->BUYPRICEHISTORY_PRODUCTFOURNISSEURPRICE_ADDON;
811 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
812 foreach ($dirmodels as $reldir) {
813 $dir =
dol_buildpath($reldir.
"core/modules/buypricehistory/");
816 $mybool |= @include_once $dir.$file;
819 if ($mybool ===
false) {
824 if (class_exists($classname)) {
825 $obj =
new $classname();
826 $numref = $obj->getNextValue($this);
828 if ($numref !=
'' && $numref !=
'-1') {
831 $this->error = $obj->error;
836 print $langs->trans(
"Error").
" ".$langs->trans(
"ClassNotFound").
' '.$classname;
840 print $langs->trans(
"ErrorNumberingModuleNotSetup", $this->element);
856 public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams =
null)
858 global $conf, $langs;
861 $includedocgeneration = 0;
863 $langs->load(
"buypricehistory@buypricehistory");
866 $modele =
'standard_productfournisseurprice';
868 if (!empty($this->model_pdf)) {
869 $modele = $this->model_pdf;
871 $modele = $conf->global->PRODUCTFOURNISSEURPRICE_ADDON_PDF;
875 $modelpath =
"core/modules/buypricehistory/doc/";
877 if ($includedocgeneration && !empty($modele)) {
878 $result = $this->
commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
print $langs trans("AuditedSecurityEvents").'</strong >< span class="opacitymedium"></span >< br > status
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=false)
Create object into database.
deleteCommon(User $user, $notrigger=false, $forcechilddeletion=0)
Delete object in database.
getFieldList($alias='', $excludefields=array())
Function to concat keys of fields.
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.
updateCommon(User $user, $notrigger=false)
Update object into database.
fetchCommon($id, $ref=null, $morewhere='', $noextrafields=0)
Load object in memory from the database.
call_trigger($triggerName, $user)
Call trigger based on this instance.
Class to manage Dolibarr database access.
Class for ProductFournisseurPrice.
update(User $user, $notrigger=false)
Update object into database.
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.
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 optionaly 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.
fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, array $filter=array(), $filtermode='AND')
Load list of objects in memory from the database.
LibStatut($status, $mode=0)
Return the status.
__construct(DoliDB $db)
Constructor.
create(User $user, $notrigger=false)
Create object into database.
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.
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.
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)
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)
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.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.