From 8b16eeb55481da937a2927a4a255a52f74252c2d Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 4 Nov 2016 10:06:53 +0100 Subject: [PATCH 01/46] Fix: no login are required for fckeditor (external emailing) --- htdocs/viewimage.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index d14ccc6f8d4..5aeb1072d04 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -36,6 +36,12 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); if (! defined('NOREQUIREHOOK')) define('NOREQUIREHOOK','1'); // Disable "main.inc.php" hooks // Pour autre que companylogo, on charge environnement + info issus de logon comme le user if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'companylogo') && ! defined("NOLOGIN")) define("NOLOGIN",'1'); +if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'fckeditor') && ! defined("NOLOGIN")) { + define("NOLOGIN",'1'); + // For multicompany + $entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); + if (is_numeric($entity)) define("DOLENTITY", $entity); +} /** * Header empty From 718adef600eaeda9e74fcef3eedfe88b63079a0c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 4 Nov 2016 10:21:20 +0100 Subject: [PATCH 02/46] Fix: external access of fkeditor image with multicompany --- htdocs/core/class/doleditor.class.php | 2 +- htdocs/core/filemanagerdol/connectors/php/config.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 35c3b3909ef..7e68589c5f9 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -108,7 +108,7 @@ class DolEditor // Dolibarr utilise toujours liens avec modulepart='fckeditor' quelque soit modulepart. // Ou se trouve donc cette valeur /viewimage.php?modulepart=fckeditor&file=' ? $modulepart='fckeditor'; - $this->editor->Config['UserFilesPath'] = '/viewimage.php?modulepart='.$modulepart.'&file='; + $this->editor->Config['UserFilesPath'] = '/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&file='; $this->editor->Config['UserFilesAbsolutePath'] = DOL_DATA_ROOT.'/'.$modulepart.'/' ; $this->editor->Config['LinkBrowser']=($uselocalbrowser?'true':'false'); diff --git a/htdocs/core/filemanagerdol/connectors/php/config.php b/htdocs/core/filemanagerdol/connectors/php/config.php index 0c3b0a4884c..e21e69bdec2 100644 --- a/htdocs/core/filemanagerdol/connectors/php/config.php +++ b/htdocs/core/filemanagerdol/connectors/php/config.php @@ -44,7 +44,8 @@ $Config['Enabled'] = true ; // Path to user files relative to the document root. -$Config['UserFilesPath'] = DOL_URL_ROOT.'/viewimage.php?modulepart=fckeditor&file=' ; +$extEntity=(empty($entity) ? 1 : $entity); // For multicompany with external access +$Config['UserFilesPath'] = DOL_URL_ROOT.'/viewimage.php?modulepart=fckeditor&entity='.$extEntity.'&file=' ; // Fill the following value it you prefer to specify the absolute path for the // user files directory. Useful if you are using a virtual directory, symbolic From 0b594eab594d7df40e9ebb1443509ea59f481309 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Wed, 9 Nov 2016 11:28:05 +0100 Subject: [PATCH 03/46] FIX #5966 Bug: getNomUrl tooltips show Proposal info even if user has no rights to read them --- htdocs/comm/propal/class/propal.class.php | 64 ++++++++++++++--------- 1 file changed, 38 insertions(+), 26 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 463c81266f8..aa1a59e025a 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2734,34 +2734,46 @@ class Propal extends CommonObject */ function getNomUrl($withpicto=0,$option='', $get_params='') { - global $langs, $conf; + global $langs, $conf, $user; $result=''; - $label = '' . $langs->trans("ShowPropal") . ''; - if (! empty($this->ref)) - $label.= '
'.$langs->trans('Ref').': '.$this->ref; - if (! empty($this->ref_client)) - $label.= '
'.$langs->trans('RefCustomer').': '.$this->ref_client; - if (! empty($this->total_ht)) - $label.= '
' . $langs->trans('AmountHT') . ': ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); - if (! empty($this->total_tva)) - $label.= '
' . $langs->trans('VAT') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); - if (! empty($this->total_ttc)) - $label.= '
' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); - $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; - if ($option == '') { - $link = ''; + $label = ''; + + if ($user->rights->propal->lire) { + $label .= ''.$langs->trans("ShowPropal").''; + if (!empty($this->ref)) { + $label .= '
'.$langs->trans('Ref').': '.$this->ref; + } + if (!empty($this->ref_client)) { + $label .= '
'.$langs->trans('RefCustomer').': '.$this->ref_client; + } + if (!empty($this->total_ht)) { + $label .= '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, + $conf->currency); + } + if (!empty($this->total_tva)) { + $label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, + $conf->currency); + } + if (!empty($this->total_ttc)) { + $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, + $conf->currency); + } + $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; + if ($option == '') { + $link = '
'; + } $picto='propal'; From c6f96a81d130a82fa1e21805212e419ae818b715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Wed, 9 Nov 2016 11:30:55 +0100 Subject: [PATCH 04/46] Little correction --- htdocs/comm/propal/class/propal.class.php | 29 ++++++++++++----------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index aa1a59e025a..25ed1acb27e 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2759,22 +2759,23 @@ class Propal extends CommonObject $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); } - $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; - if ($option == '') { - $link = '
'; } + $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; + if ($option == '') { + $link = ''; + $picto='propal'; From 24c12df356a83fcb1bc44c72edac1533d4e49e10 Mon Sep 17 00:00:00 2001 From: philazerty Date: Wed, 9 Nov 2016 12:16:41 +0100 Subject: [PATCH 05/46] Update companies.lang Ajout du Gabon --- htdocs/langs/fr_FR/companies.lang | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/langs/fr_FR/companies.lang b/htdocs/langs/fr_FR/companies.lang index 21c8e740334..e246848c9d8 100644 --- a/htdocs/langs/fr_FR/companies.lang +++ b/htdocs/langs/fr_FR/companies.lang @@ -184,6 +184,12 @@ ProfId3FR=Id. prof. 3 (NAF-APE) ProfId4FR=Id. prof. 4 (RCS/RM) ProfId5FR=- ProfId6FR=- +ProfId1GA=Id. prof. 1 (NIF) +ProfId2GA=Id. prof. 2 (RCCM) +ProfId3GA=Id. prof. 3 (CAE) +ProfId4GA=Id. prof. 4 +ProfId5GA=- +ProfId6GA=- ProfId1GB=Numéro d'enregistrement ProfId2GB=- ProfId3GB=SIC From a1cccc021ed1c6c963680ea62044c014bc304337 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 12 Nov 2016 09:48:34 +0100 Subject: [PATCH 06/46] Fix: missing encrypt data for llx_const --- htdocs/install/mysql/migration/3.8.0-3.9.0.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql index 1a776c27e66..86d2549a8bc 100755 --- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -22,7 +22,7 @@ -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); -insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_ENABLE_LOG_TO_HTML','0','chaine','If this option is set to 1, it is possible to see log output at end of HTML sources by adding paramater logtohtml=1 on URL',1,0); +insert into llx_const (name, value, type, note, visible, entity) values (__ENCRYPT('MAIN_ENABLE_LOG_TO_HTML')__,__ENCRYPT('0')__,'chaine','If this option is set to 1, it is possible to see log output at end of HTML sources by adding paramater logtohtml=1 on URL',1,0); -- Was done into a 3.8 fix, so we must do it also in 3.9 @@ -61,7 +61,7 @@ update llx_opensurvey_sondage set format = 'D' where format = 'D+'; update llx_opensurvey_sondage set format = 'A' where format = 'A+'; INSERT INTO llx_const (name, value, type, note, visible) values (__ENCRYPT('MAIN_DELAY_EXPENSEREPORTS_TO_PAY')__,__ENCRYPT('31')__,'chaine','Tolérance de retard avant alerte (en jours) sur les notes de frais impayées',0); -INSERT INTO llx_const (name, value, type, note, visible) values ('MAIN_SIZE_SHORTLISTE_LIMIT','4','chaine','Longueur maximum des listes courtes (fiche client)',0); +INSERT INTO llx_const (name, value, type, note, visible) values (__ENCRYPT('MAIN_SIZE_SHORTLISTE_LIMIT')__,__ENCRYPT('4')__,'chaine','Longueur maximum des listes courtes (fiche client)',0); ALTER TABLE llx_accounting_system MODIFY COLUMN pcg_version varchar(32); ALTER TABLE llx_accountingaccount MODIFY COLUMN fk_pcg_version varchar(32); From e539842c281da09430dc6ddff74431a2e9b96ae9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 26 Nov 2016 15:46:41 +0100 Subject: [PATCH 07/46] Fix eatdate and selldate not correctly set. --- htdocs/product/stock/mouvement.php | 4 ++-- htdocs/product/stock/product.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 48b8d089375..ba257721746 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -115,8 +115,8 @@ if ($action == "correct_stock") //$eatby=GETPOST('eatby'); //$sellby=GETPOST('sellby'); - $eatby=dol_mktime(12, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear')); - $sellby=dol_mktime(12, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear')); + $eatby=dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear')); + $sellby=dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear')); $result=$product->correct_stock_batch( $user, diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 3170f329ea7..d37219db898 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -54,8 +54,8 @@ $stocklimit = GETPOST('seuil_stock_alerte'); $desiredstock = GETPOST('desiredstock'); $cancel = GETPOST('cancel'); $fieldid = isset($_GET["ref"])?'ref':'rowid'; -$d_eatby=dol_mktime(12, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']); -$d_sellby=dol_mktime(12, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']); +$d_eatby=dol_mktime(0, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']); +$d_sellby=dol_mktime(0, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']); $pdluoid=GETPOST('pdluoid','int'); // Security check @@ -352,8 +352,8 @@ if ($action == 'updateline' && GETPOST('save') == $langs->trans('Save')) } else { - $d_eatby=dol_mktime(12, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']); - $d_sellby=dol_mktime(12, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']); + $d_eatby=dol_mktime(0, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']); + $d_sellby=dol_mktime(0, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']); $pdluo->batch=GETPOST("batch_number",'san_alpha'); $pdluo->eatby=$d_eatby; $pdluo->sellby=$d_sellby; From 196428edf5dbb1d6a21e5abc3446d263a1a04dee Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 28 Nov 2016 16:34:38 +0100 Subject: [PATCH 08/46] FIX #6051 --- htdocs/societe/consumption.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index ea2cb899893..c31b4513ef5 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -250,6 +250,7 @@ if ($type_element == 'supplier_invoice') $tables_from = MAIN_DB_PREFIX."facture_fourn as f,".MAIN_DB_PREFIX."facture_fourn_det as d"; $where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid; $where.= " AND d.fk_facture_fourn = f.rowid"; + $where.= " AND f.entity = ".$conf->entity; $dateprint = 'f.datef'; $doc_number='f.ref'; $thirdTypeSelect='supplier'; @@ -262,6 +263,7 @@ if ($type_element == 'supplier_order') $tables_from = MAIN_DB_PREFIX."commande_fournisseur as c,".MAIN_DB_PREFIX."commande_fournisseurdet as d"; $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; $where.= " AND d.fk_commande = c.rowid"; + $where.= " AND c.entity = ".$conf->entity; $dateprint = 'c.date_valid'; $doc_number='c.ref'; $thirdTypeSelect='supplier'; @@ -275,6 +277,7 @@ if ($type_element == 'contract') $tables_from = MAIN_DB_PREFIX."contrat as c,".MAIN_DB_PREFIX."contratdet as d"; $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; $where.= " AND d.fk_contrat = c.rowid"; + $where.= " AND c.entity = ".$conf->entity; $dateprint = 'c.date_valid'; $doc_number='c.ref'; $thirdTypeSelect='customer'; From 5b6d5df159e99ea2ac4da32d6686ebae60c8c6e7 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 30 Nov 2016 16:02:55 +0100 Subject: [PATCH 09/46] FIX : delete contract extrafields on contract deletion --- htdocs/contrat/class/contrat.class.php | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 74ea611dc96..e4bee39c39e 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -56,7 +56,7 @@ class Contrat extends CommonObject * @var string */ var $ref_customer; - + /** * Supplier reference of the contract * @var string @@ -536,7 +536,7 @@ class Contrat extends CommonObject return -1; } } - + /** * Load a contract from database * @@ -1134,6 +1134,16 @@ class Contrat extends CommonObject } } + // Removed extrafields + if (! $error) { + $result=$this->deleteExtraFields(); + if ($result < 0) + { + $error++; + dol_syslog(get_class($this)."::delete error -3 ".$this->error, LOG_ERR); + } + } + if (! $error) { // We remove directory @@ -1333,7 +1343,7 @@ class Contrat extends CommonObject $localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->societe, $mysoc); $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, 1,$mysoc, $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; @@ -1356,9 +1366,9 @@ class Contrat extends CommonObject if (empty($pa_ht)) $pa_ht=0; - + // if buy price not defined, define buyprice as configured in margin admin - if ($this->pa_ht == 0) + if ($this->pa_ht == 0) { if (($result = $this->defineBuyPrice($pu_ht, $remise_percent, $fk_product)) < 0) { @@ -1515,7 +1525,7 @@ class Contrat extends CommonObject $localtaxes_type=getLocalTaxesFromRate($tvatx, 0, $this->societe, $mysoc); $tvatx = preg_replace('/\s*\(.*\)/','',$tvatx); // Remove code into vatrate. - + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $tvatx, $localtax1tx, $localtax2tx, 0, $price_base_type, $info_bits, 1, $mysoc, $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; @@ -1539,7 +1549,7 @@ class Contrat extends CommonObject if (empty($pa_ht)) $pa_ht=0; // if buy price not defined, define buyprice as configured in margin admin - if ($this->pa_ht == 0) + if ($this->pa_ht == 0) { if (($result = $this->defineBuyPrice($pu_ht, $remise_percent)) < 0) { @@ -2571,7 +2581,7 @@ class ContratLigne extends CommonObjectLine if (empty($this->pa_ht)) $this->pa_ht=0; // if buy price not defined, define buyprice as configured in margin admin - if ($this->pa_ht == 0) + if ($this->pa_ht == 0) { if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) { From 191474a5db73aaa05509cc325776efe82c6080c5 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Fri, 2 Dec 2016 11:35:12 +0100 Subject: [PATCH 10/46] FIX : Update intervention lline crash with PgSQL --- htdocs/fichinter/class/fichinter.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 59ea03476c4..f1c2ad16879 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -1202,7 +1202,7 @@ class FichinterLigne extends CommonObjectLine // Mise a jour ligne en base $sql = "UPDATE ".MAIN_DB_PREFIX."fichinterdet SET"; $sql.= " description='".$this->db->escape($this->desc)."'"; - $sql.= ",date=".$this->db->idate($this->datei); + $sql.= ",date='".$this->db->idate($this->datei)."'"; $sql.= ",duree=".$this->duration; $sql.= ",rang='".$this->rang."'"; $sql.= " WHERE rowid = ".$this->rowid; From de5ad57af40a432c673070b6dc160bca93e80ffd Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Fri, 2 Dec 2016 12:02:08 +0100 Subject: [PATCH 11/46] FIX : export extrafields must not include separe type --- htdocs/core/extrafieldsinexport.inc.php | 62 +++++++++++++------------ 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/htdocs/core/extrafieldsinexport.inc.php b/htdocs/core/extrafieldsinexport.inc.php index 1a608f6bc2e..82c26a91991 100644 --- a/htdocs/core/extrafieldsinexport.inc.php +++ b/htdocs/core/extrafieldsinexport.inc.php @@ -1,4 +1,4 @@ -db->fetch_object($resql)) { - $fieldname=$keyforaliasextra.'.'.$obj->name; - $fieldlabel=ucfirst($obj->label); - $typeFilter="Text"; - switch($obj->type) - { - case 'int': - case 'double': - case 'price': - $typeFilter="Numeric"; - break; - case 'date': - case 'datetime': - $typeFilter="Date"; - break; - case 'boolean': - $typeFilter="Boolean"; - break; - case 'sellist': - $tmp=''; - $tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null - if ($tmpparam['options'] && is_array($tmpparam['options'])) { - $tmpkeys=array_keys($tmpparam['options']); - $tmp=array_shift($tmpkeys); - } - if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp; - break; + if ($obj->type!='separate') { + $fieldname=$keyforaliasextra.'.'.$obj->name; + $fieldlabel=ucfirst($obj->label); + $typeFilter="Text"; + switch($obj->type) + { + case 'int': + case 'double': + case 'price': + $typeFilter="Numeric"; + break; + case 'date': + case 'datetime': + $typeFilter="Date"; + break; + case 'boolean': + $typeFilter="Boolean"; + break; + case 'sellist': + $tmp=''; + $tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null + if ($tmpparam['options'] && is_array($tmpparam['options'])) { + $tmpkeys=array_keys($tmpparam['options']); + $tmp=array_shift($tmpkeys); + } + if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp; + break; + } + $this->export_fields_array[$r][$fieldname]=$fieldlabel; + $this->export_TypeFields_array[$r][$fieldname]=$typeFilter; + $this->export_entities_array[$r][$fieldname]=$keyforelement; } - $this->export_fields_array[$r][$fieldname]=$fieldlabel; - $this->export_TypeFields_array[$r][$fieldname]=$typeFilter; - $this->export_entities_array[$r][$fieldname]=$keyforelement; } } // End add axtra fields From c2bee0f9375035cd96645f3e9bebe968342d667a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Dec 2016 12:44:56 +0100 Subject: [PATCH 12/46] FIX #6088 --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 52c3b2f5cb9..420f6529758 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -729,7 +729,7 @@ class ExtraFields } elseif ($type == 'price') { - $out=' '.$langs->getCurrencySymbol($conf->currency); + $out=' '.$langs->getCurrencySymbol($conf->currency); } elseif ($type == 'double') { From 829ff2299e7a6e3ae01abf8fef953e14d0750190 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Sat, 10 Dec 2016 12:46:26 +0100 Subject: [PATCH 13/46] Fix: Delete surplus migration file --- .../install/mysql/migration/3.8.0-3.9.0.sql | 30 ------------------- 1 file changed, 30 deletions(-) delete mode 100644 htdocs/install/mysql/migration/3.8.0-3.9.0.sql diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql deleted file mode 100644 index c3e6b5b091e..00000000000 --- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql +++ /dev/null @@ -1,30 +0,0 @@ --- --- Be carefull to requests order. --- This file must be loaded by calling /install/index.php page --- when current version is 3.9.0 or higher. --- --- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new; --- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol; --- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60); --- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname; --- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60); --- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name; --- To restrict request to Mysql version x.y use -- VMYSQLx.y --- To restrict request to Pgsql version x.y use -- VPGSQLx.y --- To make pk to be auto increment (mysql): VMYSQL4.3 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; --- To make pk to be auto increment (postgres): VPGSQL8.2 NOT POSSIBLE. MUST DELETE/CREATE TABLE --- To set a field as NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL; --- To set a field as default NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL; --- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user); --- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); - --- Fix bad data -update llx_opensurvey_sondage set format = 'D' where format = 'D+'; -update llx_opensurvey_sondage set format = 'A' where format = 'A+'; - -INSERT INTO llx_const (name, value, type, note, visible) values ('MAIN_DELAY_EXPENSEREPORTS_TO_PAY','31','chaine','Tolérance de retard avant alerte (en jours) sur les notes de frais impayées',0); - -ALTER TABLE llx_accounting_system MODIFY COLUMN pcg_version varchar(32); -ALTER TABLE llx_accountingaccount MODIFY COLUMN fk_pcg_version varchar(32); - - From 97e21cb7758d9ad24534f4c639eaa0e01da40b48 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 10 Dec 2016 13:05:46 +0100 Subject: [PATCH 14/46] Fix : delete product was not possible if batch stock --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 78ea0cb39c7..6b53fea0347 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -879,7 +879,7 @@ class Product extends CommonObject // Delete all child tables if (! $error) { - $elements = array('product_fournisseur_price','product_price','product_lang','categorie_product','product_stock','product_customer_price'); + $elements = array('product_fournisseur_price','product_price','product_lang','categorie_product','product_stock','product_customer_price','product_batch'); foreach($elements as $table) { if (! $error) From 5a2b8ff53cce86971b56299c7b6592819df1bb75 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Sat, 10 Dec 2016 22:41:53 +0100 Subject: [PATCH 15/46] FIX #5853 $conf->global->$calc==0 || $conf->global->$calc==1 --- htdocs/compta/localtax/clients.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/localtax/clients.php b/htdocs/compta/localtax/clients.php index b4cea5b4982..5c21b67a891 100644 --- a/htdocs/compta/localtax/clients.php +++ b/htdocs/compta/localtax/clients.php @@ -106,7 +106,7 @@ $fsearch.=' '; $calc=$conf->global->MAIN_INFO_LOCALTAX_CALC.$local; // Affiche en-tete du rapport -if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice for goods and services +if ($calc==0 || $calc==1) // Calculate on invoice for goods and services { $nom=$langs->transcountry($local==1?"LT1ReportByCustomersInInputOutputMode":"LT2ReportByCustomersInInputOutputMode",$mysoc->country_code); $calcmode=$calc==0?$langs->trans("CalcModeLT".$local):$langs->trans("CalcModeLT".$local."Rec"); @@ -124,7 +124,7 @@ if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice $productsup=$langs->trans("Description"); $amountsup=$langs->trans("AmountHT"); } -if ($conf->global->$calc==2) // Invoice for goods, payment for services +if ($calc==2) // Invoice for goods, payment for services { $nom=$langs->transcountry($local==1?"LT1ReportByCustomersInInputOutputMode":"LT2ReportByCustomersInInputOutputMode",$mysoc->country_code); $calcmode=$langs->trans("CalcModeLT2Debt"); @@ -149,7 +149,7 @@ $vatcust=$langs->transcountry($local==1?"LT1":"LT2",$mysoc->country_code); $vatsup=$langs->transcountry($local==1?"LT1":"LT2",$mysoc->country_code); // IRPF that the customer has retained me -if($conf->global->$calc ==0 || $conf->global->$calc == 2) +if($calc ==0 || $calc == 2) { print ""; print ""; @@ -232,7 +232,7 @@ if($conf->global->$calc ==0 || $conf->global->$calc == 2) } // IRPF I retained my supplier -if($conf->global->$calc ==0 || $conf->global->$calc == 1){ +if($calc ==0 || $calc == 1){ print "
"; print ""; print '"; @@ -309,7 +309,7 @@ if($conf->global->$calc ==0 || $conf->global->$calc == 1){ } } -if($conf->global->$calc ==0){ +if($calc ==0){ // Total to pay print '

'; print '
'.$langs->trans("Num")."
'; From 56aafa4660cb7b5e262943cff1b561c09d73c07c Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Sat, 10 Dec 2016 23:25:13 +0100 Subject: [PATCH 16/46] Fix #5646 Error editing Sell Price on products/services --- htdocs/product/price.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 8c3ad45c90c..88c6c3e57b1 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -5,7 +5,7 @@ * Copyright (C) 2005-2015 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2014 Florian Henry - * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2014-2016 Juanjo Menent * Copyright (C) 2014-2015 Philippe Grand * Copyright (C) 2014 Ion agorria * Copyright (C) 2015 Alexandre Spangaro @@ -246,8 +246,8 @@ if (empty($reshook)) { $obj = $db->fetch_object($resql); $npr = $obj->recuperableonly; - $localtax1 = $obj->localtax1; - $localtax2 = $obj->localtax2; + $localtax1 = get_localtax($tva_tx,1); + $localtax2 = get_localtax($tva_tx,2); $localtax1_type = $obj->localtax1_type; $localtax2_type = $obj->localtax2_type; } From 7fd75c793aea3b0b003f40c4d97be86c4f29dc43 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 11 Dec 2016 10:39:48 +0100 Subject: [PATCH 17/46] FIX Regression when deleting product --- htdocs/product/class/product.class.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 9bf8bcbd3f0..1d8d17d6c8f 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -908,10 +908,26 @@ class Product extends CommonObject // End call triggers } + // Delete from product_batch on product delete + if (! $error) + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX.'product_batch'; + $sql.= " WHERE fk_product_stock IN ("; + $sql.= "SELECT rowid FROM ".MAIN_DB_PREFIX.'product_stock'; + $sql.= " WHERE fk_product = ".$id.")"; + dol_syslog(get_class($this).'::delete', LOG_DEBUG); + $result = $this->db->query($sql); + if (! $result) + { + $error++; + $this->errors[] = $this->db->lasterror(); + } + } + // Delete all child tables if (! $error) { - $elements = array('product_fournisseur_price','product_price','product_lang','categorie_product','product_stock','product_customer_price','product_batch'); + $elements = array('product_fournisseur_price','product_price','product_lang','categorie_product','product_stock','product_customer_price'); foreach($elements as $table) { if (! $error) From 4dd740fe2f4bb1f8da072180b3da731b0809dc62 Mon Sep 17 00:00:00 2001 From: gauthier Date: Tue, 13 Dec 2016 11:41:26 +0100 Subject: [PATCH 18/46] FIX : wrong test on dict.php --- htdocs/admin/dict.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index bef8c6951bf..cae081e55e3 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1292,8 +1292,6 @@ if ($id) } else if ($fieldlist[$field]=='taux') { $valuetoshow = price($valuetoshow, 0, $langs, 0, 0); - if ($obj->localtax1 == 0) - $valuetoshow = ''; $align="right"; } else if (in_array($fieldlist[$field],array('recuperableonly'))) From 530d3503f5b11fb29aa662b942f87180631493f1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 14 Dec 2016 10:32:10 +0100 Subject: [PATCH 19/46] FIX Introduce hidden option MAIL_PREFIX_FOR_EMAIL_ID to solve pb of tracking email. --- htdocs/core/lib/functions.lib.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index aaff894fcf9..e0acccfe0c0 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -290,8 +290,15 @@ function GETPOST($paramname,$check='',$method=0,$filter=NULL,$options=NULL) */ function dol_getprefix() { + global $conf; + if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"])) { + if (! empty($conf->gobal->MAIL_PREFIX_FOR_EMAIL_ID)) + { + if ($conf->gobal->MAIL_PREFIX_FOR_EMAIL_ID == 'SERVER_NAME') return $_SERVER["SERVER_NAME"]; + return $conf->gobal->MAIL_PREFIX_FOR_EMAIL_ID; + } return dol_hash($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT); // Use this for a "clear" cookie name //return dol_sanitizeFileName($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT); From 56b3f2c011a11d898fbcbd759325daf18361d53f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 14 Dec 2016 10:36:11 +0100 Subject: [PATCH 20/46] FIX Introduce hidden option MAIL_PREFIX_FOR_EMAIL_ID to solve pb of tracking email. --- htdocs/core/lib/functions.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e0acccfe0c0..bce67604ee7 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -294,10 +294,10 @@ function dol_getprefix() if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"])) { - if (! empty($conf->gobal->MAIL_PREFIX_FOR_EMAIL_ID)) + if (! empty($conf->global->MAIL_PREFIX_FOR_EMAIL_ID)) { - if ($conf->gobal->MAIL_PREFIX_FOR_EMAIL_ID == 'SERVER_NAME') return $_SERVER["SERVER_NAME"]; - return $conf->gobal->MAIL_PREFIX_FOR_EMAIL_ID; + if ($conf->global->MAIL_PREFIX_FOR_EMAIL_ID == 'SERVER_NAME') return $_SERVER["SERVER_NAME"]; + return $conf->global->MAIL_PREFIX_FOR_EMAIL_ID; } return dol_hash($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT); // Use this for a "clear" cookie name From af407a094a2b4ff8e03393e2ba1feabb55de6ae2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 14 Dec 2016 11:20:44 +0100 Subject: [PATCH 21/46] FIX Introduce hidden option MAIL_PREFIX_FOR_EMAIL_ID to solve pb of tracking email. --- htdocs/core/class/smtps.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index dd2726d2306..6dd5f8214c2 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -1126,6 +1126,8 @@ class SMTPs $host=preg_replace('@tcp://@i','',$host); // Remove prefix $host=preg_replace('@ssl://@i','',$host); // Remove prefix + $host.=dol_getprefix().'-'.$host; + //NOTE: Message-ID should probably contain the username of the user who sent the msg $_header .= 'Subject: ' . $this->getSubject() . "\r\n"; $_header .= 'Date: ' . date("r") . "\r\n"; From e4dd0208874d20508c9db3acc810680417ee1810 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 14 Dec 2016 11:23:55 +0100 Subject: [PATCH 22/46] Fix bad concat --- htdocs/core/class/smtps.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index 6dd5f8214c2..a46672443ac 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -1126,7 +1126,7 @@ class SMTPs $host=preg_replace('@tcp://@i','',$host); // Remove prefix $host=preg_replace('@ssl://@i','',$host); // Remove prefix - $host.=dol_getprefix().'-'.$host; + $host=dol_getprefix().'-'.$host; //NOTE: Message-ID should probably contain the username of the user who sent the msg $_header .= 'Subject: ' . $this->getSubject() . "\r\n"; From 1f1c75adfb627d6e48543959ee8804bd84241359 Mon Sep 17 00:00:00 2001 From: gauthier Date: Wed, 14 Dec 2016 15:50:50 +0100 Subject: [PATCH 23/46] FIX : HT and TTC price should always be displayed together --- htdocs/product/price.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 88c6c3e57b1..3be258f4243 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1269,14 +1269,14 @@ if ($result) } else { - print '"; - print '"; + print '"; + print '"; if (! empty($conf->dynamicprices->enabled)) { //Only if module is enabled print ''; } } - print ''; - print ''; + print ''; + print ''; // User print ''; From 2c4c48ad6fc0f78afb59ebc2d42ae00daf85f663 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 15 Dec 2016 12:11:39 +0100 Subject: [PATCH 24/46] Better fix to add server name into email id. --- htdocs/core/class/CMailFile.class.php | 2 +- htdocs/core/class/smtps.class.php | 2 +- htdocs/core/lib/functions.lib.php | 15 +++++++++------ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index cd9e47f8a78..db9bf8e1ad0 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -680,7 +680,7 @@ class CMailFile global $conf; $out = ""; - $host = dol_getprefix(); + $host = dol_getprefix('email'); // Sender //$out.= "Sender: ".getValidAddress($this->addr_from,2)).$this->eol2; diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index a46672443ac..6731b46fe0f 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -1126,7 +1126,7 @@ class SMTPs $host=preg_replace('@tcp://@i','',$host); // Remove prefix $host=preg_replace('@ssl://@i','',$host); // Remove prefix - $host=dol_getprefix().'-'.$host; + $host=dol_getprefix('email').'-'.$host; //NOTE: Message-ID should probably contain the username of the user who sent the msg $_header .= 'Subject: ' . $this->getSubject() . "\r\n"; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index bce67604ee7..8c810b76b97 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -286,19 +286,22 @@ function GETPOST($paramname,$check='',$method=0,$filter=NULL,$options=NULL) * This prefix is unique for instance and avoid conflict between multi-instances, * even when having two instances with one root dir or two instances in virtual servers * + * @param string $mode '' or 'email' * @return string A calculated prefix */ -function dol_getprefix() +function dol_getprefix($mode='') { global $conf; + // If MAIL_PREFIX_FOR_EMAIL_ID is set and prefix is for email + if ($mode == 'email' && ! empty($conf->global->MAIL_PREFIX_FOR_EMAIL_ID)) + { + if ($conf->global->MAIL_PREFIX_FOR_EMAIL_ID != 'SERVER_NAME') return $conf->global->MAIL_PREFIX_FOR_EMAIL_ID; + else if (isset($_SERVER["SERVER_NAME"])) return $_SERVER["SERVER_NAME"]; + } + if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"])) { - if (! empty($conf->global->MAIL_PREFIX_FOR_EMAIL_ID)) - { - if ($conf->global->MAIL_PREFIX_FOR_EMAIL_ID == 'SERVER_NAME') return $_SERVER["SERVER_NAME"]; - return $conf->global->MAIL_PREFIX_FOR_EMAIL_ID; - } return dol_hash($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT); // Use this for a "clear" cookie name //return dol_sanitizeFileName($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT); From 534e2b12825768a12f8e8f6c3b30a6334b640760 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 16 Dec 2016 13:46:39 +0100 Subject: [PATCH 25/46] FIX Security to restrict email sending was not efficient --- build/debian/conf.php.install | 8 +++++++- htdocs/admin/system/constall.php | 3 ++- htdocs/admin/system/dolibarr.php | 3 ++- htdocs/comm/mailing/card.php | 13 ++++++++----- htdocs/conf/conf.php.example | 12 +++++++++--- htdocs/filefunc.inc.php | 1 + htdocs/langs/en_US/mails.lang | 4 ++-- htdocs/master.inc.php | 13 +++++++++++++ scripts/emailings/mailing-send.php | 11 ++++++++++- 9 files changed, 54 insertions(+), 14 deletions(-) diff --git a/build/debian/conf.php.install b/build/debian/conf.php.install index c0ba3bdb120..72b18049a6c 100644 --- a/build/debian/conf.php.install +++ b/build/debian/conf.php.install @@ -222,7 +222,13 @@ $dolibarr_main_prod='0'; # $dolibarr_main_limit_users='0'; # dolibarr_mailing_limit_sendbyweb -# Can set a limit for mailing send by web, can be used for a restricted mode. +# Can set a limit for mailing send by web. This overwrite database value. Can be used to restrict on OS level. # Default value: 0 (use database value if exist) # Examples: # $dolibarr_mailing_limit_sendbyweb='0'; + +# dolibarr_mailing_limit_sendbycli +# Can set a limit for mailing send by cli. This overwrite database value. Can be used to restrict on OS level. +# Default value: 0 (use database value if exist) +# Examples: +# $dolibarr_mailing_limit_sendbycli='0'; diff --git a/htdocs/admin/system/constall.php b/htdocs/admin/system/constall.php index 1ff005e88b2..0fb3a6c9a7b 100644 --- a/htdocs/admin/system/constall.php +++ b/htdocs/admin/system/constall.php @@ -90,7 +90,8 @@ $configfileparameters=array( '?dolibarr_font_DOL_DEFAULT_TTF_BOLD', 'separator', '?dolibarr_mailing_limit_sendbyweb', - '?dolibarr_strict_mode' + '?dolibarr_mailing_limit_sendbycli', + '?dolibarr_strict_mode' ); $configfilelib=array( // 'separator', diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index eeea93a2fea..38ae5377710 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -284,7 +284,8 @@ $configfileparameters=array( 'separator4' => '', 'dolibarr_main_prod' => 'Production mode (Hide all error messages)', '?dolibarr_mailing_limit_sendbyweb' => 'Limit nb of email sent by page', - '?dolibarr_strict_mode' => 'Strict mode is on/off', + '?dolibarr_mailing_limit_sendbycli' => 'Limit nb of email sent by cli', + '?dolibarr_strict_mode' => 'Strict mode is on/off', '?dolibarr_pdf_force_fpdf' => 'Force fpdf usage to generate PDF' ); diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 2cb2337d177..016caddbabf 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -761,6 +761,7 @@ else $sendingmode=$conf->global->MAIN_MAIL_SENDMODE; if (empty($sendingmode)) $sendingmode='mail'; // If not defined, we use php mail function + // Note: MAILING_LIMIT_SENDBYWEB is always defined to something != 0 if (! empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') { // EMailing feature may be a spam problem, so when you host several users/instance, having this option may force each user to use their own SMTP agent. @@ -772,19 +773,21 @@ else if (! empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) setEventMessages($langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS), null, 'warnings'); $_GET["action"]=''; } - else if (empty($conf->global->MAILING_LIMIT_SENDBYWEB)) + else if ($conf->global->MAILING_LIMIT_SENDBYWEB == '-1') { - // Pour des raisons de securite, on ne permet pas cette fonction via l'IHM, - // on affiche donc juste un message + // No limit was defined, so the feature is forbidden from GUI, we show just a message. setEventMessages($langs->trans("MailingNeedCommand"), null, 'warnings'); setEventMessages('', null, 'warnings'); - setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings'); + if ($conf->file->mailing_limit_sendbyweb != '-1') + { + setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings'); // You can send online with constant... + } $_GET["action"]=''; } else { $text=''; - if ($conf->file->mailing_limit_sendbyweb == 0) + if ($conf->global->MAILING_LIMIT_SENDBYCLI >= 0) { $text.=$langs->trans("MailingNeedCommand"); $text.='
'; diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index 3d6db94d801..11d0fc8ef23 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -262,9 +262,15 @@ $dolibarr_main_db_prefix=''; // $dolibarr_main_limit_users='0'; // dolibarr_mailing_limit_sendbyweb -// Can set a limit for mailing send by web. Can be used for a restricted mode. -// Default value: 0 (use database value if exist) -// Examples: +// Can set a limit for mailing send by web. This overwrite database value. Can be used to restrict on OS level. +// Default value: '0' (no overwrite, use database value if exists) +// Examples: '-1' (sending by web is forbidden) +// $dolibarr_mailing_limit_sendbyweb='0'; + +// dolibarr_mailing_limit_sendbycli +// Can set a limit for mailing send by cli. This overwrite database value. Can be used to restrict on OS level. +// Default value: '0' (no overwrite, use database value if exists) +// Examples: '-1' (sending by cli is forbidden) // $dolibarr_mailing_limit_sendbyweb='0'; // dolibarr_strict_mode diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 14dd1f0e318..7de3a9f9377 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -122,6 +122,7 @@ if (empty($dolibarr_main_db_encryption)) $dolibarr_main_db_encryption=0; if (empty($dolibarr_main_db_cryptkey)) $dolibarr_main_db_cryptkey=''; if (empty($dolibarr_main_limit_users)) $dolibarr_main_limit_users=0; if (empty($dolibarr_mailing_limit_sendbyweb)) $dolibarr_mailing_limit_sendbyweb=0; +if (empty($dolibarr_mailing_limit_sendbycli)) $dolibarr_mailing_limit_sendbycli=0; if (empty($dolibarr_strict_mode)) $dolibarr_strict_mode=0; // For debug in php strict mode // TODO Multicompany Remove this. Useless. if (empty($multicompany_transverse_mode)) $multicompany_transverse_mode=0; diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index 94a74604901..e748b634785 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -116,9 +116,9 @@ SearchAMailing=Search mailing SendMailing=Send emailing SendMail=Send email SentBy=Sent by -MailingNeedCommand=For security reason, sending an emailing is better when performed from command line. If you have one, ask your server administrator to launch the following command to send the emailing to all recipients: +MailingNeedCommand=For security reason, sending an emailing must be performed from command line. Ask your server administrator to launch the following command to send the emailing to all recipients: MailingNeedCommand2=You can however send them online by adding parameter MAILING_LIMIT_SENDBYWEB with value of max number of emails you want to send by session. For this, go on Home - Setup - Other. -ConfirmSendingEmailing=If you can't or prefer sending them with your www browser, please confirm you are sure you want to send emailing now from your browser ? +ConfirmSendingEmailing=If you want to send emailing directly from this screen, please confirm you are sure you want to send emailing now from your browser ? LimitSendingEmailing=Note: Sending of emailings from web interface is done in several times for security and timeout reasons, %s recipients at a time for each sending session. TargetsReset=Clear list ToClearAllRecipientsClickHere=Click here to clear the recipient list for this emailing diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 7c0000bedea..80fc5d9a1d4 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -61,6 +61,7 @@ if (defined('TEST_DB_FORCE_TYPE')) $conf->db->type=constant('TEST_DB_FORCE_TYPE' // Set properties specific to conf file $conf->file->main_limit_users = $dolibarr_main_limit_users; $conf->file->mailing_limit_sendbyweb = $dolibarr_mailing_limit_sendbyweb; +$conf->file->mailing_limit_sendbycli = $dolibarr_mailing_limit_sendbycli; $conf->file->main_authentication = empty($dolibarr_main_authentication)?'':$dolibarr_main_authentication; // Identification mode $conf->file->main_force_https = empty($dolibarr_main_force_https)?'':$dolibarr_main_force_https; // Force https $conf->file->strict_mode = empty($dolibarr_strict_mode)?'':$dolibarr_strict_mode; // Force php strict mode (for debug) @@ -188,6 +189,18 @@ if (! empty($conf->file->mailing_limit_sendbyweb)) { $conf->global->MAILING_LIMIT_SENDBYWEB = $conf->file->mailing_limit_sendbyweb; } +if (empty($conf->global->MAILING_LIMIT_SENDBYWEB)) +{ + $conf->global->MAILING_LIMIT_SENDBYWEB = 25; +} +if (! empty($conf->file->mailing_limit_sendbycli)) +{ + $conf->global->MAILING_LIMIT_SENDBYCLI = $conf->file->mailing_limit_sendbycli; +} +if (empty($conf->global->MAILING_LIMIT_SENDBYCLI)) +{ + $conf->global->MAILING_LIMIT_SENDBYCLI = 0; +} // If software has been locked. Only login $conf->global->MAIN_ONLY_LOGIN_ALLOWED is allowed. if (! empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index 98455b2a233..fb8612977a8 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -61,6 +61,11 @@ $error=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; +if ($conf->global->MAILING_LIMIT_SENDBYCLI == '-1') +{ + +} + $user = new User($db); // for signature, we use user send as parameter if (! empty($login)) $user->fetch('',$login); @@ -108,7 +113,11 @@ if ($resql) $sql2 = "SELECT mc.rowid, mc.lastname as lastname, mc.firstname as firstname, mc.email, mc.other, mc.source_url, mc.source_id, mc.source_type, mc.tag"; $sql2.= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc"; $sql2.= " WHERE mc.statut < 1 AND mc.fk_mailing = ".$id; - + if ($conf->global->MAILING_LIMIT_SENDBYCLI > 0) + { + $sql2.= " LIMIT ".$conf->global->MAILING_LIMIT_SENDBYCLI; + } + $resql2=$db->query($sql2); if ($resql2) { From c5db333af8b6b59cb4943647f64cc47d2618ce1d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 17 Dec 2016 14:00:39 +0100 Subject: [PATCH 26/46] Fix translation of error message when sending email --- htdocs/core/class/CMailFile.class.php | 31 ++++++++++++++++++++++++--- htdocs/langs/en_US/errors.lang | 1 + 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index db9bf8e1ad0..bd803ca3851 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -366,7 +366,7 @@ class CMailFile */ function sendfile() { - global $conf,$db; + global $conf,$db,$langs; $errorlevel=error_reporting(); error_reporting($errorlevel ^ E_WARNING); // Desactive warnings @@ -388,7 +388,31 @@ class CMailFile return $reshook; } - + + // Check number of recipient is lower or equal than MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL + if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL=10; + $tmparray = explode(',', $this->addr_to); + if (count($tmparray) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL) + { + $this->error = 'Too much recipients in to:'; + dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); + return false; + } + $tmparray = explode(',', $this->addr_cc); + if (count($tmparray) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL) + { + $this->error = 'Too much recipients in cc:'; + dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); + return false; + } + $tmparray = explode(',', $this->addr_bcc); + if (count($tmparray) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL) + { + $this->error = 'Too much recipients in bcc:'; + dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); + return false; + } + // Action according to choosed sending method if ($conf->global->MAIN_MAIL_SENDMODE == 'mail') { @@ -449,7 +473,8 @@ class CMailFile { $this->error.=" to HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port'); // This values are value used only for non linuxlike systems } - $this->error.=".
Check your server logs and your firewalls setup"; + $this->error.=".
"; + $this->error.=$langs->trans("ErrorPhpMailDelivery"); dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR); } else diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index dc3502e027a..5727c0edb11 100755 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -180,6 +180,7 @@ ErrorStockIsNotEnoughToAddProductOnOrder=Stock is not enougth for product %s to ErrorStockIsNotEnoughToAddProductOnInvoice=Stock is not enougth for product %s to add it into a new invoice. ErrorStockIsNotEnoughToAddProductOnShipment=Stock is not enougth for product %s to add it into a new shipment. ErrorStockIsNotEnoughToAddProductOnProposal=Stock is not enougth for product %s to add it into a new proposal. +ErrorPhpMailDelivery=Check that you don't use a too high number of recipients and that your email content is not similar to a Spam. Ask also your administrator to check firewall and server logs files for a more complete information. # Warnings WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. From 73e666323065f642e8b8aabc2f5b1c4379b9881b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 17 Dec 2016 14:47:06 +0100 Subject: [PATCH 27/46] Fix help/messages for emailing to warn users. --- htdocs/comm/mailing/card.php | 21 ++++++++++++++------- htdocs/langs/en_US/mails.lang | 2 +- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 016caddbabf..7a3e1ab8057 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -761,11 +761,12 @@ else $sendingmode=$conf->global->MAIN_MAIL_SENDMODE; if (empty($sendingmode)) $sendingmode='mail'; // If not defined, we use php mail function - // Note: MAILING_LIMIT_SENDBYWEB is always defined to something != 0 + // MAILING_NO_USING_PHPMAIL may be defined or not + // MAILING_LIMIT_SENDBYWEB is always defined to something != 0, MAILING_LIMIT_SENDBYCLI may be defined ot not. if (! empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') { // EMailing feature may be a spam problem, so when you host several users/instance, having this option may force each user to use their own SMTP agent. - // You ensure that every user is using its own SMTP server. + // You ensure that every user is using its own SMTP server when using the mass emailing module. $linktoadminemailbefore=''; $linktoadminemailend=''; setEventMessages($langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]), null, 'warnings'); @@ -775,10 +776,13 @@ else } else if ($conf->global->MAILING_LIMIT_SENDBYWEB == '-1') { - // No limit was defined, so the feature is forbidden from GUI, we show just a message. - setEventMessages($langs->trans("MailingNeedCommand"), null, 'warnings'); + if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_PHPMAIL, null, 'warnings'); + if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL, null, 'warnings'); + + // The feature is forbidden from GUI, we show just message to use from command line. + setEventMessages($langs->trans("MailingNeedCommand"), null, 'warnings'); setEventMessages('', null, 'warnings'); - if ($conf->file->mailing_limit_sendbyweb != '-1') + if ($conf->file->mailing_limit_sendbyweb != '-1') // MAILING_LIMIT_SENDBYWEB was set to -1 in database, but it is allowed ot increase it. { setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings'); // You can send online with constant... } @@ -786,8 +790,11 @@ else } else { - $text=''; - if ($conf->global->MAILING_LIMIT_SENDBYCLI >= 0) + if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_PHPMAIL, null, 'warnings'); + if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL, null, 'warnings'); + + $text=''; + if ($conf->global->MAILING_LIMIT_SENDBYCLI >= 0) { $text.=$langs->trans("MailingNeedCommand"); $text.='
'; diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index e748b634785..f682df02406 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -116,7 +116,7 @@ SearchAMailing=Search mailing SendMailing=Send emailing SendMail=Send email SentBy=Sent by -MailingNeedCommand=For security reason, sending an emailing must be performed from command line. Ask your server administrator to launch the following command to send the emailing to all recipients: +MailingNeedCommand=Sending an emailing can be performed from command line. Ask your server administrator to launch the following command to send the emailing to all recipients: MailingNeedCommand2=You can however send them online by adding parameter MAILING_LIMIT_SENDBYWEB with value of max number of emails you want to send by session. For this, go on Home - Setup - Other. ConfirmSendingEmailing=If you want to send emailing directly from this screen, please confirm you are sure you want to send emailing now from your browser ? LimitSendingEmailing=Note: Sending of emailings from web interface is done in several times for security and timeout reasons, %s recipients at a time for each sending session. From 321933f2671fbc26c09160144fefa07ea35f1649 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Dec 2016 02:10:26 +0100 Subject: [PATCH 28/46] Fix deletion of product --- htdocs/product/class/product.class.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 6b53fea0347..7ebe18358c6 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -876,10 +876,26 @@ class Product extends CommonObject // End call triggers } - // Delete all child tables + // Delete from product_batch on product delete if (! $error) { - $elements = array('product_fournisseur_price','product_price','product_lang','categorie_product','product_stock','product_customer_price','product_batch'); + $sql = "DELETE FROM ".MAIN_DB_PREFIX.'product_batch'; + $sql.= " WHERE fk_product_stock IN ("; + $sql.= "SELECT rowid FROM ".MAIN_DB_PREFIX.'product_stock'; + $sql.= " WHERE fk_product = ".$id.")"; + dol_syslog(get_class($this).'::delete', LOG_DEBUG); + $result = $this->db->query($sql); + if (! $result) + { + $error++; + $this->errors[] = $this->db->lasterror(); + } + } + + // Delete all child tables + if (! $error) + { + $elements = array('product_fournisseur_price','product_price','product_lang','categorie_product','product_stock','product_customer_price'); // product_batch done before foreach($elements as $table) { if (! $error) From dbf96b8f5977fa44b2f268d0827fa8383fb7a96e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Dec 2016 23:32:31 +0100 Subject: [PATCH 29/46] Log at wrong place --- htdocs/core/class/CMailFile.class.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index bd803ca3851..ba4eb1ad017 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -441,8 +441,6 @@ class CMailFile } else { - dol_syslog("CMailFile::sendfile: mail start HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port'), LOG_DEBUG); - $bounce = ''; // By default if (! empty($conf->global->MAIN_MAIL_ALLOW_SENDMAIL_F)) { @@ -455,7 +453,8 @@ class CMailFile { $bounce .= ($bounce?' ':'').'-ba'; } - + dol_syslog("CMailFile::sendfile: mail start HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port').", additionnal_parameters=".$bounce, LOG_DEBUG); + $this->message=stripslashes($this->message); if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail(); From 74e00c4d803a4da3e21c345445aac3b95db19243 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Dec 2016 01:04:17 +0100 Subject: [PATCH 30/46] More comment and hidden option to solve problems when sending emails. --- htdocs/core/class/CMailFile.class.php | 7 +++++-- htdocs/core/class/smtps.class.php | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index ba4eb1ad017..a7c9b0a0e56 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -143,6 +143,8 @@ class CMailFile $this->msgishtml = $msgishtml; } + if (! empty($conf->global->MAIN_MAIL_FORCE_CONTENT_TYPE_TO_HTML)) $this->msgishtml=1; // To force to send everything with content type html. + // Detect images if ($this->msgishtml) { @@ -822,8 +824,9 @@ class CMailFile $strContent = preg_replace("/\r\n/si", "\n", $strContent); } - //$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems bugged - $strContent = rtrim(wordwrap($strContent)); + // Make RFC2045 Compliant, split lines + //$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems ko if not used on a base64 content + $strContent = rtrim(wordwrap($strContent)); // TODO Using this method creates unexpected line break on text/plain content. if ($this->msgishtml) { diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index 6731b46fe0f..91efd218de1 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -1188,7 +1188,9 @@ class SMTPs // Make RFC821 Compliant, replace bare linefeeds $strContent = preg_replace("/(?_msgContent[$strType] = array(); From 876722733aa721d03d9ce369cbdaaa67cf046e77 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Dec 2016 02:33:54 +0100 Subject: [PATCH 31/46] Better fix to get localtax --- htdocs/core/lib/functions.lib.php | 17 +++++++---------- htdocs/product/price.php | 11 +++++++++-- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8c810b76b97..bd184469e49 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3330,7 +3330,7 @@ function price2num($amount,$rounding='',$alreadysqlnb=0) * @param float $vatrate Vat rate. Can be '8.5' or '8.5 (VATCODEX)' for example * @param int $local Local tax to search and return (1 or 2 return only tax rate 1 or tax rate 2) * @param Societe $thirdparty_buyer Object of buying third party - * @param Societe $thirdparty_seller Object of selling third party + * @param Societe $thirdparty_seller Object of selling third party ($mysoc if not defined) * @param int $vatnpr If vat rate is NPR or not * @return mixed 0 if not found, localtax rate if found * @see get_default_tva @@ -3389,18 +3389,15 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller if ($local == 1 && ! $thirdparty_seller->localtax1_assuj) return 0; if ($local == 2 && ! $thirdparty_seller->localtax2_assuj) return 0; } - //if ($local == 0 && ! $thirdparty_seller->localtax1_assuj && ! $thirdparty_seller->localtax2_assuj) return array('localtax1'=>0,'localtax2'=>0); - // Do not enabled this. We want localtax that match the vat rate. - // If we forced a vat, we must also force local tax - /* - if (is_object($thirdparty_buyer)) + // For some country MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY is forced to on. + if (in_array($mysoc->country_code, array('ES'))) { - if ($thirdparty_seller->country_code != $thirdparty_buyer->country_code) return 0; - }*/ - + $conf->global->MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY = 1; + } + // Search local taxes - if ($mysoc->country_code == 'ES' || ! empty($conf->global->MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY)) + if (! empty($conf->global->MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY)) { if ($local==1) { diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 3be258f4243..625b6c29631 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -246,10 +246,17 @@ if (empty($reshook)) { $obj = $db->fetch_object($resql); $npr = $obj->recuperableonly; - $localtax1 = get_localtax($tva_tx,1); - $localtax2 = get_localtax($tva_tx,2); + $localtax1 = $obj->localtax1; + $localtax2 = $obj->localtax2; $localtax1_type = $obj->localtax1_type; $localtax2_type = $obj->localtax2_type; + + // If spain, we don't use the localtax found into tax record in database with same code, but using the get_localtax rule + if (in_array($mysoc->country_code, array('ES'))) + { + $localtax1 = get_localtax($tva_tx,1); + $localtax2 = get_localtax($tva_tx,2); + } } } $pricestoupdate[0] = array( From 94eeaf9ed05cb70bb79897363283626bc5549569 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Dec 2016 18:47:21 +0100 Subject: [PATCH 32/46] Fix typo error --- htdocs/langs/en_US/errors.lang | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 5727c0edb11..8635b3e2d88 100755 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -176,10 +176,10 @@ ErrorWarehouseRequiredIntoShipmentLine=Warehouse is required on the line to ship ErrorFileMustHaveFormat=File must have format %s ErrorSupplierCountryIsNotDefined=Country for this supplier is not defined. Correct this first. ErrorsThirdpartyMerge=Failed to merge the two records. Request canceled. -ErrorStockIsNotEnoughToAddProductOnOrder=Stock is not enougth for product %s to add it into a new order. -ErrorStockIsNotEnoughToAddProductOnInvoice=Stock is not enougth for product %s to add it into a new invoice. -ErrorStockIsNotEnoughToAddProductOnShipment=Stock is not enougth for product %s to add it into a new shipment. -ErrorStockIsNotEnoughToAddProductOnProposal=Stock is not enougth for product %s to add it into a new proposal. +ErrorStockIsNotEnoughToAddProductOnOrder=Stock is not enough for product %s to add it into a new order. +ErrorStockIsNotEnoughToAddProductOnInvoice=Stock is not enough for product %s to add it into a new invoice. +ErrorStockIsNotEnoughToAddProductOnShipment=Stock is not enough for product %s to add it into a new shipment. +ErrorStockIsNotEnoughToAddProductOnProposal=Stock is not enough for product %s to add it into a new proposal. ErrorPhpMailDelivery=Check that you don't use a too high number of recipients and that your email content is not similar to a Spam. Ask also your administrator to check firewall and server logs files for a more complete information. # Warnings From f7e5898b4ad79393ffe300b91b42fb580050ee3f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Dec 2016 10:58:31 +0100 Subject: [PATCH 33/46] Fix show a more accurate translation --- htdocs/langs/en_US/mails.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index f682df02406..67a8a24c04d 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -42,7 +42,7 @@ MailingStatusSentPartialy=Sent partialy MailingStatusSentCompletely=Sent completely MailingStatusError=Error MailingStatusNotSent=Not sent -MailSuccessfulySent=Email successfully sent (from %s to %s) +MailSuccessfulySent=Email successfully accepted for delivery (from %s to %s) MailingSuccessfullyValidated=EMailing successfully validated MailUnsubcribe=Unsubscribe Unsuscribe=Unsubscribe From 9cc2a7422154fba8bfc152bba5d5d7613c31f25a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Dec 2016 16:29:15 +0100 Subject: [PATCH 34/46] Update changelog --- ChangeLog | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/ChangeLog b/ChangeLog index d3274e1048d..1ad2ff66841 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,61 @@ during migration. Upgrading to any other version or any other database system is abolutely required BEFORE trying make a Dolibarr upgrade. + +***** ChangeLog for 3.9.4 compared to 3.9.3 ***** +FIX: #2853 +FIX: #3128 +FIX: #4447 +FIX: #5128 if create method return duplicated code error not use GETPOST in order to get a new code +FIX: #5340 +FIX: #5473 +FIX: #5474 Country_id of "Don" object is still empty +FIX: #5534 +FIX: #5535 bad dependency. +FIX: #5537 AJAX project search does not work properly +FIX: #5540 getFormMail is not registered as addReplace hook +FIX: #5544 Disabled Contact still appear in lists to send emails +FIX: #5549 getNomUrl tooltips show Order info even if user has no rights to read them +FIX: #5568 +FIX: #5594 +FIX: #5629 PgSQL Interger string stylish error +FIX: #5651 +FIX: #5660 +FIX: #5853 $conf->global->$calc==0 || $conf->global->$calc==1 +FIX: #5907 +FIX: #5966 Bug: getNomUrl tooltips show Proposal info even if user has no rights to read them +FIX: #6051 +FIX: #6088 +FIX: Can correct stock of lot using eatby or sell by date +FIX: Can make a movement on "out of sell" products +FIX: cannot update bank account on invoice if module order not activated +FIX: Can't create withdrawal document +FIX: delete contract extrafields on contract deletion +FIX: Direction of movement lost if an error occurs +FIX: Error when CATEGORIE_RECURSIV_ADD is enabled and new category is daughter of an already linked to object +FIX: export extrafields must not include separe type +FIX: External user must not be able to edit its discounts +FIX: Failed to export contact categories with contact extra fields +FIX: header title in commercial area +FIX: HT and TTC price should always be displayed together +FIX: incoterms +FIX: incoterms do not output into crabe invoice PDF +FIX: in PgSQL no quote "word style" is permitted around column name +FIX: Introduce hidden option MAIL_PREFIX_FOR_EMAIL_ID to solve pb of tracking email. +FIX: margin tab on customer card must filter on current entity invoices +FIX: missing column into SQL on thridparty list +FIX: only show projects of related third if external user +FIX: PgSQL Module Ressource list crash #5637 +FIX: php Strict +FIX: Regression when deleting product +FIX: Security to restrict email sending was not efficient +FIX: tag for date rfc in odt substitution +FIX: Update intervention lline crash with PgSQL +FIX: update limit stock on product stock +FIX: vat dictionary should allow enter and edit multiple values for localtaxes, separated by: (ex -19:-15) +FIX: wrong test on dict.php + + ***** ChangeLog for 3.9.3 compared to 3.9.2 ***** FIX: #4383 $userid not defined FIX: #4448 $filebonprev is not used, $this->filename now From cdcbf58ca860bc2eaffa18e600891c60eb59aafb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Dec 2016 17:33:54 +0100 Subject: [PATCH 35/46] Prepare 3.9.5 --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 7de3a9f9377..42df075fa17 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr'); -if (! defined('DOL_VERSION')) define('DOL_VERSION','3.9.4'); +if (! defined('DOL_VERSION')) define('DOL_VERSION','3.9.5'); if (! defined('EURO')) define('EURO',chr(128)); From 98599b0bbfde042e3ee25636e1ed391080995d6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Tue, 27 Dec 2016 12:56:49 +0100 Subject: [PATCH 36/46] FIX #6227 Document models table header "Unit" is shown in 2 lines in Spanish --- htdocs/core/modules/commande/doc/pdf_einstein.modules.php | 4 ++-- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 4 ++-- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 4 ++-- .../core/modules/supplier_invoice/pdf/pdf_canelle.modules.php | 4 ++-- .../core/modules/supplier_order/pdf/pdf_muscadet.modules.php | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 36f62be3833..286038f1b22 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -110,8 +110,8 @@ class pdf_einstein extends ModelePDFCommandes { $this->posxtva=99; $this->posxup=114; - $this->posxqty=133; - $this->posxunit=150; + $this->posxqty=130; + $this->posxunit=147; } else { diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index ff8a73c527d..6d7b22613f7 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -120,8 +120,8 @@ class pdf_crabe extends ModelePDFFactures { $this->posxtva=99; $this->posxup=114; - $this->posxqty=133; - $this->posxunit=150; + $this->posxqty=130; + $this->posxunit=147; } else { diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 52f9a09ae9f..0c0728093ac 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -108,8 +108,8 @@ class pdf_azur extends ModelePDFPropales { $this->posxtva=99; $this->posxup=114; - $this->posxqty=133; - $this->posxunit=150; + $this->posxqty=130; + $this->posxunit=147; } else { diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index 6b89ef7f5c8..c368ca52ca9 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -102,8 +102,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices if($conf->global->PRODUCT_USE_UNITS) { $this->posxtva=99; $this->posxup=114; - $this->posxqty=133; - $this->posxunit=150; + $this->posxqty=130; + $this->posxunit=147; } //if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup; $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index 95b0c00ff5b..3117b6a9e55 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -111,8 +111,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders { $this->posxtva=99; $this->posxup=114; - $this->posxqty=133; - $this->posxunit=150; + $this->posxqty=130; + $this->posxunit=147; } else { $this->posxtva=112; $this->posxup=126; From 39f35bbaab2ae4771320b2c4d3aba5a37aa20ad9 Mon Sep 17 00:00:00 2001 From: arnaud Date: Tue, 17 Jan 2017 11:17:40 +0100 Subject: [PATCH 37/46] FIX all dolibarr versions about project list and ajax completion bug --- htdocs/core/class/html.formprojet.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 4c094061ee4..ba4d2bac3ff 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -127,13 +127,15 @@ class FormProjets // Search all projects $sql = 'SELECT p.rowid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public'; $sql.= ' FROM '.MAIN_DB_PREFIX .'projet as p'; - $sql.= " WHERE p.entity = ".$conf->entity; + $sql.= " WHERE p.entity IN (".getEntity('project',1).")"; if ($projectsListId !== false) $sql.= " AND p.rowid IN (".$projectsListId.")"; if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)"; if ($socid > 0) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)"; if (!empty($filterkey)) { - $sql .= ' AND p.title LIKE "%'.$this->db->escape($filterkey).'%"'; + $sql .= ' AND ('; + $sql .= ' p.title LIKE "%'.$this->db->escape($filterkey).'%"'; $sql .= ' OR p.ref LIKE "%'.$this->db->escape($filterkey).'%"'; + $sql .= ')'; } $sql.= " ORDER BY p.ref ASC"; From 2cedcfece2c3a9f41c5385176e6e66d72969dd55 Mon Sep 17 00:00:00 2001 From: arnaud Date: Fri, 20 Jan 2017 12:01:20 +0100 Subject: [PATCH 38/46] FIX bug margin calcul by user with multicompany --- htdocs/margin/agentMargins.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index f9189ed7e97..d023720a875 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -126,6 +126,7 @@ $sql.= ", ".MAIN_DB_PREFIX."facturedet as d"; $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ", ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE f.fk_soc = s.rowid"; +$sql.= " AND f.entity = ".$conf->entity; $sql.= " AND sc.fk_soc = f.fk_soc"; $sql.= " AND (d.product_type = 0 OR d.product_type = 1)"; if (! empty($conf->global->AGENT_CONTACT_TYPE)) From 2be601106918c58a75216c8df441cdcffdb88a9f Mon Sep 17 00:00:00 2001 From: fappels Date: Mon, 23 Jan 2017 20:59:32 +0100 Subject: [PATCH 39/46] Fix product elephant verify for service --- htdocs/core/modules/product/mod_codeproduct_elephant.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/product/mod_codeproduct_elephant.php b/htdocs/core/modules/product/mod_codeproduct_elephant.php index 517cd0a7ce9..bb7eb09abf4 100644 --- a/htdocs/core/modules/product/mod_codeproduct_elephant.php +++ b/htdocs/core/modules/product/mod_codeproduct_elephant.php @@ -252,7 +252,7 @@ class mod_codeproduct_elephant extends ModeleProductCode // Get Mask value $mask = ''; if ($type==0) $mask = empty($conf->global->PRODUCT_ELEPHANT_MASK_PRODUCT)?'':$conf->global->PRODUCT_ELEPHANT_MASK_PRODUCT; - if ($type==1) $mask = empty($conf->global->PRODUCT_ELEPHANT_MASK_SSERVICE)?'':$conf->global->PRODUCT_ELEPHANT_MASK_SERVICE; + if ($type==1) $mask = empty($conf->global->PRODUCT_ELEPHANT_MASK_SERVICE)?'':$conf->global->PRODUCT_ELEPHANT_MASK_SERVICE; if (! $mask) { $this->error='NotConfigured'; From 90e8f062e93c6ef1cdc294272fa158183d82cd6f Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Tue, 31 Jan 2017 10:23:03 +0100 Subject: [PATCH 40/46] Fix : link to user in bank was wrong regarding expensereport payment --- .../expensereport/class/paymentexpensereport.class.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php index 4c9c5843a49..9b05313a581 100644 --- a/htdocs/expensereport/class/paymentexpensereport.class.php +++ b/htdocs/expensereport/class/paymentexpensereport.class.php @@ -527,13 +527,14 @@ class PaymentExpenseReport extends CommonObject { if ($mode == 'payment_expensereport') { - $euser = new User($this->db); - $euser->fetch($key); + $er = new ExpenseReport($this->db); + $er->fetch($key); + $er->fetch_user($er->fk_user_author); $result=$acc->add_url_line( $bank_line_id, - $euser->id, + $er->user->id, DOL_URL_ROOT.'/user/card.php?id=', - $euser->getFullName($langs), + $er->user->getFullName($langs), 'user' ); if ($result <= 0) From d5978a5092b36b3669fd019174d89da533ec52c2 Mon Sep 17 00:00:00 2001 From: fmarcet Date: Tue, 7 Feb 2017 14:02:27 +0100 Subject: [PATCH 41/46] Fix: Wrong vat calculation when split discounts --- htdocs/comm/remx.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index e358b842d2d..408135b552b 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -109,7 +109,7 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes') $newdiscount2->amount_ttc=price2num($discount->amount_ttc-$newdiscount1->amount_ttc); $newdiscount1->amount_ht=price2num($newdiscount1->amount_ttc/(1+$newdiscount1->tva_tx/100),'MT'); $newdiscount2->amount_ht=price2num($newdiscount2->amount_ttc/(1+$newdiscount2->tva_tx/100),'MT'); - $newdiscount1->amount_tva=price2num($newdiscount1->amount_ttc-$newdiscount2->amount_ht); + $newdiscount1->amount_tva=price2num($newdiscount1->amount_ttc-$newdiscount1->amount_ht); $newdiscount2->amount_tva=price2num($newdiscount2->amount_ttc-$newdiscount2->amount_ht); $db->begin(); From c01988ba438e1e74f6b88b8a1d4929682ab728a5 Mon Sep 17 00:00:00 2001 From: gauthier Date: Thu, 9 Feb 2017 17:28:37 +0100 Subject: [PATCH 42/46] FIX : delete bank class lines when we delete bank_categ --- htdocs/compta/bank/categ.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/htdocs/compta/bank/categ.php b/htdocs/compta/bank/categ.php index 00755959ab9..176f8d6101b 100644 --- a/htdocs/compta/bank/categ.php +++ b/htdocs/compta/bank/categ.php @@ -87,6 +87,17 @@ if ($action == 'delete') { if (GETPOST('categid')) { + // Delete bank class + $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class"; + $sql.= " WHERE fk_categ = '".GETPOST('categid')."'"; + + $result = $db->query($sql); + if (!$result) + { + dol_print_error($db); + } + + // Delete bank categ $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_categ"; $sql.= " WHERE rowid = '".GETPOST('categid')."'"; $sql.= " AND entity = ".$conf->entity; From 9cd807af1acda10a9c7e2a6dd9686a7ad85d62c5 Mon Sep 17 00:00:00 2001 From: gauthier Date: Tue, 28 Feb 2017 12:31:45 +0100 Subject: [PATCH 43/46] FIX : param billed when we change page --- htdocs/commande/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index f9653c06732..c6c1fe704e2 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -275,6 +275,7 @@ if ($resql) if ($search_sale > 0) $param.='&search_sale='.$search_sale; if ($search_total_ht != '') $param.='&search_total_ht='.$search_total_ht; if ($optioncss != '') $param.='&optioncss='.$optioncss; + if ($billed != '') $param.='&billed='.$billed; $num = $db->num_rows($resql); print_barre_liste($title, $page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_commercial.png'); From e1f459d67a5b096b95b7f385b7e02911630cc2d0 Mon Sep 17 00:00:00 2001 From: fmarcet Date: Fri, 3 Mar 2017 12:57:52 +0100 Subject: [PATCH 44/46] Fix: Error when references are numeric --- htdocs/product/class/product.class.php | 4 ++-- htdocs/projet/class/project.class.php | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 1d8d17d6c8f..72f7533135a 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -12,7 +12,7 @@ * Copyright (C) 2014 Henry Florian * Copyright (C) 2014-2016 Philippe Grand * Copyright (C) 2014 Ion agorria - * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2016-2017 Ferran Marcet * * 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 @@ -803,7 +803,7 @@ class Product extends CommonObject // End call triggers } - if (! $error && (is_object($this->oldcopy) && $this->oldcopy->ref != $this->ref)) + if (! $error && (is_object($this->oldcopy) && $this->oldcopy->ref !== $this->ref)) { // We remove directory if ($conf->product->dir_output) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 91a75f80ce1..6e866057584 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2015 Marcos García + * Copyright (C) 2017 Ferran Marcet * * 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 @@ -279,7 +280,7 @@ class Project extends CommonObject } } - if (! $error && (is_object($this->oldcopy) && $this->oldcopy->ref != $this->ref)) + if (! $error && (is_object($this->oldcopy) && $this->oldcopy->ref !== $this->ref)) { // We remove directory if ($conf->projet->dir_output) From 38ccf7ffdd74ae5d36f3a3ff20702a97f8c79119 Mon Sep 17 00:00:00 2001 From: hugome Date: Thu, 2 Mar 2017 20:16:12 +0100 Subject: [PATCH 45/46] Fix : Agenda getCalendarEvents hook Return of getCalendarEvents on agenda page : The array_merge change key of merged array. --- htdocs/comm/action/index.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 5366720bfc6..321d15ba485 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -919,7 +919,14 @@ if (count($listofextcals)) // Complete $eventarray with events coming from external module $parameters=array(); $object=null; $reshook=$hookmanager->executeHooks('getCalendarEvents',$parameters,$object,$action); -if (! empty($hookmanager->resArray['eventarray'])) $eventarray=array_merge($eventarray, $hookmanager->resArray['eventarray']); +if (! empty($hookmanager->resArray['eventarray'])) { + foreach ($hookmanager->resArray['eventarray'] as $keyDate => $events) { + if (!isset($eventarray[$keyDate])) { + $eventarray[$keyDate]=array(); + } + $eventarray[$keyDate]=array_merge($eventarray[$keyDate], $events); + } +} From 15d0e6abc5453c6301e7e92ca378b5077e196c0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Mon, 13 Mar 2017 20:33:21 +0100 Subject: [PATCH 46/46] Corrected bug where product multiprices admin page would not render properly due to a PHP fatal error --- htdocs/product/admin/price_rules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/admin/price_rules.php b/htdocs/product/admin/price_rules.php index e284572e7e7..224acd9c04b 100644 --- a/htdocs/product/admin/price_rules.php +++ b/htdocs/product/admin/price_rules.php @@ -155,7 +155,6 @@ $genPriceOptions = function($level) use ($price_options) { return $return; }; - ?>
' . ($objp->price_base_type != 'TTC' ? price($objp->price) : ''). "' . ($objp->price_base_type == 'TTC' ? price($objp->price_ttc) : '') . "' . price($objp->price). "' . price($objp->price_ttc) . "' . ($objp->price_base_type != 'TTC' ? price($objp->price_min) : '') . '' . ($objp->price_base_type == 'TTC' ? price($objp->price_min_ttc) : '') . '' . price($objp->price_min) . '' . price($objp->price_min_ttc) . '' . img_object($langs->trans("ShowUser"), 'user') . ' ' . $objp->login . '
@@ -173,7 +172,8 @@ $genPriceOptions = function($level) use ($price_options) {
trans('SellingPrice').' '.$i; // Label of price - if (! empty($conf->global->{"PRODUIT_MULTIPRICES_LABEL$i"})) { + $keyforlabel='PRODUIT_MULTIPRICES_LABEL'.$i; + if (! empty($conf->global->$keyforlabel)) { print ' - '.$langs->trans($conf->global->$keyforlabel); } ?>