From 15a765a79a04c0e375dc381972731bf9fb2409b2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Aug 2019 13:28:24 +0200 Subject: [PATCH 1/6] Fix responsive --- htdocs/user/home.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/user/home.php b/htdocs/user/home.php index 9a7d0ab94fd..711eb94500c 100644 --- a/htdocs/user/home.php +++ b/htdocs/user/home.php @@ -124,8 +124,9 @@ if ($resql) { $num = $db->num_rows($resql); print ''; - print ''; + print ''; print ''; + print ''; print ''; $i = 0; @@ -194,7 +195,7 @@ if ($resql) print ($entitystring?' ('.$entitystring.')':''); print ''; - print ''; + print ''; print ''; From def0311f9da7f0df2b082cd58a92b6143b269d2e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Aug 2019 17:26:13 +0200 Subject: [PATCH 2/6] Fix translation --- htdocs/compta/facture/card.php | 4 ++-- htdocs/compta/facture/fiche-rec.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index d19e925843e..203d2f22a78 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3237,8 +3237,8 @@ if ($action == 'create') '__INVOICE_PREVIOUS_MONTH_TEXT__' => $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%B').')', '__INVOICE_MONTH_TEXT__' => $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%B').')', '__INVOICE_NEXT_MONTH_TEXT__' => $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B').')', - '__INVOICE_PREVIOUS_YEAR__' => $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'), '%Y').')', - '__INVOICE_YEAR__' => $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%Y').')', + '__INVOICE_PREVIOUS_YEAR__' => $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'), '%Y').')', + '__INVOICE_YEAR__' => $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%Y').')', '__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'), '%Y').')' ); diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 9b50e782454..3544aaa1049 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -1015,8 +1015,8 @@ if ($action == 'create') $substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%B').')'; $substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date, '%B').')'; $substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%B').')'; - $substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'y'), '%Y').')'; - $substitutionarray['__INVOICE_YEAR__'] = $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date, '%Y').')'; + $substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'y'), '%Y').')'; + $substitutionarray['__INVOICE_YEAR__'] = $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date, '%Y').')'; $substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'y'), '%Y').')'; // Only on template invoices $substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen").' ('.$langs->trans("Example").': '.dol_print_date($object->date_when, 'dayhour').')'; @@ -1357,8 +1357,8 @@ else $substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%B').')'; $substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%B').')'; $substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B').')'; - $substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'), '%Y').')'; - $substitutionarray['__INVOICE_YEAR__'] = $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%Y').')'; + $substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'), '%Y').')'; + $substitutionarray['__INVOICE_YEAR__'] = $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%Y').')'; $substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'), '%Y').')'; // Only on template invoices $substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen").' ('.$langs->trans("Example").': '.dol_print_date(($object->date_when?$object->date_when:dol_now()), 'dayhour').')'; From f98d3c5c48d6ee8d3d7eb42d1804df659599a22a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Aug 2019 14:08:30 +0200 Subject: [PATCH 3/6] FIX Do not show tooltip if tooltip is empty --- htdocs/modulebuilder/template/admin/setup.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index fea88479abf..fd3ff41c799 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -103,7 +103,8 @@ if ($action == 'edit') foreach($arrayofparameters as $key => $val) { print ''; } print '
'.$langs->trans("LastUsersCreated", min($num, $max)).'
'.$langs->trans("LastUsersCreated", min($num, $max)).''.$langs->trans("FullList").'
'.dol_print_date($db->jdate($obj->datec), 'dayhour').''.dol_print_date($db->jdate($obj->datec), 'dayhour').''; print $fuserstatic->getLibStatut(3); print '
'; - print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip')); + $tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : ''); + print $form->textwithpicto($langs->trans($key), $tooltiphelp); print '
'; @@ -125,7 +126,8 @@ else foreach($arrayofparameters as $key => $val) { print ''; - print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip')); + $tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : ''); + print $form->textwithpicto($langs->trans($key), $tooltiphelp); print '' . $conf->global->$key . ''; } From e75d7e46863bd5e787243405fb61159350abfeea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Aug 2019 14:51:18 +0200 Subject: [PATCH 4/6] Fix test on uploaded modules --- htdocs/admin/modules.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 5fd40fb032a..65d7ea6d216 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -130,13 +130,13 @@ if ($action=='install') } else { - if (! preg_match('/\.zip$/i', $original_file)) + if (! $error && ! preg_match('/\.zip$/i', $original_file)) { $langs->load("errors"); setEventMessages($langs->trans("ErrorFileMustBeADolibarrPackage", $original_file), null, 'errors'); $error++; } - if (! preg_match('/module_.*\-[\d]+\.[\d]+.*$/i', $original_file)) + if (! $error && ! preg_match('/^(module[a-zA-Z0-9]*|theme)_.*\-([0-9][0-9\.]*)\.zip$/i', $original_file)) { $langs->load("errors"); setEventMessages($langs->trans("ErrorFilenameDosNotMatchDolibarrPackageRules", $original_file, 'module_*-x.y*.zip'), null, 'errors'); @@ -180,13 +180,13 @@ if ($action=='install') { // Now we move the dir of the module $modulename=preg_replace('/module_/', '', $original_file); - $modulename=preg_replace('/\-[\d]+\.[\d]+.*$/', '', $modulename); + $modulename=preg_replace('/\-([0-9][0-9\.]*)\.zip$/i', '', $modulename); // Search dir $modulename - $modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename; + $modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename; // Example .../mymodule //var_dump($modulenamedir); if (! dol_is_dir($modulenamedir)) { - $modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename; + $modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename; // Example .../htdocs/mymodule //var_dump($modulenamedir); if (! dol_is_dir($modulenamedir)) { @@ -195,10 +195,17 @@ if ($action=='install') } } + if (! $error) + { + // TODO Make more test + + } + + // Now we install the module if (! $error) { //var_dump($dirins); - @dol_delete_dir_recursive($dirins.'/'.$modulename); + @dol_delete_dir_recursive($dirins.'/'.$modulename); // delete the zip file dol_syslog("Uncompress of module file is a success. We copy it from ".$modulenamedir." into target dir ".$dirins.'/'.$modulename); $result=dolCopyDir($modulenamedir, $dirins.'/'.$modulename, '0444', 1); if ($result <= 0) From 1b21905c556314a47aafdb01e6e3863145c3a1a5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Aug 2019 14:51:18 +0200 Subject: [PATCH 5/6] Fix test on uploaded modules Conflicts: htdocs/admin/modules.php --- htdocs/admin/modules.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 0397073935d..69e428cddc0 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -130,13 +130,13 @@ if ($action=='install') } else { - if (! preg_match('/\.zip$/i',$original_file)) + if (! $error && ! preg_match('/\.zip$/i', $original_file)) { $langs->load("errors"); setEventMessages($langs->trans("ErrorFileMustBeADolibarrPackage",$original_file), null, 'errors'); $error++; } - if (! preg_match('/module_.*\-[\d]+\.[\d]+.*$/i',$original_file)) + if (! $error && ! preg_match('/^(module[a-zA-Z0-9]*|theme)_.*\-([0-9][0-9\.]*)\.zip$/i', $original_file)) { $langs->load("errors"); setEventMessages($langs->trans("ErrorFilenameDosNotMatchDolibarrPackageRules",$original_file, 'module_*-x.y*.zip'), null, 'errors'); @@ -180,13 +180,13 @@ if ($action=='install') { // Now we move the dir of the module $modulename=preg_replace('/module_/', '', $original_file); - $modulename=preg_replace('/\-[\d]+\.[\d]+.*$/', '', $modulename); + $modulename=preg_replace('/\-([0-9][0-9\.]*)\.zip$/i', '', $modulename); // Search dir $modulename - $modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename; + $modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename; // Example .../mymodule //var_dump($modulenamedir); if (! dol_is_dir($modulenamedir)) { - $modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename; + $modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename; // Example .../htdocs/mymodule //var_dump($modulenamedir); if (! dol_is_dir($modulenamedir)) { @@ -195,10 +195,17 @@ if ($action=='install') } } + if (! $error) + { + // TODO Make more test + + } + + // Now we install the module if (! $error) { //var_dump($dirins); - @dol_delete_dir_recursive($dirins.'/'.$modulename); + @dol_delete_dir_recursive($dirins.'/'.$modulename); // delete the zip file dol_syslog("Uncompress of module file is a success. We copy it from ".$modulenamedir." into target dir ".$dirins.'/'.$modulename); $result=dolCopyDir($modulenamedir, $dirins.'/'.$modulename, '0444', 1); if ($result <= 0) From ed7480ddbb9205210bd7dd747e4df23300da34a6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Aug 2019 16:03:49 +0200 Subject: [PATCH 6/6] Fix phpcs --- htdocs/admin/modules.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 69e428cddc0..2d12c5838f9 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -198,7 +198,6 @@ if ($action=='install') if (! $error) { // TODO Make more test - } // Now we install the module