diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php
index c1fc07be61f..f194d41803e 100644
--- a/htdocs/core/class/CMailFile.class.php
+++ b/htdocs/core/class/CMailFile.class.php
@@ -1208,9 +1208,10 @@ class CMailFile
$res = true;
if (!empty($this->error) || !empty($this->errors) || !$result) {
if (!empty($failedRecipients)) {
- $this->errors[] = 'Transport failed for the following addresses: "' . join('", "', $failedRecipients) . '".';
+ $this->error = 'Transport failed for the following addresses: "' . join('", "', $failedRecipients) . '".';
+ $this->errors[] = $this->error;
}
- dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
+ dol_syslog("CMailFile::sendfile: mail end error=". join(' ', $this->errors), LOG_ERR);
$res = false;
if (getDolGlobalString('MAIN_MAIL_DEBUG')) {
diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php
index 42e0e277797..170a01c4981 100644
--- a/htdocs/core/tpl/contacts.tpl.php
+++ b/htdocs/core/tpl/contacts.tpl.php
@@ -144,7 +144,7 @@ if ($permission) {
socid) ? 0 : $object->socid);
- $selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', '', 0, '', 'minwidth300imp'); // This also print the select component?>
+ $selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', '', 0, '', 'minwidth300imp maxwidth400 widthcentpercentminusx'); // This also print the select component?>
name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
- // Auto link contract
- if (!empty($conf->contract->enabled) && isModEnabled('ticket') && isModEnabled('ficheinter') && !empty($conf->workflow->enabled) && getDolGlobalString('WORKFLOW_TICKET_LINK_CONTRACT') && getDolGlobalString('TICKET_PRODUCT_CATEGORY') && !empty($object->fk_soc)) {
+ // Auto link ticket to contract
+ if (isModEnabled('contract') && isModEnabled('ticket') && isModEnabled('workflow') && getDolGlobalString('WORKFLOW_TICKET_LINK_CONTRACT') && getDolGlobalString('TICKET_PRODUCT_CATEGORY') && !empty($object->fk_soc)) {
$societe = new Societe($this->db);
$company_ids = (!getDolGlobalString('WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS')) ? [$object->fk_soc] : $societe->getParentsForCompany($object->fk_soc, [$object->fk_soc]);
@@ -514,6 +514,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
$number_contracts_found = 0;
foreach ($company_ids as $company_id) {
$contrat->socid = $company_id;
+
$list = $contrat->getListOfContracts($option = 'all', $status = [Contrat::STATUS_DRAFT, Contrat::STATUS_VALIDATED], $product_categories = [$conf->global->TICKET_PRODUCT_CATEGORY], $line_status = [ContratLigne::STATUS_INITIAL, ContratLigne::STATUS_OPEN]);
if (!is_array($list) || empty($list)) {
continue;
@@ -533,20 +534,18 @@ class InterfaceWorkflowManager extends DolibarrTriggers
}
break;
}
- if ($number_contracts_found == 0) {
- if (empty(NOLOGIN)) {
- setEventMessage($langs->trans('TicketNoContractFoundToLink'), 'mesgs');
- }
+ if ($number_contracts_found == 0 && !defined('NOLOGIN')) {
+ setEventMessage($langs->trans('TicketNoContractFoundToLink'), 'mesgs');
}
}
// Automatically create intervention
- if (isModEnabled('ficheinter') && isModEnabled('ticket') && !empty($conf->workflow->enabled) && getDolGlobalString('WORKFLOW_TICKET_CREATE_INTERVENTION')) {
+ if (isModEnabled('ficheinter') && isModEnabled('ticket') && isModEnabled('workflow') && getDolGlobalString('WORKFLOW_TICKET_CREATE_INTERVENTION')) {
$fichinter = new Fichinter($this->db);
$fichinter->socid = (int) $object->fk_soc;
$fichinter->fk_project = (int) $object->fk_project;
$fichinter->fk_contrat = (int) $object->fk_contract;
$fichinter->author = $user->id;
- $fichinter->model_pdf = (getDolGlobalString('FICHEINTER_ADDON_PDF')) ? $conf->global->FICHEINTER_ADDON_PDF : 'soleil';
+ $fichinter->model_pdf = getDolGlobalString('FICHEINTER_ADDON_PDF', 'soleil');
$fichinter->origin = $object->element;
$fichinter->origin_id = $object->id;
diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php
index fa28436a7c2..ff06c3e940b 100644
--- a/htdocs/product/stock/replenish.php
+++ b/htdocs/product/stock/replenish.php
@@ -196,6 +196,13 @@ if ($action == 'order' && GETPOST('valid')) {
// TODO Get desc in language of thirdparty
}
+ // If we use multicurrency
+ if (isModEnabled('multicurrency') && !empty($productsupplier->fourn_multicurrency_code) && $productsupplier->fourn_multicurrency_code != $conf->currency) {
+ $line->multicurrency_code = $productsupplier->fourn_multicurrency_code;
+ $line->fk_multicurrency = $productsupplier->fourn_multicurrency_id;
+ $line->multicurrency_subprice = $productsupplier->fourn_multicurrency_unitprice;
+ }
+
$line->tva_tx = $productsupplier->vatrate_supplier;
$line->subprice = $productsupplier->fourn_pu;
$line->total_ht = $productsupplier->fourn_pu * $qty;
@@ -264,7 +271,8 @@ if ($action == 'order' && GETPOST('valid')) {
null,
null,
0,
- $line->fk_unit
+ $line->fk_unit,
+ $line->multicurrency_subprice ?? 0
);
}
if ($result < 0) {
@@ -279,6 +287,7 @@ if ($action == 'order' && GETPOST('valid')) {
} else {
$order->socid = $suppliersid[$i];
$order->fetch_thirdparty();
+ $order->multicurrency_code = $order->thirdparty->multicurrency_code;
// Trick to know which orders have been generated using the replenishment feature
$order->source = $order::SOURCE_ID_REPLENISHMENT;