diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 73e7fb28670..749a9a12184 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -27,6 +27,8 @@ $user->getrights('facture'); if (!$user->rights->facture->lire) accessforbidden(); +$langs->load("bills"); + require("../facture.class.php"); require("../lib/CMailFile.class.php"); require("../paiement.class.php"); @@ -214,12 +216,6 @@ if ($_GET["action"] == 'payed' && $user->rights->facture->paiement) $result = $fac->set_payed($_GET["facid"]); } -if ($_GET["action"] == 'canceled' && $user->rights->facture->paiement) -{ - $fac = new Facture($db); - $result = $fac->set_canceled($_GET["facid"]); -} - if ($_POST["action"] == 'setremise' && $user->rights->facture->creer) { $fac = new Facture($db); @@ -297,6 +293,18 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == yes) } } +if ($_POST["action"] == 'confirm_canceled' && $_POST["confirm"] == yes) +{ + if ($user->rights->facture->supprimer ) + { + $fac = new Facture($db); + $result = $fac->set_canceled($_GET["facid"]); + $_GET["facid"] = 0 ; + Header("Location: facture.php"); + } +} + + /* * */ @@ -754,6 +762,15 @@ else { $html->form_confirm($_SERVER["PHP_SELF"]."?facid=$fac->id","Supprimer la facture","Etes-vous sûr de vouloir supprimer cette facture ?","confirm_delete"); } + + /* + * Confirmation du classement abandonné + * + */ + if ($_GET["action"] == 'canceled') + { + $html->form_confirm($_SERVER["PHP_SELF"]."?facid=$fac->id","Classer la facture à l'état 'Abandonnée'","La totalité du paiement de cette facture n'a pas été réalisée. Etes-vous sûr de vouloir abandonner définitivement cette facture ?","confirm_canceled"); + } /* * Confirmation de la validation @@ -1052,7 +1069,7 @@ else { if ($user->rights->facture->valider) { - print 'Valider'; + print ''.$langs->trans("Valid").''; } } else @@ -1062,11 +1079,11 @@ else { if ($fac->paye == 0) { - print "id&action=pdf\">Générer le PDF"; + print "id&action=pdf\">".$langs->trans("BuildPDF").""; } else { - print "id&action=pdf\">Regénérer le PDF"; + print "id&action=pdf\">".$langs->trans("RebuildPDF").""; } } } @@ -1074,38 +1091,38 @@ else // Supprimer if ($fac->statut == 0 && $user->rights->facture->supprimer) { - print "id&action=delete\">Supprimer"; + print "id&action=delete\">".$langs->trans("Delete").""; } // Envoyer if ($fac->statut == 1 && $user->rights->facture->envoyer) { - print "id&action=presend\">Envoyer"; + print "id&action=presend\">".$langs->trans("Send").""; } // Envoyer une relance if ($fac->statut == 1 && price($resteapayer) > 0 && $user->rights->facture->envoyer) { - print "id&action=prerelance\">Envoyer relance"; + print "id&action=prerelance\">".$langs->trans("SendRemind").""; } // Emettre paiement if ($fac->statut == 1 && price($resteapayer) > 0 && $user->rights->facture->paiement) { - print "id."&action=create\">Emettre paiement"; + print "id."&action=create\">".$langs->trans("DoPaiement").""; } // Classer 'payé' if ($fac->statut == 1 && price($resteapayer) <= 0 && $fac->paye == 0 && $user->rights->facture->paiement) { - print "id&action=payed\">Classer 'Payée'"; + print "id&action=payed\">".$langs->trans("ClassifyPayed").""; } - // Classer 'annulée' (possible si validée et aucun paiement n'a encore eu lieu) - if ($fac->statut == 1 && $fac->paye == 0 && $totalpaye == 0 && $user->rights->facture->paiement) + // Classer 'abandonnée' (possible si validée et pas encore classer payée) + if ($fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->paiement) { - print "id&action=canceled\">Classer 'Annulée'"; + print "id&action=canceled\">".$langs->trans("ClassifyCanceled").""; } // Récurrente @@ -1494,7 +1511,7 @@ else } elseif ($objp->fk_statut == 3) { - print 'annulée'; + print 'abandonnée'; } else { diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php index 4e99a7faa17..4131b886ab2 100644 --- a/htdocs/facture.class.php +++ b/htdocs/facture.class.php @@ -432,7 +432,7 @@ class Facture } /** - * Retourne le libellé du statut d'une facture (brouillon, validée, annulée, payée) + * Retourne le libellé du statut d'une facture (brouillon, validée, abandonnée, payée) * */ Function get_libstatut() @@ -459,7 +459,7 @@ class Facture $return = $this->db->query( $sql); } /** - * Tag la facture comme annulée + * Tag la facture comme abandonnée * */ Function set_canceled($rowid) @@ -913,7 +913,7 @@ class Facture if (! $paye) { if ($statut == 0) return 'Brouillon (à valider)'; - if ($statut == 3) return 'Annulée'; + if ($statut == 3) return 'Abandonnée'; return 'Validée (à payer)'; } else diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index e858f5ec3cc..1962fd2d761 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -289,6 +289,8 @@ class Form */ Function form_confirm($page, $title, $question, $action) { + global $langs; + print '
'; print ''; print ''; @@ -299,7 +301,7 @@ class Form $this->selectyesno("confirm","no"); print "\n"; - print ''; + print ''; print '
'; print "
\n"; } diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index c2483eacf7d..0f9b80264bf 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -1,3 +1,12 @@ # Dolibarr language file - en_US - bills Bill=Bill -Bills=Bills \ No newline at end of file +Bills=Bills +ClassifyPayed=Classify 'Payed' +ClassifyCanceled=Classify 'Abandonned' +Send=Send +SendRemind=Send remind +DoPaiement=Do paiement +BuildPDF=Build PDF +RebuildPDF=Rebuild PDF +VAT=VAT +Amount=Amount \ No newline at end of file diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index 5172eed10d8..5e3d3f9f6b3 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -1,3 +1,12 @@ # Dolibarr language file - fr_FR - bills Bill=Facture -Bills=Factures \ No newline at end of file +Bills=Factures +ClassifyPayed=Classer 'Payée' +ClassifyCanceled=Classer 'Abandonnée' +Send=Envoyer +SendRemind=Envoyer rappel +DoPaiement=Emettre paiement +BuildPDF=Générer le PDF +RebuildPDF=Regénérer le PDF +VAT=TVA +Amount=Montant \ No newline at end of file