diff --git a/include/lehreinheit.class.php b/include/lehreinheit.class.php index c6c1c0228..3d754d7ec 100644 --- a/include/lehreinheit.class.php +++ b/include/lehreinheit.class.php @@ -532,20 +532,34 @@ class lehreinheit extends basis_db for($anz=0;$anzstudiengang_kz);$anz++) { - $sql_query.=" OR ((studiengang_kz=".$this->db_add_param($this->studiengang_kz[$anz])." AND semester=".$this->db_add_param($this->semester[$anz]).")"; + // Direkte Gruppen kollidieren nicht + $direktgruppe = false; + if($this->gruppe_kurzbz[$anz]!=null && $this->gruppe_kurzbz[$anz]!='' && $this->gruppe_kurzbz[$anz]!=' ') + { + $grp_obj = new gruppe(); + $grp_obj->load($this->gruppe_kurzbz[$anz]); + if($grp_obj->direktinskription) + { + $direktgruppe = true; + } + } + if(!$direktgruppe) + { + $sql_query.=" OR ((studiengang_kz=".$this->db_add_param($this->studiengang_kz[$anz])." AND semester=".$this->db_add_param($this->semester[$anz]).")"; - if ($this->gruppe_kurzbz[$anz]!=null && $this->gruppe_kurzbz[$anz]!='' && $this->gruppe_kurzbz[$anz]!=' ') - { - $sql_query.=" OR (gruppe_kurzbz=".$this->db_add_param($this->gruppe_kurzbz[$anz]).")"; + if ($this->gruppe_kurzbz[$anz]!=null && $this->gruppe_kurzbz[$anz]!='' && $this->gruppe_kurzbz[$anz]!=' ') + { + $sql_query.=" OR (gruppe_kurzbz=".$this->db_add_param($this->gruppe_kurzbz[$anz]).")"; + } + else + { + if ($this->verband[$anz]!=null && $this->verband[$anz]!='' && $this->verband[$anz]!=' ') + $sql_query.=" AND (verband=".$this->db_add_param($this->verband[$anz])." OR verband IS NULL OR verband='' OR verband=' ')"; + if ($this->gruppe[$anz]!=null && $this->gruppe[$anz]!='' && $this->gruppe[$anz]!=' ') + $sql_query.=" AND (gruppe=".$this->db_add_param($this->gruppe[$anz])." OR gruppe IS NULL OR gruppe='' OR gruppe=' ')"; + } + $sql_query.=')'; } - else - { - if ($this->verband[$anz]!=null && $this->verband[$anz]!='' && $this->verband[$anz]!=' ') - $sql_query.=" AND (verband=".$this->db_add_param($this->verband[$anz])." OR verband IS NULL OR verband='' OR verband=' ')"; - if ($this->gruppe[$anz]!=null && $this->gruppe[$anz]!='' && $this->gruppe[$anz]!=' ') - $sql_query.=" AND (gruppe=".$this->db_add_param($this->gruppe[$anz])." OR gruppe IS NULL OR gruppe='' OR gruppe=' ')"; - } - $sql_query.=')'; } $sql_query.=")";