diff --git a/htdocs/compta/sociales/charges.php b/htdocs/compta/sociales/charges.php
index ea6b6c658f4..ffba9834453 100644
--- a/htdocs/compta/sociales/charges.php
+++ b/htdocs/compta/sociales/charges.php
@@ -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='
'.$chargesociales->error.'
';
+ $_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=''.$chargesociales->error.'
';
+ }
+ }
+ else
+ {
+ $_GET['action']='';
}
}
@@ -96,27 +113,38 @@ if ($chid > 0)
{
if ($mesg) print $mesg.'
';
- //$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 '
';
}
+ if ($_GET['action'] == 'delete')
+ {
+ $text=$langs->trans('ConfirmDeleteSocialContribution');
+ $html->form_confirm($_SERVER['PHP_SELF'].'?id='.$cha->id,$langs->trans('DeleteSocialContribution'),$text,'confirm_delete');
+ print '
';
+ }
+
print "