*/
include("session.php");
require_once("class_db.php");
require_once("class_letterbox.php");
$func = new functions();
if(isset($_GET['start']))
{
$start = $_GET['start'];
}
else
{
$start = 0;
}
if(isset($_GET['action']) && !empty($_GET['action']) )
{
if($_GET['action'] == "RED" && count($_SESSION['chosen_doc']) > 0)
{
?>
0)
{
?>
0)
{
?>
0)
{
?>
define_order();
if(empty($orderby))
{
$orderby = " ORDER BY priority ";
}
$table = $_SESSION['current_basket']['table'];
//$user = $_SESSION['user']['UserId'];
$db = new dbquery();
$db->connect();
$db2 = new dbquery();
$db2->connect();
$db->query("select count(*) as TOTAL from ".$table." where ".$_SESSION['current_basket']['clause'].' '.$orderby);
$line = $db->fetch_object();
$total = $line->TOTAL;
$db->query("select SOCIETE,DESCRIPTION, RES_ID, AUTHOR, TYPE_ID,date(CUSTOM_D1) as DATE1, date(CUSTOM_D2) as DATE2, date(CREATION_DATE) as DATE3, STATUS, PRIORITY, SOCIETE, AUTHOR, IS_INGOING, DEST_USER from ".$table." where ".$_SESSION['current_basket']['clause'].' '.$orderby." limit ".$start.",".$_SESSION['config']['nblinetoshow']);
if ($_SESSION['config']['corporate'] == "true" && $_SESSION['config']['replace_subject_by_society'] == "true")
{
$_SESSION['print_list']['current_request'] = "select RES_ID, AUTHOR, SOCIETE, date(CUSTOM_D1) as DATE1,date(CUSTOM_D2) as DATE2 , PRIORITY, STATUS from ".$table." where ".$_SESSION['current_basket']['clause'].' '.$orderby;
}
else
{
$_SESSION['print_list']['current_request'] = "select RES_ID, PRIORITY, date(CUSTOM_D1) as DATE1, DESCRIPTION, AUTHOR , date(CUSTOM_D2) as DATE2, STATUS from ".$table." where ".$_SESSION['current_basket']['clause'].' '.$orderby;
}
$tab = array();
$isreserved = false;
while($line = $db->fetch_object())
{
$isreserved = $courr->test_reserved_time($line->RES_ID, $table);
if($isreserved == null)
{
$user = '';
$reserved = 'N';
}
else
{
$user = '';
$reserved = 'Y';
$db2->query("SELECT FIRSTNAME,LASTNAME from ".$_SESSION['tablename']['users']." WHERE user_id = '".$isreserved."'");
if($db2->nb_result() > 0)
{
$res2 = $db2->fetch_object();
$user = $res2->FIRSTNAME." ".$res2->LASTNAME;
}
}
$this_line = array(
"SOCIETE" => stripslashes($line->SOCIETE),
"OBJET" => stripslashes($line->DESCRIPTION),
"ID" => $line->RES_ID,
"TYPE" => $line->TYPE_ID,
"ARRIVEE" => $db->inverse_date($line->DATE1),
"CREATION_DATE" => $db->inverse_date($line->DATE3),
"EMETTEUR" => stripslashes($line->AUTHOR." ".$line->CUSTOM_T4),
"STATUS"=> $line->STATUS,
"LIMITE" => $db->inverse_date($line->DATE2),
"PRIORITY" => $line->PRIORITY,
"IS_INGOING" => $line->IS_INGOING,
"USER" => $user,
"RESERVED" => $reserved,
"BY_USER_ID" => $isreserved);
if($_SESSION['current_basket']['is_global'] == "Y")
{
$this_line["SOCIETE"] = $func->show($this_line["SOCIETE"],7);
$this_line["OBJET"] = $func->show($this_line["OBJET"],12);
$this_line["TYPE"] = $func->show($this_line["TYPE"],8);
$this_line["PRIORITY"] = $func->show($_SESSION['priority'][$this_line["PRIORITY"]]['label'],7);
$this_line["USER"] = $func->show($this_line["USER"],9);
$this_line["EMETTEUR"] = $func->show($this_line["EMETTEUR"],7);
}
else
{
$this_line["SOCIETE"] = $func->show($this_line["SOCIETE"],7);
$this_line["OBJET"] = $func->show($this_line["OBJET"],12);
$this_line["TYPE"] = $func->show($this_line["TYPE"],8);
$this_line["PRIORITY"] = $func->show($_SESSION['priority'][$this_line["PRIORITY"]]['label'],7);
$this_line["USER"] = $func->show($this_line["USER"],9);
$this_line["EMETTEUR"] = $func->show($this_line["EMETTEUR"],13);
}
$tab[] = $this_line;
}
if($total == 1)
{
$title = $_SESSION['current_basket']['label']." (".$total." document)";
}
else
{
$title = $_SESSION['current_basket']['label']." (".$total." "._DOCUMENTS.")";
}
$courr->mail_process($tab, $total, $title, $_SESSION['current_basket']['page']);
?>