<%@ LANGUAGE = JavaScript %>
<% /*
     $Revision$
     $Id$

     File:        prs_inzetbaar_delete.asp
*/ %>
<%
var JSON_Result = true;
%>

<!-- #include file="../Shared/common.inc" -->
<!-- #include file="../prs/prs.inc" -->

<%
protectRequest.validateToken();

var prs_inzetbaar_key = getFParamIntArray("prs_inzetbaar_key");

var sql = "SELECT pi.prs_perslid_key"
    + "  FROM prs_perslid_inzetbaar pi"
    + " WHERE pi.prs_perslid_inzetbaar_key = " + prs_inzetbaar_key;
var oRs = Oracle.Execute(sql);
var prs_perslid_key = oRs("prs_perslid_key").value;
oRs.Close();

if (!prs.checkAutorisation(prs_perslid_key).writecontact)
{
    var autfunction = "WEB_PRSMAN";
    var authparams = user.checkAutorisation(autfunction);
    user.auth_required_or_abort(authparams.PRSwritelevel < 9 && authparams.ALGwritelevel < 9);
}

var sql = "DELETE prs_perslid_inzetbaar"
        + " WHERE prs_perslid_inzetbaar_key = " + prs_inzetbaar_key;

Oracle.Execute(sql);
result = {success: true};

Response.Write(JSON.stringify(result));
%>
<% ASPPAGE_END(); %>
