Skip to content

Commit

Permalink
Merge branch 'Dolibarr:develop' into patch-8
Browse files Browse the repository at this point in the history
  • Loading branch information
thibdrev authored Jan 28, 2024
2 parents 86e20f4 + f8d89bf commit a85af3c
Show file tree
Hide file tree
Showing 40 changed files with 435 additions and 365 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ jobs:
- name: Install required tools
run: sudo apt-get update && sudo apt-get install cppcheck
if: false

# The next uses the git API because there is no clone yet.
# This is faster for a big repo.
- name: Get all changed php files (if PR)
id: changed-php
uses: tj-actions/changed-files@v42
if: github.event_name == 'pull_request'
with:
files: |
**.php
# Checkout git sources to analyze
- uses: actions/checkout@v4
# Action setup-python needs a requirements.txt or pyproject.toml
Expand Down Expand Up @@ -42,6 +53,24 @@ jobs:
set -o pipefail
pre-commit gc
pre-commit run --show-diff-on-failure --color=always --all-files | tee ${RAW_LOG}
# The next uses git, which is slow for a bit repo.
# - name: Get all changed php files (if PR)
# id: changed-php
# uses: tj-actions/changed-files@v42
# if: github.event_name == 'pull_request'
# with:
# files: |
# **.php

- name: Run some pre-commit hooks on selected changed files only
if: steps.changed-php.outputs.any_changed == 'true'
env:
ALL_CHANGED_FILES: ${{ steps.changed-php.outputs.all_changed_files }}
run: |
set -o pipefail
pre-commit run php-cs ${ALL_CHANGED_FILES} | tee -a ${RAW_LOG}
# If error, we convert log in the checkstyle format
- name: Convert Raw Log to CheckStyle format
if: ${{ failure() }}
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ exclude: (?x)^( htdocs/includes/ckeditor/.* )
repos:
# Several miscellaneous checks and fix (on yaml files, end of files fix)
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: no-commit-to-branch
args: [--branch, develop, --pattern, \d+.0]
Expand Down Expand Up @@ -87,7 +87,7 @@ repos:

# Check format of yaml files
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.32.0
rev: v1.33.0
hooks:
- id: yamllint
args:
Expand All @@ -97,7 +97,7 @@ repos:

# Execute codespell to fix typo errors (setup of codespell into dev/tools/codespell/)
- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
rev: v2.2.6
hooks:
- id: codespell
# Due to a current limitation of configuration files,
Expand Down Expand Up @@ -142,7 +142,7 @@ repos:

