diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a83ff1083e6..0618e15afe8 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2747,23 +2747,23 @@ class Form } if ($objp->quantity == 1) { - $opt.= price($objp->fprice, 1, $langs, 0, 0, -1, $conf->currency)."/"; - $outval.= price($objp->fprice, 0, $langs, 0, 0, -1, $conf->currency)."/"; + $opt.= price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/"; + $outval.= price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/"; $opt.= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding $outval.=$langs->transnoentities("Unit"); } else { - $opt.= price($objp->fprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; - $outval.= price($objp->fprice, 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; + $opt.= price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; + $outval.= price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; $opt.= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding $outval.= ' '.$langs->transnoentities("Units"); } if ($objp->quantity >= 1) { - $opt.=" (".price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding - $outval.=" (".price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding + $opt.=" (".price($objp->unitprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding + $outval.=" (".price($objp->unitprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding } if ($objp->remise_percent >= 1) { @@ -2854,7 +2854,7 @@ class Form $langs->load('stocks'); $sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration, pfp.fk_soc,"; - $sql.= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.unitprice,"; + $sql.= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.remise_percent, pfp.quantity, pfp.unitprice,"; $sql.= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; @@ -2914,7 +2914,7 @@ class Form } if ($objp->quantity == 1) { - $opt.= price($objp->fprice, 1, $langs, 0, 0, -1, $conf->currency)."/"; + $opt.= price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/"; } $opt.= $objp->quantity.' '; @@ -2930,7 +2930,7 @@ class Form if ($objp->quantity > 1) { $opt.=" - "; - $opt.= price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit"); + $opt.= price($objp->unitprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit"); } if ($objp->duration) $opt .= " - ".$objp->duration; $opt .= "\n"; diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index 1758480af8f..166e0ce2044 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -62,7 +62,9 @@ class FormAdmin public function select_language($selected = '', $htmlname = 'lang_id', $showauto = 0, $filter = null, $showempty = '', $showwarning = 0, $disabled = 0, $morecss = '', $showcode = 0, $forcecombo = 0) { // phpcs:enable - global $langs; + global $conf, $langs; + + if (!empty($conf->global->MAIN_DEFAULT_LANGUAGE_FILTER)) $filter[$conf->global->MAIN_DEFAULT_LANGUAGE_FILTER] = 1; $langs_available=$langs->get_available_languages(DOL_DOCUMENT_ROOT, 12); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 04f379b746f..1db6dc01ab4 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -5,7 +5,7 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Marcos García * Copyright (C) 2018 Ferran Marcet - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -65,6 +65,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $menu->add('#', '', 0, $showmode, $atarget, "xxx", '', 0, $id, $idsel, $classname); } + $menu_arr = array(); // Home $menu_arr[] = array( 'name' => 'Home', diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index d88166db424..0885f12af67 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -132,6 +132,8 @@ dol_fiche_end(); print ''; +$invoice_status_except_list = array(Facture::STATUS_DRAFT, Facture::STATUS_ABANDONED); + $sql = "SELECT"; $sql.= " s.rowid as socid, s.nom as name, s.code_client, s.client,"; $sql.= " u.rowid as agent, u.login, u.lastname, u.firstname,"; @@ -153,7 +155,7 @@ if (! empty($conf->global->AGENT_CONTACT_TYPE)) $sql.= " AND ((e.fk_socpeople IS NULL AND sc.fk_user = u.rowid) OR (e.fk_socpeople IS NOT NULL AND e.fk_socpeople = u.rowid))"; else $sql .= " AND sc.fk_user = u.rowid"; -$sql.= " AND f.fk_statut > 0"; +$sql.= " AND f.fk_statut NOT IN (" . implode(', ', $invoice_status_except_list) . ")"; $sql.= ' AND s.entity IN ('.getEntity('societe').')'; $sql.= " AND d.fk_facture = f.rowid"; if ($agentid > 0) { diff --git a/htdocs/margin/checkMargins.php b/htdocs/margin/checkMargins.php index 4203d591541..a3b932e565c 100644 --- a/htdocs/margin/checkMargins.php +++ b/htdocs/margin/checkMargins.php @@ -183,6 +183,7 @@ dol_fiche_end(); $arrayfields=array(); $massactionbutton=''; +$invoice_status_except_list = array(Facture::STATUS_DRAFT, Facture::STATUS_ABANDONED); $sql = "SELECT"; $sql .= " f.ref, f.rowid as invoiceid, d.rowid as invoicedetid, d.buy_price_ht, d.total_ht, d.subprice, d.label, d.description , d.qty"; @@ -190,7 +191,7 @@ $sql .= " ,d.fk_product"; $sql .= " FROM " . MAIN_DB_PREFIX . "facture as f "; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as d ON d.fk_facture = f.rowid"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON d.fk_product = p.rowid"; -$sql .= " WHERE f.fk_statut > 0"; +$sql .= " WHERE f.fk_statut NOT IN (" . implode(', ', $invoice_status_except_list) . ")"; $sql .= " AND f.entity IN (" . getEntity('invoice') . ") "; if (! empty($startdate)) $sql .= " AND f.datef >= '" . $db->idate($startdate) . "'"; if (! empty($enddate)) $sql .= " AND f.datef <= '" . $db->idate($enddate) . "'"; diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index 0e591bc6036..7a3777ecfb5 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -200,6 +200,8 @@ dol_fiche_end(); print ''; +$invoice_status_except_list = array(Facture::STATUS_DRAFT, Facture::STATUS_ABANDONED); + $sql = "SELECT"; $sql.= " s.rowid as socid, s.nom as name, s.code_client, s.client,"; if ($client) $sql.= " f.rowid as facid, f.ref, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,"; @@ -218,7 +220,7 @@ if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", ".MAIN_DB_PRE $sql.= " WHERE f.fk_soc = s.rowid"; if ($socid > 0) $sql.= ' AND s.rowid = '.$socid; if (!$user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; -$sql.= " AND f.fk_statut > 0"; +$sql.= " AND f.fk_statut NOT IN (" . implode(', ', $invoice_status_except_list) . ")"; $sql.= ' AND s.entity IN ('.getEntity('societe').')'; $sql.= " AND d.fk_facture = f.rowid"; $sql.= " AND (d.product_type = 0 OR d.product_type = 1)"; diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index 7d644931ffc..c390f9599c8 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -174,6 +174,8 @@ dol_fiche_end(); print ''; +$invoice_status_except_list = array(Facture::STATUS_DRAFT, Facture::STATUS_ABANDONED); + $sql = "SELECT p.label, p.rowid, p.fk_product_type, p.ref, p.entity as pentity,"; if ($id > 0) $sql.= " d.fk_product,"; if ($id > 0) $sql.= " f.rowid as facid, f.ref, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,"; @@ -190,7 +192,7 @@ if (! empty($TSelectedCats)) { } $sql.= " WHERE f.fk_soc = s.rowid"; $sql.= ' AND f.entity IN ('.getEntity('invoice').')'; -$sql.= " AND f.fk_statut > 0"; +$sql.= " AND f.fk_statut NOT IN (" . implode(', ', $invoice_status_except_list) . ")"; $sql.= " AND d.fk_facture = f.rowid"; if ($id > 0) $sql.= " AND d.fk_product =".$id; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 35f6f56c57c..1f58937d879 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -61,7 +61,7 @@ if (defined('THEME_ONLY_CONSTANT')) return; session_cache_limiter('public'); -require_once __DIR__.'/../../main.inc.php'; // __DIR__ allow this script to be included in custom themes +require_once '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined)