From e6a5d4c8d92d0a72588ee0a8549845616f145ab5 Mon Sep 17 00:00:00 2001 From: Birame SENE Date: Thu, 21 May 2020 17:01:27 +0200 Subject: [PATCH 1/8] Add PNG/JPEG packages to build GD extension --- build/docker/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/docker/Dockerfile b/build/docker/Dockerfile index 4b1df7e0876..9264eed5ef2 100644 --- a/build/docker/Dockerfile +++ b/build/docker/Dockerfile @@ -3,7 +3,7 @@ FROM php:7.2-apache ENV HOST_USER_ID 33 ENV PHP_INI_DATE_TIMEZONE 'UTC' -RUN apt-get update && apt-get install -y libpng-dev libjpeg-dev libldap2-dev libzip-dev zlib1g-dev libicu-dev g++\ +RUN apt-get update && apt-get install -y libpng16-16 libpng-dev libjpeg62-turbo libjpeg62-turbo-dev libldap2-dev zlib1g-dev libicu-dev g++\ && rm -rf /var/lib/apt/lists/* \ && docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \ && docker-php-ext-install gd \ @@ -14,7 +14,7 @@ RUN apt-get update && apt-get install -y libpng-dev libjpeg-dev libldap2-dev lib && docker-php-ext-install calendar \ && docker-php-ext-configure intl \ && docker-php-ext-install intl \ - && apt-get autoremove --purge -y libjpeg-dev libldap2-dev zlib1g-dev libicu-dev g++ + && apt-get autoremove --purge -y libpng-dev libjpeg62-turbo-dev libldap2-dev zlib1g-dev libicu-dev g++ RUN mkdir /var/documents RUN chown www-data /var/documents From d9a2d2b982613e5a52beb29d949f26931abad44d Mon Sep 17 00:00:00 2001 From: Tobias Sekan Date: Fri, 22 May 2020 08:00:26 +0200 Subject: [PATCH 2/8] fix not working default values for payment --- htdocs/fourn/facture/card.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 6e8f259bc01..ae6af7bf99b 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1780,6 +1780,18 @@ if ($action == 'create') if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code; } + // when payment condition is empty (means not override by payment condition form a other object, like third-party), try to use default value + if(empty($cond_reglement_id)) + { + $cond_reglement_id = GETPOST("cond_reglement_id"); + } + + // when payment mode is empty (means not override by payment condition form a other object, like third-party), try to use default value + if(empty($mode_reglement_id)) + { + $mode_reglement_id = GETPOST("mode_reglement_id"); + } + print '
'; print ''; print ''; From 53080be2453eb2c6815d809e344c1e5191f070d3 Mon Sep 17 00:00:00 2001 From: Tobias Sekan Date: Fri, 22 May 2020 08:01:29 +0200 Subject: [PATCH 3/8] fix not working default values for payment --- htdocs/compta/facture/card.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index ab2262844bf..3b36950447f 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2907,6 +2907,18 @@ if ($action == 'create') if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code; } + // when payment condition is empty (means not override by payment condition form a other object, like third-party), try to use default value + if(empty($cond_reglement_id)) + { + $cond_reglement_id = GETPOST("cond_reglement_id"); + } + + // when payment mode is empty (means not override by payment mode form a other object, like third-party), try to use default value + if(empty($mode_reglement_id)) + { + $mode_reglement_id = GETPOST("mode_reglement_id"); + } + if (!empty($soc->id)) $absolute_discount = $soc->getAvailableDiscounts(); $note_public = $object->getDefaultCreateValueFor('note_public', ((!empty($origin) && !empty($originid) && is_object($objectsrc) && !empty($conf->global->FACTURE_REUSE_NOTES_ON_CREATE_FROM)) ? $objectsrc->note_public : null)); $note_private = $object->getDefaultCreateValueFor('note_private', ((!empty($origin) && !empty($originid) && is_object($objectsrc) && !empty($conf->global->FACTURE_REUSE_NOTES_ON_CREATE_FROM)) ? $objectsrc->note_private : null)); From 2873f4dacfe3a0bdf0c7e91281bb73a40b4f2ce4 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 22 May 2020 06:08:12 +0000 Subject: [PATCH 4/8] Fixing style errors. --- htdocs/compta/facture/card.php | 2 +- htdocs/fourn/facture/card.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 3b36950447f..038120151e3 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2918,7 +2918,7 @@ if ($action == 'create') { $mode_reglement_id = GETPOST("mode_reglement_id"); } - + if (!empty($soc->id)) $absolute_discount = $soc->getAvailableDiscounts(); $note_public = $object->getDefaultCreateValueFor('note_public', ((!empty($origin) && !empty($originid) && is_object($objectsrc) && !empty($conf->global->FACTURE_REUSE_NOTES_ON_CREATE_FROM)) ? $objectsrc->note_public : null)); $note_private = $object->getDefaultCreateValueFor('note_private', ((!empty($origin) && !empty($originid) && is_object($objectsrc) && !empty($conf->global->FACTURE_REUSE_NOTES_ON_CREATE_FROM)) ? $objectsrc->note_private : null)); diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index ae6af7bf99b..05cb43fceb8 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1791,7 +1791,7 @@ if ($action == 'create') { $mode_reglement_id = GETPOST("mode_reglement_id"); } - + print ''; print ''; print ''; From e349b9323f04db2ee0fda7d73fe8fea41abf4106 Mon Sep 17 00:00:00 2001 From: "gael.langlais" Date: Fri, 22 May 2020 17:42:06 +0200 Subject: [PATCH 5/8] Change some curly braces #13929 --- htdocs/contact/list.php | 11 +++++------ htdocs/core/antispamimage.php | 2 +- htdocs/core/class/lessc.class.php | 6 +++--- htdocs/core/lib/security2.lib.php | 16 ++++++++-------- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 9e7485d189f..7eee6d797e7 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -76,7 +76,7 @@ $search_no_email = GETPOST("search_no_email", 'int'); if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { if ($value['active']) { - $search_{$key} = GETPOST("search_".$key, 'alpha'); + $search_[$key] = GETPOST("search_".$key, 'alpha'); } } } @@ -253,7 +253,7 @@ if (empty($reshook)) if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { if ($value['active']) { - $search_{$key} = ""; + $search_[$key] = ""; } } } @@ -357,9 +357,8 @@ if (strlen($search_phone_mobile)) $sql .= natural_search('p.phone_mobile', $se if (strlen($search_fax)) $sql .= natural_search('p.fax', $search_fax); if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { - if ($value['active'] && strlen($search_{$key})) { - //$sql.= natural_search("p.socialnetworks->'$.".$key."'", $search_{$key}); - $sql .= ' AND p.socialnetworks LIKE \'%"'.$key.'":"'.$search_{$key}.'%\''; + if ($value['active'] && strlen($search_[$key])) { + $sql .= ' AND p.socialnetworks LIKE \'%"'.$key.'":"'.$search_[$key].'%\''; } } } @@ -669,7 +668,7 @@ if (!empty($conf->socialnetworks->enabled)) { if (!empty($arrayfields['p.'.$key]['checked'])) { print ''; - print ''; + print ''; print ''; } } diff --git a/htdocs/core/antispamimage.php b/htdocs/core/antispamimage.php index 68e585c3ea0..7d6512a64a9 100644 --- a/htdocs/core/antispamimage.php +++ b/htdocs/core/antispamimage.php @@ -43,7 +43,7 @@ $number = strlen($letters); $string = ''; for ($i = 0; $i < $length; $i++) { - $string .= $letters{mt_rand(0, $number - 1)}; + $string .= $letters[mt_rand(0, $number - 1)]; } //print $string; diff --git a/htdocs/core/class/lessc.class.php b/htdocs/core/class/lessc.class.php index 210c3d3c29d..8ab9e58aa58 100644 --- a/htdocs/core/class/lessc.class.php +++ b/htdocs/core/class/lessc.class.php @@ -1966,7 +1966,7 @@ class Lessc { $this->pushEnv(); $parser = new lessc_parser($this, __METHOD__); foreach ($args as $name => $strValue) { - if ($name{0} !== '@') { + if ($name[0] !== '@') { $name = '@'.$name; } $parser->count = 0; @@ -2638,7 +2638,7 @@ class lessc_parser { $hidden = true; if (!isset($block->args)) { foreach ($block->tags as $tag) { - if (!is_string($tag) || $tag{0} != $this->lessc->mPrefix) { + if (!is_string($tag) || $tag[0] != $this->lessc->mPrefix) { $hidden = false; break; } @@ -2692,7 +2692,7 @@ class lessc_parser { protected function fixTags($tags) { // move @ tags out of variable namespace foreach ($tags as &$tag) { - if ($tag{0} == $this->lessc->vPrefix) + if ($tag[0] == $this->lessc->vPrefix) $tag[0] = $this->lessc->mPrefix; } return $tags; diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 04d16084365..c7f5a7b7330 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -463,15 +463,15 @@ function getRandomPassword($generic = false, $replaceambiguouschars = null, $len { $max = strlen($lowercase) - 1; for ($x = 0; $x < $nbofchar; $x++) { - $randomCode .= $lowercase{random_int(0, $max)}; + $randomCode .= $lowercase[random_int(0, $max)]; } $max = strlen($uppercase) - 1; for ($x = 0; $x < $nbofchar; $x++) { - $randomCode .= $uppercase{random_int(0, $max)}; + $randomCode .= $uppercase[random_int(0, $max)]; } $max = strlen($numbers) - 1; for ($x = 0; $x < $nbofcharlast; $x++) { - $randomCode .= $numbers{random_int(0, $max)}; + $randomCode .= $numbers[random_int(0, $max)]; } $generated_password = str_shuffle($randomCode); @@ -480,15 +480,15 @@ function getRandomPassword($generic = false, $replaceambiguouschars = null, $len { $max = strlen($lowercase) - 1; for ($x = 0; $x < $nbofchar; $x++) { - $randomCode .= $lowercase{mt_rand(0, $max)}; + $randomCode .= $lowercase[mt_rand(0, $max)]; } $max = strlen($uppercase) - 1; for ($x = 0; $x < $nbofchar; $x++) { - $randomCode .= $uppercase{mt_rand(0, $max)}; + $randomCode .= $uppercase[mt_rand(0, $max)]; } $max = strlen($numbers) - 1; for ($x = 0; $x < $nbofcharlast; $x++) { - $randomCode .= $numbers{mt_rand(0, $max)}; + $randomCode .= $numbers[mt_rand(0, $max)]; } $generated_password = str_shuffle($randomCode); @@ -512,11 +512,11 @@ function getRandomPassword($generic = false, $replaceambiguouschars = null, $len $max = strlen($numbers) - 1; if (function_exists('random_int')) // Cryptographic random { - $generated_password = str_replace($replaceambiguouschars, $numbers{random_int(0, $max)}, $generated_password); + $generated_password = str_replace($replaceambiguouschars, $numbers[random_int(0, $max)], $generated_password); } else { - $generated_password = str_replace($replaceambiguouschars, $numbers{mt_rand(0, $max)}, $generated_password); + $generated_password = str_replace($replaceambiguouschars, $numbers[mt_rand(0, $max)], $generated_password); } } From 0bf6b26117a631ee6843e3b2911bad1929743c37 Mon Sep 17 00:00:00 2001 From: Laurent De Coninck Date: Sat, 23 May 2020 12:20:56 +0200 Subject: [PATCH 6/8] add a mail server --- build/docker/docker-compose.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/build/docker/docker-compose.yml b/build/docker/docker-compose.yml index 3fe6125a874..cc839810e7f 100644 --- a/build/docker/docker-compose.yml +++ b/build/docker/docker-compose.yml @@ -21,5 +21,12 @@ web: - ../../htdocs:/var/www/html links: - mariadb + - mail ports: - "80:80" + +mail: + image: maildev/maildev + ports: + - "8081:80" + - "25:25" \ No newline at end of file From 072d8c622297c87ac2f3bf1040908d8fab63d9f5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 May 2020 13:36:02 +0200 Subject: [PATCH 7/8] Update list.php --- htdocs/contact/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 7eee6d797e7..8ee51ca815e 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -76,7 +76,7 @@ $search_no_email = GETPOST("search_no_email", 'int'); if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { if ($value['active']) { - $search_[$key] = GETPOST("search_".$key, 'alpha'); + $search_{$key} = GETPOST("search_".$key, 'alpha'); } } } @@ -253,7 +253,7 @@ if (empty($reshook)) if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { if ($value['active']) { - $search_[$key] = ""; + $search_{$key} = ""; } } } @@ -358,7 +358,7 @@ if (strlen($search_fax)) $sql .= natural_search('p.fax', $search_fax) if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { if ($value['active'] && strlen($search_[$key])) { - $sql .= ' AND p.socialnetworks LIKE \'%"'.$key.'":"'.$search_[$key].'%\''; + $sql .= ' AND p.socialnetworks LIKE \'%"'.$key.'":"'.$search_{$key}.'%\''; } } } From 9e95342e2fcb7c254f97763f6502f16e1e740323 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 May 2020 13:36:39 +0200 Subject: [PATCH 8/8] Update list.php --- htdocs/contact/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 8ee51ca815e..781daacd030 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -357,7 +357,7 @@ if (strlen($search_phone_mobile)) $sql .= natural_search('p.phone_mobile', $se if (strlen($search_fax)) $sql .= natural_search('p.fax', $search_fax); if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { - if ($value['active'] && strlen($search_[$key])) { + if ($value['active'] && strlen($search_{$key})) { $sql .= ' AND p.socialnetworks LIKE \'%"'.$key.'":"'.$search_{$key}.'%\''; } } @@ -668,7 +668,7 @@ if (!empty($conf->socialnetworks->enabled)) { if (!empty($arrayfields['p.'.$key]['checked'])) { print ''; - print ''; + print ''; print ''; } }