\n");
$error_message = getLanguageText('ERRORMSG-ACCESS-DENIED');
include "form.messages.php";
return;
}
// Get schedule_num
if (array_key_exists('schedule_num',$_GET)) $schedule_num = intval($_GET['schedule_num']);
if (array_key_exists('schedule_num',$_POST)) $schedule_num = intval($_POST['schedule_num']);
if (!isset($schedule_num)) {
echo("
\n");
$error_message = getLanguageText('ERRORMSG-INVALID-ACCESS');
include "form.messages.php";
return;
}
// Check if this is a valid schedule
$swhere = "";
if ($_SESSION['UserInfo']['type'] == 'Supplier') $swhere = " and supplier_num = " . $_SESSION['UserInfo']['supplier_num'];
$query = "select * from hotlunch_schedules " .
"where record_num = $schedule_num " .
"and school_num = $school_num " .
$swhere;
$results = db_query($query);
if (db_num_rows($results) == 0) {
echo("
\n");
$error_message = getLanguageText('ERRORMSG-INVALID-SCHEDULE');
include "form.messages.php";
return;
}
$hotlunch_schedule = db_fetch_array($results);
// Check that this schedule date has lunch dates specified
$query = "select count(*) num from hotlunch_menu_dates " .
"where school_num = $school_num " .
"and schedule_num = $schedule_num";
$dates = db_getVal($query);
if ($dates == 0) {
echo("
\n");
$error_message = getLanguageText('ERRORMSG-NO-MENU-DATES');
include "form.messages.php";
return;
}
// Check that this schedule date has lunch items specified
$query = "SELECT count(hotlunch_menu_items.record_num) num " .
"FROM hotlunch_menu_items AS hlmi,hotlunch_menu_dates AS hlmd " .
"WHERE hlmi.school_num = $school_num " .
"AND hlmd.school_num = $school_num " .
"AND hlmd.record_num = hlmi.menu_num " .
"AND hlmd.schedule_num = $schedule_num";
$items = db_getVal($query);
if ($items == 0) {
echo("
\n");
$error_message = getLanguageText('ERRORMSG-NO-MENU-DATES');
include "form.messages.php";
return;
}
?>