Automated merge from 22.0 to 23.0 by tool pullmerge.sh

This commit is contained in:
Laurent Destailleur 2026-03-12 23:40:02 +01:00
commit b9f5895c68
7 changed files with 72 additions and 43 deletions

View file

@ -846,30 +846,50 @@ if ($action == 'export_file') {
}
// add documents in an archive for some accountancy export format
if (getDolGlobalString('ACCOUNTING_EXPORT_MODELCSV') == AccountancyExport::$EXPORT_TYPE_QUADRATUS
|| getDolGlobalString('ACCOUNTING_EXPORT_MODELCSV') == AccountancyExport::$EXPORT_TYPE_FEC
|| getDolGlobalString('ACCOUNTING_EXPORT_MODELCSV') == AccountancyExport::$EXPORT_TYPE_FEC2
) {
$except = array();
if (getDolGlobalInt('ACCOUNTING_EXPORT_REMOVE_INVOICE_SOURCE_FILE')) {
$except[] = $langs->trans('Invoice');
}
if (getDolGlobalInt('ACCOUNTING_EXPORT_REMOVE_EXPENSEREPORT_SOURCE_FILE')) {
$except[] = $langs->trans('ExpenseReport');
}
if (getDolGlobalInt('ACCOUNTING_EXPORT_REMOVE_SUPPLIERINVOICE_SOURCE_FILE')) {
$except[] = $langs->trans('SupplierInvoice');
}
$exportTypesWithDocs = array(
AccountancyExport::$EXPORT_TYPE_QUADRATUS,
AccountancyExport::$EXPORT_TYPE_FEC,
AccountancyExport::$EXPORT_TYPE_FEC2
);
$form_question['notifiedexportfull'] = array(
'name' => 'notifiedexportfull',
'type' => 'checkbox',
'label' => $langs->trans('NotifiedExportFull').(empty($except) ? '' : ' <spanc class="opacitymedium">('.$langs->trans("except").' '.implode(', ', $except).')</span>'),
'value' => 'false',
);
$except = array();
if (getDolGlobalInt('ACCOUNTING_EXPORT_REMOVE_INVOICE_SOURCE_FILE')) {
$except[] = $langs->trans('Invoice');
}
if (getDolGlobalInt('ACCOUNTING_EXPORT_REMOVE_EXPENSEREPORT_SOURCE_FILE')) {
$except[] = $langs->trans('ExpenseReport');
}
if (getDolGlobalInt('ACCOUNTING_EXPORT_REMOVE_SUPPLIERINVOICE_SOURCE_FILE')) {
$except[] = $langs->trans('SupplierInvoice');
}
$form_question['notifiedexportfull'] = array(
'name' => 'notifiedexportfull',
'type' => 'checkbox',
'label' => $langs->trans('NotifiedExportFull').(empty($except) ? '' : ' <spanc class="opacitymedium">('.$langs->trans("except").' '.implode(', ', $except).')</span>'),
'value' => 'false',
);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").'...', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 500, 700);
$formconfirm .= '<script>
jQuery(document).ready(function() {
const exportTypesWithDocs = ['.implode(',', $exportTypesWithDocs).'];
const $formatExport = jQuery("#formatexport");
function toggleExportFull() {
const $checkbox = jQuery("#notifiedexportfull");
const show = exportTypesWithDocs.indexOf(parseInt($formatExport.val())) !== -1;
$checkbox.closest(".tagtr").toggle(show);
if (!show) {
$checkbox.prop("checked", false); // remove checked if hidden
}
}
$formatExport.on("change", toggleExportFull);
toggleExportFull();
});
</script>';
}
// Print form confirm

View file

