Commit d2e12b5b83b4ded18e931d328b0ea3b8a9c34ab9

Authored by Conrad Vermeulen
1 parent 46e0a234

"KTS-2115"

"create unit tests for ktapi"
Fixed.

Reviewed By: Kevin Fourie

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@6805 c91229c3-7414-0410-bfa2-8a42b809f60b
ktapi/KTAPIDocument.inc.php
... ... @@ -45,7 +45,7 @@ class KTAPI_Document extends KTAPI_FolderItem
45 45 $document = &Document::get($documentid);
46 46 if (is_null($document) || PEAR::isError($document))
47 47 {
48   - return new PEAR_Error(KTAPI_ERROR_DOCUMENT_INVALID);
  48 + return new KTAPI_Error(KTAPI_ERROR_DOCUMENT_INVALID,$document );
49 49 }
50 50  
51 51 $user = $ktapi->can_user_access_object_requiring_permission($document, KTAPI_PERMISSION_READ);
... ... @@ -135,7 +135,7 @@ class KTAPI_Document extends KTAPI_FolderItem
135 135 if (PEAR::isError($result))
136 136 {
137 137 DBUtil::rollback();
138   - return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR);
  138 + return new KTAPI_Error(KTAPI_ERROR_INTERNAL_ERROR,$result);
139 139 }
140 140 DBUtil::commit();
141 141  
... ... @@ -182,7 +182,7 @@ class KTAPI_Document extends KTAPI_FolderItem
182 182 if (($res === false) || PEAR::isError($res))
183 183 {
184 184 DBUtil::rollback();
185   - return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR);
  185 + return new KTAPI_Error(KTAPI_ERROR_INTERNAL_ERROR,$res);
186 186 }
187 187  
188 188 $oDocumentTransaction = & new DocumentTransaction($this->document, $reason, 'ktcore.transactions.force_checkin');
... ... @@ -190,7 +190,7 @@ class KTAPI_Document extends KTAPI_FolderItem
190 190 $res = $oDocumentTransaction->create();
191 191 if (($res === false) || PEAR::isError($res)) {
192 192 DBUtil::rollback();
193   - return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR);
  193 + return new KTAPI_Error(KTAPI_ERROR_INTERNAL_ERROR,$res);
194 194 }
195 195 DBUtil::commit();
196 196 }
... ... @@ -219,7 +219,7 @@ class KTAPI_Document extends KTAPI_FolderItem
219 219 if (PEAR::isError($res))
220 220 {
221 221 DBUtil::rollback();
222   - return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR);
  222 + return new KTAPI_Error(KTAPI_ERROR_INTERNAL_ERROR, $res);
223 223 }
224 224  
225 225 DBUtil::commit();
... ... @@ -249,7 +249,7 @@ class KTAPI_Document extends KTAPI_FolderItem
249 249 if (PEAR::isError($res))
250 250 {
251 251 DBUtil::rollback();
252   - return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR);
  252 + return new KTAPI_Error(KTAPI_ERROR_INTERNAL_ERROR, $res);
253 253 }
254 254  
255 255 DBUtil::commit();
... ... @@ -274,7 +274,7 @@ class KTAPI_Document extends KTAPI_FolderItem
274 274 $user = &User::getByUserName($newusername);
275 275 if (is_null($user) || PEAR::isError($user))
276 276 {
277   - return new PEAR_Error('User could not be found');
  277 + return new KTAPI_Error('User could not be found',$user);
278 278 }
279 279  
280 280 $newuserid = $user->getId();
... ... @@ -286,14 +286,14 @@ class KTAPI_Document extends KTAPI_FolderItem
286 286 if (PEAR::isError($res))
287 287 {
288 288 DBUtil::rollback();
289   - return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR);
  289 + return new KTAPI_Error(KTAPI_ERROR_INTERNAL_ERROR ,$res );
