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

This commit is contained in:
Laurent Destailleur 2022-05-04 01:23:25 +02:00
commit bdc80d22ea
17 changed files with 828 additions and 675 deletions

View File

@ -831,6 +831,13 @@ if (empty($reshook)) {
foreach ($object->lines as $line) {
$result = $object->updateline($line->id, $line->subprice, $line->qty, $line->remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
}
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('remiseforalllines', 'alpha') !== '' && $usercancreate) {
// Define vat_rate
$remise_percent = (GETPOST('remiseforalllines') ? GETPOST('remiseforalllines') : 0);
$remise_percent = str_replace('*', '', $remise_percent);
foreach ($object->lines as $line) {
$result = $object->updateline($line->id, $line->subprice, $line->qty, $remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
}
} elseif ($action == 'addline' && $usercancreate) { // Add line
// Set if we used free entry or predefined product
$predef = '';

View File

@ -2097,7 +2097,7 @@ if ($resql) {
// Note public
if (!empty($arrayfields['p.note_public']['checked'])) {
print '<td class="center">';
print dol_escape_htmltag($obj->note_public);
print dol_string_nohtmltag($obj->note_public);
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
@ -2106,7 +2106,7 @@ if ($resql) {
// Note private
if (!empty($arrayfields['p.note_private']['checked'])) {
print '<td class="center">';
print dol_escape_htmltag($obj->note_private);
print dol_string_nohtmltag($obj->note_private);
print '</td>';
if (!$i) {
$totalarray['nbfield']++;

View File

@ -628,6 +628,13 @@ if (empty($reshook)) {
foreach ($object->lines as $line) {
$result = $object->updateline($line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $line->info_bits, $line->date_start, $line->date_end, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
}
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('remiseforalllines', 'alpha') !== '' && $usercancreate) {
// Define remise_percent
$remise_percent = (GETPOST('remiseforalllines') ? GETPOST('remiseforalllines') : 0);
$remise_percent = str_replace('*', '', $remise_percent);
foreach ($object->lines as $line) {
$result = $object->updateline($line->id, $line->desc, $line->subprice, $line->qty, $remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->date_start, $line->date_end, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
}
} elseif ($action == 'addline' && $usercancreate) { // Add a new line
$langs->load('errors');
$error = 0;

View File

@ -1994,6 +1994,13 @@ if (empty($reshook)) {
foreach ($object->lines as $line) {
$result = $object->updateline($line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit, $line->multicurrency_subprice);
}
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('remiseforalllines', 'alpha') !== '' && $usercancreate) {
// Define vat_rate
$remise_percent = (GETPOST('remiseforalllines') ? GETPOST('remiseforalllines') : 0);
$remise_percent = str_replace('*', '', $remise_percent);
foreach ($object->lines as $line) {
$result = $object->updateline($line->id, $line->desc, $line->subprice, $line->qty, $remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit, $line->multicurrency_subprice);
}
} elseif ($action == 'addline' && $usercancreate) { // Add a new line
$langs->load('errors');
$error = 0;

View File

@ -5221,11 +5221,11 @@ class Facture extends CommonInvoice
if (!empty($recipient->email)) {
$to = $recipient->email;
} else {
$errormesg = "Failed to send remind to thirdparty id=".$tmpinvoice->fk_soc.". No email defined for user.";
$errormesg = "Failed to send remind to thirdparty id=".$tmpinvoice->socid.". No email defined for user.";
$error++;
}
} else {
$errormesg = "Failed to load recipient with thirdparty id=".$tmpinvoice->fk_soc;
$errormesg = "Failed to load recipient with thirdparty id=".$tmpinvoice->socid;
$error++;
}

View File

@ -327,29 +327,51 @@ if (!$error && $massaction == 'confirm_presend') {
// TODO Set subdir to be compatible with multi levels dir trees
// $subdir = get_exdir($objectobj->id, 2, 0, 0, $objectobj, $objectobj->element)
$filedir = $uploaddir.'/'.$subdir.dol_sanitizeFileName($objectobj->ref);
$file = $filedir.'/'.$filename;
$filepath = $filedir.'/'.$filename;
// For supplier invoices, we use the file provided by supplier, not the one we generate
if ($objectobj->element == 'invoice_supplier') {
$fileparams = dol_most_recent_file($uploaddir.'/'.get_exdir($objectobj->id, 2, 0, 0, $objectobj, $objectobj->element).$objectobj->ref, preg_quote($objectobj->ref, '/').'([^\-])+');
$file = $fileparams['fullname'];
$filepath = $fileparams['fullname'];
}
$mime = dol_mimetype($file);
// try to find other files generated for this object (last_main_doc)
$filename_found = '';
$filepath_found = '';
$file_check_list = array();
$file_check_list[] = array(
'name' => $filename,
'path' => $filepath,
);
if (!empty($conf->global->MAIL_MASS_ACTION_ADD_LAST_IF_MAIN_DOC_NOT_FOUND) && !empty($objectobj->last_main_doc)) {
$file_check_list[] = array(
'name' => basename($objectobj->last_main_doc),
'path' => DOL_DATA_ROOT . '/' . $objectobj->last_main_doc,
);
}
foreach ($file_check_list as $file_check_arr) {
if (dol_is_file($file_check_arr['path'])) {
$filename_found = $file_check_arr['name'];
$filepath_found = $file_check_arr['path'];
break;
}
}
if (dol_is_file($file)) {
if ($filepath_found) {
// Create form object
$attachedfilesThirdpartyObj[$thirdpartyid][$objectid] = array(
'paths'=>array($file),
'names'=>array($filename),
'mimes'=>array($mime)
'paths'=>array($filepath_found),
'names'=>array($filename_found),
'mimes'=>array(dol_mimetype($filepath_found))
);
} else {
$nbignored++;
$langs->load("errors");
$resaction .= '<div class="error">'.$langs->trans('ErrorCantReadFile', $file).'</div><br>';
dol_syslog('Failed to read file: '.$file, LOG_WARNING);
continue;
$nbignored++;
$langs->load("errors");
foreach ($file_check_list as $file_check_arr) {
$resaction .= '<div class="error">'.$langs->trans('ErrorCantReadFile', $file_check_arr['path']).'</div><br>';
dol_syslog('Failed to read file: '.$file_check_arr['path'], LOG_WARNING);
}
continue;
}
}

View File

@ -7,7 +7,7 @@
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
* Copyright (C) 2016-2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2019-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2022 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -986,6 +986,8 @@ class FormFile
$out .= '<td class="right">';
$out .= dol_print_date($file->datea, 'dayhour');
$out .= '</td>';
// for share link of files
$out .= '<td></td>';
if ($delallowed || $printer || $morepicto) {
$out .= '<td></td>';
}

View File

@ -781,7 +781,11 @@ class FormMail extends Form
} elseif ($this->withmaindocfile == -1) {
$out .= '<input type="checkbox" id="addmaindocfile" name="addmaindocfile" value="1" checked="checked" />';
}
$out .= ' <label for="addmaindocfile">'.$langs->trans("JoinMainDoc").'.</label><br>';
if (!empty($conf->global->MAIL_MASS_ACTION_ADD_LAST_IF_MAIN_DOC_NOT_FOUND)) {
$out .= ' <label for="addmaindocfile">'.$langs->trans("JoinMainDocOrLastGenerated").'.</label><br>';
} else {
$out .= ' <label for="addmaindocfile">'.$langs->trans("JoinMainDoc").'.</label><br>';
}
}
if (is_numeric($this->withfile)) {

View File

@ -8990,6 +8990,9 @@ function printCommonFooter($zone = 'private')
print 'jQuery("select[name=\''.$paramkey.'\']").prop(\'required\',true);'."\n";
print 'jQuery("select[name=\''.$paramkey.'\'] option[value=\'-1\']").prop(\'value\', \'\');'."\n";
print 'jQuery("select[name=\''.$paramkey.'\'] option[value=\'0\']").prop(\'value\', \'\');'."\n";
// Add 'field required' class on closest td for all input elements : input, textarea and select
print 'jQuery(":input[name=\'' . $paramkey . '\']").closest("tr").find("td:first").addClass("fieldrequired");' . "\n";
}
}
}

View File

@ -105,7 +105,24 @@ if (!empty($conf->global->PRODUCT_USE_UNITS)) {
}
// Reduction short
print '<td class="linecoldiscount right">'.$langs->trans('ReductionShort').'</td>';
print '<td class="linecoldiscount right">';
print $langs->trans('ReductionShort');
if (in_array($object->element, array('propal', 'commande', 'facture')) && $object->status == $object::STATUS_DRAFT) {
global $mysoc;
if (empty($disableedit)) {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?mode=remiseforalllines&id='.$object->id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickvatforalllines opacitymedium paddingleft cursorpointer"').'</a>';
}
//print '<script>$(document).ready(function() { $(".clickremiseforalllines").click(function() { jQuery(".classremiseforalllines").toggle(); }); });</script>';
if (GETPOST('mode', 'aZ09') == 'remiseforalllines') {
print '<div class="remiseforalllines inline-block nowraponall">';
print '<input class="inline-block smallpaddingimp" name="remiseforalllines" value="0"> %';
print '<input class="inline-block button smallpaddingimp" type="submit" name="submitforalllines" value="'.$langs->trans("Update").'">';
print '</div>';
}
}
print '</td>';
// Fields for situation invoice
if (isset($this->situation_cycle_ref) && $this->situation_cycle_ref) {

View File

@ -0,0 +1,27 @@
-- Copyright (C) ---Put here your own copyright and developer email---
--
-- 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
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see https://www.gnu.org/licenses/.
-- BEGIN MODULEBUILDER INDEXES
ALTER TABLE llx_webhook_target ADD INDEX idx_webhook_target_rowid (rowid);
ALTER TABLE llx_webhook_target ADD INDEX idx_webhook_target_ref (ref);
ALTER TABLE llx_webhook_target ADD CONSTRAINT llx_webhook_target_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid);
ALTER TABLE llx_webhook_target ADD INDEX idx_webhook_target_status (status);
-- END MODULEBUILDER INDEXES
--ALTER TABLE llx_webhook_target ADD UNIQUE INDEX uk_webhook_target_fieldxy(fieldx, fieldy);
--ALTER TABLE llx_webhook_target ADD CONSTRAINT llx_webhook_target_fk_field FOREIGN KEY (fk_field) REFERENCES llx_webhook_myotherobject(rowid);

View File

@ -0,0 +1,34 @@
-- Copyright (C) ---Put here your own copyright and developer email---
--
-- 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
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see https://www.gnu.org/licenses/.
CREATE TABLE llx_webhook_target(
-- BEGIN MODULEBUILDER FIELDS
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
ref varchar(128) NOT NULL,
label varchar(255),
description text,
note_public text,
note_private text,
date_creation datetime NOT NULL,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
fk_user_creat integer NOT NULL,
fk_user_modif integer,
import_key varchar(14),
status integer DEFAULT 0 NOT NULL,
url varchar(255) NOT NULL,
trigger_codes text NOT NULL
-- END MODULEBUILDER FIELDS
) ENGINE=innodb;

View File

@ -621,6 +621,7 @@ MonthVeryShort11=N
MonthVeryShort12=D
AttachedFiles=Attached files and documents
JoinMainDoc=Join main document
JoinMainDocOrLastGenerated=Send the main document or the last generated one if not found
DateFormatYYYYMM=YYYY-MM
DateFormatYYYYMMDD=YYYY-MM-DD
DateFormatYYYYMMDDHHMM=YYYY-MM-DD HH:SS
@ -1172,4 +1173,4 @@ AddLineOnPosition=Add line on position (at the end if empty)
ConfirmAllocateCommercial=Assign sales representative confirmation
ConfirmAllocateCommercialQuestion=Are you sure you want to assign the %s selected record(s)?
CommercialsAffected=Sales representatives affected
CommercialAffected=Sales representative affected
CommercialAffected=Sales representative affected

View File

@ -620,6 +620,7 @@ MonthVeryShort11=N
MonthVeryShort12=D
AttachedFiles=Fichiers et documents joints
JoinMainDoc=Joindre le document principal
JoinMainDocOrLastGenerated=Joindre le document principal ou le dernier généré s'il n'a pas été trouvé
DateFormatYYYYMM=YYYY-MM
DateFormatYYYYMMDD=YYYY-MM-DD
DateFormatYYYYMMDDHHMM=YYYY-MM-DD HH:SS

View File

@ -264,7 +264,7 @@ if (empty($reshook) && $action == 'create_ticket' && GETPOST('save', 'alpha')) {
$infos_new_ticket .= $langs->transnoentities('TicketNewEmailBodyInfosTrackUrl').'<br><br>';
$message .= $infos_new_ticket;
$message .= getDolGlobalString('TICKET_MESSAGE_MAIL_SIGNATURE') ? getDolGlobalString('TICKET_MESSAGE_MAIL_SIGNATURE') : $langs->transnoentities('TicketMessageMailSignatureText', $mysoc->name);
$message .= getDolGlobalString('TICKET_MESSAGE_MAIL_SIGNATURE', $langs->transnoentities('TicketMessageMailSignatureText', $mysoc->name));
$sendto = GETPOST('email', 'alpha');

View File

@ -361,6 +361,13 @@ function LoadProducts(position, issubcat) {
$("#prodiv"+ishow).attr("class","wrapper2");
$("#prowatermark"+ishow).hide();
ishow++; //Next product to show after print data product
<?php
// Add js from hooks
$parameters=array();
$parameters['caller'] = 'loadProducts';
$hookmanager->executeHooks('completeJSProductDisplay', $parameters);
print $hookmanager->resPrint;
?>
}
//console.log("Hide the prowatermark for ishow="+ishow);
idata++; //Next data everytime
@ -627,6 +634,15 @@ function Search2(keyCodeForEnter, moreorless) {
}
$("#prodiv" + i).data("rowid", data[i]['rowid']);
$("#prodiv" + i).data("iscat", 0);
<?php
// Add js from hooks
$parameters=array();
$parameters['caller'] = 'search2';
$hookmanager->executeHooks('completeJSProductDisplay', $parameters);
print $hookmanager->resPrint;
?>
nbsearchresults++;
}
}).always(function (data) {

File diff suppressed because it is too large Load Diff