From 81ce609b7bba714831e54b8df61f66b09abe6a89 Mon Sep 17 00:00:00 2001 From: kevin Date: Tue, 13 Sep 2022 16:04:20 +0200 Subject: [PATCH 01/18] FIX no when contains an @ --- htdocs/user/class/user.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 96a614857ba..4b6ee860c74 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -711,6 +711,7 @@ class User extends CommonObject // If module is abc@module, we check permission user->rights->module->abc->permlevel1 $tmp = explode('@', $rightsPath, 2); if (! empty($tmp[1])) { + if (strpos($module, '@') !== false) $module = $tmp[1]; $rightsPath = $tmp[1]; $permlevel2 = $permlevel1; $permlevel1 = $tmp[0]; From cba04c9648eaf5dabb970a4663a07b5cc710bd20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 13 Sep 2022 20:48:59 +0200 Subject: [PATCH 02/18] Update bonprelevement.class.php --- .../class/bonprelevement.class.php | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 18216c1cda6..06b912ec343 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -450,9 +450,6 @@ class BonPrelevement extends CommonObject dol_syslog(get_class($this)."::set_infocredit AddPaymentToBank Error ".$this->error); } } - //var_dump($paiement->amounts); - //var_dump($thirdpartyid); - //var_dump($cursoramounts); } // Update withdrawal line @@ -1039,15 +1036,15 @@ class BonPrelevement extends CommonObject $account = new Account($this->db); if ($account->fetch($id) > 0) { $this->emetteur_code_banque = $account->code_banque; - $this->emetteur_code_guichet = $account->code_guichet; - $this->emetteur_numero_compte = $account->number; + $this->emetteur_code_guichet = $account->code_guichet; + $this->emetteur_numero_compte = $account->number; $this->emetteur_number_key = $account->cle_rib; - $this->emetteur_iban = $account->iban; - $this->emetteur_bic = $account->bic; + $this->emetteur_iban = $account->iban; + $this->emetteur_bic = $account->bic; - $this->emetteur_ics = ($type == 'bank-transfer' ? $account->ics_transfer : $account->ics); + $this->emetteur_ics = ($type == 'bank-transfer' ? $account->ics_transfer : $account->ics); - $this->raison_sociale = $account->proprio; + $this->raison_sociale = $account->proprio; } $this->factures = $factures_prev_id; @@ -1057,8 +1054,6 @@ class BonPrelevement extends CommonObject // This also set the property $this->total with amount that is included into file $result = $this->generate($format, $executiondate, $type); if ($result < 0) { - /*var_dump($this->error); - var_dump($this->invoice_in_error); */ $error++; } } @@ -1684,7 +1679,7 @@ class BonPrelevement extends CommonObject fclose($this->file); if (!empty($conf->global->MAIN_UMASK)) { - @chmod($this->file, octdec($conf->global->MAIN_UMASK)); + @chmod($this->filename, octdec($conf->global->MAIN_UMASK)); } return $result; From 81e8b872a82279410520665bd3b4bd2b6c86d8ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 14 Sep 2022 08:51:22 +0200 Subject: [PATCH 03/18] Update bonprelevement.class.php --- htdocs/compta/prelevement/class/bonprelevement.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 06b912ec343..0db7bc2b2b9 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -2175,7 +2175,8 @@ class BonPrelevement extends CommonObject $XML_SEPA_INFO .= ' '.$CrLf;*/ } } else { - fputs($this->file, 'INCORRECT EMETTEUR '.$XML_SEPA_INFO.$CrLf); + fputs($this->file, 'INCORRECT EMETTEUR '.$this->raison_sociale.$CrLf); + $XML_SEPA_INFO = ''; } return $XML_SEPA_INFO; } From ebf35432bd93e2fa7f7f7942197c93ea09e77b42 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Wed, 14 Sep 2022 11:30:57 +0200 Subject: [PATCH 04/18] FIX recruitment linked files --- htdocs/core/lib/files.lib.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 04c3a481d00..b2100f5a693 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2857,6 +2857,10 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, // Wrapping for import module $accessallowed = $user->rights->import->run; $original_file = $conf->import->dir_temp.'/'.$original_file; + } elseif ($modulepart == 'recruitment' && !empty($conf->recruitment->dir_output)) { + // Wrapping for import module + $accessallowed = $user->rights->recruitment->recruitmentjobposition->read; + $original_file = $conf->recruitment->dir_output.'/'.$original_file; } elseif ($modulepart == 'editor' && !empty($conf->fckeditor->dir_output)) { // Wrapping for wysiwyg editor $accessallowed = 1; From 4906aaf1f6394db3f19b6492fe4bacba721c3e72 Mon Sep 17 00:00:00 2001 From: ksar <35605507+ksar-ksar@users.noreply.github.com> Date: Fri, 16 Sep 2022 11:43:17 +0200 Subject: [PATCH 05/18] FIX : ToOfferALinkForOnlinePayment not translated Link to #22248 I forgot to do it on Crabe also. --- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 0c89d14992c..bd8bea0499e 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1183,7 +1183,7 @@ class pdf_crabe extends ModelePDFFactures require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; global $langs; - $langs->loadLangs(array('payment', 'paybox')); + $langs->loadLangs(array('payment', 'paybox', 'stripe')); $servicename = $langs->transnoentities('Online'); $paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, '', '', ''); $linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' '.$outputlangs->transnoentities("ClickHere").''; From dd4be90525ace20821ba05adb775df11d00f611f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2022 14:15:41 +0200 Subject: [PATCH 06/18] Fix warning --- htdocs/core/class/conf.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 60ee78bbff5..6f08ea8f0ae 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -820,7 +820,7 @@ class Conf } // If we are in develop mode, we activate the option MAIN_SECURITY_CSRF_WITH_TOKEN to 1 if not already defined. - if (!isset($this->global->MAIN_SECURITY_CSRF_WITH_TOKEN) && $this->global->MAIN_FEATURES_LEVEL >= 2) { + if (!isset($this->global->MAIN_SECURITY_CSRF_WITH_TOKEN) && isset($this->global->MAIN_FEATURES_LEVEL) && $this->global->MAIN_FEATURES_LEVEL >= 2) { $this->global->MAIN_SECURITY_CSRF_WITH_TOKEN = 1; } From 12ce79ab078d1663fc40a9846b1bfadd93321509 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2022 14:50:12 +0200 Subject: [PATCH 07/18] Fix rounding --- htdocs/core/lib/price.lib.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php index 9be293a81ab..ca01317ad5d 100644 --- a/htdocs/core/lib/price.lib.php +++ b/htdocs/core/lib/price.lib.php @@ -372,16 +372,16 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt // If rounding is not using base 10 (rare) if (!empty($conf->global->MAIN_ROUNDING_RULE_TOT)) { if ($price_base_type == 'HT') { - $result[0] = round($result[0] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; - $result[1] = round($result[1] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; - $result[9] = round($result[9] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; - $result[10] = round($result[10] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; + $result[0] = price2num(round($result[0] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[1] = price2num(round($result[1] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[9] = price2num(round($result[9] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[10] = price2num(round($result[10] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); $result[2] = price2num($result[0] + $result[1] + $result[9] + $result[10], 'MT'); } else { - $result[1] = round($result[1] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; - $result[2] = round($result[2] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; - $result[9] = round($result[9] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; - $result[10] = round($result[10] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; + $result[1] = price2num(round($result[1] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[2] = price2num(round($result[2] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[9] = price2num(round($result[9] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); + $result[10] = price2num(round($result[10] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT'); $result[0] = price2num($result[2] - $result[1] - $result[9] - $result[10], 'MT'); } } From 5d39f7b6a33b4cb8808343c19ee702658b4c1884 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2022 15:20:17 +0200 Subject: [PATCH 08/18] Try to move to bionic --- .travis.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 92cd2059b15..7e900ebc77b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,8 @@ # We use dist: xenial to have php 5.6+ available os: linux -dist: xenial -#dist: bionic +#dist: xenial +dist: bionic language: php @@ -20,7 +20,7 @@ services: addons: # Force postgresql to 9.4 (the oldest availablable on xenial) - postgresql: '9.4' + postgresql: '10' apt: sources: # To use the last version of pgloader, we add repo of postgresql with a name available in http://apt.postgresql.org/pub/repos/apt/ @@ -74,6 +74,8 @@ notifications: before_install: - | + echo "Add ondrej PPA" + add-apt-repository -y ppa:ondrej/php echo "Disabling Xdebug for composer" export PHP_VERSION_NAME=$(phpenv version-name) cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini From 48f0a956822b73b50d6b4adabafda6f114e290ce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2022 15:51:00 +0200 Subject: [PATCH 09/18] Try fix travis --- .travis.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7e900ebc77b..ebab9b0d017 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,7 @@ addons: # Let's install Apache with. - apache2 # mod_php is not supported by Travis. Add fcgi. We install FPM later on. - - libapache2-mod-fastcgi + #- libapache2-mod-fastcgi # We need pgloader for import mysql database into pgsql - pgloader @@ -72,6 +72,7 @@ notifications: on_failure: always use_notice: true + before_install: - | echo "Add ondrej PPA" @@ -240,6 +241,10 @@ before_script: - echo "Setting up Apache + FPM" + # setup link for php legacy + - sudo ln -s ~/.phpenv/versions/$(phpenv version-name)/bin/php /bin/php + # install apache web server + - sudo apt-get install apache2 php-fpm php-mysql php-pgsql php-gd php-ldap php-xml php-mbstring libapache2-mod-php # enable php-fpm - sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf - | @@ -247,10 +252,11 @@ before_script: # Copy the included pool sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf fi - - sudo a2enmod rewrite actions fastcgi alias + - sudo a2enmod proxy_fcgi rewrite setenvif cgi alias - echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - sudo sed -i -e "s,www-data,travis,g" /etc/apache2/envvars - - sudo chown -R travis:travis /var/lib/apache2/fastcgi + #- sudo chown -R travis:travis /var/lib/apache2/fastcgi + # start php-fpm - ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm # configure apache virtual hosts - sudo cp -f build/travis-ci/apache.conf /etc/apache2/sites-available/000-default.conf From 1162d858ddfca0f85d7408986265d767a37ac924 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2022 16:01:07 +0200 Subject: [PATCH 10/18] Try fix rounding --- htdocs/core/class/commonobject.class.php | 28 +++++++++++++++--------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 513717b56de..b9b09450642 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3529,10 +3529,11 @@ abstract class CommonObject if (!$resqlfix) { dol_print_error($this->db, 'Failed to update line'); } - $this->total_tva -= $diff; - $this->total_ttc -= $diff; - $total_tva_by_vats[$obj->vatrate] -= $diff; - $total_ttc_by_vats[$obj->vatrate] -= $diff; + + $this->total_tva = (float) price2num($this->total_tva - $diff, '', 1); + $this->total_ttc = (float) price2num($this->total_ttc - $diff, '', 1); + $total_tva_by_vats[$obj->vatrate] = (float) price2num($total_tva_by_vats[$obj->vatrate] - $diff, '', 1); + $total_ttc_by_vats[$obj->vatrate] = (float) price2num($total_ttc_by_vats[$obj->vatrate] - $diff, '', 1); } } @@ -3559,9 +3560,16 @@ abstract class CommonObject } } + // Clean total + $this->total_ht = (float) price2num($this->total_ht); + $this->total_tva = (float) price2num($this->total_tva); + $this->total_localtax1 = (float) price2num($this->total_localtax1); + $this->total_localtax2 = (float) price2num($this->total_localtax2); + $this->total_ttc = (float) price2num($this->total_ttc); + $this->db->free($resql); - // Now update global field total_ht, total_ttc, total_tva, total_localtax1, total_localtax2, multicurrency_total_* + // Now update global fields total_ht, total_ttc, total_tva, total_localtax1, total_localtax2, multicurrency_total_* $fieldht = 'total_ht'; $fieldtva = 'tva'; $fieldlocaltax1 = 'localtax1'; @@ -3592,11 +3600,11 @@ abstract class CommonObject if (empty($nodatabaseupdate)) { $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element.' SET'; - $sql .= " ".$fieldht." = ".((float) price2num($this->total_ht)).","; - $sql .= " ".$fieldtva." = ".((float) price2num($this->total_tva)).","; - $sql .= " ".$fieldlocaltax1." = ".((float) price2num($this->total_localtax1)).","; - $sql .= " ".$fieldlocaltax2." = ".((float) price2num($this->total_localtax2)).","; - $sql .= " ".$fieldttc." = ".((float) price2num($this->total_ttc)); + $sql .= " ".$fieldht." = ".((float) price2num($this->total_ht, 'MT', 1)).","; + $sql .= " ".$fieldtva." = ".((float) price2num($this->total_tva, 'MT', 1)).","; + $sql .= " ".$fieldlocaltax1." = ".((float) price2num($this->total_localtax1, 'MT', 1)).","; + $sql .= " ".$fieldlocaltax2." = ".((float) price2num($this->total_localtax2, 'MT', 1)).","; + $sql .= " ".$fieldttc." = ".((float) price2num($this->total_ttc, 'MT', 1)); $sql .= ", multicurrency_total_ht = ".((float) price2num($this->multicurrency_total_ht, 'MT', 1)); $sql .= ", multicurrency_total_tva = ".((float) price2num($this->multicurrency_total_tva, 'MT', 1)); $sql .= ", multicurrency_total_ttc = ".((float) price2num($this->multicurrency_total_ttc, 'MT', 1)); From 802c06c15e744a70a38f63139145cbb65d389f9e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2022 16:15:13 +0200 Subject: [PATCH 11/18] Try travis fix --- .travis.yml | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index ebab9b0d017..21b010b3704 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,19 @@ services: - mysql - postgresql + +before_install: +- | + echo "Add ondrej PPA" + sudo add-apt-repository -y ppa:ondrej/php + sudo apt-get update + echo "Disabling Xdebug for composer" + export PHP_VERSION_NAME=$(phpenv version-name) + echo $PHP_VERSION_NAME + cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini + phpenv config-rm xdebug.ini + echo + addons: # Force postgresql to 9.4 (the oldest availablable on xenial) postgresql: '10' @@ -25,6 +38,7 @@ addons: sources: # To use the last version of pgloader, we add repo of postgresql with a name available in http://apt.postgresql.org/pub/repos/apt/ - pgdg-xenial + - sourceline: 'ppa:ondrej/php' packages: # We need a webserver to test the webservices # Let's install Apache with. @@ -73,16 +87,6 @@ notifications: use_notice: true -before_install: -- | - echo "Add ondrej PPA" - add-apt-repository -y ppa:ondrej/php - echo "Disabling Xdebug for composer" - export PHP_VERSION_NAME=$(phpenv version-name) - cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini - phpenv config-rm xdebug.ini - echo - install: - | echo "Updating Composer" From 5afbfd0a0a96101a221bf9e1f80549ea6025f5d8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2022 16:20:00 +0200 Subject: [PATCH 12/18] Try fix rounding --- htdocs/core/class/commonobject.class.php | 38 ++++++++++++++---------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 4d09b8ae769..c9c7f096fd5 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3494,10 +3494,11 @@ abstract class CommonObject if (!$resqlfix) { dol_print_error($this->db, 'Failed to update line'); } - $this->total_tva -= $diff; - $this->total_ttc -= $diff; - $total_tva_by_vats[$obj->vatrate] -= $diff; - $total_ttc_by_vats[$obj->vatrate] -= $diff; + + $this->total_tva = (float) price2num($this->total_tva - $diff, '', 1); + $this->total_ttc = (float) price2num($this->total_ttc - $diff, '', 1); + $total_tva_by_vats[$obj->vatrate] = (float) price2num($total_tva_by_vats[$obj->vatrate] - $diff, '', 1); + $total_ttc_by_vats[$obj->vatrate] = (float) price2num($total_ttc_by_vats[$obj->vatrate] - $diff, '', 1); } } @@ -3524,9 +3525,16 @@ abstract class CommonObject } } + // Clean total + $this->total_ht = (float) price2num($this->total_ht); + $this->total_tva = (float) price2num($this->total_tva); + $this->total_localtax1 = (float) price2num($this->total_localtax1); + $this->total_localtax2 = (float) price2num($this->total_localtax2); + $this->total_ttc = (float) price2num($this->total_ttc); + $this->db->free($resql); - // Now update global field total_ht, total_ttc, total_tva, total_localtax1, total_localtax2, multicurrency_total_* + // Now update global fields total_ht, total_ttc, total_tva, total_localtax1, total_localtax2, multicurrency_total_* $fieldht = 'total_ht'; $fieldtva = 'tva'; $fieldlocaltax1 = 'localtax1'; @@ -3557,16 +3565,16 @@ abstract class CommonObject if (empty($nodatabaseupdate)) { $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET'; - $sql .= " ".$fieldht." = ".price2num($this->total_ht).","; - $sql .= " ".$fieldtva." = ".price2num($this->total_tva).","; - $sql .= " ".$fieldlocaltax1." = ".price2num($this->total_localtax1).","; - $sql .= " ".$fieldlocaltax2." = ".price2num($this->total_localtax2).","; - $sql .= " ".$fieldttc." = ".price2num($this->total_ttc); - $sql .= ", multicurrency_total_ht = ".price2num($this->multicurrency_total_ht, 'MT', 1); - $sql .= ", multicurrency_total_tva = ".price2num($this->multicurrency_total_tva, 'MT', 1); - $sql .= ", multicurrency_total_ttc = ".price2num($this->multicurrency_total_ttc, 'MT', 1); - $sql .= ' WHERE rowid = '.$this->id; - + $sql .= " ".$fieldht." = ".((float) price2num($this->total_ht, 'MT', 1)).","; + $sql .= " ".$fieldtva." = ".((float) price2num($this->total_tva, 'MT', 1)).","; + $sql .= " ".$fieldlocaltax1." = ".((float) price2num($this->total_localtax1, 'MT', 1)).","; + $sql .= " ".$fieldlocaltax2." = ".((float) price2num($this->total_localtax2, 'MT', 1)).","; + $sql .= " ".$fieldttc." = ".((float) price2num($this->total_ttc, 'MT', 1)); + $sql .= ", multicurrency_total_ht = ".((float) price2num($this->multicurrency_total_ht, 'MT', 1)); + $sql .= ", multicurrency_total_tva = ".((float) price2num($this->multicurrency_total_tva, 'MT', 1)); + $sql .= ", multicurrency_total_ttc = ".((float) price2num($this->multicurrency_total_ttc, 'MT', 1)); + $sql .= " WHERE rowid = ".((int) $this->id); + dol_syslog(get_class($this)."::update_price", LOG_DEBUG); $resql = $this->db->query($sql); From bab7ff256fc862bb2b93a61c739c38ddc2199f7b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2022 16:35:22 +0200 Subject: [PATCH 13/18] Try fix travis --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 21b010b3704..28d8b7004b7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,9 +21,6 @@ services: before_install: - | - echo "Add ondrej PPA" - sudo add-apt-repository -y ppa:ondrej/php - sudo apt-get update echo "Disabling Xdebug for composer" export PHP_VERSION_NAME=$(phpenv version-name) echo $PHP_VERSION_NAME @@ -47,6 +44,8 @@ addons: #- libapache2-mod-fastcgi # We need pgloader for import mysql database into pgsql - pgloader + - php5.6 + - php5.6-pgsql env: global: From d39eca4d50e3deaffb5442baacb5527f038fc1ef Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2022 16:36:29 +0200 Subject: [PATCH 14/18] Fix phpcs --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index c9c7f096fd5..5de1744a20d 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3574,7 +3574,7 @@ abstract class CommonObject $sql .= ", multicurrency_total_tva = ".((float) price2num($this->multicurrency_total_tva, 'MT', 1)); $sql .= ", multicurrency_total_ttc = ".((float) price2num($this->multicurrency_total_ttc, 'MT', 1)); $sql .= " WHERE rowid = ".((int) $this->id); - + dol_syslog(get_class($this)."::update_price", LOG_DEBUG); $resql = $this->db->query($sql); From ebc3df35ee47ed860e13f0edb97bd5c4c0aeabc2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2022 17:27:32 +0200 Subject: [PATCH 15/18] Try fix --- .travis.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.travis.yml b/.travis.yml index 28d8b7004b7..9ddc5fe0379 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,11 +21,17 @@ services: before_install: - | + echo "Add ondrej PPA" + sudo add-apt-repository -y ppa:ondrej/php + sudo apt-get update echo "Disabling Xdebug for composer" export PHP_VERSION_NAME=$(phpenv version-name) echo $PHP_VERSION_NAME + ls ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/ cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini phpenv config-rm xdebug.ini + phpenv rehash + phpenv config-add mysqli echo addons: @@ -46,6 +52,7 @@ addons: - pgloader - php5.6 - php5.6-pgsql + - php5.6-mysqli env: global: From 962018d5c74ba7f4361306c2649f30eb1b5244b3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2022 18:14:34 +0200 Subject: [PATCH 16/18] Try fix --- .travis.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9ddc5fe0379..a456e92752e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -448,8 +448,8 @@ script: - | echo "Unit testing" - # Ensure we catch errors. Set this to +e if you want to go to the end to see dolibarr.log file. - set -e + # Ensure we catch errors. Set this to +e if you want to go to the end to see dolibarr.log and apache error.log file. + set +e phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php phpunitresult=$? echo "Phpunit return code = $phpunitresult" @@ -461,6 +461,9 @@ after_script: ls $TRAVIS_BUILD_DIR/documents #cat $TRAVIS_BUILD_DIR/documents/dolibarr.log sudo tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log + echo "After script - Output last lines of apache error.log" + ls /var/log/apache2 + sudo tail -n 50 /var/log/apache2/travis_error_log after_success: - | @@ -469,14 +472,14 @@ after_success: after_failure: - | echo Failure detected, so we show samples of log to help diagnose - # This part of code is executed only if previous command that fails are enclosed with set +e - # Upgrade log files + # This part of code is executed only if the command that fails are enclosed with set +e + # Show upgrade log files for ficlog in `ls $TRAVIS_BUILD_DIR/*.log` do echo "Debugging informations for file $ficlog" #cat $ficlog done - # Apache log file + # Show Apache log file echo "Debugging informations for file apache error.log" sudo cat /var/log/apache2/travis_error_log if [ "$DEBUG" = true ]; then From 2664f1bce041b142fe56298b4b534cc65d42cc8c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2022 18:45:17 +0200 Subject: [PATCH 17/18] Test --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a456e92752e..5247b051e23 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,7 +31,6 @@ before_install: cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini phpenv config-rm xdebug.ini phpenv rehash - phpenv config-add mysqli echo addons: @@ -53,6 +52,7 @@ addons: - php5.6 - php5.6-pgsql - php5.6-mysqli + - php5.6-xml env: global: From af0c6c0600eb610a6476481265d898d3d5670f3d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2022 19:36:47 +0200 Subject: [PATCH 18/18] Try restore old travis script --- .travis.yml | 57 +++++++++++++++++------------------------------------ 1 file changed, 18 insertions(+), 39 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5247b051e23..92cd2059b15 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,8 @@ # We use dist: xenial to have php 5.6+ available os: linux -#dist: xenial -dist: bionic +dist: xenial +#dist: bionic language: php @@ -18,41 +18,21 @@ services: - mysql - postgresql - -before_install: -- | - echo "Add ondrej PPA" - sudo add-apt-repository -y ppa:ondrej/php - sudo apt-get update - echo "Disabling Xdebug for composer" - export PHP_VERSION_NAME=$(phpenv version-name) - echo $PHP_VERSION_NAME - ls ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/ - cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini - phpenv config-rm xdebug.ini - phpenv rehash - echo - addons: # Force postgresql to 9.4 (the oldest availablable on xenial) - postgresql: '10' + postgresql: '9.4' apt: sources: # To use the last version of pgloader, we add repo of postgresql with a name available in http://apt.postgresql.org/pub/repos/apt/ - pgdg-xenial - - sourceline: 'ppa:ondrej/php' packages: # We need a webserver to test the webservices # Let's install Apache with. - apache2 # mod_php is not supported by Travis. Add fcgi. We install FPM later on. - #- libapache2-mod-fastcgi + - libapache2-mod-fastcgi # We need pgloader for import mysql database into pgsql - pgloader - - php5.6 - - php5.6-pgsql - - php5.6-mysqli - - php5.6-xml env: global: @@ -92,6 +72,13 @@ notifications: on_failure: always use_notice: true +before_install: +- | + echo "Disabling Xdebug for composer" + export PHP_VERSION_NAME=$(phpenv version-name) + cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini + phpenv config-rm xdebug.ini + echo install: - | @@ -251,10 +238,6 @@ before_script: - echo "Setting up Apache + FPM" - # setup link for php legacy - - sudo ln -s ~/.phpenv/versions/$(phpenv version-name)/bin/php /bin/php - # install apache web server - - sudo apt-get install apache2 php-fpm php-mysql php-pgsql php-gd php-ldap php-xml php-mbstring libapache2-mod-php # enable php-fpm - sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf - | @@ -262,11 +245,10 @@ before_script: # Copy the included pool sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf fi - - sudo a2enmod proxy_fcgi rewrite setenvif cgi alias + - sudo a2enmod rewrite actions fastcgi alias - echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - sudo sed -i -e "s,www-data,travis,g" /etc/apache2/envvars - #- sudo chown -R travis:travis /var/lib/apache2/fastcgi - # start php-fpm + - sudo chown -R travis:travis /var/lib/apache2/fastcgi - ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm # configure apache virtual hosts - sudo cp -f build/travis-ci/apache.conf /etc/apache2/sites-available/000-default.conf @@ -448,8 +430,8 @@ script: - | echo "Unit testing" - # Ensure we catch errors. Set this to +e if you want to go to the end to see dolibarr.log and apache error.log file. - set +e + # Ensure we catch errors. Set this to +e if you want to go to the end to see dolibarr.log file. + set -e phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php phpunitresult=$? echo "Phpunit return code = $phpunitresult" @@ -461,9 +443,6 @@ after_script: ls $TRAVIS_BUILD_DIR/documents #cat $TRAVIS_BUILD_DIR/documents/dolibarr.log sudo tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log - echo "After script - Output last lines of apache error.log" - ls /var/log/apache2 - sudo tail -n 50 /var/log/apache2/travis_error_log after_success: - | @@ -472,14 +451,14 @@ after_success: after_failure: - | echo Failure detected, so we show samples of log to help diagnose - # This part of code is executed only if the command that fails are enclosed with set +e - # Show upgrade log files + # This part of code is executed only if previous command that fails are enclosed with set +e + # Upgrade log files for ficlog in `ls $TRAVIS_BUILD_DIR/*.log` do echo "Debugging informations for file $ficlog" #cat $ficlog done - # Show Apache log file + # Apache log file echo "Debugging informations for file apache error.log" sudo cat /var/log/apache2/travis_error_log if [ "$DEBUG" = true ]; then