Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
281cefd7c2
9 changed files with 67 additions and 55 deletions
6
.github/scripts/get_changed_php.sh
vendored
6
.github/scripts/get_changed_php.sh
vendored
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
b!/bin/bash
|
||||
# Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
|
||||
set -euo pipefail
|
||||
|
|
@ -34,7 +34,6 @@ if [[ "$pr_number" == "null" ]]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
# Split repository into owner and repo name
|
||||
# Split repository into owner and repo name using Bash parameter expansion
|
||||
owner="${GITHUB_REPOSITORY%%/*}" # Extract text before the first '/'
|
||||
repo="${GITHUB_REPOSITORY##*/}" # Extract text after the last '/'
|
||||
|
|
@ -73,11 +72,12 @@ all_changed_files=$(IFS=" " ; echo "${changed_php_files[*]}")
|
|||
all_changed_lang=$(IFS=" " ; echo "${changed_lang_files[*]}")
|
||||
|
||||
|
||||
forbidden_files=""
|
||||
#forbidden_files=$(echo "$all_changed_lang" | grep -E 'htdocs/langs/([^/]+)/.*\.lang$' | grep -v 'htdocs/langs/en_US/')
|
||||
#if [ -n "$forbidden_files" ]; then
|
||||
# echo "You tried to modify one or more language files that are not allowed to be modified in Pull requests."
|
||||
# echo "$forbidden_files"
|
||||
# echo "To modify translation that are not the source language (en_US), you must modify them from transifex.com"
|
||||
# echo "To modify translations that are not the source language (en_US), you must modify them from transifex.com"
|
||||
# exit 10
|
||||
#fi
|
||||
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ foreach my $PROJECT (@PROJECTLIST) {
|
|||
. ucfirst($PROJECT)
|
||||
. ".class.php"
|
||||
);
|
||||
$custom = 0;
|
||||
$custom = 1;
|
||||
if ( !$result ) {
|
||||
$result = open(
|
||||
$IN,
|
||||
|
|
@ -180,7 +180,7 @@ foreach my $PROJECT (@PROJECTLIST) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
$custom = 1;
|
||||
$custom = 0;
|
||||
}
|
||||
while (<$IN>) {
|
||||
if ( $_ =~ /this->version\s*=\s*'([\d\.]+)'/ ) {
|
||||
|
|
|
|||
|
|
@ -580,13 +580,29 @@ if (!empty($conf->use_javascript_ajax)) {
|
|||
print "\n" . '<script type="text/javascript">';
|
||||
print '$(document).ready(function () {
|
||||
function toggleSubledger() {
|
||||
var isCentral = $("#accountingaccount_number option:selected").data("centralized");
|
||||
console.log("the selected general ledger account is centralised?", isCentral);
|
||||
if (isCentral) {
|
||||
$("#subledger_account, #subledger_label").prop("disabled", false);
|
||||
} else {
|
||||
$("#subledger_account, #subledger_label").prop("disabled", true);
|
||||
}
|
||||
var isCentral = $("#accountingaccount_number option:selected").data("centralized");
|
||||
console.log("the selected general ledger account is centralised?", isCentral);
|
||||
|
||||
var isAjaxMode = $("#search_subledger_account").length > 0;
|
||||
var $visibleSubledger = isAjaxMode
|
||||
? $("#search_subledger_account")
|
||||
: $("#subledger_account");
|
||||
|
||||
if (isCentral) {
|
||||
$visibleSubledger.prop("disabled", false);
|
||||
if (!isAjaxMode) {
|
||||
$("#subledger_account").prop("disabled", false).trigger("change");
|
||||
}
|
||||
$("#subledger_label").prop("disabled", false);
|
||||
} else {
|
||||
$visibleSubledger.prop("disabled", true).val("");
|
||||
if (!isAjaxMode) {
|
||||
$("#subledger_account").val("").prop("disabled", true).trigger("change");
|
||||
} else {
|
||||
$("#subledger_account").val("");
|
||||
}
|
||||
$("#subledger_label").val("").prop("disabled", true);
|
||||
}
|
||||
}
|
||||
|
||||
toggleSubledger();
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2019 JC Prieto <jcprieto@virtual20.com><prietojc@gmail.com>
|
||||
* Copyright (C) 2022-2025 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2026 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -1426,7 +1426,7 @@ class Account extends CommonObject
|
|||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$response->nbtodo++;
|
||||
if ($this->db->jdate($obj->datefin) < ($now - $conf->bank->rappro->warning_delay)) {
|
||||
if ((int) $this->db->jdate($obj->datefin) < ($now - $conf->bank->rappro->warning_delay)) {
|
||||
$response->nbtodolate++;
|
||||
}
|
||||
}
|
||||
|
|
@ -2626,7 +2626,7 @@ class AccountLine extends CommonObjectLine
|
|||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$newdate = $this->db->jdate($obj->datev) + (3600 * 24 * $sign);
|
||||
$newdate = (int) $this->db->jdate($obj->datev) + (3600 * 24 * $sign);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bank SET";
|
||||
$sql .= " datev = '".$this->db->idate($newdate)."'";
|
||||
|
|
@ -2689,7 +2689,7 @@ class AccountLine extends CommonObjectLine
|
|||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$newdate = $this->db->jdate($obj->dateo) + (3600 * 24 * $sign);
|
||||
$newdate = (int) $this->db->jdate($obj->dateo) + (3600 * 24 * $sign);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bank SET";
|
||||
$sql .= " dateo = '".$this->db->idate($newdate)."'";
|
||||
|
|
|
|||
|
|
@ -2564,7 +2564,7 @@ if (empty($reshook)) {
|
|||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if ($qty < 0) {
|
||||
if ($qty < 0 && !getDolGlobalString('INVOICE_ENABLE_NEGATIVE_QTY')) {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors');
|
||||
$error++;
|
||||
|
|
@ -2585,7 +2585,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
$price_base_type = null;
|
||||
if (!$error && ($qty >= 0) && (!empty($line_desc) || (!empty($idprod) && $idprod > 0))) {
|
||||
if (!$error && (!empty($line_desc) || (!empty($idprod) && $idprod > 0))) {
|
||||
$ret = $object->fetch($id);
|
||||
if ($ret < 0) {
|
||||
dol_print_error($db, $object->error);
|
||||
|
|
@ -3199,7 +3199,7 @@ if (empty($reshook)) {
|
|||
$error++;
|
||||
}
|
||||
}
|
||||
if ($qty < 0) {
|
||||
if ($qty < 0 && !getDolGlobalString('INVOICE_ENABLE_NEGATIVE_QTY')) {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors');
|
||||
$error++;
|
||||
|
|
|
|||
|
|
@ -65,6 +65,9 @@ $limit = getDolGlobalInt('ACCOUNTANCY_AUXACCOUNT_SEARCH_LIMIT', 100);
|
|||
$minLength = getDolGlobalInt('ACCOUNTANCY_AUXACCOUNT_USE_SEARCH_TO_SELECT', 2) - 1;
|
||||
|
||||
$results = array();
|
||||
/**
|
||||
* @var array<string,mixed> $results
|
||||
*/
|
||||
|
||||
if (strlen($searchkey) >= $minLength) {
|
||||
// Search anywhere by default (use LIKE '%term%')
|
||||
|
|
@ -87,17 +90,19 @@ if (strlen($searchkey) >= $minLength) {
|
|||
if (!empty($obj->code_client)) {
|
||||
$key = $obj->code_client;
|
||||
$results[$key] = array(
|
||||
'key' => $key,
|
||||
'value' => $key, // value shown in input once selected
|
||||
'label' => $key.' ('.$obj->name.')', // label shown in dropdown list
|
||||
'key' => $key,
|
||||
'value' => $key.' ('.$obj->name.')', // value shown in input once selected
|
||||
'label' => $key.' ('.$obj->name.')', // label shown in dropdown list
|
||||
'label_name' => $obj->name,
|
||||
);
|
||||
}
|
||||
if (!empty($obj->code_fourn) && !isset($results[$obj->code_fourn])) {
|
||||
$key = $obj->code_fourn;
|
||||
$results[$key] = array(
|
||||
'key' => $key,
|
||||
'value' => $key,
|
||||
'label' => $key.' ('.$obj->name.')',
|
||||
'key' => $key,
|
||||
'value' => $key.' ('.$obj->name.')',
|
||||
'label' => $key.' ('.$obj->name.')',
|
||||
'label_name' => $obj->name,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -124,9 +129,10 @@ if (strlen($searchkey) >= $minLength) {
|
|||
$key = $obj->accountancy_code;
|
||||
$fullname = dolGetFirstLastname($obj->firstname, $obj->lastname);
|
||||
$results[$key] = array(
|
||||
'key' => $key,
|
||||
'value' => $key,
|
||||
'label' => $key.' ('.$fullname.')',
|
||||
'key' => $key,
|
||||
'value' => $key.' ('.$fullname.')',
|
||||
'label' => $key.' ('.$fullname.')',
|
||||
'label_name' => $fullname,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5958,7 +5958,7 @@ abstract class CommonObject
|
|||
$this->tpl['strike'] = 0;
|
||||
if ($restrictlist == 'services' && $line->product_type != Product::TYPE_SERVICE) {
|
||||
$this->tpl['strike'] = 1;
|
||||
} elseif ($line->special_code == SUBTOTALS_SPECIAL_CODE) {
|
||||
} elseif (defined('SUBTOTALS_SPECIAL_CODE') && $line->special_code == SUBTOTALS_SPECIAL_CODE) {
|
||||
$this->tpl['strike'] = 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -497,7 +497,7 @@ class FormAccounting extends Form
|
|||
* @param string $htmlname Name of field in html form
|
||||
* @param int|string $showempty Add an empty field
|
||||
* @param string $morecss More css
|
||||
* @param string $usecache Key to use for cache (mode 0 only)
|
||||
* @param string $usecache Key to use for cache (mode 1 only)
|
||||
* @param string $labelhtmlname HTML name of label input for autofill of subledger label
|
||||
* @param string $selected_input_value Displayed text of preselected entry (ajax modes 2/3/4 only)
|
||||
* @return string|int<-1,-1> HTML string or -1 on error
|
||||
|
|
@ -509,10 +509,11 @@ class FormAccounting extends Form
|
|||
|
||||
$out = '';
|
||||
$auxaccount_mode = getDolGlobalInt('ACCOUNTANCY_AUXACCOUNT_USE_SEARCH_TO_SELECT', 0);
|
||||
$placeholder = (!empty($showempty) && !is_numeric($showempty)) ? $showempty : $langs->trans("SubledgerAccount");
|
||||
|
||||
// MODE 0: free text input - no list, no autocomplete
|
||||
if ($auxaccount_mode == 0) {
|
||||
$out .= '<input type="text" class="'.$morecss.'" name="'.$htmlname.'" id="'.$htmlname.'" value="'.$selectid.'" />';
|
||||
$out .= '<input type="text" class="'.$morecss.'" name="'.$htmlname.'" id="'.$htmlname.'" value="'.dol_escape_htmltag($selectid).'" placeholder="'.dol_escape_htmltag($placeholder).'" />';
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
|
@ -553,28 +554,18 @@ class FormAccounting extends Form
|
|||
}
|
||||
|
||||
// Visible text input — targeted by ajax_autocompleter() JavaScript via "input#search_$htmlname"
|
||||
$placeholder = (!empty($showempty) && !is_numeric($showempty)) ? $showempty : $langs->trans("Search");
|
||||
$out .= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.dol_escape_htmltag($selected_input_value).'" placeholder="'.$langs->trans($placeholder).'" />';
|
||||
|
||||
// Hidden input + jQuery UI autocomplete JS — the hidden id="$htmlname" is generated by ajax_autocompleter() itself
|
||||
$out .= ajax_autocompleter($selectid, $htmlname, DOL_URL_ROOT.'/core/ajax/auxaccount.php', $urloption, $minLength, 0, array());
|
||||
$out .= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.dol_escape_htmltag($selected_input_value).'" placeholder="'.dol_escape_htmltag($placeholder).'" />';
|
||||
|
||||
// Autofill subledger label — listen on "change" of the hidden field
|
||||
// ajax_autocompleter() calls .val(ui.item.id).trigger("change") on the hidden field upon selection
|
||||
// auxaccount.php returns 'label_name' = just the name without the account code
|
||||
$ajaxoptions = array();
|
||||
if (!empty($labelhtmlname)) {
|
||||
$out .= '<script nonce="'.getNonce().'">
|
||||
jQuery(document).ready(function() {
|
||||
$("#'.dol_escape_js($htmlname).'").on("change", function() {
|
||||
var searchVal = $("#search_'.dol_escape_js($htmlname).'").val();
|
||||
var match = /\(([^)]+)\)/.exec(searchVal);
|
||||
if (match) {
|
||||
$("input[name=\"'.dol_escape_js($labelhtmlname).'\"]").val(match[1]);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
$ajaxoptions['update'] = array($labelhtmlname => 'label_name');
|
||||
}
|
||||
|
||||
// Hidden input + jQuery UI autocomplete JS
|
||||
$out .= ajax_autocompleter($selectid, $htmlname, DOL_URL_ROOT.'/core/ajax/auxaccount.php', $urloption, $minLength, 0, $ajaxoptions);
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
|
@ -637,15 +628,14 @@ class FormAccounting extends Form
|
|||
}
|
||||
|
||||
// Build native select — select2 is automatically activated by Form::selectarray() with $useajax=1
|
||||
$out .= Form::selectarray($htmlname, $aux_account, $selectid, ($showempty ? (is_numeric($showempty) ? 1 : $showempty) : 0), 0, 0, '', 0, 0, 0, '', $morecss, 1);
|
||||
$out .= Form::selectarray($htmlname, $aux_account, $selectid, $placeholder, 0, 0, '', 0, 0, 0, '', $morecss, 1);
|
||||
|
||||
// Autofill subledger label on select2 selection event
|
||||
// Autofill subledger label on select2 selection event (mode 1 only)
|
||||
if (!empty($conf->use_javascript_ajax) && !empty($labelhtmlname)) {
|
||||
$out .= '<script nonce="'.getNonce().'">
|
||||
jQuery(document).ready(() => {
|
||||
$("#'.dol_escape_js($htmlname).'").on("select2:select", function(e) {
|
||||
var regExp = /\(([^)]+)\)/;
|
||||
const match = regExp.exec(e.params.data.text);
|
||||
var match = /\(([^)]+)\)/.exec(e.params.data.text);
|
||||
if (match) { $("input[name=\"'.dol_escape_js($labelhtmlname).'\"]").val(match[1]); }
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ $fullpath_original_file = getMultidirOutput($object, 'ticket').'/'.$original_fil
|
|||
|
||||
// Security:
|
||||
// Limit access if permissions are wrong
|
||||
if (!$accessallowed) {
|
||||
if (!$accessallowed) { // @phpstan-ignore-line as value is set to 1 just before
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
|
@ -269,7 +269,7 @@ if (!file_exists($fullpath_original_file_osencoded)) {
|
|||
top_httphead($type);
|
||||
|
||||
header('Content-Description: File Transfer');
|
||||
if ($encoding) {
|
||||
if ($encoding) { // @phpstan-ignore-line as variable is set to '' and never change
|
||||
header('Content-Encoding: '.$encoding);
|
||||
}
|
||||
// Add MIME Content-Disposition from RFC 2183 (inline=automatically displayed, attachment=need user action to open)
|
||||
|
|
@ -289,7 +289,7 @@ if (is_object($db)) {
|
|||
}
|
||||
|
||||
// Send file now
|
||||
if ($readfile) {
|
||||
if ($readfile) { // @phpstan-ignore-line as value is set to true just before
|
||||
header('Content-Length: '.dol_filesize($fullpath_original_file));
|
||||
|
||||
readfileLowMemory($fullpath_original_file_osencoded);
|
||||
|
|
|
|||
Loading…
Reference in a new issue