diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index b17b15d3ff9..5680cfb676c 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -502,11 +502,11 @@ if ($id > 0) $sql2.= ' AND s.rowid = '.$object->id; // Show orders with status validated, shipping started and delivered (well any order we can bill) $sql2.= " AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))"; - + $resql2=$db->query($sql2); $orders2invoice = $db->num_rows($resql2); $db->free($resql2); - + print '
| ';
print $companystatic->getNomUrl(1,'customer');
print ' ';
-
+
// If module invoices enabled and user with invoice creation permissions
if (! empty($conf->facture->enabled))
{
if ($user->rights->facture->creer)
{
-
+
if (($objp->fk_statut > 0 && $objp->fk_statut < 3) || ($objp->fk_statut == 3 && $objp->facturee == 0))
{
-
+
print img_picto($langs->trans("CreateInvoiceForThisCustomer").' : '.$companystatic->nom,'object_bill').'';
}
}
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index 9d668723f34..937b37be6c2 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -256,7 +256,8 @@ if ($resql)
$moreforfilter='';
if ($user->rights->societe->client->voir || $socid)
{
- $moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': ';
+ $langs->load("commercial");
+ $moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': ';
$moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user);
$moreforfilter.=' ';
}
diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php
index 0ebe94d2d8a..4fbc531707f 100644
--- a/htdocs/compta/paiement.php
+++ b/htdocs/compta/paiement.php
@@ -68,6 +68,8 @@ if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='ye
$datepaye = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
$paiement_id = 0;
+ $totalpaiement = 0;
+ $atleastonepaymentnotnull = 0;
// Verifie si des paiements sont superieurs au montant facture
foreach ($_POST as $key => $value)
@@ -77,6 +79,7 @@ if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='ye
$cursorfacid = substr($key,7);
$amounts[$cursorfacid] = price2num(trim($_POST[$key]));
$totalpaiement = $totalpaiement + $amounts[$cursorfacid];
+ if (! empty($amounts[$cursorfacid])) $atleastonepaymentnotnull++;
$tmpfacture=new Facture($db);
$tmpfacture->fetch($cursorfacid);
$amountsresttopay[$cursorfacid]=price2num($tmpfacture->total_ttc-$tmpfacture->getSommePaiement());
@@ -108,7 +111,7 @@ if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='ye
}
}
- if ($totalpaiement == 0)
+ if (empty($totalpaiement) && empty($atleastonepaymentnotnull))
{
$fiche_erreur_message = ' '.$langs->transnoentities('ErrorFieldRequired',$langs->trans('PaymentAmount')).' ';
$error++;
@@ -154,8 +157,8 @@ if ($action == 'confirm_paiement' && $confirm == 'yes')
if (! $error)
{
- $paiement_id = $paiement->create($user,(GETPOST('closepaidinvoices')=='on'?1:0));
- if ($paiement_id < 0)
+ $paiement_id = $paiement->create($user,(GETPOST('closepaidinvoices')=='on'?1:0));
+ if ($paiement_id < 0)
{
$errmsg=$paiement->error;
$error++;
diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php
index 3d23f896c0e..e3daaaf119b 100644
--- a/htdocs/compta/paiement/class/paiement.class.php
+++ b/htdocs/compta/paiement/class/paiement.class.php
@@ -137,17 +137,22 @@ class Paiement extends CommonObject
// Clean parameters
$totalamount = 0;
+ $atleastonepaymentnotnull = 0;
foreach ($this->amounts as $key => $value) // How payment is dispatch
{
$newvalue = price2num($value,'MT');
$this->amounts[$key] = $newvalue;
$totalamount += $newvalue;
+ if (! empty($newvalue)) $atleastonepaymentnotnull++;
}
$totalamount = price2num($totalamount);
// Check parameters
- if ($totalamount == 0) return -1; // On accepte les montants negatifs pour les rejets de prelevement mais pas null
-
+ if (empty($totalamount) && empty($atleastonepaymentnotnull)) // We accept negative amounts for withdraw reject but not empty arrays
+ {
+ $this->error='TotalAmountEmpty';
+ return -1;
+ }
$this->db->begin();
diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php
index e423136b7ee..5b3b2fe05d1 100644
--- a/htdocs/compta/resultat/index.php
+++ b/htdocs/compta/resultat/index.php
@@ -506,7 +506,7 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++)
print ' | '; if (isset($decaiss_ttc[$case]) && $decaiss_ttc[$case] != 0) { - print ''.price(price2num($decaiss_ttc[$case],'MT')).''; + print ''.price(price2num($decaiss_ttc[$case],'MT')).''; if (! isset($totsorties[$annee])) $totsorties[$annee]=0; $totsorties[$annee]+=$decaiss_ttc[$case]; } @@ -515,7 +515,7 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++) print ' | '; if (isset($encaiss_ttc[$case]) && $encaiss_ttc[$case] != 0) { - print ''.price(price2num($encaiss_ttc[$case],'MT')).''; + print ''.price(price2num($encaiss_ttc[$case],'MT')).''; if (! isset($totentrees[$annee])) $totentrees[$annee]=0; $totentrees[$annee]+=$encaiss_ttc[$case]; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index fa53b19a2fb..cab56780ed8 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2732,12 +2732,12 @@ class Form if ($filter) $newfilter.=' AND ('.$filter.')'; $nbqualifiedlines=$this->select_remises($selected,$htmlname,$newfilter,$socid,$maxvalue); print ' | '; - print ''; + print ' | '; if ($nbqualifiedlines > 0) { - print ' '; + print ' '; } if ($more) print $more; print ' | ';