From 8ea475df642346037db16d019c7ade286c82ed1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 27 Feb 2019 16:11:19 +0100 Subject: [PATCH 1/2] Update establishment.class.php --- htdocs/hrm/class/establishment.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/hrm/class/establishment.class.php b/htdocs/hrm/class/establishment.class.php index 467201940ce..f39a9ee374a 100644 --- a/htdocs/hrm/class/establishment.class.php +++ b/htdocs/hrm/class/establishment.class.php @@ -396,7 +396,7 @@ class Establishment extends CommonObject * Get on record Establishment * * @param int $id Id of record - * @return obj + * @return Object */ function getEstablishment($id) { @@ -457,7 +457,7 @@ class Establishment extends CommonObject */ function getNomUrlParent($id = 0, $withpicto = 0) { - global $langs; + global $langs, $conf; $result=''; From 8e8c68345a54446db864bccc682d675fe34c471e Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Wed, 27 Feb 2019 21:41:55 +0100 Subject: [PATCH 2/2] phpcs simplification --- htdocs/core/class/html.formfile.class.php | 24 ++++++++--------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index c53a5562997..d2c2b6d17a3 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1555,22 +1555,14 @@ class FormFile $id=0; $ref=''; $label=''; // To show ref or specific information according to view to show (defined by $module) - if ($modulepart == 'company') { preg_match('/(\d+)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:''); } - elseif ($modulepart == 'invoice') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); } - elseif ($modulepart == 'invoice_supplier') { preg_match('/([^\/]+)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); if (is_numeric($ref)) { $id=$ref; $ref=''; } } // $ref may be also id with old supplier invoices - elseif ($modulepart == 'propal') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); } - elseif ($modulepart == 'supplier_proposal') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); } - elseif ($modulepart == 'order') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); } - elseif ($modulepart == 'order_supplier') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); } - elseif ($modulepart == 'contract') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); } - elseif ($modulepart == 'product') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); } - elseif ($modulepart == 'tax') { preg_match('/(\d+)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:''); } - elseif ($modulepart == 'project') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:'');} - elseif ($modulepart == 'fichinter') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:'');} - elseif ($modulepart == 'user') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:'');} - elseif ($modulepart == 'expensereport') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:'');} - elseif ($modulepart == 'holiday') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:'');} - + if ($modulepart == 'company' || $modulepart == 'tax') { preg_match('/(\d+)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:''); } + elseif ($modulepart == 'invoice_supplier') { preg_match('/([^\/]+)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); if (is_numeric($ref)) { $id=$ref; $ref=''; } } // $ref may be also id with old supplier invoices + elseif ($modulepart == 'user' || $modulepart == 'holiday') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:''); } + elseif (in_array($modulepart, array('invoice', 'propal', 'supplier_proposal', 'order', 'order_supplier', 'contract', 'product', 'project', 'fichinter', 'expensereport'))) + { + preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); + } + if (! $id && ! $ref) continue; $found=0; if (! empty($this->cache_objects[$modulepart.'_'.$id.'_'.$ref]))