Harmonize JSON API error messages
This commit is contained in:
+7
-5
@@ -137,8 +137,8 @@ class Project extends PhpObject {
|
||||
|
||||
$asProjects = $this->oDb->selectRows($asInfo, 'codename');
|
||||
foreach($asProjects as $sCodeName => &$asProject) {
|
||||
//Update Geo JSON
|
||||
if($sCodeName != '' && (!Converter::isGeoJsonValid($sCodeName) || !$asProject['latitude'] && !$asProject['longitude'])) {
|
||||
//Update geoJSON
|
||||
if(Converter::hasGpxFile($sCodeName) && (!Converter::isGeoJsonValid($sCodeName) || !$asProject['latitude'] && !$asProject['longitude'])) {
|
||||
$aiCenter = Converter::convertToGeoJson($sCodeName)['center'];
|
||||
$this->oDb->updateRow(self::PROJ_TABLE, $asProject['id'], ['latitude' => $aiCenter[1], 'longitude' => $aiCenter[0]]);
|
||||
$asProject['latitude'] = $aiCenter[1];
|
||||
@@ -212,13 +212,15 @@ class Project extends PhpObject {
|
||||
$asResult['feed'][] = (new Feed($this->oDb, $iFeedId))->delete();
|
||||
}
|
||||
|
||||
$bDeleted = $this->oDb->deleteRow(self::PROJ_TABLE, $this->getProjectId());
|
||||
$asResult['project'][] = array(
|
||||
'id' => $this->getProjectId(),
|
||||
'del' => $this->oDb->deleteRow(self::PROJ_TABLE, $this->getProjectId()),
|
||||
'desc' => $this->oDb->getLastError()
|
||||
'del' => $bDeleted,
|
||||
'desc_lang_id' => $bDeleted?'':'error.commit_db',
|
||||
'desc_lang_params' => array()
|
||||
);
|
||||
}
|
||||
else $asResult['project'][] = array('del'=>false, 'desc'=>'Error while setting project: no project ID');
|
||||
else $asResult['project'][] = array('del'=>false, 'desc_lang_id'=>'error.impossible_value', 'desc_lang_params'=>array($this->getProjectId(), 'project ID'));
|
||||
|
||||
return $asResult;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user