From a814e02d5349528199fc7c0f41209e60352b8394 Mon Sep 17 00:00:00 2001 From: gauthier Date: Fri, 21 Oct 2016 12:40:19 +0200 Subject: [PATCH 1/9] FIX : margin tab on customer card must filter on current entity invoices --- htdocs/margin/tabs/thirdpartyMargins.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index 0a0239f0bf2..48d230070c9 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -152,7 +152,7 @@ if ($socid > 0) $sql.= ", ".MAIN_DB_PREFIX."facturedet as d"; $sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " AND f.fk_statut > 0"; - $sql.= " AND s.entity = ".$conf->entity; + $sql.= " AND f.entity = ".$conf->entity; $sql.= " AND d.fk_facture = f.rowid"; $sql.= " AND f.fk_soc = $socid"; $sql.= " AND d.buy_price_ht IS NOT NULL"; From 2a4517e1bcd8f9830eec9b562b61a2e74cd16966 Mon Sep 17 00:00:00 2001 From: Sergio Sanchis Climent Date: Mon, 24 Oct 2016 19:21:41 +0200 Subject: [PATCH 2/9] FIX: #5907 --- htdocs/langs/en_US/main.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index aaa1085e377..25095ce0a9e 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -576,6 +576,7 @@ MailSentBy=Email sent by TextUsedInTheMessageBody=Email body SendAcknowledgementByMail=Send Ack. by email NoEMail=No email +Email=Email NoMobilePhone=No mobile phone Owner=Owner DetectedVersion=Detected version From 1dc0dfc065579cc377ba2c2e15779892f1454d70 Mon Sep 17 00:00:00 2001 From: phf Date: Tue, 25 Oct 2016 12:07:34 +0200 Subject: [PATCH 3/9] Fix fetch multicurrency object from code must be filter by entity --- htdocs/multicurrency/class/multicurrency.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index c2c6ba1bc99..ce29f8e14c5 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -181,11 +181,13 @@ class MultiCurrency extends CommonObject public function fetch($id, $code = null) { dol_syslog('Currency::fetch', LOG_DEBUG); + + global $conf; $sql = 'SELECT'; $sql .= ' c.rowid, c.name, c.code, c.entity, c.date_create, c.fk_user'; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' AS c'; - if (!empty($code)) $sql .= ' WHERE c.code = \''.$this->db->escape($code).'\''; + if (!empty($code)) $sql .= ' WHERE c.code = \''.$this->db->escape($code).'\' AND c.entity = '.$conf->entity; else $sql .= ' WHERE c.rowid = ' . $id; dol_syslog(__METHOD__,LOG_DEBUG); From a947ac55f9f2b4269ebddd5f70eb9e21dd565b4d Mon Sep 17 00:00:00 2001 From: phf Date: Tue, 25 Oct 2016 12:45:23 +0200 Subject: [PATCH 4/9] Fix get multicurrency rowid from code must be filtered by entity --- htdocs/multicurrency/class/multicurrency.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index ce29f8e14c5..e3570c5285e 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -501,7 +501,9 @@ class MultiCurrency extends CommonObject */ public static function getIdFromCode(&$db, $code) { - $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'multicurrency WHERE code = \''.$db->escape($code).'\''; + global $conf; + + $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'multicurrency WHERE code = \''.$db->escape($code).'\' AND entity = '.$conf->entity; dol_syslog(__METHOD__,LOG_DEBUG); $resql = $db->query($sql); From 3e2f39fbc042788b60e7abab2752904a519e0d58 Mon Sep 17 00:00:00 2001 From: phf Date: Tue, 25 Oct 2016 13:31:36 +0200 Subject: [PATCH 5/9] Fix on first activate module it must create if needed the first currency rate from general settings --- .../core/modules/modMultiCurrency.class.php | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modMultiCurrency.class.php b/htdocs/core/modules/modMultiCurrency.class.php index 7ae613edd49..4928ab5edf4 100644 --- a/htdocs/core/modules/modMultiCurrency.class.php +++ b/htdocs/core/modules/modMultiCurrency.class.php @@ -265,8 +265,14 @@ class modMultiCurrency extends DolibarrModules $sql = array(); //$this->_load_tables('/multicurrency/sql/'); - - return $this->_init($sql, $options); + $res = $this->_init($sql, $options); + + if ($res) + { + $this->createFirstCurrency(); + } + + return $res; } /** @@ -284,5 +290,27 @@ class modMultiCurrency extends DolibarrModules return $this->_remove($sql, $options); } + /** + * Function called when module is enabled + * Create the currency from general setting + * + * @return int 1 if OK, 0 if KO + */ + private function createFirstCurrency() + { + global $conf,$user,$langs; + + if (!MultiCurrency::checkCodeAlreadyExists($conf->currency)) + { + $langs->loadCacheCurrencies(''); + + $multicurrency = new MultiCurrency($this->db); + $multicurrency->code = $conf->currency; + $multicurrency->name = $langs->cache_currencies[$conf->currency]['label'].' ('.$langs->getCurrencySymbol($conf->currency).')'; + $r = $multicurrency->create($user); + + if ($r > 0) $multicurrency->addRate(1); + } + } } From be493fcf09747b37c69c9124736e025c727904de Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Fri, 28 Oct 2016 10:16:58 +0200 Subject: [PATCH 6/9] Fix bad parameter in hook call --- htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 16338efc225..bb9d4b1be1e 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -211,7 +211,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $hookmanager->initHooks(array('pdfgeneration')); $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); global $action; - $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $nblignes = count($object->lines); From 3dbab863a77dc8b78ea876d8ebcdf4f0300853ef Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Fri, 28 Oct 2016 10:24:31 +0200 Subject: [PATCH 7/9] Fix : vars were not set after commande function --- htdocs/fourn/class/fournisseur.commande.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 523f89862c8..c5020e8fa33 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -950,6 +950,8 @@ class CommandeFournisseur extends CommonOrder { $result = 1; $this->log($user, 3, $date, $comment); + $this->date_commande = $date; + $this->methode_commande = $methode; } else { From d0bd1d5d365fa369ac3645588a687a7e186509c0 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 28 Oct 2016 14:22:06 +0200 Subject: [PATCH 8/9] Fix: missing path of user photo --- htdocs/core/class/commondocgenerator.class.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index a38b4cf59d9..9b233ef6b74 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -35,8 +35,8 @@ abstract class CommonDocGenerator { var $error=''; protected $db; - - + + /** * Constructor * @@ -59,6 +59,8 @@ abstract class CommonDocGenerator { global $conf; + $logotouse=$conf->user->dir_output.'/'.get_exdir($user->id, 2, 0, 1, $user, 'user').'/'.$user->photo; + return array( 'myuser_lastname'=>$user->lastname, 'myuser_firstname'=>$user->firstname, @@ -75,7 +77,7 @@ abstract class CommonDocGenerator 'myuser_fax'=>$user->office_fax, 'myuser_mobile'=>$user->user_mobile, 'myuser_email'=>$user->email, - 'myuser_logo'=>$user->photo, + 'myuser_logo'=>$logotouse, 'myuser_job'=>$user->job, 'myuser_web'=>'' // url not exist in $user object ); @@ -390,7 +392,7 @@ abstract class CommonDocGenerator // Add vat by rates foreach ($object->lines as $line) { - // $line->tva_tx format depends on database field accuraty, no reliable. This is kept for backward comaptibility + // $line->tva_tx format depends on database field accuraty, no reliable. This is kept for backward comaptibility if (empty($resarray[$array_key.'_total_vat_'.$line->tva_tx])) $resarray[$array_key.'_total_vat_'.$line->tva_tx]=0; $resarray[$array_key.'_total_vat_'.$line->tva_tx]+=$line->total_tva; $resarray[$array_key.'_total_vat_locale_'.$line->tva_tx]=price($resarray[$array_key.'_total_vat_'.$line->tva_tx]); @@ -582,7 +584,7 @@ abstract class CommonDocGenerator $object->array_options['options_'.$key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_'.$key]]; } else if($extrafields->attribute_type[$key] == 'date') - { + { if (strlen($object->array_options['options_'.$key])>0) { $object->array_options['options_'.$key] = dol_print_date($object->array_options['options_'.$key],'day'); // using company output language From 7c75d98f9a6666211238e67b491ed0049f68c6e5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 29 Oct 2016 18:43:12 +0200 Subject: [PATCH 9/9] FIX #5866 --- htdocs/compta/facture/list.php | 4 ++++ htdocs/product/stock/productlot_list.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 3f5f7183e90..79342baf293 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -229,6 +229,10 @@ if (empty($reshook)) $error++; } + if (! $error && $massaction == 'confirm_presend' && GETPOST('modelselected')) // If we change the template, we must not send email, but keep on send email form + { + $massaction='presend'; + } if (! $error && $massaction == 'confirm_presend') { $resaction = ''; diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index 2d01c95520b..0b0b1510ada 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -145,7 +145,7 @@ if (($id > 0 || ! empty($ref)) && $action != 'add') */ if (GETPOST('cancel')) { $action='list'; $massaction=''; } -if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } +if (! GETPOST('confirmmassaction') && $massaction != 'confirm_presend') { $massaction=''; } $parameters=array(); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks