From 8c87050703903b8fe6577e75cddc43bc6c259735 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Dec 2020 13:54:02 +0100 Subject: [PATCH 01/15] FIX Check of customer/vendor code fails in some cases --- htdocs/comm/card.php | 5 ++- htdocs/core/lib/functions2.lib.php | 39 ++++++++----------- .../societe/mod_codeclient_elephant.php | 6 +-- htdocs/fourn/card.php | 6 ++- htdocs/margin/tabs/thirdpartyMargins.php | 10 ++++- htdocs/societe/card.php | 10 ++++- htdocs/societe/class/societe.class.php | 2 + htdocs/societe/consumption.php | 10 ++++- htdocs/societe/document.php | 10 ++++- htdocs/societe/note.php | 10 ++++- htdocs/societe/notify/card.php | 10 ++++- htdocs/societe/paymentmodes.php | 10 ++++- htdocs/societe/price.php | 8 +++- htdocs/societe/project.php | 10 ++++- htdocs/societe/societecontact.php | 10 ++++- htdocs/societe/website.php | 8 +++- htdocs/ticket/list.php | 10 ++--- 17 files changed, 120 insertions(+), 54 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index d48c897d6bb..8b1ab0f4ac8 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -269,7 +269,10 @@ if ($object->id > 0) print ''; print $langs->trans('CustomerCode').''; print $object->code_client; - if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; + $tmpcheck = $object->check_codeclient(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongCustomerCode").')'; + } print ''; print ''; diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 1ccc4a2d1fb..c00e0f7f825 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -773,6 +773,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ if (dol_strlen($maskcounter) < 3 && empty($conf->global->MAIN_COUNTER_WITH_LESS_3_DIGITS)) return 'ErrorCounterMustHaveMoreThan3Digits'; // Extract value for third party mask counter + $regClientRef = array(); if (preg_match('/\{(c+)(0*)\}/i', $mask, $regClientRef)) { $maskrefclient = $regClientRef[1].$regClientRef[2]; @@ -806,6 +807,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ } // Extract value for user + $regType = array(); if (preg_match('/\{(u+)\}/i', $mask, $regType)) { $lastname = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; @@ -970,12 +972,10 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ //print "masktri=".$masktri." maskcounter=".$maskcounter." maskraz=".$maskraz." maskoffset=".$maskoffset."
\n"; // Define $sqlstring - if (function_exists('mb_strrpos')) - { + if (function_exists('mb_strrpos')) { $posnumstart = mb_strrpos($maskwithnocode, $maskcounter, 'UTF-8'); } - else - { + else { $posnumstart = strrpos($maskwithnocode, $maskcounter); } // Pos of counter in final string (from 0 to ...) if ($posnumstart < 0) return 'ErrorBadMaskFailedToLocatePosOfSequence'; @@ -1218,6 +1218,7 @@ function check_value($mask, $value) $hasglobalcounter = false; // Extract value for mask counter, mask raz and mask offset + $reg = array(); if (preg_match('/\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}/i', $mask, $reg)) { $masktri = $reg[1].(isset($reg[2]) ? $reg[2] : '').(isset($reg[3]) ? $reg[3] : ''); @@ -1236,6 +1237,7 @@ function check_value($mask, $value) if (dol_strlen($maskcounter) < 3) return 'ErrorCounterMustHaveMoreThan3Digits'; // Extract value for third party mask counter + $regClientRef = array(); if (preg_match('/\{(c+)(0*)\}/i', $mask, $regClientRef)) { $maskrefclient = $regClientRef[1].$regClientRef[2]; @@ -1288,31 +1290,24 @@ function check_value($mask, $value) // Define reg if ($maskraz > 1 && !preg_match('/^(.*)\{(y+)\}\{(m+)\}/i', $maskwithonlyymcode, $reg)) return 'ErrorCantUseRazInStartedYearIfNoYearMonthInMask'; if ($maskraz <= 1 && !preg_match('/^(.*)\{(y+)\}/i', $maskwithonlyymcode, $reg)) return 'ErrorCantUseRazIfNoYearInMask'; - //print "x".$maskwithonlyymcode." ".$maskraz; } - //print "masktri=".$masktri." maskcounter=".$maskcounter." maskraz=".$maskraz." maskoffset=".$maskoffset."
\n"; + //print "masktri=".$masktri." maskcounter=".$maskcounter." maskwithonlyymcode=".$maskwithonlyymcode." maskwithnocode=".$maskwithnocode." maskraz=".$maskraz." maskoffset=".$maskoffset."
\n"; - // Check we have a number in ($posnumstart+1).', '.dol_strlen($maskcounter) - // + if (function_exists('mb_strrpos')) { + $posnumstart = mb_strrpos($maskwithnocode, $maskcounter, 'UTF-8'); + } + else { + $posnumstart = strrpos($maskwithnocode, $maskcounter); + } // Pos of counter in final string (from 0 to ...) + if ($posnumstart < 0) return 'ErrorBadMaskFailedToLocatePosOfSequence'; + + // Check we have a number in $value at position ($posnumstart+1).', '.dol_strlen($maskcounter) + // TODO // Check length $len = dol_strlen($maskwithnocode); if (dol_strlen($value) != $len) $result = -1; - // Define $maskLike - /* seems not used - $maskLike = dol_string_nospecial($mask); - $maskLike = str_replace("%","_",$maskLike); - // Replace protected special codes with matching number of _ as wild card caracter - $maskLike = str_replace(dol_string_nospecial('{yyyy}'),'____',$maskLike); - $maskLike = str_replace(dol_string_nospecial('{yy}'),'__',$maskLike); - $maskLike = str_replace(dol_string_nospecial('{y}'),'_',$maskLike); - $maskLike = str_replace(dol_string_nospecial('{mm}'),'__',$maskLike); - $maskLike = str_replace(dol_string_nospecial('{dd}'),'__',$maskLike); - $maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),str_pad("",dol_strlen($maskcounter),"_"),$maskLike); - if ($maskrefclient) $maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),str_pad("",strlen($maskrefclient),"_"),$maskLike); - */ - dol_syslog("functions2::check_value result=".$result, LOG_DEBUG); return $result; } diff --git a/htdocs/core/modules/societe/mod_codeclient_elephant.php b/htdocs/core/modules/societe/mod_codeclient_elephant.php index 22ec06c8aa6..c7a2d600ede 100644 --- a/htdocs/core/modules/societe/mod_codeclient_elephant.php +++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php @@ -267,7 +267,8 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode * -2 ErrorCustomerCodeRequired * -3 ErrorCustomerCodeAlreadyUsed * -4 ErrorPrefixRequired - * -5 Other (see this->error) + * -5 NotConfigured - Setup empty so any value may be ok or not + * -6 Other (see this->error) */ public function verif($db, &$code, $soc, $type) { @@ -297,12 +298,11 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode $this->error = 'NotConfigured'; return -5; } - $result = check_value($mask, $code); if (is_string($result)) { $this->error = $result; - return -5; + return -6; } } diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index b467fdbd366..9d94c6847b7 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -180,7 +180,11 @@ if ($object->id > 0) print ''; print ''.$langs->trans("SupplierCode").''; print $object->code_fournisseur; - if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; + $tmpcheck = $object->check_codefournisseur(); + var_dump($tmpcheck); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongSupplierCode").')'; + } print ''; print ''; diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index ecb8a3ce764..047edc8cfe2 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -101,7 +101,10 @@ if ($socid > 0) print ''; print $langs->trans('CustomerCode').''; print $object->code_client; - if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; + $tmpcheck = $object->check_codeclient(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongCustomerCode").')'; + } print ''; } @@ -110,7 +113,10 @@ if ($socid > 0) print ''; print $langs->trans('SupplierCode').''; print $object->code_fournisseur; - if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; + $tmpcheck = $object->check_codefournisseur(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongSupplierCode").')'; + } print ''; } diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index d79a5c1a9e0..ea121acc4c7 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2330,7 +2330,10 @@ else print ''; print $langs->trans('CustomerCode').''; print $object->code_client; - if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; + $tmpcheck = $object->check_codeclient(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongCustomerCode").')'; + } print ''; print ''; } @@ -2341,7 +2344,10 @@ else print ''; print $langs->trans('SupplierCode').''; print $object->code_fournisseur; - if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; + $tmpcheck = $object->check_codefournisseur(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongSupplierCode").')'; + } print ''; print ''; } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index ee91363dba1..35b52243804 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -3018,6 +3018,8 @@ class Societe extends CommonObject * -2 ErrorCustomerCodeRequired * -3 ErrorCustomerCodeAlreadyUsed * -4 ErrorPrefixRequired + * -5 NotConfigured - Setup empty so any value may be ok or not + * -6 Other (see this->error) */ public function check_codeclient() { diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 0ce28356d90..e9514365c0f 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -130,7 +130,10 @@ if ($object->client) print ''; print $langs->trans('CustomerCode').''; print $object->code_client; - if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; + $tmpcheck = $object->check_codeclient(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongCustomerCode").')'; + } print ''; $sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."facture where fk_soc = ".$socid; $resql = $db->query($sql); @@ -153,7 +156,10 @@ if ($object->fournisseur) print ''; print $langs->trans('SupplierCode').''; print $object->code_fournisseur; - if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; + $tmpcheck = $object->check_codefournisseur(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongSupplierCode").')'; + } print ''; $sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."commande_fournisseur where fk_soc = ".$socid; $resql = $db->query($sql); diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index d082ae6baa5..05c6cbd2378 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -136,7 +136,10 @@ if ($object->id) print ''; print $langs->trans('CustomerCode').''; print $object->code_client; - if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; + $tmpcheck = $object->check_codeclient(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongCustomerCode").')'; + } print ''; } @@ -145,7 +148,10 @@ if ($object->id) print ''; print $langs->trans('SupplierCode').''; print $object->code_fournisseur; - if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; + $tmpcheck = $object->check_codefournisseur(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongSupplierCode").')'; + } print ''; } diff --git a/htdocs/societe/note.php b/htdocs/societe/note.php index 2e3e3ec4532..63f9ab3b1c6 100644 --- a/htdocs/societe/note.php +++ b/htdocs/societe/note.php @@ -99,7 +99,10 @@ if ($object->id > 0) print ''; print $langs->trans('CustomerCode').''; print $object->code_client; - if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; + $tmpcheck = $object->check_codeclient(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongCustomerCode").')'; + } print ''; } @@ -108,7 +111,10 @@ if ($object->id > 0) print ''; print $langs->trans('SupplierCode').''; print $object->code_fournisseur; - if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; + $tmpcheck = $object->check_codefournisseur(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongSupplierCode").')'; + } print ''; } diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index 191f9c4bb2c..52969ef4008 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -174,7 +174,10 @@ if ($result > 0) print ''; print $langs->trans('CustomerCode').''; print $object->code_client; - if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; + $tmpcheck = $object->check_codeclient(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongCustomerCode").')'; + } print ''; } @@ -183,7 +186,10 @@ if ($result > 0) print ''; print $langs->trans('SupplierCode').''; print $object->code_fournisseur; - if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; + $tmpcheck = $object->check_codefournisseur(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongSupplierCode").')'; + } print ''; } diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 5894c3245a9..a215b254a55 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -847,7 +847,10 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print ''; print $langs->trans('CustomerCode').''; print $object->code_client; - if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; + $tmpcheck = $object->check_codeclient(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongCustomerCode").')'; + } print ''; $sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."facture where fk_soc = ".$socid; $resql = $db->query($sql); @@ -899,7 +902,10 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print ''; print $langs->trans('SupplierCode').''; print $object->code_fournisseur; - if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; + $tmpcheck = $object->check_codefournisseur(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongSupplierCode").')'; + } print ''; $sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."facture where fk_soc = ".$socid; $resql = $db->query($sql); diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index df8e966d0ce..7571ae314ef 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -212,8 +212,10 @@ if ($object->client) { print ''; print $langs->trans('CustomerCode').''; print $object->code_client; - if ($object->check_codeclient() != 0) + $tmpcheck = $object->check_codeclient(); + if ($tmpcheck != 0 && $tmpcheck != -5) { print ' ('.$langs->trans("WrongCustomerCode").')'; + } print ''; } @@ -221,8 +223,10 @@ if ($object->fournisseur) { print ''; print $langs->trans('SupplierCode').''; print $object->code_fournisseur; - if ($object->check_codefournisseur() != 0) + $tmpcheck = $object->check_codefournisseur(); + if ($tmpcheck != 0 && $tmpcheck != -5) { print ' ('.$langs->trans("WrongSupplierCode").')'; + } print ''; } diff --git a/htdocs/societe/project.php b/htdocs/societe/project.php index 1c2604e0e44..94b453e87d9 100644 --- a/htdocs/societe/project.php +++ b/htdocs/societe/project.php @@ -99,7 +99,10 @@ if ($socid) print ''; print $langs->trans('CustomerCode').''; print $object->code_client; - if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; + $tmpcheck = $object->check_codeclient(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongCustomerCode").')'; + } print ''; } @@ -108,7 +111,10 @@ if ($socid) print ''; print $langs->trans('SupplierCode').''; print $object->code_fournisseur; - if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; + $tmpcheck = $object->check_codefournisseur(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongSupplierCode").')'; + } print ''; } diff --git a/htdocs/societe/societecontact.php b/htdocs/societe/societecontact.php index 5ff86ff0064..fdba8d6a461 100644 --- a/htdocs/societe/societecontact.php +++ b/htdocs/societe/societecontact.php @@ -193,7 +193,10 @@ if ($id > 0 || !empty($ref)) print ''; print $langs->trans('CustomerCode').''; print $object->code_client; - if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; + $tmpcheck = $object->check_codeclient(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongCustomerCode").')'; + } print ''; } @@ -202,7 +205,10 @@ if ($id > 0 || !empty($ref)) print ''; print $langs->trans('SupplierCode').''; print $object->code_fournisseur; - if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; + $tmpcheck = $object->check_codefournisseur(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongSupplierCode").')'; + } print ''; } print ''; diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index e7ebae374e2..109e65c5b04 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -213,8 +213,10 @@ if ($object->client) { print ''; print $langs->trans('CustomerCode').''; print $object->code_client; - if ($object->check_codeclient() != 0) + $tmpcheck = $object->check_codeclient(); + if ($tmpcheck != 0 && $tmpcheck != -5) { print ' ('.$langs->trans("WrongCustomerCode").')'; + } print ''; } @@ -222,8 +224,10 @@ if ($object->fournisseur) { print ''; print $langs->trans('SupplierCode').''; print $object->code_fournisseur; - if ($object->check_codefournisseur() != 0) + $tmpcheck = $object->check_codefournisseur(); + if ($tmpcheck != 0 && $tmpcheck != -5) { print ' ('.$langs->trans("WrongSupplierCode").')'; + } print ''; } diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 40beb75b5e9..8e3b73346b7 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -441,10 +441,10 @@ if ($socid && !$projectid && !$project_ref && $user->rights->societe->lire) { print ''; print $langs->trans('CustomerCode').''; print $socstat->code_client; - if ($socstat->check_codeclient() != 0) { - print ' ('.$langs->trans("WrongCustomerCode").')'; + $tmpcheck = $socstat->check_codeclient(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongCustomerCode").')'; } - print ''; print ''; } @@ -453,10 +453,10 @@ if ($socid && !$projectid && !$project_ref && $user->rights->societe->lire) { print ''; print $langs->trans('SupplierCode').''; print $socstat->code_fournisseur; - if ($socstat->check_codefournisseur() != 0) { + $tmpcheck = $socstat->check_codefournisseur(); + if ($tmpcheck != 0 && $tmpcheck != -5) { print ' ('.$langs->trans("WrongSupplierCode").')'; } - print ''; print ''; } From 33f8c53ccabccfb0b549c22e3102cc7e93d97653 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Dec 2020 14:03:10 +0100 Subject: [PATCH 02/15] Fix var_dump --- htdocs/fourn/card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 9d94c6847b7..8b07fea2204 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -181,7 +181,6 @@ if ($object->id > 0) print ''.$langs->trans("SupplierCode").''; print $object->code_fournisseur; $tmpcheck = $object->check_codefournisseur(); - var_dump($tmpcheck); if ($tmpcheck != 0 && $tmpcheck != -5) { print ' ('.$langs->trans("WrongSupplierCode").')'; } From 42c4b65f168454013fe9688d260899f9dbbde1e6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Dec 2020 14:34:31 +0100 Subject: [PATCH 03/15] Fix travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index bda2a9e9634..af37fe08a8d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -268,7 +268,7 @@ script: # Ensure we catch errors set -e #parallel-lint --exclude htdocs/includes --blame . - parallel-lint --exclude dev/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \ + 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 \ From 7fae5ea800403bec1f108ebe2934b60175bbbfb8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Dec 2020 18:21:34 +0100 Subject: [PATCH 04/15] Code clean --- htdocs/contrat/list.php | 36 ++++++++++++++++++------ htdocs/core/class/commonobject.class.php | 3 +- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index bd5b39f717b..ca8ccb9bd7d 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -208,7 +208,7 @@ $contracttmp = new Contrat($db); $sql = 'SELECT'; $sql .= " c.rowid, c.ref, c.datec as date_creation, c.tms as date_update, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public,"; -$sql .= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client,'; +$sql .= ' s.rowid as socid, s.nom as name, s.name_alias, s.email, s.town, s.zip, s.fk_pays as country_id, s.client, s.code_client, s.status as company_status, s.logo as company_logo,'; $sql .= " typent.code as typent_code,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; $sql .= " MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") as lower_planned_end_date,"; @@ -263,7 +263,7 @@ $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql .= " GROUP BY c.rowid, c.ref, c.datec, c.tms, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public,"; -$sql .= ' s.rowid, s.nom, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client,'; +$sql .= ' s.rowid, s.nom, s.name_alias, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client, s.status, s.logo,'; $sql .= " typent.code,"; $sql .= " state.code_departement, state.nom"; // Add fields from extrafields @@ -341,7 +341,7 @@ if ($socid > 0) $param = ''; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); -if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; +if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); if ($sall != '') $param .= '&sall='.urlencode($sall); if ($search_contract != '') $param .= '&search_contract='.urlencode($search_contract); if ($search_name != '') $param .= '&search_name='.urlencode($search_name); @@ -596,6 +596,10 @@ if (!empty($arrayfields['status']['checked'])) { print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; +$totalarray = array(); +$typenArray = array(); +$cacheCountryIDCode = array(); + while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); @@ -608,6 +612,24 @@ while ($i < min($num, $limit)) if ($obj->socid > 0) { $result = $socstatic->fetch($obj->socid); } + /*$socstatic->id = $obj->socid; + $socstatic->name = $obj->name; + $socstatic->name_alias = $obj->name_alias; + $socstatic->email = $obj->email; + $socstatic->status = $obj->company_status; + $socstatic->logo = $obj->logo; + $socstatic->country_id = $obj->country_id; + $socstatic->country_code = ''; + $socstatic->country_label = '';*/ + if ($obj->country_id > 0) { + if (!isset($cacheCountryIDCode[$obj->country_id]['code'])) { + $tmparray = getCountry($obj->country_id, 'all'); + $cacheCountryIDCode[$obj->country_id] = array('code'=> empty($tmparray['code']) ? '' : $tmparray['code'], 'label' => empty($tmparray['label']) ? '' : $tmparray['label']); + } + $socstatic->country_code = $cacheCountryIDCode[$obj->country_id]['code']; + $socstatic->country_label = $cacheCountryIDCode[$obj->country_id]['label']; + } + print ''; @@ -643,9 +665,8 @@ while ($i < min($num, $limit)) if (!empty($arrayfields['s.nom']['checked'])) { print ''; - //print ''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.''; - if ($obj->socid > 0) - { + if ($obj->socid > 0) { + // TODO Use a cache for this string print $socstatic->getNomUrl(1, ''); } print ''; @@ -680,8 +701,7 @@ while ($i < min($num, $limit)) if (!empty($arrayfields['country.code_iso']['checked'])) { print ''; - $tmparray = getCountry($obj->fk_pays, 'all'); - print $tmparray['label']; + print $socstatic->country_label; print ''; if (!$i) $totalarray['nbfield']++; } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 760b9632cb6..bfdea016ea6 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3292,7 +3292,7 @@ abstract class CommonObject /** * Fetch array of objects linked to current object (object of enabled modules only). Links are loaded into - * this->linkedObjectsIds array and + * this->linkedObjectsIds array + * this->linkedObjects array if $loadalsoobjects = 1 * Possible usage for parameters: * - all parameters empty -> we look all link to current object (current object can be source or target) @@ -3405,6 +3405,7 @@ abstract class CommonObject { // Parse element/subelement (ex: project_task, cabinetmed_consultation, ...) $module = $element = $subelement = $objecttype; + $regs = array(); if ($objecttype != 'supplier_proposal' && $objecttype != 'order_supplier' && $objecttype != 'invoice_supplier' && preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) { From 0a1387e673a1fad738923bb975c6d6593c85baca Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Dec 2020 18:41:54 +0100 Subject: [PATCH 05/15] Debug v13 --- htdocs/core/lib/functions.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 00fa4b8f0b7..713da28996e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4230,7 +4230,7 @@ function print_liste_field_titre($name, $file = "", $field = "", $begin = "", $m /** * Get title line of an array * - * @param string $name Translation key of field + * @param string $name Translation key of field to show or complete HTML string to show * @param int $thead 0=To use with standard table format, 1=To use inside , 2=To use with
* @param string $file Url used when we click on sort picto * @param string $field Field to use for new sorting. Empty if this field is not sortable. Example "t.abc" or "t.abc,t.def" @@ -4277,7 +4277,7 @@ function getTitleFieldOfList($name, $thead = 0, $file = "", $field = "", $begin } $out .= '<'.$tag.' class="'.$prefix.$liste_titre.'" '.$moreattrib; //$out .= (($field && empty($conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE) && preg_match('/^[a-zA-Z_0-9\s\.\-:&;]*$/', $name)) ? ' title="'.dol_escape_htmltag($langs->trans($name)).'"' : ''); - $out .= ($name && empty($conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE)) ? ' title="'.dol_escape_htmltag($langs->trans($name)).'"' : ''; + $out .= ($name && empty($conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE) && empty($forcenowrapcolumntitle) && !dol_textishtml($name)) ? ' title="'.dol_escape_htmltag($langs->trans($name)).'"' : ''; $out .= '>'; if (empty($thead) && $field && empty($disablesortlink)) // If this is a sort field From d3bd709ad6fe1e559526633f92d8104e13443357 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Dec 2020 18:51:17 +0100 Subject: [PATCH 06/15] Fix phpcs --- dev/setup/codesniffer/ruleset.xml | 2 +- htdocs/admin/sms.php | 1 - htdocs/install/fileconf.php | 14 +++++++------- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index bf283993628..db4945a654c 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -6,7 +6,7 @@ build/html build/aps - dev/namespacemig + dev/tools/test/namespacemig dev/initdata/dbf/includes documents htdocs/core/class/lessc.class.php diff --git a/htdocs/admin/sms.php b/htdocs/admin/sms.php index 9b333d7b4f1..d2cf26a0c9a 100644 --- a/htdocs/admin/sms.php +++ b/htdocs/admin/sms.php @@ -161,7 +161,6 @@ if (!count($listofmethods)) { } if ($action == 'edit') { - print '
'; print ''; print ''; diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php index 713f3132eaf..eccc22de899 100644 --- a/htdocs/install/fileconf.php +++ b/htdocs/install/fileconf.php @@ -408,13 +408,13 @@ if (!empty($force_install_noedit)) { id="db_pass" autocomplete="off" name="db_pass" value="" + // If $force_install_databasepass is on, we don't want to set password, we just show '***'. Real value will be extracted from the forced install file at step1. + $autofill = ((!empty($_SESSION['dol_save_pass'])) ? $_SESSION['dol_save_pass'] : str_pad('', strlen($force_install_databasepass), '*')); + if (!empty($dolibarr_main_prod)) { + $autofill = ''; + } + print dol_escape_htmltag($autofill); + ?>" > From 5dc6f5b89f670d7b6f4e15987f09563befdc3fd0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Dec 2020 01:33:06 +0100 Subject: [PATCH 07/15] Prepare 13.0 --- htdocs/core/boxes/box_scheduled_jobs.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/boxes/box_scheduled_jobs.php b/htdocs/core/boxes/box_scheduled_jobs.php index 23d520e9a8a..d981432b4d2 100644 --- a/htdocs/core/boxes/box_scheduled_jobs.php +++ b/htdocs/core/boxes/box_scheduled_jobs.php @@ -117,7 +117,7 @@ class box_scheduled_jobs extends ModeleBoxes $cronstatic->getNomUrl(1), $cronstatic->datelastrun, $cronstatic->status, - $cronstatic->getLibStatut(2) + $cronstatic->getLibStatut(3) ); $line++; } @@ -135,18 +135,18 @@ class box_scheduled_jobs extends ModeleBoxes $cronstatic->getNomUrl(1), $cronstatic->datenextrun, $cronstatic->status, - $cronstatic->getLibStatut(2) + $cronstatic->getLibStatut(3) ); } foreach ($resultarray as $line => $value) { $this->info_box_contents[$line][] = array( - 'td' => 'class="left"', + 'td' => 'class="tdoverflowmax100"', 'text' => $resultarray[$line][0] ); $this->info_box_contents[$line][] = array( - 'td' => 'class="left"', + 'td' => 'class="nowraponall"', 'textnoformat' => $resultarray[$line][1] ); $this->info_box_contents[$line][] = array( @@ -160,12 +160,12 @@ class box_scheduled_jobs extends ModeleBoxes $line++; } $this->info_box_contents[$line][] = array( - 'td' => 'class="left" colspan="2"', + 'td' => 'class="tdoverflowmax200" colspan="2"', 'text' => $langs->trans("NumberScheduledJobError") ); $this->info_box_contents[$line][] = array( 'td' => 'class="right" colspan="2"', - 'textnoformat' => ($nbjobsinerror ? ''.$nbjobsinerror.''.img_error() : ''.$langs->trans("None").'') + 'textnoformat' => ($nbjobsinerror ? ''.$nbjobsinerror.img_error() : ''.$langs->trans("None").'') ); } else { $this->info_box_contents[0][0] = array( From 67de45b8d725ede8e90c869f787bea2291a8642c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Dec 2020 01:40:15 +0100 Subject: [PATCH 08/15] Fix responsive --- htdocs/admin/system/database.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/admin/system/database.php b/htdocs/admin/system/database.php index 8681efa08ef..3b712b489f5 100644 --- a/htdocs/admin/system/database.php +++ b/htdocs/admin/system/database.php @@ -45,15 +45,15 @@ print load_fiche_titre($langs->trans("InfoDatabase"), '', 'title_setup'); print '
'; print ''; print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; print '
'.$langs->trans("Database").'
'.$langs->trans("Version").''.$db::LABEL.' '.$db->getVersion().'
'.$langs->trans("DatabaseServer").''.$conf->db->host.'
'.$langs->trans("DatabasePort").''.(empty($conf->db->port) ? $langs->trans("Default") : $conf->db->port).'
'.$langs->trans("DatabaseName").''.$conf->db->name.'
'.$langs->trans("DriverType").''.$conf->db->type.($db->getDriverInfo() ? ' ('.$db->getDriverInfo().')' : '').'
'.$langs->trans("User").''.$conf->db->user.'
'.$langs->trans("Password").''.preg_replace('/./i', '*', $dolibarr_main_db_pass).'
'.$langs->trans("DBStoringCharset").''.$db->getDefaultCharacterSetDatabase().'
'.$langs->trans("DBSortingCharset").''.$db->getDefaultCollationDatabase().'
'.$langs->trans("Version").''.$db::LABEL.' '.$db->getVersion().'
'.$langs->trans("DatabaseServer").''.$conf->db->host.'
'.$langs->trans("DatabasePort").''.(empty($conf->db->port) ? $langs->trans("Default") : $conf->db->port).'
'.$langs->trans("DatabaseName").''.$conf->db->name.'
'.$langs->trans("DriverType").''.$conf->db->type.($db->getDriverInfo() ? ' ('.$db->getDriverInfo().')' : '').'
'.$langs->trans("User").''.$conf->db->user.'
'.$langs->trans("Password").''.preg_replace('/./i', '*', $dolibarr_main_db_pass).'
'.$langs->trans("DBStoringCharset").''.$db->getDefaultCharacterSetDatabase().'
'.$langs->trans("DBSortingCharset").''.$db->getDefaultCollationDatabase().'
'; print '
'; @@ -62,7 +62,7 @@ print '
'; print '
'; print ''; print ''."\n"; -print ''."\n"; +print ''."\n"; print '
'.$langs->trans("Tables").'
'.$langs->trans("List").'
'.$langs->trans("List").'
'; print '
'; @@ -104,7 +104,7 @@ if (!count($listofvars) && !count($listofstatus)) print ''; print $param; print ''; - print ''; + print ''; $show = 0; $text = ''; foreach ($arraytest as $key => $val) { From f8ff8c63b6f3df6ef1989f5b5f5743778da86487 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Dec 2020 01:50:16 +0100 Subject: [PATCH 09/15] Update init demo --- dev/initdemo/README | 5 +++++ dev/initdemo/initdemopassword.sh | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/dev/initdemo/README b/dev/initdemo/README index 89e21b9337a..5e0f610d82e 100644 --- a/dev/initdemo/README +++ b/dev/initdemo/README @@ -12,6 +12,11 @@ The script initdemo.sh will erase current database with data into mysqldump_doli Do a chmod 700 initdemo.sh then run ./initdemo.sh to launch Graphic User Interface. +After loading the demo files, admin login may be: +- admin / admin +or +- admin / adminadmin + *** Save demo diff --git a/dev/initdemo/initdemopassword.sh b/dev/initdemo/initdemopassword.sh index d5aa9c1ef0e..84d50f0dcc3 100755 --- a/dev/initdemo/initdemopassword.sh +++ b/dev/initdemo/initdemopassword.sh @@ -53,7 +53,7 @@ then DIALOG="$DIALOG --ascii-lines" fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$ trap "rm -f $fichtemp" 0 1 2 5 15 - $DIALOG --title "Init Dolibarr with demo values" --clear \ + $DIALOG --title "Reset login password" --clear \ --inputbox "Mysql database name :" 16 55 dolibarrdemo 2> $fichtemp valret=$? case $valret in @@ -70,7 +70,7 @@ then DIALOG=${DIALOG=dialog} fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$ trap "rm -f $fichtemp" 0 1 2 5 15 - $DIALOG --title "Init Dolibarr with demo values" --clear \ + $DIALOG --title "Reset login password" --clear \ --inputbox "Mysql port (ex: 3306):" 16 55 3306 2> $fichtemp valret=$? @@ -128,7 +128,7 @@ then # ---------------------------- confirmation DIALOG=${DIALOG=dialog} - $DIALOG --title "Init demo login with demo values" --clear \ + $DIALOG --title "Reset login password" --clear \ --yesno "Do you confirm ? \n Mysql database : '$base' \n Mysql port : '$port' \n Demo login: '$demologin' \n Demo password : '$demopass'" 15 55 case $? in From 0a19f3cf5bfa63f51a3f6ee575ea66426f1dd6dd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Dec 2020 02:27:05 +0100 Subject: [PATCH 10/15] css --- htdocs/core/boxes/box_scheduled_jobs.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/boxes/box_scheduled_jobs.php b/htdocs/core/boxes/box_scheduled_jobs.php index d981432b4d2..0fc63126ec9 100644 --- a/htdocs/core/boxes/box_scheduled_jobs.php +++ b/htdocs/core/boxes/box_scheduled_jobs.php @@ -141,7 +141,7 @@ class box_scheduled_jobs extends ModeleBoxes foreach ($resultarray as $line => $value) { $this->info_box_contents[$line][] = array( - 'td' => 'class="tdoverflowmax100"', + 'td' => 'class="tdoverflowmax200"', 'text' => $resultarray[$line][0] ); @@ -154,18 +154,18 @@ class box_scheduled_jobs extends ModeleBoxes 'textnoformat' => (empty($resultarray[$line][2]) ? '' : $form->textwithpicto(dol_print_date($resultarray[$line][2], "dayhoursec"), $langs->trans("CurrentTimeZone"))) ); $this->info_box_contents[$line][] = array( - 'td' => 'class="right" ', + 'td' => 'class="center" ', 'textnoformat' => $resultarray[$line][4] ); $line++; } $this->info_box_contents[$line][] = array( - 'td' => 'class="tdoverflowmax200" colspan="2"', + 'td' => 'class="tdoverflowmax300" colspan="3"', 'text' => $langs->trans("NumberScheduledJobError") ); $this->info_box_contents[$line][] = array( - 'td' => 'class="right" colspan="2"', - 'textnoformat' => ($nbjobsinerror ? ''.$nbjobsinerror.img_error() : ''.$langs->trans("None").'') + 'td' => 'class="center"', + 'textnoformat' => (!$nbjobsinerror ? ''.$nbjobsinerror.img_error() : '
0
') ); } else { $this->info_box_contents[0][0] = array( From 6937ab75fa5b696530f73009774cb9e6a2c0fe6b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Dec 2020 02:31:19 +0100 Subject: [PATCH 11/15] Fix test --- htdocs/core/boxes/box_scheduled_jobs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_scheduled_jobs.php b/htdocs/core/boxes/box_scheduled_jobs.php index 0fc63126ec9..01dd86a999d 100644 --- a/htdocs/core/boxes/box_scheduled_jobs.php +++ b/htdocs/core/boxes/box_scheduled_jobs.php @@ -165,7 +165,7 @@ class box_scheduled_jobs extends ModeleBoxes ); $this->info_box_contents[$line][] = array( 'td' => 'class="center"', - 'textnoformat' => (!$nbjobsinerror ? ''.$nbjobsinerror.img_error() : '
0
') + 'textnoformat' => ($nbjobsinerror ? ''.$nbjobsinerror.img_error() : '
0
') ); } else { $this->info_box_contents[0][0] = array( From 0195c11437293088131a9e475a760b06ede8ba22 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Dec 2020 12:58:03 +0100 Subject: [PATCH 12/15] Add missing field required for real funnel of prospection. --- htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 3 +++ htdocs/install/mysql/tables/llx_projet.sql | 1 + 2 files changed, 4 insertions(+) diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index e391787479d..309d4d4b170 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -552,3 +552,6 @@ INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES -- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_scheduled_jobs.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_scheduled_jobs.php' AND entity = 1); ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging varchar(64); + +ALTER TABLE llx_projet ADD COLUMN fk_opp_status_end integer DEFAULT NULL; + diff --git a/htdocs/install/mysql/tables/llx_projet.sql b/htdocs/install/mysql/tables/llx_projet.sql index a36adb3a672..1b95444b3a1 100644 --- a/htdocs/install/mysql/tables/llx_projet.sql +++ b/htdocs/install/mysql/tables/llx_projet.sql @@ -35,6 +35,7 @@ create table llx_projet fk_statut integer DEFAULT 0 NOT NULL, -- open or close fk_opp_status integer DEFAULT NULL, -- if project is used to manage opportunities opp_percent double(5,2), + fk_opp_status_end integer DEFAULT NULL, -- if project is used to manage opportunities (the opportunity status the project has when set to lose) date_close datetime DEFAULT NULL, fk_user_close integer DEFAULT NULL, note_private text, From 7d0e71165a47f4748d4b70cd30975b71f4f42126 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Dec 2020 14:40:27 +0100 Subject: [PATCH 13/15] Clean code --- htdocs/core/class/dolgraph.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 4495c5ae50d..5fcc7b00c91 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -891,7 +891,6 @@ class DolGraph $color1 = sprintf("%02x%02x%02x", $this->bgcolorgrid[0], $this->bgcolorgrid[0], $this->bgcolorgrid[2]); $color2 = sprintf("%02x%02x%02x", $this->bgcolorgrid[0], $this->bgcolorgrid[1], $this->bgcolorgrid[2]); $this->stringtoshow .= ', grid: { hoverable: true, backgroundColor: { colors: ["#' . $color1 . '", "#' . $color2 . '"] }, borderWidth: 1, borderColor: \'#e6e6e6\', tickColor : \'#e6e6e6\' }' . "\n"; - //$this->stringtoshow.=', shadowSize: 20'."\n"; TODO Uncommet this $this->stringtoshow .= '});' . "\n"; $this->stringtoshow .= '}' . "\n"; } From d05f9c42f5317df9a44b6c83896df8ecba09c526 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Dec 2020 14:43:23 +0100 Subject: [PATCH 14/15] Fix bad dir --- htdocs/salaries/list.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 26477900be2..3e2694cf445 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -154,9 +154,7 @@ if (empty($reshook)) // Mass actions $objectclass = 'PaymentSalary'; $objectlabel = 'SalariesPayments'; - $permissiontoread = $user->rights->salaries->read; - $permissiontodelete = $user->rights->salaries->delete; - $uploaddir = $conf->bom->dir_output; + $uploaddir = $conf->salaries->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; // Validate records From eebdd0bd7a13e160de4de89015a220b8ba400b96 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Dec 2020 14:54:20 +0100 Subject: [PATCH 15/15] Fix missing date value --- htdocs/salaries/list.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 3e2694cf445..b8a0ba69ef7 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -306,7 +306,7 @@ print ''; -// Date +// Date payment print ''; print '
'; print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); @@ -315,6 +315,9 @@ print '
'; print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); print '
'; print ''; +// Date value +print ''; +print ''; // Type print ''; $form->select_types_paiements($search_type_id, 'search_type_id', '', 0, 1, 1, 16); @@ -350,7 +353,8 @@ print ''; print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "s.rowid", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Employee", $_SERVER["PHP_SELF"], "u.rowid", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "s.label", "", $param, 'class="left"', $sortfield, $sortorder); -print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "s.datep,s.rowid", "", $param, 'align="center"', $sortfield, $sortorder); +print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "s.datep,s.rowid", "", $param, '', $sortfield, $sortorder, 'center '); +print_liste_field_titre("DateValue", $_SERVER["PHP_SELF"], "s.datev,s.rowid", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, 'class="left"', $sortfield, $sortorder); if (!empty($conf->banque->enabled)) print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "s.amount", "", $param, 'class="right"', $sortfield, $sortorder); @@ -419,6 +423,10 @@ while ($i < ($limit ? min($num, $limit) : $num)) print ''.dol_print_date($db->jdate($obj->datep), 'day')."\n"; if (!$i) $totalarray['nbfield']++; + // Date value + print ''.dol_print_date($db->jdate($obj->datev), 'day')."\n"; + if (!$i) $totalarray['nbfield']++; + // Type print ''.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.''; if (!$i) $totalarray['nbfield']++;