AKSW / site.ontowiki

HTML Content Publishing system on top of Linked Data
6 stars 7 forks source link

displayLiteralPropertyValue helper changes value "0" to empty string #31

Closed kkda closed 10 years ago

kkda commented 11 years ago

Maybe check for null or for datatype there.

white-gecko commented 10 years ago

This is the same for querylist helper

white-gecko commented 10 years ago

Generally Erfurt seams to rewrite "0" to empty strings when you da a sparqlQuery. So this should be an Erfurt issue.

kkda commented 10 years ago

Output of literal helper works fine with this change:

diff --git a/helpers/DisplayLiteralPropertyValue.php b/helpers/DisplayLiteralPropertyValue.php
index 8aa7129..1728a5f 100644
--- a/helpers/DisplayLiteralPropertyValue.php
+++ b/helpers/DisplayLiteralPropertyValue.php
@@ -19,7 +19,7 @@ class Site_View_Helper_DisplayLiteralPropertyValue extends Zend_View_Helper_Abst
 {
     public function displayLiteralPropertyValue($value = null, $property = '', $datatype = 'http://www.w3.org/2001/XMLSchema#string')
     {
-        if (!$value) {
+        if ($value === null) {
             $newValue = '';
         } else {
             $event           = new Erfurt_Event('onDisplayLiteralPropertyValue');
white-gecko commented 10 years ago

So please commit this change and close this issue. Maybe the sparql query bug and this one has a different cause.

kkda commented 10 years ago

Committed in 221cf733d421b2d4883b6a1782759e21cd49909c.