@ -1109,7 +1109,7 @@ if ($object->id > 0) {
* Latest shipments
*/
if (isModEnabled("shipping") && $user->hasRight('expedition', 'lire')) {
$param = 'entity=' . ((int) $objp->entity);
$param = '';
$sql = 'SELECT e.rowid as id';
$sql .= ', e.ref, e.entity, e.fk_projet';
@ -1148,6 +1148,8 @@ if ($object->id > 0) {
while ($i < $num && $i < $MAXLIST) {
$objp = $db->fetch_object($resql);
$param = 'entity=' . ((int) $objp->entity);
$sendingstatic->id = $objp->id;
$sendingstatic->ref = $objp->ref;
$sendingstatic->fk_project = $objp->fk_projet;

View file

@ -1803,8 +1803,12 @@ abstract class CommonDocGenerator
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label) {
// Enable extrafield ?
$enabled = 0;
if (!empty($extrafields->attributes[$object->table_element]['enabled'][$key])) {
$enabled = (int) dol_eval((string) $extrafields->attributes[$object->table_element]['enabled'][$key], 1, 1, '2');
}
$disableOnEmpty = 0;
if (!empty($extrafields->attributes[$object->table_element]['printable'][$key])) {
if ($enabled && !empty($extrafields->attributes[$object->table_element]['printable'][$key])) {
$printable = intval($extrafields->attributes[$object->table_element]['printable'][$key]);
if (in_array($printable, $params['printableEnable']) || in_array($printable, $params['printableEnableNotEmpty'])) {
$enabled = 1;

View file

@ -12905,21 +12905,20 @@ function printCommonFooter($zone = 'private')
foreach ($defval as $paramkey => $paramval) {
// Solution 1: Add handler on submit to check if mandatory fields are empty
print 'var form = $(\'#' . dol_escape_js($paramkey) . '\').closest("form");' . "\n";
print 'var form = $(\'[name="'.dol_escape_js($paramkey).'"]\').closest("form");'."\n";
print "form.on('submit', function(event) {
var submitter = $(this).find(':submit:focus').get(0);
if (submitter) {
var buttonName = $(submitter).attr('name');
if (buttonName == 'cancel') {
console.log('We click on cancel button so we accept submit with no need to check mandatory fields');
return true;
}
var submitter = \$(this).find(':submit:focus').get(0);
var buttonName = submitter ? \$(submitter).attr('name') : 'save';
if (buttonName == 'cancel') {
console.log('We click on cancel button so we accept submit with no need to check mandatory fields');
return true;
}
console.log('We did not click on cancel button but on something else, we check that field #" . dol_escape_js($paramkey) . " is not empty');
console.log('We did not click on cancel button but on something else, we check that field [name=".dol_escape_js($paramkey)."] is not empty');
var tmpvalue = jQuery('#" . dol_escape_js($paramkey) . "').val();
let tmptypefield = jQuery('#" . dol_escape_js($paramkey) . "').prop('nodeName').toLowerCase(); // Get the tag name (div, section, footer...)
var tmpvalue = jQuery('[name=\"".dol_escape_js($paramkey)."\"]').val();
let tmptypefield = jQuery('[name=\"".dol_escape_js($paramkey)."\"]').prop('nodeName').toLowerCase(); // Get the tag name (div, section, footer...)
if (tmptypefield == 'textarea') {
// We must instead check the content of ckeditor
@ -12937,11 +12936,13 @@ function printCommonFooter($zone = 'private')
if (tmpvalue === '0' && (tmptypefield == 'select' || tmptypefield == 'input')) {
tmpvalueisempty = true;
}
if (tmpvalueisempty && (buttonName == 'save')) {
if (tmpvalueisempty && buttonName !== 'cancel') {
console.log('field has type '+tmptypefield+' and is empty, we cancel the submit');
event.preventDefault(); // Stop submission of form to allow custom code to decide.
event.stopPropagation(); // Stop other handlers.
alert('" . dol_escape_js($langs->trans("ErrorFieldRequired", $paramkey) . ' (' . $langs->trans("CustomMandatoryFieldRule") . ')') . "');
alert('".dol_escape_js($langs->transnoentitiesnoconv("ErrorFieldRequired", $paramkey).' ('.$langs->transnoentitiesnoconv("CustomMandatoryFieldRule").')')."');
return false;
}
console.log('field has type '+tmptypefield+' and is defined to '+tmpvalue);
@ -12965,7 +12966,6 @@ function printCommonFooter($zone = 'private')
print 'jQuery(\':input[name="' . dol_escape_js($paramkey) . '"]\').closest("tr").find("td:first").addClass("fieldrequired");' . "\n";
}
// If we submit using the cancel button, we remove the required attributes
print 'jQuery("input[name=\'cancel\']").click(function() {
console.log("We click on cancel button so removed all required attribute");

View file

@ -1739,7 +1739,7 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef
//$newmenu->add("/accountancy/index.php?leftmenu=accountancy", $langs->trans("MenuAccountancy"), 0, $permtoshowmenu, '', $mainmenu, 'accountancy');
// Configuration
$newmenu->add("/accountancy/index.php?leftmenu=accountancy_admin", $langs->trans("Setup"), 0, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin', 1, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/accountancy/admin/index.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Setup"), 0, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin', 1, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"'));
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/', $leftmenu)) {
global $mysoc;
$newmenu->add("/accountancy/admin/index.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("General"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_general', 10);

View file

@ -1126,7 +1126,7 @@ if ($resql) {
if (isModEnabled('productbatch') && $product_static->hasbatch()) {
$valuetoshow = $product_static->stock_warehouse[$obj->fk_warehouse]->detail_batch[$obj->batch]->qty ?? 0;
} else {
$valuetoshow = $product_static->stock_warehouse[$obj->fk_warehouse]->real ?? 0;
$valuetoshow = !empty($product_static->stock_warehouse[$obj->fk_warehouse]->real) ? $product_static->stock_warehouse[$obj->fk_warehouse]->real : 0;
}
}
print price2num($valuetoshow, 'MS');
@ -1301,10 +1301,11 @@ print '<script type="text/javascript">
success: function(result){
window.location.href = "'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&page='.($page + 1).$paramwithsearch.'";
}});
return false;
});
$(".paginationprevious:last").click(function(e){
$(".paginationprevious:last").click(function(e){
var form = $("#formrecord");
var actionURL = "'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&page='.($page).$paramwithsearch.'";
$.ajax({
@ -1314,9 +1315,10 @@ print '<script type="text/javascript">
success: function(result){
window.location.href = "'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&page='.($page - 1).$paramwithsearch.'";
}});
});
return false;
});
$("#idbuttonmakemovementandclose").click(function(e){
$("#idbuttonmakemovementandclose").click(function(e){
var form = $("#formrecord");
var actionURL = "'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&page='.($page).$paramwithsearch.'";
$.ajax({
@ -1326,7 +1328,8 @@ print '<script type="text/javascript">
success: function(result){
window.location.href = "'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&page='.($page - 1).$paramwithsearch.'&action=record";
}});
});
return false;
});
});
</script>';

View file

@ -790,7 +790,7 @@ if ($action == 'create' || $action == 'presend') {
$formticket->showForm(0, 'edit', 0, null, $action, $object);
print dol_get_fiche_end();
} elseif (empty($action) || in_array($action, ['builddoc', 'view', 'addlink', 'addlinkbyref', 'dellink', 'presend', 'presend_addmessage', 'close', 'abandon', 'clone', 'delete', 'editcustomer', 'progression', 'categories', 'reopen', 'edit_contrat', 'editsubject', 'edit_extras', 'update_extras', 'edit_extrafields', 'set_extrafields', 'classify', 'sel_contract', 'edit_message_init', 'set_status'])) {
} elseif ($object->id) {
if (!empty($res) && $res > 0) {
// or for unauthorized internals users
if (!$user->socid && (getDolGlobalString('TICKET_LIMIT_VIEW_ASSIGNED_ONLY') && $object->fk_user_assign != $user->id) && !$user->hasRight('ticket', 'manage')) {