Ticket #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: | 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
Note: See
TracTickets for help on using
tickets.
