2
0
forked from Wavyzz/dolibarr

Merge branch '18.0' of git@github.com:Dolibarr/dolibarr.git into 19.0

This commit is contained in:
Laurent Destailleur
2024-09-23 21:52:08 +02:00
4 changed files with 21 additions and 12 deletions

View File

@@ -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')) {

View File

@@ -144,7 +144,7 @@ if ($permission) {
<div class="tagtd nowrap noborderbottom">
<?php
$selectedCompany = GETPOSTISSET("newcompany") ? GETPOST("newcompany", 'int') : (empty($object->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?>
</div>
<div class="tagtd noborderbottom minwidth500imp">
<?php

View File

@@ -505,8 +505,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers
if ($action == 'TICKET_CREATE') {
dol_syslog("Trigger '".$this->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;

View File

@@ -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;