From 48ff89c63bde5c40622fffd3ede37de70743912c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 5 Apr 2018 19:52:54 +0200 Subject: [PATCH] Fix regression --- htdocs/core/class/html.form.class.php | 5 ++++- htdocs/core/lib/functions.lib.php | 8 ++++---- htdocs/core/modules/action/rapport.pdf.php | 6 ++++-- test/phpunit/FunctionsLibTest.php | 9 +++++++-- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 8f9be1356d4..60e0ea24967 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1703,7 +1703,10 @@ class Form $userstatic->fetch($value['id']); $out.= $userstatic->getNomUrl(-1); if ($i == 0) { $ownerid = $value['id']; $out.=' ('.$langs->trans("Owner").')'; } - if ($nbassignetouser > 1 && $action != 'view') $out.=' '; + if ($nbassignetouser > 1 && $action != 'view') + { + $out.=' '; + } // Show my availability if ($showproperties) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 6afb6892679..14f147d7f48 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3059,7 +3059,7 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodo * Example: picto.png@mymodule if picto.png is stored into htdocs/mymodule/img * Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1) * @param string $moreatt Add more attribute on img tag (For example 'style="float: right"') - * @param int $pictoisfullpath If 1, image path is a full path + * @param boolean|int $pictoisfullpath If true or 1, image path is a full path * @param int $srconly Return only content of the src attribute of img. * @param int $notitle 1=Disable tag title. Use it if you add js tooltip, to avoid duplicate tooltip. * @param string $alt Force alt for bind peoplae @@ -3082,13 +3082,13 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ if (! preg_match('/(\.png|\.gif|\.svg)$/i',$picto)) { $picto .= '.png'; } - $fullpathpicto = $url.'/'.$path.'/img/'.$picto; + $fullpathpicto = $picto; } else { $pictowithoutext = preg_replace('/(\.png|\.gif|\.svg)$/', '', $picto); //if (in_array($picto, array('switch_off', 'switch_on', 'off', 'on'))) - if (in_array($pictowithoutext, array('bank', 'delete', 'edit', 'off', 'on', 'play', 'playdisabled', 'printer', 'resize', 'switch_off', 'switch_on', 'unlink', 'uparrow'))) { + if (empty($srconly) && in_array($pictowithoutext, array('bank', 'delete', 'edit', 'off', 'on', 'play', 'playdisabled', 'printer', 'resize', 'switch_off', 'switch_on', 'unlink', 'uparrow'))) { $fakey = $pictowithoutext; $facolor = ''; $fasize = ''; @@ -3151,7 +3151,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ if (preg_match('/class="([^"]+)"/', $moreatt, $reg)) { $morecss.= ($morecss?' ':'').$reg[1]; } - $enabledisablehtml = ''; + $enabledisablehtml = ''; if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $enabledisablehtml.= $titlealt; } diff --git a/htdocs/core/modules/action/rapport.pdf.php b/htdocs/core/modules/action/rapport.pdf.php index c6b652e265e..504164cd431 100644 --- a/htdocs/core/modules/action/rapport.pdf.php +++ b/htdocs/core/modules/action/rapport.pdf.php @@ -179,7 +179,7 @@ class CommActionRapport @chmod($file, octdec($conf->global->MAIN_UMASK)); $this->result = array('fullpath'=>$file); - + return 1; } } @@ -291,7 +291,9 @@ class CommActionRapport if ($code == 'AC_OTH_AUTO') $code='AC_AUTO'; } $pdf->SetXY(60,$y); - $pdf->MultiCell(32, $height, dol_trunc($outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Action".$code)),32), 0, 'L', 0); + $labelactiontype = $outputlangs->transnoentitiesnoconv("Action".$code); + $labelactiontypeshort = $outputlangs->transnoentitiesnoconv("Action".$code.'Short'); + $pdf->MultiCell(32, $height, dol_trunc($outputlangs->convToOutputCharset($labelactiontypeshort == "Action".$code.'Short' ? $labelactiontype : $labelactiontypeshort),32), 0, 'L', 0); $y2 = $pdf->GetY(); // Description of event diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index dd492e4724c..da6fe60d787 100644 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -820,13 +820,18 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase $this->assertContains('theme',$s,'testImgPicto2'); $this->assertContains('style="float: right"',$s,'testImgPicto2'); - $s=img_picto('title','/fullpath/img.png','',1); + $s=img_picto('title', '/fullpath/img.png', '', 1); print __METHOD__." s=".$s."\n"; $this->assertEquals('',$s,'testImgPicto3'); - $s=img_picto('title','/fullpath/img.png','',true); + $s=img_picto('title', '/fullpath/img.png', '', true); print __METHOD__." s=".$s."\n"; $this->assertEquals('',$s,'testImgPicto4'); + + $s=img_picto('title', 'delete', '', 0, 1); + print __METHOD__." s=".$s."\n"; + $this->assertEquals('',$s,'testImgPicto3'); + } /**