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

This commit is contained in:
Laurent Destailleur 2025-11-24 15:52:13 +01:00
commit bfa695e7c5
25 changed files with 221 additions and 148 deletions

View file

@ -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

View file

@ -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:

View file

@ -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:

View file

@ -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:

View file

@ -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

View file

@ -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

View file

@ -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:

View file

@ -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 '<td class="liste_titre">';
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 '</td>';
}
// Filter: Type
if (!empty($arrayfields['cs.fk_mode_reglement']['checked'])) {
print '<td class="liste_titre">';
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 '</td>';
}
// Filter: Bank Account
if (!empty($arrayfields['cs.fk_account']['checked'])) {
print '<td class="liste_titre">';
$form->select_comptes($search_account, 'search_account', 0, '', 1, '', 0, 'maxwidth150');
$form->select_comptes($search_account, 'search_account', 0, '', 1, '', 0, 'maxwidth125');
print '</td>';
}

View file

@ -74,18 +74,25 @@ class Form
/** @var array<string,int> */
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<string,array{id:int,code:string,label:string,type:int,entity:int,active:int}> */
public $cache_types_paiements = array();
/** @var array<string,array{code:string,label:string,deposit_percent:string,entity:int}> */
public $cache_conditions_paiements = array();
/** @var array<int,array{rowid:int,code:string,label:string,active:int}> */
public $cache_transport_mode = array();
/** @var array<int,array{code:string,label:string,position:int}> */
public $cache_availability = array();
/** @var array<int,array{id:int,code:string,label:string}> */
public $cache_demand_reason = array();
/** @var array<string,string> */
public $cache_types_fees = array();
/** @var array<int,array{rowid:int,type_vat:int,code:string,txtva:string,nprtva:int,localtax1:string|float|null,localtax1_type:string,localtax2:string|float|null,localtax2_type:string,label:string,labelallrates:string,labelpositiverates:string}> */
public $cache_vatrates = array();
/** @var array<int,array{rowid:int,code:string,label:string}> */
public $cache_invoice_subtype = array();
/** @var array<string,string> */
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 .= '<!-- datepicker usecalendar=eldy --><input id="' . $prefix . '" name="' . $prefix . '" type="text" class="maxwidthdate center" maxlength="11" value="' . $formatted_date . '"';
$retstring .= ($disabled ? ' disabled' : '');
$retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->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 .= '<input id="'.$prefix.'" name="'.$prefix.'" type="'.($usecalendar == 'html' ? "date" : "text").'" class="maxwidthdate center" maxlength="11" value="'.$formatted_date.'"';
$retstring .= ($disabled ? ' disabled' : '');
$retstring .= ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '');
$retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($formatjs) . '\'); "'; // 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 / FormatDateShortJavaInput that is same for javascript
$retstring .= ' autocomplete="off">';
// Icon calendar

View file

