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 "
id&action=update\" method=\"post\">"; print ''; + print ""; + print ""; print ""; @@ -217,12 +245,6 @@ if ($chid > 0) print "
\n"; - // Supprimer - if ($cha->paye == 0 && $totalpaye <=0 && $user->rights->tax->charges->supprimer) - { - print "id&action=delete\">".$langs->trans("Delete").""; - } - // Emettre paiement if ($cha->paye == 0 && round($resteapayer) > 0 && $user->rights->tax->charges->creer) { @@ -235,6 +257,12 @@ if ($chid > 0) print "id&action=payed\">".$langs->trans("ClassifyPayed").""; } + // Supprimer + if ($cha->paye == 0 && $totalpaye <=0 && $user->rights->tax->charges->supprimer) + { + print "id&action=delete\">".$langs->trans("Delete").""; + } + print "
"; } } diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index a6357c274f5..0e405bad38c 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -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. \ No newline at end of file +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 ? \ No newline at end of file diff --git a/htdocs/langs/fr_FR/compta.lang b/htdocs/langs/fr_FR/compta.lang index 9cef7543f89..6b2d40a728a 100644 --- a/htdocs/langs/fr_FR/compta.lang +++ b/htdocs/langs/fr_FR/compta.lang @@ -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. \ No newline at end of file +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 ? \ No newline at end of file
".$langs->trans("Ref").''.$cha->id."
".$langs->trans("Type")."$cha->type_libelle".$langs->trans("Payments")."
".$langs->trans("Period")."