<?php
 require "../commonincludefiles.php";

// The ext grid script will send  a task field which will specify what it wants to do
$task = '';
if (isset($_POST['task'])){
	$task = $_POST['task'];
}

$IssueDetail_Ids = $_POST['ids1'];
$Book_Ids = $_POST['ids2'];

$updateIssueDetail_Id = 0;
$updateBook_Id = 0;

$updateIssueDetail_Id = json_decode(stripslashes($IssueDetail_Ids));
$updateBook_Id = json_decode(stripslashes($Book_Ids));

if(sizeof($updateIssueDetail_Id)<1 && sizeof($updateBook_Id)<1){
	echo '0';
}
else{
	/** Update Book Available **/
	$objBookMgmt = new BookMgmt();
	$objBookMgmt->book_available = "0";
	$objBookMgmt->book_id = implode(",",$updateBook_Id);
	$objBookMgmt->edit_availabelbook();

	$objIssueMgmt = new IssueMgmt();
	$objIssueDetailMgmt = new IssueDetailMgmt();
	$objIssueDetailMgmt->issue_isreturned = "0";
	$objIssueDetailMgmt->issue_id = implode(",",$updateIssueDetail_Id);
	$objIssueDetailMgmt->edit();
	echo '1';
}        
?>