diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index f88560159b0..6bc9133c553 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -831,7 +831,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) 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/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index b1b03e8de97..6b6d5854a1d 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 @@ -1111,18 +1111,47 @@ if (!$error && $massaction == 'validate' && $permissiontoadd) if ($result > 0) { $result = $objecttmp->validate($user); - if ($result == 0) - { + if ($result == 0) { $langs->load("errors"); setEventMessages($langs->trans("ErrorObjectMustHaveStatusDraftToBeValidated", $objecttmp->ref), null, 'errors'); $error++; break; - } elseif ($result < 0) - { + } elseif ($result < 0) { setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); $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 { setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); $error++; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 9e6204bd364..0b4565ab08f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1399,6 +1399,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) { @@ -1414,11 +1416,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 ca75eddb7df..a68319fb2df 100644 --- a/htdocs/langs/en_US/supplier_proposal.lang +++ b/htdocs/langs/en_US/supplier_proposal.lang @@ -53,3 +53,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