2
0
forked from Wavyzz/dolibarr

Fix regression

This commit is contained in:
Laurent Destailleur
2018-04-05 19:52:54 +02:00
parent 6c409b2670
commit 48ff89c63b
4 changed files with 19 additions and 9 deletions

View File

@@ -1703,7 +1703,10 @@ class Form
$userstatic->fetch($value['id']); $userstatic->fetch($value['id']);
$out.= $userstatic->getNomUrl(-1); $out.= $userstatic->getNomUrl(-1);
if ($i == 0) { $ownerid = $value['id']; $out.=' ('.$langs->trans("Owner").')'; } if ($i == 0) { $ownerid = $value['id']; $out.=' ('.$langs->trans("Owner").')'; }
if ($nbassignetouser > 1 && $action != 'view') $out.=' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 1, 1).'" value="'.$userstatic->id.'" class="removedassigned" id="removedassigned_'.$userstatic->id.'" name="removedassigned_'.$userstatic->id.'">'; if ($nbassignetouser > 1 && $action != 'view')
{
$out.=' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 0, 1).'" value="'.$userstatic->id.'" class="removedassigned" id="removedassigned_'.$userstatic->id.'" name="removedassigned_'.$userstatic->id.'">';
}
// Show my availability // Show my availability
if ($showproperties) if ($showproperties)
{ {

View File

@@ -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: 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) * 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 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 $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 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 * @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)) { if (! preg_match('/(\.png|\.gif|\.svg)$/i',$picto)) {
$picto .= '.png'; $picto .= '.png';
} }
$fullpathpicto = $url.'/'.$path.'/img/'.$picto; $fullpathpicto = $picto;
} }
else { else {
$pictowithoutext = preg_replace('/(\.png|\.gif|\.svg)$/', '', $picto); $pictowithoutext = preg_replace('/(\.png|\.gif|\.svg)$/', '', $picto);
//if (in_array($picto, array('switch_off', 'switch_on', 'off', 'on'))) //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; $fakey = $pictowithoutext;
$facolor = ''; $facolor = '';
$fasize = ''; $fasize = '';
@@ -3151,7 +3151,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
if (preg_match('/class="([^"]+)"/', $moreatt, $reg)) { if (preg_match('/class="([^"]+)"/', $moreatt, $reg)) {
$morecss.= ($morecss?' ':'').$reg[1]; $morecss.= ($morecss?' ':'').$reg[1];
} }
$enabledisablehtml = '<span class="fa '.$fakey.' marginleftonly valignmiddle'.($morecss?' '.$morecss:'').'" style="'.($fasize?('font-size: '.$fasize.';'):'').($facolor?(' color: '.$facolor.';'):'').'" alt="'.dol_escape_htmltag($titlealt).'" title="'.dol_escape_htmltag($titlealt).'"'.($moreatt?' '.$moreatt:'').'">'; $enabledisablehtml = '<span class="fa '.$fakey.' marginleftonly valignmiddle'.($morecss?' '.$morecss:'').'" style="'.($fasize?('font-size: '.$fasize.';'):'').($facolor?(' color: '.$facolor.';'):'').'" alt="'.dol_escape_htmltag($titlealt).'" title="'.dol_escape_htmltag($titlealt).'"'.($moreatt?' '.$moreatt:'').'>';
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
$enabledisablehtml.= $titlealt; $enabledisablehtml.= $titlealt;
} }

View File

@@ -179,7 +179,7 @@ class CommActionRapport
@chmod($file, octdec($conf->global->MAIN_UMASK)); @chmod($file, octdec($conf->global->MAIN_UMASK));
$this->result = array('fullpath'=>$file); $this->result = array('fullpath'=>$file);
return 1; return 1;
} }
} }
@@ -291,7 +291,9 @@ class CommActionRapport
if ($code == 'AC_OTH_AUTO') $code='AC_AUTO'; if ($code == 'AC_OTH_AUTO') $code='AC_AUTO';
} }
$pdf->SetXY(60,$y); $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(); $y2 = $pdf->GetY();
// Description of event // Description of event

View File

@@ -820,13 +820,18 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
$this->assertContains('theme',$s,'testImgPicto2'); $this->assertContains('theme',$s,'testImgPicto2');
$this->assertContains('style="float: right"',$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"; print __METHOD__." s=".$s."\n";
$this->assertEquals('<img src="/fullpath/img.png" alt="" title="title" class="inline-block">',$s,'testImgPicto3'); $this->assertEquals('<img src="/fullpath/img.png" alt="" title="title" class="inline-block">',$s,'testImgPicto3');
$s=img_picto('title','/fullpath/img.png','',true); $s=img_picto('title', '/fullpath/img.png', '', true);
print __METHOD__." s=".$s."\n"; print __METHOD__." s=".$s."\n";
$this->assertEquals('<img src="/fullpath/img.png" alt="" title="title" class="inline-block">',$s,'testImgPicto4'); $this->assertEquals('<img src="/fullpath/img.png" alt="" title="title" class="inline-block">',$s,'testImgPicto4');
$s=img_picto('title', 'delete', '', 0, 1);
print __METHOD__." s=".$s."\n";
$this->assertEquals('<img src="/fullpath/img.png" alt="" title="title" class="inline-block">',$s,'testImgPicto3');
} }
/** /**