32require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobject.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/commonpeople.class.php';
46 public $element =
'don';
51 public $table_element =
'don';
56 public $fk_element =
'fk_donation';
62 public $ismultientitymanaged = 1;
67 public $picto =
'donation';
114 public $phone_mobile;
129 public $fk_typepayment;
137 public $modepaymentid = 0;
150 public $labelStatusShort;
153 const STATUS_DRAFT = 0;
154 const STATUS_VALIDATED = 1;
155 const STATUS_PAID = 2;
156 const STATUS_CANCELED = -1;
192 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
194 $langs->load(
"donations");
195 $this->labelStatus[-1] = $langs->transnoentitiesnoconv(
"Canceled");
196 $this->labelStatus[0] = $langs->transnoentitiesnoconv(
"DonationStatusPromiseNotValidated");
197 $this->labelStatus[1] = $langs->transnoentitiesnoconv(
"DonationStatusPromiseValidated");
198 $this->labelStatus[2] = $langs->transnoentitiesnoconv(
"DonationStatusPaid");
199 $this->labelStatusShort[-1] = $langs->transnoentitiesnoconv(
"Canceled");
200 $this->labelStatusShort[0] = $langs->transnoentitiesnoconv(
"DonationStatusPromiseNotValidatedShort");
201 $this->labelStatusShort[1] = $langs->transnoentitiesnoconv(
"DonationStatusPromiseValidatedShort");
202 $this->labelStatusShort[2] = $langs->transnoentitiesnoconv(
"DonationStatusPaidShort");
205 $statusType =
'status'.$status;
206 if ($status == self::STATUS_CANCELED) {
207 $statusType =
'status9';
209 if ($status == self::STATUS_PAID) {
210 $statusType =
'status6';
213 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status],
'', $statusType, $mode);
233 $sql =
"SELECT rowid";
234 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe";
235 $sql .=
" WHERE client IN (1, 3)";
236 $sql .=
" AND entity = ".$conf->entity;
239 $resql = $this->db->query($sql);
241 $num_socs = $this->db->num_rows($resql);
243 while ($i < $num_socs) {
244 $row = $this->db->fetch_row($resql);
245 $socids[$i] = $row[0];
253 $this->
ref =
'SPECIMEN';
255 $this->lastname =
'Doe';
256 $this->firstname =
'John';
257 $this->socid = empty($socids[0]) ? 0 : $socids[0];
259 $this->date_valid = $now;
260 $this->amount = 100.90;
262 $this->societe =
'The Company';
263 $this->address =
'Twist road';
264 $this->zip =
'99999';
265 $this->town =
'Town';
266 $this->note_private =
'Private note';
267 $this->note_public =
'Public note';
268 $this->email =
'email@email.com';
269 $this->phone =
'0123456789';
270 $this->phone_mobile =
'0606060606';
285 $langs->load(
'main');
286 $langs->load(
'companies');
288 $error_string = array();
293 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Company').
'/'.$langs->transnoentitiesnoconv(
'Firstname').
'-'.$langs->transnoentitiesnoconv(
'Lastname'));
299 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Address'));
304 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Zip'));
309 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Town'));
314 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'EMail'));
318 $this->amount = trim($this->amount);
322 for ($i = 0; $i < $len; $i++) {
323 if (!isset($map[substr($this->amount, $i, 1)])) {
324 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Amount'));
331 if (!$amount_invalid) {
332 if ($this->amount == 0) {
333 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Amount'));
336 if ($this->amount < $minimum && $minimum > 0) {
337 $error_string[] = $langs->trans(
'MinimumAmount', $langs->transnoentitiesnoconv(
'$minimum'));
344 $this->errors = $error_string;
359 public function create($user, $notrigger = 0)
361 global $conf, $langs;
368 $this->address = ($this->address > 0 ? $this->address : $this->address);
369 $this->zip = ($this->zip > 0 ? $this->zip : $this->zip);
370 $this->town = ($this->town > 0 ? $this->town : $this->town);
371 $this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id);
372 $this->country = ($this->country ? $this->country : $this->country);
373 $this->amount =
price2num($this->amount);
376 if ($this->amount < 0) {
377 $this->error = $langs->trans(
'FieldCannotBeNegative', $langs->transnoentitiesnoconv(
"Amount"));
383 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"don (";
387 $sql .=
", fk_payment";
389 $sql .=
", firstname";
390 $sql .=
", lastname";
395 $sql .=
", fk_country";
397 $sql .=
", fk_projet";
398 $sql .=
", note_private";
399 $sql .=
", note_public";
400 $sql .=
", fk_user_author";
401 $sql .=
", fk_user_valid";
405 $sql .=
", phone_mobile";
406 $sql .=
") VALUES (";
407 $sql .=
"'".$this->db->idate($this->date ? $this->date : $now).
"'";
408 $sql .=
", ".((int) $conf->entity);
409 $sql .=
", ".((float) $this->amount);
410 $sql .=
", ".($this->modepaymentid ? $this->modepaymentid :
"null");
411 $sql .=
", ".($this->socid > 0 ? $this->socid :
"null");
412 $sql .=
", '".$this->db->escape($this->firstname).
"'";
413 $sql .=
", '".$this->db->escape($this->lastname).
"'";
414 $sql .=
", '".$this->db->escape($this->societe).
"'";
415 $sql .=
", '".$this->db->escape($this->address).
"'";
416 $sql .=
", '".$this->db->escape($this->zip).
"'";
417 $sql .=
", '".$this->db->escape($this->town).
"'";
418 $sql .=
", ".(int) ($this->country_id > 0 ? $this->country_id : 0);
419 $sql .=
", ".(int) $this->
public;
420 $sql .=
", ".($this->fk_project > 0 ? (int) $this->fk_project :
"null");
421 $sql .=
", ".(!empty($this->note_private) ? (
"'".$this->db->escape($this->note_private).
"'") :
"NULL");
422 $sql .=
", ".(!empty($this->note_public) ? (
"'".$this->db->escape($this->note_public).
"'") :
"NULL");
423 $sql .=
", ".((int) $user->id);
425 $sql .=
", '".$this->db->idate($this->date).
"'";
426 $sql .=
", '".(!empty($this->email) ? $this->db->escape(trim($this->email)) :
"").
"'";
427 $sql .=
", '".(!empty($this->phone) ? $this->db->escape(trim($this->phone)) :
"").
"'";
428 $sql .=
", '".(!empty($this->phone_mobile) ? $this->db->escape(trim($this->phone_mobile)) :
"").
"'";
431 $resql = $this->db->query($sql);
433 $this->
id = $this->db->last_insert_id(MAIN_DB_PREFIX.
"don");
445 $this->error = $this->db->lasterror();
446 $this->errno = $this->db->lasterrno();
467 $this->db->rollback();
479 public function update($user, $notrigger = 0)
486 $this->address = ($this->address > 0 ? $this->address : $this->address);
487 $this->zip = ($this->zip > 0 ? $this->zip : $this->zip);
488 $this->town = ($this->town > 0 ? $this->town : $this->town);
489 $this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id);
490 $this->country = ($this->country ? $this->country : $this->country);
491 $this->amount =
price2num($this->amount);
494 if ($this->amount < 0) {
495 $this->error = $langs->trans(
'FieldCannotBeNegative', $langs->transnoentitiesnoconv(
"Amount"));
501 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"don SET";
502 $sql .=
" amount = ".((float) $this->amount);
503 $sql .=
", fk_payment = ".($this->modepaymentid ? $this->modepaymentid :
"null");
504 $sql .=
", firstname = '".$this->db->escape($this->firstname).
"'";
505 $sql .=
", lastname='".$this->db->escape($this->lastname).
"'";
506 $sql .=
", societe='".$this->db->escape($this->societe).
"'";
507 $sql .=
", address='".$this->db->escape($this->address).
"'";
508 $sql .=
", zip='".$this->db->escape($this->zip).
"'";
509 $sql .=
", town='".$this->db->escape($this->town).
"'";
510 $sql .=
", fk_country = ".($this->country_id > 0 ? ((int) $this->country_id) :
'0');
511 $sql .=
", public=".((int) $this->
public);
512 $sql .=
", fk_projet=".($this->fk_project > 0 ? $this->fk_project :
'null');
513 $sql .=
", note_private=".(!empty($this->note_private) ? (
"'".$this->db->escape($this->note_private).
"'") :
"NULL");
514 $sql .=
", note_public=".(!empty($this->note_public) ? (
"'".$this->db->escape($this->note_public).
"'") :
"NULL");
515 $sql .=
", datedon='".$this->db->idate($this->date).
"'";
516 $sql .=
", date_valid=".($this->date_valid ?
"'".$this->db->idate($this->date).
"'" :
"null");
517 $sql .=
", email='".$this->db->escape(trim($this->email)).
"'";
518 $sql .=
", phone='".$this->db->escape(trim($this->phone)).
"'";
519 $sql .=
", phone_mobile='".$this->db->escape(trim($this->phone_mobile)).
"'";
520 $sql .=
", fk_statut=".((int) $this->
statut);
521 $sql .=
" WHERE rowid = ".((int) $this->
id);
523 dol_syslog(get_class($this).
"::Update", LOG_DEBUG);
524 $resql = $this->db->query($sql);
547 $this->db->rollback();
551 $this->error = $this->db->lasterror();
552 $this->errors[] = $this->error;
553 $this->db->rollback();
554 dol_syslog(get_class($this).
"::Update error -2 ".$this->error, LOG_ERR);
567 public function delete($user, $notrigger = 0)
569 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
575 if (!$error && !$notrigger) {
587 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"don_extrafields";
588 $sql .=
" WHERE fk_object = ".((int) $this->
id);
590 $resql = $this->db->query($sql);
592 $this->errors[] = $this->db->lasterror();
598 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"don";
599 $sql .=
" WHERE rowid=".((int) $this->
id);
601 $resql = $this->db->query($sql);
603 $this->errors[] = $this->db->lasterror();
612 foreach ($this->errors as $errmsg) {
613 dol_syslog(get_class($this).
"::delete ".$errmsg, LOG_ERR);
614 $this->error .= ($this->error ?
', '.$errmsg : $errmsg);
616 dol_syslog(get_class($this).
"::delete ".$this->error, LOG_ERR);
617 $this->db->rollback();
629 public function fetch($id, $ref =
'')
631 $sql =
"SELECT d.rowid, d.datec, d.date_valid, d.tms as datem, d.datedon,";
632 $sql .=
" d.fk_soc as socid,d.firstname, d.lastname, d.societe, d.amount, d.fk_statut, d.address, d.zip, d.town, ";
633 $sql .=
" d.fk_country, d.country as country_olddata, d.public, d.amount, d.fk_payment, d.paid, d.note_private, d.note_public, d.email, d.phone, ";
634 $sql .=
" d.phone_mobile, d.fk_projet as fk_project, d.model_pdf,";
635 $sql .=
" p.ref as project_ref,";
636 $sql .=
" cp.libelle as payment_label, cp.code as payment_code,";
637 $sql .=
" c.code as country_code, c.label as country";
638 $sql .=
" FROM ".MAIN_DB_PREFIX.
"don as d";
639 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = d.fk_projet";
640 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as cp ON cp.id = d.fk_payment";
641 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as c ON d.fk_country = c.rowid";
642 $sql .=
" WHERE d.entity IN (".getEntity(
'donation').
")";
644 $sql .=
" AND d.rowid=".((int) $id);
645 } elseif (!empty($ref)) {
646 $sql .=
" AND d.ref='".$this->db->escape($ref).
"'";
649 dol_syslog(get_class($this).
"::fetch", LOG_DEBUG);
650 $resql = $this->db->query($sql);
652 if ($this->db->num_rows($resql)) {
653 $obj = $this->db->fetch_object($resql);
655 $this->
id = $obj->rowid;
656 $this->
ref = $obj->rowid;
657 $this->date_creation = $this->db->jdate($obj->datec);
658 $this->datec = $this->db->jdate($obj->datec);
659 $this->date_validation = $this->db->jdate($obj->date_valid);
660 $this->date_valid = $this->db->jdate($obj->date_valid);
661 $this->date_modification = $this->db->jdate($obj->datem);
662 $this->datem = $this->db->jdate($obj->datem);
663 $this->date = $this->db->jdate($obj->datedon);
664 $this->socid = $obj->socid;
665 $this->firstname = $obj->firstname;
666 $this->lastname = $obj->lastname;
667 $this->societe = $obj->societe;
668 $this->
statut = $obj->fk_statut;
669 $this->address = $obj->address;
670 $this->zip = $obj->zip;
671 $this->town = $obj->town;
672 $this->country_id = $obj->fk_country;
673 $this->country_code = $obj->country_code;
674 $this->country = $obj->country;
675 $this->country_olddata = $obj->country_olddata;
676 $this->email = $obj->email;
677 $this->phone = $obj->phone;
678 $this->phone_mobile = $obj->phone_mobile;
679 $this->project = $obj->project_ref;
680 $this->fk_projet = $obj->fk_project;
681 $this->fk_project = $obj->fk_project;
682 $this->
public = $obj->public;
683 $this->mode_reglement_id = $obj->fk_payment;
684 $this->mode_reglement_code = $obj->payment_code;
685 $this->mode_reglement = $obj->payment_label;
686 $this->paid = $obj->paid;
687 $this->amount = $obj->amount;
688 $this->note_private = $obj->note_private;
689 $this->note_public = $obj->note_public;
690 $this->model_pdf = $obj->model_pdf;
691 $this->modelpdf = $obj->model_pdf;
734 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"don SET fk_statut = 1, fk_user_valid = ".((int) $userid).
" WHERE rowid = ".((int) $id).
" AND fk_statut = 0";
736 $resql = $this->db->query($sql);
738 if ($this->db->affected_rows($resql)) {
750 $this->error = $this->db->lasterror();
758 $this->db->rollback();
770 public function setPaid($id, $modepayment = 0)
772 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"don SET fk_statut = 2, paid = 1";
774 $sql .=
", fk_payment = ".((int) $modepayment);
776 $sql .=
" WHERE rowid = ".((int) $id).
" AND fk_statut = 1";
778 $resql = $this->db->query($sql);
780 if ($this->db->affected_rows($resql)) {
803 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"don SET fk_statut = -1 WHERE rowid = ".((int) $id);
805 $resql = $this->db->query($sql);
807 if ($this->db->affected_rows($resql)) {
826 public function reopen($user, $notrigger = 0)
829 if ($this->
statut != self::STATUS_CANCELED) {
840 return $this->
setStatusCommon($user, self::STATUS_VALIDATED, $notrigger,
'DON_REOPEN');
857 $sql =
"SELECT sum(amount) as total";
858 $sql .=
" FROM ".MAIN_DB_PREFIX.
"don";
859 $sql .=
" WHERE fk_statut = ".((int) $param);
860 $sql .=
" AND entity = ".$conf->entity;
862 $resql = $this->db->query($sql);
864 $obj = $this->db->fetch_object($resql);
865 $result = $obj->total;
882 $sql =
"SELECT count(d.rowid) as nb";
883 $sql .=
" FROM ".MAIN_DB_PREFIX.
"don as d";
884 $sql .=
" WHERE d.fk_statut > 0";
885 $sql .=
" AND d.entity IN (".getEntity(
'donation').
")";
887 $resql = $this->db->query($sql);
889 while ($obj = $this->db->fetch_object($resql)) {
890 $this->nb[
"donations"] = $obj->nb;
892 $this->db->free($resql);
896 $this->error = $this->db->error();
910 public function getNomUrl($withpicto = 0, $notooltip = 0, $moretitle =
'', $save_lastsearch_value = -1)
912 global $conf, $langs, $hookmanager;
914 if (!empty($conf->dol_no_mouse_hover)) {
919 $label =
img_picto(
'', $this->picto).
' <u class="paddingrightonly">'.$langs->trans(
"Donation").
'</u>';
920 if (isset($this->status)) {
921 $label .=
' '.$this->getLibStatut(5);
923 if (!empty($this->
id)) {
924 $label .=
'<br><b>'.$langs->trans(
'Ref').
':</b> '.$this->id;
925 $label .=
'<br><b>'.$langs->trans(
'Date').
':</b> '.
dol_print_date($this->date,
'day');
928 $label .=
' - '.$moretitle;
931 $url = DOL_URL_ROOT.
'/don/card.php?id='.$this->id;
933 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
934 if ($save_lastsearch_value == -1 && preg_match(
'/list\.php/', $_SERVER[
"PHP_SELF"])) {
935 $add_save_lastsearch_values = 1;
937 if ($add_save_lastsearch_values) {
938 $url .=
'&save_lastsearch_values=1';
941 $linkstart =
'<a href="'.$url.
'" title="'.
dol_escape_htmltag($label, 1).
'" class="classfortooltip">';
944 $result .= $linkstart;
946 $result .=
img_object(($notooltip ?
'' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ?
'class="paddingright"' :
'') :
'class="'.(($withpicto != 2) ?
'paddingright ' :
'').
'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
948 if ($withpicto != 2) {
949 $result .= $this->ref;
953 $hookmanager->initHooks(array($this->element .
'dao'));
954 $parameters = array(
'id'=>$this->
id,
'getnomurl' => &$result);
955 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
957 $result = $hookmanager->resPrint;
959 $result .= $hookmanager->resPrint;
972 $sql =
'SELECT d.rowid, d.datec, d.fk_user_author, d.fk_user_valid,';
973 $sql .=
' d.tms as datem';
974 $sql .=
' FROM '.MAIN_DB_PREFIX.
'don as d';
975 $sql .=
' WHERE d.rowid = '.((int) $id);
977 dol_syslog(get_class($this).
'::info', LOG_DEBUG);
978 $result = $this->db->query($sql);
981 if ($this->db->num_rows($result)) {
982 $obj = $this->db->fetch_object($result);
983 $this->
id = $obj->rowid;
985 $this->user_creation_id = $obj->fk_user_author;
986 $this->user_validation_id = $obj->fk_user_valid;
987 $this->date_creation = $this->db->jdate($obj->datec);
988 $this->date_modification = (!empty($obj->tms) ? $this->db->jdate($obj->tms) :
"");
990 $this->db->free($result);
1007 public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
1009 global $conf, $langs;
1011 $langs->load(
"bills");
1014 $modele =
'html_cerfafr';
1016 if ($this->model_pdf) {
1017 $modele = $this->model_pdf;
1018 } elseif (!empty($conf->global->DON_ADDON_MODEL)) {
1019 $modele = $conf->global->DON_ADDON_MODEL;
1029 $err = error_reporting();
1031 @set_time_limit(120);
1032 error_reporting($err);
1034 $srctemplatepath =
'';
1037 $tmp = explode(
':', $modele, 2);
1038 if (!empty($tmp[1])) {
1040 $srctemplatepath = $tmp[1];
1044 $file =
''; $classname =
''; $filefound = 0;
1045 $dirmodels = array(
'/');
1046 if (is_array($conf->modules_parts[
'models'])) {
1047 $dirmodels = array_merge($dirmodels, $conf->modules_parts[
'models']);
1049 foreach ($dirmodels as $reldir) {
1050 foreach (array(
'html',
'doc',
'pdf') as $prefix) {
1051 $file = $prefix.
"_".preg_replace(
'/^html_/',
'', $modele).
".modules.php";
1054 $file =
dol_buildpath($reldir.
"core/modules/dons/".$file, 0);
1055 if (file_exists($file)) {
1057 $classname = $prefix.
'_'.$modele;
1072 $classname = $modele;
1073 $obj =
new $classname($this->db);
1077 $sav_charset_output = $outputlangs->charset_output;
1078 if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0) {
1079 $outputlangs->charset_output = $sav_charset_output;
1082 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
1086 $outputlangs->charset_output = $sav_charset_output;
1092 print $langs->trans(
"Error").
" ".$langs->trans(
"ErrorFileDoesNotExists", $file);
1123 if (empty($this->
id)) {
1124 $this->error =
'Missing object id';
1125 $this->errors[] = $this->error;
1126 dol_syslog(__METHOD__.
' : '.$this->error, LOG_ERR);
1130 $sql =
"SELECT SUM(amount) as sum_amount FROM ".MAIN_DB_PREFIX.
"payment_donation WHERE fk_donation = ".((int) $this->
id);
1131 $resql = $this->db->query($sql);
1136 $sum_amount = (float) $this->db->fetch_object($resql)->sum_amount;
1137 return (
float) $this->amount - $sum_amount;
1152 $selected = (empty($arraydata[
'selected']) ? 0 : $arraydata[
'selected']);
1154 $return =
'<div class="box-flex-item box-flex-grow-zero">';
1155 $return .=
'<div class="info-box info-box-sm">';
1156 $return .=
'<span class="info-box-icon bg-infobox-action">';
1158 $return .=
'</span>';
1159 $return .=
'<div class="info-box-content">';
1160 $return .=
'<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this,
'getNomUrl') ? $this->
getNomUrl(1) : $this->ref).
'</span>';
1161 $return .=
'<input id="cb'.$this->id.
'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->
id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1162 if (property_exists($this,
'date')) {
1163 $return .=
' | <span class="opacitymedium" >'.$langs->trans(
"Date").
'</span> : <span class="info-box-label">'.
dol_print_date($this->date).
'</span>';
1165 if (property_exists($this,
'societe') && !empty($this->societe)) {
1166 $return .=
'<br><span class="opacitymedium">'.$langs->trans(
"Company").
'</span> : <span class="info-box-label">'.$this->societe.
'</span>';
1168 if (property_exists($this,
'amount')) {
1169 $return .=
'<br><span class="opacitymedium" >'.$langs->trans(
"Amount").
'</span> : <span class="info-box-label amount">'.
price($this->amount).
'</span>';
1171 if (method_exists($this,
'LibStatut')) {
1172 $return .=
'<br><div class="info-box-status margintoponly">'.$this->getLibStatut(3).
'</div>';
1174 $return .=
'</div>';
1175 $return .=
'</div>';
1176 $return .=
'</div>';
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...
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.
call_trigger($triggerName, $user)
Call trigger based on this instance.
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 reamain 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 clicable 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.
generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
Create a document onto disk according to template module.
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.
load_state_board()
Charge indicateurs this->nb pour le tableau de bord.
set_cancel($id)
Set donation to status cancelled.
setPaid($id, $modepayment=0)
Classify the donation as paid, the donation was received.
getNomUrl($withpicto=0, $notooltip=0, $moretitle='', $save_lastsearch_value=-1)
Return clicable name (with picto eventually)
print $langs trans("Ref").' m m m statut
trait CommonPeople
Superclass for thirdparties, contacts, members or users.
dol_delete_preview($object)
Delete all preview files linked to object instance.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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.
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_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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.
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.
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...