diff --git a/htdocs/commande/commande.class.php b/htdocs/commande/commande.class.php
index e9d2da60461..7b336d35692 100644
--- a/htdocs/commande/commande.class.php
+++ b/htdocs/commande/commande.class.php
@@ -643,7 +643,7 @@ class Commande
{
$sql = 'SELECT c.rowid, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.tva, c.fk_cond_reglement, c.fk_mode_reglement,';
$sql.= ' '.$this->db->pdate('c.date_commande').' as date_commande, '.$this->db->pdate('c.date_livraison').' as date_livraison,';
- $sql.= ' c.fk_projet, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture, c.note, c.note_public, c.ref_client, c.model_pdf, c.fk_adresse_livraison';
+ $sql.= ' c.fk_projet, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as facturee, c.note, c.note_public, c.ref_client, c.model_pdf, c.fk_adresse_livraison';
$sql.= ' FROM '.MAIN_DB_PREFIX.'commande as c';
$sql.= ' WHERE c.rowid = '.$id;
@@ -666,7 +666,7 @@ class Commande
$this->remise_percent = $obj->remise_percent;
$this->remise_absolue = $obj->remise_absolue;
$this->source = $obj->source;
- $this->facturee = $obj->facture;
+ $this->facturee = $obj->facturee;
$this->note = $obj->note;
$this->note_public = $obj->note_public;
$this->projet_id = $obj->fk_projet;
@@ -1723,7 +1723,7 @@ class Commande
*/
function getLibStatut($mode)
{
- return $this->LibStatut($this->statut,$this->facture,$mode);
+ return $this->LibStatut($this->statut,$this->facturee,$mode);
}
/**
diff --git a/htdocs/commande/liste.php b/htdocs/commande/liste.php
index c4b18f6ebc4..71b8f233c7f 100644
--- a/htdocs/commande/liste.php
+++ b/htdocs/commande/liste.php
@@ -50,6 +50,10 @@ if ($user->societe_id > 0)
}
+/*
+ * Affichage page
+ */
+
llxHeader();
$begin=$_GET['begin'];
@@ -62,7 +66,8 @@ if (! $sortorder) $sortorder='DESC';
$limit = $conf->liste_limit;
$offset = $limit * $_GET['page'] ;
-$sql = 'SELECT s.nom, s.idp, c.rowid, c.ref, c.total_ht,'.$db->pdate('c.date_commande').' as date_commande, c.fk_statut';
+$sql = 'SELECT s.nom, s.idp, c.rowid, c.ref, c.total_ht,';
+$sql.= ' '.$db->pdate('c.date_commande').' as date_commande, c.fk_statut, c.facture as facturee';
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user";
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'commande as c';
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@@ -95,7 +100,7 @@ if (isset($_GET['status']))
{
$sql .= " AND fk_statut = ".$_GET['status'];
}
-if (isset($_GET['afacturer']))
+if (isset($_GET['afacturer']) && $_GET['afacturer'] == 1)
{
$sql .= ' AND c.facture = 0';
}
@@ -178,7 +183,7 @@ if ($resql)
print strftime('%Y',$objp->date_commande).'';
if (($objp->fk_statut > 0) && ($objp->fk_statut < 3) && $objp->date_commande < (time() - $conf->commande->warning_delay)) print img_picto($langs->trans("Late"),"warning");
print '';
- print '
'.$generic_commande->LibStatut($objp->fk_statut,5).' | ';
+ print ''.$generic_commande->LibStatut($objp->fk_statut,$objp->facturee,5).' | ';
print '';
$total = $total + $objp->price;
$subtotal = $subtotal + $objp->price;
diff --git a/htdocs/compta/commande/fiche.php b/htdocs/compta/commande/fiche.php
index dd5e8ce48b3..73548222616 100644
--- a/htdocs/compta/commande/fiche.php
+++ b/htdocs/compta/commande/fiche.php
@@ -126,10 +126,22 @@ if ($_GET["id"] > 0)
// Société
print '| '.$langs->trans('Company').' | ';
- print '';
+ print ' | ';
print ''.$soc->nom.' | ';
print '
';
+ // Ligne info remises tiers
+ print '| '.$langs->trans('Info').' | ';
+ if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
+ else print $langs->trans("CompanyHasNoRelativeDiscount");
+ $aboslute_discount=$soc->getCurrentDiscount();
+ print '. ';
+ if ($aboslute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount);
+ else print $langs->trans("CompanyHasNoAbsoluteDiscount");
+ print '.';
+ print ' |
';
+
+ // Date
print '| '.$langs->trans('Date').' | ';
print ''.dolibarr_print_date($commande->date,'%A %d %B %Y').' | ';
print ''.$langs->trans('Source').' : ' . $commande->sources[$commande->source] ;
@@ -373,7 +385,9 @@ if ($_GET["id"] > 0)
* Lignes de remise
*/
- // Remise relative
+ // Réductions relatives (Remises-Ristournes-Rabbais)
+/* Une réduction doit s'appliquer obligatoirement sur des lignes de factures
+ et non globalement
$var=!$var;
print ' |
';
print '';
+*/
- // Remise absolue
+ // Réductions (Remises-Ristournes-Rabbais)
+/* Les remises absolues doivent s'appliquer par ajout de lignes spécialisées
$var=!$var;
print '';
-
+*/
print '';
diff --git a/htdocs/compta/commande/liste.php b/htdocs/compta/commande/liste.php
index d8325a0a0a7..d4f5e407286 100644
--- a/htdocs/compta/commande/liste.php
+++ b/htdocs/compta/commande/liste.php
@@ -77,7 +77,7 @@ if (isset($_GET["status"]))
{
$sql .= " AND fk_statut = ".$_GET["status"];
}
-if (isset($_GET["afacturer"]))
+if (isset($_GET["afacturer"]) && $_GET['afacturer'] == 1)
{
$sql .= " AND fk_statut >=1 AND c.facture = 0";
}
diff --git a/htdocs/includes/menus/barre_left/eldy_backoffice.php b/htdocs/includes/menus/barre_left/eldy_backoffice.php
index 6ff5951489e..4e9b8ea65ba 100644
--- a/htdocs/includes/menus/barre_left/eldy_backoffice.php
+++ b/htdocs/includes/menus/barre_left/eldy_backoffice.php
@@ -333,7 +333,7 @@ class MenuLeft {
if ($conf->commande->enabled )
{
$langs->load("orders");
- if ($conf->facture->enabled) $newmenu->add(DOL_URL_ROOT."/compta/commande/liste.php?leftmenu=orders&status=3", $langs->trans("MenuOrdersToBill"), 0, $user->rights->commande->lire);
+ if ($conf->facture->enabled) $newmenu->add(DOL_URL_ROOT."/compta/commande/liste.php?leftmenu=orders&status=3&afacturer=1", $langs->trans("MenuOrdersToBill"), 0, $user->rights->commande->lire);
// if ($leftmenu=="orders") $newmenu->add_submenu(DOL_URL_ROOT."/commande/", $langs->trans("StatusOrderToBill"), 1 ,$user->rights->commande->lire);
}
diff --git a/htdocs/lib/order.lib.php b/htdocs/lib/order.lib.php
index e6e677f58fe..acfcc86fbd6 100644
--- a/htdocs/lib/order.lib.php
+++ b/htdocs/lib/order.lib.php
@@ -53,7 +53,8 @@ function commande_prepare_head($commande)
$h++;
}
- if ($conf->compta->enabled || $conf->comptaexpert->enabled)
+ // Commande à facturer
+ if ($conf->facture->enabled)
{
$head[$h][0] = DOL_URL_ROOT.'/compta/commande/fiche.php?id='.$commande->id;
$head[$h][1] = $langs->trans("ComptaCard");