@ -1629,7 +1629,7 @@ function activateModulesRequiredByCountry($country_code)
if ($modulequalified) {
// Load languages files of module
if (property_exists($objMod, 'automatic_activation') && isset($objMod->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');

View file

@ -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<array{commentgroup?:string,mainmenu:string,leftmenu:string,langs:string,enabled:int|string,target:string,titre:string,user:int,fk_menu:string,fk_parent:string,url:string,position:int,positionfull:int|string,perms:string,type:string}>|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<string,string> Array ['<country_code>'=>'<translation_key_activation_reason>']
*/
public $automatic_activation = array();
/**
* @var int Module is enabled globally (Multicompany support)
*/

View file

@ -5,7 +5,7 @@
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015 Benoit Bruchard <benoitb21@gmail.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2025 Frédéric France <frederic.france@free.fr>
*
* 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);

View file

@ -6,7 +6,7 @@
* Copyright (C) 2014-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015 Benoit Bruchard <benoitb21@gmail.com>
* Copyright (C) 2015 Benjamin Neumann <btdn@sigsoft.org>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 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
@ -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 = '';
}

View file

@ -1,10 +1,11 @@
<?php
/* Copyright (C) 2010-2012 Laurent Destailleur <ely@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
/* Copyright (C) 2010-2012 Laurent Destailleur <ely@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2025 Alexandre Spangaro <alexandre@inovea-conseil.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
@ -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;

View file

@ -13,7 +13,7 @@
* Copyright (C) 2022 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 Nick Fragoulis
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2024-2025 Alexandre Spangaro <alexandre@inovea-conseil.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
@ -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;

View file

@ -1,17 +1,17 @@
<?php
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2015 Marcos Garcia <marcosgdf@gmail.com>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
* Copyright (C) 2022-2025 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2022-2024 Eric Seigne <eric.seigne@cap-rel.fr>
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2015 Marcos Garcia <marcosgdf@gmail.com>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
* Copyright (C) 2022-2025 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2022-2024 Eric Seigne <eric.seigne@cap-rel.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* 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;

View file

@ -1,17 +1,17 @@
<?php
/* Copyright (C) 2004-2024 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
/* Copyright (C) 2004-2024 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2018-2024 Anthony Berton <anthony.berton@bb2a.fr>
* Copyright (C) 2022-2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2022-2025 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* 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;

View file

@ -141,7 +141,7 @@ if (getDolGlobalString('PRODUCT_USE_UNITS')) {
foreach ($line_options as $key => $value) {
if (in_array($line_type, $value['type'])) {
print '<li><label for="' . $key . '">' . $langs->trans($value['trans_key']) . '</label>';
print '<input style="float: left;" id="' . $key . '" type="checkbox" name="' . $key . '" value="' . $value['value'] . '" ';
print '<input style="float: left;margin-top: 9px;" id="' . $key . '" type="checkbox" name="' . $key . '" value="' . $value['value'] . '" ';
print $value['checked'] ? 'checked' : '';
print '></li>';
}

View file

@ -2,6 +2,7 @@
/* Copyright (C) 2014-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 Charlene Benke <charlene@patas-monkey.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
@ -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 '<td class="linecolmargin1"></td>';
print '<td class="linecolmargin1 nowrap margininfos right"></td>';
}
if (getDolGlobalString('DISPLAY_MARGIN_RATES') && $user->hasRight('margins', 'liretous')) {
print '<td class="linecolmargin2"></td>';
print '<td class="linecolmargin2 nowrap margininfos right"></td>';
}
if (getDolGlobalString('DISPLAY_MARK_RATES') && $user->hasRight('margins', 'liretous')) {
print '<td class="linecolmark1"></td>';
print '<td class="linecolmark1 nowrap margininfos right"></td>';
}
}
?>

View file

@ -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);

View file

@ -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 = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
@ -1096,8 +1102,6 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
print '<br>';
}
$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 ? '<a href="' . DOL_URL_ROOT . '/projet/tasks.php?id=' . $projectstatic->id . '">' . $langs->trans("BackToList") . '</a>' : '';
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 '<input type="hidden" name="sortfield" value="' . $sortfield . '">';
print '<input type="hidden" name="sortorder" value="' . $sortorder . '">';
print '<input type="hidden" name="id" value="' . $id . '">';
print '<input type="hidden" name="projectid" value="' . $projectidforalltimes . '">';
print '<input type="hidden" name="withproject" value="' . $withproject . '">';
print '<input type="hidden" name="tab" value="' . $tab . '">';
@ -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 '<td class="center nowraponall">';
if (($action == 'editline' || $action == 'splitline') && GETPOSTINT('lineid') == $task_time->rowid) {
print '<input type="hidden" name="lineid" value="' . GETPOSTINT('lineid') . '">';
if ($id) {
print '<input type="hidden" name="id" value="' . $id . '">'; // If you enable this, the edit will go beack to task view
}
print '<input type="submit" class="button buttongen reposition smallpaddingimp margintoponlyshort marginbottomonlyshort button-save" name="save" value="'.$langs->trans("Save").'">';
print '<br>';
print '<input type="submit" class="button buttongen reposition smallpaddingimp margintoponlyshort marginbottomonlyshort button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';

View file

@ -3,7 +3,7 @@
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* 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);

View file

@ -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 {

View file

@ -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;
}

View file

@ -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/