diff --git a/application/controllers/monpas/Groepen.php b/application/controllers/monpas/Groepen.php index c81a6bd..032df36 100644 --- a/application/controllers/monpas/Groepen.php +++ b/application/controllers/monpas/Groepen.php @@ -146,8 +146,9 @@ class Groepen extends MY_Controller{ $archief = $this->clean_input('archief'); if ($archief !== 'T') $archief = 'F'; +// && ($aantal > 0) - if (($osid == 0 || $osid == null) && ($aantal > 0)) { + if (($osid == 0 || $osid == null) ) { $data = array( "organisatie_id" => $orgid, "naam" => $this->clean_input("naam"), @@ -172,22 +173,23 @@ class Groepen extends MY_Controller{ $aos = $this->Aantalxondersteuningsvorm_model->get_records_where($data2, TRUE); if($aos){ - if ($aantal == 0 && $archief !== 'T') { - // delete alleen als het niet gearchiveerd is - $this->Aantalxondersteuningsvorm_model->delete_record($aos->id); - } - else { +// if ($aantal == 0 && $archief !== 'T') { +// // delete alleen als het niet gearchiveerd is +// $this->Aantalxondersteuningsvorm_model->delete_record($aos->id); +// } + + // update de regel (ook archief opslaan) $data = array( "aantal" => $aantal, "archief" => $archief ); $this->Aantalxondersteuningsvorm_model->update_record($data, $aos->id); - } + } else{ // record bestaat nog niet: maak hem aan als er aantal > 0 is OF als het archief is - if ($aantal > 0 || $archief === 'T'){ +// if ($aantal > 0 || $archief === 'T'){ $data = array( "organisatie_id" => $orgid, "groep_id" => $this->clean_input('groepid'), @@ -196,7 +198,7 @@ class Groepen extends MY_Controller{ "archief" => $archief ); $aantalid = $this->Aantalxondersteuningsvorm_model->insert_record($data); - } +// } } echo json_encode($osid); diff --git a/application/models/monpas/Aantalxondersteuningsvorm_model.php b/application/models/monpas/Aantalxondersteuningsvorm_model.php index 450d9f8..7198ace 100644 --- a/application/models/monpas/Aantalxondersteuningsvorm_model.php +++ b/application/models/monpas/Aantalxondersteuningsvorm_model.php @@ -37,14 +37,13 @@ class Aantalxondersteuningsvorm_model extends MY_Model{ return $this->get_query_row('aantal'); } - function getaantallen($vormid, $orgid,$schooljaarnr, $groepids){ + function getaantallen($vormid, $orgid){ $this->sql ="SELECT G.id, G.naam, IF(AOS.id,aantal,0) AS aantal FROM tb_groepen G LEFT JOIN tb_aantalxondersteuningsvorm AOS ON ( G.id = AOS.groep_id AND AOS.ondersteuningsvorm_id = {$vormid}) WHERE G.organisatie_id = {$orgid} - AND G.schooljaarnr= {$schooljaarnr} - AND G.id IN ({$groepids}) + ORDER BY G.niveau, G.naam, G.id"; return $this->get_query_result(); } diff --git a/public/js/monpas/models/mondiv/groepenmodel.js b/public/js/monpas/models/mondiv/groepenmodel.js index 9fae6d4..4c732a8 100644 --- a/public/js/monpas/models/mondiv/groepenmodel.js +++ b/public/js/monpas/models/mondiv/groepenmodel.js @@ -97,14 +97,14 @@ $(function(){ $.each(dit.ondersteuningsvormen(), function(x,y){ if (parseInt(y.nivo )=== 2 ){ - console.log(y, 'wat is y') + if(y.archief() && y.orgid > 0) toon = true; } }); } - console.log(toon); + return toon; }); this.archiefextra = ko.computed(function(){ @@ -450,12 +450,11 @@ $(function(){ fToggleArchief: function(wat){ var self = ls.GroepenModel; - console.log(wat, 'wat'); if (!self.editGroep()) return; if (wat === 2) self.editGroep().archief2(! self.editGroep().archief2()); if (wat === 3) self.editGroep().archief3(! self.editGroep().archief3()); if (wat === 4) self.editGroep().archief4(! self.editGroep().archief4()); - console.log(self.editGroep().archief4(), 'archief4'); + }, fCheckinput: function(data,elid){