Merge branch '12.0' of git@github.com:Dolibarr/dolibarr.git into 13.0

Conflicts:
	htdocs/contact/card.php
	htdocs/core/actions_massactions.inc.php
This commit is contained in:
Laurent Destailleur 2021-02-22 15:54:24 +01:00
commit 912f9f9bdb
4 changed files with 48 additions and 10 deletions

View File

@ -831,7 +831,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
print '<tr><td>'.$langs->trans("ContactByDefaultFor").'</td>'; print '<tr><td>'.$langs->trans("ContactByDefaultFor").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
$contactType = $object->listeTypeContacts('external', '', 1); $contactType = $object->listeTypeContacts('external', '', 1);
print $form->multiselectarray('roles', $contactType); print $form->multiselectarray('roles', $contactType, array(), 0, 0, 'minwidth500');
print '</td></tr>'; print '</td></tr>';
} }

View File

@ -3,7 +3,7 @@
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com> * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2018 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2019 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2019 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2019-2021 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * 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) if ($result > 0)
{ {
$result = $objecttmp->validate($user); $result = $objecttmp->validate($user);
if ($result == 0) if ($result == 0) {
{
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans("ErrorObjectMustHaveStatusDraftToBeValidated", $objecttmp->ref), null, 'errors'); setEventMessages($langs->trans("ErrorObjectMustHaveStatusDraftToBeValidated", $objecttmp->ref), null, 'errors');
$error++; $error++;
break; break;
} elseif ($result < 0) } elseif ($result < 0) {
{
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++; $error++;
break; 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 { } else {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++; $error++;

View File

@ -1399,6 +1399,8 @@ abstract class CommonObject
if ($resql) { if ($resql) {
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
if ($num > 0) { if ($num > 0) {
$langs->loadLangs(array("propal", "orders", "bills", "suppliers", "contracts", "supplier_proposal"));
while ($obj = $this->db->fetch_object($resql)) { while ($obj = $this->db->fetch_object($resql)) {
$modulename = $obj->element; $modulename = $obj->element;
if (strpos($obj->element, 'project') !== false) { if (strpos($obj->element, 'project') !== false) {
@ -1414,11 +1416,15 @@ abstract class CommonObject
} }
if ($conf->{$modulename}->enabled) { if ($conf->{$modulename}->enabled) {
$libelle_element = $langs->trans('ContactDefault_'.$obj->element); $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); $libelle_type = ($langs->trans($transkey) != $transkey ? $langs->trans($transkey) : $obj->libelle);
if (empty($option)) if (empty($option)) {
$tab[$obj->rowid] = $libelle_element.' - '.$libelle_type; $tab[$obj->rowid] = $libelle_element.' - '.$libelle_type;
else $tab[$obj->rowid] = $libelle_element.' - '.$libelle_type; }
else {
$tab[$obj->rowid] = $libelle_element.' - '.$libelle_type;
}
} }
} }
} }

View File

@ -53,3 +53,6 @@ SupplierProposalsToClose=Vendor proposals to close
SupplierProposalsToProcess=Vendor proposals to process SupplierProposalsToProcess=Vendor proposals to process
LastSupplierProposals=Latest %s price requests LastSupplierProposals=Latest %s price requests
AllPriceRequests=All 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