From 657972b79be5f3cf9b5ece59b7bfc500a3e3188f Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Wed, 16 Jun 2021 16:49:24 +0200 Subject: [PATCH 1/7] FIX : Tracking number label shouldn't be displaied on "espadon" model if shipping tracking number is empty --- htdocs/core/modules/expedition/doc/pdf_espadon.modules.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index c232edbe81c..69b6059e622 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -364,7 +364,11 @@ class pdf_espadon extends ModelePdfExpedition $tab_top_alt = $tab_top; $pdf->SetFont('', 'B', $default_font_size - 2); - $pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities("TrackingNumber")." : ".$object->tracking_number, 0, 1, false, true, 'L'); + if(!empty($object->tracking_number)) { + $pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities("TrackingNumber")." : ".$object->tracking_number, 0, 1, false, true, 'L'); + } else { + $pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top - 5, '', 0, 1, false, true, 'L'); + } $tab_top_alt = $pdf->GetY(); //$tab_top_alt += 1; From 3b42b44899ff31f59ddaf18381f352adc6a70d10 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Jun 2021 19:05:51 +0200 Subject: [PATCH 2/7] Update travis --- .travis.yml | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7b8fa4546b2..9403188d709 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ # This script is used by Travis CI to run automatically Continuous test integration # from Dolibarr GitHub repository. -# For syntax, see http://about.travis-ci.org/docs/user/languages/php/ +# For syntax, see https://docs.travis-ci.com/user/languages/php/ # We use dist: xenial to have php 5.6+ available os: linux @@ -9,6 +9,9 @@ dist: xenial language: php +git: + depth: 1 + # Start on every boot services: - memcached @@ -38,8 +41,8 @@ env: jobs: fast_finish: true - allow_failures: - - php: nightly + #allow_failures: + #- php: nightly include: - if: type = push php: '5.6' @@ -73,13 +76,6 @@ before_install: phpenv config-rm xdebug.ini echo -- | - if [ "$DB" = 'postgresql' ]; then - echo "Check pgloader version" - pgloader --version - echo - fi - install: - | echo "Updating Composer" @@ -178,6 +174,10 @@ before_script: mysql --version | head - mysql -e "SELECT VERSION();" | head - psql --version + if [ "$DB" = 'postgresql' ]; then + echo "Check pgloader version" + pgloader --version + fi echo - | @@ -267,24 +267,27 @@ script: echo - | - echo "Checking PHP syntax errors" + echo "Checking PHP syntax errors (only 1 version to not overload travis and avoid duplicate tests)" # Ensure we catch errors set -e #parallel-lint --exclude htdocs/includes --blame . - parallel-lint --exclude dev/tools/test/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \ - --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian \ - --exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/php-parallel-lint --exclude htdocs/includes/symfony \ - --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/maximebf \ - --exclude htdocs/includes/phpunit/ --exclude htdocs/includes/tecnickcom/tcpdf/include/barcodes --exclude htdocs/includes/webmozart --blame . + # Exclusions are defined in the ruleset.xml file + if [ "$TRAVIS_PHP_VERSION" = "7.4" ]; then + parallel-lint -e php --exclude dev/tools/test/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \ + --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian \ + --exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/php-parallel-lint --exclude htdocs/includes/symfony \ + --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/maximebf \ + --exclude htdocs/includes/phpunit/ --exclude htdocs/includes/tecnickcom/tcpdf/include/barcodes --exclude htdocs/includes/webmozart --blame . + fi set +e echo - | - echo "Checking coding style (excluding Pull Requests builds to not overload travis, excluding also some jobs to avoid duplicate tests)" + echo "Checking coding style (only for Pull Requests builds and 1 version to not overload travis and avoid duplicate tests)" # Ensure we catch errors set -e # Exclusions are defined in the ruleset.xml file - if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "7.4" ] && [ "$DB" = "mysql" ]; then + if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "7.4" ]; then phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; fi set +e @@ -401,8 +404,12 @@ script: php upgrade.php 12.0.0 13.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade12001300.log php upgrade2.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-2.log php step5.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-3.log + ls -alrt $TRAVIS_BUILD_DIR/ +- | + echo "Enabling new modules" # Enable modules not enabled into original dump + cd htdocs/install php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_PRODUCTBATCH,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_STRIPE > $TRAVIS_BUILD_DIR/enablemodule.log php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKET,MAIN_MODULE_ACCOUNTING,MAIN_MODULE_MRP >> $TRAVIS_BUILD_DIR/enablemodule.log php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_RECEPTION,MAIN_MODULE_RECRUITMENT >> $TRAVIS_BUILD_DIR/enablemodule.log From 99655eeb39a1371510e4ae367dd91e6df05ab2db Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Thu, 17 Jun 2021 09:28:45 +0200 Subject: [PATCH 3/7] FIX: styles failure in tickets with very long messages --- htdocs/ticket/class/actions_ticket.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/class/actions_ticket.class.php b/htdocs/ticket/class/actions_ticket.class.php index 40fc22e1347..8df5572c87c 100644 --- a/htdocs/ticket/class/actions_ticket.class.php +++ b/htdocs/ticket/class/actions_ticket.class.php @@ -191,7 +191,7 @@ class ActionsTicket // Initial message print '
'; - print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print ''; print '
'; print $langs->trans("InitialMessage"); From eeef78760a260e90dda94bfe9d6a5049b3189526 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Thu, 17 Jun 2021 10:29:43 +0200 Subject: [PATCH 4/7] fix: Bad position of the printFieldListWhere hook --- htdocs/product/stock/replenish.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index d316d6cdf98..a2bf8051a3c 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -352,6 +352,12 @@ if (!empty($canvas)) $sql .= ' AND p.canvas = "'.$db->escape($canvas).'"'; if ($fk_supplier > 0) { $sql .= ' AND EXISTS (SELECT pfp.rowid FROM '.MAIN_DB_PREFIX.'product_fournisseur_price as pfp WHERE pfp.fk_product = p.rowid AND pfp.fk_soc = '.((int) $fk_supplier).' AND pfp.entity IN ('.getEntity('product_fournisseur_price').'))'; } + +// Add where from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; + $sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price'; $sql .= ', p.price_ttc, p.price_base_type,p.fk_product_type, p.tms'; $sql .= ', p.duration, p.tobuy'; @@ -459,11 +465,6 @@ if ($usevirtualstock) } } -// Add where from hooks -$parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook -$sql .= $hookmanager->resPrint; - $sql .= $db->order($sortfield, $sortorder); $sql .= $db->plimit($limit + 1, $offset); From 5b8a6f1d712601e5e6cbe87353fa2d8ff2fdf63a Mon Sep 17 00:00:00 2001 From: atm-lena Date: Thu, 17 Jun 2021 10:41:03 +0200 Subject: [PATCH 5/7] Add Trigger "MAILING_DELETE" --- htdocs/comm/mailing/class/mailing.class.php | 24 ++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index 75efe1f07b2..24531c53956 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -429,6 +429,10 @@ class Mailing extends CommonObject */ public function delete($rowid) { + global $user; + + $this->db->begin(); + $sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing"; $sql .= " WHERE rowid = ".$rowid; @@ -436,13 +440,31 @@ class Mailing extends CommonObject $resql = $this->db->query($sql); if ($resql) { - return $this->delete_targets(); + $res = $this->delete_targets(); + if(empty($res)){ + $this->db->rollback(); + $this->error = $this->db->lasterror(); + return -1; + } } else { + $this->db->rollback(); $this->error = $this->db->lasterror(); return -1; } + + if(!$notrigger){ + $result = $this->call_trigger('MAILING_DELETE', $user); + if ($result < 0) + { + $this->db->rollback(); + return -1; + } + } + + $this->db->commit(); + return 1; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps From 9769e33eab1d44c124f1a4e666eed788e8eaf391 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Thu, 17 Jun 2021 10:41:55 +0200 Subject: [PATCH 6/7] notigger parameter --- htdocs/comm/mailing/class/mailing.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index 24531c53956..a61ea3079e4 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -427,7 +427,7 @@ class Mailing extends CommonObject * @param int $rowid id du mailing a supprimer * @return int 1 en cas de succes */ - public function delete($rowid) + public function delete($rowid, $notrigger = 0) { global $user; From 50bc832532d58ccabbdf240906f87d4c274cd087 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Thu, 17 Jun 2021 10:48:48 +0200 Subject: [PATCH 7/7] FIX : better correction --- htdocs/core/modules/expedition/doc/pdf_espadon.modules.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 69b6059e622..48e70b29a45 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -362,15 +362,12 @@ class pdf_espadon extends ModelePdfExpedition { $tab_top = 88 + $height_incoterms; $tab_top_alt = $tab_top; - $pdf->SetFont('', 'B', $default_font_size - 2); if(!empty($object->tracking_number)) { $pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities("TrackingNumber")." : ".$object->tracking_number, 0, 1, false, true, 'L'); - } else { - $pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top - 5, '', 0, 1, false, true, 'L'); } - $tab_top_alt = $pdf->GetY(); + if(!empty($object->tracking_number)) $tab_top_alt = $pdf->GetY(); //$tab_top_alt += 1; // Tracking number