Merge branch 'feature/archiefoptie-ondersteuningsvorm' into develop
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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){
|
||||
|
||||
Reference in New Issue
Block a user