29require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobject.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
41 public $element =
'chequereceipt';
46 public $table_element =
'bordereau_cheque';
51 public $picto =
'payment';
78 public $date_bordereau;
86 public $account_label;
101 const STATUS_DRAFT = 0;
102 const STATUS_VALIDATED = 1;
122 public function fetch($id, $ref =
'')
126 $sql =
"SELECT bc.rowid, bc.datec, bc.fk_user_author, bc.fk_bank_account, bc.amount, bc.ref, bc.statut as status, bc.nbcheque, bc.ref_ext,";
127 $sql .=
" bc.date_bordereau as date_bordereau, bc.type,";
128 $sql .=
" ba.label as account_label";
129 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bordereau_cheque as bc";
130 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank_account as ba ON bc.fk_bank_account = ba.rowid";
131 $sql .=
" WHERE bc.entity = ".$conf->entity;
133 $sql .=
" AND bc.rowid = ".((int) $id);
136 $sql .=
" AND bc.ref = '".$this->db->escape($ref).
"'";
140 $resql = $this->db->query($sql);
142 if ($obj = $this->db->fetch_object($resql)) {
143 $this->
id = $obj->rowid;
144 $this->amount = $obj->amount;
145 $this->date_bordereau = $this->db->jdate($obj->date_bordereau);
146 $this->account_id = $obj->fk_bank_account;
147 $this->account_label = $obj->account_label;
148 $this->author_id = $obj->fk_user_author;
149 $this->nbcheque = $obj->nbcheque;
150 $this->statut = $obj->status;
151 $this->
status = $obj->status;
152 $this->ref_ext = $obj->ref_ext;
153 $this->
type = $obj->type;
156 $this->
ref =
"(PROV".$this->id.
")";
158 $this->
ref = $obj->ref;
161 $this->db->free($resql);
165 $this->error = $this->db->lasterror();
179 public function create($user, $account_id, $limit, $toRemise)
188 dol_syslog(
"RemiseCheque::Create start", LOG_DEBUG);
191 if (empty($this->
type)) {
197 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"bordereau_cheque (";
199 $sql .=
", date_bordereau";
200 $sql .=
", fk_user_author";
201 $sql .=
", fk_bank_account";
206 $sql .=
", nbcheque";
209 $sql .=
") VALUES (";
210 $sql .=
"'".$this->db->idate($now).
"'";
211 $sql .=
", '".$this->db->idate($now).
"'";
212 $sql .=
", ".((int) $user->id);
213 $sql .=
", ".((int) $account_id);
217 $sql .=
", ".((int)
$conf->entity);
220 $sql .=
", '".$this->db->escape($this->
type).
"'";
223 $resql = $this->db->query($sql);
225 $this->
id = $this->db->last_insert_id(MAIN_DB_PREFIX.
"bordereau_cheque");
226 if ($this->
id == 0) {
227 $this->errno = -1024;
228 dol_syslog(
"Remisecheque::Create Error read id ".$this->errno, LOG_ERR);
231 if ($this->
id > 0 && $this->errno == 0) {
232 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"bordereau_cheque";
233 $sql .=
" SET ref = '(PROV".$this->id.
")'";
234 $sql .=
" WHERE rowid=".((int) $this->
id);
236 $resql = $this->db->query($sql);
238 $this->errno = -1025;
239 dol_syslog(
"RemiseCheque::Create Error update ".$this->errno, LOG_ERR);
245 if ($this->
id > 0 && $this->errno == 0) {
246 $sql =
"SELECT b.rowid";
247 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank as b";
248 $sql .=
" WHERE b.fk_type = '".$this->db->escape($this->
type).
"'";
249 $sql .=
" AND b.amount > 0";
250 $sql .=
" AND b.fk_bordereau = 0";
251 $sql .=
" AND b.fk_account = ".((int) $account_id);
253 $sql .= $this->db->plimit($limit);
256 dol_syslog(
"RemiseCheque::Create", LOG_DEBUG);
257 $resql = $this->db->query($sql);
259 while ($row = $this->db->fetch_row($resql)) {
260 array_push($lines, $row[0]);
262 $this->db->free($resql);
264 $this->errno = -1026;
265 dol_syslog(
"RemiseCheque::Create Error ".$this->errno, LOG_ERR);
269 if ($this->
id > 0 && $this->errno == 0) {
270 foreach ($lines as $lineid) {
271 $checkremise =
false;
272 foreach ($toRemise as $linetoremise) {
273 if ($linetoremise == $lineid) {
279 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"bank";
280 $sql .=
" SET fk_bordereau = ".((int) $this->
id);
281 $sql .=
" WHERE rowid = ".((int) $lineid);
283 $resql = $this->db->query($sql);
286 dol_syslog(
"RemiseCheque::Create Error update bank ".$this->errno, LOG_ERR);
292 if ($this->
id > 0 && $this->errno == 0) {
294 $this->errno = -1027;
295 dol_syslog(
"RemiseCheque::Create Error update amount ".$this->errno, LOG_ERR);
300 $this->error = $this->db->lasterror();
311 dol_syslog(
"RemiseCheque::Create end", LOG_DEBUG);
314 $this->db->rollback();
315 dol_syslog(
"RemiseCheque::Create end", LOG_DEBUG);
326 public function delete($user)
334 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"bordereau_cheque";
335 $sql .=
" WHERE rowid = ".((int) $this->
id);
336 $sql .=
" AND entity = ".$conf->entity;
338 $resql = $this->db->query($sql);
340 $num = $this->db->affected_rows($resql);
344 dol_syslog(
"Remisecheque::Delete Erreur Lecture ID ($this->errno)");
347 if ($this->errno === 0) {
348 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"bank";
349 $sql .=
" SET fk_bordereau = 0";
350 $sql .=
" WHERE fk_bordereau = ".((int) $this->
id);
352 $resql = $this->db->query($sql);
354 $this->errno = -1028;
355 dol_syslog(
"RemiseCheque::Delete ERREUR UPDATE ($this->errno)");
360 if ($this->errno === 0) {
363 $this->db->rollback();
364 dol_syslog(
"RemiseCheque::Delete ROLLBACK ($this->errno)");
386 if ($this->errno == 0 && $numref) {
387 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"bordereau_cheque";
388 $sql .=
" SET statut = 1, ref = '".$this->db->escape($numref).
"'";
389 $sql .=
" WHERE rowid = ".((int) $this->
id);
390 $sql .=
" AND entity = ".((int)
$conf->entity);
391 $sql .=
" AND statut = 0";
393 dol_syslog(
"RemiseCheque::Validate", LOG_DEBUG);
394 $resql = $this->db->query($sql);
396 $num = $this->db->affected_rows($resql);
399 $this->
ref = $numref;
403 $this->errno = -1029;
404 dol_syslog(
"Remisecheque::validate Error ".$this->errno, LOG_ERR);
407 $this->errno = -1033;
408 $this->error = $this->db->lasterror();
409 dol_syslog(
"Remisecheque::validate Error ".$this->errno, LOG_ERR);
414 if ($this->errno == 0) {
418 $this->db->rollback();
419 dol_syslog(
"RemiseCheque::Validate ".$this->errno, LOG_ERR);
433 global
$conf, $db, $langs, $mysoc;
434 $langs->load(
"bills");
438 $conf->global->CHEQUERECEIPTS_ADDON =
'mod_chequereceipt_mint';
440 $conf->global->CHEQUERECEIPTS_ADDON =
'mod_chequereceipt_thyme';
442 $conf->global->CHEQUERECEIPTS_ADDON =
'mod_chequereceipt_mint';
452 $dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
454 foreach ($dirmodels as $reldir) {
458 if (is_file($dir.$file) && is_readable($dir.$file)) {
459 $mybool = (include_once $dir.$file) || $mybool;
467 $classname = preg_replace(
'/\-.*$/',
'', $classname);
469 foreach (
$conf->file->dol_document_root as $dirroot) {
470 $dir = $dirroot.
"/core/modules/cheque/";
473 if (is_file($dir.$file) && is_readable($dir.$file)) {
474 $mybool = (include_once $dir.$file) || $mybool;
484 $obj =
new $classname();
485 '@phan-var-force ModeleNumRefChequeReceipts $obj';
488 $numref = $obj->getNextValue($mysoc, $this);
494 if ($mode !=
'last' && !$numref) {
501 $langs->load(
"errors");
502 print $langs->trans(
"Error").
" ".$langs->trans(
"ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv(
"Bank"));
519 global
$conf, $langs;
525 $sql =
"SELECT b.rowid, b.datev as datefin";
526 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank as b";
527 $sql .=
", ".MAIN_DB_PREFIX.
"bank_account as ba";
528 $sql .=
" WHERE b.fk_account = ba.rowid";
529 $sql .=
" AND ba.entity IN (".getEntity(
'bank_account').
")";
530 $sql .=
" AND b.fk_type = '".$this->db->escape($type).
"'";
531 $sql .=
" AND b.fk_bordereau = 0";
532 $sql .=
" AND b.amount > 0";
534 $resql = $this->db->query($sql);
536 $langs->load(
"banks");
540 $response->warning_delay =
$conf->bank->cheque->warning_delay / 60 / 60 / 24;
541 $response->label = $langs->trans(
"BankChecksToReceipt");
542 $response->labelShort = $langs->trans(
"BankChecksToReceiptShort");
543 $response->url = DOL_URL_ROOT.
'/compta/paiement/cheque/index.php?leftmenu=checks&mainmenu=bank';
546 while ($obj = $this->db->fetch_object($resql)) {
549 if ($this->db->jdate($obj->datefin) < ($now -
$conf->bank->cheque->warning_delay)) {
550 $response->nbtodolate++;
557 $this->error = $this->db->error();
577 $sql =
"SELECT count(b.rowid) as nb";
578 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank as b";
579 $sql .=
", ".MAIN_DB_PREFIX.
"bank_account as ba";
580 $sql .=
" WHERE b.fk_account = ba.rowid";
581 $sql .=
" AND ba.entity IN (".getEntity(
'bank_account').
")";
582 $sql .=
" AND b.fk_type = '".$this->db->escape($type).
"'";
583 $sql .=
" AND b.amount > 0";
585 $resql = $this->db->query($sql);
587 while ($obj = $this->db->fetch_object($resql)) {
588 $this->nb[
"cheques"] = $obj->nb;
590 $this->db->free($resql);
594 $this->error = $this->db->error();
609 global $langs,
$conf;
615 dol_syslog(
"RemiseCheque::generatePdf model=".$model.
" id=".$this->id, LOG_DEBUG);
617 $dir = DOL_DOCUMENT_ROOT.
"/core/modules/cheque/doc/";
620 $file =
"pdf_".$model.
".class.php";
621 if (file_exists($dir.$file)) {
622 include_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
623 include_once $dir.$file;
625 $classname =
'BordereauCheque'.ucfirst($model);
626 $docmodel =
new $classname($this->db);
627 '@phan-var-force ModeleChequeReceipts $docmodel';
629 $sql =
"SELECT b.banque, b.emetteur, b.amount, b.num_chq";
630 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank as b";
631 $sql .=
", ".MAIN_DB_PREFIX.
"bank_account as ba";
632 $sql .=
", ".MAIN_DB_PREFIX.
"bordereau_cheque as bc";
633 $sql .=
" WHERE b.fk_account = ba.rowid";
634 $sql .=
" AND b.fk_bordereau = bc.rowid";
635 $sql .=
" AND bc.rowid = ".((int) $this->
id);
636 $sql .=
" AND bc.entity = ".$conf->entity;
637 $sql .=
" ORDER BY b.dateo ASC, b.rowid ASC";
639 dol_syslog(
"RemiseCheque::generatePdf", LOG_DEBUG);
640 $result = $this->db->query($sql);
643 while ($objp = $this->db->fetch_object($result)) {
644 $docmodel->lines[$i] =
new stdClass();
645 $docmodel->lines[$i]->bank_chq = $objp->banque;
646 $docmodel->lines[$i]->emetteur_chq = $objp->emetteur;
647 $docmodel->lines[$i]->amount_chq = $objp->amount;
648 $docmodel->lines[$i]->num_chq = $objp->num_chq;
652 $docmodel->nbcheque = $this->nbcheque;
653 $docmodel->ref = $this->ref;
654 $docmodel->amount = $this->amount;
655 $docmodel->date = $this->date_bordereau;
657 $account =
new Account($this->db);
658 $account->fetch($this->account_id);
660 $docmodel->account = &$account;
664 $sav_charset_output = $outputlangs->charset_output;
666 $result = $docmodel->write_file($this,
$conf->bank->dir_output.
'/checkdeposits', $this->ref, $outputlangs);
677 $this->error = $langs->trans(
"ErrorFileDoesNotExists", $dir.$file);
696 $sql =
"SELECT amount ";
697 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank";
698 $sql .=
" WHERE fk_bordereau = ".((int) $this->
id);
700 $resql = $this->db->query($sql);
702 while ($row = $this->db->fetch_row($resql)) {
707 $this->db->free($resql);
709 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"bordereau_cheque";
710 $sql .=
" SET amount = ".price2num($total);
711 $sql .=
", nbcheque = ".((int) $nb);
712 $sql .=
" WHERE rowid = ".((int) $this->
id);
713 $sql .=
" AND entity = ".((int)
$conf->entity);
715 $resql = $this->db->query($sql);
717 $this->errno = -1030;
718 dol_syslog(
"RemiseCheque::updateAmount ERREUR UPDATE ($this->errno)");
721 $this->errno = -1031;
722 dol_syslog(
"RemiseCheque::updateAmount ERREUR SELECT ($this->errno)");
725 if ($this->errno === 0) {
728 $this->db->rollback();
729 dol_syslog(
"RemiseCheque::updateAmount ROLLBACK ($this->errno)");
746 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"bank";
747 $sql .=
" SET fk_bordereau = 0";
748 $sql .=
" WHERE rowid = ".((int) $account_id);
749 $sql .=
" AND fk_bordereau = ".((int) $this->
id);
751 $resql = $this->db->query($sql);
755 $this->errno = -1032;
756 dol_syslog(
"RemiseCheque::removeCheck ERREUR UPDATE ($this->errno)");
775 $payment->fetch(0, 0, $bank_id);
778 $bankline->fetch($bank_id);
792 $bankaccount = $payment->fk_account;
795 $sql =
'SELECT pf.fk_facture, pf.amount';
796 $sql .=
' FROM '.MAIN_DB_PREFIX.
'paiement_facture as pf';
797 $sql .=
' WHERE pf.fk_paiement = '.((int) $payment->id);
799 $resql = $this->db->query($sql);
801 $rejectedPayment =
new Paiement($this->db);
802 $rejectedPayment->amounts = array();
803 $rejectedPayment->datepaye = $rejection_date;
804 $rejectedPayment->paiementid =
dol_getIdFromCode($this->db,
'CHQ',
'c_paiement',
'code',
'id', 1);
805 $rejectedPayment->num_payment = $payment->num_payment;
807 while ($obj = $this->db->fetch_object($resql)) {
808 $invoice =
new Facture($this->db);
809 $invoice->fetch($obj->fk_facture);
810 $invoice->setUnpaid($user);
812 $rejectedPayment->amounts[$obj->fk_facture] = (float)
price2num($obj->amount) * -1;
815 $result = $rejectedPayment->create($user);
818 $result = $rejectedPayment->addPaymentToBank($user,
'payment',
'(CheckRejected)', $bankaccount,
'',
'');
820 $result = $payment->reject();
823 return $rejectedPayment->id;
825 $this->db->rollback();
829 $this->error = $rejectedPayment->error;
830 $this->errors = $rejectedPayment->errors;
831 $this->db->rollback();
835 $this->error = $rejectedPayment->error;
836 $this->errors = $rejectedPayment->errors;
837 $this->db->rollback();
841 $this->error = $this->db->lasterror();
842 $this->db->rollback();
858 if ($user->hasRight(
'banque',
'cheque')) {
859 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"bordereau_cheque";
860 $sql .=
" SET date_bordereau = ".($date ?
"'".$this->db->idate($date).
"'" :
'null');
861 $sql .=
" WHERE rowid = ".((int) $this->
id);
863 dol_syslog(
"RemiseCheque::set_date", LOG_DEBUG);
864 $resql = $this->db->query($sql);
866 $this->date_bordereau = $date;
869 $this->error = $this->db->error();
888 if ($user->hasRight(
'banque',
'cheque')) {
889 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"bordereau_cheque";
890 $sql .=
" SET ref = '".$this->db->escape($ref).
"'";
891 $sql .=
" WHERE rowid = ".((int) $this->
id);
893 dol_syslog(
"RemiseCheque::set_number", LOG_DEBUG);
894 $resql = $this->db->query($sql);
898 $this->error = $this->db->error();
916 global $user, $langs,
$conf;
920 $nownotime =
dol_mktime(0, 0, 0, $arraynow[
'mon'], $arraynow[
'mday'], $arraynow[
'year']);
924 $this->
ref =
'SPECIMEN';
926 $this->date_bordereau = $nownotime;
941 public function getNomUrl($withpicto = 0, $option =
'', $notooltip = 0, $morecss =
'', $save_lastsearch_value = -1)
943 global
$conf, $langs;
947 $label =
'<u>'.$langs->trans(
"ShowCheckReceipt").
'</u>';
949 $label .=
'<b>'.$langs->trans(
'Ref').
':</b> '.$this->ref;
951 $url = DOL_URL_ROOT.
'/compta/paiement/cheque/card.php?id='.$this->id;
953 if ($option !=
'nolink') {
955 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
956 if ($save_lastsearch_value == -1 && isset($_SERVER[
"PHP_SELF"]) && preg_match(
'/list\.php/', $_SERVER[
"PHP_SELF"])) {
957 $add_save_lastsearch_values = 1;
959 if ($add_save_lastsearch_values) {
960 $url .=
'&save_lastsearch_values=1';
965 if (empty($notooltip)) {
967 $label = $langs->trans(
"ShowCheckReceipt");
968 $linkclose .=
' alt="'.dolPrintHTMLForAttribute($label).
'"';
970 $linkclose .=
' title="'.dolPrintHTMLForAttribute($label).
'"';
971 $linkclose .=
' class="classfortooltip'.($morecss ?
' '.$morecss :
'').
'"';
973 $linkclose = ($morecss ?
' class="'.$morecss.
'"' :
'');
976 $linkstart =
'<a href="'.$url.
'"';
977 $linkstart .= $linkclose.
'>';
980 $result .= $linkstart;
982 $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);
984 if ($withpicto != 2) {
985 $result .= $this->ref;
1000 return $this->
LibStatut($this->statut, $mode);
1014 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
1016 $langs->load(
'compta');
1017 $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'ToValidate');
1018 $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Validated');
1019 $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'ToValidate');
1020 $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Validated');
1023 $statusType =
'status'.$status;
1024 if ($status == self::STATUS_VALIDATED) {
1025 $statusType =
'status4';
1028 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status],
'', $statusType, $mode);
1042 $selected = (empty($arraydata[
'selected']) ? 0 : $arraydata[
'selected']);
1044 $return =
'<div class="box-flex-item box-flex-grow-zero">';
1045 $return .=
'<div class="info-box info-box-sm">';
1046 $return .=
'<span class="info-box-icon bg-infobox-action">';
1048 $return .=
'</span>';
1049 $return .=
'<div class="info-box-content">';
1050 $return .=
'<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this,
'getNomUrl') ? $this->
getNomUrl() : $this->ref).
'</span>';
1051 if ($selected >= 0) {
1052 $return .=
'<input id="cb'.$this->id.
'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->
id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1054 if (property_exists($this,
'date_bordereau')) {
1055 $return .=
'<br><span class="opacitymedium">'.$langs->trans(
"DateCreation").
'</span> : <span class="info-box-label">'.
dol_print_date($this->db->jdate($this->date_bordereau),
'day').
'</span>';
1057 if (property_exists($this,
'nbcheque')) {
1058 $return .=
'<br><span class="opacitymedium">'.$langs->trans(
"Cheque",
'',
'',
'',
'', 5).
'</span> : <span class="info-box-label">'.$this->nbcheque.
'</span>';
1060 if (property_exists($this,
'account_id')) {
1061 $return .=
' | <span class="info-box-label">'.$this->account_id.
'</span>';
1063 if (method_exists($this,
'LibStatut')) {
1064 $return .=
'<br><div style="display:inline-block" class="info-box-status margintoponly">'.$this->getLibStatut(3).
'</div>';
1066 if (property_exists($this,
'amount')) {
1067 $return .=
' | <div style="display:inline-block"><span class="opacitymedium">'.$langs->trans(
"Amount").
'</span> : <span class="amount">'.
price($this->amount).
'</div>';
1069 $return .=
'</div>';
1070 $return .=
'</div>';
1071 $return .=
'</div>';
Class to manage bank accounts.
Class to manage bank transaction lines.
Parent class of all other business classes (invoices, contracts, proposals, orders,...
Class to manage invoices.
Class to manage payments of customer invoices.
Class to manage cheque delivery receipts.
removeCheck($account_id)
Insere la remise en base.
getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
Return clickable name (with picto eventually)
getKanbanView($option='', $arraydata=null)
Return clickable link of object (with eventually picto)
generatePdf($model, $outputlangs)
Build document.
LibStatut($status, $mode=0)
Return the label of a given status.
__construct($db)
Constructor.
getLibStatut($mode=0)
Return the label of the status.
set_date($user, $date)
Set the creation date.
rejectCheck($bank_id, $rejection_date)
Check return management Reopen linked invoices and create a new negative payment.
validate($user)
Validate a receipt.
set_number($user, $ref)
Set the ref of bordereau.
load_board($user, $type='CHQ')
Load indicators for dashboard (this->nbtodo and this->nbtodolate)
getNextNumRef($mode='next')
Return next reference of cheque receipts not already used (or last reference) according to numbering ...
fetch($id, $ref='')
Load record.
loadStateBoard($type='CHQ')
Load indicators this->nb for the state board.
create($user, $account_id, $limit, $toRemise)
Create a receipt to send cheques.
updateAmount()
Mets a jour le montant total.
initAsSpecimen($option='')
Initialise an instance with random values.
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_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='', $useCache=true)
Return an id or code from a code or id.
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)
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_now($mode='auto')
Return date for now.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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...
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.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type