33require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobject.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/commonpeople.class.php';
47 public $element =
'don';
52 public $table_element =
'don';
57 public $fk_element =
'fk_donation';
62 public $picto =
'donation';
128 public $phone_mobile;
133 public $mode_reglement;
138 public $mode_reglement_code;
153 public $fk_typepayment;
164 public $modepaymentid = 0;
176 const STATUS_DRAFT = 0;
177 const STATUS_VALIDATED = 1;
178 const STATUS_PAID = 2;
179 const STATUS_CANCELED = -1;
191 $this->ismultientitymanaged = 1;
217 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
219 $langs->load(
"donations");
220 $this->labelStatus[-1] = $langs->transnoentitiesnoconv(
"Canceled");
221 $this->labelStatus[0] = $langs->transnoentitiesnoconv(
"DonationStatusPromiseNotValidated");
222 $this->labelStatus[1] = $langs->transnoentitiesnoconv(
"DonationStatusPromiseValidated");
223 $this->labelStatus[2] = $langs->transnoentitiesnoconv(
"DonationStatusPaid");
224 $this->labelStatusShort[-1] = $langs->transnoentitiesnoconv(
"Canceled");
225 $this->labelStatusShort[0] = $langs->transnoentitiesnoconv(
"DonationStatusPromiseNotValidatedShort");
226 $this->labelStatusShort[1] = $langs->transnoentitiesnoconv(
"DonationStatusPromiseValidatedShort");
227 $this->labelStatusShort[2] = $langs->transnoentitiesnoconv(
"DonationStatusPaidShort");
230 $statusType =
'status'.$status;
231 if ($status == self::STATUS_CANCELED) {
232 $statusType =
'status9';
234 if ($status == self::STATUS_PAID) {
235 $statusType =
'status6';
238 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status],
'', $statusType, $mode);
258 $sql =
"SELECT rowid";
259 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe";
260 $sql .=
" WHERE client IN (1, 3)";
261 $sql .=
" AND entity = ".$conf->entity;
264 $resql = $this->db->query($sql);
266 $num_socs = $this->db->num_rows($resql);
268 while ($i < $num_socs) {
269 $row = $this->db->fetch_row($resql);
270 $socids[$i] = $row[0];
278 $this->
ref =
'SPECIMEN';
280 $this->lastname =
'Doe';
281 $this->firstname =
'John';
282 $this->socid = empty($socids[0]) ? 0 : $socids[0];
284 $this->date_valid = $now;
287 $this->societe =
'The Company';
289 $this->zip =
'99999';
290 $this->town =
'Town';
291 $this->note_private =
'Private note';
292 $this->note_public =
'Public note';
293 $this->
email =
'email@email.com';
294 $this->phone =
'0123456789';
295 $this->phone_mobile =
'0606060606';
312 $langs->load(
'main');
313 $langs->load(
'companies');
315 $error_string = array();
321 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Company').
'/'.$langs->transnoentitiesnoconv(
'Firstname').
'-'.$langs->transnoentitiesnoconv(
'Lastname'));
327 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Address'));
332 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Zip'));
337 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Town'));
342 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'EMail'));
350 for ($i = 0; $i < $len; $i++) {
351 if (!isset($map[substr((
string) $this->amount, $i, 1)])) {
352 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Amount'));
359 if (!$amount_invalid) {
360 if ($this->amount == 0) {
361 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Amount'));
365 $error_string[] = $langs->trans(
'MinimumAmount', $minimum);
372 $this->errors = $error_string;
387 public function create($user, $notrigger = 0)
389 global
$conf, $langs;
405 $this->error = $langs->trans(
'FieldCannotBeNegative', $langs->transnoentitiesnoconv(
"Amount"));
411 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"don (";
415 $sql .=
", fk_payment";
417 $sql .=
", firstname";
418 $sql .=
", lastname";
423 $sql .=
", fk_country";
425 $sql .=
", fk_projet";
426 $sql .=
", note_private";
427 $sql .=
", note_public";
428 $sql .=
", fk_user_author";
429 $sql .=
", fk_user_valid";
433 $sql .=
", phone_mobile";
435 $sql .=
") VALUES (";
436 $sql .=
"'".$this->db->idate($this->
date ? $this->
date : $now).
"'";
437 $sql .=
", ".((int)
$conf->entity);
438 $sql .=
", ".((float) $this->
amount);
439 $sql .=
", ".($this->modepaymentid ? $this->modepaymentid :
"null");
440 $sql .=
", ".($this->socid > 0 ? $this->socid :
"null");
441 $sql .=
", '".$this->db->escape($this->firstname).
"'";
442 $sql .=
", '".$this->db->escape($this->lastname).
"'";
443 $sql .=
", '".$this->db->escape($this->societe).
"'";
444 $sql .=
", '".$this->db->escape($this->
address).
"'";
445 $sql .=
", '".$this->db->escape($this->zip).
"'";
446 $sql .=
", '".$this->db->escape($this->town).
"'";
447 $sql .=
", ".(int) ($this->country_id > 0 ? $this->country_id : 0);
448 $sql .=
", ".(int) $this->
public;
449 $sql .=
", ".($this->fk_project > 0 ? (int) $this->fk_project :
"null");
450 $sql .=
", ".(!empty($this->note_private) ? (
"'".$this->db->escape($this->note_private).
"'") :
"NULL");
451 $sql .=
", ".(!empty($this->note_public) ? (
"'".$this->db->escape($this->note_public).
"'") :
"NULL");
452 $sql .=
", ".((int) $user->id);
454 $sql .=
", '".$this->db->idate($this->
date).
"'";
455 $sql .=
", '".(!empty($this->
email) ? $this->db->escape(trim($this->
email)) :
"").
"'";
456 $sql .=
", '".(!empty($this->phone) ? $this->db->escape(trim($this->phone)) :
"").
"'";
457 $sql .=
", '".(!empty($this->phone_mobile) ? $this->db->escape(trim($this->phone_mobile)) :
"").
"'";
458 $sql .=
", '".(!empty($this->ip) ? $this->db->escape($this->ip) :
"null").
"'";
461 $resql = $this->db->query($sql);
463 $this->
id = $this->db->last_insert_id(MAIN_DB_PREFIX.
"don");
468 $result = $this->call_trigger(
'DON_CREATE', $user);
475 $this->error = $this->db->lasterror();
496 $this->db->rollback();
508 public function update($user, $notrigger = 0)
524 $this->error = $langs->trans(
'FieldCannotBeNegative', $langs->transnoentitiesnoconv(
"Amount"));
530 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"don SET";
531 $sql .=
" amount = ".((float) $this->
amount);
532 $sql .=
", fk_payment = ".($this->modepaymentid ? $this->modepaymentid :
"null");
533 $sql .=
", firstname = '".$this->db->escape($this->firstname).
"'";
534 $sql .=
", lastname='".$this->db->escape($this->lastname).
"'";
535 $sql .=
", societe='".$this->db->escape($this->societe).
"'";
536 $sql .=
", address='".$this->db->escape($this->
address).
"'";
537 $sql .=
", zip='".$this->db->escape($this->zip).
"'";
538 $sql .=
", town='".$this->db->escape($this->town).
"'";
539 $sql .=
", fk_country = ".($this->country_id > 0 ? ((int) $this->country_id) :
'0');
540 $sql .=
", public=".((int) $this->
public);
541 $sql .=
", fk_projet=".($this->fk_project > 0 ? $this->fk_project :
'null');
542 $sql .=
", note_private=".(!empty($this->note_private) ? (
"'".$this->db->escape($this->note_private).
"'") :
"NULL");
543 $sql .=
", note_public=".(!empty($this->note_public) ? (
"'".$this->db->escape($this->note_public).
"'") :
"NULL");
544 $sql .=
", datedon='".$this->db->idate($this->
date).
"'";
545 $sql .=
", date_valid=".($this->date_valid ?
"'".$this->db->idate($this->
date).
"'" :
"null");
546 $sql .=
", email='".$this->db->escape(trim($this->
email)).
"'";
547 $sql .=
", phone='".$this->db->escape(trim($this->phone)).
"'";
548 $sql .=
", phone_mobile='".$this->db->escape(trim($this->phone_mobile)).
"'";
549 $sql .=
", fk_statut=".((int) $this->
status);
550 $sql .=
" WHERE rowid = ".((int) $this->
id);
552 dol_syslog(get_class($this).
"::Update", LOG_DEBUG);
553 $resql = $this->db->query($sql);
557 $result = $this->call_trigger(
'DON_MODIFY', $user);
576 $this->db->rollback();
580 $this->error = $this->db->lasterror();
581 $this->errors[] = $this->error;
582 $this->db->rollback();
583 dol_syslog(get_class($this).
"::Update error -2 ".$this->error, LOG_ERR);
596 public function delete($user, $notrigger = 0)
598 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
606 $result = $this->call_trigger(
'DON_DELETE', $user);
616 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"don_extrafields";
617 $sql .=
" WHERE fk_object = ".((int) $this->
id);
619 $resql = $this->db->query($sql);
621 $this->errors[] = $this->db->lasterror();
627 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"don";
628 $sql .=
" WHERE rowid=".((int) $this->
id);
630 $resql = $this->db->query($sql);
632 $this->errors[] = $this->db->lasterror();
638 $dir = DOL_DATA_ROOT.
'/'.$this->element.
'/'.$this->ref;
642 $this->errors[] =
'ErrorFailToDeleteDir';
652 foreach ($this->errors as $errmsg) {
653 dol_syslog(get_class($this).
"::delete ".$errmsg, LOG_ERR);
654 $this->error .= ($this->error ?
', '.$errmsg : $errmsg);
656 dol_syslog(get_class($this).
"::delete ".$this->error, LOG_ERR);
657 $this->db->rollback();
669 public function fetch($id, $ref =
'')
671 $sql =
"SELECT d.rowid, d.entity, d.datec, d.date_valid, d.tms as datem, d.datedon,";
672 $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, ";
673 $sql .=
" d.fk_country, d.public, d.amount, d.fk_payment, d.paid, d.note_private, d.note_public, d.email, d.phone, ";
674 $sql .=
" d.phone_mobile, d.fk_projet as fk_project, d.model_pdf,";
675 $sql .=
" p.ref as project_ref,";
676 $sql .=
" cp.libelle as payment_label, cp.code as payment_code,";
677 $sql .=
" c.code as country_code, c.label as country";
678 $sql .=
" FROM ".MAIN_DB_PREFIX.
"don as d";
679 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = d.fk_projet";
680 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as cp ON cp.id = d.fk_payment";
681 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as c ON d.fk_country = c.rowid";
682 $sql .=
" WHERE d.entity IN (".getEntity(
'donation').
")";
684 $sql .=
" AND d.rowid=".((int) $id);
685 } elseif (!empty($ref)) {
686 $sql .=
" AND d.ref='".$this->db->escape($ref).
"'";
689 dol_syslog(get_class($this).
"::fetch", LOG_DEBUG);
690 $resql = $this->db->query($sql);
692 if ($this->db->num_rows($resql)) {
693 $obj = $this->db->fetch_object($resql);
695 $this->
id = $obj->rowid;
696 $this->entity = $obj->entity;
697 $this->
ref = $obj->rowid;
698 $this->date_creation = $this->db->jdate($obj->datec);
699 $this->datec = $this->db->jdate($obj->datec);
700 $this->date_validation = $this->db->jdate($obj->date_valid);
701 $this->date_valid = $this->db->jdate($obj->date_valid);
702 $this->date_modification = $this->db->jdate($obj->datem);
703 $this->datem = $this->db->jdate($obj->datem);
704 $this->
date = $this->db->jdate($obj->datedon);
705 $this->socid = $obj->socid;
706 $this->firstname = $obj->firstname;
707 $this->lastname = $obj->lastname;
708 $this->societe = $obj->societe;
709 $this->
status = $obj->status;
710 $this->statut = $obj->status;
711 $this->
address = $obj->address;
712 $this->zip = $obj->zip;
713 $this->town = $obj->town;
714 $this->country_id = $obj->fk_country;
715 $this->country_code = $obj->country_code;
716 $this->country = $obj->country;
717 $this->
email = $obj->email;
718 $this->phone = $obj->phone;
719 $this->phone_mobile = $obj->phone_mobile;
720 $this->project = $obj->project_ref;
721 $this->fk_projet = $obj->fk_project;
722 $this->fk_project = $obj->fk_project;
723 $this->
public = $obj->public;
724 $this->mode_reglement_id = $obj->fk_payment;
725 $this->mode_reglement_code = $obj->payment_code;
726 $this->mode_reglement = $obj->payment_label;
727 $this->paid = $obj->paid;
728 $this->
amount = $obj->amount;
729 $this->note_private = $obj->note_private;
730 $this->note_public = $obj->note_public;
731 $this->model_pdf = $obj->model_pdf;
775 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"don SET fk_statut = 1, fk_user_valid = ".((int) $userid).
" WHERE rowid = ".((int) $id).
" AND fk_statut = 0";
777 $resql = $this->db->query($sql);
779 if ($this->db->affected_rows($resql)) {
782 $result = $this->call_trigger(
'DON_VALIDATE', $user);
791 $this->error = $this->db->lasterror();
799 $this->db->rollback();
811 public function setPaid($id, $modepayment = 0)
813 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"don SET fk_statut = 2, paid = 1";
815 $sql .=
", fk_payment = ".((int) $modepayment);
817 $sql .=
" WHERE rowid = ".((int) $id).
" AND fk_statut = 1";
819 $resql = $this->db->query($sql);
821 if ($this->db->affected_rows($resql)) {
844 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"don SET fk_statut = -1 WHERE rowid = ".((int) $id);
846 $resql = $this->db->query($sql);
848 if ($this->db->affected_rows($resql)) {
867 public function reopen($user, $notrigger = 0)
870 if ($this->
status != self::STATUS_CANCELED && $this->
status != self::STATUS_PAID) {
873 if ($this->statut == self::STATUS_PAID) {
874 $sql =
"UPDATE " . MAIN_DB_PREFIX .
"don SET paid = 0 WHERE rowid = " . ((int) $this->
id);
876 $resql = $this->db->query($sql);
878 if ($this->db->affected_rows($resql)) {
887 return $this->
setStatusCommon($user, self::STATUS_VALIDATED, $notrigger,
'DON_REOPEN');
904 $sql =
"SELECT sum(amount) as total";
905 $sql .=
" FROM ".MAIN_DB_PREFIX.
"don";
906 $sql .=
" WHERE fk_statut = ".((int) $param);
907 $sql .=
" AND entity = ".$conf->entity;
909 $resql = $this->db->query($sql);
911 $obj = $this->db->fetch_object($resql);
912 $result = $obj->total;
927 $sql =
"SELECT count(d.rowid) as nb";
928 $sql .=
" FROM ".MAIN_DB_PREFIX.
"don as d";
929 $sql .=
" WHERE d.fk_statut > 0";
930 $sql .=
" AND d.entity IN (".getEntity(
'donation').
")";
932 $resql = $this->db->query($sql);
934 while ($obj = $this->db->fetch_object($resql)) {
935 $this->nb[
"donations"] = $obj->nb;
937 $this->db->free($resql);
941 $this->error = $this->db->error();
955 public function getNomUrl($withpicto = 0, $notooltip = 0, $moretitle =
'', $save_lastsearch_value = -1)
957 global
$conf, $langs, $hookmanager;
959 if (!empty(
$conf->dol_no_mouse_hover)) {
964 $label =
img_picto(
'', $this->picto).
' <u class="paddingrightonly">'.$langs->trans(
"Donation").
'</u>';
965 if (isset($this->
status)) {
966 $label .=
' '.$this->getLibStatut(5);
968 if (!empty($this->
id)) {
969 $label .=
'<br><b>'.$langs->trans(
'Ref').
':</b> '.$this->id;
970 $label .=
'<br><b>'.$langs->trans(
'Date').
':</b> '.
dol_print_date($this->
date,
'day');
973 $label .=
' - '.$moretitle;
976 $url = DOL_URL_ROOT.
'/don/card.php?id='.$this->id;
978 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
979 if ($save_lastsearch_value == -1 && isset($_SERVER[
"PHP_SELF"]) && preg_match(
'/list\.php/', $_SERVER[
"PHP_SELF"])) {
980 $add_save_lastsearch_values = 1;
982 if ($add_save_lastsearch_values) {
983 $url .=
'&save_lastsearch_values=1';
986 $linkstart =
'<a href="'.$url.
'" title="'.
dol_escape_htmltag($label, 1).
'" class="classfortooltip">';
989 $result .= $linkstart;
991 $result .=
img_object(($notooltip ?
'' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ?
'class="paddingright"' :
'') :
'class="'.(($withpicto != 2) ?
'paddingright ' :
'').
'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
993 if ($withpicto != 2) {
994 $result .= $this->ref;
998 $hookmanager->initHooks(array($this->element .
'dao'));
999 $parameters = array(
'id' => $this->
id,
'getnomurl' => &$result);
1000 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
1002 $result = $hookmanager->resPrint;
1004 $result .= $hookmanager->resPrint;
1017 $sql =
'SELECT d.rowid, d.datec, d.fk_user_author, d.fk_user_valid,';
1018 $sql .=
' d.tms as datem';
1019 $sql .=
' FROM '.MAIN_DB_PREFIX.
'don as d';
1020 $sql .=
' WHERE d.rowid = '.((int) $id);
1022 dol_syslog(get_class($this).
'::info', LOG_DEBUG);
1023 $result = $this->db->query($sql);
1026 if ($this->db->num_rows($result)) {
1027 $obj = $this->db->fetch_object($result);
1028 $this->
id = $obj->rowid;
1030 $this->user_creation_id = $obj->fk_user_author;
1031 $this->user_validation_id = $obj->fk_user_valid;
1032 $this->date_creation = $this->db->jdate($obj->datec);
1033 $this->date_modification = (!empty($obj->tms) ? $this->db->jdate($obj->tms) :
"");
1035 $this->db->free($result);
1052 public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
1054 global
$conf, $langs;
1056 $langs->load(
"bills");
1059 $modele =
'html_cerfafr';
1061 if ($this->model_pdf) {
1062 $modele = $this->model_pdf;
1074 $err = error_reporting();
1076 @set_time_limit(120);
1077 error_reporting($err);
1079 $srctemplatepath =
'';
1082 $tmp = explode(
':', $modele, 2);
1083 if (!empty($tmp[1])) {
1085 $srctemplatepath = $tmp[1];
1092 $dirmodels = array_merge([
'/'], (array)
$conf->modules_parts[
'models']);
1093 foreach ($dirmodels as $reldir) {
1094 foreach (array(
'html',
'doc',
'pdf') as $prefix) {
1095 $file = $prefix.
"_".preg_replace(
'/^html_/',
'', $modele).
".modules.php";
1098 $file =
dol_buildpath($reldir.
"core/modules/dons/".$file, 0);
1099 if (file_exists($file)) {
1101 $classname = $prefix.
'_'.$modele;
1116 $classname = $modele;
1117 $obj =
new $classname($this->db);
1119 '@phan-var-force ModeleDon $obj';
1123 $sav_charset_output = $outputlangs->charset_output;
1124 if ($obj->write_file(
$object, $outputlangs ) > 0) {
1125 $outputlangs->charset_output = $sav_charset_output;
1128 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
1132 $outputlangs->charset_output = $sav_charset_output;
1138 print $langs->trans(
"Error").
" ".$langs->trans(
"ErrorFileDoesNotExists", $file);
1169 if (empty($this->
id)) {
1170 $this->error =
'Missing object id';
1171 $this->errors[] = $this->error;
1172 dol_syslog(__METHOD__.
' : '.$this->error, LOG_ERR);
1176 $sql =
"SELECT SUM(amount) as sum_amount FROM ".MAIN_DB_PREFIX.
"payment_donation WHERE fk_donation = ".((int) $this->
id);
1177 $resql = $this->db->query($sql);
1182 $sum_amount = (float) $this->db->fetch_object($resql)->sum_amount;
1183 return (
float) ($this->
amount - $sum_amount);
1196 global
$conf, $langs;
1198 $selected = (empty($arraydata[
'selected']) ? 0 : $arraydata[
'selected']);
1200 $return =
'<div class="box-flex-item box-flex-grow-zero">';
1201 $return .=
'<div class="info-box info-box-sm">';
1202 $return .=
'<span class="info-box-icon bg-infobox-action">';
1204 $return .=
'</span>';
1205 $return .=
'<div class="info-box-content">';
1206 $return .=
'<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">' . $this->
getNomUrl(1) .
'</span>';
1207 if ($selected >= 0) {
1208 $return .=
'<input id="cb'.$this->id.
'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->
id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1211 $return .=
' | <span class="info-box-label">'.dol_print_date($this->
date,
'day',
'tzuserrel').
'</span>';
1213 if (!empty($this->societe)) {
1214 $return .=
'<br><span class="opacitymedium">'.$langs->trans(
"Company").
'</span> : <span class="info-box-label">'.$this->societe.
'</span>';
1216 if (!empty($this->
amount)) {
1217 $return .=
'<br><span class="info-box-label amount">'.price($this->
amount, 1, $langs, 1, -1, -1,
getDolCurrency()).
'</span>';
1219 if (isset($this->
status)) {
1220 $return .=
'<br><div class="info-box-status">'.$this->getLibStatut(3).
'</div>';
1222 $return .=
'</div>';
1223 $return .=
'</div>';
1224 $return .=
'</div>';
if(! $sortfield) if(! $sortorder) $object
Parent class of all other business classes (invoices, contracts, proposals, orders,...
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...
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)
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_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.
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 '.
isDolTms($timestamp)
isDolTms check if a timestamp is valid.
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.
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).
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_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
div refaddress div address
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