mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-19 16:02:15 +00:00
Merge branch 'ci' of https://github.com/FH-Complete/FHC-Core into ci
This commit is contained in:
@@ -61,6 +61,9 @@ class Prestudentstatus extends APIv1_Controller
|
||||
{
|
||||
if(isset($prestudentstatus['new']) && $prestudentstatus['new'] == true)
|
||||
{
|
||||
// Remove new parameter to avoid DB insert errors
|
||||
unset($prestudentstatus['new']);
|
||||
|
||||
$result = $this->PrestudentstatusModel->insert($prestudentstatus);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -33,7 +33,21 @@ class DB_Model extends FHC_Model
|
||||
|
||||
// DB-INSERT
|
||||
if ($this->db->insert($this->dbTable, $data))
|
||||
return $this->_success($this->db->insert_id());
|
||||
{
|
||||
// Avoid to use method insert_id() from CI because it forces to have a sequence
|
||||
// and doesn't return the primary key when it's composed by more columns
|
||||
$primaryKeysArray = array();
|
||||
|
||||
foreach ($this->pk as $key => $value)
|
||||
{
|
||||
if(isset($data[$value]))
|
||||
{
|
||||
$primaryKeysArray[$value] = $data[$value];
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_success($primaryKeysArray);
|
||||
}
|
||||
else
|
||||
return $this->_error($this->db->error(), FHC_DB_ERROR);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user