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;
120 public $mode_reglement;
125 public $mode_reglement_code;
140 public $fk_typepayment;
148 public $modepaymentid = 0;
161 public $labelStatusShort;
164 const STATUS_DRAFT = 0;
165 const STATUS_VALIDATED = 1;
166 const STATUS_PAID = 2;
167 const STATUS_CANCELED = -1;
203 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
205 $langs->load(
"donations");
206 $this->labelStatus[-1] = $langs->transnoentitiesnoconv(
"Canceled");
207 $this->labelStatus[0] = $langs->transnoentitiesnoconv(
"DonationStatusPromiseNotValidated");
208 $this->labelStatus[1] = $langs->transnoentitiesnoconv(
"DonationStatusPromiseValidated");
209 $this->labelStatus[2] = $langs->transnoentitiesnoconv(
"DonationStatusPaid");
210 $this->labelStatusShort[-1] = $langs->transnoentitiesnoconv(
"Canceled");
211 $this->labelStatusShort[0] = $langs->transnoentitiesnoconv(
"DonationStatusPromiseNotValidatedShort");
212 $this->labelStatusShort[1] = $langs->transnoentitiesnoconv(
"DonationStatusPromiseValidatedShort");
213 $this->labelStatusShort[2] = $langs->transnoentitiesnoconv(
"DonationStatusPaidShort");
216 $statusType =
'status'.$status;
217 if ($status == self::STATUS_CANCELED) {
218 $statusType =
'status9';
220 if ($status == self::STATUS_PAID) {
221 $statusType =
'status6';
224 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status],
'', $statusType, $mode);
244 $sql =
"SELECT rowid";
245 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe";
246 $sql .=
" WHERE client IN (1, 3)";
247 $sql .=
" AND entity = ".$conf->entity;
250 $resql = $this->db->query($sql);
252 $num_socs = $this->db->num_rows($resql);
254 while ($i < $num_socs) {
255 $row = $this->db->fetch_row($resql);
256 $socids[$i] = $row[0];
264 $this->
ref =
'SPECIMEN';
266 $this->lastname =
'Doe';
267 $this->firstname =
'John';
268 $this->socid = empty($socids[0]) ? 0 : $socids[0];
270 $this->date_valid = $now;
271 $this->amount = 100.90;
273 $this->societe =
'The Company';
274 $this->address =
'Twist road';
275 $this->zip =
'99999';
276 $this->town =
'Town';
277 $this->note_private =
'Private note';
278 $this->note_public =
'Public note';
279 $this->email =
'email@email.com';
280 $this->phone =
'0123456789';
281 $this->phone_mobile =
'0606060606';
296 $langs->load(
'main');
297 $langs->load(
'companies');
299 $error_string = array();
304 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Company').
'/'.$langs->transnoentitiesnoconv(
'Firstname').
'-'.$langs->transnoentitiesnoconv(
'Lastname'));
310 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Address'));
315 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Zip'));
320 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Town'));
325 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'EMail'));
329 $this->amount = trim($this->amount);
333 for ($i = 0; $i < $len; $i++) {
334 if (!isset($map[substr($this->amount, $i, 1)])) {
335 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Amount'));
342 if (!$amount_invalid) {
343 if ($this->amount == 0) {
344 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Amount'));
347 if ($this->amount < $minimum && $minimum > 0) {
348 $error_string[] = $langs->trans(
'MinimumAmount', $langs->transnoentitiesnoconv(
'$minimum'));
355 $this->errors = $error_string;
370 public function create($user, $notrigger = 0)
372 global $conf, $langs;
379 $this->address = ($this->address > 0 ? $this->address : $this->address);
380 $this->zip = ($this->zip > 0 ? $this->zip : $this->zip);
381 $this->town = ($this->town > 0 ? $this->town : $this->town);
382 $this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id);
383 $this->country = ($this->country ? $this->country : $this->country);
384 $this->amount =
price2num($this->amount);
387 if ($this->amount < 0) {
388 $this->error = $langs->trans(
'FieldCannotBeNegative', $langs->transnoentitiesnoconv(
"Amount"));
394 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"don (";
398 $sql .=
", fk_payment";
400 $sql .=
", firstname";
401 $sql .=
", lastname";
406 $sql .=
", fk_country";
408 $sql .=
", fk_projet";
409 $sql .=
", note_private";
410 $sql .=
", note_public";
411 $sql .=
", fk_user_author";
412 $sql .=
", fk_user_valid";
416 $sql .=
", phone_mobile";
417 $sql .=
") VALUES (";
418 $sql .=
"'".$this->db->idate($this->date ? $this->date : $now).
"'";
419 $sql .=
", ".((int) $conf->entity);
420 $sql .=
", ".((float) $this->amount);
421 $sql .=
", ".($this->modepaymentid ? $this->modepaymentid :
"null");
422 $sql .=
", ".($this->socid > 0 ? $this->socid :
"null");
423 $sql .=
", '".$this->db->escape($this->firstname).
"'";
424 $sql .=
", '".$this->db->escape($this->lastname).
"'";
425 $sql .=
", '".$this->db->escape($this->societe).
"'";
426 $sql .=
", '".$this->db->escape($this->address).
"'";
427 $sql .=
", '".$this->db->escape($this->zip).
"'";
428 $sql .=
", '".$this->db->escape($this->town).
"'";
429 $sql .=
", ".(int) ($this->country_id > 0 ? $this->country_id : 0);
430 $sql .=
", ".(int) $this->
public;
431 $sql .=
", ".($this->fk_project > 0 ? (int) $this->fk_project :
"null");
432 $sql .=
", ".(!empty($this->note_private) ? (
"'".$this->db->escape($this->note_private).
"'") :
"NULL");
433 $sql .=
", ".(!empty($this->note_public) ? (
"'".$this->db->escape($this->note_public).
"'") :
"NULL");
434 $sql .=
", ".((int) $user->id);
436 $sql .=
", '".$this->db->idate($this->date).
"'";
437 $sql .=
", '".(!empty($this->email) ? $this->db->escape(trim($this->email)) :
"").
"'";
438 $sql .=
", '".(!empty($this->phone) ? $this->db->escape(trim($this->phone)) :
"").
"'";
439 $sql .=
", '".(!empty($this->phone_mobile) ? $this->db->escape(trim($this->phone_mobile)) :
"").
"'";
442 $resql = $this->db->query($sql);
444 $this->
id = $this->db->last_insert_id(MAIN_DB_PREFIX.
"don");
456 $this->error = $this->db->lasterror();
477 $this->db->rollback();
489 public function update($user, $notrigger = 0)
496 $this->address = ($this->address > 0 ? $this->address : $this->address);
497 $this->zip = ($this->zip > 0 ? $this->zip : $this->zip);
498 $this->town = ($this->town > 0 ? $this->town : $this->town);
499 $this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id);
500 $this->country = ($this->country ? $this->country : $this->country);
501 $this->amount =
price2num($this->amount);
504 if ($this->amount < 0) {
505 $this->error = $langs->trans(
'FieldCannotBeNegative', $langs->transnoentitiesnoconv(
"Amount"));
511 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"don SET";
512 $sql .=
" amount = ".((float) $this->amount);
513 $sql .=
", fk_payment = ".($this->modepaymentid ? $this->modepaymentid :
"null");
514 $sql .=
", firstname = '".$this->db->escape($this->firstname).
"'";
515 $sql .=
", lastname='".$this->db->escape($this->lastname).
"'";
516 $sql .=
", societe='".$this->db->escape($this->societe).
"'";
517 $sql .=
", address='".$this->db->escape($this->address).
"'";
518 $sql .=
", zip='".$this->db->escape($this->zip).
"'";
519 $sql .=
", town='".$this->db->escape($this->town).
"'";
520 $sql .=
", fk_country = ".($this->country_id > 0 ? ((int) $this->country_id) :
'0');
521 $sql .=
", public=".((int) $this->
public);
522 $sql .=
", fk_projet=".($this->fk_project > 0 ? $this->fk_project :
'null');
523 $sql .=
", note_private=".(!empty($this->note_private) ? (
"'".$this->db->escape($this->note_private).
"'") :
"NULL");
524 $sql .=
", note_public=".(!empty($this->note_public) ? (
"'".$this->db->escape($this->note_public).
"'") :
"NULL");
525 $sql .=
", datedon='".$this->db->idate($this->date).
"'";
526 $sql .=
", date_valid=".($this->date_valid ?
"'".$this->db->idate($this->date).
"'" :
"null");
527 $sql .=
", email='".$this->db->escape(trim($this->email)).
"'";
528 $sql .=
", phone='".$this->db->escape(trim($this->phone)).
"'";
529 $sql .=
", phone_mobile='".$this->db->escape(trim($this->phone_mobile)).
"'";
530 $sql .=
", fk_statut=".((int) $this->
statut);
531 $sql .=
" WHERE rowid = ".((int) $this->
id);
533 dol_syslog(get_class($this).
"::Update", LOG_DEBUG);
534 $resql = $this->db->query($sql);
557 $this->db->rollback();
561 $this->error = $this->db->lasterror();
562 $this->errors[] = $this->error;
563 $this->db->rollback();
564 dol_syslog(get_class($this).
"::Update error -2 ".$this->error, LOG_ERR);
577 public function delete($user, $notrigger = 0)
579 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
585 if (!$error && !$notrigger) {
597 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"don_extrafields";
598 $sql .=
" WHERE fk_object = ".((int) $this->
id);
600 $resql = $this->db->query($sql);
602 $this->errors[] = $this->db->lasterror();
608 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"don";
609 $sql .=
" WHERE rowid=".((int) $this->
id);
611 $resql = $this->db->query($sql);
613 $this->errors[] = $this->db->lasterror();
622 foreach ($this->errors as $errmsg) {
623 dol_syslog(get_class($this).
"::delete ".$errmsg, LOG_ERR);
624 $this->error .= ($this->error ?
', '.$errmsg : $errmsg);
626 dol_syslog(get_class($this).
"::delete ".$this->error, LOG_ERR);
627 $this->db->rollback();
639 public function fetch($id, $ref =
'')
641 $sql =
"SELECT d.rowid, d.datec, d.date_valid, d.tms as datem, d.datedon,";
642 $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, ";
643 $sql .=
" d.fk_country, d.public, d.amount, d.fk_payment, d.paid, d.note_private, d.note_public, d.email, d.phone, ";
644 $sql .=
" d.phone_mobile, d.fk_projet as fk_project, d.model_pdf,";
645 $sql .=
" p.ref as project_ref,";
646 $sql .=
" cp.libelle as payment_label, cp.code as payment_code,";
647 $sql .=
" c.code as country_code, c.label as country";
648 $sql .=
" FROM ".MAIN_DB_PREFIX.
"don as d";
649 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = d.fk_projet";
650 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as cp ON cp.id = d.fk_payment";
651 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as c ON d.fk_country = c.rowid";
652 $sql .=
" WHERE d.entity IN (".getEntity(
'donation').
")";
654 $sql .=
" AND d.rowid=".((int) $id);
655 } elseif (!empty($ref)) {
656 $sql .=
" AND d.ref='".$this->db->escape($ref).
"'";
659 dol_syslog(get_class($this).
"::fetch", LOG_DEBUG);
660 $resql = $this->db->query($sql);
662 if ($this->db->num_rows($resql)) {
663 $obj = $this->db->fetch_object($resql);
665 $this->
id = $obj->rowid;
666 $this->
ref = $obj->rowid;
667 $this->date_creation = $this->db->jdate($obj->datec);
668 $this->datec = $this->db->jdate($obj->datec);
669 $this->date_validation = $this->db->jdate($obj->date_valid);
670 $this->date_valid = $this->db->jdate($obj->date_valid);
671 $this->date_modification = $this->db->jdate($obj->datem);
672 $this->datem = $this->db->jdate($obj->datem);
673 $this->date = $this->db->jdate($obj->datedon);
674 $this->socid = $obj->socid;
675 $this->firstname = $obj->firstname;
676 $this->lastname = $obj->lastname;
677 $this->societe = $obj->societe;
678 $this->
status = $obj->status;
679 $this->
statut = $obj->status;
680 $this->address = $obj->address;
681 $this->zip = $obj->zip;
682 $this->town = $obj->town;
683 $this->country_id = $obj->fk_country;
684 $this->country_code = $obj->country_code;
685 $this->country = $obj->country;
686 $this->email = $obj->email;
687 $this->phone = $obj->phone;
688 $this->phone_mobile = $obj->phone_mobile;
689 $this->project = $obj->project_ref;
690 $this->fk_projet = $obj->fk_project;
691 $this->fk_project = $obj->fk_project;
692 $this->
public = $obj->public;
693 $this->mode_reglement_id = $obj->fk_payment;
694 $this->mode_reglement_code = $obj->payment_code;
695 $this->mode_reglement = $obj->payment_label;
696 $this->paid = $obj->paid;
697 $this->amount = $obj->amount;
698 $this->note_private = $obj->note_private;
699 $this->note_public = $obj->note_public;
700 $this->model_pdf = $obj->model_pdf;
743 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"don SET fk_statut = 1, fk_user_valid = ".((int) $userid).
" WHERE rowid = ".((int) $id).
" AND fk_statut = 0";
745 $resql = $this->db->query($sql);
747 if ($this->db->affected_rows($resql)) {
759 $this->error = $this->db->lasterror();
767 $this->db->rollback();
779 public function setPaid($id, $modepayment = 0)
781 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"don SET fk_statut = 2, paid = 1";
783 $sql .=
", fk_payment = ".((int) $modepayment);
785 $sql .=
" WHERE rowid = ".((int) $id).
" AND fk_statut = 1";
787 $resql = $this->db->query($sql);
789 if ($this->db->affected_rows($resql)) {
812 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"don SET fk_statut = -1 WHERE rowid = ".((int) $id);
814 $resql = $this->db->query($sql);
816 if ($this->db->affected_rows($resql)) {
835 public function reopen($user, $notrigger = 0)
838 if ($this->
statut != self::STATUS_CANCELED) {
849 return $this->
setStatusCommon($user, self::STATUS_VALIDATED, $notrigger,
'DON_REOPEN');
866 $sql =
"SELECT sum(amount) as total";
867 $sql .=
" FROM ".MAIN_DB_PREFIX.
"don";
868 $sql .=
" WHERE fk_statut = ".((int) $param);
869 $sql .=
" AND entity = ".$conf->entity;
871 $resql = $this->db->query($sql);
873 $obj = $this->db->fetch_object($resql);
874 $result = $obj->total;
891 $sql =
"SELECT count(d.rowid) as nb";
892 $sql .=
" FROM ".MAIN_DB_PREFIX.
"don as d";
893 $sql .=
" WHERE d.fk_statut > 0";
894 $sql .=
" AND d.entity IN (".getEntity(
'donation').
")";
896 $resql = $this->db->query($sql);
898 while ($obj = $this->db->fetch_object($resql)) {
899 $this->nb[
"donations"] = $obj->nb;
901 $this->db->free($resql);
905 $this->error = $this->db->error();
919 public function getNomUrl($withpicto = 0, $notooltip = 0, $moretitle =
'', $save_lastsearch_value = -1)
921 global $conf, $langs, $hookmanager;
923 if (!empty($conf->dol_no_mouse_hover)) {
928 $label =
img_picto(
'', $this->picto).
' <u class="paddingrightonly">'.$langs->trans(
"Donation").
'</u>';
929 if (isset($this->
status)) {
930 $label .=
' '.$this->getLibStatut(5);
932 if (!empty($this->
id)) {
933 $label .=
'<br><b>'.$langs->trans(
'Ref').
':</b> '.$this->id;
934 $label .=
'<br><b>'.$langs->trans(
'Date').
':</b> '.
dol_print_date($this->date,
'day');
937 $label .=
' - '.$moretitle;
940 $url = DOL_URL_ROOT.
'/don/card.php?id='.$this->id;
942 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
943 if ($save_lastsearch_value == -1 && isset($_SERVER[
"PHP_SELF"]) && preg_match(
'/list\.php/', $_SERVER[
"PHP_SELF"])) {
944 $add_save_lastsearch_values = 1;
946 if ($add_save_lastsearch_values) {
947 $url .=
'&save_lastsearch_values=1';
950 $linkstart =
'<a href="'.$url.
'" title="'.
dol_escape_htmltag($label, 1).
'" class="classfortooltip">';
953 $result .= $linkstart;
955 $result .=
img_object(($notooltip ?
'' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ?
'class="paddingright"' :
'') :
'class="'.(($withpicto != 2) ?
'paddingright ' :
'').
'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
957 if ($withpicto != 2) {
958 $result .= $this->ref;
962 $hookmanager->initHooks(array($this->element .
'dao'));
963 $parameters = array(
'id'=>$this->
id,
'getnomurl' => &$result);
964 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
966 $result = $hookmanager->resPrint;
968 $result .= $hookmanager->resPrint;
981 $sql =
'SELECT d.rowid, d.datec, d.fk_user_author, d.fk_user_valid,';
982 $sql .=
' d.tms as datem';
983 $sql .=
' FROM '.MAIN_DB_PREFIX.
'don as d';
984 $sql .=
' WHERE d.rowid = '.((int) $id);
986 dol_syslog(get_class($this).
'::info', LOG_DEBUG);
987 $result = $this->db->query($sql);
990 if ($this->db->num_rows($result)) {
991 $obj = $this->db->fetch_object($result);
992 $this->
id = $obj->rowid;
994 $this->user_creation_id = $obj->fk_user_author;
995 $this->user_validation_id = $obj->fk_user_valid;
996 $this->date_creation = $this->db->jdate($obj->datec);
997 $this->date_modification = (!empty($obj->tms) ? $this->db->jdate($obj->tms) :
"");
999 $this->db->free($result);
1016 public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
1018 global $conf, $langs;
1020 $langs->load(
"bills");
1023 $modele =
'html_cerfafr';
1025 if ($this->model_pdf) {
1026 $modele = $this->model_pdf;
1028 $modele = $conf->global->DON_ADDON_MODEL;
1038 $err = error_reporting();
1040 @set_time_limit(120);
1041 error_reporting($err);
1043 $srctemplatepath =
'';
1046 $tmp = explode(
':', $modele, 2);
1047 if (!empty($tmp[1])) {
1049 $srctemplatepath = $tmp[1];
1056 $dirmodels = array(
'/');
1057 if (is_array($conf->modules_parts[
'models'])) {
1058 $dirmodels = array_merge($dirmodels, $conf->modules_parts[
'models']);
1060 foreach ($dirmodels as $reldir) {
1061 foreach (array(
'html',
'doc',
'pdf') as $prefix) {
1062 $file = $prefix.
"_".preg_replace(
'/^html_/',
'', $modele).
".modules.php";
1065 $file =
dol_buildpath($reldir.
"core/modules/dons/".$file, 0);
1066 if (file_exists($file)) {
1068 $classname = $prefix.
'_'.$modele;
1083 $classname = $modele;
1084 $obj =
new $classname($this->db);
1088 $sav_charset_output = $outputlangs->charset_output;
1089 if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0) {
1090 $outputlangs->charset_output = $sav_charset_output;
1093 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
1097 $outputlangs->charset_output = $sav_charset_output;
1103 print $langs->trans(
"Error").
" ".$langs->trans(
"ErrorFileDoesNotExists", $file);
1134 if (empty($this->
id)) {
1135 $this->error =
'Missing object id';
1136 $this->errors[] = $this->error;
1137 dol_syslog(__METHOD__.
' : '.$this->error, LOG_ERR);
1141 $sql =
"SELECT SUM(amount) as sum_amount FROM ".MAIN_DB_PREFIX.
"payment_donation WHERE fk_donation = ".((int) $this->
id);
1142 $resql = $this->db->query($sql);
1147 $sum_amount = (float) $this->db->fetch_object($resql)->sum_amount;
1148 return (
float) $this->amount - $sum_amount;
1163 $selected = (empty($arraydata[
'selected']) ? 0 : $arraydata[
'selected']);
1165 $return =
'<div class="box-flex-item box-flex-grow-zero">';
1166 $return .=
'<div class="info-box info-box-sm">';
1167 $return .=
'<span class="info-box-icon bg-infobox-action">';
1169 $return .=
'</span>';
1170 $return .=
'<div class="info-box-content">';
1171 $return .=
'<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this,
'getNomUrl') ? $this->
getNomUrl(1) : $this->ref).
'</span>';
1172 if ($selected >= 0) {
1173 $return .=
'<input id="cb'.$this->id.
'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->
id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1175 if (property_exists($this,
'date')) {
1176 $return .=
' | <span class="opacitymedium" >'.$langs->trans(
"Date").
'</span> : <span class="info-box-label">'.
dol_print_date($this->date).
'</span>';
1178 if (property_exists($this,
'societe') && !empty($this->societe)) {
1179 $return .=
'<br><span class="opacitymedium">'.$langs->trans(
"Company").
'</span> : <span class="info-box-label">'.$this->societe.
'</span>';
1181 if (property_exists($this,
'amount')) {
1182 $return .=
'<br><span class="opacitymedium" >'.$langs->trans(
"Amount").
'</span> : <span class="info-box-label amount">'.
price($this->amount).
'</span>';
1184 if (method_exists($this,
'LibStatut')) {
1185 $return .=
'<br><div class="info-box-status margintoponly">'.$this->getLibStatut(3).
'</div>';
1187 $return .=
'</div>';
1188 $return .=
'</div>';
1189 $return .=
'</div>';
print $langs trans("AuditedSecurityEvents").'</strong >< span class="opacitymedium"></span >< br > status
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)
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...
publicphonebutton2 phonegreen basiclayout basiclayout TotalHT VATCode TotalVAT TotalLT1 TotalLT2 TotalTTC TotalHT clearboth nowraponall right right takeposterminal SELECT e e e e e statut