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 ($_POST["action"] == 'confirm_payed')
|
||||||
if ($_GET["action"] == 'del' && $_POST["confirm"] == 'yes')
|
|
||||||
{
|
{
|
||||||
$chargesociales=new ChargeSociales($db);
|
if ($_POST["confirm"] == 'yes')
|
||||||
$chargesociales->id=$_GET["id"];
|
|
||||||
$result=$chargesociales->delete($user);
|
|
||||||
if ($result > 0)
|
|
||||||
{
|
{
|
||||||
Header("Location: index.php");
|
$chargesociales = new ChargeSociales($db);
|
||||||
exit;
|
$result = $chargesociales->set_payed($chid);
|
||||||
}
|
}
|
||||||
else
|
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>';
|
if ($mesg) print $mesg.'<br>';
|
||||||
|
|
||||||
//$head[0][0] = DOL_URL_ROOT.'/comm/propal.php?propalid='.$propal->id;
|
$h = 0;
|
||||||
$head[0][1] = $langs->trans("SocialContribution").": $cha->id";
|
$head[$h][0] = DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$cha->id;
|
||||||
$h = 1;
|
$head[$h][1] = $langs->trans('Card');
|
||||||
$a = 0;
|
$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
|
* 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>';
|
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 "<form action=\"charges.php?id=$cha->id&action=update\" method=\"post\">";
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
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("Type")."</td><td>$cha->type_libelle</td><td>".$langs->trans("Payments")."</td></tr>";
|
||||||
|
|
||||||
print "<tr><td>".$langs->trans("Period")."</td>";
|
print "<tr><td>".$langs->trans("Period")."</td>";
|
||||||
@ -217,12 +245,6 @@ if ($chid > 0)
|
|||||||
|
|
||||||
print "<div class=\"tabsAction\">\n";
|
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
|
// Emettre paiement
|
||||||
if ($cha->paye == 0 && round($resteapayer) > 0 && $user->rights->tax->charges->creer)
|
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>";
|
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>";
|
print "</div>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,3 +63,7 @@ NewCheckReceipt=Nouvelle remise
|
|||||||
NewCheckDeposit=New check deposit
|
NewCheckDeposit=New check deposit
|
||||||
NewCheckDepositOn=New check deposit on account: %s
|
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 ?
|
||||||
@ -63,3 +63,7 @@ NewCheckReceipt=Nouvelle remise
|
|||||||
NewCheckDeposit=Nouveau dépôt
|
NewCheckDeposit=Nouveau dépôt
|
||||||
NewCheckDepositOn=Nouveau dépôt sur compte: %s
|
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