<?php
// +-------------------------------------------------+
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: resa_cart.inc.php,v 1.19.4.2 2026/06/23 13:00:01 dgoron Exp $

if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) die("no access");

global $base_path, $include_path, $sub;
global $opac_resa, $opac_resa_planning;
global $notices, $bulletins, $from_cart;

require_once($base_path.'/includes/resa_func.inc.php');
require_once($include_path.'/mail.inc.php');
require_once($include_path.'/templates/resa_planning.tpl.php') ;
require_once($base_path.'/classes/notice.class.php');
require_once($base_path.'/classes/resa.class.php');
require_once($base_path.'/classes/resa_planning.class.php');
require_once($base_path.'/classes/event/events/event_resa_multiple.class.php');
require_once($base_path.'/classes/event/events_handler.class.php');

if($opac_resa && $_SESSION['user_code']) {

	$notices=array();
	$bulletins=array();
	$from_cart=0;

	//Récupération des notices
	switch($sub){
		case 'resa_cart' :
		case 'resa_planning_cart' :
			$notices = $_SESSION['cart'];
			$from_cart = 1;
			break;
		case 'resa_cart_checked':
		case 'resa_planning_cart_checked':
			if(isset($notice)) {
				$notices = $notice;
			} else if(isset($resa_notices)) {
				$notices = $resa_notices;
			}
			$from_cart = 1;
			break;
		default:
			print '<script>document.location="./index.php"</script>';
			break;
	}
	$id_empr=$_SESSION['id_empr_session'];

	//resas classiques
	if($opac_resa_planning != 1){
	    $resa_multiple = new resa_multiple($_SESSION["id_empr_session"], $notices);
	    $resa_multiple->proceed();
	//resas planifiees
	} else {
	    $resa_planning_multiple = new resa_planning_multiple($id_empr, $notices);
        $resa_planning_multiple->proceed();
	}

} else {
	print '<script>document.location="./index.php";</script>';
}