290 290 }
291 291  
292 292 $res = KTPermissionUtil::updatePermissionLookup($this->document);
293 293 if (PEAR::isError($res))
294 294 {
295 295 DBUtil::rollback();
296   - return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR);
  296 + return new KTAPI_Error(KTAPI_ERROR_INTERNAL_ERROR,$res );
297 297 }
298 298  
299 299 $oDocumentTransaction = & new DocumentTransaction($this->document, $reason, 'ktcore.transactions.permissions_change');
... ... @@ -301,7 +301,7 @@ class KTAPI_Document extends KTAPI_FolderItem
301 301 $res = $oDocumentTransaction->create();
302 302 if (($res === false) || PEAR::isError($res)) {
303 303 DBUtil::rollback();
304   - return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR);
  304 + return new KTAPI_Error(KTAPI_ERROR_INTERNAL_ERROR,$res );
305 305 }
306 306  
307 307 DBUtil::commit();
... ... @@ -376,7 +376,7 @@ class KTAPI_Document extends KTAPI_FolderItem
376 376 if (PEAR::isError($new_document))
377 377 {
378 378 DBUtil::rollback();
379   - return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR);
  379 + return new KTAPI_Error(KTAPI_ERROR_INTERNAL_ERROR,$new_document );
380 380 }
381 381  
382 382 $new_document->setName($name);
... ... @@ -387,7 +387,7 @@ class KTAPI_Document extends KTAPI_FolderItem
387 387 if (PEAR::isError($res))
388 388 {
389 389 DBUtil::rollback();
390   - return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR);
  390 + return new KTAPI_Error(KTAPI_ERROR_INTERNAL_ERROR,$res );
391 391 }
392 392  
393 393 DBUtil::commit();
... ... @@ -487,7 +487,7 @@ class KTAPI_Document extends KTAPI_FolderItem
487 487 if (PEAR::isError($res))
488 488 {
489 489 DBUtil::rollback();
490   - return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR);
  490 + return new KTAPI_Error(KTAPI_ERROR_INTERNAL_ERROR, $res );
491 491 }
492 492  
493 493 $this->document->setName($name);
... ... @@ -498,7 +498,7 @@ class KTAPI_Document extends KTAPI_FolderItem
498 498 if (PEAR::isError($res))
499 499 {
500 500 DBUtil::rollback();
501   - return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR);
  501 + return new KTAPI_Error(KTAPI_ERROR_INTERNAL_ERROR,$res );
502 502 }
503 503  
504 504 DBUtil::commit();
... ... @@ -523,7 +523,7 @@ class KTAPI_Document extends KTAPI_FolderItem
523 523 if (PEAR::isError($res))
524 524 {
525 525 DBUtil::rollback();
526   - return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR);
  526 + return new KTAPI_Error(KTAPI_ERROR_INTERNAL_ERROR,$res );
527 527 }
528 528 DBUtil::commit();
529 529 }
... ... @@ -553,7 +553,7 @@ class KTAPI_Document extends KTAPI_FolderItem
553 553 if (PEAR::isError($res))
554 554 {
555 555 DBUtil::rollback();
556   - return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR);
  556 + return new KTAPI_Error(KTAPI_ERROR_INTERNAL_ERROR,$res );
557 557 }
558 558 DBUtil::commit();
559 559 }
... ... @@ -583,7 +583,7 @@ class KTAPI_Document extends KTAPI_FolderItem
583 583 if (PEAR::isError($res))
584 584 {
585 585 DBUtil::rollback();
586   - return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR);
  586 + return new KTAPI_Error(KTAPI_ERROR_INTERNAL_ERROR, $res);
587 587 }
588 588 DBUtil::commit();
589 589 }
... ... @@ -610,7 +610,7 @@ class KTAPI_Document extends KTAPI_FolderItem
610 610 $res = $this->document->update();
611 611 if (($res === false) || PEAR::isError($res)) {
612 612 DBUtil::rollback();
613   - return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR);
  613 + return new KTAPI_Error(KTAPI_ERROR_INTERNAL_ERROR, $res);
