dearchiveren orgd=s

This commit is contained in:
Monique
2022-07-07 09:13:28 +02:00
parent 2c34210d5f
commit 31b4df1d2c
4 changed files with 210 additions and 16 deletions
@@ -15,6 +15,7 @@ class Organisaties extends MY_Controller{
"monpas/Scores_model",
"monpas/Schooldetails_model",
"monpas/Ambities_model",
"monpas/Wenssituaties_model",
"shared/Licenties_model");
$this->load->model($models);
$this->load->helper('string');
@@ -132,6 +133,7 @@ class Organisaties extends MY_Controller{
$this->Ambities_model->delete_record_where(array("organisatie_id"=>$orgid));
$this->Orgversies_model->delete_record_where(array("organisatie_id" =>$orgid));
$this->Licenties_model->delete_record_where(array("orgid" =>$orgid));
$this->Wenssituaties_model->delete_record_where(["organisatie_id" =>$orgid ]);
$this->Organisaties_model->delete_record($orgid);
}
}
@@ -150,7 +152,13 @@ class Organisaties extends MY_Controller{
}
else {
$actief = 1;
if ($this->input->post("actief")=="false") $actief = 0;
if ($this->input->post("actief")=="false"){
if($this->input->post("soort")== "4") $actief = 0;
else{ $orgs = $this->Organisaties_model->getorgsonderbestuur($orgid);
if($orgs) $errortekst .= "Deactiveer eerst de actieve organisaties onder deze organisatie.";
else $actief = 0;
}
}
// $monbas=1;
// if ($this->input->post("monbas")=="false") $monbas = 0;
// $mondiv = 1;
@@ -189,6 +197,29 @@ class Organisaties extends MY_Controller{
else {$errortekst = " U bent niet geautoriseerd voor deze handeling.";};
echo json_encode($errortekst);
}
function dearchiveer(){
//TODO clean input
if ($this->Autorisaties_model->check_autorisatie($this->userrole, SUPERUSER) > 0) {
$orgid =$this->input->post("id");
$errortekst = '';
if($this->input->post("soort")== "1") $actief = 1;
else{ $valtonderID = $this->input->post("valtonderID");
$actief = $this->Organisaties_model->get_fieldvalue(["valtonder_id" => $valtonderID], 'actief');
if($actief == 0) $errortekst .= "Activeer eerst de gearchiveerd organisatie(s) boven deze organisatie.";
else $actief = 1;
}
$data=array(
"actief" =>$actief
);
$this->Organisaties_model->update_record($data,$orgid);
}
else {$errortekst = " U bent niet geautoriseerd voor deze handeling.";};
echo json_encode($errortekst);
}
function zoek(){
//TODO clean input
$errortekst="";