Fix: Error using static method

This commit is contained in:
Laurent Destailleur 2013-01-07 23:20:00 +01:00
parent e5f5e38736
commit 0889bdc3eb
2 changed files with 4 additions and 5 deletions

View File

@ -541,7 +541,7 @@ class ActionComm extends CommonObject
* @param int $fk_element Id of element action is linked to * @param int $fk_element Id of element action is linked to
* @param string $elementtype Type of element action is linked to * @param string $elementtype Type of element action is linked to
* @param string $filter Other filter * @param string $filter Other filter
* @return array <0 if KO, array with actions * @return array or string Error string if KO, array with actions if OK
*/ */
static function getActions($db, $socid=0, $fk_element=0, $elementtype='', $filter='') static function getActions($db, $socid=0, $fk_element=0, $elementtype='', $filter='')
{ {
@ -580,9 +580,8 @@ class ActionComm extends CommonObject
return $resarray; return $resarray;
} }
else else
{ {
$this->error=$db->lasterror(); return $db->lasterror();
return -1;
} }
} }

View File

@ -145,7 +145,7 @@ class FormActions
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
$listofactions=ActionComm::getActions($this->db, $socid, $object->id, $typeelement); $listofactions=ActionComm::getActions($this->db, $socid, $object->id, $typeelement);
if (is_numeric($listofactions) && $listofactions < 0) dol_print_error($this->db,'FailedToGetActions'); if (! is_array($listofactions)) dol_print_error($this->db,'FailedToGetActions');
$num = count($listofactions); $num = count($listofactions);
if ($num) if ($num)