public function _findExternalUser($system = null, $idUser = null, $login = null) { $adapter = Base_Model_Table::getDefaultAdapter(); try { if ($system and $login) { $select = $adapter->select()->from('scan.dictionary', array())->joinLeft('scan.dictionary_entry', 'dictionary.id = dictionary_entry.dictionary_id', array())->joinLeft('scan.external_user', 'dictionary_entry.id = external_user.system_id', array('*'))->where("dictionary.code = 'SYST'")->where("dictionary_entry.code LIKE '" . $system . "'")->where("external_user.login = ?", strtoupper($login))->limit(1); $result = $select->query()->fetchAll(); $result = $result[0]; } else { if ($idUser) { $exUsr = new ExternalUser(); $result = $exUsr->findOne($idUser)->toArray(); } } } catch (Exception $e) { throw new Exception('Blad podczas wyszukiwania uzytkownika!'); } if (empty($result) || !isset($result)) { throw new Exception('Nieznany uzytkownik'); } return $result; }