nieuwe onderst. vorm ook opslaan als aantal 0 is

This commit is contained in:
2026-02-03 18:40:55 +01:00
parent c35552cc66
commit e265e257b8
3 changed files with 16 additions and 16 deletions
+11 -9
View File
@@ -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);