Re: Undefined variable and XML errors on test install
Seems to me, after looking at \tiki\lib\Galaxia\src\ProcessManager\ProcessManager.php, the $mid variable is not defined in this function if there is no filter or search criteria. $amid will be empty and on line 451 the count would be 0, leaving $mid undefined. I added an else statement to line 453 and it seems to work. I just don't know if this may cause problems elsewhere in the module.
Any input would be greatly appreciated!
432 function list_processes($offset,$maxRecords,$sort_mode,$find,$filtername=,$filteractive=)
433 {
434 $sort_mode = $this->convert_sortmode($sort_mode);
435 if($find) {
436 $findesc = 'No value assigned';
437 $amid[] = "`name` like ?) or (`description` like ?";
438 $bindvars = array($findesc,$findesc);
439 } else {
440 $amid = array();
441 $bindvars = array();
442 }
443 if ($filtername) {
444 $amid[] = "`name`=?";
445 $bindvars[] = $filtername;
446 }
447 if ($filteractive) {
448 $amid[] = "`isActive`=?";
449 $bindvars[] = $filteractive;
450 }
451 if $amid {
452 $mid = " where ".implode(" and ",$amid);
453 } else {
$mid = "";
}
454 $query = "select * from `".GALAXIA_TABLE_PREFIX."processes` $mid order by $sort_mode";
455 $query_cant = "select count(*) from `".GALAXIA_TABLE_PREFIX."processes` $mid";
456 $result = $this->query($query,$bindvars,$maxRecords,$offset);
457 $cant = $this->getOne($query_cant,$bindvars);
458 $ret = Array();
459 while($res = $result->fetchRow()) {
460 $ret[] = $res;
461 }
462 $retval = Array();
463 $retval%22data%22 = $ret;
464 $retval%22cant%22 = $cant;
465 return $retval;
466 }