628 lines
26 KiB
PHP
628 lines
26 KiB
PHP
<?php
|
|
require_once("include/globals.php");
|
|
|
|
if (SessionActive() != 1 || ! UserLoggedIn()) {
|
|
header("Location: /");
|
|
exit();
|
|
}
|
|
|
|
$moduleName = "supplier_products.post.php";
|
|
// startLog($moduleName);
|
|
|
|
// Start the template and output buffering
|
|
startTemplate();
|
|
$templatePageTitle = "";
|
|
$headerArgs = "";
|
|
|
|
|
|
|
|
// Ensure that only valid user types have access to this module
|
|
$AllowedUserTypes = array('SuperUser','System Administrator','Application Administrator','Administration Team','Schedule Team','Supplier');
|
|
if (checkPermission($AllowedUserTypes) != 1) {
|
|
$error_message = getLanguageText('ERRORMSG-ACCESS-DENIED');
|
|
$action = '';
|
|
$naction = '';
|
|
header("Location: /?action=$action&naction=$naction$headerArgs&form_message=" . urlencode($form_message) . "&error_message=" . urlencode($error_message));
|
|
exit();
|
|
}
|
|
|
|
|
|
$subtitle = "";
|
|
$swhere = "";
|
|
unset($selected_supplier);
|
|
if (array_key_exists('selected_supplier',$_GET) && strlen($_GET['selected_supplier']) > 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("<br>\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("<br>\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("<br>\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("<br>\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
|
|
?>
|
|
<br>
|
|
<table width='80%' class='content-table'>
|
|
<tr>
|
|
<td align='center' class='heading'><?php displayLanguageText('TEXT-POST-TO-MENU'); ?>: <?php echo($schedule_name) ?> - <?php echo($school_name) ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td align='center'>
|
|
<br>
|
|
<table width='80%' cellpadding='2' cellspacing='1' border='0' class='content-table'>
|
|
<tr class='success'>
|
|
<td width='95%' align='left'><?php displayLanguageText('TEXT-PRODUCT-NAME'); ?></td>
|
|
<td align='center'><?php displayLanguageText('TEXT-ITEMS-UPDATED'); ?></td>
|
|
</tr>
|
|
<?php
|
|
|
|
// Process each product
|
|
for ($i = 0; $i < count($selected_products); $i++) {
|
|
$product_num = $selected_products[$i];
|
|
|
|
// Get product info
|
|
$results = db_query("SELECT * FROM supplier_products WHERE school_num = $supplier_school_num AND record_num = $product_num");
|
|
$product = db_fetch_array($results);
|
|
|
|
$class = 'data-even';
|
|
if ($i % 2) $class = 'data-odd';
|
|
|
|
// Get the menu items to be updated
|
|
$query = "SELECT hlmi.record_num FROM hotlunch_menu_items as hlmi, hotlunch_menu_dates as hlmd, hotlunch_menu_products as hlmp " .
|
|
"WHERE hlmd.school_num = $school_num " .
|
|
"AND hlmi.school_num = $school_num " .
|
|
"AND hlmp.school_num = $school_num " .
|
|
"AND hlmd.schedule_num = $selected_schedule " .
|
|
"AND hlmi.menu_num = hlmd.record_num " .
|
|
"AND hlmp.menu_item_num = hlmi.record_num " .
|
|
"AND hlmp.product_sequence = 1 " .
|
|
"AND hlmp.supplier_product_num = $product_num";
|
|
$results = db_query($query);
|
|
$num_items = db_num_rows($results);
|
|
|
|
// If there are items found build the SQL statement to update them
|
|
if ($num_items > 0) {
|
|
|
|
// Get set of items to update
|
|
$items = "";
|
|
while ($row = db_fetch_array($results)) {
|
|
if (strlen($items)) $items .= ", ";
|
|
$items .= $row['record_num'];
|
|
}
|
|
|
|
// Create SQL statement
|
|
$set = "";
|
|
|
|
// Post the item_title
|
|
if (array_key_exists('post_title', $_POST) && $_POST['post_title'] == 'Y') {
|
|
if (strlen($set)) $set .= ", ";
|
|
$set .= "item_title = '" . db_escape_string($product['product_name']) . "'";
|
|
}
|
|
|
|
// Post the item_description
|
|
if (array_key_exists('post_description', $_POST) && $_POST['post_description'] == 'Y') {
|
|
if (strlen($set)) $set .= ", ";
|
|
$set .= "item_description = '" . db_escape_string($product['product_description']) . "'";
|
|
}
|
|
|
|
// Post the label
|
|
if (array_key_exists('post_label', $_POST) && $_POST['post_label'] == 'Y') {
|
|
if (strlen($set)) $set .= ", ";
|
|
$set .= "label_title = '" . db_escape_string($product['label_name']) . "'";
|
|
}
|
|
|
|
// Post the online price
|
|
if (array_key_exists('post_online', $_POST) && $_POST['post_online'] == 'Y') {
|
|
if (strlen($set)) $set .= ", ";
|
|
$price = floatval($product['standard_online_price']);
|
|
$set .= "online_price = $price";
|
|
|
|
if ($school_record['implement_multiple_item_prices'] == 'Y') {
|
|
$num = intval($product['number_of_alternate_prices']);
|
|
$set .= ", number_of_alternate_prices = $num";
|
|
|
|
for ($n = 1; $n <= 10; $n++) {
|
|
$price = floatval($product["alternate_price$n"]);
|
|
$set .= ", alternate_price$n = $price";
|
|
}
|
|
}
|
|
}
|
|
|
|
// Post the paper price
|
|
if (array_key_exists('post_paper', $_POST) && $_POST['post_paper'] == 'Y') {
|
|
if (strlen($set)) $set .= ", ";
|
|
$price = $product['standard_offline_price'];
|
|
if ($price == '') $price = '0';
|
|
$set .= "offline_price = $price";
|
|
}
|
|
|
|
// Post the special price 1
|
|
if (array_key_exists('post_special1', $_POST) && $_POST['post_special1'] == 'Y') {
|
|
if (strlen($set)) $set .= ", ";
|
|
$price = $product['special_price1'];
|
|
if ($price == '') $price = '0';
|
|
$set .= "special_price1 = $price";
|
|
}
|
|
|
|
// Post the special price 2
|
|
if (array_key_exists('post_special2', $_POST) && $_POST['post_special2'] == 'Y') {
|
|
if (strlen($set)) $set .= ", ";
|
|
$price = $product['special_price2'];
|
|
if ($price == '') $price = '0';
|
|
$set .= "special_price2 = $price";
|
|
}
|
|
|
|
// Post the special price 3
|
|
if (array_key_exists('post_special3', $_POST) && $_POST['post_special3'] == 'Y') {
|
|
if (strlen($set)) $set .= ", ";
|
|
$price = $product['special_price3'];
|
|
if ($price == '') $price = '0';
|
|
$set .= "special_price3 = $price";
|
|
}
|
|
|
|
// Post the taxable flag
|
|
if (array_key_exists('post_taxable', $_POST) && $_POST['post_taxable'] == 'Y') {
|
|
if (strlen($set)) $set .= ", ";
|
|
$taxable = $product['taxable_product'];
|
|
$set .= "taxable_item = '$taxable'";
|
|
}
|
|
|
|
// Post the options
|
|
if (array_key_exists('post_options', $_POST) && $_POST['post_options'] == 'Y') {
|
|
if (strlen($set)) $set .= ", ";
|
|
$min = intval($product['min_options'],0);
|
|
$max = intval($product['max_options'],0);
|
|
$min2 = intval($product['min_options2'],0);
|
|
$max2 = intval($product['max_options2'],0);
|
|
$min3 = intval($product['min_options3'],0);
|
|
$max3 = intval($product['max_options3'],0);
|
|
$set .= "options_title = '" . db_escape_string($product['options_title']) . "'," .
|
|
"options = '" . db_escape_string($product['product_options']) . "'," .
|
|
"default_options = '" . db_escape_string($product['default_options']) . "'," .
|
|
"min_options = $min, max_options = $max, " .
|
|
"options2_title = '" . db_escape_string($product['options2_title']) . "'," .
|
|
"options2 = '" . db_escape_string($product['product_options2']) . "'," .
|
|
"default_options2 = '" . db_escape_string($product['default_options2']) . "'," .
|
|
"min_options2 = $min2, max_options2 = $max2, " . "options3_title = '" . db_escape_string($product['options3_title']) . "'," .
|
|
"options3 = '" . db_escape_string($product['product_options3']) . "'," .
|
|
"default_options3 = '" . db_escape_string($product['default_options3']) . "'," .
|
|
"min_options3 = $min3, max_options3 = $max3";
|
|
}
|
|
|
|
// Post the nutritional info
|
|
if (array_key_exists('post_nutritional', $_POST) && $_POST['post_nutritional'] == 'Y') {
|
|
if (strlen($set)) $set .= ", ";
|
|
$set .= "nutritional_info = '" . db_escape_string($product['nutritional_info']) . "'";
|
|
}
|
|
|
|
// Post the image
|
|
if (array_key_exists('post_image', $_POST) && $_POST['post_image'] == 'Y') {
|
|
if (strlen($set)) $set .= ", ";
|
|
$set .= "image = '" . db_escape_string($product['image']) . "'";
|
|
}
|
|
|
|
// Post the hot_cold_food
|
|
if (array_key_exists('post_hot_cold_food', $_POST) && $_POST['post_hot_cold_food'] == 'Y') {
|
|
if (strlen($set)) $set .= ", ";
|
|
$set .= "hot_cold_food = '" . $product['hot_cold_food'] . "'";
|
|
}
|
|
|
|
// Post the item message
|
|
if (array_key_exists('post_message', $_POST) && $_POST['post_message'] == 'Y') {
|
|
if (strlen($set)) $set .= ", ";
|
|
$set .= "item_message = '" . db_escape_string($product['item_message']) . "'";
|
|
}
|
|
|
|
// Post the Food rating
|
|
if (array_key_exists('post_rating', $_POST) && $_POST['post_rating'] == 'Y') {
|
|
if (strlen($set)) $set .= ", ";
|
|
$set .= "bc_guideline_rating = '" . db_escape_string($product['bc_guideline_rating']) . "'";
|
|
}
|
|
|
|
if (strlen($set)) $set .= ", ";
|
|
$set .= "sales_summary_item = '" . $product['sales_summary_item'] . "'";
|
|
|
|
$query = "UPDATE hotlunch_menu_items SET $set WHERE record_num IN ($items)";
|
|
db_query($query);
|
|
echo("<!-- $query -->\n");
|
|
}
|
|
|
|
$class = 'data-even';
|
|
if ($i % 2) $class = 'data-odd';
|
|
|
|
?>
|
|
<tr class='<?php echo($class) ?>'>
|
|
<td align='left'><?php echo($product['product_name']) ?></td>
|
|
<td align='center'><?php echo($num_items) ?></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
|
|
?>
|
|
</table>
|
|
<br>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<?php
|
|
}
|
|
|
|
break;
|
|
|
|
case "list":
|
|
default:
|
|
// Start the table
|
|
?>
|
|
<form method='post' action='/'>
|
|
<br>
|
|
<table width='80%' class='content-table'>
|
|
<tr>
|
|
<td align='center' class='heading'><?php displayLanguageText('TEXT-SUPPLIER-PRODUCT-POST-TO-UPDATE-MENUS'); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td align='center'>
|
|
<br>
|
|
<table width='80%' cellpadding='2' cellspacing='1' border='0' class='content-table'>
|
|
<?php
|
|
|
|
// Display all products for selection
|
|
$all_products = array();
|
|
$scount = 0;
|
|
|
|
// Get all the products for this supplier
|
|
$products = db_query("select product_name,record_num from supplier_products where school_num = $supplier_school_num and supplier_num = $selected_supplier AND status = 'Active' order by sequence,product_name");
|
|
if (db_num_rows($products)) {
|
|
|
|
if ($scount) {
|
|
echo(" <tr>\n");
|
|
echo(" <td colspan='2'> </td>\n");
|
|
echo(" </tr>\n");
|
|
}
|
|
|
|
echo(" <tr class='success'>\n");
|
|
echo(" <td align='left' colspan='2'>$supplier_name</td>\n");
|
|
echo(" </tr>\n");
|
|
|
|
?>
|
|
<tr class='data-odd'>
|
|
<td width='95%' align='left'><b><?php displayLanguageText('TEXT-CHECK-UNCHECK-ALL-OPTIONS'); ?></b>: </td>
|
|
<td align='center'><input type='checkbox' name='select_all' id='select_all' value='Y' checked='checked' onClick='toggleProductCheckboxes()'></td>
|
|
</tr>
|
|
<?php
|
|
|
|
// Display all the products for this supplier
|
|
$count = 0;
|
|
while ($row = db_fetch_array($products)) {
|
|
$product_name = $row['product_name'];
|
|
$product_num = $row['record_num'];
|
|
$fid = "cb_$product_num";
|
|
$all_products[] = $fid;
|
|
$fname = "selected_products[]";
|
|
|
|
$class = 'data-even';
|
|
if ($count % 2) $class = 'data-odd';
|
|
|
|
echo(" <tr class='$class'>\n");
|
|
echo(" <td width='80%' align='left'>$product_name</td>\n");
|
|
echo(" <td align='center'><input type='checkbox' name='$fname' id='$fid' value='$product_num' checked='checked'></td>\n");
|
|
echo(" </tr>\n");
|
|
|
|
$count++;
|
|
}
|
|
|
|
$scount++;
|
|
}
|
|
|
|
?>
|
|
</table>
|
|
<br>
|
|
<p class='small'><?php displayLanguageText('TEXT-NOTE-POST-TO-SCHEDULES-THAT-HAVE-NOT-STARTED'); ?></p>
|
|
<?php
|
|
$SchoolSet = array();
|
|
$SchoolSet[] = array('record_num' => $school_num, 'school_name' => $school_record['school_name']);
|
|
|
|
if ($school_record['reseller'] != 'hotlunch' && $school_record['status'] == 'Special') {
|
|
$reseller = $school_record['reseller'];
|
|
|
|
$schools = db_query("SELECT school_name, record_num FROM schools WHERE reseller = '$reseller' AND status = 'Active' ORDER BY school_name");
|
|
if (db_num_rows($schools)) {
|
|
while ($row = db_fetch_assoc($schools)) {
|
|
$SchoolSet[] = $row;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Get set of upcoming schedules
|
|
$ScheduleSet = array();
|
|
$cutoff = date("Y-m-d",time() - 60 * 60 * 24 * 100);
|
|
$m = date("m",time());
|
|
if ($m < '08') $cutoff = date("Y-m-d",time() - 60 * 60 * 24 * 200);
|
|
|
|
for ($i = 0; $i < count($SchoolSet); $i++) {
|
|
$school_num = $SchoolSet[$i]['record_num'];
|
|
$school_name = $SchoolSet[$i]['school_name'];
|
|
|
|
$query = "select * from hotlunch_schedules " .
|
|
"where school_num = $school_num " .
|
|
"and status not in ('Disabled','Deleted') " .
|
|
"and schedule_start_date > '$cutoff' " .
|
|
"order by $scheduleSortOrder";
|
|
$schedules = db_query($query);
|
|
|
|
if (db_num_rows($schedules) > 0) {
|
|
while ($row = db_fetch_assoc($schedules)) {
|
|
$row['school_name'] = $school_name;
|
|
$ScheduleSet[] = $row;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (count($ScheduleSet)) {
|
|
$size = count($ScheduleSet) + 1;
|
|
if ($size > 30) $size = 30;
|
|
?>
|
|
<table>
|
|
<tr>
|
|
<td valign='top'><?php displayLanguageText('TEXT-SELECT-SCHEDULES'); ?>: </td>
|
|
<td valign='top'><select name='selected_schedules[]' multiple size='<?php echo($size) ?>'>
|
|
<?php
|
|
$PrevSchoolNum = 0;
|
|
for ($i = 0; $i < count($ScheduleSet); $i++) {
|
|
$row = $ScheduleSet[$i];
|
|
$school_num = $row['school_num'];
|
|
$school_name = $row['school_name'];
|
|
$schedule_name = $row['schedule_name'];
|
|
$schedule_num = $row['record_num'];
|
|
|
|
if ($school_num != $PrevSchoolNum) {
|
|
if ($PrevSchoolNum > 0) {
|
|
echo(" </optgroup>\n");
|
|
}
|
|
$school_name = str_replace("'","'",$school_name);
|
|
echo(" <optgroup label='$school_name'>\n");
|
|
}
|
|
$PrevSchoolNum = $school_num;
|
|
|
|
$schedule_name = str_replace("'","'",$schedule_name);
|
|
echo(" <option value='$schedule_num' selected='selected'>$schedule_name</option>\n");
|
|
}
|
|
?>
|
|
</select></td>
|
|
</tr>
|
|
</table>
|
|
<br>
|
|
<br>
|
|
<table width='60%' cellpadding='2' cellspacing='1' border='0' class='content-table'>
|
|
<tr class='success'>
|
|
<td align='left' colspan='2'><?php displayLanguageText('TEXT-ITEMS'); ?></td>
|
|
</tr>
|
|
<tr class='data-even'>
|
|
<td align='left' width='80%'><?php displayLanguageText('TEXT-PRODUCT-NAME'); ?>: </td>
|
|
<td align='center'><input type='checkbox' name='post_title' value='Y' checked='checked'></td>
|
|
</tr>
|
|
<tr class='data-odd'>
|
|
<td align='left'><?php displayLanguageText('TEXT-PRODUCT-DESCRIPTION'); ?>: </td>
|
|
<td align='center'><input type='checkbox' name='post_description' value='Y' checked='checked'></td>
|
|
</tr>
|
|
<tr class='data-even'>
|
|
<td align='left'><?php displayLanguageText('TEXT-LABEL-TITLE'); ?>: </td>
|
|
<td align='center'><input type='checkbox' name='post_label' value='Y' checked='checked'></td>
|
|
</tr>
|
|
<tr class='data-odd'>
|
|
<td align='left'><?php displayLanguageText('TEXT-ON-LINE-PRICE'); ?>: </td>
|
|
<td align='center'><input type='checkbox' name='post_online' value='Y' checked='checked'></td>
|
|
</tr>
|
|
<tr class='data-even'>
|
|
<td align='left'><?php displayLanguageText('TEXT-PAPER-SELLING-PRICE'); ?>: </td>
|
|
<td align='center'><input type='checkbox' name='post_paper' value='Y' checked='checked'></td>
|
|
</tr>
|
|
<tr class='data-odd'>
|
|
<td align='left'><?php echo($Special1_Title) ?>: </td>
|
|
<td align='center'><input type='checkbox' name='post_special1' value='Y' checked='checked'></td>
|
|
</tr>
|
|
<tr class='data-even'>
|
|
<td align='left'><?php echo($Special2_Title) ?>: </td>
|
|
<td align='center'><input type='checkbox' name='post_special2' value='Y' checked='checked'></td>
|
|
</tr>
|
|
<tr class='data-odd'>
|
|
<td align='left'><?php echo($Special3_Title) ?>: </td>
|
|
<td align='center'><input type='checkbox' name='post_special3' value='Y' checked='checked'></td>
|
|
</tr>
|
|
<tr class='data-even'>
|
|
<td align='left'><?php displayLanguageText('TEXT-TAXABLE'); ?>: </td>
|
|
<td align='center'><input type='checkbox' name='post_taxable' value='Y' checked='checked'></td>
|
|
</tr>
|
|
<tr class='data-odd'>
|
|
<td align='left'><?php displayLanguageText('TEXT-HOT-OR-COLD-FOOD-CLASSIFICATION'); ?>: </td>
|
|
<td align='center'><input type='checkbox' name='post_hot_cold_food' value='Y' checked='checked'></td>
|
|
</tr>
|
|
<tr class='data-even'>
|
|
<td align='left'><?php displayLanguageText('TEXT-MENU-ITEM-OPTIONS'); ?>: </td>
|
|
<td align='center'><input type='checkbox' name='post_options' value='Y' checked='checked'></td>
|
|
</tr>
|
|
<tr class='data-odd'>
|
|
<td align='left'><?php displayLanguageText('TEXT-ADDITIONAL-INFORMATION'); ?>: </td>
|
|
<td align='center'><input type='checkbox' name='post_nutritional' value='Y' checked='checked'></td>
|
|
</tr>
|
|
<tr class='data-even'>
|
|
<td align='left'><?php displayLanguageText('TEXT-PRODUCT-IMAGE'); ?>: </td>
|
|
<td align='center'><input type='checkbox' name='post_image' value='Y' checked='checked'></td>
|
|
</tr>
|
|
<tr class='data-odd'>
|
|
<td align='left'><?php displayLanguageText('TEXT-ITEM-MESSAGE'); ?>: </td>
|
|
<td align='center'><input type='checkbox' name='post_message' value='Y' checked='checked'></td>
|
|
</tr>
|
|
<?php if ($school_record['display_bc_food_guidelines'] == 'Y') { ?>
|
|
<tr class='data-even'>
|
|
<td align='left'><?php displayLanguageText('TEXT-FOOD-GUIDELINES-RATING'); ?>: </td>
|
|
<td align='center'><input type='checkbox' name='post_rating' value='Y' checked='checked'></td>
|
|
</tr>
|
|
<?php } ?>
|
|
</table>
|
|
<br>
|
|
<input type='submit' id='post-products' class='btn btn--primary' value='<?php displayLanguageText('TEXT-POST-TO-MENU'); ?>'>
|
|
<input type='hidden' name='action' value='supplier-products-post'>
|
|
<input type='hidden' name='naction' value='post'>
|
|
<input type='hidden' name='selected_supplier' value='<?php echo($selected_supplier) ?>'>
|
|
<br>
|
|
<?php
|
|
}
|
|
else {
|
|
?>
|
|
<p><b><?php displayLanguageText('MESSAGE-NO-SCHEDULES-AVAILABLE'); ?></b></p>
|
|
<?php
|
|
}
|
|
?>
|
|
<br>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</form>
|
|
<?php
|
|
break;
|
|
}
|
|
?>
|
|
<?php if ($naction != 'post') { ?>
|
|
<script language='javascript'>
|
|
function toggleProductCheckboxes() {
|
|
var cb = document.getElementById('select_all').checked;
|
|
|
|
if (cb == false) {
|
|
<?php
|
|
for ($i = 0; $i < count($all_products); $i++) {
|
|
$fname = $all_products[$i];
|
|
echo(" var $fname = document.getElementById('$fname');\n");
|
|
echo(" $fname.checked = false;\n");
|
|
}
|
|
?>
|
|
}
|
|
else {
|
|
<?php
|
|
for ($i = 0; $i < count($all_products); $i++) {
|
|
$fname = $all_products[$i];
|
|
echo(" var $fname = document.getElementById('$fname');\n");
|
|
echo(" $fname.checked = true;\n");
|
|
}
|
|
?>
|
|
}
|
|
}
|
|
|
|
$(document).ready(function() {
|
|
|
|
$("#post-products").click(function() {
|
|
var products_selected = false;
|
|
<?php
|
|
for ($i = 0; $i < count($all_products); $i++) {
|
|
$fname = $all_products[$i];
|
|
echo(" if (\$('#$fname').prop('checked')) products_selected = true;\n");
|
|
}
|
|
?>
|
|
if (products_selected == false) {
|
|
alert("<?php displayLanguageText('ERRORMSG-NO-PRODUCTS-SELECTED'); ?>");
|
|
return(false);
|
|
}
|
|
});
|
|
});
|
|
|
|
</script>
|
|
<?php } ?>
|
|
|
|
<?php
|
|
endTemplate();
|
|
?>
|