diff --git a/.github/workflows/ci-cache-clean-pr.yml b/.github/workflows/ci-cache-clean-pr.yml index 9713af46134..5b6866b52c3 100644 --- a/.github/workflows/ci-cache-clean-pr.yml +++ b/.github/workflows/ci-cache-clean-pr.yml @@ -18,7 +18,7 @@ jobs: contents: read steps: - name: Check out code - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Cleanup run: | gh extension install actions/gh-actions-cache diff --git a/.github/workflows/ci-checkmajorversion.yml b/.github/workflows/ci-checkmajorversion.yml index 047d9b66f11..918f302e73c 100644 --- a/.github/workflows/ci-checkmajorversion.yml +++ b/.github/workflows/ci-checkmajorversion.yml @@ -17,7 +17,7 @@ jobs: github.repository == 'Dolibarr/dolibarr' || github.event.schedule == false steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Setup PHP uses: shivammathur/setup-php@v2 with: diff --git a/.github/workflows/ci-phpstan_baseline.yml b/.github/workflows/ci-phpstan_baseline.yml index a68414b62df..692d259d1d8 100644 --- a/.github/workflows/ci-phpstan_baseline.yml +++ b/.github/workflows/ci-phpstan_baseline.yml @@ -33,7 +33,7 @@ jobs: pull-requests: write steps: - name: Checkout - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Setup PHP uses: shivammathur/setup-php@v2 with: diff --git a/.github/workflows/phan.yml b/.github/workflows/phan.yml index 7004f68d1ea..9accfc8212d 100644 --- a/.github/workflows/phan.yml +++ b/.github/workflows/phan.yml @@ -33,7 +33,7 @@ jobs: github.repository == 'Dolibarr/dolibarr' || github.event.schedule == false steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Setup PHP uses: shivammathur/setup-php@v2 with: diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index d41d022a643..671326f83c1 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -37,7 +37,7 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 # Get PHP and addons - name: Setup PHP id: setup-php diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 48fc9cf2dfd..7cc7ed6f379 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -30,7 +30,7 @@ jobs: # if: false # Checkout git sources to analyze - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 # Try to get the list of modified files into steps.changed-php.outputs.all_changed_files #- name: Get changed files diff --git a/.github/workflows/windows-ci.yml b/.github/workflows/windows-ci.yml index cd772236d67..781a433bfbc 100644 --- a/.github/workflows/windows-ci.yml +++ b/.github/workflows/windows-ci.yml @@ -37,7 +37,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout code - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Setup PHP uses: shivammathur/setup-php@v2 with: diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index 318e44dc892..72c00d61c3e 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -31,13 +31,6 @@ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsocialcontrib.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; - /** * @var Conf $conf * @var DoliDB $db @@ -45,6 +38,12 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsocialcontrib.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; // Load translation files required by the page $langs->loadLangs(array('compta', 'banks', 'bills', 'hrm', 'projects')); @@ -103,15 +102,13 @@ if (!$sortorder) { $sortorder = "DESC"; } -$filtre = GETPOSTINT("filtre"); - $arrayfields = array( 'cs.rowid' => array('label' => "Ref", 'checked' => '1', 'position' => 10), 'cs.libelle' => array('label' => "Label", 'checked' => '1', 'position' => 20), 'cs.fk_type' => array('label' => "Type", 'checked' => '1', 'position' => 30), 'cs.date_ech' => array('label' => "Date", 'checked' => '1', 'position' => 40), 'cs.periode' => array('label' => "PeriodEndDate", 'checked' => '1', 'position' => 50), - 'p.ref' => array('label' => "ProjectRef", 'checked' => '1', 'position' => 60, 'enabled' => (string) (int) (isModEnabled('project'))), + 'p.ref' => array('label' => "ProjectRef", 'checked' => '-1', 'position' => 60, 'enabled' => (string) (int) (isModEnabled('project'))), 'cs.fk_user' => array('label' => "Employee", 'checked' => '1', 'position' => 70), 'cs.fk_mode_reglement' => array('checked' => '-1', 'position' => 80, 'label' => "DefaultPaymentMode"), 'cs.amount' => array('label' => "Amount", 'checked' => '1', 'position' => 100), @@ -521,21 +518,21 @@ if (!empty($arrayfields['p.ref']['checked'])) { if (!empty($arrayfields['cs.fk_user']['checked'])) { // Employee print ''; - print $form->select_dolusers($search_users, 'search_users', 1, null, 0, '', '', '0', 0, 0, '', 0, '', 'maxwidth150', 0, 0, true); + print $form->select_dolusers($search_users, 'search_users', 1, null, 0, '', '', '0', 0, 0, '', 0, '', 'maxwidth125', 0, 0, true); print ''; } // Filter: Type if (!empty($arrayfields['cs.fk_mode_reglement']['checked'])) { print ''; - print $form->select_types_paiements($search_type, 'search_type', '', 0, 1, 1, 0, 1, 'maxwidth150', 1); + print $form->select_types_paiements($search_type, 'search_type', '', 0, 1, 1, 0, 1, 'maxwidth125', 1); print ''; } // Filter: Bank Account if (!empty($arrayfields['cs.fk_account']['checked'])) { print ''; - $form->select_comptes($search_account, 'search_account', 0, '', 1, '', 0, 'maxwidth150'); + $form->select_comptes($search_account, 'search_account', 0, '', 1, '', 0, 'maxwidth125'); print ''; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 8da9a94beab..4ccad75628f 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -74,18 +74,25 @@ class Form /** @var array */ public $result; - /** @var int Number of line returned by method to generate combo select */ + /** @var int Number of lines returned by method to generate combo select */ public $num; // Cache arrays + /** @var array */ public $cache_types_paiements = array(); + /** @var array */ public $cache_conditions_paiements = array(); + /** @var array */ public $cache_transport_mode = array(); /** @var array */ public $cache_availability = array(); + /** @var array */ public $cache_demand_reason = array(); + /** @var array */ public $cache_types_fees = array(); + /** @var array */ public $cache_vatrates = array(); + /** @var array */ public $cache_invoice_subtype = array(); /** @var array */ public $cache_rule_for_lines_dates = array(); @@ -4755,7 +4762,7 @@ class Form $label = $langs->trans($obj->code); // So translation key SRC_XXX will work } - $tmparray[$obj->rowid]['id'] = $obj->rowid; + $tmparray[$obj->rowid]['id'] = (int) $obj->rowid; $tmparray[$obj->rowid]['code'] = $obj->code; $tmparray[$obj->rowid]['label'] = $label; $i++; @@ -7300,7 +7307,7 @@ class Form $obj = $this->db->fetch_object($resql); $tmparray = array(); - $tmparray['rowid'] = $obj->rowid; + $tmparray['rowid'] = (int) $obj->rowid; $tmparray['type_vat'] = ($obj->type_vat <= 0 ? 0 : $obj->type_vat); // Some version have type_vat corrupted with value -1 $tmparray['code'] = $obj->code; $tmparray['txtva'] = $obj->taux; @@ -7793,11 +7800,13 @@ class Form $reduceformat = (!empty($conf->dol_optimize_smallscreen) ? 1 : 0); // Test on original $format param. if ($reduceformat) { $format = str_replace('%Y', '%y', $langs->transnoentitiesnoconv("FormatDateShortInput")); // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript + $formatjslong = $langs->transnoentitiesnoconv("FormatDateShortJavaInput"); // don't trust the name $formatjs = str_replace('yyyy', 'yy', $langs->transnoentitiesnoconv("FormatDateShortJavaInput")); $formatjquery = str_replace('yyyy', 'yy', $langs->trans("FormatDateShortJQueryInput")); } else { - $format = $langs->transnoentitiesnoconv("FormatDateShortInput"); // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript - $formatjs = $langs->transnoentitiesnoconv("FormatDateShortJavaInput"); // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript + $format = $langs->transnoentitiesnoconv("FormatDateShortInput"); // FormatDateShortInput for dol_print_date is same than FormatDateShortJavaInput for javascript + $formatjslong = $langs->transnoentitiesnoconv("FormatDateShortJavaInput"); // don't trust the name + $formatjs = $langs->transnoentitiesnoconv("FormatDateShortJavaInput"); // FormatDateShortInput for dol_print_date is same than FormatDateShortJavaInput for javascript $formatjquery = $langs->trans("FormatDateShortJQueryInput"); } @@ -7810,13 +7819,12 @@ class Form // Calendrier popup version eldy if ($usecalendar == "eldy") { // To have this manager working back, you must retrieve all functions showDP child found into the lib_head.js of v4 for example - // and use load the js so the call of showDP will works. - + // and load the js that contains them so the call of showDP will works. /* // Input area to enter date manually $retstring .= 'trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript + $retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($formatjslong")) . '\'); "'; // FormatDateShortInput for dol_print_date is same than FormatDateShortJavaInput for javascript $retstring .= ' autocomplete="off">'; // Icon calendar @@ -7875,7 +7883,7 @@ class Form $retstring .= 'automatic_activation) && is_array($objMod->automatic_activation) && isset($objMod->automatic_activation[$country_code])) { + if (isset($objMod->automatic_activation[$country_code])) { activateModule($modName); setEventMessages($objMod->automatic_activation[$country_code], null, 'warnings'); diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 2315a2e013a..b425ea09617 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -139,16 +139,16 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it */ public $rights_class; - const URL_FOR_BLACKLISTED_MODULES = 'https://ping.dolibarr.org/modules-blacklist.txt'; + public const URL_FOR_BLACKLISTED_MODULES = 'https://ping.dolibarr.org/modules-blacklist.txt'; - const KEY_ID = 0; - const KEY_LABEL = 1; - const KEY_TYPE = 2; // deprecated - const KEY_DEFAULT = 3; - const KEY_FIRST_LEVEL = 4; - const KEY_SECOND_LEVEL = 5; - const KEY_MODULE = 6; - const KEY_ENABLED = 7; + public const KEY_ID = 0; + public const KEY_LABEL = 1; + public const KEY_TYPE = 2; // deprecated + public const KEY_DEFAULT = 3; + public const KEY_FIRST_LEVEL = 4; + public const KEY_SECOND_LEVEL = 5; + public const KEY_MODULE = 6; + public const KEY_ENABLED = 7; /** * @var array|int<1,1> Module menu entries (1 means the menu entries are not declared into module descriptor but are hardcoded into menu manager) @@ -400,6 +400,11 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it */ public $disabled; + /** + * @var array Array [''=>''] + */ + public $automatic_activation = array(); + /** * @var int Module is enabled globally (Multicompany support) */ diff --git a/htdocs/core/modules/dons/html_cerfafr.modules.php b/htdocs/core/modules/dons/html_cerfafr.modules.php index 609443fa8f0..7148abfa637 100644 --- a/htdocs/core/modules/dons/html_cerfafr.modules.php +++ b/htdocs/core/modules/dons/html_cerfafr.modules.php @@ -5,7 +5,7 @@ * Copyright (C) 2012 Marcos García * Copyright (C) 2014-2020 Alexandre Spangaro * Copyright (C) 2015 Benoit Bruchard - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2025 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -172,7 +172,7 @@ class html_cerfafr extends ModeleDon $form = str_replace('__DONATOR_ADDRESS__', $don->address, $form); $form = str_replace('__DONATOR_ZIP__', $don->zip, $form); $form = str_replace('__DONATOR_TOWN__', $don->town, $form); - $form = str_replace('__PAYMENTMODE_LIB__ ', $paymentmode, $form); + $form = str_replace('__PAYMENTMODE_LIB__ ', (string) $paymentmode, $form); $form = str_replace('__NOW__', dol_print_date($now, 'day', false, $outputlangs), $form); $form = str_replace('__DonationRef__', $outputlangs->trans("DonationRef"), $form); $form = str_replace('__DonationTitle__', $outputlangs->trans("DonationTitle"), $form); diff --git a/htdocs/core/modules/dons/html_generic.modules.php b/htdocs/core/modules/dons/html_generic.modules.php index 622c8139cc0..5f7499cb2e5 100644 --- a/htdocs/core/modules/dons/html_generic.modules.php +++ b/htdocs/core/modules/dons/html_generic.modules.php @@ -6,7 +6,7 @@ * Copyright (C) 2014-2020 Alexandre Spangaro * Copyright (C) 2015 Benoit Bruchard * Copyright (C) 2015 Benjamin Neumann - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * 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 @@ -97,7 +97,7 @@ class html_generic extends ModeleDon $formclass->load_cache_types_paiements(); if ($don->mode_reglement_id) { - $paymentmode = $formclass->cache_types_paiements[$don->mode_reglement_id]['label']; + $paymentmode = (string) $formclass->cache_types_paiements[$don->mode_reglement_id]['label']; } else { $paymentmode = ''; } diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index 80e81be745a..bb9155f66b2 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -1,10 +1,11 @@ - * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2014 Marcos García - * Copyright (C) 2016 Charlie Benke - * Copyright (C) 2018-2025 Frédéric France +/* Copyright (C) 2010-2012 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2014 Marcos García + * Copyright (C) 2016 Charlie Benke + * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2024 MDW + * Copyright (C) 2025 Alexandre Spangaro * * 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 @@ -344,6 +345,19 @@ class doc_generic_invoice_odt extends ModelePDFFactures $nbProduct = 0; $nbService = 0; foreach ($object->lines as $line) { + // Do not take into account lines of the type “deposit.” + $is_deposit = false; + if (preg_match('/^\((.*)\)$/', $line->desc, $reg)) { + if ($reg[1] == 'DEPOSIT') { + $is_deposit = true; + } + } + + // If DEPOSIT, this line is completely ignored for calculations. + if ($is_deposit) { + continue; + } + // determine category of operation if ($categoryOfOperation < 2) { $lineProductType = $line->product_type; diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index b548cb510bf..29b1eadf415 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -13,7 +13,7 @@ * Copyright (C) 2022 Charlene Benke * Copyright (C) 2024-2025 MDW * Copyright (C) 2024-2025 Nick Fragoulis - * Copyright (C) 2024 Alexandre Spangaro + * Copyright (C) 2024-2025 Alexandre Spangaro * * 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 @@ -388,6 +388,19 @@ class pdf_crabe extends ModelePDFFactures $this->atleastonediscount++; } + // Do not take into account lines of the type “deposit.” + $is_deposit = false; + if (preg_match('/^\((.*)\)$/', $object->lines[$i]->desc, $reg)) { + if ($reg[1] == 'DEPOSIT') { + $is_deposit = true; + } + } + + // If DEPOSIT, this line is completely ignored for calculations. + if ($is_deposit) { + continue; + } + // determine category of operation if ($categoryOfOperation < 2) { $lineProductType = $object->lines[$i]->product_type; diff --git a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php index f7090067beb..3a2339b6b07 100644 --- a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php @@ -1,17 +1,17 @@ - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2008 Raphael Bertrand - * Copyright (C) 2010-2014 Juanjo Menent - * Copyright (C) 2012 Christophe Battarel - * Copyright (C) 2012 Cédric Salvador - * Copyright (C) 2012-2014 Raphaël Doursenaud - * Copyright (C) 2015 Marcos Garcia - * Copyright (C) 2017 Ferran Marcet - * Copyright (C) 2018-2025 Frédéric France - * Copyright (C) 2022 Anthony Berton - * Copyright (C) 2022-2025 Alexandre Spangaro - * Copyright (C) 2022-2024 Eric Seigne +/* Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2008 Raphael Bertrand + * Copyright (C) 2010-2014 Juanjo Menent + * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2012 Cédric Salvador + * Copyright (C) 2012-2014 Raphaël Doursenaud + * Copyright (C) 2015 Marcos Garcia + * Copyright (C) 2017 Ferran Marcet + * Copyright (C) 2018-2025 Frédéric France + * Copyright (C) 2022 Anthony Berton + * Copyright (C) 2022-2025 Alexandre Spangaro + * Copyright (C) 2022-2024 Eric Seigne * Copyright (C) 2024-2025 MDW * Copyright (C) 2024-2025 Nick Fragoulis * @@ -488,6 +488,19 @@ class pdf_octopus extends ModelePDFFactures $this->atleastonediscount++; } + // Do not take into account lines of the type “deposit.” + $is_deposit = false; + if (preg_match('/^\((.*)\)$/', $object->lines[$i]->desc, $reg)) { + if ($reg[1] == 'DEPOSIT') { + $is_deposit = true; + } + } + + // If DEPOSIT, this line is completely ignored for calculations. + if ($is_deposit) { + continue; + } + // determine category of operation if ($categoryOfOperation < 2) { $lineProductType = $object->lines[$i]->product_type; diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index ea7488c96a0..209ead0c0b6 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1,17 +1,17 @@ - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2008 Raphael Bertrand - * Copyright (C) 2010-2014 Juanjo Menent - * Copyright (C) 2012 Christophe Battarel - * Copyright (C) 2012 Cédric Salvador - * Copyright (C) 2012-2014 Raphaël Doursenaud - * Copyright (C) 2015 Marcos García - * Copyright (C) 2017 Ferran Marcet - * Copyright (C) 2018-2025 Frédéric France +/* Copyright (C) 2004-2024 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2008 Raphael Bertrand + * Copyright (C) 2010-2014 Juanjo Menent + * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2012 Cédric Salvador + * Copyright (C) 2012-2014 Raphaël Doursenaud + * Copyright (C) 2015 Marcos García + * Copyright (C) 2017 Ferran Marcet + * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2018-2024 Anthony Berton - * Copyright (C) 2022-2024 Alexandre Spangaro - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2022-2025 Alexandre Spangaro + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024-2025 Nick Fragoulis * Copyright (C) 2024 Franck Moreau * @@ -419,6 +419,19 @@ class pdf_sponge extends ModelePDFFactures $this->atleastonediscount++; } + // Do not take into account lines of the type “deposit.” + $is_deposit = false; + if (preg_match('/^\((.*)\)$/', $object->lines[$i]->desc, $reg)) { + if ($reg[1] == 'DEPOSIT') { + $is_deposit = true; + } + } + + // If DEPOSIT, this line is completely ignored for calculations. + if ($is_deposit) { + continue; + } + // determine category of operation if ($categoryOfOperation < 2) { $lineProductType = $object->lines[$i]->product_type; diff --git a/htdocs/core/tpl/subtotal_edit.tpl.php b/htdocs/core/tpl/subtotal_edit.tpl.php index ddae4132e4c..47f9cbdd373 100644 --- a/htdocs/core/tpl/subtotal_edit.tpl.php +++ b/htdocs/core/tpl/subtotal_edit.tpl.php @@ -141,7 +141,7 @@ if (getDolGlobalString('PRODUCT_USE_UNITS')) { foreach ($line_options as $key => $value) { if (in_array($line_type, $value['type'])) { print '
  • '; - print '
  • '; } diff --git a/htdocs/core/tpl/subtotal_view.tpl.php b/htdocs/core/tpl/subtotal_view.tpl.php index 4600e760bce..de0138aa2fc 100644 --- a/htdocs/core/tpl/subtotal_view.tpl.php +++ b/htdocs/core/tpl/subtotal_view.tpl.php @@ -2,6 +2,7 @@ /* Copyright (C) 2014-2017 Laurent Destailleur * Copyright (C) 2024 MDW * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2025 Charlene Benke * * 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 @@ -149,13 +150,13 @@ if ($line->qty > 0) { ?> // Handling colspan if margin module is enabled if (!empty($object->element) && in_array($object->element, array('facture', 'facturerec', 'propal', 'commande')) && isModEnabled('margin') && empty($user->socid)) { if ($user->hasRight('margins', 'creer')) { - print ''; + print ''; } if (getDolGlobalString('DISPLAY_MARGIN_RATES') && $user->hasRight('margins', 'liretous')) { - print ''; + print ''; } if (getDolGlobalString('DISPLAY_MARK_RATES') && $user->hasRight('margins', 'liretous')) { - print ''; + print ''; } } ?> diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 99a8b9a856b..9f647dbeefc 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -2107,7 +2107,8 @@ class Task extends CommonObjectLine $timespent->element_date = $this->timespent_date; $timespent->element_datehour = $this->timespent_datehour; - $timespent->element_date_withhour = $this->timespent_withhour; + + $timespent->element_date_withhour = $this->timespent_withhour; // 0 or 1 $timespent->element_duration = $this->timespent_duration; if ($this->timespent_fk_user > 0) { $timespent->fk_user = $this->timespent_fk_user; @@ -2118,7 +2119,9 @@ class Task extends CommonObjectLine $timespent->invoice_line_id = $this->timespent_invoicelineid; dol_syslog(get_class($this)."::updateTimeSpent", LOG_DEBUG); - if ($timespent->update($user) > 0) { + + $resupdate = $timespent->update($user); + if ($resupdate > 0) { if (!$notrigger) { // Call trigger $result = $this->call_trigger('TASK_TIMESPENT_MODIFY', $user); diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 473714fd644..65a29ab0cc8 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -33,15 +33,6 @@ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; -require_once DOL_DOCUMENT_ROOT . '/projet/class/task.class.php'; -require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formintervention.class.php'; - /** * @var Conf $conf * @var DoliDB $db @@ -53,6 +44,14 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formintervention.class.php'; ' @phan-var-force ?string $uploaddir '; +require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; +require_once DOL_DOCUMENT_ROOT . '/projet/class/task.class.php'; +require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formintervention.class.php'; // Load translation files required by the page $langsLoad = array('projects', 'bills', 'orders', 'companies'); @@ -72,8 +71,9 @@ $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'alpha'); $mode = GETPOST('mode', 'alpha'); -$id = GETPOSTINT('id'); -$projectid = GETPOSTINT('projectid'); +$id = GETPOSTINT('id'); // Id of task +$projectid = GETPOSTINT('projectid'); // Id of project +$lineid = GETPOSTINT('lineid'); // Id of time spent line $ref = GETPOST('ref', 'alpha'); $withproject = GETPOSTINT('withproject'); $project_ref = GETPOST('project_ref', 'alpha'); @@ -164,6 +164,7 @@ if ($object->fk_project > 0) { /* * Actions */ + $error = 0; if (GETPOST('cancel', 'alpha')) { @@ -289,11 +290,10 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us $timespent_date = dol_mktime(12, 0, 0, GETPOSTINT("timelinemonth"), GETPOSTINT("timelineday"), GETPOSTINT("timelineyear")); if (!$error) { - if (GETPOSTINT('taskid') != $id) { // GETPOST('taskid') is id of new task - $id_temp = GETPOSTINT('taskid'); // should not overwrite $id + if ($id && GETPOSTINT('taskid') != $id) { // GETPOSTINT('taskid') is the id of new task + $id_temp = GETPOSTINT('taskid'); // should not overwrite $id - - $object->fetchTimeSpent(GETPOSTINT('lineid')); + $object->fetchTimeSpent($lineid); $result = 0; @@ -326,7 +326,7 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us } } } else { - $object->fetch($id, $ref); + $object->fetch($id, $ref); // $object is Task $object->fetchTimeSpent(GETPOSTINT('lineid')); @@ -334,17 +334,22 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us $object->timespent_old_duration = GETPOSTINT("old_duration"); $object->timespent_duration = GETPOSTINT("new_durationhour") * 60 * 60; // We store duration in seconds $object->timespent_duration += (GETPOSTINT("new_durationmin") ? GETPOSTINT('new_durationmin') : 0) * 60; // We store duration in seconds + if (GETPOST("timelinehour") != '' && GETPOST("timelinehour") >= 0) { // If hour was entered - $object->timespent_date = dol_mktime(GETPOSTINT("timelinehour"), GETPOSTINT("timelinemin"), 0, GETPOSTINT("timelinemonth"), GETPOSTINT("timelineday"), GETPOSTINT("timelineyear")); + $object->timespent_date = dol_mktime(12, 0, 0, GETPOSTINT("timelinemonth"), GETPOSTINT("timelineday"), GETPOSTINT("timelineyear")); + $object->timespent_datehour = dol_mktime(GETPOSTINT("timelinehour"), GETPOSTINT("timelinemin"), 0, GETPOSTINT("timelinemonth"), GETPOSTINT("timelineday"), GETPOSTINT("timelineyear")); $object->timespent_withhour = 1; } elseif (!empty($timespent_date)) { $object->timespent_date = $timespent_date; + $object->timespent_datehour = $timespent_date; $object->timespent_withhour = 0; } + $object->timespent_fk_user = GETPOSTINT("userid_line"); $object->timespent_fk_product = GETPOSTINT("fk_product"); $object->timespent_invoiceid = GETPOSTINT("invoiceid"); $object->timespent_invoicelineid = GETPOSTINT("invoicelineid"); + $result = 0; if (in_array($object->timespent_fk_user, $childids) || $user->hasRight('projet', 'all', 'creer')) { @@ -413,6 +418,7 @@ if (GETPOSTINT('projectid') > 0) { } // If not task selected and no project selected $allprojectforuser = 0; + if ($id <= 0 && $projectidforalltimes == 0) { $allprojectforuser = $user->id; } @@ -911,10 +917,21 @@ $help_url = ''; llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-project project-tasks page-task_time'); + +$param = ((!empty($mode) && $mode == 'mine') ? '&mode=mine' : ''); +if ($search_user) { + $param .= '&search_user=' . ((int) $search_user); +} +if ($search_month) { + $param .= '&search_month=' . ((int) $search_month); +} +if ($search_year) { + $param .= '&search_year=' . ((int) $search_year); +} + + if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser > 0) { - /* - * Fiche projet en mode visu - */ + // Project car in view mode if ($projectidforalltimes > 0) { $result = $projectstatic->fetch($projectidforalltimes); if (!empty($projectstatic->socid)) { @@ -952,17 +969,6 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $head = project_prepare_head($projectstatic); print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project')); - $param = ((!empty($mode) && $mode == 'mine') ? '&mode=mine' : ''); - if ($search_user) { - $param .= '&search_user=' . ((int) $search_user); - } - if ($search_month) { - $param .= '&search_month=' . ((int) $search_month); - } - if ($search_year) { - $param .= '&search_year=' . ((int) $search_year); - } - // Project card $linkback = ''.$langs->trans("BackToList").''; @@ -1096,8 +1102,6 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser print '
    '; } - $param = ''; - // Link to create time $linktocreatetimeBtnStatus = 0; $linktocreatetimeUrl = ''; @@ -1149,6 +1153,8 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } $massactionbutton = $form->selectMassAction('', $arrayofmassactions); + $formconfirm = ''; + // Task // Show section with information of task. If id of task is not defined and project id defined, then $projectidforalltimes is not empty. @@ -1156,15 +1162,13 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $head = task_prepare_head($object); print dol_get_fiche_head($head, 'task_time', $langs->trans("Task"), -1, 'projecttask', 0, '', 'reposition'); - if ($action == 'deleteline') { - $urlafterconfirm = $_SERVER["PHP_SELF"] . "?" . ($object->id > 0 ? "id=" . $object->id : 'projectid=' . $projectstatic->id) . '&lineid=' . GETPOSTINT("lineid") . ($withproject ? '&withproject=1' : ''); - print $form->formconfirm($urlafterconfirm, $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_deleteline", '', '', 1); - } - - $param = ($withproject ? '&withproject=1' : ''); - $param .= ($param ? '&' : '') . 'id=' . $object->id; // ID of task $linkback = $withproject ? '' . $langs->trans("BackToList") . '' : ''; + if ($action == 'deleteline') { + $urlafterconfirm = $_SERVER["PHP_SELF"] . "?" . ($object->id > 0 ? "id=" . $object->id : 'projectid=' . $projectstatic->id) . '&lineid=' . GETPOSTINT("lineid") . $param; + $formconfirm .= $form->formconfirm($urlafterconfirm, $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_deleteline", '', '', 1); + } + if (!GETPOST('withproject') || empty($projectstatic->id)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); $object->next_prev_filter = "fk_projet:IN:" . $db->sanitize($projectsListId); @@ -1264,33 +1268,25 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser print dol_get_fiche_end(); } else { if ($action == 'deleteline') { - $urlafterconfirm = $_SERVER["PHP_SELF"] . "?" . ($object->id > 0 ? "id=" . $object->id : 'projectid=' . $projectstatic->id) . '&lineid=' . GETPOSTINT("lineid") . ($withproject ? '&withproject=1' : ''); - print $form->formconfirm($urlafterconfirm, $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_deleteline", '', '', 1); + $urlafterconfirm = $_SERVER["PHP_SELF"] . "?" . ($projectstatic->id > 0 ? 'projectid=' . $projectstatic->id : ($object->id > 0 ? "id=" . $object->id : '')) . '&lineid=' . GETPOSTINT("lineid") . ($withproject ? '&withproject=1' : ''). "&contextpage=" . urlencode($contextpage).$param; + $formconfirm .= $form->formconfirm($urlafterconfirm, $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_deleteline", '', '', 1); } } + // Call Hook formConfirm + $parameters = array('formConfirm' => $formconfirm, "projectstatic" => $projectstatic, "withproject" => $withproject); + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) { + $formconfirm .= $hookmanager->resPrint; + } elseif ($reshook > 0) { + $formconfirm = $hookmanager->resPrint; + } + if ($projectstatic->id > 0 || $allprojectforuser > 0) { // Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array $hookmanager->initHooks(array('tasktimelist')); - $formconfirm = ''; - - if ($action == 'deleteline' && !empty($projectidforalltimes)) { - // We must use projectidprojectid if on list of timespent of project and id=taskid if on list of timespent of a task - $urlafterconfirm = $_SERVER["PHP_SELF"] . "?" . ($projectstatic->id > 0 ? 'projectid=' . $projectstatic->id : ($object->id > 0 ? "id=" . $object->id : '')) . '&lineid=' . GETPOSTINT('lineid') . ($withproject ? '&withproject=1' : '') . "&contextpage=" . urlencode($contextpage); - $formconfirm = $form->formconfirm($urlafterconfirm, $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_deleteline", '', '', 1); - } - - // Call Hook formConfirm - $parameters = array('formConfirm' => $formconfirm, "projectstatic" => $projectstatic, "withproject" => $withproject); - $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if (empty($reshook)) { - $formconfirm .= $hookmanager->resPrint; - } elseif ($reshook > 0) { - $formconfirm = $hookmanager->resPrint; - } - // Print form confirm print $formconfirm; @@ -1398,9 +1394,6 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; */ - if ($id) { - $param .= '&id=' . urlencode((string) ($id)); - } if ($projectid) { $param .= '&projectid=' . urlencode((string) ($projectid)); } @@ -1434,7 +1427,6 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser print ''; print ''; - print ''; print ''; print ''; print ''; @@ -1598,7 +1590,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $sql = "SELECT t.rowid, t.fk_element, t.element_date, t.element_datehour, t.element_date_withhour, t.element_duration, t.fk_user, t.note, t.thm,"; $sql .= " t.fk_product,"; - $sql .= " pt.ref, pt.label, pt.fk_projet,"; + $sql .= " pt.rowid as taskid, pt.ref, pt.label, pt.fk_projet,"; $sql .= " u.lastname, u.firstname, u.login, u.photo, u.gender, u.statut as user_status,"; $sql .= " il.fk_facture as invoice_id, inv.fk_statut,"; $sql .= " p.fk_soc,s.name_alias,"; @@ -1769,7 +1761,9 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $i = 0; while ($i < $num) { $row = $db->fetch_object($resql); + $tasks[$i] = $row; + $i++; } $db->free($resql); @@ -2158,6 +2152,9 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser print ''; if (($action == 'editline' || $action == 'splitline') && GETPOSTINT('lineid') == $task_time->rowid) { print ''; + if ($id) { + print ''; // If you enable this, the edit will go beack to task view + } print ''; print '
    '; print ''; diff --git a/htdocs/reception/class/receptionlinebatch.class.php b/htdocs/reception/class/receptionlinebatch.class.php index c4df1cc15be..4e5b1ad0217 100644 --- a/htdocs/reception/class/receptionlinebatch.class.php +++ b/htdocs/reception/class/receptionlinebatch.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024 Christophe Battarel - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2025 Nick Fragoulis * * This program is free software; you can redistribute it and/or modify @@ -590,8 +590,8 @@ class ReceptionLineBatch extends CommonObjectLine $sql .= " status=".(isset($this->status) ? $this->status : "null").","; $sql .= " tms=".(dol_strlen((string) $this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; $sql .= " batch=".(isset($this->batch) ? "'".$this->db->escape($this->batch)."'" : "null").","; - $sql .= " eatby=".(dol_strlen((string) $this->eatby) != 0 ? "'".$this->db->idate($this->eatby)."'" : 'null').","; - $sql .= " sellby=".(dol_strlen((string) $this->sellby) != 0 ? "'".$this->db->idate($this->sellby)."'" : 'null').","; + $sql .= " eatby=".(dol_strlen((string) $this->eatby) != 0 ? "'".$this->db->idate((int) $this->eatby)."'" : 'null').","; + $sql .= " sellby=".(dol_strlen((string) $this->sellby) != 0 ? "'".$this->db->idate((int) $this->sellby)."'" : 'null').","; $sql .= " fk_unit = ".((int) $this->fk_unit); $sql .= " WHERE rowid=".((int) $this->id); diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 2cde543636a..e3d2f1aba7e 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -4107,6 +4107,9 @@ div.tabBar table.tableforservicepart2:last-child { /* Payment Screen : Pointer cursor in the autofill image */ .AutoFillAmount { cursor:pointer; + padding-left: 5px; + padding-right: 5px; + padding-top: 2px; } div.popuptabset { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 398d09961db..4535bee9b99 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -3106,6 +3106,9 @@ img.photorefnoborder { /* Payment Screen : Pointer cursor in the autofill image */ .AutoFillAmount { cursor:pointer; + padding-left: 5px; + padding-right: 5px; + padding-top: 2px; } diff --git a/test/hurl/api/users/10_users.hurl b/test/hurl/api/users/10_users.hurl index 31b1543387b..0d8c125443c 100644 --- a/test/hurl/api/users/10_users.hurl +++ b/test/hurl/api/users/10_users.hurl @@ -45,7 +45,10 @@ HTTP 400 POST http://{{hostnport}}/api/index.php/users {} HTTP 500 -{"error":{"code":500,"message":"Internal Server Error: Error creating","0":"Email address is incorrect"}} +[Asserts] +jsonpath "$.error" exists +jsonpath "$.error.code" == 500 +jsonpath "$.error.message" == "Internal Server Error: login field missing" # DELETE DELETE http://{{hostnport}}/api/index.php/users/