Opened 16 years ago

Closed 16 years ago

#92 closed defect (fixed)

Bug fix suggestion: Selection widget fail with DateTime

Reported by: poulet1212 Owned by: madair
Priority: P2 Milestone: 1.1
Component: Core Version: 1.0.6
Severity: Critical Keywords: selection datetime
Cc: Browser: All
External ID: Operating System: All
state: Analysing

Description

By Querying features on the map which contain DateTime Attribute, Fusion generate a callback error:

Reason: MapGuide/php/Query.php uses MapGuide\php\Utilities.php to retrieve via GetPropertyValueFromFeatReader, properties values. Look at (about) line 881 MapGuide\php\Utilities.php:

$value =  GetPropertyValueFromFeatReader($featureReader,
                $properties->$layerName->propertytypes[$j],
                                                 $propname);
$value = htmlentities($value,ENT_COMPAT,'UTF-8');

this will only work if $value is a string. But GetPropertyValueFromFeatReader() returns a DateTime Object, that's why Fusion causes this callback error.

Proposition is: Getting a string representation of this DateTime Object:

$value =  GetPropertyValueFromFeatReader($featureReader,
                $properties->$layerName->propertytypes[$j],
                                                   $propname);
if($value instanceof MgDateTime)
  $value = printDateTime($value);
$value = htmlentities($value,ENT_COMPAT,'UTF-8');

where: printDateTime($value) is:

function printDateTime($mgDateTime)
{
   $dayToday = $mgDateTime->GetDay();
   $month = $mgDateTime->GetMonth();
   $year = $mgDateTime->GetYear();
   return $dayToday.".".$month.".".$year;
}

it goes nice then, Rémy

Change History (5)

comment:1 by madair, 16 years ago

Priority: P1P2
state: NewAnalysing
Status: newassigned

comment:2 by trevorwekel, 16 years ago

I have made a submission to the MapGuide tree which partially fixes this defect. The MgDateTime.ToString() method returns an Fdo compliant text representation of the date/time. This format should be suitable for roundtripping but is not a nicely formatted user string.

http://trac.osgeo.org/mapguide/changeset/3349

comment:3 by madair, 16 years ago

(In [1613]) re #92: convert MgDateTime object to a string property value

comment:4 by madair, 16 years ago

(In [1614]) re #92: convert MgDateTime object to a string property value

comment:5 by madair, 16 years ago

Resolution: fixed
Status: assignedclosed

implemented this using the printDateTime function for backward compatibility - this may be changed to us MgDateTime->ToString() in the future

Note: See TracTickets for help on using tickets.