mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 12:19:28 +00:00
add Event mobility_delete
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
use \DateTime as DateTime;
|
||||
use CI3_Events as Events;
|
||||
|
||||
class Mobility extends FHCAPI_Controller
|
||||
{
|
||||
@@ -315,28 +316,8 @@ class Mobility extends FHCAPI_Controller
|
||||
{
|
||||
$bisio_id = $this->input->post('bisio_id');
|
||||
|
||||
$result = $this->BisioModel->tableExists('extension', 'tbl_mo_bisioidzuordnung');
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
|
||||
//if table exists check if existing entry
|
||||
if(!empty($data))
|
||||
{
|
||||
$this->BisioModel->addSelect("count(*)");
|
||||
$this->BisioModel->addJoin('extension.tbl_mo_bisioidzuordnung mo', 'ON (mo.bisio_id = bis.tbl_bisio.bisio_id)', 'LEFT');
|
||||
|
||||
$resultCheckMo = $this->BisioModel->loadWhere(
|
||||
array('mo.bisio_id' => $bisio_id)
|
||||
);
|
||||
|
||||
$resultCheckMo = $this->getDataOrTerminateWithError($resultCheckMo);
|
||||
$count = current($resultCheckMo)->count;
|
||||
|
||||
$existsInExtension = $count > 0 ? true : false;
|
||||
|
||||
if($existsInExtension)
|
||||
$this->terminateWithError($this->p->t('mobility', 'error_existingEntryInExtension'), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
//check if entry in MobilityOnline extension exists
|
||||
Events::trigger('mobility_delete', $bisio_id);
|
||||
|
||||
$result = $this->BisioModel->delete(
|
||||
array('bisio_id' => $bisio_id)
|
||||
@@ -344,6 +325,7 @@ class Mobility extends FHCAPI_Controller
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
$this->terminateWithSuccess($data);
|
||||
|
||||
}
|
||||
|
||||
public function getLVList($studiengang_kz)
|
||||
|
||||
@@ -44,27 +44,4 @@ class Bisio_model extends DB_Model
|
||||
else
|
||||
return success("Bisio not found");
|
||||
}
|
||||
|
||||
/**
|
||||
* checks, if an (extension) table exists to avoid later errors
|
||||
* @param String $schema like 'extension'
|
||||
* @param String $table like 'tbl_mo_bisiozuordnung'
|
||||
* @return boolean
|
||||
*/
|
||||
public function tableExists($schema, $table)
|
||||
{
|
||||
$params = array($schema, $table);
|
||||
|
||||
$qry = "SELECT
|
||||
1
|
||||
FROM
|
||||
information_schema.role_table_grants
|
||||
WHERE
|
||||
table_schema = ?
|
||||
AND table_name = ?";
|
||||
|
||||
$result = $this->execQuery($qry, $params);
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user