# Check some shell scripts
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.5
rev: v0.9.0.6
hooks:
- id: shellcheck
args: [-W, '100']
15 changes: 10 additions & 5 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ The following changes may create regressions for some external modules, but were
For users:
----------
NEW: Compatibility with PHP 8.2
NEW: Module for Advanced stock transfer is now stable (#26594)
NEW: Module Workstation (used to enhance the module BOM and Manufacturing Order) is now stable
NEW: Add a confirmation popup when deleting extrafields
NEW: Add type 'icon' type for extrafields
Expand Down Expand Up @@ -188,10 +187,15 @@ NEW: updating for display Help title when try to delete Don (issue #25314)
NEW: Upgrade in module builder in menu section
NEW: use account address in sepa mandate (#23642)
NEW: VAT rate - Add entity
<<<<<<< HEAD
NEW: webportal site account
NEW: When an user unset the batch management of products, transformation of each batch stock movement in global stock movement

FIX: #25828 wrong odt style naming
=======
NEW: When an user unset the batch management of products, transformation of each batch stock mouvement in global stock mouvement
NEW: PDF Generation for each Human Resource Evaluations.
>>>>>>> branch '19.0' of [email protected]:Dolibarr/dolibarr.git

SEC: #25512 applicative anti bruteforce - security on too many login attempts (#25520)
SEC: Add action confirm_... as sensitive to need a CSRF token
Expand Down Expand Up @@ -264,6 +268,8 @@ WARNING:
--------

The following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* Recheck the setup of your module Workflow to see if you need to enable the new setting to have shipment set to billed automatically when
an invoice from a shipment is validated (and if your process is to make invoice on shipment and not on order), because this setup has changed.
* The hook changeHelpURL is replaced by llxHeader
* The property ->brouillon has been removed from all classes. It was not reliable and was a duplicate of ->status == self::STATUS_DRAFT.
* The duplicated and deprecated property ->date_livraison that was renamed into ->delivery_date has been completely removed.
Expand All @@ -272,19 +278,18 @@ The following changes may create regressions for some external modules, but were
* The property ->user_creation to store ID of user of creation has been renamed into ->user_creation_id.
* The property ->user_modification to store ID of user of modification has been renamed into ->user_modification_id.
* The private array ->status_short, ->statuts and ->status_long are now array ->labelStatusShort and ->labelStatus everywhere.
* The duplicate property ->user_creat, ->date_creat, ->date_valid has been removed (use instead user_creation, date_creation, date_validation).
* The duplicate property ->user_creat, ->date_creat, ->date_valid have been removed (use instead user_creation, date_creation, date_validation).
* The method get_substitutionarray_shipment_lines() has been removed. Use the generic get_substitutionarray_lines() instead.
* The method ProductcustomerPrice->fetch_all_log() has been renamed into camel case ->fetchAllLog()
* Recheck the setup of your module Workflow to see if you need to enable the new setting to have shipment set to billed automatically when
an invoice from a shipment is validated (and if your process is to make invoice on shipment and not on order), because this setup has changed.
* It was possible to use a variable $soc or $right inside a PHP code condition of some extrafields properties, this is no more true (this 2 variables are no more global variables).
* New hook files of modules actions_mymodule.class.php should now "extends CommonHookActions"
* Endpoint for API /partnershipapi and /recruitment has been renamed into /partnerships and /recruitments to follow name conventions.
* Hidden option ACCOUNTANCY_AUTOFIX_MISSING_LINK_TO_USEr_ON_SALARY_BANK_PAYMENT has been renamed into ACCOUNTANCY_AUTOFIX_MISSING_LINK_TO_USER_ON_SALARY_BANK_PAYMENT
* Hidden option ACCOUNTANCY_AUTOFIX_MISSING_LINK_TO_USER_ON_SALARY_BANK_PAYMENT has been renamed into ACCOUNTANCY_AUTOFIX_MISSING_LINK_TO_USER_ON_SALARY_BANK_PAYMENT
* The delete() method of AdherentType, Contact, Delivery, MultiCurrency, CurrencyRate now need $user as first parameter.
* A very high number of class properties (with old name in french) are now deprecated in favor of the property name in english.
* The load of hook context productdao has been removed before calling loadvirtualstock. Modules must use the context of main parent page or 'all' for all cases.


***** ChangeLog for 18.0.4 compared to 18.0.3 *****
FIX: $this->newref already exists and could have been modified by trigger but we still use a local variable for the filesystem-based renaming
FIX: 16.0 only, backport fix for SQL error on global search product
Expand Down
8 changes: 4 additions & 4 deletions htdocs/compta/facture/card-rec.php
Original file line number Diff line number Diff line change
Expand Up @@ -1595,17 +1595,17 @@
print '</td>';
print '</tr>';

// Status of generated invoices
// Status of auto generated invoices
print '<tr><td>';
if ($action == 'auto_validate' || $object->frequency > 0) {
print $form->editfieldkey($langs->trans("StatusOfGeneratedInvoices"), 'auto_validate', $object->auto_validate, $object, $user->hasRight('facture', 'creer'));
print $form->editfieldkey($langs->trans("StatusOfAutoGeneratedInvoices"), 'auto_validate', $object->auto_validate, $object, $user->hasRight('facture', 'creer'));
} else {
print $langs->trans("StatusOfGeneratedInvoices");
print $langs->trans("StatusOfAutoGeneratedInvoices");
}
print '</td><td>';
$select = 'select;0:'.$langs->trans('BillStatusDraft').',1:'.$langs->trans('BillStatusValidated');
if ($action == 'auto_validate' || $object->frequency > 0) {
print $form->editfieldval($langs->trans("StatusOfGeneratedInvoices"), 'auto_validate', $object->auto_validate, $object, $user->hasRight('facture', 'creer'), $select);
print $form->editfieldval($langs->trans("StatusOfAutoGeneratedInvoices"), 'auto_validate', $object->auto_validate, $object, $user->hasRight('facture', 'creer'), $select);
}
print '</td>';
// Auto generate documents
Expand Down
26 changes: 16 additions & 10 deletions htdocs/core/class/commonobject.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -7314,22 +7314,27 @@ public function showInputField($val, $key, $value, $moreparam = '', $keysuffix =
$out .= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0);
}

$out .= '<select class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam ? $moreparam : '').'>';
if ((!isset($this->fields[$key]['default'])) || ($this->fields[$key]['notnull'] != 1)) {
$out .= '<option value="0">&nbsp;</option>';
}
$tmpselect = '';
$nbchoice = 0;
foreach ($param['options'] as $keyb => $valb) {
if ((string) $keyb == '') {
continue;
}
if (strpos($valb, "|") !== false) {
list($valb, $parent) = explode('|', $valb);
}
$out .= '<option value="'.$keyb.'"';
$out .= (((string) $value == (string) $keyb) ? ' selected' : '');
$out .= (!empty($parent) ? ' parent="'.$parent.'"' : '');
$out .= '>'.$valb.'</option>';
$nbchoice++;
$tmpselect .= '<option value="'.$keyb.'"';
$tmpselect .= (((string) $value == (string) $keyb) ? ' selected' : '');
$tmpselect .= (!empty($parent) ? ' parent="'.$parent.'"' : '');
$tmpselect .= '>'.$valb.'</option>';
}

$out .= '<select class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam ? $moreparam : '').'>';
if ((!isset($this->fields[$key]['default'])) || ($this->fields[$key]['notnull'] != 1) || $nbchoice >= 2) {
$out .= '<option value="0">&nbsp;</option>';
}
$out .= $tmpselect;
$out .= '</select>';
} elseif ($type == 'sellist') {
$out = '';
Expand Down Expand Up @@ -7814,7 +7819,7 @@ public function showOutputField($val, $key, $value, $moreparam = '', $keysuffix
$form = new Form($this->db);
}

$label = empty($val['label']) ? '' : $val['label'];
//$label = empty($val['label']) ? '' : $val['label'];
$type = empty($val['type']) ? '' : $val['type'];
$size = empty($val['css']) ? '' : $val['css'];
$reg = array();
Expand Down Expand Up @@ -8217,7 +8222,8 @@ public function showOutputField($val, $key, $value, $moreparam = '', $keysuffix
$value = '';
}
} elseif ($type == 'password') {
$value = preg_replace('/./i', '*', $value);
$value = '<span class="opacitymedium">'.$langs->trans("Encrypted").'</span>';
//$value = preg_replace('/./i', '*', $value);
} elseif ($type == 'array') {
$value = implode('<br>', $value);
} else { // text|html|varchar
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/class/html.formmail.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ public function get_form($addfileaction = 'addfile', $removefileaction = 'remove

//input prompt AI
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
if (isModEnabled('ai') && getDolGlobalConst('AI_CHATGPT_API_KEY')) {
if (isModEnabled('ai') && getDolGlobalString('AI_CHATGPT_API_KEY')) {
$out .= $this->getHtmlForInstruction();
}
// Message
Expand Down
8 changes: 4 additions & 4 deletions htdocs/core/class/menubase.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -497,17 +497,17 @@ public function initAsSpecimen()
$this->module = 'specimen';
$this->type = 'top';
$this->mainmenu = '';
$this->fk_menu = '0';
$this->position = '';
$this->fk_menu = 0;
$this->position = 0;
$this->url = 'http://dummy';
$this->target = '';
$this->title = 'Specimen menu';
$this->langs = '';
$this->leftmenu = '';
$this->perms = '';
$this->enabled = '';
$this->user = '';
$this->tms = '';
$this->user = 0;
$this->tms = dol_now();
}


Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/lib/date.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ function dol_get_last_hour($date, $gm = 'tzserver')
* @param int $date Date GMT
* @param mixed $gm False or 0 or 'tzserver' = Return date to compare with server TZ,
* 'gmt' to compare with GMT date.
* @return int Date for last hour of a given date
* @return int Date for first hour of a given date
*/
function dol_get_first_hour($date, $gm = 'tzserver')
{
Expand Down
1 change: 1 addition & 0 deletions htdocs/core/lib/functions.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,7 @@ function GETPOSTINT($paramname, $method = 0)
* @param string $paramname Name of the $_GET or $_POST parameter
* @param string|int $rounding Type of rounding ('', 'MU', 'MT, 'MS', 'CU', 'CT', integer) {@see price2num()}
* @return float Value converted into float
* @since Dolibarr V20
*/
function GETPOSTFLOAT($paramname, $rounding = '')
{
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/lib/profid.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ function isValidTinForBE($str)
$str = trim($str);
$str = preg_replace('/(\s)/', '', $str);

if (preg_match('/(^[0-9]{4}\.[0-9]{3}\.[0-9]{3}$)/', $str)) {
if (preg_match('/(^[0-1]{1}[0-9]{3}\.[0-9]{3}\.[0-9]{3}$)/', $str)) {
return true;
} else {
return false;
Expand Down
4 changes: 0 additions & 4 deletions htdocs/core/modules/modOpenSurvey.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ class modOpenSurvey extends DolibarrModules
*/
public function __construct($db)
{
global $langs, $conf;

$this->db = $db;

// Id for module (must be unique).
Expand Down Expand Up @@ -181,8 +179,6 @@ public function __construct($db)
*/
public function init($options = '')
{
global $conf, $langs;

$result = $this->_load_tables('/install/mysql/', 'opensurvey');
if ($result < 0) {
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
Expand Down
8 changes: 4 additions & 4 deletions htdocs/core/modules/modTakePos.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class modTakePos extends DolibarrModules
*/
public function __construct($db)
{
global $langs, $conf;
global $conf;

$this->db = $db;

Expand All @@ -54,7 +54,7 @@ public function __construct($db)
// It is used to group modules by family in module setup page
$this->family = "portal";
// Module position in the family on 2 digits ('01', '10', '20', ...)
$this->module_position = '60';
$this->module_position = '45';
// Gives the possibility to the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this)
//$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily")));

Expand Down Expand Up @@ -120,8 +120,8 @@ public function __construct($db)
//1=>array('TAKEPOS_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1)
);


if (!isset($conf->takepos) || !isset($conf->takepos->enabled)) {
// To avoid warning
if (!isModEnabled('takepos')) {
$conf->takepos = new stdClass();
$conf->takepos->enabled = 0;
}
Expand Down
Loading

0 comments on commit a85af3c

Please sign in to comment.