Forum

Welcome to ProjeQtOr new Forum. We migrated old forum to the new website.
You will find all your posts here, with your usual account.
Just one point : you’ll have to reinitialize your password. Use “Lost password” feature.

API Bug in function...
 
Notifications
Clear all

API Bug in function jsonDumpObj

2 Posts
2 Users
0 Reactions
6,443 Views
 BEAU
(@mamath)
Posts: 24
Active Member
Topic starter
 
[#1971]

Hi,

I use the API for getting information from ProjeQtOr, and if i try too retrieve information from object "Assignment", an error is log in projeQtOr log :

2014-08-28 17:18:18 ** ERROR ** Exception-[42S22] SQLSTATE[42S22]: Column not found: 1054 Unknown column 'name' in 'field list'
2014-08-28 17:18:18 ** ERROR ** For query : select id as id, name as name from l_assignment where (1=1 ) order by l_assignment.name
2014-08-28 17:18:18 ** ERROR ** Strack trace :
2014-08-28 17:18:18 ** ERROR ** #0 Sql->query called at [D:wwwpeps_dev_webmodelpersistenceSqlList.php:93]
2014-08-28 17:18:18 ** ERROR ** #1 SqlList->fetchList called at [D:wwwpeps_dev_webmodelpersistenceSqlList.php:45]
2014-08-28 17:18:18 ** ERROR ** #2 SqlList->getListNotTranslated called at [D:wwwpeps_dev_webmodelpersistenceSqlList.php:222]
2014-08-28 17:18:18 ** ERROR ** #3 SqlList->getFieldFromId called at [D:wwwpeps_dev_webmodelpersistenceSqlList.php:214]
2014-08-28 17:18:18 ** ERROR ** #4 SqlList->getNameFromId called at [D:wwwpeps_dev_webapiindex.php:291]
2014-08-28 17:18:18 ** ERROR ** #5 jsonDumpObj called at [D:wwwpeps_dev_webapiindex.php:176

The bug is not blocking at all because the Assignment object good, and i have found the origin :
too correct just change the following line in

function jsonDumpObj($obj, $included=false)

of api/index.php

Change :

if (strtoupper(substr($idclass,0,1))==substr($idclass,0,1)) {
		  		$res.=", ";
		  		$res.='"name' . $idclass . '":"' . htmlEncodeJson(SqlList::getNameFromId($idclass, $val)) . '"';
		  	}

to

if (strtoupper(substr($idclass,0,1))==substr($idclass,0,1) && 
				property_exists($idclass, 'name') ) {
		  		$res.=", ";
		  		$res.='"name' . $idclass . '":"' . htmlEncodeJson(SqlList::getNameFromId($idclass, $val)) . '"';
		  	}

Bye


 
Posted : 28 Aug 2014 19H29
(@babynus)
Posts: 14952
Member Admin
 

Thanks for reporting the issue of providing the fix.

Will be included in next version.


 
Posted : 28 Aug 2014 21H33
Share:

Scroll to Top