Skip to content
Snippets Groups Projects
Commit d7edcbf7 authored by Anton Bagliy's avatar Anton Bagliy
Browse files

ADD: mark globa disciplines from 1C as global but not bound #497

parent ce38d068
Branches
No related merge requests found
CREATE OR REPLACE FUNCTION public.discipline_setglobal(pdisciplineid integer)
RETURNS integer
LANGUAGE plpgsql
AS $function$
BEGIN
UPDATE disciplines SET isglobal=TRUE
WHERE disciplines.id = pdisciplineid;
RETURN 0;
EXCEPTION
when others
then RETURN -1;
end
$function$;
......@@ -81,6 +81,7 @@ class Controller_Api_V0_StudyPlan extends Controller_Handler_Api
if (isset($discipline)) {
if ($disciplineData->global) {
$discipline->setInactive();
$discipline->setGlobal();
}
}
......
......@@ -319,6 +319,15 @@ class Model_Discipline extends Model_Container
return $res;
}
public function setGlobal() {
$sql = 'SELECT * FROM Discipline_setGlobal(:discipline) as "Num"';
$res = DB::query(Database::SELECT, $sql)
->parameters([
':discipline' => $this->ID
])->execute()->get("Num");
return $res;
}
public function setActive() {
$sql = 'SELECT * FROM Discipline_setActive(:discipline) as "Num"';
$res = DB::query(Database::SELECT, $sql)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment