34require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobject.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/class/commonpeople.class.php';
48 public $element =
'don';
53 public $table_element =
'don';
58 public $fk_element =
'fk_donation';
63 public $picto =
'donation';
129 public $phone_mobile;
134 public $mode_reglement;
139 public $mode_reglement_code;
154 public $fk_typepayment;
165 public $modepaymentid = 0;
177 const STATUS_DRAFT = 0;
178 const STATUS_VALIDATED = 1;
179 const STATUS_PAID = 2;
180 const STATUS_CANCELED = -1;
192 $this->ismultientitymanaged = 1;
218 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
220 $langs->load(
"donations");
221 $this->labelStatus[-1] = $langs->transnoentitiesnoconv(
"Canceled");
222 $this->labelStatus[0] = $langs->transnoentitiesnoconv(
"DonationStatusPromiseNotValidated");
223 $this->labelStatus[1] = $langs->transnoentitiesnoconv(
"DonationStatusPromiseValidated");
224 $this->labelStatus[2] = $langs->transnoentitiesnoconv(
"DonationStatusPaid");
225 $this->labelStatusShort[-1] = $langs->transnoentitiesnoconv(
"Canceled");
226 $this->labelStatusShort[0] = $langs->transnoentitiesnoconv(
"DonationStatusPromiseNotValidatedShort");
227 $this->labelStatusShort[1] = $langs->transnoentitiesnoconv(
"DonationStatusPromiseValidatedShort");
228 $this->labelStatusShort[2] = $langs->transnoentitiesnoconv(
"DonationStatusPaidShort");
231 $statusType =
'status'.$status;
232 if ($status == self::STATUS_CANCELED) {
233 $statusType =
'status9';
235 if ($status == self::STATUS_PAID) {
236 $statusType =
'status6';
239 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status],
'', $statusType, $mode);
259 $sql =
"SELECT rowid";
260 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe";
261 $sql .=
" WHERE client IN (1, 3)";
262 $sql .=
" AND entity = ".((int)
$conf->entity);
265 $resql = $this->db->query($sql);
267 $num_socs = $this->db->num_rows($resql);
269 while ($i < $num_socs) {
270 $row = $this->db->fetch_row($resql);
271 $socids[$i] = $row[0];
279 $this->
ref =
'SPECIMEN';
281 $this->lastname =
'Doe';
282 $this->firstname =
'John';
283 $this->socid = empty($socids[0]) ? 0 : $socids[0];
285 $this->date_valid = $now;
288 $this->societe =
'The Company';
290 $this->zip =
'99999';
291 $this->town =
'Town';
292 $this->note_private =
'Private note';
293 $this->note_public =
'Public note';
294 $this->
email =
'email@email.com';
295 $this->phone =
'0123456789';
296 $this->phone_mobile =
'0606060606';
313 $langs->load(
'main');
314 $langs->load(
'companies');
316 $error_string = array();
320 if (
dol_strlen(trim((
string) $this->societe)) == 0) {
321 if ((
dol_strlen(trim((
string) $this->lastname)) +
dol_strlen(trim((
string) $this->firstname))) == 0) {
322 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Company').
'/'.$langs->transnoentitiesnoconv(
'Firstname').
'-'.$langs->transnoentitiesnoconv(
'Lastname'));
328 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Address'));
332 if (
dol_strlen(trim((
string) $this->zip)) == 0) {
333 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Zip'));
337 if (
dol_strlen(trim((
string) $this->town)) == 0) {
338 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Town'));
343 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'EMail'));
351 for ($i = 0; $i < $len; $i++) {
352 if (!isset($map[substr((
string) $this->amount, $i, 1)])) {
353 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Amount'));
360 if (!$amount_invalid) {
361 if ($this->amount == 0) {
362 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Amount'));
366 $error_string[] = $langs->trans(
'ErrorMinimumAmount', $minimum);
373 $this->errors = $error_string;
388 public function create($user, $notrigger = 0)
390 global
$conf, $langs;
406 $this->error = $langs->trans(
'FieldCannotBeNegative', $langs->transnoentitiesnoconv(
"Amount"));
412 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"don (";
416 $sql .=
", fk_payment";
418 $sql .=
", firstname";
419 $sql .=
", lastname";
424 $sql .=
", fk_country";
426 $sql .=
", fk_projet";
427 $sql .=
", note_private";
428 $sql .=
", note_public";
429 $sql .=
", fk_user_author";
430 $sql .=
", fk_user_valid";
434 $sql .=
", phone_mobile";
436 $sql .=
") VALUES (";
437 $sql .=
"'".$this->db->idate($this->
date ? $this->
date : $now).
"'";
438 $sql .=
", ".((int)
$conf->entity);
439 $sql .=
", ".((float) $this->
amount);
440 $sql .=
", ".($this->modepaymentid ? ((int) $this->modepaymentid) :
"null");
441 $sql .=
", ".($this->socid > 0 ? ((int) $this->socid) :
"null");
442 $sql .=
", '".$this->db->escape($this->firstname).
"'";
443 $sql .=
", '".$this->db->escape($this->lastname).
"'";
444 $sql .=
", '".$this->db->escape($this->societe).
"'";
445 $sql .=
", '".$this->db->escape((
string) $this->
address).
"'";
446 $sql .=
", '".$this->db->escape((
string) $this->zip).
"'";
447 $sql .=
", '".$this->db->escape((
string) $this->town).
"'";
448 $sql .=
", ".(int) ($this->country_id > 0 ? $this->country_id : 0);
449 $sql .=
", ".(int) $this->
public;
450 $sql .=
", ".($this->fk_project > 0 ? (int) $this->fk_project :
"null");
451 $sql .=
", ".(!empty($this->note_private) ? (
"'".$this->db->escape($this->note_private).
"'") :
"NULL");
452 $sql .=
", ".(!empty($this->note_public) ? (
"'".$this->db->escape($this->note_public).
"'") :
"NULL");
453 $sql .=
", ".((int) $user->id);
455 $sql .=
", '".$this->db->idate($this->
date).
"'";
456 $sql .=
", '".(!empty($this->
email) ? $this->db->escape(trim($this->
email)) :
"").
"'";
457 $sql .=
", '".(!empty($this->phone) ? $this->db->escape(trim($this->phone)) :
"").
"'";
458 $sql .=
", '".(!empty($this->phone_mobile) ? $this->db->escape(trim($this->phone_mobile)) :
"").
"'";
459 $sql .=
", '".(!empty($this->ip) ? $this->db->escape($this->ip) :
"null").
"'";
462 $resql = $this->db->query($sql);
464 $this->
id = $this->db->last_insert_id(MAIN_DB_PREFIX.
"don");
469 $result = $this->call_trigger(
'DON_CREATE', $user);
476 $this->error = $this->db->lasterror();
497 $this->db->rollback();
509 public function update($user, $notrigger = 0)
525 $this->error = $langs->trans(
'FieldCannotBeNegative', $langs->transnoentitiesnoconv(
"Amount"));
531 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"don SET";
532 $sql .=
" amount = ".((float) $this->
amount);
533 $sql .=
", fk_payment = ".($this->modepaymentid ? ((int) $this->modepaymentid) :
"null");
534 $sql .=
", firstname = '".$this->db->escape($this->firstname).
"'";
535 $sql .=
", lastname='".$this->db->escape($this->lastname).
"'";
536 $sql .=
", societe='".$this->db->escape($this->societe).
"'";
537 $sql .=
", address='".$this->db->escape((
string) $this->
address).
"'";
538 $sql .=
", zip='".$this->db->escape((
string) $this->zip).
"'";
539 $sql .=
", town='".$this->db->escape((
string) $this->town).
"'";
540 $sql .=
", fk_country = ".($this->country_id > 0 ? ((int) $this->country_id) :
'0');
541 $sql .=
", public=".((int) $this->
public);
542 $sql .=
", fk_projet=".($this->fk_project > 0 ? ((int) $this->fk_project) :
'null');
543 $sql .=
", note_private=".(!empty($this->note_private) ? (
"'".$this->db->escape($this->note_private).
"'") :
"NULL");
544 $sql .=
", note_public=".(!empty($this->note_public) ? (
"'".$this->db->escape($this->note_public).
"'") :
"NULL");
545 $sql .=
", datedon='".$this->db->idate($this->
date).
"'";
546 $sql .=
", date_valid=".($this->date_valid ?
"'".$this->db->idate($this->
date).
"'" :
"null");
547 $sql .=
", email='".$this->db->escape(trim((
string) $this->
email)).
"'";
548 $sql .=
", phone='".$this->db->escape(trim((
string) $this->phone)).
"'";
549 $sql .=
", phone_mobile='".$this->db->escape(trim((
string) $this->phone_mobile)).
"'";
550 $sql .=
", fk_statut=".((int) $this->
status);
551 $sql .=
" WHERE rowid = ".((int) $this->
id);
553 dol_syslog(get_class($this).
"::Update", LOG_DEBUG);
554 $resql = $this->db->query($sql);
558 $result = $this->call_trigger(
'DON_MODIFY', $user);
577 $this->db->rollback();
581 $this->error = $this->db->lasterror();
582 $this->errors[] = $this->error;
583 $this->db->rollback();
584 dol_syslog(get_class($this).
"::Update error -2 ".$this->error, LOG_ERR);
597 public function delete($user, $notrigger = 0)
599 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
607 $result = $this->call_trigger(
'DON_DELETE', $user);
617 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"don_extrafields";
618 $sql .=
" WHERE fk_object = ".((int) $this->
id);
620 $resql = $this->db->query($sql);
622 $this->errors[] = $this->db->lasterror();
628 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"don";
629 $sql .=
" WHERE rowid=".((int) $this->
id);
631 $resql = $this->db->query($sql);
633 $this->errors[] = $this->db->lasterror();
639 $dir = DOL_DATA_ROOT.
'/'.$this->element.
'/'.$this->ref;
643 $this->errors[] =
'ErrorFailToDeleteDir';
653 foreach ($this->errors as $errmsg) {
654 dol_syslog(get_class($this).
"::delete ".$errmsg, LOG_ERR);
655 $this->error .= ($this->error ?
', '.$errmsg : $errmsg);
657 dol_syslog(get_class($this).
"::delete ".$this->error, LOG_ERR);
658 $this->db->rollback();
670 public function fetch($id, $ref =
'')
672 $sql =
"SELECT d.rowid, d.entity, d.datec, d.date_valid, d.tms as datem, d.datedon,";
673 $sql .=
" d.fk_soc as socid, d.firstname, d.lastname, d.societe, d.amount, d.fk_statut as status, d.address, d.zip, d.town, ";
674 $sql .=
" d.fk_country, d.public, d.amount, d.fk_payment, d.paid, d.note_private, d.note_public, d.email, d.phone, ";
675 $sql .=
" d.phone_mobile, d.fk_projet as fk_project, d.model_pdf,";
676 $sql .=
" p.ref as project_ref,";
677 $sql .=
" cp.libelle as payment_label, cp.code as payment_code,";
678 $sql .=
" c.code as country_code, c.label as country";
679 $sql .=
" FROM ".MAIN_DB_PREFIX.
"don as d";
680 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = d.fk_projet";
681 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as cp ON cp.id = d.fk_payment";
682 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as c ON d.fk_country = c.rowid";
683 $sql .=
" WHERE d.entity IN (".getEntity(
'donation').
")";
685 $sql .=
" AND d.rowid=".((int) $id);
686 } elseif (!empty($ref)) {
687 $sql .=
" AND d.ref='".$this->db->escape($ref).
"'";
690 dol_syslog(get_class($this).
"::fetch", LOG_DEBUG);
691 $resql = $this->db->query($sql);
693 if ($this->db->num_rows($resql)) {
694 $obj = $this->db->fetch_object($resql);
696 $this->
id = $obj->rowid;
697 $this->entity = $obj->entity;
698 $this->
ref = $obj->rowid;
699 $this->date_creation = $this->db->jdate($obj->datec);
700 $this->datec = $this->db->jdate($obj->datec);
701 $this->date_validation = $this->db->jdate($obj->date_valid);
702 $this->date_valid = $this->db->jdate($obj->date_valid);
703 $this->date_modification = $this->db->jdate($obj->datem);
704 $this->datem = $this->db->jdate($obj->datem);
705 $this->
date = $this->db->jdate($obj->datedon);
706 $this->socid = $obj->socid;
707 $this->firstname = $obj->firstname;
708 $this->lastname = $obj->lastname;
709 $this->societe = $obj->societe;
710 $this->
status = $obj->status;
711 $this->statut = $obj->status;
712 $this->
address = $obj->address;
713 $this->zip = $obj->zip;
714 $this->town = $obj->town;
715 $this->country_id = $obj->fk_country;
716 $this->country_code = $obj->country_code;
717 $this->country = $obj->country;
718 $this->
email = $obj->email;
719 $this->phone = $obj->phone;
720 $this->phone_mobile = $obj->phone_mobile;
721 $this->project = $obj->project_ref;
722 $this->fk_projet = $obj->fk_project;
723 $this->fk_project = $obj->fk_project;
724 $this->
public = $obj->public;
725 $this->mode_reglement_id = $obj->fk_payment;
726 $this->mode_reglement_code = $obj->payment_code;
727 $this->mode_reglement = $obj->payment_label;
728 $this->paid = $obj->paid;
729 $this->
amount = $obj->amount;
730 $this->note_private = $obj->note_private;
731 $this->note_public = $obj->note_public;
732 $this->model_pdf = $obj->model_pdf;
740 dol_print_error($this->db);
776 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"don SET fk_statut = 1, fk_user_valid = ".((int) $userid).
" WHERE rowid = ".((int) $id).
" AND fk_statut = 0";
778 $resql = $this->db->query($sql);
780 if ($this->db->affected_rows($resql)) {
783 $result = $this->call_trigger(
'DON_VALIDATE', $user);
792 $this->error = $this->db->lasterror();
800 $this->db->rollback();
812 public function setPaid($id, $modepayment = 0)
814 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"don SET fk_statut = 2, paid = 1";
816 $sql .=
", fk_payment = ".((int) $modepayment);
818 $sql .=
" WHERE rowid = ".((int) $id).
" AND fk_statut = 1";
820 $resql = $this->db->query($sql);
822 if ($this->db->affected_rows($resql)) {
830 dol_print_error($this->db);
852 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"don SET fk_statut = -1 WHERE rowid = ".((int) $id);
854 $resql = $this->db->query($sql);
856 if ($this->db->affected_rows($resql)) {
861 $result = $this->call_trigger(
'DON_CANCEL', $user);
872 $this->error = $this->db->error();
880 $this->db->rollback();
892 public function reopen($user, $notrigger = 0)
895 if ($this->
status != self::STATUS_CANCELED && $this->
status != self::STATUS_PAID) {
898 if ($this->statut == self::STATUS_PAID) {
899 $sql =
"UPDATE " . MAIN_DB_PREFIX .
"don SET paid = 0 WHERE rowid = " . ((int) $this->
id);
901 $resql = $this->db->query($sql);
903 if ($this->db->affected_rows($resql)) {
906 dol_print_error($this->db);
912 return $this->
setStatusCommon($user, self::STATUS_VALIDATED, $notrigger,
'DON_REOPEN');
929 $sql =
"SELECT sum(amount) as total";
930 $sql .=
" FROM ".MAIN_DB_PREFIX.
"don";
931 $sql .=
" WHERE fk_statut = ".((int) $param);
932 $sql .=
" AND entity = ".((int)
$conf->entity);
934 $resql = $this->db->query($sql);
936 $obj = $this->db->fetch_object($resql);
937 $result = $obj->total;
952 $sql =
"SELECT count(d.rowid) as nb";
953 $sql .=
" FROM ".MAIN_DB_PREFIX.
"don as d";
954 $sql .=
" WHERE d.fk_statut > 0";
955 $sql .=
" AND d.entity IN (".getEntity(
'donation').
")";
957 $resql = $this->db->query($sql);
959 while ($obj = $this->db->fetch_object($resql)) {
960 $this->nb[
"donations"] = $obj->nb;
962 $this->db->free($resql);
965 dol_print_error($this->db);
966 $this->error = $this->db->error();
980 public function getNomUrl($withpicto = 0, $notooltip = 0, $moretitle =
'', $save_lastsearch_value = -1)
982 global
$conf, $langs, $hookmanager;
984 if (!empty(
$conf->dol_no_mouse_hover)) {
989 $label = img_picto(
'', $this->picto).
' <u class="paddingrightonly">'.$langs->trans(
"Donation").
'</u>';
990 if (isset($this->
status)) {
991 $label .=
' '.$this->getLibStatut(5);
993 if (!empty($this->
id)) {
994 $label .=
'<br><b>'.$langs->trans(
'Ref').
':</b> '.$this->id;
995 $label .=
'<br><b>'.$langs->trans(
'Date').
':</b> '.
dol_print_date($this->
date,
'day');
998 $label .=
' - '.$moretitle;
1001 $url = DOL_URL_ROOT.
'/don/card.php?id='.$this->id;
1003 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
1004 if ($save_lastsearch_value == -1 && isset($_SERVER[
"PHP_SELF"]) && preg_match(
'/list\.php/', $_SERVER[
"PHP_SELF"])) {
1005 $add_save_lastsearch_values = 1;
1007 if ($add_save_lastsearch_values) {
1008 $url .=
'&save_lastsearch_values=1';
1011 $linkstart =
'<a href="'.$url.
'" title="'.
dol_escape_htmltag($label, 1).
'" class="classfortooltip">';
1014 $result .= $linkstart;
1016 $result .= img_object(($notooltip ?
'' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ?
'class="paddingright"' :
'') :
'class="'.(($withpicto != 2) ?
'paddingright ' :
'').
'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
1018 if ($withpicto != 2) {
1019 $result .= $this->ref;
1021 $result .= $linkend;
1023 $hookmanager->initHooks(array($this->element .
'dao'));
1024 $parameters = array(
'id' => $this->
id,
'getnomurl' => &$result);
1025 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
1027 $result = $hookmanager->resPrint;
1029 $result .= $hookmanager->resPrint;
1042 $sql =
'SELECT d.rowid, d.datec, d.fk_user_author, d.fk_user_valid,';
1043 $sql .=
' d.tms as datem';
1044 $sql .=
' FROM '.MAIN_DB_PREFIX.
'don as d';
1045 $sql .=
' WHERE d.rowid = '.((int) $id);
1047 dol_syslog(get_class($this).
'::info', LOG_DEBUG);
1048 $result = $this->db->query($sql);
1051 if ($this->db->num_rows($result)) {
1052 $obj = $this->db->fetch_object($result);
1053 $this->
id = $obj->rowid;
1055 $this->user_creation_id = $obj->fk_user_author;
1056 $this->user_validation_id = $obj->fk_user_valid;
1057 $this->date_creation = $this->db->jdate($obj->datec);
1058 $this->date_modification = (!empty($obj->tms) ? $this->db->jdate($obj->tms) :
"");
1060 $this->db->free($result);
1062 dol_print_error($this->db);
1077 public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
1079 global
$conf, $langs;
1081 $langs->load(
"bills");
1084 $modele =
'html_cerfafr';
1086 if ($this->model_pdf) {
1087 $modele = $this->model_pdf;
1099 $err = error_reporting();
1101 @set_time_limit(120);
1102 error_reporting($err);
1104 $srctemplatepath =
'';
1107 $tmp = explode(
':', $modele, 2);
1108 if (!empty($tmp[1])) {
1110 $srctemplatepath = $tmp[1];
1118 $modelebasename = preg_replace(
'/^(html|doc|pdf)_/',
'', $modele);
1119 $dirmodels = array_merge([
'/'], (array)
$conf->modules_parts[
'models']);
1120 foreach ($dirmodels as $reldir) {
1121 foreach (array(
'html',
'doc',
'pdf') as $prefix) {
1122 if ($modelebasename != $modele && strpos($modele, $prefix.
'_') !== 0) {
1128 $file =
dol_buildpath($reldir.
"core/modules/dons/".$file, 0);
1129 if (file_exists($file)) {
1131 $modele = $prefix.
'_'.$modelebasename;
1146 $classname = $modele;
1147 $obj =
new $classname($this->db);
1149 '@phan-var-force ModeleDon $obj';
1153 $sav_charset_output = $outputlangs->charset_output;
1154 if ($obj->write_file(
$object, $outputlangs ) > 0) {
1155 $outputlangs->charset_output = $sav_charset_output;
1158 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
1162 if (!empty($obj->result[
'fullpath'])) {
1165 $this->
indexFile($obj->result[
'fullpath'], (empty($obj->update_main_doc_field) ? 0 : 1));
1168 dol_syslog(
'Method ->write_file was called on object '.get_class($obj).
' and return a success but the return array ->result["fullpath"] was not set.', LOG_WARNING);
1173 $outputlangs->charset_output = $sav_charset_output;
1175 dol_print_error($this->db, $obj->error);
1179 print $langs->trans(
"Error").
" ".$langs->trans(
"ErrorFileDoesNotExists", $file);
1210 if (empty($this->
id)) {
1211 $this->error =
'Missing object id';
1212 $this->errors[] = $this->error;
1213 dol_syslog(__METHOD__.
' : '.$this->error, LOG_ERR);
1217 $sql =
"SELECT SUM(amount) as sum_amount FROM ".MAIN_DB_PREFIX.
"payment_donation WHERE fk_donation = ".((int) $this->
id);
1218 $resql = $this->db->query($sql);
1220 dol_print_error($this->db);
1223 $sum_amount = (float) $this->db->fetch_object($resql)->sum_amount;
1224 return (
float) ($this->
amount - $sum_amount);
1237 global
$conf, $langs;
1239 $selected = (empty($arraydata[
'selected']) ? 0 : $arraydata[
'selected']);
1241 $return =
'<div class="box-flex-item box-flex-grow-zero">';
1242 $return .=
'<div class="info-box info-box-sm">';
1243 $return .=
'<span class="info-box-icon bg-infobox-action">';
1244 $return .= img_picto(
'', $this->picto);
1245 $return .=
'</span>';
1246 $return .=
'<div class="info-box-content">';
1247 $return .=
'<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">' . $this->
getNomUrl(1) .
'</span>';
1248 if ($selected >= 0) {
1249 $return .=
'<input id="cb'.$this->id.
'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->
id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1252 $return .=
' | <span class="info-box-label">'.dol_print_date($this->
date,
'day',
'tzuserrel').
'</span>';
1254 if (!empty($this->societe)) {
1255 $return .=
'<br><span class="opacitymedium">'.$langs->trans(
"Company").
'</span> : <span class="info-box-label">'.$this->societe.
'</span>';
1257 if (!empty($this->
amount)) {
1258 $return .=
'<br><span class="info-box-label amount">'.price($this->
amount, 1, $langs, 1, -1, -1,
getDolCurrency()).
'</span>';
1260 if (isset($this->
status)) {
1261 $return .=
'<br><div class="info-box-status">'.$this->getLibStatut(3).
'</div>';
1263 $return .=
'</div>';
1264 $return .=
'</div>';
1265 $return .=
'</div>';
if(! $sortfield) if(! $sortorder) $object
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
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...
indexFile($destfull, $update_main_doc_field)
Index a file into the ECM database.
deleteEcmFiles($mode=0)
Delete related files of object in database.
setStatusCommon($user, $status, $notrigger=0, $triggercode='')
Set to a status.
static commonReplaceThirdparty(DoliDB $dbs, $origin_id, $dest_id, array $tables, $ignoreerrors=0)
Function used to replace a thirdparty id with another one.
insertExtraFields($trigger='', $userused=null)
Add/Update all extra fields values for the current object.
Class to manage Dolibarr database access.
Class to manage donations.
getLibStatut($mode=0)
Returns the donation status label (draft, valid, abandoned, paid)
__construct($db)
Constructor.
initAsSpecimen()
Initialise an instance with random values.
create($user, $notrigger=0)
Create donation record into database.
getRemainToPay()
Function to get remaining amount to pay for a donation.
check($minimum=0)
Check params and init ->errors array.
setValid($user, $notrigger=0)
Validate a intervention.
valid_promesse($id, $userid, $notrigger=0)
Validate a promise of donation.
getKanbanView($option='', $arraydata=null)
Return clickable link of object (with eventually picto)
LibStatut($status, $mode=0)
Return the label of a given status.
static replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id)
Function used to replace a thirdparty id with another one.
fetch($id, $ref='')
Load donation from database.
reopen($user, $notrigger=0)
Set cancel status.
sum_donations($param)
Sum of donations.
info($id)
Information on record.
update($user, $notrigger=0)
Update a donation record.
set_cancel($id, $notrigger=0)
Set donation to status cancelled.
loadStateBoard()
Load the indicators this->nb for the state board.
setPaid($id, $modepayment=0)
Classify the donation as paid, the donation was received.
getNomUrl($withpicto=0, $notooltip=0, $moretitle='', $save_lastsearch_value=-1)
Return clickable name (with picto eventually)
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...
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as p label as s rowid as s nom as s email
Sender: Who sends the email ("Sender" has sent emails on behalf of "From").
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0, $level=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
dol_is_file($pathoffile)
Return if path is a file.
dol_is_dir($folder)
Test if filename is a directory.
dol_delete_preview($object)
Delete all preview files linked to object instance.
dol_now($mode='gmt')
Return date for now.
price2num($amount, $rounding='', $option=0, $currencycode='')
Function that return a number with universal decimal format (decimal separator is '.
dol_strlen($string, $stringencoding='UTF-8', $binarycount=0)
Make a strlen call.
isDolTms($timestamp)
isDolTms check if a timestamp is valid.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
getDolCurrency()
Return the main currency ('EUR', 'USD', ...)
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
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_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
print $langs trans('Date')." left Ref Label right Qty right Price right TotalHT right TotalTTC right right right right right right right right right centpercent right TotalHT right n right VAT right n right TotalVAT right n No sujeto a RE IRPF right TotalLT1 right n right TotalLT2 right n right TotalTTC right n takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency right TotalTTC takeposcustomercurrency right takeposcustomercurrency n right Paid right PaymentTypeShortLIQ right SELECT p pos_change as p datep as p p num_paiement as f pf amount as amount
print $langs trans('Date')." left Ref Label right Qty right Price right TotalHT right TotalTTC right right right right right right right right right centpercent right TotalHT right n right VAT right n right TotalVAT right n No sujeto a RE IRPF right TotalLT1 right n right TotalLT2 right n right TotalTTC right n takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency right TotalTTC takeposcustomercurrency right takeposcustomercurrency n right Paid right PaymentTypeShortLIQ right SELECT p pos_change as p datep as date
div refaddress div address