614 614 }
615 615  
616 616 $oDocumentTransaction = & new DocumentTransaction($this->document, sprintf(_kt('Document archived: %s'), $reason), 'ktcore.transactions.update');
... ... @@ -656,7 +656,7 @@ class KTAPI_Document extends KTAPI_FolderItem
656 656 $workflow = KTWorkflow::getByName($workflow);
657 657 if (is_null($workflow) || PEAR::isError($workflow))
658 658 {
659   - return new PEAR_Error(KTAPI_ERROR_WORKFLOW_INVALID);
  659 + return new KTAPI_Error(KTAPI_ERROR_WORKFLOW_INVALID, $workflow);
660 660 }
661 661  
662 662 DBUtil::startTransaction();
... ... @@ -664,7 +664,7 @@ class KTAPI_Document extends KTAPI_FolderItem
664 664 if (is_null($result) || PEAR::isError($result))
665 665 {
666 666 DBUtil::rollback();
667   - return new PEAR_Error(KTAPI_ERROR_WORKFLOW_INVALID);
  667 + return new KTAPI_Error(KTAPI_ERROR_WORKFLOW_INVALID, $result);
668 668 }
669 669 DBUtil::commit();
670 670 }
... ... @@ -693,7 +693,7 @@ class KTAPI_Document extends KTAPI_FolderItem
693 693 if (is_null($result) || PEAR::isError($result))
694 694 {
695 695 DBUtil::rollback();
696   - return new PEAR_Error(KTAPI_ERROR_WORKFLOW_INVALID);
  696 + return new KTAPI_Error(KTAPI_ERROR_WORKFLOW_INVALID,$result);
697 697 }
698 698 DBUtil::commit();
699 699 }
... ... @@ -722,7 +722,7 @@ class KTAPI_Document extends KTAPI_FolderItem
722 722 $transition = &KTWorkflowTransition::getByName($transition);
723 723 if (is_null($transition) || PEAR::isError($transition))
724 724 {
725   - return new PEAR_Error(KTAPI_ERROR_WORKFLOW_INVALID);
  725 + return new KTAPI_Error(KTAPI_ERROR_WORKFLOW_INVALID, $transition);
726 726 }
727 727  
728 728 DBUtil::startTransaction();
... ... @@ -730,7 +730,7 @@ class KTAPI_Document extends KTAPI_FolderItem
730 730 if (is_null($result) || PEAR::isError($result))
731 731 {
732 732 DBUtil::rollback();
733   - return new PEAR_Error(KTAPI_ERROR_WORKFLOW_INVALID);
  733 + return new KTAPI_Error(KTAPI_ERROR_WORKFLOW_INVALID, $transition);
734 734 }
735 735 DBUtil::commit();
736 736 }
... ... @@ -850,12 +850,12 @@ class KTAPI_Document extends KTAPI_FolderItem
850 850 if (is_null($result))
851 851 {
852 852 DBUtil::rollback();
853   - return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR);
  853 + return new KTAPI_Error(KTAPI_ERROR_INTERNAL_ERROR);
