<% /*
     $Revision$
     $Id$

    File:               objectFilter.inc
    Description:        functies voor object suggest velden
    Globals:
    Context:
    Note:
*/ %>


<%

function getFiltClauseObject(params)
{
  var lfiltClause = "";
  if (params.filtcode && params.filtcode != "")
  {
    switch(params.filtcode)
    {
    case "I": lfiltClause = " AND d.ins_alg_ruimte_key_org IS NULL"
                          + " AND d.ins_alg_ruimte_type_org IS NULL"
                          + " AND d.ins_deel_parent_key IS NULL"
                          + " AND s.ins_srtdeel_uitleenbaar = 1";
              break;
    case "U": lfiltClause = " AND d.ins_alg_ruimte_key_org IS NOT NULL"
                          + " AND d.ins_alg_ruimte_type_org IS NOT NULL"
                          + " AND d.ins_deel_parent_key IS NULL"
                          + " AND s.ins_srtdeel_uitleenbaar = 1";
              break;
    }
  }

  if (params.srtdeel_key && params.srtdeel_key != -1) // parent-parent gegeven
  {
    lfiltClause += " AND d.ins_srtdeel_key = " + params.srtdeel_key;
  }
  else if (params.srtgroup_key && params.srtgroup_key != -1) // parent-parent gegeven
  {
    lfiltClause += " AND s.ins_srtgroep_key = " + params.srtgroup_key;
  }
  else if (params.disc_key && params.disc_key != -1) // parent gegeven
  {
    lfiltClause += " AND d.ins_discipline_key = " + params.disc_key;
  }

  return lfiltClause;
}
%>
