diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index ebf3929a6a2..88a75024348 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -261,34 +261,29 @@ if ($_POST['action'] == 'confirm_payed' && $_POST['confirm'] == 'yes' && $user->
}
if ($_POST['action'] == 'confirm_payed_partially' && $_POST['confirm'] == 'yes' && $user->rights->facture->paiement)
{
- $fac = new Facture($db);
- $fac->fetch($_GET['facid']);
- $close_code=$_POST["close_code"];
- $close_note=$_POST["close_note"];
- if ($close_code)
- {
- /*
- if ($close_code == 'other' && ! $close_note)
+ $fac = new Facture($db);
+ $fac->fetch($_GET['facid']);
+ $close_code=$_POST["close_code"];
+ $close_note=$_POST["close_note"];
+ if ($close_code)
{
- $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->trans("Comment")).'
';
+ if ($close_code == 'abandon')
+ {
+ $result = $fac->set_canceled($user,$close_code,$close_note);
+ }
+ elseif ($close_code == 'badcustomer')
+ {
+ $result = $fac->set_canceled($user,$close_code,$close_note);
+ }
+ else
+ {
+ $result = $fac->set_payed($user,$close_code,$close_note);
+ }
}
else
{
- */
- if ($close_code == 'abandon')
- {
- $result = $fac->set_canceled($user,$close_code,$close_note);
+ $mesg=''.$langs->trans("ErrorFieldRequired",$langs->trans("Reason")).'
';
}
- else
- {
- $result = $fac->set_payed($user,$close_code,$close_note);
- }
- // }
- }
- else
- {
- $mesg=''.$langs->trans("ErrorFieldRequired",$langs->trans("Reason")).'
';
- }
}
/*
@@ -1684,27 +1679,35 @@ else
$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('ClassifyPayed'),$langs->trans('ConfirmClassifyPayedBill',$fac->ref),'confirm_payed');
print '
';
}
- if ($_GET['action'] == 'payed' && $resteapayer > 0)
- {
- // Crée un tableau formulaire
- //$helpescompte_avoir=$langs->trans("ConfirmClassifyPayedPartiallyAvoir");
- $helpescompte_vat =$langs->trans("HelpEscompte").'
'.$langs->trans("ConfirmClassifyPayedPartiallyVat");
- $helpescompte_abandon=$langs->trans("ConfirmClassifyPayedPartiallyAbandon");
- //$reason_avoir =$html->textwithhelp($langs->transnoentities("ConfirmClassifyPayedPartiallyReasonAvoir",$resteapayer,$langs->trans("Currency".$conf->monnaie)),$helpescompte_avoir,1);
- $reason_vat =$html->textwithhelp($langs->transnoentities("ConfirmClassifyPayedPartiallyReasonDiscountVat",$resteapayer,$langs->trans("Currency".$conf->monnaie)),$helpescompte_vat,1);
- $reason_abandon=$html->textwithhelp($langs->transnoentities("ConfirmClassifyPayedPartiallyReasonAbandon",$resteapayer,$langs->trans("Currency".$conf->monnaie)),$helpescompte_abandon,1);
- //$arrayreasons['avoir'] =$reason_avoir;
- $arrayreasons['discount_vat']=$reason_vat;
- $arrayreasons['abandon'] =$reason_abandon;
- $formquestion=array(
- 'text' => $langs->trans("ConfirmClassifyPayedPartiallyQuestion"),
- array('type' => 'radio', 'name' => 'close_code', 'label' => $langs->trans("Reason"), 'values' => $arrayreasons),
- array('type' => 'text', 'name' => 'close_note', 'label' => $langs->trans("Comment"), 'value' => '', 'size' => '100')
- );
- // Paiement incomplet. On demande si motif = escompte ou autre
- $html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('ClassifyPayed'),$langs->trans('ConfirmClassifyPayedPartially',$fac->ref),'confirm_payed_partially',$formquestion);
- print '
';
- }
+ if ($_GET['action'] == 'payed' && $resteapayer > 0)
+ {
+ // Code
+ $close[0]['code']='discount_vat';
+ $close[1]['code']='badcustomer';
+ $close[2]['code']='abandon';
+ // Help
+ $close[0]['label']=$langs->trans("HelpEscompte").'
'.$langs->trans("ConfirmClassifyPayedPartiallyVat");
+ $close[1]['label']=$langs->trans("ConfirmClassifyPayedPartiallyBadCustomer");
+ $close[2]['label']=$langs->trans("ConfirmClassifyPayedPartiallyOther");
+ // Texte
+ $close[0]['reason']=$html->textwithhelp($langs->transnoentities("ConfirmClassifyPayedPartiallyReasonDiscountVat",$resteapayer,$langs->trans("Currency".$conf->monnaie)),$close[0]['label'],1);
+ $close[1]['reason']=$html->textwithhelp($langs->transnoentities("ConfirmClassifyPayedPartiallyReasonBadCustomer",$resteapayer,$langs->trans("Currency".$conf->monnaie)),$close[1]['label'],1);
+ $close[2]['reason']=$html->textwithhelp($langs->transnoentities("ConfirmClassifyPayedPartiallyReasonOther",$resteapayer,$langs->trans("Currency".$conf->monnaie)),$close[2]['label'],1);
+ // arrayreasons
+ $arrayreasons[$close[0]['code']]=$close[0]['reason'];
+ $arrayreasons[$close[1]['code']]=$close[1]['reason'];
+ $arrayreasons[$close[2]['code']]=$close[2]['reason'];
+
+ // Crée un tableau formulaire
+ $formquestion=array(
+ 'text' => $langs->trans("ConfirmClassifyPayedPartiallyQuestion"),
+ array('type' => 'radio', 'name' => 'close_code', 'label' => $langs->trans("Reason"), 'values' => $arrayreasons),
+ array('type' => 'text', 'name' => 'close_note', 'label' => $langs->trans("Comment"), 'value' => '', 'size' => '100')
+ );
+ // Paiement incomplet. On demande si motif = escompte ou autre
+ $html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('ClassifyPayed'),$langs->trans('ConfirmClassifyPayedPartially',$fac->ref),'confirm_payed_partially',$formquestion);
+ print '
';
+ }
/*
* Confirmation du classement abandonne
diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php
index 206d8b0122b..9af906b5050 100644
--- a/htdocs/facture.class.php
+++ b/htdocs/facture.class.php
@@ -867,7 +867,6 @@ class Facture extends CommonObject
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture SET';
$sql.= ' paye=1';
if ($close_code) $sql.= ", close_code='".addslashes($close_code)."'";
- if ($close_note) $sql.= ", close_note='".addslashes($close_note)."'";
$sql.= ' WHERE rowid = '.$this->id;
$resql = $this->db->query($sql);
diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang
index 41bb0f0534a..c39f640e3c4 100644
--- a/htdocs/langs/en_US/bills.lang
+++ b/htdocs/langs/en_US/bills.lang
@@ -116,11 +116,13 @@ ConfirmClassifyPayedPartiallyQuestion=This invoice has not been payed completely
ConfirmClassifyPayedPartiallyReasonAvoir=Remainder to pay (%s %s) is a discount granted because payment was made before term. Je régularise la TVA par un avoir.
ConfirmClassifyPayedPartiallyReasonDiscountNoVat=Remainder to pay (%s %s) is a discount granted because payment was made before term. J'accepte de perdre la TVA sur cet escompte.
ConfirmClassifyPayedPartiallyReasonDiscountVat=Remainder to pay (%s %s) is a discount granted because payment was made before term. Je récupère la TVA sur cet escompte sans avoir.
-ConfirmClassifyPayedPartiallyReasonAbandon=Debit irremediably not recoverable (bad customer...)
+ConfirmClassifyPayedPartiallyReasonBadCustomer=Bad customer
+ConfirmClassifyPayedPartiallyReasonOther=Debit irremediably not recoverable (other reason)
ConfirmClassifyPayedPartiallyNoVat=Ce choix est possible si votre facture était munie de la mention adéquate. (Exemple: « escompte net de taxe »)
ConfirmClassifyPayedPartiallyVat=Ce choix est possible si votre facture était munie de la mention adéquate. (Exemple: «seule la taxe correspondant au prix effectivement payé ouvre droit à déduction»)
ConfirmClassifyPayedPartiallyAvoir=Use this choice if all other does not suit
-ConfirmClassifyPayedPartiallyAbandon=Ce choix sera celui dans le cas d'un mauvais payeur sans aucun espoir de recouvrement
+ConfirmClassifyPayedPartiallyBadCustomer=This choice will be use for bad customers with no hope to be paied
+ConfirmClassifyPayedPartiallyOther=Use this choice if all other does not suit
ConfirmCustomerPayment=Do you confirm this paiement input for %s %s ?
ValidateBill=Validate invoice
NumberOfBills=Nb of invoices
diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang
index 406042079cb..fbab5e5c025 100644
--- a/htdocs/langs/fr_FR/bills.lang
+++ b/htdocs/langs/fr_FR/bills.lang
@@ -117,11 +117,13 @@ ConfirmClassifyPayedPartiallyQuestion=Cette facture n'a pas
ConfirmClassifyPayedPartiallyReasonAvoir=Le reste à payer (%s %s) est un trop facturé (car article retourné, oubli, escompte non défini...) régularisé par un avoir
ConfirmClassifyPayedPartiallyReasonDiscountNoVat=Le rest à payer (%s %s) est un escompte accordé après facture. J'accepte de perdre la TVA sur cet escompte
ConfirmClassifyPayedPartiallyReasonDiscountVat=Le reste à payer (%s %s) est un escompte
-ConfirmClassifyPayedPartiallyReasonAbandon=Créance définitivement abandonnée (client irrécouvrable...)
+ConfirmClassifyPayedPartiallyReasonBadCustomer=Mauvais payeur
+ConfirmClassifyPayedPartiallyReasonOther=Créance définitivement abandonnée (tout autre cas)
ConfirmClassifyPayedPartiallyAvoir=Ce choix est le choix à prendre si les autres ne sont pas applicables
ConfirmClassifyPayedPartiallyNoVat=Ce choix est possible si votre facture était munie de la mention adéquate. (Exemple: «escompte net de taxe»)
ConfirmClassifyPayedPartiallyVat=Ce choix est possible si votre facture était munie de la mention adéquate. (Exemple: mention définissant l'escompte ou du genre «seule la taxe correspondant au prix effectivement payé ouvre droit à déduction»)
-ConfirmClassifyPayedPartiallyAbandon=Ce choix sera celui dans le cas d'un mauvais payeur sans aucun espoir de recouvrement
+ConfirmClassifyPayedPartiallyBadCustomer=Ce choix sera celui dans le cas d'un mauvais payeur
+ConfirmClassifyPayedPartiallyOther=Ce choix sera celui dans tout autre cas
ConfirmCustomerPayment=Confirmez-vous la saisie de ce réglement de %s %s ?
ValidateBill=Valider facture
NumberOfBills=Nb de factures