854 854 }
855 855 if (PEAR::isError($result))
856 856 {
857 857 DBUtil::rollback();
858   - return new PEAR_Error(sprintf(_kt("Unexpected validation failure: %s."), $result->getMessage()));
  858 + return new KTAPI_Error(sprintf(_kt("Unexpected validation failure: %s."), $result->getMessage()));
859 859 }
860 860 DBUtil::commit();
861 861 }
... ... @@ -886,7 +886,7 @@ class KTAPI_Document extends KTAPI_FolderItem
886 886 $transitions = KTWorkflowUtil::getTransitionsForDocumentUser($this->document, $user);
887 887 if (is_null($transitions) || PEAR::isError($transitions))
888 888 {
889   - return new PEAR_Error(KTAPI_ERROR_WORKFLOW_INVALID);
  889 + return new KTAPI_Error(KTAPI_ERROR_WORKFLOW_INVALID, $transitions);
890 890 }
891 891 foreach($transitions as $transition)
892 892 {
... ... @@ -1065,7 +1065,7 @@ class KTAPI_Document extends KTAPI_FolderItem
1065 1065 $transactions = DBUtil::getResultArray(array($sQuery, $aParams));
1066 1066 if (is_null($transactions) || PEAR::isError($transactions))
1067 1067 {
1068   - return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR);
  1068 + return new KTAPI_Error(KTAPI_ERROR_INTERNAL_ERROR, $transactions );
1069 1069 }
1070 1070  
1071 1071 return $transactions;
... ...
ktapi/KTAPIFolder.inc.php
... ... @@ -38,7 +38,7 @@ class KTAPI_Folder extends KTAPI_FolderItem
38 38 $folder = &Folder::get($folderid);
39 39 if (is_null($folder) || PEAR::isError($folder))
40 40 {
41   - return new PEAR_Error(KTAPI_ERROR_FOLDER_INVALID);
  41 + return new KTAPI_Error(KTAPI_ERROR_FOLDER_INVALID,$folder);
42 42 }
43 43  
44 44 $user = $ktapi->can_user_access_object_requiring_permission($folder, KTAPI_PERMISSION_READ);
... ... @@ -144,7 +144,7 @@ class KTAPI_Folder extends KTAPI_FolderItem
144 144 $row = DBUtil::getOneResult($sql);
145 145 if (is_null($row) || PEAR::isError($row))
146 146 {
147   - return new PEAR_Error(KTAPI_ERROR_FOLDER_INVALID);
  147 + return new KTAPI_Error(KTAPI_ERROR_FOLDER_INVALID,$row);
148 148 }
149 149 $folderid = $row['id'];
150 150 }
... ... @@ -187,7 +187,7 @@ class KTAPI_Folder extends KTAPI_FolderItem
187 187  
188 188 if (is_null($ktapi_folder) || PEAR::isError($ktapi_folder))
189 189 {
190   - return new PEAR_Error(KTAPI_ERROR_FOLDER_INVALID);
  190 + return new KTAPI_Error(KTAPI_ERROR_FOLDER_INVALID, $ktapi_folder);
191 191 }
192 192  
193 193 //$folder = $ktapi_folder->get_folder();
... ... @@ -196,7 +196,7 @@ class KTAPI_Folder extends KTAPI_FolderItem
196 196 $document = Document::$function($documentname, $folderid);
197 197 if (is_null($document) || PEAR::isError($document))
198 198 {
199   - return new PEAR_Error(KTAPI_ERROR_DOCUMENT_INVALID);
  199 + return new KTAPI_Error(KTAPI_ERROR_DOCUMENT_INVALID, $document);
200 200 }
201 201  
202 202 $user = $this->can_user_access_object_requiring_permission($document, KTAPI_PERMISSION_READ);
... ... @@ -245,7 +245,7 @@ class KTAPI_Folder extends KTAPI_FolderItem
245 245 $descriptors=KTPermissionUtil::getPermissionDescriptorsForUser($user);
246 246 if (is_null($descriptors) || PEAR::isError($descriptors))
247 247 {
248   - return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR . ': problem with descriptors for user');
  248 + return new KTAPI_Error(KTAPI_ERROR_INTERNAL_ERROR . ': problem with descriptors for user', $descriptors);
249 249 }
250 250 if (count($descriptors == 0))
251 251 {
... ... @@ -328,7 +328,7 @@ class KTAPI_Folder extends KTAPI_FolderItem
328 328 $contents = DBUtil::getResultArray($sql);
329 329 if (is_null($contents) || PEAR::isError($contents))
330 330 {
331   - return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR);
  331 + return new KTAPI_Error(KTAPI_ERROR_INTERNAL_ERROR , $contents);
332 332 }
333 333  
334 334 $num_items = count($contents);
... ... @@ -397,7 +397,7 @@ class KTAPI_Folder extends KTAPI_FolderItem
397 397 if (!is_a($document,'Document'))
398 398 {
399 399 DBUtil::rollback();
400   - return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR);
  400 + return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR . ' : ' . $document->getMessage());
401 401 }
402 402 DBUtil::commit();
403 403  
... ... @@ -434,7 +434,7 @@ class KTAPI_Folder extends KTAPI_FolderItem
434 434 if (PEAR::isError($result))
435 435 {
436 436 DBUtil::rollback();
437   - return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR);
  437 + return new KTAPI_Error(KTAPI_ERROR_INTERNAL_ERROR, $result);
438 438 }
439 439 DBUtil::commit();
440 440 $folderid = $result->getId();
... ... @@ -466,7 +466,7 @@ class KTAPI_Folder extends KTAPI_FolderItem
466 466 if (PEAR::isError($result))
467 467 {
468 468 DBUtil::rollback();
469   - return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR);
  469 + return new KTAPI_Error(KTAPI_ERROR_INTERNAL_ERROR, $result);
470 470 }
471 471 DBUtil::commit();
472 472 }
... ... @@ -490,7 +490,7 @@ class KTAPI_Folder extends KTAPI_FolderItem
490 490 if (PEAR::isError($result))
491 491 {
492 492 DBUtil::rollback();
493   - return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR);
  493 + return new KTAPI_Error(KTAPI_ERROR_INTERNAL_ERROR, $result);
494 494 }
495 495 DBUtil::commit();
496 496 }
... ... @@ -522,7 +522,7 @@ class KTAPI_Folder extends KTAPI_FolderItem
522 522 if (PEAR::isError($result))
523 523 {
524 524 DBUtil::rollback();
525   - return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR);
  525 + return new KTAPI_Error(KTAPI_ERROR_INTERNAL_ERROR, $result);
526 526 }
527 527 DBUtil::commit();
528 528 }
... ... @@ -555,7 +555,7 @@ class KTAPI_Folder extends KTAPI_FolderItem
555 555 if (PEAR::isError($result))
556 556 {
557 557 DBUtil::rollback();
558   - return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR);
  558 + return new KTAPI_Error(KTAPI_ERROR_INTERNAL_ERROR, $result);
