Fix #yogosha4516

This commit is contained in:
Laurent Destailleur 2020-09-17 23:16:48 +02:00
parent 937d656f46
commit 13646ff41e

View File

@ -33,9 +33,9 @@ if (!empty($conf->banque->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/bank
$langs->loadLangs(array("bills", "banks", "companies")); $langs->loadLangs(array("bills", "banks", "companies"));
// Security check // Security check
$id = GETPOST('rowid') ?GETPOST('rowid', 'int') : GETPOST('id', 'int'); $id = GETPOST('rowid') ? GETPOST('rowid', 'int') : GETPOST('id', 'int');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm'); $confirm = GETPOST('confirm', 'alpha');
if ($user->socid) $socid = $user->socid; if ($user->socid) $socid = $user->socid;
// TODO Add rule to restrict access payment // TODO Add rule to restrict access payment
//$result = restrictedArea($user, 'facture', $id,''); //$result = restrictedArea($user, 'facture', $id,'');
@ -80,20 +80,20 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->don->cree
{ {
$db->commit(); $db->commit();
$factures = array(); // TODO Get all id of invoices linked to this payment $donations = array(); // TODO Get all id of donation linked to this payment
foreach ($factures as $id) foreach ($donations as $id)
{ {
$fac = new Facture($db); $donation = new Don($db);
$fac->fetch($id); $donation->fetch($id);
$outputlangs = $langs; $outputlangs = $langs;
if (!empty($_REQUEST['lang_id'])) if (!empty(GETPOST('lang_id')))
{ {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang(GETPOST('lang_id'));
} }
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
$fac->generateDocument($fac->model_pdf, $outputlangs); $donation->generateDocument($donation->model_pdf, $outputlangs);
} }
} }
@ -137,8 +137,7 @@ if ($action == 'delete')
*/ */
if ($action == 'valide') if ($action == 'valide')
{ {
$facid = GETPOST('facid', 'int'); print $form->formconfirm('card.php?id='.$object->id, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide', '', 0, 2);
print $form->formconfirm('card.php?id='.$object->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide', '', 0, 2);
} }
@ -263,26 +262,13 @@ dol_fiche_end();
*/ */
print '<div class="tabsAction">'; print '<div class="tabsAction">';
/*
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
{
if ($user->socid == 0 && $object->statut == 0 && $_GET['action'] == '')
{
if ($user->rights->facture->paiement)
{
print '<a class="butAction" href="card.php?id='.$_GET['id'].'&amp;facid='.$objp->facid.'&amp;action=valide">'.$langs->trans('Valid').'</a>';
}
}
}
*/
if (empty($action)) if (empty($action))
{ {
if ($user->rights->don->supprimer) if ($user->rights->don->supprimer)
{ {
if (!$disable_delete) if (!$disable_delete)
{ {
print '<a class="butActionDelete" href="card.php?id='.$_GET['id'].'&amp;action=delete">'.$langs->trans('Delete').'</a>'; print '<a class="butActionDelete" href="card.php?id='.$object->id.'&amp;action=delete">'.$langs->trans('Delete').'</a>';
} else { } else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("CantRemovePaymentWithOneInvoicePaid")).'">'.$langs->trans('Delete').'</a>'; print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("CantRemovePaymentWithOneInvoicePaid")).'">'.$langs->trans('Delete').'</a>';
} }