FIX Consistency in direct debit order lists.

FIX Confirmation of deletion
This commit is contained in:
Laurent Destailleur 2019-09-06 14:24:33 +02:00
parent bc7bf3b4b5
commit bc0b8dfad0
6 changed files with 29 additions and 7 deletions

View File

@ -239,6 +239,23 @@ if ($id > 0 || $ref)
dol_fiche_end(); dol_fiche_end();
$formconfirm = '';
// Confirmation to delete
if ($action == 'delete')
{
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('Delete'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1);
}
// Call Hook formConfirm
/*$parameters = array();
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;*/
// Print form confirm
print $formconfirm;
if (empty($object->date_trans) && $user->rights->prelevement->bons->send && $action=='settransmitted') if (empty($object->date_trans) && $user->rights->prelevement->bons->send && $action=='settransmitted')
{ {
@ -298,7 +315,7 @@ if ($id > 0 || $ref)
print "<a class=\"butAction\" href=\"card.php?action=setcredited&id=".$object->id."\">".$langs->trans("ClassCredited")."</a>"; print "<a class=\"butAction\" href=\"card.php?action=setcredited&id=".$object->id."\">".$langs->trans("ClassCredited")."</a>";
} }
print "<a class=\"butActionDelete\" href=\"card.php?action=confirm_delete&id=".$object->id."\">".$langs->trans("Delete")."</a>"; print "<a class=\"butActionDelete\" href=\"card.php?action=delete&id=".$object->id."\">".$langs->trans("Delete")."</a>";
print "</div>"; print "</div>";
} }

View File

@ -1629,8 +1629,8 @@ class BonPrelevement extends CommonObject
public static function buildRumNumber($row_code_client, $row_datec, $row_drum) public static function buildRumNumber($row_code_client, $row_datec, $row_drum)
{ {
global $langs; global $langs;
$pre = $langs->trans('RUM').'-'; $pre = substr(dol_string_nospecial(dol_string_unaccent($langs->transnoentitiesnoconv('RUM'))), 0, 3); // Must always be on 3 char ('RUM' or 'UMR'. This is a protection against bad translation)
return $pre.$row_code_client.'-'.$row_drum.'-'.date('U', $row_datec); return $pre.'-'.$row_code_client.'-'.$row_drum.'-'.date('U', $row_datec);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps

View File

@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('banks', 'categories', 'widthdrawals', 'companies', 'bills')); $langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies', 'bills'));
// Security check // Security check
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
@ -105,6 +105,7 @@ if (empty($reshook))
/* /*
* View * View
*/ */
$form = new Form($db); $form = new Form($db);
$thirdpartystatic=new Societe($db); $thirdpartystatic=new Societe($db);
@ -206,9 +207,11 @@ $sql.= " ".MAIN_DB_PREFIX."societe as s,";
$sql.= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; $sql.= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql.= " WHERE s.rowid = f.fk_soc"; $sql.= " WHERE s.rowid = f.fk_soc";
$sql.= " AND f.entity IN (".getEntity('invoice').")"; $sql.= " AND f.entity IN (".getEntity('invoice').")";
$sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
$sql.= " AND f.total_ttc > 0";
$sql.= " AND pfd.traite = 0"; $sql.= " AND pfd.traite = 0";
$sql.= " AND pfd.fk_facture = f.rowid"; $sql.= " AND pfd.fk_facture = f.rowid";
if ($socid) $sql.= " AND f.fk_soc = ".$socid; if ($socid > 0) $sql.= " AND f.fk_soc = ".$socid;
$nbtotalofrecords = ''; $nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
@ -292,7 +295,7 @@ if ($resql)
$i++; $i++;
} }
} }
else print '<tr '.$bc[0].'><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>'; else print '<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
print "</table>"; print "</table>";
print "</form>"; print "</form>";
print "<br>\n"; print "<br>\n";

View File

@ -92,6 +92,7 @@ if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.
if ($socid) $sql.= " AND f.fk_soc = ".$socid; if ($socid) $sql.= " AND f.fk_soc = ".$socid;
if (!$status) $sql.= " AND pfd.traite = 0"; if (!$status) $sql.= " AND pfd.traite = 0";
if ($status) $sql.= " AND pfd.traite = ".$status; if ($status) $sql.= " AND pfd.traite = ".$status;
$sql.= " AND f.total_ttc > 0";
$sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; $sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
$sql.= " AND pfd.fk_facture = f.rowid"; $sql.= " AND pfd.fk_facture = f.rowid";
if (dol_strlen(trim(GETPOST('search_societe', 'alpha')))) if (dol_strlen(trim(GETPOST('search_societe', 'alpha'))))

View File

@ -821,6 +821,7 @@ Mandatory=Mandatory
Hello=Hello Hello=Hello
GoodBye=GoodBye GoodBye=GoodBye
Sincerely=Sincerely Sincerely=Sincerely
ConfirmDeleteObject=Are you sure you want to delete this object?
DeleteLine=Delete line DeleteLine=Delete line
ConfirmDeleteLine=Are you sure you want to delete this line? ConfirmDeleteLine=Are you sure you want to delete this line?
NoPDFAvailableForDocGenAmongChecked=No PDF were available for the document generation among checked record NoPDFAvailableForDocGenAmongChecked=No PDF were available for the document generation among checked record

View File

@ -256,7 +256,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Confirmation to delete // Confirmation to delete
if ($action == 'delete') if ($action == 'delete')
{ {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteMyObject'), $langs->trans('ConfirmDeleteMyObject'), 'confirm_delete', '', 0, 1); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteMyObject'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1);
} }
// Confirmation to delete line // Confirmation to delete line
if ($action == 'deleteline') if ($action == 'deleteline')