nieuwe onderst. vorm ook opslaan als aantal 0 is
This commit is contained in:
@@ -146,8 +146,9 @@ class Groepen extends MY_Controller{
|
|||||||
$archief = $this->clean_input('archief');
|
$archief = $this->clean_input('archief');
|
||||||
|
|
||||||
if ($archief !== 'T') $archief = 'F';
|
if ($archief !== 'T') $archief = 'F';
|
||||||
|
// && ($aantal > 0)
|
||||||
|
|
||||||
if (($osid == 0 || $osid == null) && ($aantal > 0)) {
|
if (($osid == 0 || $osid == null) ) {
|
||||||
$data = array(
|
$data = array(
|
||||||
"organisatie_id" => $orgid,
|
"organisatie_id" => $orgid,
|
||||||
"naam" => $this->clean_input("naam"),
|
"naam" => $this->clean_input("naam"),
|
||||||
@@ -172,22 +173,23 @@ class Groepen extends MY_Controller{
|
|||||||
$aos = $this->Aantalxondersteuningsvorm_model->get_records_where($data2, TRUE);
|
$aos = $this->Aantalxondersteuningsvorm_model->get_records_where($data2, TRUE);
|
||||||
|
|
||||||
if($aos){
|
if($aos){
|
||||||
if ($aantal == 0 && $archief !== 'T') {
|
// if ($aantal == 0 && $archief !== 'T') {
|
||||||
// delete alleen als het niet gearchiveerd is
|
// // delete alleen als het niet gearchiveerd is
|
||||||
$this->Aantalxondersteuningsvorm_model->delete_record($aos->id);
|
// $this->Aantalxondersteuningsvorm_model->delete_record($aos->id);
|
||||||
}
|
// }
|
||||||
else {
|
|
||||||
|
|
||||||
// update de regel (ook archief opslaan)
|
// update de regel (ook archief opslaan)
|
||||||
$data = array(
|
$data = array(
|
||||||
"aantal" => $aantal,
|
"aantal" => $aantal,
|
||||||
"archief" => $archief
|
"archief" => $archief
|
||||||
);
|
);
|
||||||
$this->Aantalxondersteuningsvorm_model->update_record($data, $aos->id);
|
$this->Aantalxondersteuningsvorm_model->update_record($data, $aos->id);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
// record bestaat nog niet: maak hem aan als er aantal > 0 is OF als het archief is
|
// 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(
|
$data = array(
|
||||||
"organisatie_id" => $orgid,
|
"organisatie_id" => $orgid,
|
||||||
"groep_id" => $this->clean_input('groepid'),
|
"groep_id" => $this->clean_input('groepid'),
|
||||||
@@ -196,7 +198,7 @@ class Groepen extends MY_Controller{
|
|||||||
"archief" => $archief
|
"archief" => $archief
|
||||||
);
|
);
|
||||||
$aantalid = $this->Aantalxondersteuningsvorm_model->insert_record($data);
|
$aantalid = $this->Aantalxondersteuningsvorm_model->insert_record($data);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
echo json_encode($osid);
|
echo json_encode($osid);
|
||||||
|
|||||||
@@ -37,14 +37,13 @@ class Aantalxondersteuningsvorm_model extends MY_Model{
|
|||||||
return $this->get_query_row('aantal');
|
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
|
$this->sql ="SELECT G.id, G.naam, IF(AOS.id,aantal,0) AS aantal
|
||||||
FROM tb_groepen G
|
FROM tb_groepen G
|
||||||
LEFT JOIN tb_aantalxondersteuningsvorm AOS ON ( G.id = AOS.groep_id
|
LEFT JOIN tb_aantalxondersteuningsvorm AOS ON ( G.id = AOS.groep_id
|
||||||
AND AOS.ondersteuningsvorm_id = {$vormid})
|
AND AOS.ondersteuningsvorm_id = {$vormid})
|
||||||
WHERE G.organisatie_id = {$orgid}
|
WHERE G.organisatie_id = {$orgid}
|
||||||
AND G.schooljaarnr= {$schooljaarnr}
|
|
||||||
AND G.id IN ({$groepids})
|
|
||||||
ORDER BY G.niveau, G.naam, G.id";
|
ORDER BY G.niveau, G.naam, G.id";
|
||||||
return $this->get_query_result();
|
return $this->get_query_result();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,14 +97,14 @@ $(function(){
|
|||||||
$.each(dit.ondersteuningsvormen(), function(x,y){
|
$.each(dit.ondersteuningsvormen(), function(x,y){
|
||||||
|
|
||||||
if (parseInt(y.nivo )=== 2 ){
|
if (parseInt(y.nivo )=== 2 ){
|
||||||
console.log(y, 'wat is y')
|
|
||||||
if(y.archief() && y.orgid > 0)
|
if(y.archief() && y.orgid > 0)
|
||||||
|
|
||||||
toon = true;
|
toon = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
console.log(toon);
|
|
||||||
return toon;
|
return toon;
|
||||||
});
|
});
|
||||||
this.archiefextra = ko.computed(function(){
|
this.archiefextra = ko.computed(function(){
|
||||||
@@ -450,12 +450,11 @@ $(function(){
|
|||||||
|
|
||||||
fToggleArchief: function(wat){
|
fToggleArchief: function(wat){
|
||||||
var self = ls.GroepenModel;
|
var self = ls.GroepenModel;
|
||||||
console.log(wat, 'wat');
|
|
||||||
if (!self.editGroep()) return;
|
if (!self.editGroep()) return;
|
||||||
if (wat === 2) self.editGroep().archief2(! self.editGroep().archief2());
|
if (wat === 2) self.editGroep().archief2(! self.editGroep().archief2());
|
||||||
if (wat === 3) self.editGroep().archief3(! self.editGroep().archief3());
|
if (wat === 3) self.editGroep().archief3(! self.editGroep().archief3());
|
||||||
if (wat === 4) self.editGroep().archief4(! self.editGroep().archief4());
|
if (wat === 4) self.editGroep().archief4(! self.editGroep().archief4());
|
||||||
console.log(self.editGroep().archief4(), 'archief4');
|
|
||||||
},
|
},
|
||||||
|
|
||||||
fCheckinput: function(data,elid){
|
fCheckinput: function(data,elid){
|
||||||
|
|||||||
Reference in New Issue
Block a user