Ajout protection confirmation sur classer pay et effacer d'une charge sociale
This commit is contained in:
parent
a353297207
commit
88b477c028
@ -45,32 +45,49 @@ $chid=isset($_GET["id"])?$_GET["id"]:$_POST["id"];
|
||||
|
||||
/* *************************************************************************** */
|
||||
/* */
|
||||
/* Action Classer Payé */
|
||||
/* Actions */
|
||||
/* */
|
||||
/* *************************************************************************** */
|
||||
if ($_GET["action"] == 'payed')
|
||||
{
|
||||
$cha = new ChargeSociales($db);
|
||||
$result = $cha->set_payed($chid);
|
||||
}
|
||||
|
||||
/*
|
||||
* Suppression d'une charge sociale
|
||||
* Classer payé
|
||||
*/
|
||||
|
||||
if ($_GET["action"] == 'del' && $_POST["confirm"] == 'yes')
|
||||
if ($_POST["action"] == 'confirm_payed')
|
||||
{
|
||||
$chargesociales=new ChargeSociales($db);
|
||||
$chargesociales->id=$_GET["id"];
|
||||
$result=$chargesociales->delete($user);
|
||||
if ($result > 0)
|
||||
if ($_POST["confirm"] == 'yes')
|
||||
{
|
||||
Header("Location: index.php");
|
||||
exit;
|
||||
$chargesociales = new ChargeSociales($db);
|
||||
$result = $chargesociales->set_payed($chid);
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$chargesociales->error.'</div>';
|
||||
$_GET["action"]='';
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Suppression d'une charge sociale
|
||||
*/
|
||||
if ($_POST["action"] == 'confirm_delete')
|
||||
{
|
||||
if ($_POST["confirm"] == 'yes')
|
||||
{
|
||||
$chargesociales=new ChargeSociales($db);
|
||||
$chargesociales->id=$_GET["id"];
|
||||
$result=$chargesociales->delete($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
Header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$chargesociales->error.'</div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$_GET['action']='';
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,27 +113,38 @@ if ($chid > 0)
|
||||
{
|
||||
if ($mesg) print $mesg.'<br>';
|
||||
|
||||
//$head[0][0] = DOL_URL_ROOT.'/comm/propal.php?propalid='.$propal->id;
|
||||
$head[0][1] = $langs->trans("SocialContribution").": $cha->id";
|
||||
$h = 1;
|
||||
$a = 0;
|
||||
$h = 0;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$cha->id;
|
||||
$head[$h][1] = $langs->trans('Card');
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
dolibarr_fiche_head($head, $a);
|
||||
dolibarr_fiche_head($head, 'card', $langs->trans("SocialContribution"));
|
||||
|
||||
/*
|
||||
* Confirmation de la suppression de la charge
|
||||
*
|
||||
*/
|
||||
if ($_GET["action"] == 'delete')
|
||||
if ($_GET["action"] == 'payed')
|
||||
{
|
||||
$html->form_confirm($_SERVER["PHP_SELF"]."?id=$cha->id&action=del","Supprimer la charge sociale","Etes-vous sûr de vouloir supprimer cette charge sociale ?","confirm_delete");
|
||||
$text=$langs->trans('ConfirmPaySocialContribution');
|
||||
$html->form_confirm($_SERVER["PHP_SELF"]."?id=$cha->id&action=confirm_payed",$langs->trans('PaySocialContribution'),$text,"confirm_payed");
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
if ($_GET['action'] == 'delete')
|
||||
{
|
||||
$text=$langs->trans('ConfirmDeleteSocialContribution');
|
||||
$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$cha->id,$langs->trans('DeleteSocialContribution'),$text,'confirm_delete');
|
||||
print '<br />';
|
||||
}
|
||||
|
||||
print "<form action=\"charges.php?id=$cha->id&action=update\" method=\"post\">";
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print "<tr><td>".$langs->trans("Ref").'</td><td colspan="2">'.$cha->id."</td></tr>";
|
||||
|
||||
print "<tr><td>".$langs->trans("Type")."</td><td>$cha->type_libelle</td><td>".$langs->trans("Payments")."</td></tr>";
|
||||
|
||||
print "<tr><td>".$langs->trans("Period")."</td>";
|
||||
@ -217,12 +245,6 @@ if ($chid > 0)
|
||||
|
||||
print "<div class=\"tabsAction\">\n";
|
||||
|
||||
// Supprimer
|
||||
if ($cha->paye == 0 && $totalpaye <=0 && $user->rights->tax->charges->supprimer)
|
||||
{
|
||||
print "<a class=\"butDelete\" href=\"charges.php?id=$cha->id&action=delete\">".$langs->trans("Delete")."</a>";
|
||||
}
|
||||
|
||||
// Emettre paiement
|
||||
if ($cha->paye == 0 && round($resteapayer) > 0 && $user->rights->tax->charges->creer)
|
||||
{
|
||||
@ -235,6 +257,12 @@ if ($chid > 0)
|
||||
print "<a class=\"tabAction\" href=\"charges.php?id=$cha->id&action=payed\">".$langs->trans("ClassifyPayed")."</a>";
|
||||
}
|
||||
|
||||
// Supprimer
|
||||
if ($cha->paye == 0 && $totalpaye <=0 && $user->rights->tax->charges->supprimer)
|
||||
{
|
||||
print "<a class=\"butDelete\" href=\"charges.php?id=$cha->id&action=delete\">".$langs->trans("Delete")."</a>";
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,4 +62,8 @@ CheckReceipt=Check receipt
|
||||
NewCheckReceipt=Nouvelle remise
|
||||
NewCheckDeposit=New check deposit
|
||||
NewCheckDepositOn=New check deposit on account: %s
|
||||
NoWaitingChecks=No checks waiting for deposit.
|
||||
NoWaitingChecks=No checks waiting for deposit.
|
||||
PaySocialContribution=Pay a social contribution
|
||||
ConfirmPaySocialContribution=Are you sure you want to classify this social contribution as payed ?
|
||||
DeleteSocialContribution=Delete a social contribution
|
||||
ConfirmDeleteSocialContribution=Are you sure you want to delete this social contribution ?
|
||||
@ -62,4 +62,8 @@ CheckReceipt=Remise de ch
|
||||
NewCheckReceipt=Nouvelle remise
|
||||
NewCheckDeposit=Nouveau dépôt
|
||||
NewCheckDepositOn=Nouveau dépôt sur compte: %s
|
||||
NoWaitingChecks=Pas de chèque en attente de dépots.
|
||||
NoWaitingChecks=Pas de chèque en attente de dépots.
|
||||
PaySocialContribution=Payer une charge sociale
|
||||
ConfirmPaySocialContribution=Etes-vous sûr de vouloir classer cette charge sociale à payé ?
|
||||
DeleteSocialContribution=Effacer charge sociale
|
||||
ConfirmDeleteSocialContribution=Etes-vous sûr de vouloir supprimer cette charge sociale ?
|
||||
Loading…
Reference in New Issue
Block a user