<?php

session_start();
$currentBaseDir = dirname($_SERVER['PHP_SELF']);
include($_SESSION['basedir']."core.php");

$svaTool = new svaTool();

$ids = $_REQUEST['ids'];
$ids = rtrim($ids, ",");
$idsList = explode(",", $ids);
$found = false;
$errorCode = 0;
$Id = "";


for ($i = 0; $i < count($idsList); $i++) {

    $item = trim($idsList[$i]);
    $Id .= "'" . $item . "',";
     if ($dba->checkGroupInUse($item) > 0) {
        $found = true;
        $errorCode = 1;
    }
}

$Id = rtrim($Id, ',');



if ($errorCode == 0) {
$dba->UpdateAddSCCAgent(3,$Id, NULL, NULL, 0);

}




switch ($errorCode) {

    case 0 : $msg = "{ \"errorCode\": $errorCode,\"errorMessage\" :\"GROUPE(S) SUPPRIME(S) AVEC SUCCES !\"  }"; 
        break;
    case 1 : $msg = "{ \"errorCode\": $errorCode,\"errorMessage\" :\"ERREUR ! GROUPE EN UTILISATION ! IMPOSSIBLE DE SUPPRIMER !\"  }";
        break;
    case 2 : $msg = "{ \"errorCode\": $errorCode,\"errorMessage\" :\"ERREUR ! VEUILLEZ SAISIR UNE VALEUR POUR CE PARAMETRE. !\"  }"; 
        break;
   
   
	 
}

echo $msg;
?>