Files
HotLunches/suppliers.php
T
2026-10-19 15:22:52 -07:00

86 lines
2.9 KiB
PHP

<?php
require_once("include/globals.php");
if (SessionActive() != 1 || ! UserLoggedIn()) {
header("Location: /");
exit();
}
//
// Process all actions to list and edit records
//
$CurrentTable = "suppliers";
$FormFile = "suppliers.dialog.php";
$JQueryFile = "suppliers.js.php";
$DialogWidth = 850;
$DialogHeight = 450;
$TitleText = getLanguageText('TEXT-SUPPLIERS');
$SequenceFlag = 'N';
$tableAction = "suppliers-list";
$RequiredFields = array('supplier_name','contact_name');
$CustomDialogFields = array(
array('field_name' => 'supplier_password', 'default' => '', 'ftype' => 'form-data'),
);
// Ensure that only valid user types have access to this module
$AllowedUserTypes = array('SuperUser','System Administrator','Application Administrator');
if (checkPermission($AllowedUserTypes) != 1) {
$error_message = getLanguageText('ERRORMSG-ACCESS-DENIED');
include "form.messages.php";
endTemplate();
exit();
}
// Start the template and output buffering
startTemplate();
$templatePageTitle = getLanguageText('TEXT-SUPPLIERS');
$headerArgs = "";
include "form.js.php";
?>
<table cellpadding='4' cellspacing='2' border='0' align='right'>
<tr>
<td align='center'><a href='?action=suppliers-report' class='btn btn--primary btn--xsmall'><span><?php displayLanguageText('TEXT-SUPPLIER-REPORT'); ?></span></a></td>
<td align='center'><a href='?action=supplier-products-print' class='btn btn--primary btn--xsmall'><span><?php displayLanguageText('TEXT-SUPPLIER-PRODUCTS-REPORT') ?></span></a></td>
<td align='center'><a href='#' id='list-active-suppliers' class='btn btn--primary btn--xsmall'><span><?php displayLanguageText('TEXT-LIST-ACTIVE') ?></span></a></td>
<td align='center'><a href='#' id='list-all-suppliers' class='btn btn--primary btn--xsmall'><span><?php displayLanguageText('TEXT-LIST-ALL') ?></span></a></td>
</tr>
</table>
<script>
$(document).ready(function() {
$(document).on('click touch', '.edit-record', function() {
var school_num = '<?php echo($school_num) ?>';
var asnum = $(this).attr('asnum');
if (school_num != asnum) {
alert("<?php displayLanguageText('TEXT-EDIT-NOT-PERMITTED'); ?>");
return false;
}
});
$(document).on('click touch', '.delete-record', function() {
var school_num = '<?php echo($school_num) ?>';
var dflag = $(this).attr('dflag');
var asnum = $(this).attr('asnum');
if (dflag == 'N') {
alert("<?php displayLanguageText('TEXT-DELETE-NOT-PERMITTED'); ?>");
return false;
}
if (school_num != asnum) {
alert("<?php displayLanguageText('TEXT-DELETE-NOT-PERMITTED'); ?>");
return false;
}
});
});
</script>
<?php
endTemplate();
?>