0) $selected_supplier = $_GET['selected_supplier'];
if (array_key_exists('selected_supplier',$_POST) && strlen($_POST['selected_supplier']) > 0) $selected_supplier = $_POST['selected_supplier'];
if (!isset($selected_supplier)) {
$error_message = getLanguageText('ERRORMSG-NO-SUPPLIER-SELECTED');
include "form.messages.php";
return;
}
if (isset($selected_supplier)) {
$query = "select * from suppliers where school_num = $supplier_school_num and record_num = $selected_supplier";
// writeLog($query);
$results = db_query($query);
if (db_num_rows($results) != 1) {
echo("
\n");
$error_message = getLanguageText('ERRORMSG-NO-SUPPLIER-SELECTED');
// writeLog($error_message);
include "form.messages.php";
return;
}
$supplier = db_fetch_array($results);
$supplier_name = $supplier['supplier_name'];
$subtitle = " - " . $supplier['supplier_name'];
$swhere = "and record_num = $selected_supplier ";
// writeLog("Supplier: $supplier_name");
}
//
// Process all actions to list and edit records
//
$naction = "";
$templatePageTitle = getLanguageText('TEXT-POST-SUPPLIER-PRODUCT-TO-SELECTED-SCHEDULE');
if (array_key_exists('naction',$_GET)) $naction = $_GET['naction'];
if (array_key_exists('naction',$_POST)) $naction = $_POST['naction'];
switch (strtolower($naction)) {
case "post":
$selected_products = $_POST['selected_products'];
$selected_schedules = $_POST['selected_schedules'];
if (!is_array($selected_products)) {
// writeLog("selected_products is not an array");
$error_message = getLanguageText('ERRORMSG-NO-PRODUCTS-SELECTED');
echo("
\n");
include "form.messages.php";
break;
}
$num_products = count($selected_products);
// writeLog("num_products: $num_products");
// Ensure that there are products to post
if ($num_products == 0) {
$error_message = getLanguageText('ERRORMSG-NO-PRODUCTS-SELECTED');
echo("
\n");
include "form.messages.php";
break;
}
// Check that there is an item to post
$items_to_post = false;
if (array_key_exists('post_title', $_POST) && $_POST['post_title'] == 'Y') $items_to_post = true;
if (array_key_exists('post_description', $_POST) && $_POST['post_description'] == 'Y') $items_to_post = true;
if (array_key_exists('post_label', $_POST) && $_POST['post_label'] == 'Y') $items_to_post = true;
if (array_key_exists('post_online', $_POST) && $_POST['post_online'] == 'Y') $items_to_post = true;
if (array_key_exists('post_paper', $_POST) && $_POST['post_paper'] == 'Y') $items_to_post = true;
if (array_key_exists('post_special1', $_POST) && $_POST['post_special1'] == 'Y') $items_to_post = true;
if (array_key_exists('post_special2', $_POST) && $_POST['post_special2'] == 'Y') $items_to_post = true;
if (array_key_exists('post_special3', $_POST) && $_POST['post_special3'] == 'Y') $items_to_post = true;
if (array_key_exists('post_options', $_POST) && $_POST['post_options'] == 'Y') $items_to_post = true;
if (array_key_exists('post_rating', $_POST) && $_POST['post_rating'] == 'Y') $items_to_post = true;
if (array_key_exists('post_message', $_POST) && $_POST['post_message'] == 'Y') $items_to_post = true;
if (array_key_exists('post_image', $_POST) && $_POST['post_image'] == 'Y') $items_to_post = true;
if (array_key_exists('post_hot_cold_food', $_POST) && $_POST['post_hot_cold_food'] == 'Y') $items_to_post = true;
if (array_key_exists('post_taxable', $_POST) && $_POST['post_taxable'] == 'Y') $items_to_post = true;
if (!$items_to_post) {
$error_message = getLanguageText('ERRORMSG-NO-FEATURES-TO-POST');
// writeLog($error_message);
echo("
\n");
include "form.messages.php";
break;
}
$nSchedules = count($selected_schedules);
// writeLog("nSchedules: $nSchedules");
for ($sn = 0; $sn < count($selected_schedules); $sn++) {
$selected_schedule = $selected_schedules[$sn];
// Get schedule title
$query = "SELECT schedule_name, school_num FROM hotlunch_schedules WHERE record_num = $selected_schedule";
$results = db_query($query);
if (db_num_rows($results) == 0) continue;
$schedule = db_fetch_assoc($results);
$schedule_name = $schedule['schedule_name'];
$school_num = $schedule['school_num'];
$school_name = db_getVal("SELECT school_name FROM schools WHERE record_num = $school_num");
// Start the table
?>
| : - | ||||
|
|