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->project->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);
67 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
70 $hookmanager->initHooks(array(
'doncard',
'globalcard'));
72 $upload_dir = $conf->don->dir_output;
73 $permissiontoadd = $user->rights->don->creer;
80 $parameters = array();
82 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
87 if (empty($reshook)) {
88 $backurlforlist = DOL_URL_ROOT.
'/don/list.php';
90 if (empty($backtopage) || ($cancel && empty($id))) {
91 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
92 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
93 $backtopage = $backurlforlist;
95 $backtopage = DOL_URL_ROOT.
'/don/card.php?id='.((!empty($id) && $id > 0) ? $id :
'__ID__');
101 if (!empty($backtopageforcancel)) {
102 header(
"Location: ".$backtopageforcancel);
104 } elseif (!empty($backtopage)) {
105 header(
"Location: ".$backtopage);
112 if ($action ==
'confirm_reopen' && $confirm ==
'yes' && $permissiontoadd) {
115 $result = $object->reopen($user);
118 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
119 if (method_exists($object,
'generateDocument')) {
120 $outputlangs = $langs;
122 if ($conf->global->MAIN_MULTILANGS && empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
123 $newlang =
GETPOST(
'lang_id',
'aZ09');
125 if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
126 $newlang = $object->thirdparty->default_lang;
128 if (!empty($newlang)) {
130 $outputlangs->setDefaultLang($newlang);
132 $model = $object->model_pdf;
133 $ret = $object->fetch($id);
135 $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
139 header(
"Location: ".$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
149 if ($action ==
'update') {
150 if (!empty($cancel)) {
151 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".urlencode($id));
157 if (empty($donation_date)) {
158 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Date")), null,
'errors');
163 if (empty($amount)) {
164 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Amount")), null,
'errors');
172 $object->firstname = (string)
GETPOST(
"firstname",
'alpha');
173 $object->lastname = (string)
GETPOST(
"lastname",
'alpha');
174 $object->societe = (string)
GETPOST(
"societe",
'alpha');
175 $object->address = (string)
GETPOST(
"address",
'alpha');
177 $object->town = (string)
GETPOST(
"town",
'alpha');
178 $object->zip = (string)
GETPOST(
"zipcode",
'alpha');
179 $object->country_id = (int)
GETPOST(
'country_id',
'int');
180 $object->email = (string)
GETPOST(
"email",
'alpha');
181 $object->date = $donation_date;
182 $object->public = $public_donation;
183 $object->fk_project = (int)
GETPOST(
"fk_project",
'int');
184 $object->modepaymentid = (int)
GETPOST(
'modepayment',
'int');
187 $ret = $extrafields->setOptionalsFromPost(null, $object,
'@GETPOSTISSET');
192 if ($object->update($user) > 0) {
193 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
204 if ($action ==
'add') {
205 if (!empty($cancel)) {
206 header(
"Location: index.php");
212 if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES) && !(
GETPOST(
"socid",
'int') > 0)) {
213 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ThirdParty")), null,
'errors');
217 if (empty($donation_date)) {
218 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Date")), null,
'errors');
223 if (empty($amount)) {
224 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Amount")), null,
'errors');
230 $object->socid = (int)
GETPOST(
"socid",
'int');
231 $object->firstname = (string)
GETPOST(
"firstname",
'alpha');
232 $object->lastname = (string)
GETPOST(
"lastname",
'alpha');
233 $object->societe = (string)
GETPOST(
"societe",
'alpha');
234 $object->address = (string)
GETPOST(
"address",
'alpha');
236 $object->zip = (string)
GETPOST(
"zipcode",
'alpha');
237 $object->town = (string)
GETPOST(
"town",
'alpha');
238 $object->country_id = (int)
GETPOST(
'country_id',
'int');
239 $object->email = (string)
GETPOST(
'email',
'alpha');
240 $object->date = $donation_date;
241 $object->note_private = (string)
GETPOST(
"note_private",
'restricthtml');
242 $object->note_public = (string)
GETPOST(
"note_public",
'restricthtml');
243 $object->public = $public_donation;
244 $object->fk_project = (int)
GETPOST(
"fk_project",
'int');
245 $object->modepaymentid = (int)
GETPOST(
'modepayment',
'int');
248 $ret = $extrafields->setOptionalsFromPost(null, $object);
253 $res = $object->create($user);
255 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$res);
265 if ($action ==
'confirm_delete' &&
GETPOST(
"confirm") ==
"yes" && $user->rights->don->supprimer) {
267 $result = $object->delete($user);
269 header(
"Location: index.php");
278 if ($action ==
'valid_promesse') {
280 if ($object->valid_promesse($id, $user->id) >= 0) {
289 if ($action ==
'set_cancel') {
291 if ($object->set_cancel($id) >= 0) {
299 if ($action ==
'set_paid') {
301 if ($object->setPaid($id, $modepayment) >= 0) {
306 } elseif ($action ==
'classin' && $user->rights->don->creer) {
308 $object->setProject($projectid);
313 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
374 $title = $langs->trans(
"Donation");
376 $help_url =
'EN:Module_Donations|FR:Module_Dons|ES:Módulo_Donaciones|DE:Modul_Spenden';
383 if (!empty($conf->project->enabled)) {
387 if ($action ==
'create') {
388 print
load_fiche_titre($langs->trans(
"AddDonation"),
'',
'object_donation');
390 print
'<form name="add" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
391 print
'<input type="hidden" name="token" value="'.newToken().
'">';
392 print
'<input type="hidden" name="action" value="add">';
396 print
'<table class="border centpercent">';
400 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
'Ref').
'</td><td>'.$langs->trans(
'Draft').
'</td></tr>';
403 if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES)) {
406 print
'<td class="fieldrequired">'.$langs->trans(
'ThirdParty').
'</td>';
408 print $soc->getNomUrl(1);
409 print
'<input type="hidden" name="socid" value="'.$soc->id.
'">';
411 $arrayoutstandingbills = $soc->getOutstandingBills();
412 $outstandingBills = $arrayoutstandingbills[
'opened'];
413 print
' ('.$langs->trans(
'CurrentOutstandingBill').
': ';
414 print
price($outstandingBills,
'', $langs, 0, 0, -1, $conf->currency);
415 if ($soc->outstanding_limit !=
'') {
416 if ($outstandingBills > $soc->outstanding_limit) {
417 print
img_warning($langs->trans(
"OutstandingBillReached"));
419 print
' / '.price($soc->outstanding_limit,
'', $langs, 0, 0, -1, $conf->currency);
424 print
'<td class="fieldrequired">'.$langs->trans(
'ThirdParty').
'</td>';
426 print
$form->select_company($soc->id,
'socid',
'(s.client = 1 OR s.client = 3) AND status=1',
'SelectThirdParty', 0, 0, null, 0,
'minwidth300');
428 if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) {
429 print
'<script type="text/javascript">
430 $(document).ready(function() {
431 $("#socid").change(function() {
432 console.log("We have changed the company - Reload page");
433 var socid = $(this).val();
434 var fac_rec = $(\'#fac_rec\').val();
436 $("input[name=action]").val("create");
437 $("form[name=add]").submit();
442 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>';
449 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"Date").
'</td><td>';
450 print
$form->selectDate($donation_date ? $donation_date : -1,
'',
'',
'',
'',
"add", 1, 1);
454 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>';
457 print
'<tr><td class="fieldrequired">'.$langs->trans(
"PublicDonation").
"</td><td>";
458 print
$form->selectyesno(
"public", $public_donation, 1);
459 print
"</td></tr>\n";
461 if (empty($conf->societe->enabled) || empty($conf->global->DONATION_USE_THIRDPARTIES)) {
462 print
"<tr>".
'<td>'.$langs->trans(
"Company").
'</td><td><input type="text" name="societe" value="'.
dol_escape_htmltag(
GETPOST(
"societe")).
'" class="maxwidth200"></td></tr>';
463 print
"<tr>".
'<td>'.$langs->trans(
"Lastname").
'</td><td><input type="text" name="lastname" value="'.
dol_escape_htmltag(
GETPOST(
"lastname")).
'" class="maxwidth200"></td></tr>';
464 print
"<tr>".
'<td>'.$langs->trans(
"Firstname").
'</td><td><input type="text" name="firstname" value="'.
dol_escape_htmltag(
GETPOST(
"firstname")).
'" class="maxwidth200"></td></tr>';
465 print
"<tr>".
'<td>'.$langs->trans(
"Address").
'</td><td>';
466 print
'<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="3">'.dol_escape_htmltag(
GETPOST(
"address",
"alphanohtml"), 0, 1).
'</textarea></td></tr>';
469 print
'<tr><td>'.$langs->trans(
"Zip").
' / '.$langs->trans(
"Town").
'</td><td>';
470 print $formcompany->select_ziptown((
GETPOSTISSET(
"zipcode") ?
GETPOST(
"zipcode") : $object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
472 print $formcompany->select_ziptown((
GETPOSTISSET(
"town") ?
GETPOST(
"town") : $object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
476 print
'<tr><td><label for="selectcountry_id">'.$langs->trans(
'Country').
'</label></td><td class="maxwidthonsmartphone">';
477 print
img_picto(
'',
'globe-americas',
'class="paddingrightonly"').$form->select_country(
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') : $object->country_id);
479 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
483 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>';
487 print
"<tr><td>".$langs->trans(
"PaymentMode").
"</td><td>\n";
488 $selected =
GETPOST(
'modepayment',
'int');
489 $form->select_types_paiements($selected,
'modepayment',
'CRDT', 0, 1);
490 print
"</td></tr>\n";
494 print
'<td class="tdtop">'.$langs->trans(
'NotePublic').
'</td>';
497 $doleditor =
new DolEditor(
'note_public', $note_public,
'', 80,
'dolibarr_notes',
'In', 0,
false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3,
'90%');
498 print $doleditor->Create(1);
502 if (empty($user->socid)) {
504 print
'<td class="tdtop">'.$langs->trans(
'NotePrivate').
'</td>';
507 $doleditor =
new DolEditor(
'note_private', $note_private,
'', 80,
'dolibarr_notes',
'In', 0,
false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3,
'90%');
508 print $doleditor->Create(1);
512 if (!empty($conf->project->enabled)) {
513 print
"<tr><td>".$langs->trans(
"Project").
"</td><td>";
514 $formproject->select_projects(-1, $projectid,
'fk_project', 0, 0, 1, 1, 0, 0, 0,
'', 0, 0,
'maxwidth500');
515 print
"</td></tr>\n";
519 $parameters = array();
520 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
521 print $hookmanager->resPrint;
522 if (empty($reshook)) {
523 print $object->showOptionals($extrafields,
'create', $parameters);
531 print
$form->buttonsSaveCancel();
543 if (!empty($id) && $action ==
'edit') {
544 $result = $object->fetch($id);
548 $result = $object->fetch_optionals();
556 print
'<form name="update" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
557 print
'<input type="hidden" name="token" value="'.newToken().
'">';
558 print
'<input type="hidden" name="action" value="update">';
559 print
'<input type="hidden" name="rowid" value="'.$object->id.
'">';
560 print
'<input type="hidden" name="amount" value="'.$object->amount.
'">';
563 print
dol_get_fiche_head($head, $hselected, $langs->trans(
"Donation"), 0,
'donation');
565 print
'<table class="border centpercent">';
568 print
'<tr><td>'.$langs->trans(
"Ref").
'</td><td colspan="2">';
569 print $object->getNomUrl();
574 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Date").
'</td><td>';
575 print
$form->selectDate($object->date,
'',
'',
'',
'',
"update");
579 if ($object->statut == 0) {
580 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>';
582 print
'<tr><td>'.$langs->trans(
"Amount").
'</td><td>';
583 print
price($object->amount, 0, $langs, 0, 0, -1, $conf->currency);
587 print
'<tr><td class="fieldrequired">'.$langs->trans(
"PublicDonation").
"</td><td>";
588 print
$form->selectyesno(
"public", $object->public, 1);
592 if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES)) {
595 print
'<tr><td>'.$langs->trans(
"ThirdParty").
'</td><td colspan="2">';
596 if ($object->socid > 0) {
597 $result = $company->fetch($object->socid);
598 print $company->getNomUrl(1);
602 $langs->load(
"companies");
603 print
'<tr><td>'.$langs->trans(
"Company").
'</td><td><input type="text" name="societe" class="maxwidth200" value="'.
dol_escape_htmltag($object->societe).
'"></td></tr>';
604 print
'<tr><td>'.$langs->trans(
"Lastname").
'</td><td><input type="text" name="lastname" class="maxwidth200" value="'.
dol_escape_htmltag($object->lastname).
'"></td></tr>';
605 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td><td><input type="text" name="firstname" class="maxwidth200" value="'.
dol_escape_htmltag($object->firstname).
'"></td></tr>';
606 print
'<tr><td>'.$langs->trans(
"Address").
'</td><td>';
607 print
'<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.
'">'.
dol_escape_htmltag($object->address, 0, 1).
'</textarea></td></tr>';
610 print
'<tr><td>'.$langs->trans(
"Zip").
' / '.$langs->trans(
"Town").
'</td><td>';
611 print $formcompany->select_ziptown((
GETPOSTISSET(
"zipcode") ?
GETPOSTISSET(
"zipcode") : $object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
613 print $formcompany->select_ziptown((
GETPOSTISSET(
"town") ?
GETPOST(
"town") : $object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
617 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
'Country').
'</td><td>';
618 print
$form->select_country((!empty($object->country_id) ? $object->country_id : $mysoc->country_code),
'country_id');
620 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
624 print
"<tr>".
'<td>'.$langs->trans(
"EMail").
'</td><td><input type="text" name="email" class="maxwidth200" value="'.
dol_escape_htmltag($object->email).
'"></td></tr>';
627 print
"<tr><td>".$langs->trans(
"PaymentMode").
"</td><td>\n";
628 if ($object->mode_reglement_id) {
629 $selected = $object->mode_reglement_id;
633 $form->select_types_paiements($selected,
'modepayment',
'CRDT', 0, 1);
634 print
"</td></tr>\n";
637 print
"<tr>".
'<td>'.$langs->trans(
"Status").
'</td><td>'.$object->getLibStatut(4).
'</td></tr>';
640 if (!empty($conf->project->enabled)) {
643 $langs->load(
'projects');
644 print
'<tr><td>'.$langs->trans(
'Project').
'</td><td>';
645 $formproject->select_projects(-1, $object->fk_project,
'fk_project', 0, 0, 1, 1, 0, 0, 0,
'', 0, 0,
'maxwidth500');
650 $parameters = array();
651 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
652 print $hookmanager->resPrint;
653 if (empty($reshook)) {
654 print $object->showOptionals($extrafields,
'edit', $parameters);
661 print
$form->buttonsSaveCancel();
673 if (!empty($id) && $action !=
'edit') {
675 if ($action ==
'delete') {
676 $text = $langs->trans(
"ConfirmDeleteADonation");
677 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"DeleteADonation"), $text,
"confirm_delete",
'',
'', 1);
680 $result = $object->fetch($id);
684 $result = $object->fetch_optionals();
692 print
dol_get_fiche_head($head, $hselected, $langs->trans(
"Donation"), -1,
'donation');
697 $linkback =
'<a href="'.DOL_URL_ROOT.
'/don/list.php'.(!empty($socid) ?
'?socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
699 $morehtmlref =
'<div class="refidno">';
701 if (!empty($conf->project->enabled)) {
702 $langs->load(
"projects");
703 $morehtmlref .= $langs->trans(
'Project').
' ';
704 if ($user->rights->don->creer) {
705 if ($action !=
'classify') {
706 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
708 if ($action ==
'classify') {
710 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
711 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
712 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
713 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project,
'projectid', 0, 0, 1, 0, 1, 0, 0,
'', 1, 0,
'maxwidth500');
714 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
715 $morehtmlref .=
'</form>';
717 $morehtmlref .=
$form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1);
720 if (!empty($object->fk_project)) {
722 $proj->fetch($object->fk_project);
723 $morehtmlref .=
' : '.$proj->getNomUrl(1);
725 $morehtmlref .=
' - '.$proj->title;
732 $morehtmlref .=
'</div>';
735 dol_banner_tab($object,
'rowid', $linkback, 1,
'rowid',
'ref', $morehtmlref);
738 print
'<div class="fichecenter">';
739 print
'<div class="fichehalfleft">';
740 print
'<div class="underbanner clearboth"></div>';
742 print
'<table class="border tableforfield" width="100%">';
745 print
'<tr><td class="titlefield">'.$langs->trans(
"Date").
'</td><td colspan="2">';
749 print
'<tr><td>'.$langs->trans(
"Amount").
'</td><td colspan="2">';
750 print
price($object->amount, 0, $langs, 0, 0, -1, $conf->currency);
753 print
'<tr><td>'.$langs->trans(
"PublicDonation").
'</td><td colspan="2">';
754 print
yn($object->public);
757 if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES)) {
760 print
'<tr><td>'.$langs->trans(
"ThirdParty").
'</td><td colspan="2">';
761 if ($object->socid > 0) {
762 $result = $company->fetch($object->socid);
763 print $company->getNomUrl(1);
767 print
'<tr><td>'.$langs->trans(
"Company").
'</td><td colspan="2">'.$object->societe.
'</td></tr>';
768 print
'<tr><td>'.$langs->trans(
"Lastname").
'</td><td colspan="2">'.$object->lastname.
'</td></tr>';
769 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td><td colspan="2">'.$object->firstname.
'</td></tr>';
773 print
"<tr><td>".$langs->trans(
"PaymentMode").
"</td><td>";
774 $form->form_modes_reglement(null, $object->mode_reglement_id,
'none');
775 print
"</td></tr>\n";
779 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
784 print
'<div class="fichehalfright">';
789 $sql =
"SELECT p.rowid, p.num_payment, p.datep as dp, p.amount,";
790 $sql .=
"c.code as type_code,c.libelle as paiement_type";
791 $sql .=
" FROM ".MAIN_DB_PREFIX.
"payment_donation as p";
792 $sql .=
", ".MAIN_DB_PREFIX.
"c_paiement as c ";
793 $sql .=
", ".MAIN_DB_PREFIX.
"don as d";
794 $sql .=
" WHERE d.rowid = ".((int) $id);
795 $sql .=
" AND p.fk_donation = d.rowid";
796 $sql .=
" AND d.entity IN (".getEntity(
'donation').
")";
797 $sql .=
" AND p.fk_typepayment = c.id";
798 $sql .=
" ORDER BY dp";
801 $resql = $db->query($sql);
803 $num = $db->num_rows(
$resql);
805 print
'<table class="noborder paymenttable centpercent">';
806 print
'<tr class="liste_titre">';
807 print
'<td>'.$langs->trans(
"RefPayment").
'</td>';
808 print
'<td>'.$langs->trans(
"Date").
'</td>';
809 print
'<td>'.$langs->trans(
"Type").
'</td>';
810 print
'<td class="right">'.$langs->trans(
"Amount").
'</td>';
814 $objp = $db->fetch_object(
$resql);
816 print
'<tr class="oddeven"><td>';
817 print
'<a href="'.DOL_URL_ROOT.
'/don/payment/card.php?id='.$objp->rowid.
'">'.
img_object($langs->trans(
"Payment"),
"payment").
' '.$objp->rowid.
'</a></td>';
818 print
'<td>'.dol_print_date($db->jdate($objp->dp),
'day').
"</td>\n";
819 $labeltype = $langs->trans(
"PaymentType".$objp->type_code) != (
"PaymentType".$objp->type_code) ? $langs->trans(
"PaymentType".$objp->type_code) : $objp->paiement_type;
820 print
"<td>".$labeltype.
' '.$objp->num_payment.
"</td>\n";
821 print
'<td class="right">'.price($objp->amount).
"</td>\n";
823 $totalpaid += $objp->amount;
827 if ($object->paid == 0) {
828 print
"<tr><td colspan=\"3\" class=\"right\">".$langs->trans(
"AlreadyPaid").
" :</td><td class=\"right\">".
price($totalpaid).
"</td></tr>\n";
829 print
"<tr><td colspan=\"3\" class=\"right\">".$langs->trans(
"AmountExpected").
" :</td><td class=\"right\">".
price($object->amount).
"</td></tr>\n";
831 $remaintopay = $object->amount - $totalpaid;
833 print
"<tr><td colspan=\"3\" class=\"right\">".$langs->trans(
"RemainderToPay").
" :</td>";
834 print
'<td class="right'.($resteapayeraffiche ?
' amountremaintopay' :
'').
'">'.
price($remaintopay).
"</td></tr>\n";
845 print
'<div class="clearboth"></div>';
849 $remaintopay = $object->amount - $totalpaid;
853 print
'<div class="tabsAction">';
856 if ($permissiontoadd && $object->statut == $object::STATUS_CANCELED) {
857 print
'<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&action=confirm_reopen&confirm=yes&token='.
newToken().
'">'.$langs->trans(
"ReOpen").
'</a>';
860 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>';
862 if ($object->statut == $object::STATUS_DRAFT) {
863 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>';
866 if (($object->statut == $object::STATUS_DRAFT || $object->statut == $object::STATUS_VALIDATED) && $totalpaid == 0 && $object->paid == 0) {
867 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>";
871 if ($object->statut == $object::STATUS_VALIDATED && $object->paid == 0 && $user->rights->don->creer) {
872 if ($remaintopay == 0) {
873 print
'<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="'.$langs->trans(
"DisabledBecauseRemainderToPayIsZero").
'">'.$langs->trans(
'DoPayment').
'</span></div>';
875 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>';
880 if ($object->statut == $object::STATUS_VALIDATED && round($remaintopay) == 0 && $object->paid == 0 && $user->rights->don->creer) {
881 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>";
885 if ($user->rights->don->supprimer) {
886 if ($object->statut == $object::STATUS_CANCELED || $object->statut == $object::STATUS_DRAFT) {
887 print
'<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?rowid='.$object->id.
'&action=delete&token='.
newToken().
'">'.$langs->trans(
"Delete").
"</a></div>";
889 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
"Delete").
"</a></div>";
892 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
"Delete").
"</a></div>";
898 print
'<div class="fichecenter"><div class="fichehalfleft">';
905 $urlsource = $_SERVER[
'PHP_SELF'].
'?rowid='.$object->id;
906 $genallowed = (($object->paid == 0 || $user->admin) && $user->rights->don->lire);
907 $delallowed = $user->rights->don->creer;
909 print $formfile->showdocuments(
'donation', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf);
912 $linktoelem =
$form->showLinkToObjectBlock($object, null, array(
'don'));
913 $somethingshown =
$form->showLinkedObjectBlock($object, $linktoelem);
916 $useonlinepayment = (!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled));
918 if ($useonlinepayment) {
919 print
'<br><!-- Link to pay -->'.
"\n";
920 require_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
921 print showOnlinePaymentUrl(
'donation', $object->ref).
'<br>';
924 print
'</div><div class="fichehalfright">';
926 print
'</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.
if($cancel &&!$id) if($action== 'add'&&!$cancel) if($action== 'delete') if($id) $form
Actions.
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...
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save"&&empty($cancel)) $help_url
View.
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 from a POST of a form...
Class to manage third parties objects (customers, suppliers, prospects...)
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin= '1', $morecss= 'hideonsmartphone', $textfordropdown= '')
Show information for admin users or standard users.
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)
Class to manage translations.
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
restrictedArea($user, $features, $objectid=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.
if(isModEnabled('facture')&&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur')&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)&&$user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice')&&$user->rights->supplier_invoice->lire)) if(isModEnabled('don')&&!empty($user->rights->don->lire)) if(isModEnabled('tax')&&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture')&&isModEnabled('commande')&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
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).
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.
$formconfirm
if ($action == 'delbookkeepingyear') {