From 9116110737d152a4ef861aff37fbc396d4d6fbe5 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 30 Nov 2019 00:35:32 +0100 Subject: [PATCH 01/10] Fix #12502 : loan rate wasn't updatable --- htdocs/loan/card.php | 2 +- htdocs/loan/class/loan.class.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 242472aff0a..bde0ce6ccb4 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -544,7 +544,7 @@ if ($id > 0) } else { - print $object->rate . '%'; + print price($object->rate) . '%'; } print ''; diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index 0e4542b1d20..cb980b36d2d 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -335,6 +335,7 @@ class Loan extends CommonObject $sql.= " datestart='".$this->db->idate($this->datestart)."',"; $sql.= " dateend='".$this->db->idate($this->dateend)."',"; $sql.= " nbterm=".$this->nbterm.","; + $sql.= " rate=".$this->db->escape($this->rate).","; $sql.= " accountancy_account_capital = '".$this->db->escape($this->account_capital)."',"; $sql.= " accountancy_account_insurance = '".$this->db->escape($this->account_insurance)."',"; $sql.= " accountancy_account_interest = '".$this->db->escape($this->account_interest)."',"; From 02b5da5db1c2b57c6d88bd18f247527843d6b8fd Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 30 Nov 2019 00:57:21 +0100 Subject: [PATCH 02/10] Fix #12448 : notifications were sent to disabled user or contacts --- htdocs/core/class/notify.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index ae22728f06d..f8bb58a05fb 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -329,6 +329,7 @@ class Notify $sql.= " ".MAIN_DB_PREFIX."societe as s"; $sql.= " WHERE n.fk_contact = c.rowid AND a.rowid = n.fk_action"; $sql.= " AND n.fk_soc = s.rowid"; + $sql.= " AND c.statut = 1"; if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage else $sql.= " AND a.code = '".$notifcode."'"; // New usage $sql .= " AND s.rowid = ".$object->socid; @@ -342,6 +343,7 @@ class Notify $sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,"; $sql.= " ".MAIN_DB_PREFIX."notify_def as n"; $sql.= " WHERE n.fk_user = c.rowid AND a.rowid = n.fk_action"; + $sql.= " AND c.statut = 1"; if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage else $sql.= " AND a.code = '".$notifcode."'"; // New usage From 9095482113a40e10a6e39edf26cfc7047e52b0dd Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 30 Nov 2019 14:47:48 +0100 Subject: [PATCH 03/10] Fix margins access + menu display --- htdocs/core/menus/standard/eldy.lib.php | 3 ++- htdocs/margin/productMargins.php | 2 +- htdocs/margin/tabs/productMargins.php | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 6325643cf87..c875c0c28a5 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -165,9 +165,10 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode if (! empty($conf->salaries->enabled)) $menuqualified++; if (! empty($conf->supplier_invoice->enabled)) $menuqualified++; if (! empty($conf->loan->enabled)) $menuqualified++; + if (! empty($conf->margins->enabled)) $menuqualified++; $tmpentry=array( 'enabled'=>$menuqualified, - 'perms'=>(! empty($user->rights->facture->lire) || ! empty($user->rights->don->lire) || ! empty($user->rights->tax->charges->lire) || ! empty($user->rights->salaries->read) || ! empty($user->rights->fournisseur->facture->lire) || ! empty($user->rights->loan->read)), + 'perms'=>(! empty($user->rights->facture->lire) || ! empty($user->rights->don->lire) || ! empty($user->rights->tax->charges->lire) || ! empty($user->rights->salaries->read) || ! empty($user->rights->fournisseur->facture->lire) || ! empty($user->rights->loan->read) || ! empty($user->rights->margins->liretous)), 'module'=>'facture|supplier_invoice|don|tax|salaries|loan'); $showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal); if ($showmode) diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index d827f5d985e..38018852ffe 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -42,7 +42,7 @@ $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); if (! empty($user->societe_id)) $socid=$user->societe_id; $result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype); -$result=restrictedArea($user,'margins'); +if(empty($user->rights->margins->liretous)) accessforbidden(); $mesg = ''; diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php index 3b826501614..cd6b93e04e1 100644 --- a/htdocs/margin/tabs/productMargins.php +++ b/htdocs/margin/tabs/productMargins.php @@ -41,6 +41,7 @@ $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); if (! empty($user->societe_id)) $socid=$user->societe_id; $result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype); +if(empty($user->rights->margins->liretous)) accessforbidden(); $object = new Product($db); From 916954b301a1168064489a73d4111225f8ab5499 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 30 Nov 2019 14:48:05 +0100 Subject: [PATCH 04/10] Fix #12371 : access rights on contacts --- htdocs/core/lib/company.lib.php | 2 +- htdocs/societe/contact.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 68ad744dee2..8528c25bac7 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -52,7 +52,7 @@ function societe_prepare_head(Societe $object) if (empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) { - if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) + if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->societe->contact->lire) { //$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); $nbContact = 0; // TODO diff --git a/htdocs/societe/contact.php b/htdocs/societe/contact.php index 37fb07eb652..8a988edc413 100644 --- a/htdocs/societe/contact.php +++ b/htdocs/societe/contact.php @@ -88,6 +88,7 @@ if (! empty($canvas)) // Security check $result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', $objcanvas); +if(empty($user->rights->societe->contact->lire)) accessforbidden(); From 2c165d0a616e40d23dfb4e667795a0895e9efd8b Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 30 Nov 2019 15:53:50 +0100 Subject: [PATCH 05/10] Fix deposit date display in PDF --- htdocs/core/lib/pdf.lib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index ffd19489d1b..c432a8229da 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1264,9 +1264,10 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl $sourceref=!empty($discount->discount_type)?$discount->ref_invoive_supplier_source:$discount->ref_facture_source; $libelleproduitservice=$outputlangs->transnoentitiesnoconv("DiscountFromDeposit",$sourceref); // Add date of deposit - if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec,'day','',$outputlangs).')'; + if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) $libelleproduitservice.= ' ('.dol_print_date($discount->datec,'day','',$outputlangs).')'; + } - if ($desc == '(EXCESS RECEIVED)' && $object->lines[$i]->fk_remise_except) + elseif ($desc == '(EXCESS RECEIVED)' && $object->lines[$i]->fk_remise_except) { $discount=new DiscountAbsolute($db); $discount->fetch($object->lines[$i]->fk_remise_except); From 558669dd88a725fe6b7b84e571fe5d875bf2deec Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 30 Nov 2019 16:14:16 +0100 Subject: [PATCH 06/10] Fix #6497 : deposit lines were not translated --- htdocs/compta/facture/card.php | 2 +- htdocs/core/lib/pdf.lib.php | 3 +++ htdocs/core/tpl/objectline_view.tpl.php | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index df6aa92ff54..62f5899c025 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1314,7 +1314,7 @@ if (empty($reshook)) if (empty($amount)) continue; $arraylist = array('amount' => 'FixAmount','variable' => 'VarAmount'); - $descline = $langs->trans('Deposit'); + $descline = '(DEPOSIT)'; //$descline.= ' - '.$langs->trans($arraylist[$typeamount]); if ($typeamount=='amount') { $descline.= ' ('. price($valuedeposit, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).')'; diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index c432a8229da..8fa12241643 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1238,6 +1238,9 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl if (! empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && ($textwasmodified || $translatealsoifmodified)) $note=$prodser->multilangs[$outputlangs->defaultlang]["note"]; } } + elseif ($object->type == Facture::TYPE_DEPOSIT && $object->element == 'facture') { + $desc = str_replace('(DEPOSIT)', $outputlangs->trans('Deposit'), $desc); + } // Description short of product line $libelleproduitservice=$label; diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 38c492a84ae..c747e97d0a0 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -137,6 +137,8 @@ $domData .= ' data-product_type="'.$line->product_type.'"'; if (! empty($line->label)) { $text.= ' '.$line->label.''; echo $form->textwithtooltip($text,dol_htmlentitiesbr($line->description),3,'','',$i,0,(!empty($line->fk_parent_line)?img_picto('', 'rightarrow'):'')); + } elseif (strpos($line->description, '(DEPOSIT)') === 0) { + echo $text.' '.str_replace('(DEPOSIT)', $langs->trans("Deposit"), $line->description);; } else { if (! empty($line->fk_parent_line)) echo img_picto('', 'rightarrow'); echo $text.' '.dol_htmlentitiesbr($line->description); From 3c639772d9234c2bbe4ef9b5bede70ace4d2abb8 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 30 Nov 2019 17:16:16 +0100 Subject: [PATCH 07/10] Fix #11228 : VAT dates regarding fiscal year --- htdocs/compta/tva/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php index 6b0c2875d42..fb3ee8b8b6d 100644 --- a/htdocs/compta/tva/index.php +++ b/htdocs/compta/tva/index.php @@ -39,6 +39,7 @@ $year=GETPOST("year","int"); if (empty($year)) { $year_current = strftime("%Y",dol_now()); + if($conf->global->SOCIETE_FISCAL_MONTH_START > date('m')) $year_current--; $year_start = $year_current; } else { $year_current = $year; From f2ff443641b4d45fde0d0baf0d2de82cbacfaecd Mon Sep 17 00:00:00 2001 From: Nicolas Date: Sat, 30 Nov 2019 20:04:27 +0100 Subject: [PATCH 08/10] FIX #12482 --- htdocs/core/lib/functions.lib.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8d301275b5e..d0bcead2eb9 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -14,6 +14,7 @@ * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2018 Frédéric France + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -6085,7 +6086,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label) { - $substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '__'] = $object->array_options['options_' . $key]; + $value = $object->array_options['options_' . $key]; + $substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '__'] = $extrafields->showOutputField($key, $value); } } } From a352fd5a6e92e75eb60920d3ef320965f8d1eca2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Nov 2019 21:00:56 +0100 Subject: [PATCH 09/10] Revert "FIX#12482" --- htdocs/core/lib/functions.lib.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d0bcead2eb9..8d301275b5e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -14,7 +14,6 @@ * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2018 Frédéric France - * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -6086,8 +6085,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label) { - $value = $object->array_options['options_' . $key]; - $substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '__'] = $extrafields->showOutputField($key, $value); + $substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '__'] = $object->array_options['options_' . $key]; } } } From edb8bcb5987422245329f36e9d5b36b670316c94 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 30 Nov 2019 22:58:32 +0100 Subject: [PATCH 10/10] Fix PDF rouget for SHIPPING_PDF_HIDE_WEIGHT_AND_VOLUME --- htdocs/core/modules/expedition/doc/pdf_rouget.modules.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 087b4a373aa..a6a14106832 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -155,6 +155,8 @@ class pdf_rouget extends ModelePdfExpedition $this->posxtotalht=$this->page_largeur - $this->marge_droite - 20; } + if(!empty($conf->global->SHIPPING_PDF_HIDE_WEIGHT_AND_VOLUME)) $this->posxweightvol = $this->posxqtyordered; + $this->posxpicture=$this->posxweightvol - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images if ($this->page_largeur < 210) // To work with US executive format