From e1f459d67a5b096b95b7f385b7e02911630cc2d0 Mon Sep 17 00:00:00 2001 From: fmarcet Date: Fri, 3 Mar 2017 12:57:52 +0100 Subject: [PATCH 01/19] 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 a39dccad197451e06aa3f5ce12bf6f1c65b1a1d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sat, 11 Mar 2017 19:00:44 +0100 Subject: [PATCH 02/19] FIX #6503: SQL error in "Last pending payment invoices" Close #6503 --- htdocs/core/boxes/box_factures_imp.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php index 67c4d4dbfcc..d3336500263 100644 --- a/htdocs/core/boxes/box_factures_imp.php +++ b/htdocs/core/boxes/box_factures_imp.php @@ -78,8 +78,9 @@ class box_factures_imp extends ModeleBoxes $sql.= " f.total_ttc,"; $sql.= " f.paye, f.fk_statut, f.rowid as facid"; $sql.= ", sum(pf.amount) as am"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql.= ", ".MAIN_DB_PREFIX."facture as f"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid=pf.fk_facture "; $sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " AND f.entity = ".$conf->entity; From e9c7b020499de09ce33603f7aa7f1c99f67fdd65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sat, 11 Mar 2017 19:22:01 +0100 Subject: [PATCH 03/19] FIX #6507: Statistics counter show wrong total Contract numbers when the user does not have full access Close #6507 --- htdocs/contrat/class/contrat.class.php | 2 +- htdocs/contrat/list.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 81a3d26c818..6ad972a11eb 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2045,7 +2045,7 @@ class Contrat extends CommonObject $sql = "SELECT count(c.rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."contrat as c"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON c.fk_soc = s.rowid"; - if (!$user->rights->contrat->lire && !$user->societe_id) + if (!$user->rights->societe->client->voir && !$user->societe_id) { $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; $sql.= " WHERE sc.fk_user = " .$user->id; diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 57cf487e8e9..ba3e8c0a80d 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -201,7 +201,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) } $sql.= $db->plimit($limit + 1, $offset); - +echo $sql; $resql=$db->query($sql); if ($resql) { From f15c6da8871068f22ea1d889c74b83f6e6393635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sat, 11 Mar 2017 19:24:05 +0100 Subject: [PATCH 04/19] Typo --- htdocs/contrat/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index ba3e8c0a80d..57cf487e8e9 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -201,7 +201,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) } $sql.= $db->plimit($limit + 1, $offset); -echo $sql; + $resql=$db->query($sql); if ($resql) { From e9d5b44009a3e96abbba9b9d6a1e7348d4224e9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 12 Mar 2017 15:31:39 +0100 Subject: [PATCH 05/19] Fixed Project counter showing total amount of projects instead of just the projects current user can see --- htdocs/projet/class/project.class.php | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 1de78f46021..15170a23cbc 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2016 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2013 Florian Henry - * Copyright (C) 2014-2015 Marcos García + * Copyright (C) 2014-2017 Marcos García * * 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 @@ -1689,17 +1689,21 @@ class Project extends CommonObject */ function load_state_board() { - global $conf; + global $user; $this->nb=array(); - - $sql = "SELECT count(u.rowid) as nb"; - $sql.= " FROM ".MAIN_DB_PREFIX."projet as u"; - $sql.= " WHERE"; - //$sql.= " WHERE u.fk_statut > 0"; - //$sql.= " AND employee != 0"; - $sql.= " u.entity IN (".getEntity('projet', 1).")"; - + + $sql = "SELECT DISTINCT + count(p.rowid) as nb +FROM ".MAIN_DB_PREFIX."projet AS p LEFT JOIN ".MAIN_DB_PREFIX."societe AS s ON p.fk_soc = s.rowid + LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status AS cls ON p.fk_opp_status = cls.rowid +WHERE p.entity IN (".getEntity('projet', 1).")"; + + if (! $user->rights->projet->all->lire) { + $projectsListId = $this->getProjectsAuthorizedForUser($user,0,1); + $sql .= "AND p.rowid IN (".$projectsListId.")"; + } + $resql=$this->db->query($sql); if ($resql) { From cd349ab6cc19aadf4292c2cc98b76ab91b0d7d4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Mon, 13 Mar 2017 20:17:31 +0100 Subject: [PATCH 06/19] FIX #6505 Project elements page shows greyed-out links even if the option to show actions not available is disabled Close #6505 --- htdocs/projet/element.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 9fc957fa66b..80cc6b11539 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -612,7 +612,9 @@ foreach ($listofreferent as $key => $value) { $addform.='
'; if ($testnew) $addform.=''.($buttonnew?$langs->trans($buttonnew):$langs->trans("Create")).''; - else $addform.=''.($buttonnew?$langs->trans($buttonnew):$langs->trans("Create")).''; + elseif (empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)) { + $addform.=''.($buttonnew?$langs->trans($buttonnew):$langs->trans("Create")).''; + } $addform.='
'; } 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 07/19] 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; }; - ?> @@ -173,7 +172,8 @@ $genPriceOptions = function($level) use ($price_options) { '; //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print ''; @@ -964,8 +964,7 @@ foreach ($listofreferent as $key => $value) print ''; print ''; From 7df9c25e60e8f586f7f9e3839638eef5ec67b9fa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Mar 2017 12:23:32 +0100 Subject: [PATCH 19/19] Several fixes on multicurrency --- htdocs/comm/propal/card.php | 15 +++++++-- htdocs/commande/card.php | 4 +-- htdocs/compta/facture.php | 4 +-- .../modules/propale/doc/pdf_azur.modules.php | 1 + .../pdf/pdf_canelle.modules.php | 3 +- .../pdf/pdf_muscadet.modules.php | 5 +-- .../doc/pdf_aurore.modules.php | 6 ++-- .../class/fournisseur.commande.class.php | 4 +-- htdocs/fourn/commande/card.php | 4 +-- htdocs/fourn/facture/card.php | 19 +++++------ htdocs/supplier_proposal/card.php | 33 ++++++++++++++++--- 11 files changed, 66 insertions(+), 32 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 99ff663689e..8c1c579b0c2 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1301,8 +1301,18 @@ if ($action == 'create') // Replicate extrafields $objectsrc->fetch_optionals($originid); $object->array_options = $objectsrc->array_options; + + if (!empty($conf->multicurrency->enabled)) + { + if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code; + if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx; + } } } + else + { + if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code; + } $object = new Propal($db); @@ -1480,7 +1490,6 @@ if ($action == 'create') print ''; print ''; print ''; } @@ -2018,7 +2027,7 @@ if ($action == 'create') print '
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); } ?> From 9e944e45251a7d9c4bbe820c27fde6c165b83516 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 17 Mar 2017 12:41:56 +0100 Subject: [PATCH 08/19] Fix: wrong user fetch when same login in different entity --- htdocs/main.inc.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 40d1326c45e..1a832990f38 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -576,9 +576,10 @@ if (! defined('NOLOGIN')) { // We are already into an authenticated session $login=$_SESSION["dol_login"]; - dol_syslog("This is an already logged session. _SESSION['dol_login']=".$login, LOG_DEBUG); + $entity=$_SESSION["dol_entity"]; + dol_syslog("This is an already logged session. _SESSION['dol_login']=".$login." _SESSION['dol_entity']=".$entity, LOG_DEBUG); - $resultFetchUser=$user->fetch('',$login); + $resultFetchUser=$user->fetch('',$login,'',1,($entity > 0 ? $entity : -1)); if ($resultFetchUser <= 0) { // Account has been removed after login From 967f3f579d67c0dcbccbcaf7d51336378eaf677c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Mar 2017 20:07:37 +0100 Subject: [PATCH 09/19] Fix translation --- htdocs/admin/dict.php | 16 +++++++++------- htdocs/langs/en_US/admin.lang | 1 + 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 6a5b8161e73..2e6dc6538e3 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1034,13 +1034,13 @@ if ($id) if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); } if ($fieldlist[$field]=='type_cdr') { $valuetoshow=$langs->trans("AtEndOfMonth"); $align="center"; } if ($fieldlist[$field]=='decalage') { $valuetoshow=$langs->trans("Offset"); } - if ($fieldlist[$field]=='width' || $fieldlist[$field]=='nx') { $valuetoshow=$langs->trans("Width"); } - if ($fieldlist[$field]=='height' || $fieldlist[$field]=='ny') { $valuetoshow=$langs->trans("Height"); } + if ($fieldlist[$field]=='width' || $fieldlist[$field]=='nx') { $valuetoshow=$langs->trans("Width"); } + if ($fieldlist[$field]=='height' || $fieldlist[$field]=='ny') { $valuetoshow=$langs->trans("Height"); } if ($fieldlist[$field]=='unit' || $fieldlist[$field]=='metric') { $valuetoshow=$langs->trans("MeasuringUnit"); } if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $valuetoshow=''; } - if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); } - if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); } - if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); } + if ($fieldlist[$field]=='accountancy_code') { $valuetoshow=$langs->trans("AccountancyCode"); } + if ($fieldlist[$field]=='accountancy_code_sell') { $valuetoshow=$langs->trans("AccountancyCodeSell"); } + if ($fieldlist[$field]=='accountancy_code_buy') { $valuetoshow=$langs->trans("AccountancyCodeBuy"); } if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); } if ($fieldlist[$field]=='account_parent') { $valuetoshow=$langs->trans("Accountparent"); } if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); } @@ -1063,7 +1063,7 @@ if ($id) if ($fieldlist[$field]=='custom_y') { $valuetoshow=$langs->trans("CustomY"); } if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); } if ($fieldlist[$field]=='percent') { $valuetoshow=$langs->trans("Percentage"); } - if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("Info"); } + if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("WithCounter"); } if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); } if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); } @@ -1254,7 +1254,7 @@ if ($id) if ($fieldlist[$field]=='custom_y') { $valuetoshow=$langs->trans("CustomY"); } if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); } if ($fieldlist[$field]=='percent') { $valuetoshow=$langs->trans("Percentage"); } - if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("Info"); } + if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("WithCounter"); } if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); } if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); } @@ -1833,6 +1833,8 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') print ''; $size=''; $class=''; if ($fieldlist[$field]=='code') $class='maxwidth100'; + if ($fieldlist[$field]=='affect') $class='maxwidth50'; + if ($fieldlist[$field]=='delay') $class='maxwidth50'; if ($fieldlist[$field]=='position') $class='maxwidth50'; if ($fieldlist[$field]=='libelle') $class='quatrevingtpercent'; if ($fieldlist[$field]=='tracking') $class='quatrevingtpercent'; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 4a37c0e61bd..213c8d4767e 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -296,6 +296,7 @@ CallUpdatePage=Go to the page that updates the database structure and data: %s. LastStableVersion=Latest stable version LastActivationDate=Latest activation date UpdateServerOffline=Update server offline +WithCounter=Manage a counter GenericMaskCodes=You may enter any numbering mask. In this mask, the following tags could be used:
{000000} corresponds to a number which will be incremented on each %s. Enter as many zeros as the desired length of the counter. The counter will be completed by zeros from the left in order to have as many zeros as the mask.
{000000+000} same as previous but an offset corresponding to the number to the right of the + sign is applied starting on first %s.
{000000@x} same as previous but the counter is reset to zero when month x is reached (x between 1 and 12, or 0 to use the early months of fiscal year defined in your configuration, or 99 to reset to zero every month). If this option is used and x is 2 or higher, then sequence {yy}{mm} or {yyyy}{mm} is also required.
{dd} day (01 to 31).
{mm} month (01 to 12).
{yy}, {yyyy} or {y} year over 2, 4 or 1 numbers.
GenericMaskCodes2={cccc} the client code on n characters
{cccc000} the client code on n characters is followed by a counter dedicated for customer. This counter dedicated to customer is reset at same time than global counter.
{tttt} The code of third party type on n characters (see dictionary-thirdparty types).
GenericMaskCodes3=All other characters in the mask will remain intact.
Spaces are not allowed.
From b7442a0c1a238f3347d08da084074dad4fc615d7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Mar 2017 14:51:25 +0100 Subject: [PATCH 10/19] Fix bad vat rate used into sql request --- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 7d1d5fbdf1d..8d45b11beb3 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2316,7 +2316,7 @@ class CommandeFournisseur extends CommonOrder if (preg_match('/\((.*)\)/', $txtva, $reg)) { $vat_src_code = $reg[1]; - $vatrate = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. + $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. } $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise); From ac19aba07edbbbb18bbaaa7cc4c0d03898ac57b9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Mar 2017 15:37:07 +0100 Subject: [PATCH 11/19] FIX multicurrency management on supplier order/invoice Conflicts: htdocs/core/modules/supplier_payment/pdf/pdf_cow.modules.php --- .../modules/dons/html_cerfafr.modules.php | 9 ++- .../doc/pdf_standard.modules.php | 4 +- .../modules/facture/doc/pdf_crabe.modules.php | 2 + .../pdf/pdf_canelle.modules.php | 28 ++++--- .../pdf/pdf_muscadet.modules.php | 31 ++++---- .../doc/pdf_aurore.modules.php | 6 +- htdocs/fourn/commande/card.php | 74 ++++++------------- 7 files changed, 73 insertions(+), 81 deletions(-) diff --git a/htdocs/core/modules/dons/html_cerfafr.modules.php b/htdocs/core/modules/dons/html_cerfafr.modules.php index 314d5779ede..5e557f95f33 100644 --- a/htdocs/core/modules/dons/html_cerfafr.modules.php +++ b/htdocs/core/modules/dons/html_cerfafr.modules.php @@ -69,9 +69,10 @@ class html_cerfafr extends ModeleDon * * @param Don $don Donation object * @param Translate $outputlangs Lang object for output language + * @param string $currency Currency code * @return int >0 if OK, <0 if KO */ - function write_file($don,$outputlangs) + function write_file($don,$outputlangs,$currency='') { global $user,$conf,$langs,$mysoc; @@ -87,7 +88,9 @@ class html_cerfafr extends ModeleDon $outputlangs->load("products"); $outputlangs->load("donations"); - if (! empty($conf->don->dir_output)) + $currency = !empty($currency) ? $currency : $conf->currency; + + if (! empty($conf->don->dir_output)) { // Definition of the object don (for upward compatibility) if (! is_object($don)) @@ -165,7 +168,7 @@ class html_cerfafr extends ModeleDon //$form = str_replace('__IP__',$user->ip,$form); // TODO $user->ip not exist $form = str_replace('__AMOUNT__',$don->amount,$form); $form = str_replace('__AMOUNTLETTERS__',chiffre_en_lettre($don->amount),$form); - $form = str_replace('__CURRENCY__',$outputlangs->transnoentitiesnoconv("Currency".$conf->currency),$form); + $form = str_replace('__CURRENCY__',$outputlangs->transnoentitiesnoconv("Currency".$currency),$form); $form = str_replace('__CURRENCYCODE__',$conf->currency,$form); $form = str_replace('__MAIN_INFO_SOCIETE_NOM__',$mysoc->name,$form); $form = str_replace('__MAIN_INFO_SOCIETE_ADDRESS__',$mysoc->address,$form); diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index abc40f23005..3aa1c95ae69 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -718,6 +718,7 @@ class pdf_standard extends ModeleExpenseReport * @param Translate $outputlangs Output langs * @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title * @param int $hidebottom Hide bottom bar of array + * @param string $currency Currency code * @return void */ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0) @@ -728,12 +729,13 @@ class pdf_standard extends ModeleExpenseReport $hidebottom=0; if ($hidetop) $hidetop=-1; + $currency = !empty($currency) ? $currency : $conf->currency; $default_font_size = pdf_getPDFFontSize($outputlangs); // Amount in (at tab_top - 1) $pdf->SetTextColor(0,0,0); $pdf->SetFont('','', $default_font_size - 2); - $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency)); + $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$currency)); $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 4), $tab_top -4); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index fc9bae07c9c..c1682c78087 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1070,6 +1070,8 @@ class pdf_crabe extends ModelePDFFactures } else { + // FIXME amount of vat not supported with multicurrency + //Local tax 1 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ 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 dd29a839a48..9865fc86136 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -388,8 +388,9 @@ class pdf_canelle extends ModelePDFSuppliersInvoices } // Unit price before discount + $up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails); $pdf->SetXY($this->posxup, $curY); - $pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, price($object->lines[$i]->pu_ht), 0, 'R', 0); + $pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, $up_excl_tax, 0, 'R', 0); // Unit price before discount $up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails); @@ -466,11 +467,11 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->setPage($pagenb); if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } $this->_pagefoot($pdf,$object,$outputlangs,1); $pagenb++; @@ -482,11 +483,11 @@ class pdf_canelle extends ModelePDFSuppliersInvoices { if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } $this->_pagefoot($pdf,$object,$outputlangs,1); // New page @@ -500,12 +501,12 @@ class pdf_canelle extends ModelePDFSuppliersInvoices // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code); $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code); $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } @@ -593,8 +594,10 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->SetFillColor(255,255,255); $pdf->SetXY($col1x, $tab2_top + 0); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); + + $total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht); $pdf->SetXY($col2x, $tab2_top + 0); - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + $object->remise), 0, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + $object->remise), 0, 'R', 1); // Show VAT by rates and total $pdf->SetFillColor(248,248,248); @@ -719,8 +722,9 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->SetFillColor(224,224,224); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); + $total_ttc = ($conf->multicurrency->enabled && $object->multiccurency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc), $useborder, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc), $useborder, 'R', 1); if ($deja_regle > 0) { @@ -757,9 +761,10 @@ class pdf_canelle extends ModelePDFSuppliersInvoices * @param Translate $outputlangs Langs object * @param int $hidetop Hide top bar of array * @param int $hidebottom Hide bottom bar of array + * @param string $currency Currency code * @return void */ - function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0) + function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='') { global $conf; @@ -767,6 +772,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $hidebottom=0; if ($hidetop) $hidetop=-1; + $currency = !empty($currency) ? $currency : $conf->currency; $default_font_size = pdf_getPDFFontSize($outputlangs); // Amount in (at tab_top - 1) @@ -775,7 +781,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices if (empty($hidetop)) { - $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency)); + $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$currency)); $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); 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 111fe12d9ec..2c699190a7c 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -400,8 +400,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders } // Unit price before discount + $up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails); $pdf->SetXY($this->posxup, $curY); - $pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, price($object->lines[$i]->subprice), 0, 'R', 0); + $pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, $up_excl_tax, 0, 'R', 0); // Quantity $pdf->SetXY($this->posxqty, $curY); @@ -489,11 +490,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->setPage($pagenb); if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } $this->_pagefoot($pdf,$object,$outputlangs,1); $pagenb++; @@ -505,11 +506,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders { if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } $this->_pagefoot($pdf,$object,$outputlangs,1); // New page @@ -523,12 +524,12 @@ class pdf_muscadet extends ModelePDFSuppliersOrders // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code); $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code); $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } @@ -691,8 +692,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetXY($col1x, $tab2_top + 0); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); + $total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht); $pdf->SetXY($col2x, $tab2_top + 0); - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + (! empty($object->remise)?$object->remise:0)), 0, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (! empty($object->remise)?$object->remise:0)), 0, 'R', 1); // Show VAT by rates and total $pdf->SetFillColor(248,248,248); @@ -826,8 +828,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetFillColor(224,224,224); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); + $total_ttc = ($conf->multicurrency->enabled && $object->multiccurency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc), $useborder, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc), $useborder, 'R', 1); $pdf->SetFont('','', $default_font_size - 1); $pdf->SetTextColor(0,0,0); @@ -876,9 +879,10 @@ class pdf_muscadet extends ModelePDFSuppliersOrders * @param Translate $outputlangs Langs object * @param int $hidetop Hide top bar of array * @param int $hidebottom Hide bottom bar of array + * @param string $currency Currency code * @return void */ - function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0) + function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='') { global $conf; @@ -886,6 +890,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $hidebottom=0; if ($hidetop) $hidetop=-1; + $currency = !empty($currency) ? $currency : $conf->currency; $default_font_size = pdf_getPDFFontSize($outputlangs); // Amount in (at tab_top - 1) @@ -894,7 +899,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders if (empty($hidetop)) { - $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency)); + $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$currency)); $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); @@ -1073,14 +1078,14 @@ class pdf_muscadet extends ModelePDFSuppliersOrders if (! empty($object->date_commande)) { - $posy+=4; + $posy+=5; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : " . dol_print_date($object->date_commande,"day",false,$outputlangs,true), '', 'R'); } else { - $posy+=4; + $posy+=5; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(255,0,0); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderToProcess"), '', 'R'); diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index 32c8eb23cbb..650be00c25d 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -1089,9 +1089,10 @@ class pdf_aurore extends ModelePDFSupplierProposal * @param Translate $outputlangs Langs object * @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title * @param int $hidebottom Hide bottom bar of array + * @param string $currency Currency code * @return void */ - function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0) + function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='') { global $conf; @@ -1099,6 +1100,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $hidebottom=0; if ($hidetop) $hidetop=-1; + $currency = !empty($currency) ? $currency : $conf->currency; $default_font_size = pdf_getPDFFontSize($outputlangs); // Amount in (at tab_top - 1) @@ -1107,7 +1109,7 @@ class pdf_aurore extends ModelePDFSupplierProposal if (empty($hidetop)) { - $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency)); + $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$currency)); $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 736cb8340d3..fb6bc840354 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -877,38 +877,10 @@ if (empty($reshook)) } } - if ($action == 'builddoc' && $user->rights->fournisseur->commande->creer) // En get ou en post - { - // Build document - - // Save last template used to generate document - if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha')); - - $outputlangs = $langs; - if (GETPOST('lang_id')) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang(GETPOST('lang_id')); - } - $result= $object->generateDocument($object->modelpdf,$outputlangs, $hidedetails, $hidedesc, $hideref); - if ($result <= 0) - { - setEventMessages($object->error, $object->errors, 'errors'); - $action=''; - } - } - - // Delete file in doc form - if ($action == 'remove_file' && $object->id > 0 && $user->rights->fournisseur->commande->creer) - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $langs->load("other"); - $upload_dir = $conf->fournisseur->commande->dir_output; - $file = $upload_dir . '/' . GETPOST('file'); - $ret=dol_delete_file($file,0,0,0,$object); - if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); - else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); - } + // Actions to build doc + $upload_dir = $conf->commande->dir_output; + $permissioncreate = $user->rights->fournisseur->commande->creer; + include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; if ($action == 'update_extras') { @@ -2001,9 +1973,27 @@ elseif (! empty($object->id)) print '
'; print ''; + + if (!empty($conf->multicurrency->enabled)) + { + // Multicurrency Amount HT + print ''; + print ''; + print ''; + + // Multicurrency Amount VAT + print ''; + print ''; + print ''; + + // Multicurrency Amount TTC + print ''; + print ''; + print ''; + } // Total - print ''; + print ''; print ''; print ''; @@ -2029,24 +2019,6 @@ elseif (! empty($object->id)) print ''; print ''; - if (!empty($conf->multicurrency->enabled)) - { - // Multicurrency Amount HT - print ''; - print ''; - print ''; - - // Multicurrency Amount VAT - print ''; - print ''; - print ''; - - // Multicurrency Amount TTC - print ''; - print ''; - print ''; - } - print '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
'.$langs->trans("AmountHT").'
'.$langs->trans("AmountHT").''.price($object->total_ht,'',$langs,1,-1,-1,$conf->currency).'
'.$langs->trans("AmountTTC").''.price($object->total_ttc,'',$langs,1,-1,-1,$conf->currency).'
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
'; // Margin Infos From 80f7bce8d8d7c59bb6202ec7b5fc21f66565353d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Mar 2017 20:41:43 +0100 Subject: [PATCH 12/19] Fix duplicate --- htdocs/compta/bank/ligne.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php index 609a3f47bd1..8c1f2af7b1f 100644 --- a/htdocs/compta/bank/ligne.php +++ b/htdocs/compta/bank/ligne.php @@ -311,13 +311,9 @@ if ($result) print ''; } else if ($links[$key]['type']=='company') { - print ''; - //print img_object($langs->trans('ShowCompany'),'company').' '; $societe=new Societe($db); $societe->fetch($links[$key]['url_id']); - //print $links[$key]['label']; print $societe->getNomUrl(1); - print ''; } else if ($links[$key]['type']=='sc') { print ''; From 36630b94046af3f7b35c961632ab0d62bf8ef145 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Mar 2017 13:01:32 +0100 Subject: [PATCH 13/19] FIX Picto of project on dol_banner and box Conflicts: htdocs/core/boxes/box_project.php --- htdocs/core/boxes/box_project.php | 14 +++++++------- htdocs/core/lib/functions.lib.php | 6 ++++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index 4c0689cd282..8b5cbc342e6 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -78,7 +78,7 @@ class box_project extends ModeleBoxes // list the summary of the orders if ($user->rights->projet->lire) { - $sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut "; + $sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut, p.public"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; if($user->socid) $sql.= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=p.fk_soc"; $sql.= " WHERE p.entity = ".$conf->entity; @@ -98,7 +98,7 @@ class box_project extends ModeleBoxes $tooltip = $langs->trans('Project') . ': ' . $objp->ref; $this->info_box_contents[$i][0] = array( 'td' => 'align="left" width="16"', - 'logo' => 'object_project', + 'logo' => 'object_project'.($objp->public?'pub':''), 'tooltip' => $tooltip, 'url' => DOL_URL_ROOT."/projet/card.php?id=".$objp->rowid, ); @@ -123,13 +123,13 @@ class box_project extends ModeleBoxes if ($resultTask) { $objTask = $db->fetch_object($resultTask); $this->info_box_contents[$i][3] = array( - 'td' => 'align="right"', - 'text' => number_format($objTask->nb, 0, ',', ' ')." ".$langs->trans("Tasks"), + 'td' => 'class="right"', + 'text' => $objTask->nb." ".$langs->trans("Tasks"), ); - if ($objTask->nb > 0 ) + if ($objTask->nb > 0) $this->info_box_contents[$i][4] = array( - 'td' => 'align="right"', - 'text' => number_format(($objTask->totprogress/$objTask->nb), 0, ',', ' ')."%", + 'td' => 'class="right"', + 'text' => round($objTask->totprogress/$objTask->nb, 0)."%", ); else $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => "N/A "); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 709dc58d769..b2de5ff9d54 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1024,7 +1024,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r $morehtmlleft.=''; } } - elseif ($conf->browser->layout != 'phone') // Show no photo link + elseif ($conf->browser->layout != 'phone') // Show No photo link (picto of pbject) { $morehtmlleft.='
'; if ($object->element == 'action') @@ -1036,7 +1036,9 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r else { $width=14; $cssclass='photorefcenter'; - $nophoto=img_picto('', 'object_'.$object->picto, '', false, 1); + $picto = $object->picto; + if ($object->element == 'project' && ! $object->public) $picto = 'project'; // instead of projectpub + $nophoto=img_picto('', 'object_'.$picto, '', false, 1); $morehtmlleft.='
No photo
'; } $morehtmlleft.='
'; From e2e76b40dacaca429caeabc3f648de8b56282678 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Mar 2017 13:38:00 +0100 Subject: [PATCH 14/19] FIX list of projects Conflicts: htdocs/core/boxes/box_project.php --- htdocs/core/boxes/box_project.php | 46 +++++++++++++++++++++---------- htdocs/projet/list.php | 3 +- 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index 8b5cbc342e6..a47ae3d0cb5 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -72,27 +72,40 @@ class box_project extends ModeleBoxes $totalnb = 0; $totalnbTask=0; - $textHead = $langs->trans("Projects"); + $textHead = $langs->trans("OpenedProjects"); $this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead)); // list the summary of the orders if ($user->rights->projet->lire) { - - $sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut, p.public"; + + include_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'); + $projectstatic = new Project($this->db); + + $socid=$user->societe_id; + + // Get list of project id allowed to user (in a string list separated by coma) + $projectsListId=''; + if (! $user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1,$socid); + + $sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut, p.public"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; if($user->socid) $sql.= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=p.fk_soc"; - $sql.= " WHERE p.entity = ".$conf->entity; - if($user->socid) $sql.= " AND s.rowid = ".$user->socid; + $sql.= " WHERE p.entity IN (".getEntity('project',1).')'; + if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; // public and assigned to, or restricted to company for external users + if ($user->socid) $sql.= " AND s.rowid = ".$user->socid; $sql.= " AND p.fk_statut = 1"; // Seulement les projets ouverts - $sql.= " ORDER BY p.datec DESC"; - $sql.= $db->plimit($max, 0); + if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; + if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))"; + + $sql.= " ORDER BY p.datec DESC"; + //$sql.= $db->plimit($max, 0); $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); $i = 0; - while ($i < $num) { + while ($i < min($num, $max)) { $objp = $db->fetch_object($result); $tooltip = $langs->trans('Project') . ': ' . $objp->ref; @@ -117,8 +130,8 @@ class box_project extends ModeleBoxes $sql ="SELECT count(*) as nb, sum(progress) as totprogress"; $sql.=" FROM ".MAIN_DB_PREFIX."projet as p LEFT JOIN ".MAIN_DB_PREFIX."projet_task as pt on pt.fk_projet = p.rowid"; - $sql.=" WHERE p.entity = ".$conf->entity; - $sql.=" AND p.rowid = ".$objp->rowid; + $sql.= " WHERE p.entity IN (".getEntity('project',1).')'; + $sql.=" AND p.rowid = ".$objp->rowid; $resultTask = $db->query($sql); if ($resultTask) { $objTask = $db->fetch_object($resultTask); @@ -135,12 +148,17 @@ class box_project extends ModeleBoxes $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => "N/A "); $totalnbTask += $objTask->nb; } else { - $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => number_format(0, 0, ',', ' ')); - $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => "N/A "); + $this->info_box_contents[$i][3] = array('td' => 'class="right"', 'text' => round(0)); + $this->info_box_contents[$i][4] = array('td' => 'class="right"', 'text' => "N/A "); } $i++; } + if ($max < $num) + { + $this->info_box_contents[$i][0] = array('td' => 'colspan="5"', 'text' => '...'); + $i++; + } } } @@ -158,11 +176,11 @@ class box_project extends ModeleBoxes ); $this->info_box_contents[$i][2] = array( 'td' => 'align="right" ', - 'text' => number_format($num, 0, ',', ' ')." ".$langs->trans("Projects"), + 'text' => round($num, 0)." ".$langs->trans("Projects"), ); $this->info_box_contents[$i][3] = array( 'td' => 'align="right" ', - 'text' => number_format($totalnbTask, 0, ',', ' ')." ".$langs->trans("Tasks"), + 'text' => (($max < $num) ? '' : (round($totalnbTask, 0)." ".$langs->trans("Tasks"))), ); $this->info_box_contents[$i][4] = array( 'td' => '', diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 68077621771..dadc199d146 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -196,6 +196,7 @@ $title=$langs->trans("Projects"); if ($search_user == $user->id) $title=$langs->trans("MyProjects"); // Get list of project id allowed to user (in a string list separated by coma) +$projectsListId=''; if (! $user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1,$socid); // Get id of types of contacts for projects (This list never contains a lot of elements) @@ -245,7 +246,7 @@ if ($search_user > 0) $sql.= " WHERE p.entity IN (".getEntity('project',1).')'; if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; // public and assigned to, or restricted to company for external users // No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser -if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; +if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ); if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL"; if ($search_ref) $sql .= natural_search('p.ref', $search_ref); From 4457bc33cd8b2acb56ae5f344c0782720b251337 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Mar 2017 14:23:55 +0100 Subject: [PATCH 15/19] Fix english translation --- htdocs/langs/en_US/admin.lang | 2 +- htdocs/langs/en_US/bills.lang | 24 ++++++++++++------------ htdocs/langs/en_US/companies.lang | 2 +- htdocs/langs/en_US/compta.lang | 6 +++--- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 213c8d4767e..2df0ffcc9d4 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -82,7 +82,7 @@ Mask=Mask NextValue=Next value NextValueForInvoices=Next value (invoices) NextValueForCreditNotes=Next value (credit notes) -NextValueForDeposit=Next value (deposit) +NextValueForDeposit=Next value (down payment) NextValueForReplacements=Next value (replacements) MustBeLowerThanPHPLimit=Note: your PHP limits each file upload's size to %s %s, whatever this parameter's value is NoMaxSizeByPHPLimit=Note: No limit is set in your PHP configuration diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 7d9fcf3aa63..9ea58263dfd 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -15,9 +15,9 @@ DisabledBecauseNotErasable=Disabled because cannot be erased InvoiceStandard=Standard invoice InvoiceStandardAsk=Standard invoice InvoiceStandardDesc=This kind of invoice is the common invoice. -InvoiceDeposit=Deposit invoice -InvoiceDepositAsk=Deposit invoice -InvoiceDepositDesc=This kind of invoice is done when a deposit has been received. +InvoiceDeposit=Down payment invoice +InvoiceDepositAsk=Down payment invoice +InvoiceDepositDesc=This kind of invoice is done when a down payment has been received. InvoiceProForma=Proforma invoice InvoiceProFormaAsk=Proforma invoice InvoiceProFormaDesc=Proforma invoice is an image of a true invoice but has no accountancy value. @@ -63,7 +63,7 @@ paymentInInvoiceCurrency=in invoices currency PaidBack=Paid back DeletePayment=Delete payment ConfirmDeletePayment=Are you sure you want to delete this payment? -ConfirmConvertToReduc=Do you want to convert this credit note or deposit into an absolute discount?
The amount will so be saved among all discounts and could be used as a discount for a current or a future invoice for this customer. +ConfirmConvertToReduc=Do you want to convert this credit note or down payment into an absolute discount?
The amount will so be saved among all discounts and could be used as a discount for a current or a future invoice for this customer. SupplierPayments=Suppliers payments ReceivedPayments=Received payments ReceivedCustomersPayments=Payments received from customers @@ -196,12 +196,12 @@ ShowBill=Show invoice ShowInvoice=Show invoice ShowInvoiceReplace=Show replacing invoice ShowInvoiceAvoir=Show credit note -ShowInvoiceDeposit=Show deposit invoice +ShowInvoiceDeposit=Show down payment invoice ShowInvoiceSituation=Show situation invoice ShowPayment=Show payment AlreadyPaid=Already paid AlreadyPaidBack=Already paid back -AlreadyPaidNoCreditNotesNoDeposits=Already paid (without credit notes and deposits) +AlreadyPaidNoCreditNotesNoDeposits=Already paid (without credit notes and down payments) Abandoned=Abandoned RemainderToPay=Remaining unpaid RemainderToTake=Remaining amount to take @@ -268,10 +268,10 @@ RelativeDiscount=Relative discount GlobalDiscount=Global discount CreditNote=Credit note CreditNotes=Credit notes -Deposit=Deposit -Deposits=Deposits +Deposit=Down payment +Deposits=Down payments DiscountFromCreditNote=Discount from credit note %s -DiscountFromDeposit=Payments from deposit invoice %s +DiscountFromDeposit=Down payments from invoice %s AbsoluteDiscountUse=This kind of credit can be used on invoice before its validation CreditNoteDepositUse=Invoice must be validated to use this kind of credits NewGlobalDiscount=New absolute discount @@ -422,7 +422,7 @@ ChequeDeposits=Checks deposits Cheques=Checks DepositId=Id deposit NbCheque=Number of checks -CreditNoteConvertedIntoDiscount=This credit note or deposit invoice has been converted into %s +CreditNoteConvertedIntoDiscount=This credit note or down payment invoice has been converted into %s UsBillingContactAsIncoiveRecipientIfExist=Use customer billing contact address instead of third party address as recipient for invoices ShowUnpaidAll=Show all unpaid invoices ShowUnpaidLateOnly=Show late unpaid invoices only @@ -451,9 +451,9 @@ YouMustCreateStandardInvoiceFirstDesc=You have to create a standard invoice firs PDFCrabeDescription=Invoice PDF template Crabe. A complete invoice template (recommended Template) PDFCrevetteDescription=Invoice PDF template Crevette. A complete invoice template for situation invoices TerreNumRefModelDesc1=Return number with format %syymm-nnnn for standard invoices and %syymm-nnnn for credit notes where yy is year, mm is month and nnnn is a sequence with no break and no return to 0 -MarsNumRefModelDesc1=Return number with format %syymm-nnnn for standard invoices, %syymm-nnnn for replacement invoices, %syymm-nnnn for deposit invoices and %syymm-nnnn for credit notes where yy is year, mm is month and nnnn is a sequence with no break and no return to 0 +MarsNumRefModelDesc1=Return number with format %syymm-nnnn for standard invoices, %syymm-nnnn for replacement invoices, %syymm-nnnn for down payment invoices and %syymm-nnnn for credit notes where yy is year, mm is month and nnnn is a sequence with no break and no return to 0 TerreNumRefModelError=A bill starting with $syymm already exists and is not compatible with this model of sequence. Remove it or rename it to activate this module. -CactusNumRefModelDesc1=Return number with format %syymm-nnnn for standard invoices, %syymm-nnnn for credit notes and %syymm-nnnn for deposit invoices where yy is year, mm is month and nnnn is a sequence with no break and no return to 0 +CactusNumRefModelDesc1=Return number with format %syymm-nnnn for standard invoices, %syymm-nnnn for credit notes and %syymm-nnnn for down payment invoices where yy is year, mm is month and nnnn is a sequence with no break and no return to 0 ##### Types de contacts ##### TypeContact_facture_internal_SALESREPFOLL=Representative following-up customer invoice TypeContact_facture_external_BILLING=Customer invoice contact diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 355f9f3f31c..45e7864e0d4 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -254,7 +254,7 @@ CustomerRelativeDiscountShort=Relative discount CustomerAbsoluteDiscountShort=Absolute discount CompanyHasRelativeDiscount=This customer has a default discount of %s%% CompanyHasNoRelativeDiscount=This customer has no relative discount by default -CompanyHasAbsoluteDiscount=This customer still has discount credits or deposits for %s %s +CompanyHasAbsoluteDiscount=This customer has discount available (credits notes or down payments) for %s %s CompanyHasCreditNote=This customer still has credit notes for %s %s CompanyHasNoAbsoluteDiscount=This customer has no discount credit available CustomerAbsoluteDiscountAllUsers=Absolute discounts (granted by all users) diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index 08f17ed995e..a4080b76b07 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -133,8 +133,8 @@ RulesResultDue=- It includes outstanding invoices, expenses, VAT, donations whet RulesResultInOut=- It includes the real payments made on invoices, expenses, VAT and salaries.
- It is based on the payment dates of the invoices, expenses, VAT and salaries. The donation date for donation. RulesCADue=- It includes the client's due invoices whether they are paid or not.
- It is based on the validation date of these invoices.
RulesCAIn=- It includes all the effective payments of invoices received from clients.
- It is based on the payment date of these invoices
-DepositsAreNotIncluded=- Deposit invoices are nor included -DepositsAreIncluded=- Deposit invoices are included +DepositsAreNotIncluded=- Down payment invoices are nor included +DepositsAreIncluded=- Down payment invoices are included LT2ReportByCustomersInInputOutputModeES=Report by third party IRPF LT1ReportByCustomersInInputOutputModeES=Report by third party RE VATReport=VAT report @@ -168,7 +168,7 @@ DescSellsJournal=Sales Journal DescPurchasesJournal=Purchases Journal InvoiceRef=Invoice ref. CodeNotDef=Not defined -WarningDepositsNotIncluded=Deposits invoices are not included in this version with this accountancy module. +WarningDepositsNotIncluded=Down payment invoices are not included in this version with this accountancy module. DatePaymentTermCantBeLowerThanObjectDate=Payment term date can't be lower than object date. Pcg_version=Chart of accounts models Pcg_type=Pcg type From 1e63b9873181cc0ad5907f0d03cbfb6df43f513f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Mar 2017 17:06:27 +0100 Subject: [PATCH 16/19] Fix responsive --- htdocs/core/boxes/box_produits.php | 10 +++++----- htdocs/core/boxes/box_produits_alerte_stock.php | 10 +++++----- htdocs/core/boxes/box_services_contracts.php | 2 +- htdocs/theme/eldy/style.css.php | 9 ++++++++- htdocs/theme/md/style.css.php | 8 +++++++- 5 files changed, 26 insertions(+), 13 deletions(-) diff --git a/htdocs/core/boxes/box_produits.php b/htdocs/core/boxes/box_produits.php index 5cce3254bfb..51ee156fbeb 100644 --- a/htdocs/core/boxes/box_produits.php +++ b/htdocs/core/boxes/box_produits.php @@ -106,13 +106,13 @@ class box_produits extends ModeleBoxes $productstatic->entity = $objp->entity; $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $productstatic->getNomUrl(1), 'asis' => 1, ); $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => 'class="tdoverflowmax100 maxwidth100onsmartphone"', 'text' => $objp->label, ); @@ -144,7 +144,7 @@ class box_produits extends ModeleBoxes ); $this->info_box_contents[$line][] = array( - 'td' => 'align="left" class="nowrap"', + 'td' => 'class="nowrap"', 'text' => $price_base_type, ); @@ -174,14 +174,14 @@ class box_produits extends ModeleBoxes $db->free($result); } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql), ); } } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $langs->trans("ReadPermissionNotAllowed"), ); } diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index 3ec0fc7070c..884cf92b52a 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -113,13 +113,13 @@ class box_produits_alerte_stock extends ModeleBoxes $productstatic->entity = $objp->entity; $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $productstatic->getNomUrl(1), 'asis' => 1, ); $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => 'class="tdoverflowmax100 maxwidth100onsmartphone"', 'text' => $objp->label, ); @@ -153,7 +153,7 @@ class box_produits_alerte_stock extends ModeleBoxes ); $this->info_box_contents[$line][] = array( - 'td' => 'align="left" class="nowrap"', + 'td' => 'class="nowrap"', 'text' => $price_base_type, ); @@ -180,7 +180,7 @@ class box_produits_alerte_stock extends ModeleBoxes else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql), ); @@ -188,7 +188,7 @@ class box_produits_alerte_stock extends ModeleBoxes } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $langs->trans("ReadPermissionNotAllowed"), ); } diff --git a/htdocs/core/boxes/box_services_contracts.php b/htdocs/core/boxes/box_services_contracts.php index 752509a0616..4d7759ff081 100644 --- a/htdocs/core/boxes/box_services_contracts.php +++ b/htdocs/core/boxes/box_services_contracts.php @@ -135,7 +135,7 @@ class box_services_contracts extends ModeleBoxes 'asis' => 1 ); - $this->info_box_contents[$i][] = array('td' => '', + $this->info_box_contents[$i][] = array('td' => 'class="tdoverflowmax100 maxwidth100onsmartphone"', 'text' => $thirdpartytmp->getNomUrl(1), 'asis' => 1 ); diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 7c699c31e7f..966493861c8 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -2973,8 +2973,15 @@ div.tabBar .noborder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; - width: 110px; + width: 115px; } +@media only screen and (max-width: 767px) +{ + .boxstats { + width: 100px; + } +} + .boxstats:hover { box-shadow: 0px 0px 8px 0px rgba(0,0,0,0.20); } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 4c5016268a8..c2d76f9d9d0 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2854,7 +2854,13 @@ div .tdtop { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; - width: 110px; + width: 115px; +} +@media only screen and (max-width: 767px) +{ + .boxstats { + width: 100px; + } } .boxstats:hover { box-shadow: 0px 0px 8px 0px rgba(0,0,0,0.20); From e6637422d510caefbe4e8761557e698b9f64ce00 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Mar 2017 17:58:41 +0100 Subject: [PATCH 17/19] Fix with on smartphone --- htdocs/expensereport/info.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/expensereport/info.php b/htdocs/expensereport/info.php index 21ee44df97a..0ea405e08c3 100644 --- a/htdocs/expensereport/info.php +++ b/htdocs/expensereport/info.php @@ -39,6 +39,9 @@ $result = restrictedArea($user, 'expensereport', $id, 'expensereport'); /* * View */ + +$form = new Form($db); + $title=$langs->trans("ExpenseReport") . " - " . $langs->trans("Info"); $helpurl="EN:Module_Expense_Reports"; llxHeader("",$title,$helpurl); From 61031f1633807a5a3397496f12109bab332fd15d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Mar 2017 19:10:43 +0100 Subject: [PATCH 18/19] FIX Missing total on project overview. --- htdocs/projet/element.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 80cc6b11539..0e83fbe26a1 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -956,7 +956,7 @@ foreach ($listofreferent as $key => $value) print '
'; if (empty($value['disableamount'])) { - if (! empty($conf->salaries->enabled)) print ''.$langs->trans("TotalHT").' : '.price($total_ht); + if ($tablename != 'projet_task' || ! empty($conf->salaries->enabled)) print ''.$langs->trans("TotalHT").' : '.price($total_ht); } print ''.$langs->trans("TotalTTC").' : '.price($total_ttc).''; if (empty($value['disableamount'])) { - - if (! empty($conf->salaries->enabled)) print $langs->trans("TotalTTC").' : '.price($total_ttc); + if ($tablename != 'projet_task' || ! empty($conf->salaries->enabled)) print $langs->trans("TotalTTC").' : '.price($total_ttc); } print ' 
'.fieldLabel('Currency','multicurrency_code').''; - $currency_code = (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency)); print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 0); print '
'; - if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon)) + if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) print ''; print '
'; print fieldLabel('CurrencyRate','multicurrency_tx'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; print ''; @@ -2029,7 +2038,7 @@ if ($action == 'create') $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); } else { $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); - if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code != $conf->currency) { + if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { print '
        '; print ''.$langs->trans("ActualizeCurrency").''; print '
'; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index fda37a88467..749f40fef4e 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2213,7 +2213,7 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; - if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon)) + if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) print ''; print '
'; print fieldLabel('CurrencyRate','multicurrency_tx'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; print ''; @@ -2224,7 +2224,7 @@ if ($action == 'create' && $user->rights->commande->creer) $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); } else { $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); - if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code != $conf->currency) { + if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { print '
        '; print ''.$langs->trans("ActualizeCurrency").''; print '
'; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 73959687527..b71dbe0cc70 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3257,7 +3257,7 @@ else if ($id > 0 || ! empty($ref)) print ''; - if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon)) + if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) print ''; print '
'; print fieldLabel('CurrencyRate','multicurrency_tx'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; print ''; @@ -3268,7 +3268,7 @@ else if ($id > 0 || ! empty($ref)) $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); } else { $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); - if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code != $conf->currency) { + if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { print '
        '; print ''.$langs->trans("ActualizeCurrency").''; print '
'; diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 41cd29f8b35..972a75eecc8 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -554,6 +554,7 @@ class pdf_azur extends ModelePDFPropales // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva; else $tvaligne=$object->lines[$i]->total_tva; + $localtax1ligne=$object->lines[$i]->total_localtax1; $localtax2ligne=$object->lines[$i]->total_localtax2; $localtax1_rate=$object->lines[$i]->localtax1_tx; 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 9865fc86136..1e7e6f4bcad 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -430,7 +430,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0); // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva - $tvaligne=$object->lines[$i]->total_tva; + if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva; + else $tvaligne=$object->lines[$i]->total_tva; $localtax1ligne=$object->lines[$i]->total_localtax1; $localtax2ligne=$object->lines[$i]->total_localtax2; 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 2c699190a7c..c882ed89800 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -437,8 +437,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0); // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva - $tvaligne=$object->lines[$i]->total_tva; - + if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva; + else $tvaligne=$object->lines[$i]->total_tva; + $localtax1ligne=$object->lines[$i]->total_localtax1; $localtax2ligne=$object->lines[$i]->total_localtax2; $localtax1_rate=$object->lines[$i]->localtax1_tx; diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index 650be00c25d..3b2812c7b90 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -460,7 +460,9 @@ class pdf_aurore extends ModelePDFSupplierProposal */ // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva - $tvaligne=$object->lines[$i]->total_tva; + if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva; + else $tvaligne=$object->lines[$i]->total_tva; + $localtax1ligne=$object->lines[$i]->total_localtax1; $localtax2ligne=$object->lines[$i]->total_localtax2; $localtax1_rate=$object->lines[$i]->localtax1_tx; @@ -560,7 +562,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs); // Affiche zone totaux - $posy=$this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs); + //$posy=$this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs); // Affiche zone versements /* diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 8d45b11beb3..1616df39503 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -176,7 +176,7 @@ class CommandeFournisseur extends CommonOrder // Check parameters if (empty($id) && empty($ref)) return -1; - $sql = "SELECT c.rowid, c.ref, ref_supplier, c.fk_soc, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.tva,"; + $sql = "SELECT c.rowid, c.ref, ref_supplier, c.fk_soc, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_vat,"; $sql.= " c.localtax1, c.localtax2, "; $sql.= " c.date_creation, c.date_valid, c.date_approve, c.date_approve2,"; $sql.= " c.fk_user_author, c.fk_user_valid, c.fk_user_approve, c.fk_user_approve2,"; @@ -222,7 +222,7 @@ class CommandeFournisseur extends CommonOrder $this->user_approve_id = $obj->fk_user_approve; $this->user_approve_id2 = $obj->fk_user_approve2; $this->total_ht = $obj->total_ht; - $this->total_tva = $obj->tva; + $this->total_tva = $obj->total_vat; $this->total_localtax1 = $obj->localtax1; $this->total_localtax2 = $obj->localtax2; $this->total_ttc = $obj->total_ttc; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index fb6bc840354..805052092fb 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1862,7 +1862,7 @@ elseif (! empty($object->id)) print ''; - if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon)) + if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) print ''; print '
'; print fieldLabel('CurrencyRate','multicurrency_tx'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; print ''; @@ -1873,7 +1873,7 @@ elseif (! empty($object->id)) $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); } else { $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); - if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code != $conf->currency) { + if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { print '
        '; print ''.$langs->trans("ActualizeCurrency").''; print '
'; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 09ce7ef46aa..b0cdd488adf 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1796,17 +1796,14 @@ if ($action == 'create') echo ''; print ''.$langs->trans('TotalHT').''.price($objectsrc->total_ht).''; print ''.$langs->trans('TotalVAT').''.price($objectsrc->total_tva).""; - if ($mysoc->country_code=='ES') + if ($mysoc->localtax1_assuj=="1" || $object->total_localtax1 != 0) //Localtax1 { - if ($mysoc->localtax1_assuj=="1" || $object->total_localtax1 != 0) //Localtax1 - { - print ''.$langs->transcountry("AmountLT1",$mysoc->country_code).''.price($objectsrc->total_localtax1).""; - } + print ''.$langs->transcountry("AmountLT1",$mysoc->country_code).''.price($objectsrc->total_localtax1).""; + } - if ($mysoc->localtax2_assuj=="1" || $object->total_localtax2 != 0) //Localtax2 - { - print ''.$langs->transcountry("AmountLT2",$mysoc->country_code).''.price($objectsrc->total_localtax2).""; - } + if ($mysoc->localtax2_assuj=="1" || $object->total_localtax2 != 0) //Localtax2 + { + print ''.$langs->transcountry("AmountLT2",$mysoc->country_code).''.price($objectsrc->total_localtax2).""; } print ''.$langs->trans('TotalTTC').''.price($objectsrc->total_ttc).""; @@ -2165,7 +2162,7 @@ else print ''; - if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon)) + if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) print ''; print '
'; print fieldLabel('CurrencyRate','multicurrency_tx'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; print ''; @@ -2176,7 +2173,7 @@ else $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); } else { $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); - if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code != $conf->currency) { + if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { print '
        '; print ''.$langs->trans("ActualizeCurrency").''; print '
'; diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index e02a512f327..741ed0f2b5c 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1040,6 +1040,15 @@ if ($action == 'create') $objectsrc->fetch_optionals($originid); $object->array_options = $objectsrc->array_options; + if (!empty($conf->multicurrency->enabled)) + { + if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code; + if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx; + } + } + else + { + if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code; } $object = new SupplierProposal($db); @@ -1149,7 +1158,6 @@ if ($action == 'create') print ''; print ''.fieldLabel('Currency','multicurrency_code').''; print ''; - $currency_code = (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency)); print $form->selectMultiCurrency($currency_code, 'multicurrency_code'); print ''; } @@ -1196,6 +1204,13 @@ if ($action == 'create') print '' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($objectsrc->total_localtax2) . ""; } print '' . $langs->trans('TotalTTC') . '' . price($objectsrc->total_ttc) . ""; + + if (!empty($conf->multicurrency->enabled)) + { + print '' . $langs->trans('MulticurrencyTotalHT') . '' . price($objectsrc->multicurrency_total_ht) . ''; + print '' . $langs->trans('MulticurrencyTotalVAT') . '' . price($objectsrc->multicurrency_total_tva) . ""; + print '' . $langs->trans('MulticurrencyTotalTTC') . '' . price($objectsrc->multicurrency_total_ttc) . ""; + } } print "\n"; @@ -1491,14 +1506,22 @@ if ($action == 'create') print ''; - if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon)) + if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) print ''; print '
'; print fieldLabel('CurrencyRate','multicurrency_tx'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; print ''; - if ($action == 'editmulticurrencyrate') { - $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); + if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') { + if($action == 'actualizemulticurrencyrate') { + list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code); + } + $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); } else { - $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); + $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); + if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { + print '
        '; + print ''.$langs->trans("ActualizeCurrency").''; + print '
'; + } } print ''; }