27require
'../../main.inc.php';
35require_once DOL_DOCUMENT_ROOT.
'/don/class/don.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/don/class/paymentdonation.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/modules/facture/modules_facture.php';
40 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
45$langs->loadLangs(array(
"bills",
"banks",
"companies",
"donations"));
50$action =
GETPOST(
'action',
'aZ09');
51$confirm =
GETPOST(
'confirm',
'alpha');
53 $socid = $user->socid;
60 dol_print_error($db,
'Failed to get payment id '.$id);
66$permissiontoread = $user->hasRight(
'don',
'lire');
67$permissiontoadd = $user->hasRight(
'don',
'creer');
68$permissiontodelete = $user->hasRight(
'don',
'supprimer');
76if ($action ==
'confirm_delete' && $confirm ==
'yes' && $permissiontodelete) {
80 $result =
$object->delete($user);
83 header(
"Location: ".DOL_URL_ROOT.
"/don/index.php");
97$title = $langs->trans(
"Payment");
98llxHeader(
'', $title,
'',
'', 0, 0,
'',
'',
'',
'mod-donation page-payment_card');
101$form =
new Form($db);
105 $langs->load(
'errors');
106 echo
'<div class="error">'.$langs->trans(
"ErrorRecordNotFound").
'</div>';
114$head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/don/payment/card.php', [
'id' => $id]);
115$head[$h][1] = $langs->trans(
"DonationPayment");
116$hselected = (string) $h;
119print
dol_get_fiche_head($head, $hselected, $langs->trans(
"DonationPayment"), -1,
'payment');
122if ($action ==
'delete') {
123 print $form->formconfirm(
'card.php?id='.
$object->id, $langs->trans(
"DeletePayment"), $langs->trans(
"ConfirmDeletePayment"),
'confirm_delete',
'', 0, 2);
127dol_banner_tab($object,
'id',
'', 1,
'rowid',
'id');
129print
'<div class="fichecenter">';
130print
'<div class="underbanner clearboth"></div>';
132print
'<table class="border centpercent">';
135print
'<tr><td class="titlefield">'.$langs->trans(
'Date').
'</td><td>'.
dol_print_date(
$object->datep,
'day').
'</td></tr>';
138print
'<tr><td>'.$langs->trans(
'Mode').
'</td><td>'.$langs->trans(
"PaymentType".
$object->type_code).
'</td></tr>';
144print
'<tr><td>'.$langs->trans(
'Amount').
'</td><td>'.
price(
$object->amount, 0, $outputlangs, 1, -1, -1,
getDolCurrency()).
'</td></tr>';
153 $bankline->fetch(
$object->bank_line);
156 print
'<td>'.$langs->trans(
'BankTransactionLine').
'</td>';
158 print $bankline->getNomUrl(1, 0,
'showall');
173$sql =
'SELECT d.rowid as did, d.paid, d.amount as d_amount, pd.amount';
174$sql .=
' FROM '.MAIN_DB_PREFIX.
'payment_donation as pd,'.MAIN_DB_PREFIX.
'don as d';
175$sql .=
' WHERE pd.fk_donation = d.rowid';
176$sql .=
' AND d.entity = '.((int)
$conf->entity);
177$sql .=
' AND pd.rowid = '.((int) $id);
180$resql = $db->query($sql);
182 $num = $db->num_rows($resql);
186 print
'<br><table class="noborder centpercent">';
187 print
'<tr class="liste_titre">';
188 print
'<td>'.$langs->trans(
'Donation').
'</td>';
189 print
'<td class="right">'.$langs->trans(
'ExpectedToPay').
'</td>';
190 print
'<td class="center">'.$langs->trans(
'Status').
'</td>';
191 print
'<td class="right">'.$langs->trans(
'PayedByThisPayment').
'</td>';
196 $objp = $db->fetch_object($resql);
198 print
'<tr class="oddeven">';
201 $don->fetch($objp->did);
202 print $don->getNomUrl(1);
205 print
'<td class="right">'.price($objp->d_amount).
'</td>';
207 print
'<td class="center">'.$don->getLibStatut(4).
'</td>';
209 print
'<td class="right">'.price($objp->amount).
'</td>';
211 if ($objp->paid == 1) {
215 $total += $objp->amount;
224 dol_print_error($db);
235print
'<div class="tabsAction">';
238 if ($user->hasRight(
'don',
'supprimer')) {
239 if (!$disable_delete) {
240 print dolGetButtonAction($langs->trans(
'Delete'), $langs->trans(
'Delete'),
'delete',
dolBuildUrl($_SERVER[
"PHP_SELF"], [
'id' =>
$object->id,
'action' =>
'delete'],
true),
'', 1, array(
'attr' => array(
'class' =>
'reposition'))).
"\n";
242 print dolGetButtonAction($langs->trans(
"CantRemovePaymentWithOneInvoicePaid"), $langs->trans(
'Delete'),
'',
dolBuildUrl($_SERVER[
"PHP_SELF"], [
'id' =>
$object->id],
false,
'#'),
'', 1, [
'attr' => [
'classOverride' =>
'butActionRefused']]);
$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 transaction lines.
Class to manage donations.
Class to manage payments of donations.
dolBuildUrl($url, $params=[], $addtoken=false, $anchor='')
Return path of url.
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
dol_htmlcleanlastbr($stringtodecode)
This function remove all ending and br at end.
getDolCurrency()
Return the main currency ('EUR', 'USD', ...)
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles=1, $removeclassattribute=1, $cleanalsojavascript=0, $allowiframe=0, $allowed_tags=array(), $allowlink=0, $allowscript=0, $allowstyle=0, $allowphp=0)
Clean a string to keep only desirable HTML tags.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
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.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.