32require
'../main.inc.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/modules/dons/modules_don.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/lib/donation.lib.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/don/class/don.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
45 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
46 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
59$langs->loadLangs(array(
'bills',
'companies',
'donations',
'users'));
63$action =
GETPOST(
'action',
'aZ09');
64$cancel =
GETPOST(
'cancel',
'alpha');
65$confirm =
GETPOST(
'confirm',
'alpha');
66$backtopage =
GETPOST(
'backtopage',
'alpha');
79if (!empty($socid) && $socid > 0) {
89$extrafields->fetch_name_optionals_label(
$object->table_element);
90$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
93$hookmanager->initHooks(array(
$object->element.
'card',
'globalcard'));
95$upload_dir = $conf->don->dir_output;
101$permissiontoread = $user->hasRight(
'don',
'lire');
102$permissiontoadd = $user->hasRight(
'don',
'creer');
103$permissiontodelete = $user->hasRight(
'don',
'supprimer');
104$permissiontoeditextra = $permissiontoadd;
105if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
107 $permissiontoeditextra =
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
117$parameters = array();
119$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
124if (empty($reshook)) {
125 $backurlforlist = DOL_URL_ROOT.
'/don/list.php';
127 if (empty($backtopage) || ($cancel && empty($id))) {
128 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
129 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
130 $backtopage = $backurlforlist;
132 $backtopage = DOL_URL_ROOT.
'/don/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
138 if (!empty($backtopageforcancel)) {
139 header(
"Location: ".$backtopageforcancel);
141 } elseif (!empty($backtopage)) {
142 header(
"Location: ".$backtopage);
149 if ($action ==
'confirm_reopen' && $confirm ==
'yes' && $permissiontoadd) {
150 $result =
$object->reopen($user);
154 $outputlangs = $langs;
157 $newlang =
GETPOST(
'lang_id',
'aZ09');
160 $newlang =
$object->thirdparty->default_lang;
162 if (!empty($newlang)) {
164 $outputlangs->setDefaultLang($newlang);
171 $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
174 header(
"Location: ".$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
184 if ($action ==
'update' && $permissiontoadd) {
185 if (!empty($cancel)) {
186 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".urlencode((
string) ($id)));
190 if (empty($donation_date)) {
191 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Date")),
null,
'errors');
196 if (empty($amount)) {
197 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Amount")),
null,
'errors');
214 $object->date = $donation_date;
215 $object->public = $public_donation;
220 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
225 if (
$object->update($user) > 0) {
226 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
237 if ($action ==
'add' && $permissiontoadd) {
238 if (!empty($cancel)) {
239 header(
"Location: index.php");
244 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ThirdParty")),
null,
'errors');
248 if (empty($donation_date)) {
249 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Date")),
null,
'errors');
254 if (empty($amount)) {
255 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Amount")),
null,
'errors');
271 $object->date = $donation_date;
272 $object->note_private = (string)
GETPOST(
"note_private",
'restricthtml');
273 $object->note_public = (string)
GETPOST(
"note_public",
'restricthtml');
274 $object->public = $public_donation;
279 $ret = $extrafields->setOptionalsFromPost(
null, $object);
286 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$res);
296 if ($action ==
'confirm_delete' &&
GETPOST(
"confirm") ==
"yes" && $permissiontodelete) {
297 $result =
$object->delete($user);
299 header(
"Location: index.php");
308 if ($action ==
'valid_promesse' && $permissiontoadd) {
310 if (
$object->valid_promesse($id, $user->id) >= 0) {
319 if ($action ==
'set_cancel' && $permissiontoadd) {
320 if (
$object->set_cancel($id) >= 0) {
328 if ($action ==
'set_paid' && $permissiontoadd) {
330 if (
$object->setPaid($id, $modepayment) >= 0) {
335 } elseif ($action ==
'classin' && $user->hasRight(
'don',
'creer')) {
336 $object->setProject($projectid);
339 if ($action ==
'set_validate' && $permissiontoadd) {
341 if (
$object->reopen($user) >= 0) {
348 if ($action ==
'update_extras' && $permissiontoeditextra) {
351 $attribute_name =
GETPOST(
'attribute',
'aZ09');
354 $ret = $extrafields->setOptionalsFromPost(
null, $object, $attribute_name);
360 $result =
$object->updateExtraField($attribute_name,
'DON_MODIFY');
368 $action =
'edit_extras';
373 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
381$bankaccountstatic =
new Account($db);
383$title = $langs->trans(
"Donation");
385$help_url =
'EN:Module_Donations|FR:Module_Dons|ES:Módulo_Donaciones|DE:Modul_Spenden';
387llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-donation page-card');
389$form =
new Form($db);
397if ($action ==
'create') {
398 print
load_fiche_titre($langs->trans(
"AddDonation"),
'',
'object_donation');
400 print
'<form name="add" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
401 print
'<input type="hidden" name="token" value="'.newToken().
'">';
402 print
'<input type="hidden" name="action" value="add">';
403 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
407 print
'<table class="border centpercent">';
411 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
'Ref').
'</td><td>'.$langs->trans(
'Draft').
'</td></tr>';
416 if (is_object($soc) && $soc->id > 0) {
417 print
'<td class="fieldrequired">'.$langs->trans(
'ThirdParty').
'</td>';
419 print $soc->getNomUrl(1);
420 print
'<input type="hidden" name="socid" value="'.$soc->id.
'">';
422 $arrayoutstandingbills = $soc->getOutstandingBills();
423 $outstandingBills = $arrayoutstandingbills[
'opened'];
424 print
' ('.$langs->trans(
'CurrentOutstandingBill').
': ';
425 print
price($outstandingBills, 0, $langs, 0, 0, -1, $conf->currency);
426 if ($soc->outstanding_limit !=
'') {
427 if ($outstandingBills > $soc->outstanding_limit) {
428 print
img_warning($langs->trans(
"OutstandingBillReached"));
430 print
' / '.price($soc->outstanding_limit, 0, $langs, 0, 0, -1, $conf->currency);
435 print
'<td class="fieldrequired">'.$langs->trans(
'ThirdParty').
'</td>';
437 $filter =
'((s.client:IN:1,2,3) AND (status:=:1))';
438 print $form->select_company($socid,
'socid', $filter,
'SelectThirdParty', 0, 0, array(), 0,
'minwidth300');
441 print
'<script type="text/javascript">
442 $(document).ready(function() {
443 $("#socid").change(function() {
444 console.log("We have changed the company - Reload page");
445 var socid = $(this).val();
446 var fac_rec = $(\'#fac_rec\').val();
448 $("input[name=action]").val("create");
449 $("form[name=add]").submit();
454 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>';
461 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"Date").
'</td><td>';
462 print $form->selectDate($donation_date ? $donation_date : -1,
'', 0, 0, 0,
"add", 1, 1);
466 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>';
469 print
'<tr><td class="fieldrequired">'.$langs->trans(
"PublicDonation").
"</td><td>";
470 print $form->selectyesno(
"public", $public_donation, 1);
471 print
"</td></tr>\n";
474 print
"<tr>".
'<td>'.$langs->trans(
"Company").
'</td><td><input type="text" name="societe" value="'.
dol_escape_htmltag(
GETPOST(
"societe")).
'" class="maxwidth200"></td></tr>';
475 print
"<tr>".
'<td>'.$langs->trans(
"Lastname").
'</td><td><input type="text" name="lastname" value="'.
dol_escape_htmltag(
GETPOST(
"lastname")).
'" class="maxwidth200"></td></tr>';
476 print
"<tr>".
'<td>'.$langs->trans(
"Firstname").
'</td><td><input type="text" name="firstname" value="'.
dol_escape_htmltag(
GETPOST(
"firstname")).
'" class="maxwidth200"></td></tr>';
477 print
"<tr>".
'<td>'.$langs->trans(
"Address").
'</td><td>';
478 print
'<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="3">'.dol_escape_htmltag(
GETPOST(
"address",
"alphanohtml"), 0, 1).
'</textarea></td></tr>';
481 print
'<tr><td>'.$langs->trans(
"Zip").
' / '.$langs->trans(
"Town").
'</td><td>';
482 print $formcompany->select_ziptown((GETPOSTISSET(
"zipcode") ?
GETPOST(
"zipcode") :
$object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
484 print $formcompany->select_ziptown((GETPOSTISSET(
"town") ?
GETPOST(
"town") :
$object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
488 print
'<tr><td><label for="selectcountry_id">'.$langs->trans(
'Country').
'</label></td><td class="maxwidthonsmartphone">';
489 print
img_picto(
'',
'globe-americas',
'class="paddingrightonly"').$form->select_country(
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id);
491 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
495 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>';
499 print
"<tr><td>".$langs->trans(
"PaymentMode").
"</td><td>\n";
501 print
img_picto(
'',
'payment',
'class="pictofixedwidth"');
502 print $form->select_types_paiements((
string) $selected,
'modepayment',
'CRDT', 0, 1, 0, 0, 1,
'maxwidth200 widthcentpercentminusx', 1);
503 print
"</td></tr>\n";
507 print
'<td class="tdtop">'.$langs->trans(
'NotePublic').
'</td>';
509 if (!isset($note_public)) {
510 $note_public =
$object->getDefaultCreateValueFor(
'note_public');
512 $doleditor =
new DolEditor(
'note_public', $note_public,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3,
'90%');
513 print $doleditor->Create(1);
517 if (empty($user->socid)) {
519 print
'<td class="tdtop">'.$langs->trans(
'NotePrivate').
'</td>';
521 if (!isset($note_private)) {
522 $note_private =
$object->getDefaultCreateValueFor(
'note_private');
524 $doleditor =
new DolEditor(
'note_private', $note_private,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3,
'90%');
525 print $doleditor->Create(1);
530 print
"<tr><td>".$langs->trans(
"Project").
"</td><td>";
531 print
img_picto(
'',
'project',
'class="pictofixedwidth"');
532 print $formproject->select_projects(-1, (
string) $projectid,
'fk_project', 0, 0, 1, 1, 0, 0, 0,
'', 1, 0,
'maxwidth500');
533 print
"</td></tr>\n";
537 $parameters = array();
538 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
539 print $hookmanager->resPrint;
540 if (empty($reshook)) {
541 print
$object->showOptionals($extrafields,
'create', $parameters);
549 print $form->buttonsSaveCancel();
561if (!empty($id) && $action ==
'edit') {
565 print
'<form name="update" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
566 print
'<input type="hidden" name="token" value="'.newToken().
'">';
567 print
'<input type="hidden" name="action" value="update">';
568 print
'<input type="hidden" name="rowid" value="'.$object->id.
'">';
569 print
'<input type="hidden" name="amount" value="'.$object->amount.
'">';
570 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
572 print
dol_get_fiche_head($head, $hselected, $langs->trans(
"Donation"), 0,
'donation');
574 print
'<table class="border centpercent">';
577 print
'<tr><td>'.$langs->trans(
"Ref").
'</td><td colspan="2">';
583 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Date").
'</td><td>';
584 print $form->selectDate(
$object->date,
'', 0, 0, 0,
"update");
589 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>';
591 print
'<tr><td>'.$langs->trans(
"Amount").
'</td><td>';
592 print
price(
$object->amount, 0, $langs, 0, 0, -1, $conf->currency);
596 print
'<tr><td class="fieldrequired">'.$langs->trans(
"PublicDonation").
"</td><td>";
597 print $form->selectyesno(
"public",
$object->public, 1);
604 print
'<tr><td>'.$langs->trans(
"ThirdParty").
'</td><td colspan="2">';
606 $result = $company->fetch(
$object->socid);
607 print $company->getNomUrl(1);
611 $langs->load(
"companies");
612 print
'<tr><td>'.$langs->trans(
"Company").
'</td><td><input type="text" name="societe" class="maxwidth200" value="'.
dol_escape_htmltag(
$object->societe).
'"></td></tr>';
613 print
'<tr><td>'.$langs->trans(
"Lastname").
'</td><td><input type="text" name="lastname" class="maxwidth200" value="'.
dol_escape_htmltag(
$object->lastname).
'"></td></tr>';
614 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td><td><input type="text" name="firstname" class="maxwidth200" value="'.
dol_escape_htmltag(
$object->firstname).
'"></td></tr>';
615 print
'<tr><td>'.$langs->trans(
"Address").
'</td><td>';
616 print
'<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.
'">'.
dol_escape_htmltag(
$object->address, 0, 1).
'</textarea></td></tr>';
619 print
'<tr><td>'.$langs->trans(
"Zip").
' / '.$langs->trans(
"Town").
'</td><td>';
620 print $formcompany->select_ziptown((GETPOSTISSET(
"zipcode") ? GETPOSTISSET(
"zipcode") :
$object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
622 print $formcompany->select_ziptown((GETPOSTISSET(
"town") ?
GETPOST(
"town") :
$object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
626 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
'Country').
'</td><td>';
627 print $form->select_country((!empty(
$object->country_id) ?
$object->country_id :
$mysoc->country_code),
'country_id');
629 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
633 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>';
636 print
"<tr><td>".$langs->trans(
"PaymentMode").
"</td><td>\n";
637 if (
$object->mode_reglement_id) {
638 $selected = (string)
$object->mode_reglement_id;
642 $form->select_types_paiements($selected,
'modepayment',
'CRDT', 0, 1);
643 print
"</td></tr>\n";
646 print
"<tr>".
'<td>'.$langs->trans(
"Status").
'</td><td>'.
$object->getLibStatut(4).
'</td></tr>';
652 $langs->load(
'projects');
653 print
'<tr><td>'.$langs->trans(
'Project').
'</td><td>';
654 $formproject->select_projects(-1, (
string)
$object->fk_project,
'fk_project', 0, 0, 1, 1, 0, 0, 0,
'', 0, 0,
'maxwidth500');
659 $parameters = array();
660 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
661 print $hookmanager->resPrint;
662 if (empty($reshook)) {
663 print
$object->showOptionals($extrafields,
'edit', $parameters);
670 print $form->buttonsSaveCancel();
682if (!empty($id) && $action !=
'edit') {
686 if ($action ==
'delete') {
687 $text = $langs->trans(
"ConfirmDeleteADonation");
688 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$object->id, $langs->trans(
"DeleteADonation"), $text,
"confirm_delete",
'',
'', 1);
696 $result =
$object->fetch_optionals();
705 print
dol_get_fiche_head($head, $hselected, $langs->trans(
"Donation"), -1,
'donation');
710 $linkback =
'<a href="'.DOL_URL_ROOT.
'/don/list.php'.(!empty($socid) ?
'?socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
712 $morehtmlref =
'<div class="refidno">';
715 $langs->load(
"projects");
717 if ($permissiontoadd) {
718 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
719 if ($action !=
'classify') {
720 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
722 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->socid,
$object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
724 if (!empty(
$object->fk_project)) {
726 $proj->fetch(
$object->fk_project);
727 $morehtmlref .= $proj->getNomUrl(1);
729 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
734 $morehtmlref .=
'</div>';
737 dol_banner_tab($object,
'rowid', $linkback, 1,
'rowid',
'ref', $morehtmlref);
740 print
'<div class="fichecenter">';
741 print
'<div class="fichehalfleft">';
742 print
'<div class="underbanner clearboth"></div>';
744 print
'<table class="border tableforfield" width="100%">';
747 print
'<tr><td class="titlefield">'.$langs->trans(
"Date").
'</td><td colspan="2">';
751 print
'<tr><td>'.$langs->trans(
"Amount").
'</td><td colspan="2">';
752 print
price(
$object->amount, 0, $langs, 0, 0, -1, $conf->currency);
755 print
'<tr><td>'.$langs->trans(
"PublicDonation").
'</td><td colspan="2">';
762 print
'<tr><td>'.$langs->trans(
"ThirdParty").
'</td><td colspan="2">';
764 $result = $company->fetch(
$object->socid);
765 print $company->getNomUrl(1);
769 print
'<tr><td>'.$langs->trans(
"Company").
'</td><td colspan="2">'.
$object->societe.
'</td></tr>';
770 print
'<tr><td>'.$langs->trans(
"Lastname").
'</td><td colspan="2">'.
$object->lastname.
'</td></tr>';
771 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td><td colspan="2">'.
$object->firstname.
'</td></tr>';
775 print
"<tr><td>".$langs->trans(
"PaymentMode").
"</td><td>";
776 $form->form_modes_reglement(
'', (
string)
$object->mode_reglement_id,
'none');
777 print
"</td></tr>\n";
781 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
786 print
'<div class="fichehalfright">';
791 $sql =
"SELECT p.rowid, p.num_payment, p.datep as dp, p.amount,";
792 $sql .=
" c.code as type_code, c.libelle as paiement_type,";
793 $sql .=
" b.fk_account";
794 $sql .=
" FROM ".MAIN_DB_PREFIX.
"payment_donation as p";
795 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank as b ON p.fk_bank = b.rowid";
796 $sql .=
", ".MAIN_DB_PREFIX.
"c_paiement as c ";
797 $sql .=
", ".MAIN_DB_PREFIX.
"don as d";
798 $sql .=
" WHERE d.rowid = ".((int) $id);
799 $sql .=
" AND p.fk_donation = d.rowid";
800 $sql .=
" AND d.entity IN (".getEntity(
'donation').
")";
801 $sql .=
" AND p.fk_typepayment = c.id";
802 $sql .=
" ORDER BY dp";
805 $resql = $db->query($sql);
807 $num = $db->num_rows($resql);
810 print
'<table class="noborder paymenttable centpercent">';
811 print
'<tr class="liste_titre">';
812 print
'<td>'.$langs->trans(
"RefPayment").
'</td>';
813 print
'<td>'.$langs->trans(
"Date").
'</td>';
814 print
'<td>'.$langs->trans(
"Type").
'</td>';
816 print
'<td>'.$langs->trans(
"BankAccount").
'</td>';
818 print
'<td class="right">'.$langs->trans(
"Amount").
'</td>';
822 $objp = $db->fetch_object($resql);
824 print
'<tr class="oddeven"><td>';
825 print
'<a href="'.DOL_URL_ROOT.
'/don/payment/card.php?id='.$objp->rowid.
'">'.
img_object($langs->trans(
"Payment"),
"payment").
' '.$objp->rowid.
'</a></td>';
826 print
'<td>'.dol_print_date($db->jdate($objp->dp),
'day').
"</td>\n";
827 $labeltype = ($langs->trans(
"PaymentType".$objp->type_code) !=
"PaymentType".$objp->type_code) ? $langs->trans(
"PaymentType".$objp->type_code) : $objp->paiement_type;
828 print
"<td>".$labeltype.
' '.$objp->num_payment.
"</td>\n";
830 $bankaccountstatic->fetch($objp->fk_account);
845 print
'<td class="nowraponall">';
846 if ($bankaccountstatic->id) {
847 print $bankaccountstatic->getNomUrl(1,
'transactions');
851 print
'<td class="right">'.price($objp->amount).
"</td>\n";
853 $totalpaid += $objp->amount;
862 print
'<tr><td colspan="'.$colspan.
'" class="right">'.$langs->trans(
"AlreadyPaid").
' :</td><td class="right">'.
price($totalpaid).
"</td></tr>\n";
863 print
'<tr><td colspan="'.$colspan.
'" class="right">'.$langs->trans(
"AmountExpected").
' :</td><td class="right">'.
price(
$object->amount).
"</td></tr>\n";
865 $remaintopay =
$object->amount - $totalpaid;
866 $resteapayeraffiche = $remaintopay;
868 print
'<tr><td colspan="'.$colspan.
'" class="right">'.$langs->trans(
"RemainderToPay").
" :</td>";
869 print
'<td class="right'.(!empty($resteapayeraffiche) ?
' amountremaintopay' :
'').
'">'.
price($resteapayeraffiche).
"</td></tr>\n";
880 print
'<div class="clearboth"></div>';
889 print
'<div class="tabsAction">';
890 $parameters = array();
891 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
892 if (empty($reshook)) {
894 if ($permissiontoadd &&
$object->status == $object::STATUS_CANCELED) {
895 print
'<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=confirm_reopen&confirm=yes&token='.
newToken().
'">'.$langs->trans(
"ReOpen").
'</a>';
898 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>';
900 if (
$object->status == $object::STATUS_DRAFT) {
901 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>';
904 if ((
$object->status == $object::STATUS_DRAFT ||
$object->status == $object::STATUS_VALIDATED) && $totalpaid == 0 &&
$object->paid == 0) {
905 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>";
909 if (
$object->status == $object::STATUS_VALIDATED &&
$object->paid == 0 && $user->hasRight(
'don',
'creer')) {
910 if ($remaintopay == 0) {
911 print
'<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="'.$langs->trans(
"DisabledBecauseRemainderToPayIsZero").
'">'.$langs->trans(
'DoPayment').
'</span></div>';
913 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>';
918 if (
$object->status == $object::STATUS_VALIDATED && $remaintopay == 0 &&
$object->paid == 0 && $user->hasRight(
'don',
'creer')) {
919 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>";
921 if (
$object->status == $object::STATUS_PAID &&
$object->paid == 1 && $user->hasRight(
'don',
'creer')) {
922 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>";
926 if ($user->hasRight(
'don',
'supprimer')) {
927 if (
$object->status != $object::STATUS_PAID && $remaintopay ==
$object->amount) {
928 print
'<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?rowid='.$object->id.
'&action=delete&token='.
newToken().
'">'.$langs->trans(
"Delete").
"</a></div>";
930 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"DeletionNotPossibleWhenAPaymentExists").
'">'.$langs->trans(
"Delete").
"</a></div>";
933 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
"Delete").
"</a></div>";
940 print
'<div class="fichecenter"><div class="fichehalfleft">';
947 $urlsource = $_SERVER[
'PHP_SELF'].
'?rowid='.
$object->id;
948 $genallowed = (int) ((
$object->paid == 0 || $user->admin) && $user->hasRight(
'don',
'lire'));
949 $delallowed = $user->hasRight(
'don',
'creer');
951 print $formfile->showdocuments(
'donation', $filename, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf);
954 $tmparray = $form->showLinkToObjectBlock($object, array(), array(
'don'), 1);
955 $linktoelem = $tmparray[
'linktoelem'];
956 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
957 print $htmltoenteralink;
959 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
963 include_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
964 $validpaymentmethod = getValidOnlinePaymentMethods(
'');
965 $useonlinepayment = count($validpaymentmethod);
967 if ($useonlinepayment) {
968 print
'<br><!-- Link to pay -->'.
"\n";
969 require_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
970 print showOnlinePaymentUrl(
'donation',
$object->ref).
'<br>';
973 print
'</div><div class="fichehalfright">';
975 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.
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
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...
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.