From 8b1fff202b5b12e61a2ac6e0e40fb9b85da7850c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 26 Feb 2020 20:11:42 +0100 Subject: [PATCH 1/7] FIX option MAIN_OPTIMIZEFORTEXTBROWSER --- htdocs/main.inc.php | 70 ++++++++++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 30 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index fe7ee39f6e8..8e05aa34ab8 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1841,40 +1841,50 @@ function top_menu_user() } else $appli .= " ".DOL_VERSION; - $btnUser = ' - '; + } else { + $btnUser = ' + '; + } if (!defined('JS_JQUERY_DISABLE_DROPDOWN') && !empty($conf->use_javascript_ajax)) // This may be set by some pages that use different jquery version to avoid errors { From 9bc5eb44cab8ea010c9d872e42bd90de182f92de Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 26 Feb 2020 20:25:26 +0100 Subject: [PATCH 2/7] FIX #13182 --- htdocs/compta/tva/document.php | 5 ++--- htdocs/core/class/html.formfile.class.php | 4 +++- htdocs/core/lib/files.lib.php | 5 +++-- htdocs/core/lib/vat.lib.php | 2 +- htdocs/core/tpl/document_actions_post_headers.tpl.php | 2 ++ 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/tva/document.php b/htdocs/compta/tva/document.php index 6c1816589f4..2194fa7caab 100644 --- a/htdocs/compta/tva/document.php +++ b/htdocs/compta/tva/document.php @@ -70,8 +70,7 @@ if (! $sortfield) $sortfield="name"; $object = new Tva($db); if ($id > 0) $object->fetch($id); -$upload_dir = $conf->tax->dir_output.'/'.dol_sanitizeFileName($object->ref); -$modulepart='tax'; +$upload_dir = $conf->tax->dir_output.'/vat/'.dol_sanitizeFileName($object->ref); /* @@ -144,7 +143,7 @@ if ($object->id) dol_fiche_end(); - $modulepart = 'tax'; + $modulepart = 'tax-vat'; $permission = $user->rights->tax->charges->creer; $permtoedit = $user->rights->fournisseur->facture->creer; $param = '&id=' . $object->id; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 7a3b48e1c40..347b22400bd 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1099,7 +1099,7 @@ class FormFile if ($disablecrop == -1) { $disablecrop = 1; - if (in_array($modulepart, array('bank', 'bom', 'expensereport', 'holiday', 'member', 'mrp', 'project', 'product', 'produit', 'propal', 'service', 'societe', 'tax', 'ticket', 'user'))) $disablecrop = 0; + if (in_array($modulepart, array('bank', 'bom', 'expensereport', 'holiday', 'member', 'mrp', 'project', 'product', 'produit', 'propal', 'service', 'societe', 'tax', 'tax-vat', 'ticket', 'user'))) $disablecrop = 0; } // Define relative path used to store the file @@ -1121,6 +1121,8 @@ class FormFile $relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $upload_dir); $relativedir = preg_replace('/^[\\/]/', '', $relativedir); } + // For example here $upload_dir = '/pathtodocuments/commande/SO2001-123/' + // For example here $upload_dir = '/pathtodocuments/tax/vat/1' $hookmanager->initHooks(array('formfile')); $parameters = array( diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 0051d28caf3..8406b8ec9d5 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2401,10 +2401,11 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $original_file=(!empty($conf->product->multidir_temp[$entity])?$conf->product->multidir_temp[$entity]:$conf->service->multidir_temp[$entity]).'/'.$original_file; } // Wrapping for taxes - elseif ($modulepart == 'tax' && !empty($conf->tax->dir_output)) + elseif (in_array($modulepart, array('tax', 'tax-vat')) && !empty($conf->tax->dir_output)) { if ($fuser->rights->tax->charges->{$lire}) $accessallowed=1; - $original_file=$conf->tax->dir_output.'/'.$original_file; + $modulepartsuffix = str_replace('tax-', '', $modulepart); + $original_file=$conf->tax->dir_output.'/'.($modulepartsuffix != 'tax' ? $modulepartsuffix.'/' : '').$original_file; } // Wrapping for events elseif ($modulepart == 'actions' && !empty($conf->agenda->dir_output)) diff --git a/htdocs/core/lib/vat.lib.php b/htdocs/core/lib/vat.lib.php index f8c7b579c18..1649e686ec2 100644 --- a/htdocs/core/lib/vat.lib.php +++ b/htdocs/core/lib/vat.lib.php @@ -49,7 +49,7 @@ function vat_prepare_head($object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; - $upload_dir = $conf->tax->dir_output . "/" . dol_sanitizeFileName($object->ref); + $upload_dir = $conf->tax->dir_output . "/vat/" . dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); $nbLinks=Link::count($db, $object->element, $object->id); $head[$tab][0] = DOL_URL_ROOT.'/compta/tva/document.php?id='.$object->id; diff --git a/htdocs/core/tpl/document_actions_post_headers.tpl.php b/htdocs/core/tpl/document_actions_post_headers.tpl.php index 2a3d703d16f..1b5cb242391 100644 --- a/htdocs/core/tpl/document_actions_post_headers.tpl.php +++ b/htdocs/core/tpl/document_actions_post_headers.tpl.php @@ -72,6 +72,7 @@ if ($action == 'delete') $formfile=new FormFile($db); + // We define var to enable the feature to add prefix of uploaded files. // Caller of this include can make // $savingdocmask=dol_sanitizeFileName($object->ref).'-__file__'; @@ -93,6 +94,7 @@ if (!isset($savingdocmask) || !empty($conf->global->MAIN_DISABLE_SUGGEST_REF_AS_ 'project_task', 'expensereport', 'tax', + 'tax-vat', 'produit', 'product_batch', 'bom', From 957295ee2da44b95cc7e52038de9174c8eb488d1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Feb 2020 01:12:53 +0100 Subject: [PATCH 3/7] Fix look and feel v11 --- htdocs/admin/clicktodial.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php index 9149896988d..03c4eeb66cf 100644 --- a/htdocs/admin/clicktodial.php +++ b/htdocs/admin/clicktodial.php @@ -66,7 +66,7 @@ llxHeader('', $langs->trans("ClickToDialSetup"), $wikihelp); $linkback=''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("ClickToDialSetup"), $linkback, 'title_setup'); -print $langs->trans("ClickToDialDesc")."
\n"; +print ''.$langs->trans("ClickToDialDesc")."
\n"; print '
'; print '
'; From eac07aceb0e043449a2a02966d91e2e09e395cfc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Feb 2020 16:00:01 +0100 Subject: [PATCH 4/7] Responsive --- htdocs/core/class/html.formcompany.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index df9d4798c63..10ee91ad50f 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -455,9 +455,10 @@ class FormCompany extends Form * @param int $country_codeid 0=list for all countries, otherwise list only country requested * @param string $filter Add a SQL filter on list * @param string $htmlname HTML name of select + * @param string $morecss More CSS * @return string String with HTML select */ - public function select_juridicalstatus($selected = '', $country_codeid = 0, $filter = '', $htmlname = 'forme_juridique_code') + public function select_juridicalstatus($selected = '', $country_codeid = 0, $filter = '', $htmlname = 'forme_juridique_code', $morecss = '') { // phpcs:enable global $conf, $langs, $user; @@ -479,7 +480,7 @@ class FormCompany extends Form if ($resql) { $out .= '
'; - $out .= ''; if ($country_codeid) $out .= ''; // When country_codeid is set, we force to add an empty line because it does not appears from select. When not set, we already get the empty line from select. $num = $this->db->num_rows($resql); From f0390082821ad1cbd29cfcb0ddcf1379b747c1d8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Feb 2020 16:33:24 +0100 Subject: [PATCH 5/7] Fix reponsive --- htdocs/admin/company.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index df72e1bde04..19cdbabbd48 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -408,7 +408,7 @@ print ''.$langs->trans( // Name -print ''; +print ''; print 'global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'>'."\n"; // Addresse @@ -477,36 +477,36 @@ if (!empty($conf->barcode->enabled)) { // Logo print ''; -print '
'; +print '
'; print ''; -print '
'; +print '
'; if (!empty($mysoc->logo_mini)) { print ''.img_delete($langs->trans("Delete")).''; if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) { - print '   '; + print '
'; print ''; } } else { print ''; } -print '
'; +print '
'; print ''; // Logo (squarred) print ''; -print '
'; +print '
'; print ''; -print '
'; +print '
'; if (!empty($mysoc->logo_squarred_mini)) { print ''.img_delete($langs->trans("Delete")).''; if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) { - print '   '; + print '
'; print ''; } } else { print ''; } -print '
'; +print ''; print ''; // Note From baaa6b797ba1e4fa643e5ea15efdc9a6153f21c5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Feb 2020 17:51:31 +0100 Subject: [PATCH 6/7] FIX SQl syntax error --- htdocs/core/class/discount.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index fe792fabd2d..848999b11c6 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -611,7 +611,7 @@ class DiscountAbsolute $sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount'; $sql .= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture_fourn as f'; $sql .= ' WHERE rc.fk_invoice_supplier_source=f.rowid AND rc.fk_invoice_supplier = '.$invoice->id; - $sql .= ' f.type IN (' . Facture::TYPE_STANDARD . ', ' . Facture::TYPE_CREDIT_NOTE . ')'; // Find discount coming from credit note or excess paid + $sql .= ' AND f.type IN (' . Facture::TYPE_STANDARD . ', ' . Facture::TYPE_CREDIT_NOTE . ')'; // Find discount coming from credit note or excess paid } else { From 51489004a3aaecad02f8fc2434bf27ed37c2bbd4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Feb 2020 18:07:32 +0100 Subject: [PATCH 7/7] Removed travis warnings --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5193b7c2c77..f7b3df2cb76 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ # For syntax, see http://about.travis-ci.org/docs/user/languages/php/ # We use dist: trusty to have php 5.4+ available +os: linux dist: trusty sudo: required @@ -42,7 +43,7 @@ env: global: # Set to true for very verbose output - DEBUG=false - matrix: + jobs: # MariaDB overrides MySQL installation so it's not possible to test both yet #- DB=mysql - DB=mariadb @@ -54,7 +55,7 @@ env: # See https://github.com/DracoBlue/travis-ci-nginx-php-fpm-test #- WS=nginx -matrix: +jobs: fast_finish: true allow_failures: - php: nightly