Ticket #92 (closed defect: fixed)

Opened 4 years ago

Last modified 3 years ago

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: External ID:
state: Analysing Browser: All
Operating System: All

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

Changed 3 years ago by madair

  • priority changed from P1 to P2
  • status changed from new to assigned
  • state changed from New to Analysing

Changed 3 years ago by trevorwekel

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

Changed 3 years ago by madair

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

Changed 3 years ago by madair

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

Changed 3 years ago by madair

  • status changed from assigned to closed
  • resolution set to fixed

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.