30 require
'../main.inc.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/modules/dons/modules_don.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/donation.lib.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/don/class/don.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
41 if (!empty($conf->projet->enabled)) {
42 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
43 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
45 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
47 $langs->loadLangs(array(
"bills",
"companies",
"donations",
"users"));
50 $action =
GETPOST(
'action',
'aZ09');
51 $cancel =
GETPOST(
'cancel',
'alpha');
52 $confirm =
GETPOST(
'confirm',
'alpha');
56 $projectid = (
GETPOST(
'projectid') ?
GETPOST(
'projectid',
'int') : 0);
57 $public_donation = (int)
GETPOST(
"public",
'int');
59 $object =
new Don($db);
66 $extrafields->fetch_name_optionals_label($object->table_element);
69 $hookmanager->initHooks(array(
'doncard',
'globalcard'));
71 $upload_dir = $conf->don->dir_output;
72 $permissiontoadd = $user->rights->don->creer;
79 $parameters = array();
81 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
82 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
85 if ($action ==
'confirm_reopen' && $confirm ==
'yes' && $permissiontoadd)
89 $result = $object->reopen($user);
93 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
94 if (method_exists($object,
'generateDocument')) {
95 $outputlangs = $langs;
97 if ($conf->global->MAIN_MULTILANGS && empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) $newlang =
GETPOST(
'lang_id',
'aZ09');
98 if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
99 if (!empty($newlang)) {
101 $outputlangs->setDefaultLang($newlang);
103 $model = $object->model_pdf;
104 $ret = $object->fetch($id);
106 $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
110 header(
"Location: ".
$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
117 if ($action ==
'update')
121 header(
"Location: ".
$_SERVER[
'PHP_SELF'].
"?id=".$id);
127 if (empty($donation_date))
129 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Date")), null,
'errors');
136 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Amount")), null,
'errors');
145 $object->firstname = (string)
GETPOST(
"firstname",
'alpha');
146 $object->lastname = (string)
GETPOST(
"lastname",
'alpha');
147 $object->societe = (string)
GETPOST(
"societe",
'alpha');
148 $object->address = (string)
GETPOST(
"address",
'alpha');
150 $object->town = (string)
GETPOST(
"town",
'alpha');
151 $object->zip = (string)
GETPOST(
"zipcode",
'alpha');
152 $object->country_id = (int)
GETPOST(
'country_id',
'int');
153 $object->email = (string)
GETPOST(
"email",
'alpha');
154 $object->date = $donation_date;
155 $object->public = $public_donation;
156 $object->fk_project = (int)
GETPOST(
"fk_project",
'int');
157 $object->note_private = (string)
GETPOST(
"note_private",
'restricthtml');
158 $object->note_public = (string)
GETPOST(
"note_public",
'restricthtml');
159 $object->modepaymentid = (int)
GETPOST(
'modepayment',
'int');
162 $ret = $extrafields->setOptionalsFromPost(null, $object);
163 if ($ret < 0) $error++;
165 if ($object->update($user) > 0) {
166 header(
"Location: ".
$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
172 if ($action ==
'add')
176 header(
"Location: index.php");
182 if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES) && !(
GETPOST(
"socid",
'int') > 0)) {
183 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ThirdParty")), null,
'errors');
187 if (empty($donation_date)) {
188 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Date")), null,
'errors');
193 if (empty($amount)) {
194 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Amount")), null,
'errors');
201 $object->socid = (int)
GETPOST(
"socid",
'int');
202 $object->firstname = (string)
GETPOST(
"firstname",
'alpha');
203 $object->lastname = (string)
GETPOST(
"lastname",
'alpha');
204 $object->societe = (string)
GETPOST(
"societe",
'alpha');
205 $object->address = (string)
GETPOST(
"address",
'alpha');
207 $object->zip = (string)
GETPOST(
"zipcode",
'alpha');
208 $object->town = (string)
GETPOST(
"town",
'alpha');
209 $object->country_id = (int)
GETPOST(
'country_id',
'int');
210 $object->email = (string)
GETPOST(
'email',
'alpha');
211 $object->date = $donation_date;
212 $object->note_private = (string)
GETPOST(
"note_private",
'restricthtml');
213 $object->note_public = (string)
GETPOST(
"note_public",
'restricthtml');
214 $object->public = $public_donation;
215 $object->fk_project = (int)
GETPOST(
"fk_project",
'int');
216 $object->modepaymentid = (int)
GETPOST(
'modepayment',
'int');
219 $ret = $extrafields->setOptionalsFromPost(null, $object);
220 if ($ret < 0) $error++;
222 $res = $object->create($user);
224 header(
"Location: ".
$_SERVER[
'PHP_SELF'].
'?id='.$res);
231 if ($action ==
'confirm_delete' &&
GETPOST(
"confirm") ==
"yes" && $user->rights->don->supprimer) {
233 $result = $object->delete($user);
235 header(
"Location: index.php");
242 if ($action ==
'valid_promesse') {
244 if ($object->valid_promesse($id, $user->id) >= 0) {
251 if ($action ==
'set_cancel') {
253 if ($object->set_cancel($id) >= 0) {
259 if ($action ==
'set_paid') {
261 if ($object->set_paid($id, $modepayment) >= 0) {
266 } elseif ($action ==
'classin' && $user->rights->don->creer) {
268 $object->setProject($projectid);
272 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
332 llxHeader(
'', $langs->trans(
"Donation"),
'EN:Module_Donations|FR:Module_Dons|ES:Módulo_Donaciones');
334 $form =
new Form($db);
337 if (!empty($conf->projet->enabled)) { $formproject =
new FormProjets($db); }
339 if ($action ==
'create')
343 print '<form name="add" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
344 print '<input type="hidden" name="token" value="'.newToken().
'">';
345 print '<input type="hidden" name="action" value="add">';
349 print '<table class="border centpercent">';
353 print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
'Ref').
'</td><td>'.$langs->trans(
'Draft').
'</td></tr>';
356 if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES))
361 print '<td class="fieldrequired">'.$langs->trans(
'ThirdParty').
'</td>';
363 print $soc->getNomUrl(1);
364 print '<input type="hidden" name="socid" value="'.$soc->id.
'">';
366 $arrayoutstandingbills = $soc->getOutstandingBills();
367 $outstandingBills = $arrayoutstandingbills[
'opened'];
368 print ' ('.$langs->trans(
'CurrentOutstandingBill').
': ';
369 print price($outstandingBills,
'', $langs, 0, 0, -1, $conf->currency);
370 if ($soc->outstanding_limit !=
'')
372 if ($outstandingBills > $soc->outstanding_limit)
print img_warning($langs->trans(
"OutstandingBillReached"));
373 print ' / '.price($soc->outstanding_limit,
'', $langs, 0, 0, -1, $conf->currency);
378 print '<td class="fieldrequired">'.$langs->trans(
'ThirdParty').
'</td>';
380 print $form->select_company($soc->id,
'socid',
'(s.client = 1 OR s.client = 3) AND status=1',
'SelectThirdParty', 0, 0, null, 0,
'minwidth300');
382 if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED))
384 print '<script type="text/javascript">
385 $(document).ready(function() {
386 $("#socid").change(function() {
387 console.log("We have changed the company - Reload page");
388 var socid = $(this).val();
389 var fac_rec = $(\'#fac_rec\').val();
391 window.location.href = "'.$_SERVER[
"PHP_SELF"].
'?action=create&socid="+socid+"&fac_rec="+fac_rec;
396 print ' <a href="'.DOL_URL_ROOT.
'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode(
$_SERVER[
"PHP_SELF"].
'?action=create').
'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"AddThirdParty").
'"></span></a>';
403 print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"Date").
'</td><td>';
404 print $form->selectDate($donation_date ? $donation_date : -1,
'',
'',
'',
'',
"add", 1, 1);
408 print "<tr>".
'<td class="fieldrequired">'.$langs->trans(
"Amount").
'</td><td><input type="text" name="amount" value="'.
dol_escape_htmltag(
GETPOST(
"amount")).
'" size="10"> '.$langs->trans(
"Currency".$conf->currency).
'</td></tr>';
411 print '<tr><td class="fieldrequired">'.$langs->trans(
"PublicDonation").
"</td><td>";
412 print $form->selectyesno(
"public", $public_donation, 1);
413 print "</td></tr>\n";
415 if (empty($conf->societe->enabled) || empty($conf->global->DONATION_USE_THIRDPARTIES))
417 print "<tr>".
'<td>'.$langs->trans(
"Company").
'</td><td><input type="text" name="societe" value="'.
dol_escape_htmltag(
GETPOST(
"societe")).
'" class="maxwidth200"></td></tr>';
418 print "<tr>".
'<td>'.$langs->trans(
"Lastname").
'</td><td><input type="text" name="lastname" value="'.
dol_escape_htmltag(
GETPOST(
"lastname")).
'" class="maxwidth200"></td></tr>';
419 print "<tr>".
'<td>'.$langs->trans(
"Firstname").
'</td><td><input type="text" name="firstname" value="'.
dol_escape_htmltag(
GETPOST(
"firstname")).
'" class="maxwidth200"></td></tr>';
420 print "<tr>".
'<td>'.$langs->trans(
"Address").
'</td><td>';
421 print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="3">'.dol_escape_htmltag(
GETPOST(
"address",
"alphanohtml"), 0, 1).
'</textarea></td></tr>';
424 print '<tr><td>'.$langs->trans(
"Zip").
' / '.$langs->trans(
"Town").
'</td><td>';
425 print $formcompany->select_ziptown((
GETPOSTISSET(
"zipcode") ?
GETPOST(
"zipcode") : $object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
427 print $formcompany->select_ziptown((
GETPOSTISSET(
"town") ?
GETPOST(
"town") : $object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
431 print '<tr><td><label for="selectcountry_id">'.$langs->trans(
'Country').
'</label></td><td class="maxwidthonsmartphone">';
432 print img_picto(
'',
'globe-americas',
'class="paddingrightonly"').$form->select_country(
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') : $object->country_id);
433 if ($user->admin)
print info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
436 print
"<tr>".
'<td>'.$langs->trans(
"EMail").
'</td><td>'.
img_picto(
'',
'object_email',
'class="paddingrightonly"').
'<input type="text" name="email" value="'.
dol_escape_htmltag(
GETPOST(
"email")).
'" class="maxwidth200"></td></tr>';
440 print
"<tr><td>".$langs->trans(
"PaymentMode").
"</td><td>\n";
441 $selected =
GETPOST(
'modepayment',
'int');
442 $form->select_types_paiements($selected,
'modepayment',
'CRDT', 0, 1);
443 print
"</td></tr>\n";
447 print
'<td class="tdtop">'.$langs->trans(
'NotePublic').
'</td>';
450 $doleditor =
new DolEditor(
'note_public', $note_public,
'', 80,
'dolibarr_notes',
'In', 0,
false,
true, ROWS_3,
'90%');
451 print $doleditor->Create(1);
455 if (empty($user->socid)) {
457 print
'<td class="tdtop">'.$langs->trans(
'NotePrivate').
'</td>';
460 $doleditor =
new DolEditor(
'note_private', $note_private,
'', 80,
'dolibarr_notes',
'In', 0,
false,
true, ROWS_3,
'90%');
461 print $doleditor->Create(1);
465 if (!empty($conf->projet->enabled))
467 print
"<tr><td>".$langs->trans(
"Project").
"</td><td>";
468 $formproject->select_projects(-1, $projectid,
'fk_project', 0, 0, 1, 1, 0, 0, 0,
'', 0, 0,
'maxwidth500');
469 print
"</td></tr>\n";
473 $parameters = array();
474 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
475 print $hookmanager->resPrint;
478 print $object->showOptionals($extrafields,
'edit', $parameters);
486 print
'<div class="center">';
487 print
'<input type="submit" class="button button-save" name="save" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
488 print
' ';
489 print
'<input type="button" class="button button-cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'" onClick="javascript:history.go(-1)">';
502 if (!empty($id) && $action ==
'edit')
504 $result = $object->fetch($id);
508 $result = $object->fetch_optionals();
516 print
'<form name="update" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
517 print
'<input type="hidden" name="token" value="'.newToken().
'">';
518 print
'<input type="hidden" name="action" value="update">';
519 print
'<input type="hidden" name="rowid" value="'.$object->id.
'">';
520 print
'<input type="hidden" name="amount" value="'.$object->amount.
'">';
523 print
dol_get_fiche_head($head, $hselected, $langs->trans(
"Donation"), 0,
'donation');
525 print
'<table class="border centpercent">';
528 print
'<tr><td>'.$langs->trans(
"Ref").
'</td><td colspan="2">';
529 print $object->getNomUrl();
534 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Date").
'</td><td>';
535 print $form->selectDate($object->date,
'',
'',
'',
'',
"update");
539 if ($object->statut == 0) {
540 print
"<tr>".
'<td class="fieldrequired">'.$langs->trans(
"Amount").
'</td><td><input type="text" name="amount" size="10" value="'.
price($object->amount).
'"> '.$langs->trans(
"Currency".$conf->currency).
'</td></tr>';
542 print
'<tr><td>'.$langs->trans(
"Amount").
'</td><td>';
543 print
price($object->amount, 0, $langs, 0, 0, -1, $conf->currency);
547 print
'<tr><td class="fieldrequired">'.$langs->trans(
"PublicDonation").
"</td><td>";
548 print $form->selectyesno(
"public", $object->public, 1);
552 if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES)) {
555 print
'<tr><td>'.$langs->trans(
"ThirdParty").
'</td><td colspan="2">';
556 if ($object->socid > 0) {
557 $result = $company->fetch($object->socid);
558 print $company->getNomUrl(1);
562 $langs->load(
"companies");
563 print
'<tr><td>'.$langs->trans(
"Company").
'</td><td><input type="text" name="societe" class="maxwidth200" value="'.
dol_escape_htmltag($object->societe).
'"></td></tr>';
564 print
'<tr><td>'.$langs->trans(
"Lastname").
'</td><td><input type="text" name="lastname" class="maxwidth200" value="'.
dol_escape_htmltag($object->lastname).
'"></td></tr>';
565 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td><td><input type="text" name="firstname" class="maxwidth200" value="'.
dol_escape_htmltag($object->firstname).
'"></td></tr>';
566 print
'<tr><td>'.$langs->trans(
"Address").
'</td><td>';
567 print
'<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.
'">'.
dol_escape_htmltag($object->address, 0, 1).
'</textarea></td></tr>';
570 print
'<tr><td>'.$langs->trans(
"Zip").
' / '.$langs->trans(
"Town").
'</td><td>';
571 print $formcompany->select_ziptown((
GETPOSTISSET(
"zipcode") ?
GETPOSTISSET(
"zipcode") : $object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
573 print $formcompany->select_ziptown((
GETPOSTISSET(
"town") ?
GETPOST(
"town") : $object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
577 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
'Country').
'</td><td>';
578 print $form->select_country((!empty($object->country_id) ? $object->country_id : $mysoc->country_code),
'country_id');
580 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
584 print
"<tr>".
'<td>'.$langs->trans(
"EMail").
'</td><td><input type="text" name="email" class="maxwidth200" value="'.
dol_escape_htmltag($object->email).
'"></td></tr>';
587 print
"<tr><td>".$langs->trans(
"PaymentMode").
"</td><td>\n";
588 if ($object->mode_reglement_id) $selected = $object->mode_reglement_id;
590 $form->select_types_paiements($selected,
'modepayment',
'CRDT', 0, 1);
591 print
"</td></tr>\n";
594 print
"<tr>".
'<td>'.$langs->trans(
"Status").
'</td><td>'.$object->getLibStatut(4).
'</td></tr>';
597 if (!empty($conf->projet->enabled)) {
600 $langs->load(
'projects');
601 print
'<tr><td>'.$langs->trans(
'Project').
'</td><td>';
602 $formproject->select_projects(-1, $object->fk_project,
'fk_project', 0, 0, 1, 1, 0, 0, 0,
'', 0, 0,
'maxwidth500');
607 $parameters = array();
608 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
609 print $hookmanager->resPrint;
612 print $object->showOptionals($extrafields,
'edit', $parameters);
619 print
'<div class="center"><input type="submit" class="button button-save" name="save" value="'.$langs->trans(
"Save").
'"> <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'"></div>';
631 if (!empty($id) && $action !=
'edit')
634 if ($action ==
'delete')
636 $text = $langs->trans(
"ConfirmDeleteADonation");
637 print $form->formconfirm(
$_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"DeleteADonation"), $text,
"confirm_delete",
'',
'', 1);
640 $result = $object->fetch($id);
644 $result = $object->fetch_optionals();
652 print
dol_get_fiche_head($head, $hselected, $langs->trans(
"Donation"), -1,
'donation');
657 $linkback =
'<a href="'.DOL_URL_ROOT.
'/don/list.php'.(!empty($socid) ?
'?socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
659 $morehtmlref =
'<div class="refidno">';
661 if (!empty($conf->projet->enabled))
663 $langs->load(
"projects");
664 $morehtmlref .= $langs->trans(
'Project').
' ';
665 if ($user->rights->don->creer)
667 if ($action !=
'classify') {
668 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
670 if ($action ==
'classify') {
672 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
673 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
674 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
675 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project,
'projectid', 0, 0, 1, 0, 1, 0, 0,
'', 1, 0,
'maxwidth500');
676 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
677 $morehtmlref .=
'</form>';
679 $morehtmlref .= $form->form_project(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1);
682 if (!empty($object->fk_project)) {
684 $proj->fetch($object->fk_project);
685 $morehtmlref .=
'<a href="'.DOL_URL_ROOT.
'/projet/card.php?id='.$object->fk_project.
'" title="'.$langs->trans(
'ShowProject').
'">';
686 $morehtmlref .= $proj->ref;
687 $morehtmlref .=
'</a>';
693 $morehtmlref .=
'</div>';
696 dol_banner_tab($object,
'rowid', $linkback, 1,
'rowid',
'ref', $morehtmlref);
699 print
'<div class="fichecenter">';
700 print
'<div class="fichehalfleft">';
701 print
'<div class="underbanner clearboth"></div>';
703 print
'<table class="border tableforfield" width="100%">';
706 print
'<tr><td class="titlefield">'.$langs->trans(
"Date").
'</td><td colspan="2">';
710 print
'<tr><td>'.$langs->trans(
"Amount").
'</td><td colspan="2">';
711 print
price($object->amount, 0, $langs, 0, 0, -1, $conf->currency);
714 print
'<tr><td>'.$langs->trans(
"PublicDonation").
'</td><td colspan="2">';
715 print
yn($object->public);
718 if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES)) {
721 print
'<tr><td>'.$langs->trans(
"ThirdParty").
'</td><td colspan="2">';
722 if ($object->socid > 0) {
723 $result = $company->fetch($object->socid);
724 print $company->getNomUrl(1);
728 print
'<tr><td>'.$langs->trans(
"Company").
'</td><td colspan="2">'.$object->societe.
'</td></tr>';
729 print
'<tr><td>'.$langs->trans(
"Lastname").
'</td><td colspan="2">'.$object->lastname.
'</td></tr>';
730 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td><td colspan="2">'.$object->firstname.
'</td></tr>';
734 print
"<tr><td>".$langs->trans(
"PaymentMode").
"</td><td>";
735 $form->form_modes_reglement(null, $object->mode_reglement_id,
'none');
736 print
"</td></tr>\n";
740 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
745 print
'<div class="fichehalfright">';
746 print
'<div class="ficheaddleft">';
751 $sql =
"SELECT p.rowid, p.num_payment, p.datep as dp, p.amount,";
752 $sql .=
"c.code as type_code,c.libelle as paiement_type";
753 $sql .=
" FROM ".MAIN_DB_PREFIX.
"payment_donation as p";
754 $sql .=
", ".MAIN_DB_PREFIX.
"c_paiement as c ";
755 $sql .=
", ".MAIN_DB_PREFIX.
"don as d";
756 $sql .=
" WHERE d.rowid = '".$id.
"'";
757 $sql .=
" AND p.fk_donation = d.rowid";
758 $sql .=
" AND d.entity IN (".getEntity(
'donation').
")";
759 $sql .=
" AND p.fk_typepayment = c.id";
760 $sql .=
" ORDER BY dp";
763 $resql = $db->query($sql);
766 $num = $db->num_rows(
$resql);
768 print
'<table class="noborder paymenttable centpercent">';
769 print
'<tr class="liste_titre">';
770 print
'<td>'.$langs->trans(
"RefPayment").
'</td>';
771 print
'<td>'.$langs->trans(
"Date").
'</td>';
772 print
'<td>'.$langs->trans(
"Type").
'</td>';
773 print
'<td class="right">'.$langs->trans(
"Amount").
'</td>';
778 $objp = $db->fetch_object(
$resql);
780 print
'<tr class="oddeven"><td>';
781 print
'<a href="'.DOL_URL_ROOT.
'/don/payment/card.php?id='.$objp->rowid.
'">'.
img_object($langs->trans(
"Payment"),
"payment").
' '.$objp->rowid.
'</a></td>';
782 print
'<td>'.dol_print_date($db->jdate($objp->dp),
'day').
"</td>\n";
783 $labeltype = $langs->trans(
"PaymentType".$objp->type_code) != (
"PaymentType".$objp->type_code) ? $langs->trans(
"PaymentType".$objp->type_code) : $objp->paiement_type;
784 print
"<td>".$labeltype.
' '.$objp->num_payment.
"</td>\n";
785 print
'<td class="right">'.price($objp->amount).
"</td>\n";
787 $totalpaid += $objp->amount;
791 if ($object->paid == 0)
793 print
"<tr><td colspan=\"3\" class=\"right\">".$langs->trans(
"AlreadyPaid").
" :</td><td class=\"right\">".
price($totalpaid).
"</td></tr>\n";
794 print
"<tr><td colspan=\"3\" class=\"right\">".$langs->trans(
"AmountExpected").
" :</td><td class=\"right\">".
price($object->amount).
"</td></tr>\n";
796 $remaintopay = $object->amount - $totalpaid;
798 print
"<tr><td colspan=\"3\" class=\"right\">".$langs->trans(
"RemainderToPay").
" :</td>";
799 print
'<td class="right'.($resteapayeraffiche ?
' amountremaintopay' :
'').
'">'.
price($remaintopay).
"</td></tr>\n";
811 print
'<div class="clearboth"></div>';
815 $remaintopay = $object->amount - $totalpaid;
819 print
'<div class="tabsAction">';
822 if ($permissiontoadd && $object->statut == $object::STATUS_CANCELED)
824 print
'<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&action=confirm_reopen&confirm=yes&token='.
newToken().
'">'.$langs->trans(
"ReOpen").
'</a>';
827 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&rowid='.$object->id.
'">'.$langs->trans(
'Modify').
'</a></div>';
829 if ($object->statut == $object::STATUS_DRAFT)
831 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?rowid='.$object->id.
'&action=valid_promesse&token='.
newToken().
'">'.$langs->trans(
"ValidPromess").
'</a></div>';
834 if (($object->statut == $object::STATUS_DRAFT || $object->statut == $object::STATUS_VALIDATED) && $totalpaid == 0 && $object->paid == 0)
836 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?rowid='.$object->id.
'&action=set_cancel&token='.
newToken().
'">'.$langs->trans(
"ClassifyCanceled").
"</a></div>";
840 if ($object->statut == $object::STATUS_VALIDATED && $object->paid == 0 && $user->rights->don->creer)
842 if ($remaintopay == 0)
844 print
'<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="'.$langs->trans(
"DisabledBecauseRemainderToPayIsZero").
'">'.$langs->trans(
'DoPayment').
'</span></div>';
846 print
'<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.
'/don/payment/payment.php?rowid='.$object->id.
'&action=create">'.$langs->trans(
'DoPayment').
'</a></div>';
851 if ($object->statut == $object::STATUS_VALIDATED && round($remaintopay) == 0 && $object->paid == 0 && $user->rights->don->creer)
853 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?rowid='.$object->id.
'&action=set_paid">'.$langs->trans(
"ClassifyPaid").
"</a></div>";
857 if ($user->rights->don->supprimer)
859 if ($object->statut == $object::STATUS_CANCELED || $object->statut == $object::STATUS_DRAFT)
861 print
'<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?rowid='.$object->id.
'&action=delete&token='.
newToken().
'">'.$langs->trans(
"Delete").
"</a></div>";
863 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
"Delete").
"</a></div>";
866 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
"Delete").
"</a></div>";
872 print
'<div class="fichecenter"><div class="fichehalfleft">';
879 $urlsource =
$_SERVER[
'PHP_SELF'].
'?rowid='.$object->id;
880 $genallowed = (($object->paid == 0 || $user->admin) && $user->rights->don->lire);
881 $delallowed = $user->rights->don->creer;
883 print $formfile->showdocuments(
'donation', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf);
886 $linktoelem = $form->showLinkToObjectBlock($object, null, array(
'don'));
887 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
890 $useonlinepayment = (!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled));
892 if ($useonlinepayment)
894 print
'<br><!-- Link to pay -->'.
"\n";
895 require_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
896 print showOnlinePaymentUrl(
'donation', $object->ref).
'<br>';
899 print
'</div><div class="fichehalfright"><div class="ficheaddleft">';
901 print
'</div></div></div>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
img_edit($titlealt= 'default', $float=0, $other= '')
Show logo editer/modifier fiche.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm= 'auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
img_warning($titlealt= 'default', $moreatt= '', $morecss= 'pictowarning')
Show warning logo.
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...
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage projects.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
price2num($amount, $rounding= '', $option=0)
Function that return a number with universal decimal format (decimal separator is '...
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_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
img_object($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
Class to manage translations.
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
Class to manage donations.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Class to manage a WYSIWYG editor.
dol_banner_tab($object, $paramid, $morehtml= '', $shownav=1, $fieldid= 'rowid', $fieldref= 'ref', $morehtmlref= '', $moreparam= '', $nodbprefix=0, $morehtmlleft= '', $morehtmlstatus= '', $onlybanner=0, $morehtmlright= '')
Show tab footer of a card.
donation_prepare_head($object)
Prepare array with list of tabs.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin= '1', $morecss= '', $textfordropdown= '')
Show information for admin users or standard users.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $keepmoretags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...