From 71a2c20d4bb205a8e945160fbd78e9891345e15f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 9 Feb 2021 14:32:04 +0100 Subject: [PATCH 1/2] massaction validate invoice do not regenerate pdf --- htdocs/core/actions_massactions.inc.php | 35 +++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 77fbea3c36a..abcdd690d5c 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -3,7 +3,7 @@ * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018 Juanjo Menent * Copyright (C) 2019 Ferran Marcet - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019-2021 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1167,7 +1167,38 @@ if (!$error && $massaction == 'validate' && $permissiontoadd) $error++; break; } - else $nbok++; + else { + // validate() rename pdf but do not regenerate + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { + $newlang = GETPOST('lang_id', 'aZ09'); + } + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { + $newlang = $objecttmp->thirdparty->default_lang; + } + if (!empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + $outputlangs->load('products'); + } + $model = $objecttmp->model_pdf; + $ret = $objecttmp->fetch($objecttmp->id); // Reload to get new records + // To be sure vars is defined + $hidedetails = !empty($hidedetails) ? $hidedetails : 0; + $hidedesc = !empty($hidedesc) ? $hidedesc : 0; + $hideref = !empty($hideref) ? $hideref : 0; + $moreparams = !empty($moreparams) ? $moreparams : null; + + $result = $objecttmp->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + if ($result < 0) { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + } + } + $nbok++; + } } else { From c010cab47e85f9823d87570087caadfc77cb72c6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 22 Feb 2021 15:51:00 +0100 Subject: [PATCH 2/2] Fix translation of default value for contacts --- htdocs/contact/card.php | 2 +- htdocs/core/class/commonobject.class.php | 12 +++++++++--- htdocs/langs/en_US/supplier_proposal.lang | 3 +++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 7bd88436e31..3e3e1894a75 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -843,7 +843,7 @@ else print ''.$langs->trans("ContactByDefaultFor").''; print ''; $contactType = $object->listeTypeContacts('external', '', 1); - print $form->multiselectarray('roles', $contactType); + print $form->multiselectarray('roles', $contactType, array(), 0, 0, 'minwidth500'); print ''; } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d2853d48034..730546e0e6b 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1356,6 +1356,8 @@ abstract class CommonObject if ($resql) { $num = $this->db->num_rows($resql); if ($num > 0) { + $langs->loadLangs(array("propal", "orders", "bills", "suppliers", "contracts", "supplier_proposal")); + while ($obj = $this->db->fetch_object($resql)) { $modulename = $obj->element; if (strpos($obj->element, 'project') !== false) { @@ -1371,11 +1373,15 @@ abstract class CommonObject } if ($conf->{$modulename}->enabled) { $libelle_element = $langs->trans('ContactDefault_'.$obj->element); - $transkey = "TypeContact_".$obj->element."_".$source."_".$obj->code; + $tmpelement = $obj->element; + $transkey = "TypeContact_".$tmpelement."_".$source."_".$obj->code; $libelle_type = ($langs->trans($transkey) != $transkey ? $langs->trans($transkey) : $obj->libelle); - if (empty($option)) + if (empty($option)) { $tab[$obj->rowid] = $libelle_element.' - '.$libelle_type; - else $tab[$obj->rowid] = $libelle_element.' - '.$libelle_type; + } + else { + $tab[$obj->rowid] = $libelle_element.' - '.$libelle_type; + } } } } diff --git a/htdocs/langs/en_US/supplier_proposal.lang b/htdocs/langs/en_US/supplier_proposal.lang index ce5bdf0425a..2617cdfe9e9 100644 --- a/htdocs/langs/en_US/supplier_proposal.lang +++ b/htdocs/langs/en_US/supplier_proposal.lang @@ -52,3 +52,6 @@ SupplierProposalsToClose=Vendor proposals to close SupplierProposalsToProcess=Vendor proposals to process LastSupplierProposals=Latest %s price requests AllPriceRequests=All requests +TypeContact_supplier_proposal_external_SHIPPING=Vendor contact for delivery +TypeContact_supplier_proposal_external_BILLING=Vendor contact for billing +TypeContact_supplier_proposal_external_SERVICE=Representative following-up proposal