From 01a3787664d31b04b901488172d56f872847f81b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 31 Oct 2017 13:45:13 +0100 Subject: [PATCH 01/26] swap llxfooter() and $db->close() --- htdocs/compta/facture/document.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index e4f9846309a..9159c13070c 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -4,6 +4,7 @@ * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2017 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 @@ -164,6 +165,6 @@ else print $langs->trans("ErrorUnknown"); } -$db->close(); - llxFooter(); + +$db->close(); From 7f28c9fff6119b72e52fcd365ccd69aad7a1bd0c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 17 Nov 2017 13:56:41 +0100 Subject: [PATCH 02/26] FIX #7824 Conflicts: htdocs/product/stock/replenishorders.php --- htdocs/product/stock/replenishorders.php | 73 ++++++++++++++++-------- 1 file changed, 48 insertions(+), 25 deletions(-) diff --git a/htdocs/product/stock/replenishorders.php b/htdocs/product/stock/replenishorders.php index 5b1fda0371f..37d7bfd19f6 100644 --- a/htdocs/product/stock/replenishorders.php +++ b/htdocs/product/stock/replenishorders.php @@ -29,7 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; -require_once './lib/replenishment.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/product/stock/lib/replenishment.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $langs->load("products"); $langs->load("stocks"); @@ -44,9 +45,13 @@ $sref = GETPOST('search_ref', 'alpha'); $snom = GETPOST('search_nom', 'alpha'); $suser = GETPOST('search_user', 'alpha'); $sttc = GETPOST('search_ttc', 'alpha'); -$sdate = GETPOST('search_date', 'alpha'); $page = GETPOST('page', 'int'); $sproduct = GETPOST('sproduct', 'int'); +$search_dateyear = GETPOST('search_dateyear', 'int'); +$search_datemonth = GETPOST('search_datemonth', 'int'); +$search_dateday = GETPOST('search_dateday', 'int'); +$search_date = dol_mktime(0, 0, 0, $search_datemonth, $search_dateday, $search_dateyear); +if (GETPOST('search_date', 'alpha')) $search_date = dol_stringtotime(GETPOST('search_date', 'alpha')); // For backward compatibility $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield"); @@ -70,7 +75,10 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $snom=""; $suser=""; $sttc=""; - $sdate=''; + $search_date=''; + $search_datemonth=''; + $search_dateday=''; + $search_dateyear=''; $sproduct=0; } @@ -125,17 +133,19 @@ if ($sref) $sql .= natural_search('cf.ref', $sref); if ($snom) $sql .= natural_search('s.nom', $snom); if ($suser) $sql .= natural_search('u.login', $suser); if ($sttc) $sql .= natural_search('cf.total_ttc', $sttc, 1); -if ($sdate) + +if ($search_datemonth > 0) { - if (GETPOST('search_datemonth', 'int') && GETPOST('search_dateday', 'int') && GETPOST('search_dateyear', 'int')) - { - $date = dol_mktime(0, 0, 0, GETPOST('search_datemonth', 'int'), GETPOST('search_dateday', 'int'), GETPOST('search_dateyear', 'int')); - } - else - { - $date = dol_stringtotime($sdate); - } - $sql .= " AND cf.date_creation = '" . $db->idate($date) . "'"; + if ($search_dateyear > 0 && empty($search_dateday)) + $sql.= " AND cf.date_creation BETWEEN '".$db->idate(dol_get_first_day($search_dateyear,$search_datemonth,false))."' AND '".$db->idate(dol_get_last_day($search_dateyear,$search_datemonth,false))."'"; + else if ($search_dateyear > 0 && ! empty($search_dateday)) + $sql.= " AND cf.date_creation BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_datemonth, $search_dateday, $search_dateyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_datemonth, $search_dateday, $search_dateyear))."'"; + else + $sql.= " AND date_format(cf.date_creation, '%m') = '".$search_datemonth."'"; +} +else if ($search_dateyear > 0) +{ + $sql.= " AND cf.date_creation BETWEEN '".$db->idate(dol_get_first_day($search_dateyear,1,false))."' AND '".$db->idate(dol_get_last_day($search_dateyear,12,false))."'"; } if ($sall) $sql .= natural_search(array('cf.ref','cf.note'), $sall); if (!empty($socid)) $sql .= ' AND s.rowid = ' . $socid; @@ -146,7 +156,6 @@ $sql .= ' GROUP BY cf.rowid, cf.ref, cf.date_creation, cf.fk_statut'; $sql .= ', cf.total_ttc, cf.fk_user_author, u.login, s.rowid, s.nom'; $sql .= $db->order($sortfield, $sortorder); $sql .= $db->plimit($limit+1, $offset); -//print $sql; $resql = $db->query($sql); if ($resql) @@ -158,6 +167,19 @@ if ($resql) print_barre_liste('', $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', $num, 0, ''); + $param=''; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); + if ($sref) $param.='&search_ref='.urlencode($sref); + if ($snom) $param.='&search_nom='.urlencode($snom); + if ($suser) $param.='&search_user='.urlencode($suser); + if ($sttc) $param.='&search_ttc='.urlencode($sttc); + if ($search_dateyear) $param.='&search_dateyear='.urlencode($search_dateyear); + if ($search_datemonth) $param.='&search_datemonth='.urlencode($search_datemonth); + if ($search_dateday) $param.='&search_dateday='.urlencode($search_dateday); + if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); + + print '
'; print ''. @@ -167,7 +189,7 @@ if ($resql) $_SERVER['PHP_SELF'], 'cf.ref', '', - '', + $param, '', $sortfield, $sortorder @@ -177,7 +199,7 @@ if ($resql) $_SERVER['PHP_SELF'], 's.nom', '', - '', + $param, '', $sortfield, $sortorder @@ -187,7 +209,7 @@ if ($resql) $_SERVER['PHP_SELF'], 'u.login', '', - '', + $param, '', $sortfield, $sortorder @@ -197,7 +219,7 @@ if ($resql) $_SERVER['PHP_SELF'], 'cf.total_ttc', '', - '', + $param, '', $sortfield, $sortorder @@ -207,7 +229,7 @@ if ($resql) $_SERVER['PHP_SELF'], 'cf.date_creation', '', - '', + $param, '', $sortfield, $sortorder @@ -217,7 +239,7 @@ if ($resql) $_SERVER['PHP_SELF'], 'cf.fk_statut', '', - '', + $param, 'align="right"', $sortfield, $sortorder @@ -226,19 +248,19 @@ if ($resql) ''. ''. ''. ''. ''. ''. ''; $var = true; + $userstatic = new User($db); while ($i < min($num,$conf->liste_limit)) From fde33594a2c0b87e756cbcc34ce1d02ea2265f53 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 17 Nov 2017 14:06:08 +0100 Subject: [PATCH 03/26] FIX #7824 --- htdocs/product/stock/replenishorders.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/product/stock/replenishorders.php b/htdocs/product/stock/replenishorders.php index 37d7bfd19f6..59a1a28ccf5 100644 --- a/htdocs/product/stock/replenishorders.php +++ b/htdocs/product/stock/replenishorders.php @@ -51,7 +51,6 @@ $search_dateyear = GETPOST('search_dateyear', 'int'); $search_datemonth = GETPOST('search_datemonth', 'int'); $search_dateday = GETPOST('search_dateday', 'int'); $search_date = dol_mktime(0, 0, 0, $search_datemonth, $search_dateday, $search_dateyear); -if (GETPOST('search_date', 'alpha')) $search_date = dol_stringtotime(GETPOST('search_date', 'alpha')); // For backward compatibility $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield"); @@ -63,7 +62,6 @@ if ($page < 0) $page = 0; $offset = $limit * $page; - /* * Actions */ @@ -244,6 +242,7 @@ if ($resql) $sortfield, $sortorder ); + print ''. ''. From 42b7d805675ad3ea3e34664c55b93d4b11be057f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 17 Nov 2017 14:06:08 +0100 Subject: [PATCH 04/26] FIX #7824 Conflicts: htdocs/product/stock/replenishorders.php --- htdocs/product/stock/replenishorders.php | 91 +++++++++++++++++++----- 1 file changed, 73 insertions(+), 18 deletions(-) diff --git a/htdocs/product/stock/replenishorders.php b/htdocs/product/stock/replenishorders.php index 785760ef511..c4a57d0475c 100644 --- a/htdocs/product/stock/replenishorders.php +++ b/htdocs/product/stock/replenishorders.php @@ -29,7 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; -require_once './lib/replenishment.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/product/stock/lib/replenishment.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $langs->load("products"); $langs->load("stocks"); @@ -39,6 +40,46 @@ $langs->load("orders"); if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'produit|service'); +$sall = GETPOST('search_all', 'alphanohtml'); +$sref = GETPOST('search_ref', 'alpha'); +$snom = GETPOST('search_nom', 'alpha'); +$suser = GETPOST('search_user', 'alpha'); +$sttc = GETPOST('search_ttc', 'alpha'); +$page = GETPOST('page', 'int'); +$sproduct = GETPOST('sproduct', 'int'); +$search_dateyear = GETPOST('search_dateyear', 'int'); +$search_datemonth = GETPOST('search_datemonth', 'int'); +$search_dateday = GETPOST('search_dateday', 'int'); +$search_date = dol_mktime(0, 0, 0, $search_datemonth, $search_dateday, $search_dateyear); + +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; +$sortfield = GETPOST("sortfield"); +$sortorder = GETPOST("sortorder"); +if (!$sortorder) $sortorder = 'DESC'; +if (!$sortfield) $sortfield = 'cf.date_creation'; +$page = GETPOST("page"); +if ($page < 0) $page = 0; +$offset = $limit * $page; + + +/* + * Actions + */ + +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + $sall=""; + $sref=""; + $snom=""; + $suser=""; + $sttc=""; + $search_date=''; + $search_datemonth=''; + $search_dateday=''; + $search_dateyear=''; + $sproduct=0; +} + /* @@ -120,17 +161,18 @@ if ($suser) { if ($sttc) { $sql .= ' AND cf.total_ttc = ' . price2num($sttc); } -if ($sdate) +if ($search_datemonth > 0) { - if (GETPOST('search_datemonth', 'int') && GETPOST('search_dateday', 'int') && GETPOST('search_dateyear', 'int')) - { - $date = dol_mktime(0, 0, 0, GETPOST('search_datemonth', 'int'), GETPOST('search_dateday', 'int'), GETPOST('search_dateyear', 'int')); - } - else - { - $date = dol_stringtotime($sdate); - } - $sql .= " AND cf.date_creation = '" . $db->idate($date) . "'"; + if ($search_dateyear > 0 && empty($search_dateday)) + $sql.= " AND cf.date_creation BETWEEN '".$db->idate(dol_get_first_day($search_dateyear,$search_datemonth,false))."' AND '".$db->idate(dol_get_last_day($search_dateyear,$search_datemonth,false))."'"; + else if ($search_dateyear > 0 && ! empty($search_dateday)) + $sql.= " AND cf.date_creation BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_datemonth, $search_dateday, $search_dateyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_datemonth, $search_dateday, $search_dateyear))."'"; + else + $sql.= " AND date_format(cf.date_creation, '%m') = '".$search_datemonth."'"; +} +else if ($search_dateyear > 0) +{ + $sql.= " AND cf.date_creation BETWEEN '".$db->idate(dol_get_first_day($search_dateyear,1,false))."' AND '".$db->idate(dol_get_last_day($search_dateyear,12,false))."'"; } if ($sall) { $sql .= ' AND (cf.ref LIKE "%' . $db->escape($sall) . '%" '; @@ -159,6 +201,18 @@ if ($resql) print_barre_liste('', $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', $num, 0, ''); + $param=''; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); + if ($sref) $param.='&search_ref='.urlencode($sref); + if ($snom) $param.='&search_nom='.urlencode($snom); + if ($suser) $param.='&search_user='.urlencode($suser); + if ($sttc) $param.='&search_ttc='.urlencode($sttc); + if ($search_dateyear) $param.='&search_dateyear='.urlencode($search_dateyear); + if ($search_datemonth) $param.='&search_datemonth='.urlencode($search_datemonth); + if ($search_dateday) $param.='&search_dateday='.urlencode($search_dateday); + if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); + print ''; print '
'. - ''. + ''. ''. - ''. + ''. ''. - ''. + ''. ''. - ''. + ''. ''. - $form->select_date('', 'search_date', 0, 0, 1, '', 1, 0, 1, 0, ''). + $form->select_date($search_date, 'search_date', 0, 0, 1, '', 1, 0, 1, 0, ''). ''; $searchpitco=$form->showFilterAndCheckAddButtons(0); @@ -247,6 +269,7 @@ if ($resql) '
'. @@ -168,7 +222,7 @@ if ($resql) $_SERVER['PHP_SELF'], 'cf.ref', '', - '', + $param, '', $sortfield, $sortorder @@ -178,7 +232,7 @@ if ($resql) $_SERVER['PHP_SELF'], 's.nom', '', - '', + $param, '', $sortfield, $sortorder @@ -188,7 +242,7 @@ if ($resql) $_SERVER['PHP_SELF'], 'u.login', '', - '', + $param, '', $sortfield, $sortorder @@ -198,7 +252,7 @@ if ($resql) $_SERVER['PHP_SELF'], 'cf.total_ttc', '', - '', + $param, '', $sortfield, $sortorder @@ -208,7 +262,7 @@ if ($resql) $_SERVER['PHP_SELF'], 'cf.date_creation', '', - '', + $param, '', $sortfield, $sortorder @@ -218,11 +272,12 @@ if ($resql) $_SERVER['PHP_SELF'], 'cf.fk_statut', '', - '', + $param, 'align="right"', $sortfield, $sortorder ); + print ''. ''. @@ -239,7 +294,7 @@ if ($resql) ''. ''. ''. ''; */ - + $tmparray=$object->getTotalWeightVolume(); $totalWeight=$tmparray['weight']; $totalVolume=$tmparray['volume']; @@ -2365,18 +2385,18 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; print ''; print ''; - + // Multicurrency Amount VAT print ''; print ''; print ''; - + // Multicurrency Amount TTC print ''; print ''; print ''; } - + // Total HT print ''; print ''; @@ -2471,7 +2491,7 @@ if ($action == 'create' && $user->rights->commande->creer) } print '
'. - $form->select_date('', 'search_date', 0, 0, 1, '', 1, 0, 1, 0, ''). + $form->select_date($search_date, 'search_date', 0, 0, 1, '', 1, 0, 1, 0, ''). ''; $src = DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png'; From a9bfe0f48f2502ad3ee0c22a998c8b87292eec31 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 9 Sep 2017 17:48:04 +0200 Subject: [PATCH 05/26] Fix: some problems with medias in multicompany (backport 6.0 commit 762b4eb8768a0b09d69c06529566954f7efbc1c0) --- htdocs/core/class/conf.class.php | 5 +++++ htdocs/core/lib/files.lib.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 203d41571a9..da55a9f5668 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -88,6 +88,7 @@ class Conf $this->user = new stdClass(); $this->syslog = new stdClass(); $this->browser = new stdClass(); + $this->medias = new stdClass(); $this->multicompany = new stdClass(); //! Charset for HTML output and for storing data in memory @@ -328,6 +329,10 @@ class Conf $this->propal->dir_output=$rootfordata."/propale"; $this->propal->dir_temp=$rootfordata."/propale/temp"; + // For medias storage + $this->medias->multidir_output = array($this->entity => $rootfordata."/medias"); + $this->medias->multidir_temp = array($this->entity => $rootfordata."/medias/temp"); + // Exception: Some dir are not the name of module. So we keep exception here // for backward compatibility. diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 5d3c209bdc7..b573a9588ae 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1857,7 +1857,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu elseif ($modulepart == 'medias' && !empty($dolibarr_main_data_root)) { $accessallowed=1; - $original_file=$dolibarr_main_data_root.'/medias/'.$original_file; + $original_file=$conf->medias->multidir_output[$entity].'/'.$original_file; } // Wrapping for backups From 219e58d0e4e1294e952b89a86bbbb1ec766b30bd Mon Sep 17 00:00:00 2001 From: atm-ph Date: Wed, 22 Nov 2017 12:15:02 +0100 Subject: [PATCH 06/26] Fix product type is ignored and can generate a diffrent result with situation invoice --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 60970b5b1e2..3c60e0b6679 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2710,7 +2710,7 @@ class Facture extends CommonInvoice $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. } - $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, $situation_percent, $this->multicurrency_tx, $pu_ht_devise); + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $type, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, $situation_percent, $this->multicurrency_tx, $pu_ht_devise); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; From 5fef6478a50ae7087214f12b03b274682ae1478a Mon Sep 17 00:00:00 2001 From: atm-ph Date: Mon, 27 Nov 2017 11:26:41 +0100 Subject: [PATCH 07/26] Fix wrong calcul_price_total() update --- htdocs/compta/facture/class/facture.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 3c60e0b6679..d1ede7cb41d 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2710,7 +2710,7 @@ class Facture extends CommonInvoice $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. } - $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $type, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, $situation_percent, $this->multicurrency_tx, $pu_ht_devise); + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, $situation_percent, $this->multicurrency_tx, $pu_ht_devise); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; @@ -2878,7 +2878,7 @@ class Facture extends CommonInvoice // Cap percentages to 100 if ($percent > 100) $percent = 100; $line->situation_percent = $percent; - $tabprice = calcul_price_total($line->qty, $line->subprice, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->product_type, 'HT', 0, 0, $mysoc, '', $percent); + $tabprice = calcul_price_total($line->qty, $line->subprice, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 0, 'HT', 0, $line->product_type, $mysoc, '', $percent); $line->total_ht = $tabprice[0]; $line->total_tva = $tabprice[1]; $line->total_ttc = $tabprice[2]; From f04af6c1b3a4e4b5014cd69ed72a7358b3d1f521 Mon Sep 17 00:00:00 2001 From: gauthier Date: Wed, 29 Nov 2017 11:06:33 +0100 Subject: [PATCH 08/26] FIX : test for filter fk_status --- htdocs/compta/facture/stats/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index 4d9fdebeb64..6670ed763e1 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -84,7 +84,7 @@ dol_mkdir($dir); $stats = new FactureStats($db, $socid, $mode, ($userid>0?$userid:0)); if ($mode == 'customer') { - if ($object_status != '' && $object_status >= -1) $stats->where .= ' AND f.fk_statut IN ('.$object_status.')'; + if ($object_status != '' && $object_status >= 0) $stats->where .= ' AND f.fk_statut IN ('.$object_status.')'; } if ($mode == 'supplier') { From b7f26ea788c49724069d0c244f9ec91224aed1d7 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 30 Nov 2017 11:10:01 +0100 Subject: [PATCH 09/26] FIX add line bad price and ref --- htdocs/fourn/commande/card.php | 2 +- htdocs/product/class/product.class.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 05bbc26e5fc..3af489e1ca5 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -390,7 +390,7 @@ if (empty($reshook)) $localtax1_tx, $localtax2_tx, $idprod, - $productsupplier->id, + $productsupplier->product_fourn_price_id , $productsupplier->fourn_ref, $remise_percent, 'HT', diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 2e2f3007540..07aaf32cbb3 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1384,6 +1384,7 @@ class Product extends CommonObject $this->fourn_pu = $obj->price / $obj->quantity; // Unit price of product of supplier $this->fourn_price_base_type = 'HT'; // Price base type $this->ref_fourn = $obj->ref_fourn; // deprecated + $this->product_fourn_price_id = $obj->rowid; // supplier price id $this->ref_supplier = $obj->ref_fourn; // Ref supplier $this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier $result=$obj->fk_product; @@ -1428,6 +1429,7 @@ class Product extends CommonObject $this->fourn_qty = $obj->quantity; // min quantity for price for a virtual supplier $this->fourn_pu = $obj->price / $obj->quantity; // Unit price of product for a virtual supplier $this->fourn_price_base_type = 'HT'; // Price base type for a virtual supplier + $this->product_fourn_price_id = $obj->rowid; // supplier price id $this->ref_fourn = $obj->ref_supplier; // deprecated $this->ref_supplier = $obj->ref_supplier; // Ref supplier $this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier From b2effa7cc8c93b0495a6209a31bb9b967459fa49 Mon Sep 17 00:00:00 2001 From: Alexis ALGOUD Date: Thu, 30 Nov 2017 11:36:35 +0100 Subject: [PATCH 10/26] fix travis --- htdocs/fourn/commande/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 3af489e1ca5..c241b2a2ffa 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -390,7 +390,7 @@ if (empty($reshook)) $localtax1_tx, $localtax2_tx, $idprod, - $productsupplier->product_fourn_price_id , + $productsupplier->product_fourn_price_id, $productsupplier->fourn_ref, $remise_percent, 'HT', From c90ece118818aeae07004be094dced378bcd248b Mon Sep 17 00:00:00 2001 From: atm-ph Date: Wed, 6 Dec 2017 14:22:37 +0100 Subject: [PATCH 11/26] Fix include class WorkboardResponse --- htdocs/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/index.php b/htdocs/index.php index ee3c2490aeb..2df4365e227 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -383,7 +383,7 @@ if ($showweather) $boxwork.='agenda->enabled) && $user->rights->agenda->myactions->read) From 1bdffa961ffb110b28a3261e6df35b574ee63023 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 8 Dec 2017 10:41:14 +0100 Subject: [PATCH 12/26] Fix: wrong translation if multilang activated --- htdocs/comm/propal/card.php | 45 ++++++++++++++++++++--------- htdocs/commande/card.php | 56 +++++++++++++++++++++++++------------ htdocs/compta/facture.php | 32 +++++++++++++++++---- 3 files changed, 96 insertions(+), 37 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index e0f6b796826..a43fb982ee6 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -494,7 +494,7 @@ if (empty($reshook)) $tva_tx = $lines[$i]->tva_tx; if (! empty($lines[$i]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$i]->vat_src_code.')'; - + $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $date_start, $date_end, $array_options, $lines[$i]->fk_unit); if ($result > 0) { @@ -735,7 +735,7 @@ if (empty($reshook)) $db->begin(); // $tva_tx can be 'x.x (XXX)' - + // Ecrase $pu par celui du produit // Ecrase $desc par celui du produit // Ecrase $tva_tx par celui du produit @@ -750,7 +750,7 @@ if (empty($reshook)) $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id); if (empty($tva_tx)) $tva_npr=0; - + $pu_ht = $prod->price; $pu_ttc = $prod->price_ttc; $price_min = $prod->price_min; @@ -791,7 +791,7 @@ if (empty($reshook)) $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx)); $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); - + // if price ht is forced (ie: calculated by margin rate and cost price). TODO Why this ? if (! empty($price_ht)) { $pu_ht = price2num($price_ht, 'MU'); @@ -844,13 +844,32 @@ if (empty($reshook)) // Add custom code and origin country into description if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) { - $tmptxt = '('; - if (! empty($prod->customcode)) - $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; - if (! empty($prod->customcode) && ! empty($prod->country_code)) - $tmptxt .= ' - '; - if (! empty($prod->country_code)) - $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0); + // Define output language + if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { + $outputlangs = $langs; + $newlang = ''; + if (empty($newlang) && GETPOST('lang_id','alpha')) + $newlang = GETPOST('lang_id','alpha'); + if (empty($newlang)) + $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + if (! empty($prod->customcode)) + $tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; + if (! empty($prod->customcode) && ! empty($prod->country_code)) + $tmptxt .= ' - '; + if (! empty($prod->country_code)) + $tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $outputlangs, 0); + } else { + if (! empty($prod->customcode)) + $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; + if (! empty($prod->customcode) && ! empty($prod->country_code)) + $tmptxt .= ' - '; + if (! empty($prod->country_code)) + $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0); + } $tmptxt .= ')'; $desc = dol_concatdesc($desc, $tmptxt); } @@ -969,7 +988,7 @@ if (empty($reshook)) // Add buying price $fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : ''); $buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value - + $pu_ht_devise = GETPOST('multicurrency_subprice'); $date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); @@ -1305,7 +1324,7 @@ if ($action == 'create') // Replicate extrafields $objectsrc->fetch_optionals($originid); $object->array_options = $objectsrc->array_options; - + if (!empty($conf->multicurrency->enabled)) { if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 67978ff99e8..cf3d5efde3d 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -49,7 +49,7 @@ if (! empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; } - + require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; $langs->load('orders'); @@ -112,7 +112,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e if (empty($reshook)) { - if ($cancel) + if ($cancel) { if ($action != 'addlink' && $action != 'updateline') { @@ -126,7 +126,7 @@ if (empty($reshook)) } $action=''; } - + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once @@ -375,7 +375,7 @@ if (empty($reshook)) $tva_tx = $lines[$i]->tva_tx; if (! empty($lines[$i]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$i]->vat_src_code.')'; - + $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $date_start, $date_end, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->fk_unit, $object->origin, $lines[$i]->rowid); if ($result < 0) { @@ -760,7 +760,7 @@ if (empty($reshook)) $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx)); $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); - + // if price ht is forced (ie: calculated by margin rate and cost price). TODO Why this ? if (! empty($price_ht)) { $pu_ht = price2num($price_ht, 'MU'); @@ -782,8 +782,8 @@ if (empty($reshook)) if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { $outputlangs = $langs; $newlang = ''; - if (empty($newlang) && GETPOST('lang_id')) - $newlang = GETPOST('lang_id'); + if (empty($newlang) && GETPOST('lang_id','alpha')) + $newlang = GETPOST('lang_id','alpha'); if (empty($newlang)) $newlang = $object->thirdparty->default_lang; if (! empty($newlang)) { @@ -801,12 +801,32 @@ if (empty($reshook)) // Add custom code and origin country into description if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) { $tmptxt = '('; - if (! empty($prod->customcode)) - $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; - if (! empty($prod->customcode) && ! empty($prod->country_code)) - $tmptxt .= ' - '; - if (! empty($prod->country_code)) - $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0); + // Define output language + if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { + $outputlangs = $langs; + $newlang = ''; + if (empty($newlang) && GETPOST('lang_id','alpha')) + $newlang = GETPOST('lang_id','alpha'); + if (empty($newlang)) + $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + if (! empty($prod->customcode)) + $tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; + if (! empty($prod->customcode) && ! empty($prod->country_code)) + $tmptxt .= ' - '; + if (! empty($prod->country_code)) + $tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $outputlangs, 0); + } else { + if (! empty($prod->customcode)) + $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; + if (! empty($prod->customcode) && ! empty($prod->country_code)) + $tmptxt .= ' - '; + if (! empty($prod->country_code)) + $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0); + } $tmptxt .= ')'; $desc = dol_concatdesc($desc, $tmptxt); } @@ -2285,7 +2305,7 @@ if ($action == 'create' && $user->rights->commande->creer) } print '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . $langs->trans('AmountHT') . '' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . '
'; print ''; - + print "
\n"; dol_fiche_end(); diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index ad5f69edfc0..7290881bd6e 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1504,12 +1504,32 @@ if (empty($reshook)) // Add custom code and origin country into description if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) { $tmptxt = '('; - if (! empty($prod->customcode)) - $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; - if (! empty($prod->customcode) && ! empty($prod->country_code)) - $tmptxt .= ' - '; - if (! empty($prod->country_code)) - $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0); + // Define output language + if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { + $outputlangs = $langs; + $newlang = ''; + if (empty($newlang) && GETPOST('lang_id','alpha')) + $newlang = GETPOST('lang_id','alpha'); + if (empty($newlang)) + $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + if (! empty($prod->customcode)) + $tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; + if (! empty($prod->customcode) && ! empty($prod->country_code)) + $tmptxt .= ' - '; + if (! empty($prod->country_code)) + $tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $outputlangs, 0); + } else { + if (! empty($prod->customcode)) + $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; + if (! empty($prod->customcode) && ! empty($prod->country_code)) + $tmptxt .= ' - '; + if (! empty($prod->country_code)) + $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0); + } $tmptxt .= ')'; $desc = dol_concatdesc($desc, $tmptxt); } From 1b16eb731d88ed8f2af3ee44955fa4874b7c86e5 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 8 Dec 2017 11:00:23 +0100 Subject: [PATCH 13/26] Fix: missing load product translation file --- htdocs/comm/propal/card.php | 1 + htdocs/commande/card.php | 1 + htdocs/compta/facture.php | 1 + 3 files changed, 3 insertions(+) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index a43fb982ee6..e0a4c19c9cb 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -855,6 +855,7 @@ if (empty($reshook)) if (! empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); + $outputlangs->load('products'); } if (! empty($prod->customcode)) $tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index cf3d5efde3d..d84495da26a 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -812,6 +812,7 @@ if (empty($reshook)) if (! empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); + $outputlangs->load('products'); } if (! empty($prod->customcode)) $tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 7290881bd6e..b5b200aa540 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1515,6 +1515,7 @@ if (empty($reshook)) if (! empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); + $outputlangs->load('products'); } if (! empty($prod->customcode)) $tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; From 3db4d10fc084f6399d5ab2d0021ac206411035ab Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 10 Dec 2017 08:12:49 +0100 Subject: [PATCH 14/26] Fix event late alert on third event list #7912 --- htdocs/core/lib/company.lib.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 96d43ee4e5f..3839c867df4 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1275,10 +1275,10 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= else $out.='-'.dol_print_date($histo[$key]['dateend'],'dayhour'); } $late=0; - if ($histo[$key]['percent'] == 0 && $histo[$key]['datestart'] && $db->jdate($histo[$key]['datestart']) < ($now - $delay_warning)) $late=1; - if ($histo[$key]['percent'] == 0 && ! $histo[$key]['datestart'] && $histo[$key]['dateend'] && $db->jdate($histo[$key]['datestart']) < ($now - $delay_warning)) $late=1; - if ($histo[$key]['percent'] > 0 && $histo[$key]['percent'] < 100 && $histo[$key]['dateend'] && $db->jdate($histo[$key]['dateend']) < ($now - $delay_warning)) $late=1; - if ($histo[$key]['percent'] > 0 && $histo[$key]['percent'] < 100 && ! $histo[$key]['dateend'] && $histo[$key]['datestart'] && $db->jdate($histo[$key]['datestart']) < ($now - $delay_warning)) $late=1; + if ($histo[$key]['percent'] == 0 && $histo[$key]['datestart'] && $histo[$key]['datestart'] < ($now - $delay_warning)) $late=1; + if ($histo[$key]['percent'] == 0 && ! $histo[$key]['datestart'] && $histo[$key]['dateend'] && $histo[$key]['datestart'] < ($now - $delay_warning)) $late=1; + if ($histo[$key]['percent'] > 0 && $histo[$key]['percent'] < 100 && $histo[$key]['dateend'] && $histo[$key]['dateend'] < ($now - $delay_warning)) $late=1; + if ($histo[$key]['percent'] > 0 && $histo[$key]['percent'] < 100 && ! $histo[$key]['dateend'] && $histo[$key]['datestart'] && $histo[$key]['datestart'] < ($now - $delay_warning)) $late=1; if ($late) $out.=img_warning($langs->trans("Late")).' '; $out.="\n"; From e4725f424889328034d2eed7b642b23ae15da7f2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 10 Dec 2017 20:55:51 +0100 Subject: [PATCH 15/26] FIX #7933 --- htdocs/societe/list.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index f3ef24d12d2..5a93495d230 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -489,7 +489,7 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); -} +} // Show delete result message if (GETPOST('delsoc')) @@ -599,9 +599,9 @@ if (! empty($arrayfields['s.fk_stcomm']['checked'])) print_liste_field_titr // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key => $val) + foreach($extrafields->attribute_label as $key => $val) { - if (! empty($arrayfields["ef.".$key]['checked'])) + if (! empty($arrayfields["ef.".$key]['checked'])) { $align=$extrafields->getAlignFlag($key); print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); @@ -797,9 +797,9 @@ if (! empty($arrayfields['s.fk_stcomm']['checked'])) // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key => $val) + foreach($extrafields->attribute_label as $key => $val) { - if (! empty($arrayfields["ef.".$key]['checked'])) + if (! empty($arrayfields["ef.".$key]['checked'])) { $align=$extrafields->getAlignFlag($key); $typeofextrafield=$extrafields->attribute_type[$key]; @@ -854,7 +854,7 @@ while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); $var=!$var; - + $companystatic->id=$obj->rowid; $companystatic->name=$obj->name; $companystatic->canvas=$obj->canvas; @@ -865,7 +865,7 @@ while ($i < min($num, $limit)) $companystatic->code_fournisseur=$obj->code_fournisseur; $companystatic->fk_prospectlevel=$obj->fk_prospectlevel; $companystatic->name_alias=$obj->name_alias; - + print ""; if (! empty($arrayfields['s.nom']['checked'])) { @@ -907,12 +907,12 @@ while ($i < min($num, $limit)) if (! empty($arrayfields['s.zip']['checked'])) { print "".$obj->zip."\n"; - } + } // State if (! empty($arrayfields['state.nom']['checked'])) { print "".$obj->state_name."\n"; - } + } // Country if (! empty($arrayfields['country.code_iso']['checked'])) { @@ -925,7 +925,7 @@ while ($i < min($num, $limit)) if (! empty($arrayfields['typent.code']['checked'])) { print ''; - if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1); + if (! is_array($typenArray) || count($typenArray)==0) $typenArray = $formcompany->typent_array(1); print $typenArray[$obj->typent_code]; print ''; } From ab558ee5fae5fbbaa92452160e80d8664e83453a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 14 Dec 2017 09:49:55 +0100 Subject: [PATCH 16/26] Update product.php --- htdocs/product/admin/product.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index 2757234251d..69355a7f1e8 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -56,7 +56,6 @@ $select_pricing_rules=array( ); if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { - $langs->load("admin"); $select_pricing_rules['PRODUIT_CUSTOMER_PRICES_BY_QTY'] = $langs->trans('PriceByQuantity').' ('.$langs->trans("VersionExperimental").')'; // TODO If this is enabled, price must be hidden when price by qty is enabled, also price for quantity must be used when adding product into order/propal/invoice $select_pricing_rules['PRODUIT_CUSTOMER_PRICES_BY_QTY&PRODUIT_MULTIPRICES'] = $langs->trans('MultiPricesAbility') . '+' . $langs->trans('PriceByQuantity').' ('.$langs->trans("VersionExperimental").')'; } From 7e8fda2d71ef31181c104c9eec81f1001cdb7511 Mon Sep 17 00:00:00 2001 From: sschwebel Date: Fri, 5 Jan 2018 12:09:45 +0100 Subject: [PATCH 17/26] FIX #8029 Unable to make leave request in holyday module wrong variable name in card.php --- htdocs/holiday/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 8e8ab6f287c..0a4d0cb37ca 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -149,7 +149,7 @@ if ($action == 'create') if (! $error) { - $object->fk_user = $userid; + $object->fk_user = $fuserid; $object->description = $description; $object->date_debut = $date_debut; $object->date_fin = $date_fin; From 8000777864bf54eb4a7b8023ec8949d8175d4543 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Jan 2018 20:43:56 +0100 Subject: [PATCH 18/26] Code comment --- htdocs/compta/paiement/class/paiement.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 4fa9c5b9575..a7bc5249f46 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -143,7 +143,7 @@ class Paiement extends CommonObject * @param int $closepaidinvoices 1=Also close payed invoices to paid, 0=Do nothing more * @return int id of created payment, < 0 if error */ - function create($user,$closepaidinvoices=0) + function create($user, $closepaidinvoices=0) { global $conf, $langs; @@ -154,7 +154,7 @@ class Paiement extends CommonObject // Clean parameters $totalamount = 0; $atleastonepaymentnotnull = 0; - foreach ($this->amounts as $key => $value) // How payment is dispatch + foreach ($this->amounts as $key => $value) // How payment is dispatched (invoice id => amount) { $newvalue = price2num($value,'MT'); $this->amounts[$key] = $newvalue; @@ -696,7 +696,7 @@ class Paiement extends CommonObject /** * Information sur l'objet - * + * * @param int $id id du paiement dont il faut afficher les infos * @return void */ From 9253fed75414e75562f56d85c3cde2efb7e3263c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 11 Jan 2018 00:17:32 +0100 Subject: [PATCH 19/26] Revert "Code comment" This reverts commit 8000777864bf54eb4a7b8023ec8949d8175d4543. --- htdocs/compta/paiement/class/paiement.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index a7bc5249f46..4fa9c5b9575 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -143,7 +143,7 @@ class Paiement extends CommonObject * @param int $closepaidinvoices 1=Also close payed invoices to paid, 0=Do nothing more * @return int id of created payment, < 0 if error */ - function create($user, $closepaidinvoices=0) + function create($user,$closepaidinvoices=0) { global $conf, $langs; @@ -154,7 +154,7 @@ class Paiement extends CommonObject // Clean parameters $totalamount = 0; $atleastonepaymentnotnull = 0; - foreach ($this->amounts as $key => $value) // How payment is dispatched (invoice id => amount) + foreach ($this->amounts as $key => $value) // How payment is dispatch { $newvalue = price2num($value,'MT'); $this->amounts[$key] = $newvalue; @@ -696,7 +696,7 @@ class Paiement extends CommonObject /** * Information sur l'objet - * + * * @param int $id id du paiement dont il faut afficher les infos * @return void */ From 4c0dc21ca02614b4dc97464c787c86c7783c01ee Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 18 Jan 2018 14:07:32 +0100 Subject: [PATCH 20/26] Fix validate contrat was not using force_number parameter --- htdocs/contrat/class/contrat.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 375c98c3c0b..86a57b1c144 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -322,7 +322,11 @@ class Contrat extends CommonObject $result=$this->thirdparty->set_as_client(); // Define new ref - if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life + if ($force_number) + { + $num = $force_number; + } + else if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life { $num = $this->getNextNumRef($this->thirdparty); } From 054d98a2baf8f566a41f38dacb857695e9a75173 Mon Sep 17 00:00:00 2001 From: atm-ph Date: Mon, 22 Jan 2018 17:09:17 +0100 Subject: [PATCH 21/26] Fix each total isn't aligned on payment card --- htdocs/compta/paiement.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index e81d0e38345..2b6f47037f0 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -745,7 +745,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie { // Print total print ''; - print ''.$langs->trans('TotalTTC').''; + print ''.$langs->trans('TotalTTC').''; + if (!empty($conf->multicurrency->enabled)) print ''; if (!empty($conf->multicurrency->enabled)) print ''; if (!empty($conf->multicurrency->enabled)) print ''; if (!empty($conf->multicurrency->enabled)) print ''; From c0e719e3d8db0026a28be573abfb36c655e7588a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 26 Jan 2018 01:39:42 +0100 Subject: [PATCH 22/26] Fix package scripts --- build/makepack-dolibarr.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 20dfc2579aa..7ead2228b41 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -19,7 +19,7 @@ use Cwd; # Change this to defined target for option 98 and 99 $PROJECT="dolibarr"; $PUBLISHSTABLE="eldy,dolibarr\@frs.sourceforge.net:/home/frs/project/dolibarr"; -$PUBLISHBETARC="ldestailleur\@vmprod.dolibarr.org:/home/dolibarr/dolibarr.org/httpdocs/files"; +$PUBLISHBETARC="dolibarr\@vmprod1.dolibarr.org:/home/dolibarr/dolibarr.org/httpdocs/files"; #@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","APS","EXEDOLIWAMP","SNAPSHOT"); # Possible packages From 2147bd23e64da09d96fc2a44395aa4293a2ab427 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 2 Feb 2018 10:22:47 +0100 Subject: [PATCH 23/26] Fix: remove lines with special code when convert to reduc --- htdocs/compta/facture.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index b5b200aa540..5fcd2d05aee 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -611,7 +611,7 @@ if (empty($reshook)) $i = 0; foreach ($object->lines as $line) { - if ($line->total_ht!=0) + if (empty($line->special_code) && $line->total_ht != 0) // Remove lines with special code { // no need to create discount if amount is null $amount_ht[$line->tva_tx] += $line->total_ht; $amount_tva[$line->tva_tx] += $line->total_tva; From a161ca37ffe23e530870f5fb83522910d075fff6 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 4 Feb 2018 08:58:31 +0100 Subject: [PATCH 24/26] Fix: use product_type instead special_code --- htdocs/compta/facture.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 5fcd2d05aee..63b8f2a102b 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -611,7 +611,7 @@ if (empty($reshook)) $i = 0; foreach ($object->lines as $line) { - if (empty($line->special_code) && $line->total_ht != 0) // Remove lines with special code + if (empty($line->product_type >= 9) && $line->total_ht != 0) // Remove lines with product_type greater than or equal to 9 { // no need to create discount if amount is null $amount_ht[$line->tva_tx] += $line->total_ht; $amount_tva[$line->tva_tx] += $line->total_tva; From d5b7184c8d501e6d4e8b83afeed36027eed9a2c6 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 4 Feb 2018 09:04:15 +0100 Subject: [PATCH 25/26] Fix: wrong test --- htdocs/compta/facture.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 63b8f2a102b..39d603a6c5e 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -611,7 +611,7 @@ if (empty($reshook)) $i = 0; foreach ($object->lines as $line) { - if (empty($line->product_type >= 9) && $line->total_ht != 0) // Remove lines with product_type greater than or equal to 9 + if ($line->product_type < 9 && $line->total_ht != 0) // Remove lines with product_type greater than or equal to 9 { // no need to create discount if amount is null $amount_ht[$line->tva_tx] += $line->total_ht; $amount_tva[$line->tva_tx] += $line->total_tva; From ef051716410fcb7eef18447f6facc1086924beec Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Mon, 12 Feb 2018 13:48:43 +0100 Subject: [PATCH 26/26] Fix : contract service list context was mixing up with service list from product/service module --- htdocs/contrat/services.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php index f21c476fe35..09df597d017 100644 --- a/htdocs/contrat/services.php +++ b/htdocs/contrat/services.php @@ -75,7 +75,7 @@ $opclotureyear=GETPOST('opclotureyear'); $filter_opcloture=GETPOST('filter_opcloture'); // Initialize context for list -$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'servicelist'.$mode; +$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'contractservicelist'.$mode; // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array($contextpage));