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;
171 const STATUS_DRAFT = 0;
172 const STATUS_VALIDATED = 1;
173 const STATUS_PAID = 2;
174 const STATUS_CANCELED = -1;
186 $this->ismultientitymanaged = 1;
212 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
214 $langs->load(
"donations");
215 $this->labelStatus[-1] = $langs->transnoentitiesnoconv(
"Canceled");
216 $this->labelStatus[0] = $langs->transnoentitiesnoconv(
"DonationStatusPromiseNotValidated");
217 $this->labelStatus[1] = $langs->transnoentitiesnoconv(
"DonationStatusPromiseValidated");
218 $this->labelStatus[2] = $langs->transnoentitiesnoconv(
"DonationStatusPaid");
219 $this->labelStatusShort[-1] = $langs->transnoentitiesnoconv(
"Canceled");
220 $this->labelStatusShort[0] = $langs->transnoentitiesnoconv(
"DonationStatusPromiseNotValidatedShort");
221 $this->labelStatusShort[1] = $langs->transnoentitiesnoconv(
"DonationStatusPromiseValidatedShort");
222 $this->labelStatusShort[2] = $langs->transnoentitiesnoconv(
"DonationStatusPaidShort");
225 $statusType =
'status'.$status;
226 if ($status == self::STATUS_CANCELED) {
227 $statusType =
'status9';
229 if ($status == self::STATUS_PAID) {
230 $statusType =
'status6';
233 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status],
'', $statusType, $mode);
253 $sql =
"SELECT rowid";
254 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe";
255 $sql .=
" WHERE client IN (1, 3)";
256 $sql .=
" AND entity = ".$conf->entity;
259 $resql = $this->db->query($sql);
261 $num_socs = $this->db->num_rows($resql);
263 while ($i < $num_socs) {
264 $row = $this->db->fetch_row($resql);
265 $socids[$i] = $row[0];
273 $this->
ref =
'SPECIMEN';
275 $this->lastname =
'Doe';
276 $this->firstname =
'John';
277 $this->socid = empty($socids[0]) ? 0 : $socids[0];
279 $this->date_valid = $now;
280 $this->amount = 100.90;
282 $this->societe =
'The Company';
284 $this->zip =
'99999';
285 $this->town =
'Town';
286 $this->note_private =
'Private note';
287 $this->note_public =
'Public note';
288 $this->
email =
'email@email.com';
289 $this->phone =
'0123456789';
290 $this->phone_mobile =
'0606060606';
307 $langs->load(
'main');
308 $langs->load(
'companies');
310 $error_string = array();
316 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Company').
'/'.$langs->transnoentitiesnoconv(
'Firstname').
'-'.$langs->transnoentitiesnoconv(
'Lastname'));
322 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Address'));
327 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Zip'));
332 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Town'));
337 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'EMail'));
341 $this->amount = (float) $this->amount;
345 for ($i = 0; $i < $len; $i++) {
346 if (!isset($map[substr((
string) $this->amount, $i, 1)])) {
347 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Amount'));
354 if (!$amount_invalid) {
355 if ($this->amount == 0) {
356 $error_string[] = $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Amount'));
359 if ($this->amount < $minimum && $minimum > 0) {
360 $error_string[] = $langs->trans(
'MinimumAmount', $minimum);
367 $this->errors = $error_string;
382 public function create($user, $notrigger = 0)
384 global
$conf, $langs;
396 $this->amount = (float)
price2num($this->amount);
399 if ($this->amount < 0) {
400 $this->error = $langs->trans(
'FieldCannotBeNegative', $langs->transnoentitiesnoconv(
"Amount"));
406 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"don (";
410 $sql .=
", fk_payment";
412 $sql .=
", firstname";
413 $sql .=
", lastname";
418 $sql .=
", fk_country";
420 $sql .=
", fk_projet";
421 $sql .=
", note_private";
422 $sql .=
", note_public";
423 $sql .=
", fk_user_author";
424 $sql .=
", fk_user_valid";
428 $sql .=
", phone_mobile";
429 $sql .=
") VALUES (";
430 $sql .=
"'".$this->db->idate($this->date ? $this->date : $now).
"'";
431 $sql .=
", ".((int)
$conf->entity);
432 $sql .=
", ".((float) $this->amount);
433 $sql .=
", ".($this->modepaymentid ? $this->modepaymentid :
"null");
434 $sql .=
", ".($this->socid > 0 ? $this->socid :
"null");
435 $sql .=
", '".$this->db->escape($this->firstname).
"'";
436 $sql .=
", '".$this->db->escape($this->lastname).
"'";
437 $sql .=
", '".$this->db->escape($this->societe).
"'";
438 $sql .=
", '".$this->db->escape($this->
address).
"'";
439 $sql .=
", '".$this->db->escape($this->zip).
"'";
440 $sql .=
", '".$this->db->escape($this->town).
"'";
441 $sql .=
", ".(int) ($this->country_id > 0 ? $this->country_id : 0);
442 $sql .=
", ".(int) $this->
public;
443 $sql .=
", ".($this->fk_project > 0 ? (int) $this->fk_project :
"null");
444 $sql .=
", ".(!empty($this->note_private) ? (
"'".$this->db->escape($this->note_private).
"'") :
"NULL");
445 $sql .=
", ".(!empty($this->note_public) ? (
"'".$this->db->escape($this->note_public).
"'") :
"NULL");
446 $sql .=
", ".((int) $user->id);
448 $sql .=
", '".$this->db->idate($this->date).
"'";
449 $sql .=
", '".(!empty($this->
email) ? $this->db->escape(trim($this->
email)) :
"").
"'";
450 $sql .=
", '".(!empty($this->phone) ? $this->db->escape(trim($this->phone)) :
"").
"'";
451 $sql .=
", '".(!empty($this->phone_mobile) ? $this->db->escape(trim($this->phone_mobile)) :
"").
"'";
454 $resql = $this->db->query($sql);
456 $this->
id = $this->db->last_insert_id(MAIN_DB_PREFIX.
"don");
468 $this->error = $this->db->lasterror();
489 $this->db->rollback();
501 public function update($user, $notrigger = 0)
513 $this->amount = (float)
price2num($this->amount);
516 if ($this->amount < 0) {
517 $this->error = $langs->trans(
'FieldCannotBeNegative', $langs->transnoentitiesnoconv(
"Amount"));
523 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"don SET";
524 $sql .=
" amount = ".((float) $this->amount);
525 $sql .=
", fk_payment = ".($this->modepaymentid ? $this->modepaymentid :
"null");
526 $sql .=
", firstname = '".$this->db->escape($this->firstname).
"'";
527 $sql .=
", lastname='".$this->db->escape($this->lastname).
"'";
528 $sql .=
", societe='".$this->db->escape($this->societe).
"'";
529 $sql .=
", address='".$this->db->escape($this->
address).
"'";
530 $sql .=
", zip='".$this->db->escape($this->zip).
"'";
531 $sql .=
", town='".$this->db->escape($this->town).
"'";
532 $sql .=
", fk_country = ".($this->country_id > 0 ? ((int) $this->country_id) :
'0');
533 $sql .=
", public=".((int) $this->
public);
534 $sql .=
", fk_projet=".($this->fk_project > 0 ? $this->fk_project :
'null');
535 $sql .=
", note_private=".(!empty($this->note_private) ? (
"'".$this->db->escape($this->note_private).
"'") :
"NULL");
536 $sql .=
", note_public=".(!empty($this->note_public) ? (
"'".$this->db->escape($this->note_public).
"'") :
"NULL");
537 $sql .=
", datedon='".$this->db->idate($this->date).
"'";
538 $sql .=
", date_valid=".($this->date_valid ?
"'".$this->db->idate($this->date).
"'" :
"null");
539 $sql .=
", email='".$this->db->escape(trim($this->
email)).
"'";
540 $sql .=
", phone='".$this->db->escape(trim($this->phone)).
"'";
541 $sql .=
", phone_mobile='".$this->db->escape(trim($this->phone_mobile)).
"'";
542 $sql .=
", fk_statut=".((int) $this->
status);
543 $sql .=
" WHERE rowid = ".((int) $this->
id);
545 dol_syslog(get_class($this).
"::Update", LOG_DEBUG);
546 $resql = $this->db->query($sql);
569 $this->db->rollback();
573 $this->error = $this->db->lasterror();
574 $this->errors[] = $this->error;
575 $this->db->rollback();
576 dol_syslog(get_class($this).
"::Update error -2 ".$this->error, LOG_ERR);
589 public function delete($user, $notrigger = 0)
591 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
597 if (!$error && !$notrigger) {
609 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"don_extrafields";
610 $sql .=
" WHERE fk_object = ".((int) $this->
id);
612 $resql = $this->db->query($sql);
614 $this->errors[] = $this->db->lasterror();
620 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"don";
621 $sql .=
" WHERE rowid=".((int) $this->
id);
623 $resql = $this->db->query($sql);
625 $this->errors[] = $this->db->lasterror();
631 $dir = DOL_DATA_ROOT.
'/'.$this->element.
'/'.$this->ref;
635 $this->errors[] = $this->error;
645 foreach ($this->errors as $errmsg) {
646 dol_syslog(get_class($this).
"::delete ".$errmsg, LOG_ERR);
647 $this->error .= ($this->error ?
', '.$errmsg : $errmsg);
649 dol_syslog(get_class($this).
"::delete ".$this->error, LOG_ERR);
650 $this->db->rollback();
662 public function fetch($id, $ref =
'')
664 $sql =
"SELECT d.rowid, d.datec, d.date_valid, d.tms as datem, d.datedon,";
665 $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, ";
666 $sql .=
" d.fk_country, d.public, d.amount, d.fk_payment, d.paid, d.note_private, d.note_public, d.email, d.phone, ";
667 $sql .=
" d.phone_mobile, d.fk_projet as fk_project, d.model_pdf,";
668 $sql .=
" p.ref as project_ref,";
669 $sql .=
" cp.libelle as payment_label, cp.code as payment_code,";
670 $sql .=
" c.code as country_code, c.label as country";
671 $sql .=
" FROM ".MAIN_DB_PREFIX.
"don as d";
672 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = d.fk_projet";
673 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as cp ON cp.id = d.fk_payment";
674 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as c ON d.fk_country = c.rowid";
675 $sql .=
" WHERE d.entity IN (".getEntity(
'donation').
")";
677 $sql .=
" AND d.rowid=".((int) $id);
678 } elseif (!empty($ref)) {
679 $sql .=
" AND d.ref='".$this->db->escape($ref).
"'";
682 dol_syslog(get_class($this).
"::fetch", LOG_DEBUG);
683 $resql = $this->db->query($sql);
685 if ($this->db->num_rows($resql)) {
686 $obj = $this->db->fetch_object($resql);
688 $this->
id = $obj->rowid;
689 $this->
ref = $obj->rowid;
690 $this->date_creation = $this->db->jdate($obj->datec);
691 $this->datec = $this->db->jdate($obj->datec);
692 $this->date_validation = $this->db->jdate($obj->date_valid);
693 $this->date_valid = $this->db->jdate($obj->date_valid);
694 $this->date_modification = $this->db->jdate($obj->datem);
695 $this->datem = $this->db->jdate($obj->datem);
696 $this->date = $this->db->jdate($obj->datedon);
697 $this->socid = $obj->socid;
698 $this->firstname = $obj->firstname;
699 $this->lastname = $obj->lastname;
700 $this->societe = $obj->societe;
701 $this->
status = $obj->status;
702 $this->statut = $obj->status;
703 $this->
address = $obj->address;
704 $this->zip = $obj->zip;
705 $this->town = $obj->town;
706 $this->country_id = $obj->fk_country;
707 $this->country_code = $obj->country_code;
708 $this->country = $obj->country;
709 $this->
email = $obj->email;
710 $this->phone = $obj->phone;
711 $this->phone_mobile = $obj->phone_mobile;
712 $this->project = $obj->project_ref;
713 $this->fk_projet = $obj->fk_project;
714 $this->fk_project = $obj->fk_project;
715 $this->
public = $obj->public;
716 $this->mode_reglement_id = $obj->fk_payment;
717 $this->mode_reglement_code = $obj->payment_code;
718 $this->mode_reglement = $obj->payment_label;
719 $this->paid = $obj->paid;
720 $this->amount = $obj->amount;
721 $this->note_private = $obj->note_private;
722 $this->note_public = $obj->note_public;
723 $this->model_pdf = $obj->model_pdf;
767 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"don SET fk_statut = 1, fk_user_valid = ".((int) $userid).
" WHERE rowid = ".((int) $id).
" AND fk_statut = 0";
769 $resql = $this->db->query($sql);
771 if ($this->db->affected_rows($resql)) {
783 $this->error = $this->db->lasterror();
791 $this->db->rollback();
803 public function setPaid($id, $modepayment = 0)
805 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"don SET fk_statut = 2, paid = 1";
807 $sql .=
", fk_payment = ".((int) $modepayment);
809 $sql .=
" WHERE rowid = ".((int) $id).
" AND fk_statut = 1";
811 $resql = $this->db->query($sql);
813 if ($this->db->affected_rows($resql)) {
836 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"don SET fk_statut = -1 WHERE rowid = ".((int) $id);
838 $resql = $this->db->query($sql);
840 if ($this->db->affected_rows($resql)) {
859 public function reopen($user, $notrigger = 0)
862 if ($this->
status != self::STATUS_CANCELED) {
866 return $this->
setStatusCommon($user, self::STATUS_VALIDATED, $notrigger,
'DON_REOPEN');
883 $sql =
"SELECT sum(amount) as total";
884 $sql .=
" FROM ".MAIN_DB_PREFIX.
"don";
885 $sql .=
" WHERE fk_statut = ".((int) $param);
886 $sql .=
" AND entity = ".$conf->entity;
888 $resql = $this->db->query($sql);
890 $obj = $this->db->fetch_object($resql);
891 $result = $obj->total;
906 $sql =
"SELECT count(d.rowid) as nb";
907 $sql .=
" FROM ".MAIN_DB_PREFIX.
"don as d";
908 $sql .=
" WHERE d.fk_statut > 0";
909 $sql .=
" AND d.entity IN (".getEntity(
'donation').
")";
911 $resql = $this->db->query($sql);
913 while ($obj = $this->db->fetch_object($resql)) {
914 $this->nb[
"donations"] = $obj->nb;
916 $this->db->free($resql);
920 $this->error = $this->db->error();
934 public function getNomUrl($withpicto = 0, $notooltip = 0, $moretitle =
'', $save_lastsearch_value = -1)
936 global
$conf, $langs, $hookmanager;
938 if (!empty(
$conf->dol_no_mouse_hover)) {
943 $label =
img_picto(
'', $this->picto).
' <u class="paddingrightonly">'.$langs->trans(
"Donation").
'</u>';
944 if (isset($this->
status)) {
945 $label .=
' '.$this->getLibStatut(5);
947 if (!empty($this->
id)) {
948 $label .=
'<br><b>'.$langs->trans(
'Ref').
':</b> '.$this->id;
949 $label .=
'<br><b>'.$langs->trans(
'Date').
':</b> '.
dol_print_date($this->date,
'day');
952 $label .=
' - '.$moretitle;
955 $url = DOL_URL_ROOT.
'/don/card.php?id='.$this->id;
957 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
958 if ($save_lastsearch_value == -1 && isset($_SERVER[
"PHP_SELF"]) && preg_match(
'/list\.php/', $_SERVER[
"PHP_SELF"])) {
959 $add_save_lastsearch_values = 1;
961 if ($add_save_lastsearch_values) {
962 $url .=
'&save_lastsearch_values=1';
965 $linkstart =
'<a href="'.$url.
'" title="'.
dol_escape_htmltag($label, 1).
'" class="classfortooltip">';
968 $result .= $linkstart;
970 $result .=
img_object(($notooltip ?
'' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ?
'class="paddingright"' :
'') :
'class="'.(($withpicto != 2) ?
'paddingright ' :
'').
'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
972 if ($withpicto != 2) {
973 $result .= $this->ref;
977 $hookmanager->initHooks(array($this->element .
'dao'));
978 $parameters = array(
'id' => $this->
id,
'getnomurl' => &$result);
979 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
981 $result = $hookmanager->resPrint;
983 $result .= $hookmanager->resPrint;
996 $sql =
'SELECT d.rowid, d.datec, d.fk_user_author, d.fk_user_valid,';
997 $sql .=
' d.tms as datem';
998 $sql .=
' FROM '.MAIN_DB_PREFIX.
'don as d';
999 $sql .=
' WHERE d.rowid = '.((int) $id);
1001 dol_syslog(get_class($this).
'::info', LOG_DEBUG);
1002 $result = $this->db->query($sql);
1005 if ($this->db->num_rows($result)) {
1006 $obj = $this->db->fetch_object($result);
1007 $this->
id = $obj->rowid;
1009 $this->user_creation_id = $obj->fk_user_author;
1010 $this->user_validation_id = $obj->fk_user_valid;
1011 $this->date_creation = $this->db->jdate($obj->datec);
1012 $this->date_modification = (!empty($obj->tms) ? $this->db->jdate($obj->tms) :
"");
1014 $this->db->free($result);
1031 public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
1033 global
$conf, $langs;
1035 $langs->load(
"bills");
1038 $modele =
'html_cerfafr';
1040 if ($this->model_pdf) {
1041 $modele = $this->model_pdf;
1053 $err = error_reporting();
1055 @set_time_limit(120);
1056 error_reporting($err);
1058 $srctemplatepath =
'';
1061 $tmp = explode(
':', $modele, 2);
1062 if (!empty($tmp[1])) {
1064 $srctemplatepath = $tmp[1];
1071 $dirmodels = array(
'/');
1072 if (is_array(
$conf->modules_parts[
'models'])) {
1073 $dirmodels = array_merge($dirmodels,
$conf->modules_parts[
'models']);
1075 foreach ($dirmodels as $reldir) {
1076 foreach (array(
'html',
'doc',
'pdf') as $prefix) {
1077 $file = $prefix.
"_".preg_replace(
'/^html_/',
'', $modele).
".modules.php";
1080 $file =
dol_buildpath($reldir.
"core/modules/dons/".$file, 0);
1081 if (file_exists($file)) {
1083 $classname = $prefix.
'_'.$modele;
1098 $classname = $modele;
1099 $obj =
new $classname($this->db);
1101 '@phan-var-force ModeleDon $obj';
1105 $sav_charset_output = $outputlangs->charset_output;
1106 if ($obj->write_file(
$object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0) {
1107 $outputlangs->charset_output = $sav_charset_output;
1110 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
1114 $outputlangs->charset_output = $sav_charset_output;
1120 print $langs->trans(
"Error").
" ".$langs->trans(
"ErrorFileDoesNotExists", $file);
1151 if (empty($this->
id)) {
1152 $this->error =
'Missing object id';
1153 $this->errors[] = $this->error;
1154 dol_syslog(__METHOD__.
' : '.$this->error, LOG_ERR);
1158 $sql =
"SELECT SUM(amount) as sum_amount FROM ".MAIN_DB_PREFIX.
"payment_donation WHERE fk_donation = ".((int) $this->
id);
1159 $resql = $this->db->query($sql);
1164 $sum_amount = (float) $this->db->fetch_object($resql)->sum_amount;
1165 return (
float) ($this->amount - $sum_amount);
1178 global
$conf, $langs;
1180 $selected = (empty($arraydata[
'selected']) ? 0 : $arraydata[
'selected']);
1182 $return =
'<div class="box-flex-item box-flex-grow-zero">';
1183 $return .=
'<div class="info-box info-box-sm">';
1184 $return .=
'<span class="info-box-icon bg-infobox-action">';
1186 $return .=
'</span>';
1187 $return .=
'<div class="info-box-content">';
1188 $return .=
'<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this,
'getNomUrl') ? $this->
getNomUrl(1) : $this->ref).
'</span>';
1189 if ($selected >= 0) {
1190 $return .=
'<input id="cb'.$this->id.
'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->
id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1192 if (property_exists($this,
'date')) {
1193 $return .=
' | <span class="info-box-label">'.dol_print_date($this->date,
'day',
'tzuserrel').
'</span>';
1195 if (property_exists($this,
'societe') && !empty($this->societe)) {
1196 $return .=
'<br><span class="opacitymedium">'.$langs->trans(
"Company").
'</span> : <span class="info-box-label">'.$this->societe.
'</span>';
1198 if (property_exists($this,
'amount')) {
1199 $return .=
'<br><span class="info-box-label amount">'.price($this->amount, 1, $langs, 1, -1, -1,
$conf->currency).
'</span>';
1201 if (method_exists($this,
'LibStatut')) {
1202 $return .=
'<br><div class="info-box-status">'.$this->getLibStatut(3).
'</div>';
1204 $return .=
'</div>';
1205 $return .=
'</div>';
1206 $return .=
'</div>';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $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.
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 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.
generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
Create a document on 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.
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)
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.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
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 '.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
dol_now($mode='auto')
Return date for now.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dolGetStatus($statusLabel='', $statusLabelShort='', $html='', $statusType='status0', $displayMode=0, $url='', $params=array())
Output the badge of a status.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_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
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...