From 453b289346872ad251233e9282ef209a6c7190c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 1 Jul 2025 15:13:57 +0200 Subject: [PATCH 1/8] fix ajax product with multiprices (#34672) --- htdocs/product/ajax/products.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/ajax/products.php b/htdocs/product/ajax/products.php index 3f60355301f..22bec43c497 100644 --- a/htdocs/product/ajax/products.php +++ b/htdocs/product/ajax/products.php @@ -166,7 +166,7 @@ if ($action == 'fetch' && !empty($id)) { $sql .= " WHERE fk_product = ".((int) $id); $sql .= " AND entity IN (".getEntity('productprice').")"; $sql .= " AND price_level = ".((int) $price_level); - $sql .= " ORDER BY date_price"; + $sql .= " ORDER BY date_price DESC, rowid"; $sql .= " DESC LIMIT 1"; $result = $db->query($sql); From af095c0e11115e1867571393a67b7b6ff59ce62c Mon Sep 17 00:00:00 2001 From: Eric - CAP-REL <1468823+rycks@users.noreply.github.com> Date: Fri, 4 Jul 2025 08:35:44 +0200 Subject: [PATCH 2/8] check if rpmbuild/sources dir exists (#34687) --- build/makepack-dolibarr.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 1e5ebe630b1..32cad50b1db 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -831,6 +831,7 @@ if ($nboftargetok) { print "Compress $FILENAMETGZ2 into $FILENAMETGZ2.tgz...\n"; $ret=`tar --exclude-from "$SOURCE/build/tgz/tar_exclude.txt" --directory "$BUILDROOT" -czvf "$BUILDROOT/$FILENAMETGZ2.tgz" $FILENAMETGZ2`; + if (! -d $RPMDIR . '/SOURCES') { mkdir($RPMDIR . '/SOURCES'); } print "Move $BUILDROOT/$FILENAMETGZ2.tgz to $RPMDIR/SOURCES/$FILENAMETGZ2.tgz\n"; $cmd="mv $BUILDROOT/$FILENAMETGZ2.tgz $RPMDIR/SOURCES/$FILENAMETGZ2.tgz"; $ret=`$cmd`; From 737dc7726ec169cdcdf6433e3abbe3f625db2a29 Mon Sep 17 00:00:00 2001 From: Eric - CAP-REL <1468823+rycks@users.noreply.github.com> Date: Fri, 4 Jul 2025 08:36:44 +0200 Subject: [PATCH 3/8] remove dpatch and add debhelper+po-debconf (#34685) --- build/makepack-howto.txt | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/build/makepack-howto.txt b/build/makepack-howto.txt index 184022ecf18..83aae6624f9 100644 --- a/build/makepack-howto.txt +++ b/build/makepack-howto.txt @@ -6,7 +6,7 @@ of Dolibarr. There is a chapter for BETA version and a chapter for RELEASE versi ***** Prerequisites For Linux ***** Prerequisites to build tgz, debian and rpm packages: -> apt-get install perl tar dpkg dpatch p7zip-full rpm zip php-cli +> apt-get install perl tar dpkg p7zip-full rpm zip php-cli debhelper po-debconf Prerequisites to build autoexe DoliWamp package from Linux (solution seems broken since Ubuntu 20.04): > apt-get install wine q4wine @@ -14,11 +14,11 @@ Prerequisites to build autoexe DoliWamp package from Linux (solution seems broke > Install InnoSetup For example by running isetup-5.5.8.exe (https://www.jrsoftware.org) https://files.jrsoftware.org/is/5/ > Install WampServer into "C:\wamp64" to have Apache, PHP and MariaDB - For example by running wampserver3.2.6_x64.exe (https://www.wampserver.com). + For example by running wampserver3.2.6_x64.exe (https://www.wampserver.com). See file build/exe/doliwamp.iss to know the doliwamp version currently setup. > Add path to ISCC into PATH windows var: Launch wine cmd, then regedit and add entry int HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment\PATH -> To build manually the .exe from Windows (running from makepack-dolibarr.pl script is however recommanded), +> To build manually the .exe from Windows (running from makepack-dolibarr.pl script is however recommanded), open file build/exe/doliwamp.iss and click on button "Compile". The .exe file will be build into directory build. @@ -31,8 +31,8 @@ Prerequisites to build autoexe DoliWamp package from Windows: > Install isetup-5.5.8.exe (https://www.jrsoftware.org) > Install WampServer-3.2.*-64.exe (Apache 2.4.51, PHP 7.3.33, MariaDB 10.6.5 for example. Version must match the values found into doliwamp.iss) > Install GIT for Windows (https://git-scm.com/ => You must choose option "Add Git bash profile", "Git commit as-is") -> Install Dolibarr current version: - git clone https://github.com/dolibarr/dolibarr or git clone --branch X.Y https://github.com/dolibarr/dolibarr +> Install Dolibarr current version: + git clone https://github.com/dolibarr/dolibarr or git clone --branch X.Y https://github.com/dolibarr/dolibarr > Add the path of PHP (C:\wamp64\bin\php\php7.3.33) and InnoSetup (C:\Program Files (x86)\Inno Setup 5) into the %PATH% of Windows. @@ -43,11 +43,11 @@ Prerequisites to build autoexe DoliWamp package from Windows: ***** Actions to do a BETA ***** -This files describe steps made by Dolibarr packaging team to make a +This files describe steps made by Dolibarr packaging team to make a beta version of Dolibarr, step by step. - Check all files are commited. -- Update version/info in ChangeLog, for this you can: +- Update version/info in ChangeLog, for this you can: To generate a changelog of a major new version x.y.0 (from a repo on branch develop), you can do "cd ~/git/dolibarr; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent develop) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" To generate a changelog of a major new version x.y.0 (from a repo on branch x.y repo), you can do "cd ~/git/dolibarr_x.y; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent x.y.0) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" To generate a changelog of a maintenance version x.y.z, you can do "cd ~/git/dolibarr_x.y; git log x.y.z-1.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" @@ -67,7 +67,7 @@ Recopy the content of the output file into the file ChangeLog. ***** Actions to do a RELEASE ***** -This files describe steps made by Dolibarr packaging team to make a +This files describe steps made by Dolibarr packaging team to make a complete release of Dolibarr, step by step. - Check all files are commited. @@ -84,9 +84,9 @@ Recopy the content of the output file into the file ChangeLog. - Check content of built packages. -- Run makepack-dolibarr.pl again with option to publish files on +- Run makepack-dolibarr.pl again with option to publish files on dolibarr foundation server (Dir /home/dolibarr/wwwroot/files/stable on www.dolibarr.org). -- Run makepack-dolibarr.pl again with option to publish files on +- Run makepack-dolibarr.pl again with option to publish files on sourceforge. This will also add official tag. - Edit symbolic links in directory "/home/dolibarr/wwwroot/files/stable/xxx" on server to point to new files (used by some web sites). From f4efa58022cb48a7969ed85cf14ee79551e3c971 Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller <45882981+Hystepik@users.noreply.github.com> Date: Fri, 4 Jul 2025 19:06:35 +0200 Subject: [PATCH 4/8] Fix #17816 match compta/paiement.php payment method for credit note invoices (#34696) --- htdocs/compta/facture/class/api_invoices.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 820bcb6e955..54f1ee55461 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -1568,13 +1568,13 @@ class Invoices extends DolibarrApi $amount = price2num($amountarray["multicurrency_amount"], 'MT'); } - if ($amount > $remainstopay && !$accepthigherpayment) { + if (abs($amount) > abs($remainstopay) && !$accepthigherpayment) { $this->db->rollback(); throw new RestException(400, 'Payment amount on invoice ID '.$id.' ('.$amount.') is higher than remain to pay ('.$remainstopay.')'); } if ($this->invoice->type == Facture::TYPE_CREDIT_NOTE) { - $amount = -$amount; + $amount = - abs($amount); } if ($is_multicurrency) { From 53cf9f0bf16440f7722e91dcfef365e5f1a17d3a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 5 Jul 2025 00:40:19 +0200 Subject: [PATCH 5/8] Doc --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 662cddbba6d..13fda4c97a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,7 +4,7 @@ English Dolibarr ChangeLog ***** ChangeLog for 17.0.4 compared to 17.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: $this->newref already exists and could have been modified by a 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 FIX: 17.0: deprecated field should only be a fallback FIX: 17.0 PHP8: supplier invoice class: From ee294917e14c0fe5b7bcc4202acff281d37445ee Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Sun, 6 Jul 2025 12:51:42 +0200 Subject: [PATCH 6/8] fix: bad date management on update in time spent list if column is not displayed (#34511) * fix: if column date is missing in tasktime, line update failed with Data mandatory * fix: if column date is missing in tasktime list, line update failed with Data mandatory * fix: remove badd php comment * Update time.php --------- Co-authored-by: Laurent Destailleur --- htdocs/projet/tasks/time.php | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 57959a53398..4d71f44f4d2 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -278,11 +278,13 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us $error++; } + //If timespent date is not provided in POST (for eg, because in list the column date is hidden) we keep the actual date + $timespent_date = dol_mktime(12, 0, 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); + if (!$error) { if (GETPOST('taskid', 'int') != $id) { // GETPOST('taskid') is id of new task $id_temp = GETPOST('taskid', 'int'); // should not overwrite $id - $object->fetchTimeSpent(GETPOST('lineid', 'int')); $result = 0; @@ -296,11 +298,14 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us $object->timespent_old_duration = GETPOST("old_duration", "int"); $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 + if (GETPOST("timelinehour") != '' + && GETPOST("timelinehour") >= 0 + && !empty($timespent_date)) { + // If hour was entered $object->timespent_date = dol_mktime(GETPOST("timelinehour"), GETPOST("timelinemin"), 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); $object->timespent_withhour = 1; - } else { - $object->timespent_date = dol_mktime(12, 0, 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); + } elseif (!empty($timespent_date)) { + $object->timespent_date = $timespent_date; } $object->timespent_fk_user = GETPOST("userid_line", 'int'); $object->timespent_fk_product = GETPOST("fk_product", 'int'); @@ -320,16 +325,20 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us } else { $object->fetch($id, $ref); + $object->fetchTimeSpent(GETPOST('lineid', 'int')); + $object->timespent_id = GETPOST("lineid", 'int'); $object->timespent_note = GETPOST("timespent_note_line", "alphanohtml"); $object->timespent_old_duration = GETPOST("old_duration", "int"); $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 + if (GETPOST("timelinehour") != '' + && GETPOST("timelinehour") >= 0 + && !empty($timespent_date)) { // If hour was entered $object->timespent_date = dol_mktime(GETPOST("timelinehour", 'int'), GETPOST("timelinemin", 'int'), 0, GETPOST("timelinemonth", 'int'), GETPOST("timelineday", 'int'), GETPOST("timelineyear", 'int')); $object->timespent_withhour = 1; - } else { - $object->timespent_date = dol_mktime(12, 0, 0, GETPOST("timelinemonth", 'int'), GETPOST("timelineday", 'int'), GETPOST("timelineyear", 'int')); + } elseif (!empty($timespent_date)) { + $object->timespent_date = $timespent_date; } $object->timespent_fk_user = GETPOST("userid_line", 'int'); $object->timespent_fk_product = GETPOST("fk_product", 'int'); From 8927d1260a32d210aa32713e3ace769ab2c4e885 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Wed, 9 Jul 2025 15:27:28 +0200 Subject: [PATCH 7/8] Fix travis --- .travis.yml | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index eac04b41ab4..96aac710de6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,9 +2,9 @@ # from Dolibarr GitHub repository. # For syntax, see https://docs.travis-ci.com/user/languages/php/ -# We use dist: bionic = 18.04, focal = 20.04 +# We use dist: focal = 20.04, jammy = 22.04 os: linux -dist: focal +dist: jammy language: generic @@ -21,7 +21,7 @@ services: addons: - mariadb: '10.5' + mariadb: '10.6' env: @@ -36,10 +36,10 @@ jobs: include: - stage: PHP 7.0-8.1 if: type = push - php: '7.0' + php: '7.1' env: - DB=postgresql - - TRAVIS_PHP_VERSION=7.0 + - TRAVIS_PHP_VERSION=7.1 - stage: PHP 7.0-8.1 if: type = pull_request OR type = push php: '8.1' @@ -78,6 +78,9 @@ before_install: if [ "$TRAVIS_PHP_VERSION" = '7.0' ]; then sudo apt install unzip apache2 php7.0 php7.0-cli php7.0-curl php7.0-mysql php7.0-pgsql php7.0-gd php7.0-imap php7.0-intl php7.0-ldap php7.0-xml php7.0-mbstring php7.0-xml php7.0-zip libapache2-mod-php7.0 fi + if [ "$TRAVIS_PHP_VERSION" = '7.1' ]; then + sudo apt install unzip apache2 php7.1 php7.1-cli php7.1-curl php7.1-mysql php7.1-pgsql php7.1-gd php7.1-imap php7.1-intl php7.1-ldap php7.1-xml php7.1-mbstring php7.1-xml php7.1-zip libapache2-mod-php7.1 + fi if [ "$TRAVIS_PHP_VERSION" = '8.1' ]; then sudo apt install unzip apache2 php8.1 php8.1-cli php8.1-curl php8.1-mysql php8.1-pgsql php8.1-gd php8.1-imap php8.1-intl php8.1-ldap php8.1-xml php8.1-mbstring php8.1-xml php8.1-zip libapache2-mod-php8.1 fi @@ -108,6 +111,9 @@ install: - | if [ "$TRAVIS_PHP_VERSION" = '7.0' ]; then sudo update-alternatives --set php /usr/bin/php7.0 + fi + if [ "$TRAVIS_PHP_VERSION" = '7.1' ]; then + sudo update-alternatives --set php /usr/bin/php7.1 fi if [ "$TRAVIS_PHP_VERSION" = '8.1' ]; then sudo update-alternatives --set php /usr/bin/php8.1 @@ -123,7 +129,8 @@ install: sudo php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer sudo chmod -R a+rwx /usr/local/bin/composer composer -V - composer -n config -g vendor-dir htdocs/includes + sudo composer -n config -g vendor-dir htdocs/includes + sudo chmod -R a+rwx /home/travis/.config/composer echo - | @@ -201,8 +208,8 @@ before_script: phpcs -i | head - # Check PHP Vardump check version echo "PHP Vardump check version" - which var_dump_check - var_dump_check --version + which var-dump-check + var-dump-check --version # Check PHPUnit version echo "PHPUnit version" which phpunit @@ -253,8 +260,8 @@ before_script: echo 'ALTER SEQUENCE llx_accountingaccount_rowid_seq RENAME TO llx_accounting_account_rowid_seq' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis' echo 'ALTER SEQUENCE llx_accounting_account_rowid_seq RESTART WITH 1000001;' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis' - echo '\d llx_adherent' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis' - echo '\d llx_c_country' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis' + #echo '\d llx_adherent' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis' + #echo '\d llx_c_country' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis' # Create pgsql compatibility functions psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis' < htdocs/install/pgsql/functions/functions.sql @@ -472,11 +479,9 @@ script: echo "Unit testing" # Ensure we catch errors with -e. Set this to +e instead of -e if you want to go to the end to see dolibarr.log file. set -e - if [ "$TRAVIS_PHP_VERSION" != '7.0' ]; then - phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php - phpunitresult=$? - echo "Phpunit return code = $phpunitresult" - fi + phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php + phpunitresult=$? + echo "Phpunit return code = $phpunitresult" set +e after_script: From abc7f824d7ccb41f3f9fdfee3f94c0f0888e36ee Mon Sep 17 00:00:00 2001 From: ThomasNgr-OpenDSI Date: Tue, 15 Jul 2025 06:14:53 +0200 Subject: [PATCH 8/8] FIX accountancy closure: if subledger_label is not found, PHP8.2 throws an error. (#34736) --- htdocs/accountancy/class/bookkeeping.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 32aefa2af14..c823ead80bf 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -2822,7 +2822,7 @@ class BookKeeping extends CommonObject $error++; } $objtmp = $this->db->fetch_object($result); - $bookkeeping->subledger_label = $objtmp->subledger_label; // latest subledger label used + $bookkeeping->subledger_label = $objtmp->subledger_label ?? null; // latest subledger label used } else { $bookkeeping->subledger_account = null; $bookkeeping->subledger_label = null;