Procházet zdrojové kódy

N°1123.2 AttributeImage: default_image is no longer mandatory.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@5036 a333f486-631f-4898-b8df-5754b55c2be0
glajarige před 7 roky
rodič
revize
d056e516f9

+ 2 - 2
core/attributedef.class.inc.php

@@ -5538,8 +5538,8 @@ class AttributeImage extends AttributeBlob
 	{
 		$iMaxWidthPx = $this->Get('display_max_width');
 		$iMaxHeightPx = $this->Get('display_max_height');
-		$sUrl = $this->GetOptional('default_image', '');
-		$sRet = '<img src="'.$sUrl.'" style="max-width: '.$iMaxWidthPx.'px; max-height: '.$iMaxHeightPx.'px">';
+		$sUrl = $this->Get('default_image');
+		$sRet = ($sUrl !== null) ? '<img src="'.$sUrl.'" style="max-width: '.$iMaxWidthPx.'px; max-height: '.$iMaxHeightPx.'px">' : '';
 		if (is_object($value) && !$value->IsEmpty())
 		{
 			if ($oHostObject->IsNew() || ($oHostObject->IsModified() && (array_key_exists($this->GetCode(), $oHostObject->ListChanges()))))

+ 2 - 2
core/pdfbulkexport.class.inc.php

@@ -226,9 +226,9 @@ EOF
 							$iNewWidth = $iWidth * $fScale;
 							$iNewHeight = $iHeight * $fScale;
 
-							$sUrl = 'data:' . $value->GetMimeType() . ';base64,' . base64_encode($value->GetData());
+							$sUrl = 'data:'.$value->GetMimeType().';base64,'.base64_encode($value->GetData());
 						}
-						$sRet = '<img src="' . $sUrl . '" style="width: ' . $iNewWidth . 'px; height: ' . $iNewHeight . 'px">';
+						$sRet = ($sUrl !== null) ? '<img src="'.$sUrl.'" style="width: '.$iNewWidth.'px; height: '.$iNewHeight.'px">' : '';
 						$sRet = '<div class="view-image">'.$sRet.'</div>';
 					}
 					else

+ 5 - 0
setup/compiler.class.inc.php

@@ -1252,6 +1252,11 @@ EOF
 					{
 						$aParameters['default_image'] = "utils::GetAbsoluteUrlModulesRoot().'$sModuleRelativeDir/$sDefault'";
 					}
+					else
+					{
+						// Note: We don't put null as default param value because it would be ignored by the final checks
+						$aParameters['default_image'] = 'null';
+					}
 				}
 				elseif ($sAttType == 'AttributeStopWatch')
 				{