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

This commit is contained in:
ldestailleur 2025-07-15 18:44:05 +02:00
commit 52bf642601
9 changed files with 96 additions and 15 deletions

View file

@ -85,6 +85,9 @@ before_install:
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" = '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
@ -125,6 +128,9 @@ before_install:
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

View file

@ -2274,7 +2274,7 @@ Following changes may create regressions for some external modules, but were nec
***** 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:

View file

@ -1051,7 +1051,7 @@ if ($nboftargetok) {
$ret=`cp -fr "$SOURCE/dev/build/debian/apache" "$BUILDROOT/$PROJECT.tmp/debian/apache"`;
$ret=`cp -f "$SOURCE/dev/build/debian/apache/.htaccess" "$BUILDROOT/$PROJECT.tmp/debian/apache"`;
$ret=`cp -fr "$SOURCE/dev/build/debian/lighttpd" "$BUILDROOT/$PROJECT.tmp/debian/lighttpd"`;
# Add files also required to dev/build binary package
# Add files also required to build binary package
$ret=`cp -f "$SOURCE/dev/build/debian/dolibarr.config" "$BUILDROOT/$PROJECT.tmp/debian"`;
$ret=`cp -f "$SOURCE/dev/build/debian/dolibarr.postinst" "$BUILDROOT/$PROJECT.tmp/debian"`;
$ret=`cp -f "$SOURCE/dev/build/debian/dolibarr.postrm" "$BUILDROOT/$PROJECT.tmp/debian"`;

View file

@ -60,7 +60,7 @@ 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 beta version of Dolibarr, step by step.
This section describes steps made by Dolibarr packaging team to make a beta version of Dolibarr, step by step.
- Check all files are committed.
- Update version/info in ChangeLog, for this you can:

View file

@ -3178,7 +3178,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;

View file

@ -641,6 +641,27 @@ class AdvanceTargetingMailing extends CommonObject
if ($arrayquery['options_'.$key] > 0) {
$sqlwhere[] = " (te.".$key." = ".((int) $arrayquery["options_".$key]).")";
}
} elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'chkbxlst'
&& is_array($arrayquery['options_'.$key])) {
if (count($arrayquery['options_'.$key])) {
$i2 = 0;
$field = "te.".$key;
$sqlwhereselllist="";
foreach ($arrayquery['options_'.$key] as $data) {
$data = trim($data);
if ($data) {
$sqlwhereselllist .= ($i2 > 0 ? " OR (" : "(").$field." LIKE '".$this->db->escape($data).",%'";
$sqlwhereselllist .= " OR ".$field." = '".$this->db->escape($data)."'";
$sqlwhereselllist .= " OR ".$field." LIKE '%,".$this->db->escape($data)."'";
$sqlwhereselllist .= " OR ".$field." LIKE '%,".$this->db->escape($data).",%'";
$sqlwhereselllist .= ")";
$i2++; // a criteria for 1 more field was added to string (we can add several criteria for the same field as it is a multiselect search criteria)
}
}
if (!empty($sqlwhereselllist)) {
$sqlwhere[] = "( ".$sqlwhereselllist." )";
}
}
} else {
if (is_array($arrayquery['options_'.$key])) {
$sqlwhere[] = " (te.".$key." IN (".$this->db->sanitize("'".implode("','", $arrayquery["options_".$key])."'", 1)."))";
@ -784,6 +805,31 @@ class AdvanceTargetingMailing extends CommonObject
$sqlwhere[] = " (te.".$key." = ".((int) $arrayquery["options_".$key."_cnct"]).")";
}
}
} elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'link') {
if ($arrayquery['options_'.$key."_cnct"] > 0) {
$sqlwhere[]= " (te.".$key." = ".((int) $arrayquery["options_".$key."_cnct"]).")";
}
} elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'chkbxlst'
&& is_array($arrayquery['options_'.$key.'_cnct'])) {
if (count($arrayquery['options_'.$key.'_cnct'])) {
$i2 = 0;
$field = "te.".$key;
$sqlwhereselllist="";
foreach ($arrayquery['options_'.$key.'_cnct'] as $data) {
$data = trim($data);
if ($data) {
$sqlwhereselllist .= ($i2 > 0 ? " OR (" : "(").$field." LIKE '".$this->db->escape($data).",%'";
$sqlwhereselllist .= " OR ".$field." = '".$this->db->escape($data)."'";
$sqlwhereselllist .= " OR ".$field." LIKE '%,".$this->db->escape($data)."'";
$sqlwhereselllist .= " OR ".$field." LIKE '%,".$this->db->escape($data).",%'";
$sqlwhereselllist .= ")";
$i2++; // a criteria for 1 more field was added to string (we can add several criteria for the same field as it is a multiselect search criteria)
}
}
if (!empty($sqlwhereselllist)) {
$sqlwhere[] = "( ".$sqlwhereselllist." )";
}
}
} else {
if (is_array($arrayquery['options_'.$key.'_cnct'])) {
$sqlwhere[] = " (te.".$key." IN (".$this->db->sanitize("'".implode("','", $arrayquery["options_".$key."_cnct"])."'", 1)."))";
@ -888,6 +934,31 @@ class AdvanceTargetingMailing extends CommonObject
if ($arrayquery['options_'.$key] != '') {
$sqlwhere[] = " (tse.".$key." = ".((int) $arrayquery["options_".$key]).")";
}
} elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'link') {
if ($arrayquery['options_'.$key] > 0) {
$sqlwhere[]= " (te.".$key." = ".((int) $arrayquery["options_".$key]).")";
}
} elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'chkbxlst'
&& is_array($arrayquery['options_'.$key])) {
if (count($arrayquery['options_'.$key])) {
$i2 = 0;
$field = "tse.".$key;
$sqlwhereselllist="";
foreach ($arrayquery['options_'.$key] as $data) {
$data = trim($data);
if ($data) {
$sqlwhereselllist .= ($i2 > 0 ? " OR (" : "(").$field." LIKE '".$this->db->escape($data).",%'";
$sqlwhereselllist .= " OR ".$field." = '".$this->db->escape($data)."'";
$sqlwhereselllist .= " OR ".$field." LIKE '%,".$this->db->escape($data)."'";
$sqlwhereselllist .= " OR ".$field." LIKE '%,".$this->db->escape($data).",%'";
$sqlwhereselllist .= ")";
$i2++; // a criteria for 1 more field was added to string (we can add several criteria for the same field as it is a multiselect search criteria)
}
}
if (!empty($sqlwhereselllist)) {
$sqlwhere[] = "( ".$sqlwhereselllist." )";
}
}
} else {
if (is_array($arrayquery['options_'.$key])) {
$sqlwhere[] = " (tse.".$key." IN (".$this->db->sanitize("'".implode("','", $arrayquery["options_".$key])."'", 1)."))";

View file

@ -1616,10 +1616,10 @@ class Invoices extends DolibarrApi
* Warning: Take care that all invoices are owned by the same customer.
* Example of value for parameter arrayofamounts: {"1": {"amount": "99.99", "multicurrency_amount": ""}, "2": {"amount": "", "multicurrency_amount": "10"}}
*
* @param array $arrayofamounts {@from body} Array with id of invoices with amount to pay for each invoice
* @param array $arrayofamounts {@from body} Array with id of invoices with amount to pay for each invoice
* @phan-param array<string,array{amount:string,multicurrency_amount:string}> $arrayofamounts
* @phpstan-param array<string,array{amount:string,multicurrency_amount:string}> $arrayofamounts
* @param string $datepaye {@from body} Payment date
* @param string $datepaye {@from body} Payment date
* @param int $paymentid {@from body} Payment mode Id {@min 1}
* @param string $closepaidinvoices {@from body} Close paid invoices {@choice yes,no}
* @param int $accountid {@from body} Account Id {@min 1}
@ -1704,13 +1704,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 = price2num(-1 * (float) $amount, 'MT');
$amount = price2num(-1 * abs((float) $amount), 'MT');
}
if ($is_multicurrency) {

View file

@ -184,7 +184,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);

View file

@ -285,6 +285,9 @@ 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, 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
@ -300,11 +303,11 @@ 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
if (GETPOST("timelinehour") != '' && GETPOST("timelinehour") >= 0 && !empty($timespent_date)) { // If hour was entered
$object->timespent_date = dol_mktime(GETPOSTINT("timelinehour"), GETPOSTINT("timelinemin"), 0, GETPOSTINT("timelinemonth"), GETPOSTINT("timelineday"), GETPOSTINT("timelineyear"));
$object->timespent_withhour = 1;
} else {
$object->timespent_date = dol_mktime(12, 0, 0, GETPOSTINT("timelinemonth"), GETPOSTINT("timelineday"), GETPOSTINT("timelineyear"));
} elseif (!empty($timespent_date)) {
$object->timespent_date = $timespent_date;
$object->timespent_withhour = 0;
}
$object->timespent_fk_user = GETPOSTINT("userid_line");
@ -325,7 +328,8 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us
} else {
$object->fetch($id, $ref);
$object->timespent_id = GETPOSTINT("lineid");
$object->fetchTimeSpent(GETPOSTINT('lineid'));
$object->timespent_note = GETPOST("timespent_note_line", "alphanohtml");
$object->timespent_old_duration = GETPOSTINT("old_duration");
$object->timespent_duration = GETPOSTINT("new_durationhour") * 60 * 60; // We store duration in seconds
@ -333,8 +337,8 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us
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_withhour = 1;
} else {
$object->timespent_date = dol_mktime(12, 0, 0, GETPOSTINT("timelinemonth"), GETPOSTINT("timelineday"), GETPOSTINT("timelineyear"));
} elseif (!empty($timespent_date)) {
$object->timespent_date = $timespent_date;
$object->timespent_withhour = 0;
}
$object->timespent_fk_user = GETPOSTINT("userid_line");