32require
'../main.inc.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/modules/dons/modules_don.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/lib/donation.lib.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/don/class/don.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
54 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
55 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
57require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
60$langs->loadLangs(array(
'bills',
'companies',
'donations',
'users'));
64$action =
GETPOST(
'action',
'aZ09');
65$cancel =
GETPOST(
'cancel',
'alpha');
66$confirm =
GETPOST(
'confirm',
'alpha');
67$backtopage =
GETPOST(
'backtopage',
'alpha');
80if (!empty($socid) && $socid > 0) {
88$extrafields->fetch_name_optionals_label(
$object->table_element);
89$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
92$hookmanager->initHooks(array(
$object->element.
'card',
'globalcard'));
94$upload_dir =
$conf->don->dir_output;
100$permissiontoread = $user->hasRight(
'don',
'lire');
101$permissiontoadd = $user->hasRight(
'don',
'creer');
102$permissiontodelete = $user->hasRight(
'don',
'supprimer');
103$permissiontoeditextra = $permissiontoadd;
104if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
106 $permissiontoeditextra =
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
116$parameters = array();
118$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
123if (empty($reshook)) {
124 $backurlforlist = DOL_URL_ROOT.
'/don/list.php';
126 if (empty($backtopage) || ($cancel && empty($id))) {
127 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
128 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
129 $backtopage = $backurlforlist;
131 $backtopage = DOL_URL_ROOT.
'/don/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
137 if (!empty($backtopageforcancel)) {
138 header(
"Location: ".$backtopageforcancel);
140 } elseif (!empty($backtopage)) {
141 header(
"Location: ".$backtopage);
148 if ($action ==
'confirm_reopen' && $confirm ==
'yes' && $permissiontoadd) {
149 $result =
$object->reopen($user);
153 $outputlangs = $langs;
156 $newlang =
GETPOST(
'lang_id',
'aZ09');
159 $newlang =
$object->thirdparty->default_lang;
161 if (!empty($newlang)) {
163 $outputlangs->setDefaultLang($newlang);
170 $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
173 header(
"Location: ".$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
183 if ($action ==
'update' && $permissiontoadd) {
184 if (!empty($cancel)) {
185 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".urlencode((
string) ($id)));
189 if (empty($donation_date)) {
190 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Date")),
null,
'errors');
195 if (empty($amount)) {
196 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Amount")),
null,
'errors');
213 $object->date = $donation_date;
214 $object->public = $public_donation;
219 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
224 if (
$object->update($user) > 0) {
225 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
236 if ($action ==
'add' && $permissiontoadd) {
237 if (!empty($cancel)) {
238 header(
"Location: index.php");
243 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ThirdParty")),
null,
'errors');
247 if (empty($donation_date)) {
248 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Date")),
null,
'errors');
253 if (empty($amount)) {
254 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Amount")),
null,
'errors');
270 $object->date = $donation_date;
273 $object->public = $public_donation;
278 $ret = $extrafields->setOptionalsFromPost(
null, $object);
285 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$res);
295 if ($action ==
'confirm_delete' &&
GETPOST(
"confirm") ==
"yes" && $permissiontodelete) {
296 $result =
$object->delete($user);
298 header(
"Location: index.php");
307 if ($action ==
'valid_promesse' && $permissiontoadd) {
309 if (
$object->valid_promesse($id, $user->id) >= 0) {
318 if ($action ==
'set_cancel' && $permissiontoadd) {
319 if (
$object->set_cancel($id) >= 0) {
327 if ($action ==
'set_paid' && $permissiontoadd) {
329 if (
$object->setPaid($id, $modepayment) >= 0) {
334 } elseif ($action ==
'classin' && $user->hasRight(
'don',
'creer')) {
335 $object->setProject($projectid);
338 if ($action ==
'set_validate' && $permissiontoadd) {
340 if (
$object->reopen($user) >= 0) {
347 if ($action ==
'update_extras' && $permissiontoeditextra) {
350 $attribute_name =
GETPOST(
'attribute',
'aZ09');
353 $ret = $extrafields->setOptionalsFromPost(
null, $object, $attribute_name);
359 $result =
$object->updateExtraField($attribute_name,
'DON_MODIFY');
367 $action =
'edit_extras';
372 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
382$title = $langs->trans(
"Donation");
384$help_url =
'EN:Module_Donations|FR:Module_Dons|ES:Módulo_Donaciones|DE:Modul_Spenden';
386llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-donation page-card');
396if ($action ==
'create') {
397 print
load_fiche_titre($langs->trans(
"AddDonation"),
'',
'object_donation');
399 print
'<form name="add" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
400 print
'<input type="hidden" name="token" value="'.newToken().
'">';
401 print
'<input type="hidden" name="action" value="add">';
402 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
406 print
'<table class="border centpercent">';
410 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
'Ref').
'</td><td>'.$langs->trans(
'Draft').
'</td></tr>';
415 if (is_object($soc) && $soc->id > 0) {
416 print
'<td class="fieldrequired">'.$langs->trans(
'ThirdParty').
'</td>';
418 print $soc->getNomUrl(1);
419 print
'<input type="hidden" name="socid" value="'.$soc->id.
'">';
421 $arrayoutstandingbills = $soc->getOutstandingBills();
422 $outstandingBills = $arrayoutstandingbills[
'opened'];
423 print
' ('.$langs->trans(
'CurrentOutstandingBill').
': ';
424 print
price($outstandingBills, 0, $langs, 0, 0, -1,
$conf->currency);
425 if ($soc->outstanding_limit !=
'') {
426 if ($outstandingBills > $soc->outstanding_limit) {
427 print
img_warning($langs->trans(
"OutstandingBillReached"));
429 print
' / '.price($soc->outstanding_limit, 0, $langs, 0, 0, -1,
$conf->currency);
434 print
'<td class="fieldrequired">'.$langs->trans(
'ThirdParty').
'</td>';
436 $filter =
'((s.client:IN:1,2,3) AND (status:=:1))';
437 print $form->select_company($socid,
'socid', $filter,
'SelectThirdParty', 0, 0, array(), 0,
'minwidth300');
440 print
'<script type="text/javascript">
441 $(document).ready(function() {
442 $("#socid").change(function() {
443 console.log("We have changed the company - Reload page");
444 var socid = $(this).val();
445 var fac_rec = $(\'#fac_rec\').val();
447 $("input[name=action]").val("create");
448 $("form[name=add]").submit();
453 print
' <a href="'.DOL_URL_ROOT.
'/societe/card.php?action=create&customer=3&fournisseur=0&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?action=create').
'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"AddThirdParty").
'"></span></a>';
460 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"Date").
'</td><td>';
461 print $form->selectDate($donation_date ? $donation_date : -1,
'', 0, 0, 0,
"add", 1, 1);
465 print
"<tr>".
'<td class="fieldrequired">'.$langs->trans(
"Amount").
'</td><td><input type="text" name="amount" value="'.
dol_escape_htmltag(
GETPOST(
"amount")).
'" size="10" spellcheck="false"> '.$langs->trans(
"Currency".
$conf->currency).
'</td></tr>';
468 print
'<tr><td class="fieldrequired">'.$langs->trans(
"PublicDonation").
"</td><td>";
469 print $form->selectyesno(
"public", $public_donation, 1);
470 print
"</td></tr>\n";
473 print
"<tr>".
'<td>'.$langs->trans(
"Company").
'</td><td><input type="text" name="societe" value="'.
dol_escape_htmltag(
GETPOST(
"societe")).
'" class="maxwidth200"></td></tr>';
474 print
"<tr>".
'<td>'.$langs->trans(
"Lastname").
'</td><td><input type="text" name="lastname" value="'.
dol_escape_htmltag(
GETPOST(
"lastname")).
'" class="maxwidth200"></td></tr>';
475 print
"<tr>".
'<td>'.$langs->trans(
"Firstname").
'</td><td><input type="text" name="firstname" value="'.
dol_escape_htmltag(
GETPOST(
"firstname")).
'" class="maxwidth200"></td></tr>';
476 print
"<tr>".
'<td>'.$langs->trans(
"Address").
'</td><td>';
477 print
'<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="3">'.dol_escape_htmltag(
GETPOST(
"address",
"alphanohtml"), 0, 1).
'</textarea></td></tr>';
480 print
'<tr><td>'.$langs->trans(
"Zip").
' / '.$langs->trans(
"Town").
'</td><td>';
481 print $formcompany->select_ziptown((GETPOSTISSET(
"zipcode") ?
GETPOST(
"zipcode") :
$object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
483 print $formcompany->select_ziptown((GETPOSTISSET(
"town") ?
GETPOST(
"town") :
$object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
487 print
'<tr><td><label for="selectcountry_id">'.$langs->trans(
'Country').
'</label></td><td class="maxwidthonsmartphone">';
488 print
img_picto(
'',
'globe-americas',
'class="paddingrightonly"').$form->select_country(
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id);
490 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
494 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" spellcheck="false"></td></tr>';
498 print
"<tr><td>".$langs->trans(
"PaymentMode").
"</td><td>\n";
500 print
img_picto(
'',
'payment',
'class="pictofixedwidth"');
501 print $form->select_types_paiements((
string) $selected,
'modepayment',
'CRDT', 0, 1, 0, 0, 1,
'maxwidth200 widthcentpercentminusx', 1);
502 print
"</td></tr>\n";
506 print
'<td class="tdtop">'.$langs->trans(
'NotePublic').
'</td>';
508 if (!isset($note_public)) {
509 $note_public =
$object->getDefaultCreateValueFor(
'note_public');
511 $doleditor =
new DolEditor(
'note_public', $note_public,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3,
'90%');
512 print $doleditor->Create(1);
516 if (empty($user->socid)) {
518 print
'<td class="tdtop">'.$langs->trans(
'NotePrivate').
'</td>';
520 if (!isset($note_private)) {
521 $note_private =
$object->getDefaultCreateValueFor(
'note_private');
523 $doleditor =
new DolEditor(
'note_private', $note_private,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3,
'90%');
524 print $doleditor->Create(1);
529 print
"<tr><td>".$langs->trans(
"Project").
"</td><td>";
530 print
img_picto(
'',
'project',
'class="pictofixedwidth"');
531 print $formproject->select_projects(-1, (
string) $projectid,
'fk_project', 0, 0, 1, 1, 0, 0, 0,
'', 1, 0,
'maxwidth500');
532 print
"</td></tr>\n";
536 $parameters = array();
537 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
538 print $hookmanager->resPrint;
539 if (empty($reshook)) {
540 print
$object->showOptionals($extrafields,
'create', $parameters);
548 print $form->buttonsSaveCancel();
560if (!empty($id) && $action ==
'edit') {
564 print
'<form name="update" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
565 print
'<input type="hidden" name="token" value="'.newToken().
'">';
566 print
'<input type="hidden" name="action" value="update">';
567 print
'<input type="hidden" name="rowid" value="'.$object->id.
'">';
568 print
'<input type="hidden" name="amount" value="'.$object->amount.
'">';
569 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
571 print
dol_get_fiche_head($head, $hselected, $langs->trans(
"Donation"), 0,
'donation');
573 print
'<table class="border centpercent">';
576 print
'<tr><td>'.$langs->trans(
"Ref").
'</td><td colspan="2">';
582 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Date").
'</td><td>';
583 print $form->selectDate(
$object->date,
'', 0, 0, 0,
"update");
588 print
"<tr>".
'<td class="fieldrequired">'.$langs->trans(
"Amount").
'</td><td><input type="text" name="amount" size="10" value="'.
price(
$object->amount).
'" spellcheck="false"> '.$langs->trans(
"Currency".
$conf->currency).
'</td></tr>';
590 print
'<tr><td>'.$langs->trans(
"Amount").
'</td><td>';
595 print
'<tr><td class="fieldrequired">'.$langs->trans(
"PublicDonation").
"</td><td>";
596 print $form->selectyesno(
"public",
$object->public, 1);
603 print
'<tr><td>'.$langs->trans(
"ThirdParty").
'</td><td colspan="2">';
605 $result = $company->fetch(
$object->socid);
606 print $company->getNomUrl(1);
610 $langs->load(
"companies");
611 print
'<tr><td>'.$langs->trans(
"Company").
'</td><td><input type="text" name="societe" class="maxwidth200" value="'.
dol_escape_htmltag(
$object->societe).
'"></td></tr>';
612 print
'<tr><td>'.$langs->trans(
"Lastname").
'</td><td><input type="text" name="lastname" class="maxwidth200" value="'.
dol_escape_htmltag(
$object->lastname).
'"></td></tr>';
613 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td><td><input type="text" name="firstname" class="maxwidth200" value="'.
dol_escape_htmltag(
$object->firstname).
'"></td></tr>';
614 print
'<tr><td>'.$langs->trans(
"Address").
'</td><td>';
615 print
'<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.
'">'.
dol_escape_htmltag(
$object->address, 0, 1).
'</textarea></td></tr>';
618 print
'<tr><td>'.$langs->trans(
"Zip").
' / '.$langs->trans(
"Town").
'</td><td>';
619 print $formcompany->select_ziptown((GETPOSTISSET(
"zipcode") ? GETPOSTISSET(
"zipcode") :
$object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
621 print $formcompany->select_ziptown((GETPOSTISSET(
"town") ?
GETPOST(
"town") :
$object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
625 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
'Country').
'</td><td>';
626 print $form->select_country((!empty(
$object->country_id) ?
$object->country_id :
$mysoc->country_code),
'country_id');
628 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
632 print
'<tr><td>'.$langs->trans(
"EMail").
'</td><td><input type="text" name="email" class="maxwidth200" value="'.
dol_escape_htmltag(
$object->email).
'" spellcheck="false"></td></tr>';
635 print
"<tr><td>".$langs->trans(
"PaymentMode").
"</td><td>\n";
636 if (
$object->mode_reglement_id) {
641 $form->select_types_paiements($selected,
'modepayment',
'CRDT', 0, 1);
642 print
"</td></tr>\n";
645 print
"<tr>".
'<td>'.$langs->trans(
"Status").
'</td><td>'.
$object->getLibStatut(4).
'</td></tr>';
651 $langs->load(
'projects');
652 print
'<tr><td>'.$langs->trans(
'Project').
'</td><td>';
653 $formproject->select_projects(-1, (
string)
$object->fk_project,
'fk_project', 0, 0, 1, 1, 0, 0, 0,
'', 0, 0,
'maxwidth500');
658 $parameters = array();
659 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
660 print $hookmanager->resPrint;
661 if (empty($reshook)) {
662 print
$object->showOptionals($extrafields,
'edit', $parameters);
669 print $form->buttonsSaveCancel();
681if (!empty($id) && $action !=
'edit') {
685 if ($action ==
'delete') {
686 $text = $langs->trans(
"ConfirmDeleteADonation");
687 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$object->id, $langs->trans(
"DeleteADonation"), $text,
"confirm_delete",
'',
'', 1);
695 $result =
$object->fetch_optionals();
704 print
dol_get_fiche_head($head, $hselected, $langs->trans(
"Donation"), -1,
'donation');
709 $linkback =
'<a href="'.DOL_URL_ROOT.
'/don/list.php'.(!empty($socid) ?
'?socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
711 $morehtmlref =
'<div class="refidno">';
714 $langs->load(
"projects");
716 if ($permissiontoadd) {
717 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
718 if ($action !=
'classify') {
719 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
721 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->socid,
$object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
723 if (!empty(
$object->fk_project)) {
725 $proj->fetch(
$object->fk_project);
726 $morehtmlref .= $proj->getNomUrl(1);
728 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
733 $morehtmlref .=
'</div>';
736 dol_banner_tab($object,
'rowid', $linkback, 1,
'rowid',
'ref', $morehtmlref);
739 print
'<div class="fichecenter">';
740 print
'<div class="fichehalfleft">';
741 print
'<div class="underbanner clearboth"></div>';
743 print
'<table class="border tableforfield" width="100%">';
746 print
'<tr><td class="titlefield">'.$langs->trans(
"Date").
'</td><td colspan="2">';
750 print
'<tr><td>'.$langs->trans(
"Amount").
'</td><td colspan="2">';
754 print
'<tr><td>'.$langs->trans(
"PublicDonation").
'</td><td colspan="2">';
761 print
'<tr><td>'.$langs->trans(
"ThirdParty").
'</td><td colspan="2">';
763 $result = $company->fetch(
$object->socid);
764 print $company->getNomUrl(1);
768 print
'<tr><td>'.$langs->trans(
"Company").
'</td><td colspan="2">'.
$object->societe.
'</td></tr>';
769 print
'<tr><td>'.$langs->trans(
"Lastname").
'</td><td colspan="2">'.
$object->lastname.
'</td></tr>';
770 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td><td colspan="2">'.
$object->firstname.
'</td></tr>';
774 print
"<tr><td>".$langs->trans(
"PaymentMode").
"</td><td>";
775 $form->form_modes_reglement(
'', (
string)
$object->mode_reglement_id,
'none');
776 print
"</td></tr>\n";
780 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
785 print
'<div class="fichehalfright">';
790 $sql =
"SELECT p.rowid, p.num_payment, p.datep as dp, p.amount,";
791 $sql .=
" c.code as type_code, c.libelle as paiement_type,";
792 $sql .=
" b.fk_account";
793 $sql .=
" FROM ".MAIN_DB_PREFIX.
"payment_donation as p";
794 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank as b ON p.fk_bank = b.rowid";
795 $sql .=
", ".MAIN_DB_PREFIX.
"c_paiement as c ";
796 $sql .=
", ".MAIN_DB_PREFIX.
"don as d";
797 $sql .=
" WHERE d.rowid = ".((int) $id);
798 $sql .=
" AND p.fk_donation = d.rowid";
799 $sql .=
" AND d.entity IN (".getEntity(
'donation').
")";
800 $sql .=
" AND p.fk_typepayment = c.id";
801 $sql .=
" ORDER BY dp";
804 $resql =
$db->query($sql);
806 $num =
$db->num_rows($resql);
809 print
'<table class="noborder paymenttable centpercent">';
810 print
'<tr class="liste_titre">';
811 print
'<td>'.$langs->trans(
"RefPayment").
'</td>';
812 print
'<td>'.$langs->trans(
"Date").
'</td>';
813 print
'<td>'.$langs->trans(
"Type").
'</td>';
815 print
'<td>'.$langs->trans(
"BankAccount").
'</td>';
817 print
'<td class="right">'.$langs->trans(
"Amount").
'</td>';
821 $objp =
$db->fetch_object($resql);
823 print
'<tr class="oddeven"><td>';
824 print
'<a href="'.DOL_URL_ROOT.
'/don/payment/card.php?id='.$objp->rowid.
'">'.
img_object($langs->trans(
"Payment"),
"payment").
' '.$objp->rowid.
'</a></td>';
825 print
'<td>'.dol_print_date(
$db->jdate($objp->dp),
'day').
"</td>\n";
826 $labeltype = ($langs->trans(
"PaymentType".$objp->type_code) !=
"PaymentType".$objp->type_code) ? $langs->trans(
"PaymentType".$objp->type_code) : $objp->paiement_type;
827 print
"<td>".$labeltype.
' '.$objp->num_payment.
"</td>\n";
829 $bankaccountstatic->fetch($objp->fk_account);
844 print
'<td class="nowraponall">';
845 if ($bankaccountstatic->id) {
846 print $bankaccountstatic->getNomUrl(1,
'transactions');
850 print
'<td class="right">'.price($objp->amount).
"</td>\n";
852 $totalpaid += $objp->amount;
861 print
'<tr><td colspan="'.$colspan.
'" class="right">'.$langs->trans(
"AlreadyPaid").
' :</td><td class="right">'.
price($totalpaid).
"</td></tr>\n";
862 print
'<tr><td colspan="'.$colspan.
'" class="right">'.$langs->trans(
"AmountExpected").
' :</td><td class="right">'.
price(
$object->amount).
"</td></tr>\n";
864 $remaintopay =
$object->amount - $totalpaid;
865 $resteapayeraffiche = $remaintopay;
867 print
'<tr><td colspan="'.$colspan.
'" class="right">'.$langs->trans(
"RemainderToPay").
" :</td>";
868 print
'<td class="right'.(!empty($resteapayeraffiche) ?
' amountremaintopay' :
'').
'">'.
price($resteapayeraffiche).
"</td></tr>\n";
879 print
'<div class="clearboth"></div>';
888 print
'<div class="tabsAction">';
889 $parameters = array();
890 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
891 if (empty($reshook)) {
893 if ($permissiontoadd &&
$object->status == $object::STATUS_CANCELED) {
894 print
'<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=confirm_reopen&confirm=yes&token='.newToken().
'">'.$langs->trans(
"ReOpen").
'</a>';
897 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&token='.newToken().
'&rowid='.
$object->id.
'">'.$langs->trans(
'Modify').
'</a></div>';
899 if (
$object->status == $object::STATUS_DRAFT) {
900 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>';
903 if ((
$object->status == $object::STATUS_DRAFT ||
$object->status == $object::STATUS_VALIDATED) && $totalpaid == 0 &&
$object->paid == 0) {
904 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>";
908 if (
$object->status == $object::STATUS_VALIDATED &&
$object->paid == 0 && $user->hasRight(
'don',
'creer')) {
909 if ($remaintopay == 0) {
910 print
'<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="'.$langs->trans(
"DisabledBecauseRemainderToPayIsZero").
'">'.$langs->trans(
'DoPayment').
'</span></div>';
912 print
'<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.
'/don/payment/payment.php?rowid='.
$object->id.
'&action=create&token='.newToken().
'">'.$langs->trans(
'DoPayment').
'</a></div>';
917 if (
$object->status == $object::STATUS_VALIDATED && $remaintopay == 0 &&
$object->paid == 0 && $user->hasRight(
'don',
'creer')) {
918 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?rowid='.
$object->id.
'&action=set_paid&token='.newToken().
'">'.$langs->trans(
"ClassifyPaid").
"</a></div>";
920 if (
$object->status == $object::STATUS_PAID &&
$object->paid == 1 && $user->hasRight(
'don',
'creer')) {
921 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?rowid='.
$object->id.
'&action=set_validate&token='.newToken().
'">'.$langs->trans(
"ReOpen").
"</a></div>";
925 if ($user->hasRight(
'don',
'supprimer')) {
926 if (
$object->status != $object::STATUS_PAID && $remaintopay ==
$object->amount) {
927 print
'<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?rowid='.$object->id.
'&action=delete&token='.newToken().
'">'.$langs->trans(
"Delete").
"</a></div>";
929 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"DeletionNotPossibleWhenAPaymentExists").
'">'.$langs->trans(
"Delete").
"</a></div>";
932 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
"Delete").
"</a></div>";
939 print
'<div class="fichecenter"><div class="fichehalfleft">';
946 $urlsource = $_SERVER[
'PHP_SELF'].
'?rowid='.
$object->id;
947 $genallowed = (int) ((
$object->paid == 0 || $user->admin) && $user->hasRight(
'don',
'lire'));
948 $delallowed = $user->hasRight(
'don',
'creer');
950 print $formfile->showdocuments(
'donation', $filename, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf);
953 $tmparray = $form->showLinkToObjectBlock($object, array(), array(
'don'), 1);
954 $linktoelem = $tmparray[
'linktoelem'];
955 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
956 print $htmltoenteralink;
958 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
962 include_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
963 $validpaymentmethod = getValidOnlinePaymentMethods(
'');
964 $useonlinepayment = count($validpaymentmethod);
966 if ($useonlinepayment) {
967 print
'<br><!-- Link to pay -->'.
"\n";
968 require_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
969 print showOnlinePaymentUrl(
'donation',
$object->ref).
'<br>';
972 print
'</div><div class="fichehalfright">';
974 print
'</div></div>';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage bank accounts.
Class to manage a WYSIWYG editor.
Class to manage donations.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage translations.
donation_prepare_head($object)
Prepare array with list of tabs.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='')
Show information in HTML for admin users or standard users.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
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.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOSTFLOAT($paramname, $rounding='', $option=2)
Return the value of a $_GET or $_POST supervariable, converted into float.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
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...
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.