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

     File:        cnt_inactivate.asp
*/ %>

<%
var JSON_Result = true;
%>

<!-- #include file="../Shared/common.inc" -->
<!-- #include file="../Shared/json2.js" -->
<!-- #include file="./cnt.inc" -->

<%
protectRequest.validateToken();
/***** Get webform parameters *****/
/***** End get webform parameters *****/

var result = { success: false};

var cnt_key = getFParamInt("cnt_key");
var this_cnt = cnt.func_enabled_contract(cnt_key); // Wat heb ik zoal aan rechten op dit contract?

user.auth_required_or_abort(this_cnt.canInactivate);

// Zetten van de contact status Gesloten(1).
cnt.setcontractstatus(cnt_key, 1); // Zorgt ook voor tracking en daarmee notificatie

result.success = true;

sql = "SELECT cnt_contract_nummer"
    + " FROM CNT_CONTRACT"
    + " WHERE cnt_contract_status = 1"
    + " AND cnt_contract_key = " + cnt_key;
oRs = Oracle.Execute(sql);

if (!oRs.eof)
{
  result.success = true;
}

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