diff --git a/htdocs/core/boxes/box_factures.php b/htdocs/core/boxes/box_factures.php
index 011342d8a30..12875bd914c 100644
--- a/htdocs/core/boxes/box_factures.php
+++ b/htdocs/core/boxes/box_factures.php
@@ -93,7 +93,7 @@ class box_factures extends ModeleBoxes
$sql .= ", f.tva as total_tva";
$sql .= ", f.total_ttc";
$sql .= ", f.datef as df";
- $sql .= ", f.paye, f.fk_statut, f.datec, f.tms";
+ $sql .= ", f.paye, f.fk_statut as status, f.datec, f.tms";
$sql .= ", f.date_lim_reglement as datelimite";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client";
@@ -131,8 +131,10 @@ class box_factures extends ModeleBoxes
$facturestatic->total_ht = $objp->total_ht;
$facturestatic->total_tva = $objp->total_tva;
$facturestatic->total_ttc = $objp->total_ttc;
- $facturestatic->statut = $objp->fk_statut;
+ $facturestatic->statut = $objp->status;
+ $facturestatic->status = $objp->status;
$facturestatic->date_lim_reglement = $this->db->jdate($objp->datelimite);
+ $facturestatic->alreadypaid = $objp->paye;
$societestatic->id = $objp->socid;
$societestatic->name = $objp->name;
@@ -181,7 +183,7 @@ class box_factures extends ModeleBoxes
$this->info_box_contents[$line][] = array(
'td' => 'class="right" width="18"',
- 'text' => $facturestatic->LibStatut($objp->paye, $objp->fk_statut, 3),
+ 'text' => $facturestatic->LibStatut($objp->paye, $objp->status, 3, $objp->paye),
);
$line++;
diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php
index 26f24d41ab3..ba8873280f8 100644
--- a/htdocs/core/boxes/box_factures_fourn.php
+++ b/htdocs/core/boxes/box_factures_fourn.php
@@ -86,6 +86,8 @@ class box_factures_fourn extends ModeleBoxes
if ($user->rights->fournisseur->facture->lire)
{
+ $langs->load("bills");
+
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
$sql .= ", s.logo, s.email, s.entity";
@@ -93,7 +95,7 @@ class box_factures_fourn extends ModeleBoxes
$sql .= ", f.total_ht";
$sql .= ", f.total_tva";
$sql .= ", f.total_ttc";
- $sql .= ", f.paye, f.fk_statut";
+ $sql .= ", f.paye, f.fk_statut as status";
$sql .= ', f.datef as df';
$sql .= ', f.datec as datec';
$sql .= ', f.date_lim_reglement as datelimite, f.tms, f.type';
@@ -118,6 +120,7 @@ class box_factures_fourn extends ModeleBoxes
while ($line < $num) {
$objp = $this->db->fetch_object($result);
+
$datelimite = $this->db->jdate($objp->datelimite);
$date = $this->db->jdate($objp->df);
$datem = $this->db->jdate($objp->tms);
@@ -128,7 +131,8 @@ class box_factures_fourn extends ModeleBoxes
$facturestatic->total_tva = $objp->total_tva;
$facturestatic->total_ttc = $objp->total_ttc;
$facturestatic->date_echeance = $datelimite;
- $facturestatic->statut = $objp->fk_statut;
+ $facturestatic->statut = $objp->status;
+ $facturestatic->status = $objp->status;
$facturestatic->ref_supplier = $objp->ref_supplier;
$thirdpartystatic->id = $objp->socid;
@@ -182,7 +186,7 @@ class box_factures_fourn extends ModeleBoxes
$alreadypaid = $fac->getSommePaiement();
$this->info_box_contents[$line][] = array(
'td' => 'class="right" width="18"',
- 'text' => $facturestatic->LibStatut($objp->paye, $objp->fk_statut, 3, $alreadypaid, $objp->type),
+ 'text' => $facturestatic->LibStatut($objp->paye, $objp->status, 3, $alreadypaid, $objp->type),
);
$line++;
diff --git a/htdocs/core/boxes/box_factures_fourn_imp.php b/htdocs/core/boxes/box_factures_fourn_imp.php
index 99848d916f4..585566b78e3 100644
--- a/htdocs/core/boxes/box_factures_fourn_imp.php
+++ b/htdocs/core/boxes/box_factures_fourn_imp.php
@@ -82,6 +82,8 @@ class box_factures_fourn_imp extends ModeleBoxes
if ($user->rights->fournisseur->facture->lire)
{
+ $langs->load("bills");
+
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
$sql .= ", s.logo, s.email, s.entity";
@@ -90,13 +92,13 @@ class box_factures_fourn_imp extends ModeleBoxes
$sql .= ", f.total_ht as total_ht";
$sql .= ", f.tva as total_tva";
$sql .= ", f.total_ttc";
- $sql .= ", f.paye, f.fk_statut, f.type";
+ $sql .= ", f.paye, f.fk_statut as status, f.type";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ",".MAIN_DB_PREFIX."facture_fourn as f";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE f.fk_soc = s.rowid";
$sql .= " AND f.entity = ".$conf->entity;
- $sql .= " AND f.paye=0";
+ $sql .= " AND f.paye = 0";
$sql .= " AND fk_statut = 1";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
@@ -126,7 +128,8 @@ class box_factures_fourn_imp extends ModeleBoxes
$facturestatic->total_tva = $objp->total_tva;
$facturestatic->total_ttc = $objp->total_ttc;
$facturestatic->date_echeance = $datelimite;
- $facturestatic->statut = $objp->fk_statut;
+ $facturestatic->statut = $objp->status;
+ $facturestatic->status = $objp->status;
$thirdpartystatic->id = $objp->socid;
$thirdpartystatic->name = $objp->name;
@@ -173,7 +176,7 @@ class box_factures_fourn_imp extends ModeleBoxes
$alreadypaid = $fac->getSommePaiement();
$this->info_box_contents[$line][] = array(
'td' => 'class="right" width="18"',
- 'text' => $facturestatic->LibStatut($objp->paye, $objp->fk_statut, 3, $alreadypaid, $objp->type),
+ 'text' => $facturestatic->LibStatut($objp->paye, $objp->status, 3, $alreadypaid, $objp->type),
);
$line++;
diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php
index b47f948f4ca..0b93ea3267c 100644
--- a/htdocs/core/boxes/box_factures_imp.php
+++ b/htdocs/core/boxes/box_factures_imp.php
@@ -98,7 +98,7 @@ class box_factures_imp extends ModeleBoxes
$sql .= ", f.total as total_ht";
$sql .= ", f.tva as total_tva";
$sql .= ", f.total_ttc";
- $sql .= ", f.paye, f.fk_statut, f.rowid as facid";
+ $sql .= ", f.paye, f.fk_statut as status, f.rowid as facid";
$sql .= ", sum(pf.amount) as am";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@@ -136,8 +136,10 @@ class box_factures_imp extends ModeleBoxes
$facturestatic->total_ht = $objp->total_ht;
$facturestatic->total_tva = $objp->total_tva;
$facturestatic->total_ttc = $objp->total_ttc;
- $facturestatic->statut = $objp->fk_statut;
+ $facturestatic->statut = $objp->status;
+ $facturestatic->status = $objp->status;
$facturestatic->date_lim_reglement = $this->db->jdate($objp->datelimite);
+ $facturestatic->alreadypaid = $objp->paye;
$societestatic->id = $objp->socid;
$societestatic->name = $objp->name;
@@ -186,7 +188,7 @@ class box_factures_imp extends ModeleBoxes
$this->info_box_contents[$line][] = array(
'td' => 'class="right" width="18"',
- 'text' => $facturestatic->LibStatut($objp->paye, $objp->fk_statut, 3, $objp->am),
+ 'text' => $facturestatic->LibStatut($objp->paye, $objp->status, 3, $objp->am),
);
$line++;
diff --git a/htdocs/core/boxes/box_ficheinter.php b/htdocs/core/boxes/box_ficheinter.php
index 6cc213f98cb..186d57b831a 100644
--- a/htdocs/core/boxes/box_ficheinter.php
+++ b/htdocs/core/boxes/box_ficheinter.php
@@ -82,7 +82,7 @@ class box_ficheinter extends ModeleBoxes
if (!empty($user->rights->ficheinter->lire))
{
- $sql = "SELECT f.rowid, f.ref, f.fk_soc, f.fk_statut";
+ $sql = "SELECT f.rowid, f.ref, f.fk_soc, f.fk_statut as status";
$sql .= ", f.datec";
$sql .= ", f.date_valid as datev";
$sql .= ", f.tms as datem";
@@ -113,7 +113,8 @@ class box_ficheinter extends ModeleBoxes
$objp = $this->db->fetch_object($resql);
$datec = $this->db->jdate($objp->datec);
- $ficheinterstatic->statut = $objp->fk_statut;
+ $ficheinterstatic->statut = $objp->status;
+ $ficheinterstatic->status = $objp->status;
$ficheinterstatic->id = $objp->rowid;
$ficheinterstatic->ref = $objp->ref;
diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php
index f98e0f1e347..a8b7c0190dd 100644
--- a/htdocs/core/boxes/box_propales.php
+++ b/htdocs/core/boxes/box_propales.php
@@ -88,7 +88,7 @@ class box_propales extends ModeleBoxes
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client";
$sql .= ", s.logo, s.email, s.entity";
- $sql .= ", p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.tms";
+ $sql .= ", p.rowid, p.ref, p.fk_statut as status, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.tms";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."propal as p";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@@ -121,6 +121,8 @@ class box_propales extends ModeleBoxes
$propalstatic->total_ht = $objp->total_ht;
$propalstatic->total_tva = $objp->total_tva;
$propalstatic->total_ttc = $objp->total_ttc;
+ $propalstatic->statut = $objp->status;
+ $propalstatic->status = $objp->status;
$societestatic->id = $objp->socid;
$societestatic->name = $objp->name;
@@ -133,7 +135,7 @@ class box_propales extends ModeleBoxes
$societestatic->entity = $objp->entity;
$late = '';
- if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->propal->cloture->warning_delay)) {
+ if ($objp->status == 1 && $dateterm < ($now - $conf->propal->cloture->warning_delay)) {
$late = img_warning($langs->trans("Late"));
}
@@ -162,7 +164,7 @@ class box_propales extends ModeleBoxes
$this->info_box_contents[$line][] = array(
'td' => 'class="right" width="18"',
- 'text' => $propalstatic->LibStatut($objp->fk_statut, 3),
+ 'text' => $propalstatic->LibStatut($objp->status, 3),
);
$line++;
diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php
index 151c1df6bcb..dd555edaa96 100644
--- a/htdocs/core/boxes/box_supplier_orders.php
+++ b/htdocs/core/boxes/box_supplier_orders.php
@@ -90,7 +90,7 @@ class box_supplier_orders extends ModeleBoxes
$sql .= ", c.total_ht";
$sql .= ", c.tva as total_tva";
$sql .= ", c.total_ttc";
- $sql .= ", c.fk_statut";
+ $sql .= ", c.fk_statut as status";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as c";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@@ -115,6 +115,7 @@ class box_supplier_orders extends ModeleBoxes
$supplierorderstatic->id = $objp->rowid;
$supplierorderstatic->ref = $objp->ref;
+ $supplierorderstatic->statut = $objp->status;
$thirdpartystatic->id = $objp->socid;
$thirdpartystatic->name = $objp->name;
@@ -150,7 +151,7 @@ class box_supplier_orders extends ModeleBoxes
$this->info_box_contents[$line][] = array(
'td' => 'class="right" width="18"',
- 'text' => $supplierorderstatic->LibStatut($objp->fk_statut, 3),
+ 'text' => $supplierorderstatic->LibStatut($objp->status, 3),
);
$line++;
diff --git a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php
index 80fdbc2f4a2..7744a96530f 100644
--- a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php
+++ b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php
@@ -90,7 +90,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes
$sql .= ", c.total_ht";
$sql .= ", c.tva as total_tva";
$sql .= ", c.total_ttc";
- $sql .= ", c.fk_statut";
+ $sql .= ", c.fk_statut as status";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as c";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@@ -115,11 +115,10 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes
$delivery_date = $this->db->jdate($objp->delivery_date);
$datem = $this->db->jdate($objp->tms);
- $supplierorderstatic->delivery_date = $delivery_date;
- $supplierorderstatic->statut = $objp->fk_statut;
-
$supplierorderstatic->id = $objp->rowid;
$supplierorderstatic->ref = $objp->ref;
+ $supplierorderstatic->delivery_date = $delivery_date;
+ $supplierorderstatic->statut = $objp->status;
$thirdpartystatic->id = $objp->socid;
$thirdpartystatic->name = $objp->name;
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 0b4565ab08f..013e4670775 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -485,6 +485,10 @@ abstract class CommonObject
*/
public $sendtoid;
+ /**
+ * @var float Amount already paid (used to show correct status)
+ */
+ public $alreadypaid;
/**
* @var array List of child tables. To test if we can delete object.
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index e2889c4d6d3..21457b37848 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -3272,7 +3272,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'help', 'holiday',
'intervention', 'label', 'language', 'link', 'list', 'listlight', 'lot',
'map-marker-alt', 'member', 'money-bill-alt', 'mrp', 'note', 'next',
- 'object_accounting', 'object_account', 'object_accountline', 'object_action', 'object_barcode', 'object_bill', 'object_billa', 'object_billd', 'object_bom',
+ 'object_accounting', 'object_account', 'object_accountline', 'object_action', 'object_barcode', 'object_bill', 'object_billa', 'object_billr', 'object_billd', 'object_bom',
'object_category', 'object_conversation', 'object_bookmark', 'object_bug', 'object_clock', 'object_dolly', 'object_dollyrevert', 'object_generic', 'object_folder',
'object_list-alt', 'object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser',
'object_cash-register', 'object_company', 'object_contact', 'object_contract', 'object_donation', 'object_dynamicprice',
@@ -3312,7 +3312,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
$arrayconvpictotofa = array(
'account'=>'university', 'accountline'=>'receipt', 'accountancy'=>'money-check-alt', 'action'=>'calendar-alt', 'add'=>'plus-circle', 'address'=> 'address-book',
- 'bank_account'=>'university', 'bill'=>'file-invoice-dollar', 'billa'=>'file-excel', 'supplier_invoicea'=>'file-excel', 'billd'=>'file-medical', 'supplier_invoiced'=>'file-medical', 'bom'=>'cubes',
+ 'bank_account'=>'university', 'bill'=>'file-invoice-dollar', 'billa'=>'file-excel', 'billr'=>'file-invoice-dollar', 'supplier_invoicea'=>'file-excel', 'billd'=>'file-medical', 'supplier_invoiced'=>'file-medical', 'bom'=>'cubes',
'company'=>'building', 'contact'=>'address-book', 'contract'=>'suitcase', 'conversation'=>'comments', 'donation'=>'file-alt', 'dynamicprice'=>'hand-holding-usd',
'setup'=>'cog', 'companies'=>'building', 'products'=>'cube', 'commercial'=>'suitcase', 'invoicing'=>'coins',
'accounting'=>'chart-line', 'category'=>'tag', 'dollyrevert'=>'dolly',
@@ -3381,7 +3381,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
$arrayconvpictotomorcess = array(
'action'=>'infobox-action', 'account'=>'infobox-bank_account', 'accountline'=>'infobox-bank_account', 'accountancy'=>'infobox-bank_account',
'bank_account'=>'bg-infobox-bank_account',
- 'bill'=>'infobox-commande', 'billa'=>'infobox-commande', 'billd'=>'infobox-commande',
+ 'bill'=>'infobox-commande', 'billa'=>'infobox-commande', 'billr'=>'infobox-commande', 'billd'=>'infobox-commande',
'cash-register'=>'infobox-bank_account', 'contract'=>'infobox-contrat', 'check'=>'font-status4', 'conversation'=>'infobox-contrat',
'donation'=>'infobox-commande', 'dollyrevert'=>'flip', 'ecm'=>'infobox-action',
'hrm'=>'infobox-adherent', 'group'=>'infobox-adherent', 'intervention'=>'infobox-contrat',
diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php
index 74be7bcf762..d8d9aa7a4a3 100644
--- a/htdocs/fourn/class/fournisseur.facture.class.php
+++ b/htdocs/fourn/class/fournisseur.facture.class.php
@@ -2299,6 +2299,10 @@ class FactureFournisseur extends CommonInvoice
if ($this->type == self::TYPE_REPLACEMENT) $label = ''.$langs->transnoentitiesnoconv("InvoiceReplace").'';
elseif ($this->type == self::TYPE_CREDIT_NOTE) $label = ''.$langs->transnoentitiesnoconv("CreditNote").'';
elseif ($this->type == self::TYPE_DEPOSIT) $label = ''.$langs->transnoentitiesnoconv("Deposit").'';
+ if (isset($this->status)) {
+ $alreadypaid = -1;
+ $label .= ' '.$this->getLibStatut(5, $alreadypaid);
+ }
if (!empty($this->ref))
$label .= '
'.$langs->trans('Ref').': '.$this->ref;
if (!empty($this->ref_supplier))