559 559 }
560 560 DBUtil::commit();
561 561 }
... ...
ktapi/KTAPISession.inc.php
... ... @@ -141,9 +141,7 @@ class KTAPI_UserSession extends KTAPI_Session
141 141 * @param User $user
142 142 */
143 143 function _check_session(&$user)
144   - {
145   - session_start();
146   -
  144 + {
147 145 $user_id = $user->getId();
148 146  
149 147 $sql = "SELECT count(*) >= u.max_sessions as over_limit FROM active_sessions ass INNER JOIN users u ON ass.user_id=u.id WHERE ass.user_id = $user_id";
... ... @@ -199,7 +197,7 @@ class KTAPI_UserSession extends KTAPI_Session
199 197 $user =& User::getByUsername($username);
200 198 if (PEAR::isError($user) || ($user === false))
201 199 {
202   - return new PEAR_Error(_kt("The user '$username' cound not be found."));
  200 + return new KTAPI_Error(_kt("The user '$username' cound not be found."),$user);
203 201 }
204 202  
205 203 if ( empty($password) )
... ... @@ -211,7 +209,7 @@ class KTAPI_UserSession extends KTAPI_Session
211 209  
212 210 if (PEAR::isError($authenticated) || $authenticated === false)
213 211 {
214   - return new PEAR_Error(_kt("The password is invalid."));
  212 + return new KTAPI_Error(_kt("The password is invalid."),$authenticated);
215 213 }
216 214  
217 215 if (is_null($ip))
... ... @@ -250,7 +248,7 @@ class KTAPI_UserSession extends KTAPI_Session
250 248 $row = DBUtil::getOneResult($sql);
251 249 if (is_null($row) || PEAR::isError($row))
252 250 {
253   - return new PEAR_Error(KTAPI_ERROR_SESSION_INVALID);
  251 + return new KTAPI_Error(KTAPI_ERROR_SESSION_INVALID, $row);
254 252 }
255 253  
256 254 $sessionid = $row['id'];
... ... @@ -259,7 +257,7 @@ class KTAPI_UserSession extends KTAPI_Session
259 257 $user = &User::get($userid);
260 258 if (is_null($user) || PEAR::isError($user))
261 259 {
262   - return new PEAR_Error(KTAPI_ERROR_USER_INVALID);
  260 + return new KTAPI_Error(KTAPI_ERROR_USER_INVALID, $user);
263 261 }
264 262  
265 263  
... ... @@ -300,7 +298,7 @@ class KTAPI_AnonymousSession extends KTAPI_UserSession
300 298 $user =& User::get(-2);
301 299 if (is_null($user) || PEAR::isError($user) || ($user === false) || !$user->isAnonymous())
302 300 {
303   - return new PEAR_Error(_kt("The anonymous user could not be found."));
  301 + return new KTAPI_Error(_kt("The anonymous user could not be found."), $user);
304 302 }
305 303  
306 304 $authenticated = true;
... ...
ktapi/ktapi.inc.php
... ... @@ -30,6 +30,7 @@
30 30 *
31 31 */
32 32  
  33 +session_start();
33 34 require_once('../config/dmsDefaults.php');
34 35 require_once(KT_LIB_DIR . '/filelike/fsfilelike.inc.php');
35 36 require_once(KT_LIB_DIR . '/foldermanagement/folderutil.inc.php');
... ... @@ -38,7 +39,7 @@ require_once('KTAPIConstants.inc.php');
38 39 require_once('KTAPISession.inc.php');
39 40 require_once('KTAPIFolder.inc.php');
40 41 require_once('KTAPIDocument.inc.php');
41   -
  42 +
42 43 class KTAPI_FolderItem
43 44 {
44 45 /**
... ... @@ -55,6 +56,21 @@ class KTAPI_FolderItem
55 56 }
56 57 }
57 58  
  59 +class KTAPI_Error extends PEAR_Error
  60 +{
  61 + function KTAPI_Error($msg, $obj)
  62 + {
  63 + if (PEAR::isError($obj))
  64 + {
  65 + parent::PEAR_Error($msg . ' - ' . $obj->getMessage());
  66 + }
  67 + else
  68 + {
  69 + parent::PEAR_Error($msg);
  70 + }
  71 + }
  72 +}
  73 +
58 74 class KTAPI
59 75 {
60 76 /**
... ... @@ -319,7 +335,7 @@ class KTAPI
319 335 $rows = DBUtil::getResultArray($sql);
320 336 if (is_null($rows) || PEAR::isError($rows))
321 337 {
322   - return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR);
  338 + return new KTAPI_Error(KTAPI_ERROR_INTERNAL_ERROR, $rows);
323 339 }
324 340  
325 341 $result = array();
... ... @@ -344,7 +360,7 @@ class KTAPI
344 360 $rows = DBUtil::getResultArray($sql);
345 361 if (is_null($rows) || PEAR::isError($rows))
346 362 {
347   - return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR);
  363 + return new KTAPI_Error(KTAPI_ERROR_INTERNAL_ERROR, $rows);
348 364 }
349 365 return $rows;
350 366 }
... ... @@ -363,7 +379,7 @@ class KTAPI
363 379 $rows = DBUtil::getResultArray($sql);
364 380 if (is_null($rows) || PEAR::isError($rows))
365 381 {
366   - return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR);
  382 + return new KTAPI_Error(KTAPI_ERROR_INTERNAL_ERROR, $rows);
367 383 }
368 384 $results=array();
369 385 foreach($rows as $row)
... ... @@ -429,7 +445,7 @@ class KTAPI
429 445 $rows=DBUtil::getResultArray($sql);
430 446 if (is_null($rows) || PEAR::isError($rows))
431 447 {
432   - return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR);
  448 + return new KTAPI_Error(KTAPI_ERROR_INTERNAL_ERROR, $rows);
433 449 }
434 450 $results=array();
435 451 foreach($rows as $row)
... ...