Commit 16f7bad9 authored by François Jacquet's avatar François Jacquet
Browse files

Fix PHP notice Undefined variable

parent 6113ba48
......@@ -62,7 +62,7 @@ DrawHeader( '<b>' . _( 'Report Timeframe' ) . ': </b>' .
echo '</form>';
// sort by date since the list is two lists merged and not already properly sorted
if ( ! $_REQUEST['LO_sort'])
if ( empty( $_REQUEST['LO_sort'] ) )
$_REQUEST['LO_sort'] = 'DATE';
$extra['functions'] = array('DEBIT' => '_makeCurrency','CREDIT' => '_makeCurrency','DATE' => 'ProperDate');
......
<?php
require_once 'modules/Accounting/functions.inc.php';
if ( ! $_REQUEST['print_statements'] )
if ( empty( $_REQUEST['print_statements'] ) )
{
DrawHeader( ProgramTitle() );
}
......
......@@ -2,7 +2,7 @@
require_once 'modules/Accounting/functions.inc.php';
if ( ! $_REQUEST['print_statements'] )
if ( empty( $_REQUEST['print_statements'] ) )
{
DrawHeader( ProgramTitle() );
}
......@@ -103,7 +103,7 @@ if ( ! $_REQUEST['modfunc'] )
'COMMENTS' => _( 'Comment' ),
);
if ( ! $_REQUEST['print_statements'] )
if ( empty( $_REQUEST['print_statements'] ) )
{
$link['add']['html'] = array(
'REMOVE' => button( 'add' ),
......@@ -114,7 +114,7 @@ if ( ! $_REQUEST['modfunc'] )
);
}
if ( ! $_REQUEST['print_statements'])
if ( empty( $_REQUEST['print_statements'] ) )
{
echo '<form action="Modules.php?modname='.$_REQUEST['modname'].'" method="POST">';
if (AllowEdit())
......
......@@ -4,7 +4,7 @@ require_once 'modules/Accounting/functions.inc.php';
if (User('PROFILE')=='teacher')//limit to teacher himself
$_REQUEST['staff_id'] = User('STAFF_ID');
if ( ! $_REQUEST['print_statements'] )
if ( empty( $_REQUEST['print_statements'] ) )
{
DrawHeader( ProgramTitle() );
......@@ -95,9 +95,9 @@ if (UserStaffID() && ! $_REQUEST['modfunc'])
$columns = array();
$columns += array('TITLE' => _('Salary'),'AMOUNT' => _('Amount'),'ASSIGNED_DATE' => _('Assigned'),'DUE_DATE' => _('Due'),'COMMENTS' => _('Comment'));
if ( ! $_REQUEST['print_statements'])
if ( empty( $_REQUEST['print_statements'] ) )
$link['add']['html'] = array('REMOVE'=>button('add'),'TITLE'=>_makeSalariesTextInput('','TITLE'),'AMOUNT'=>_makeSalariesTextInput('','AMOUNT'),'ASSIGNED_DATE'=>ProperDate(DBDate()),'DUE_DATE'=>_makeSalariesDateInput('','DUE_DATE'),'COMMENTS'=>_makeSalariesTextInput('','COMMENTS'));
if ( ! $_REQUEST['print_statements'])
if ( empty( $_REQUEST['print_statements'] ) )
{
echo '<form action="Modules.php?modname='.$_REQUEST['modname'].'" method="POST">';
if (AllowEdit())
......@@ -113,7 +113,7 @@ if (UserStaffID() && ! $_REQUEST['modfunc'])
echo '<div class="center">' . SubmitButton() . '</div>';
echo '<br />';
if ( ! $_REQUEST['print_statements'] )
if ( empty( $_REQUEST['print_statements'] ) )
{
$payments_total = DBGet(DBQuery("SELECT SUM(p.AMOUNT) AS TOTAL FROM ACCOUNTING_PAYMENTS p WHERE p.STAFF_ID='".UserStaffID()."' AND p.SYEAR='".UserSyear()."' AND p.SCHOOL_ID='".UserSchool()."'"));
......
......@@ -4,7 +4,7 @@ require_once 'modules/Accounting/functions.inc.php';
if (User('PROFILE')=='teacher')//limit to teacher himself
$_REQUEST['staff_id'] = User('STAFF_ID');
if ( ! $_REQUEST['print_statements'] )
if ( empty( $_REQUEST['print_statements'] ) )
{
DrawHeader( ProgramTitle() );
......
......@@ -4,12 +4,12 @@ require_once 'modules/Attendance/includes/UpdateAttendanceDaily.fnc.php';
DrawHeader( ProgramTitle() );
if ( ! $_REQUEST['month'] )
if ( empty( $_REQUEST['month'] ) )
{
$_REQUEST['month'] = date( 'm' );
}
if ( ! $_REQUEST['year'] )
if ( empty( $_REQUEST['year'] ) )
{
$_REQUEST['year'] = date( 'Y' );
}
......
......@@ -8,8 +8,8 @@ if ( $_REQUEST['table']=='')
if ( $_REQUEST['modfunc'] === 'update'
&& AllowEdit() )
{
if ( $_REQUEST['values']
&& $_POST['values'] )
if ( ! empty( $_REQUEST['values'] )
&& ! empty( $_POST['values'] ) )
{
foreach ( (array) $_REQUEST['values'] as $id => $columns )
{
......
......@@ -213,7 +213,7 @@ $cal_RET = DBGet( DBQuery( "SELECT DISTINCT SCHOOL_DATE,'_'||to_char(SCHOOL_DATE
//if (UserStudentID() || $_REQUEST['student_id'] || User('PROFILE')=='parent')
if ( $_REQUEST['student_id'] || User( 'PROFILE' ) === 'parent' )
{
if ( $_REQUEST['period_id'] )
if ( ! empty( $_REQUEST['period_id'] ) )
{
//FJ multiple school periods for a course period
/*$sql = "SELECT
......
......@@ -84,7 +84,7 @@ if ( $_REQUEST['search_modfunc'] || $_REQUEST['student_id'] || User('PROFILE')==
echo '</form>';
}
if ( $_REQUEST['period_id'])
if ( ! empty( $_REQUEST['period_id'] ) )
{
//FJ All periods
if ( $_REQUEST['period_id'] == 'all')
......
......@@ -171,7 +171,7 @@ if ( $_REQUEST['attendance']
if ($current_RET[ $student_id ][1]['ADMIN']!='Y')
$sql .= ",ATTENDANCE_CODE='".mb_substr($value,5)."'";
if ($_REQUEST['comment'][ $student_id ])
if ( ! empty( $_REQUEST['comment'][ $student_id ] ) )
$sql .= ",COMMENT='".trim($_REQUEST['comment'][ $student_id ])."'";
$sql .= " WHERE SCHOOL_DATE='".$date."' AND PERIOD_ID='".UserPeriod()."' AND STUDENT_ID='".$student_id."'";
......
......@@ -62,7 +62,7 @@ if ( ! $_REQUEST['modfunc'] )
//$extra['WHERE'] = " AND (adr.ADDRESS_ID IS NULL OR adr.ADDRESS_ID=sja.ADDRESS_ID)";
if ( $_REQUEST['address_group'] )
if ( ! empty( $_REQUEST['address_group'] ) )
{
$extra['SELECT'] .= ",coalesce((SELECT ADDRESS_ID
FROM STUDENTS_JOIN_ADDRESS
......@@ -160,7 +160,7 @@ if ( ! $_REQUEST['modfunc'] )
DrawHeader( str_replace( '<br />', '<br /> &nbsp;', mb_substr( $_ROSARIO['SearchTerms'], 0, -6 ) ) );
if ( ! $_REQUEST['LO_save'] )
if ( empty( $_REQUEST['LO_save'] ) )
{
$_SESSION['List_PHP_SELF'] = PreparePHP_SELF( $_SESSION['_REQUEST_vars'], array( 'bottom_back' ) );
......
......@@ -247,7 +247,7 @@ if ( isset( $_REQUEST['values'] )
}
// Save Student Info.
if ( $_REQUEST['students'] )
if ( ! empty( $_REQUEST['students'] ) )
{
$sql = "UPDATE STUDENTS SET ";
......
......@@ -143,11 +143,11 @@ echo ErrorMessage( $error );
echo ErrorMessage( $note, 'note' );
//if ( ! $_REQUEST['student_id'])
//if ( empty( $_REQUEST['student_id'] ) )
$extra['new'] = true;
if ( $_REQUEST['student_id'])
if ( ! empty( $_REQUEST['student_id'] ) )
echo '<br />';
Search('student_id',$extra);
......
......@@ -7,10 +7,10 @@ $extra['new'] = true;
$extra['action'] .= '&_ROSARIO_PDF=true';
if ( ! $_REQUEST['search_modfunc'] )
if ( empty( $_REQUEST['search_modfunc'] ) )
{
DrawHeader( ProgramTitle() );
$extra['second_col'] .= ReferralLogIncludeForm();
Search( 'student_id', $extra );
......
......@@ -198,13 +198,13 @@ function ReferralLogsGenerate( $extra )
foreach ( (array) $referrals as $referral )
{
// Entry Date
if ( $_REQUEST['elements']['ENTRY_DATE'] )
if ( ! empty( $_REQUEST['elements']['ENTRY_DATE'] ) )
{
DrawHeader( '<b>' . _( 'Date' ) . ': </b>' . ProperDate( $referral['ENTRY_DATE'] ) );
}
// Reporter
if ( $_REQUEST['elements']['STAFF_ID'] )
if ( ! empty( $_REQUEST['elements']['STAFF_ID'] ) )
{
DrawHeader( '<b>' . _( 'Reporter' ) .': </b>' . GetTeacher( $referral['STAFF_ID'] ) );
}
......
......@@ -7,7 +7,7 @@ foreach ( (array) $eligibility_config as $value )
${$value[1]['TITLE']} = $value[1]['VALUE'];
}
if ( $_REQUEST['values'])
if ( ! empty( $_REQUEST['values'] ) )
{
if ( $_REQUEST['values']['START_M']=='PM')
$_REQUEST['values']['START_HOUR']+=12;
......
......@@ -82,7 +82,7 @@ if ( UserStudentID()
$start = time() - ($today-$START_DAY)*60*60*24;
if ( ! $_REQUEST['start_date'] )
if ( empty( $_REQUEST['start_date'] ) )
{
$start_time = $start;
......
......@@ -34,7 +34,7 @@ switch (date('D'))
$start = time() - ($today-$START_DAY)*60*60*24;
if ( ! $_REQUEST['start_date'] )
if ( empty( $_REQUEST['start_date'] ) )
{
$start_time = $start;
......
......@@ -38,7 +38,7 @@ switch (date('D'))
$start = time() - ($today-$START_DAY)*60*60*24;
if ( ! $_REQUEST['start_date'] )
if ( empty( $_REQUEST['start_date'] ) )
{
$start_time = $start;
......@@ -137,7 +137,7 @@ foreach ( (array) $RET as $staff_id => $periods )
$i++;
$staff_RET[ $i ]['FULL_NAME'] = $periods[ key( $periods ) ][1]['FULL_NAME'];
if ( ! $_REQUEST['period'] )
if ( empty( $_REQUEST['period'] ) )
{
foreach ( (array) $periods as $period_id => $course_periods )
{
......@@ -167,7 +167,7 @@ foreach ( (array) $RET as $staff_id => $periods )
$columns = array( 'FULL_NAME' => _( 'Teacher' ) );
if ( ! $_REQUEST['period'] )
if ( empty( $_REQUEST['period'] ) )
{
foreach ( (array) $periods_RET as $period )
{
......
......@@ -3,7 +3,7 @@
if ( ! $_SESSION['FSA_type'])
$_SESSION['FSA_type'] = 'student';
if ( $_REQUEST['type'])
if ( ! empty( $_REQUEST['type'] ) )
$_SESSION['FSA_type'] = $_REQUEST['type'];
else
$_SESSION['_REQUEST_vars']['type'] = $_REQUEST['type'] = $_SESSION['FSA_type'];
......
......@@ -21,7 +21,7 @@ if ( empty( $date ) )
$date = $_REQUEST['year_date'] . '-' . $_REQUEST['month_date'] . '-' . $_REQUEST['day_date'];
}
if ( $_REQUEST['type'])
if ( ! empty( $_REQUEST['type'] ) )
$_SESSION['FSA_type'] = $_REQUEST['type'];
else
$_SESSION['_REQUEST_vars']['type'] = $_REQUEST['type'] = $_SESSION['FSA_type'];
......
......@@ -21,7 +21,7 @@ if ( empty( $date ) )
$date = $_REQUEST['year_date'] . '-' . $_REQUEST['month_date'] . '-' . $_REQUEST['day_date'];
}
if ( $_REQUEST['type'])
if ( ! empty( $_REQUEST['type'] ) )
$_SESSION['FSA_type'] = $_REQUEST['type'];
else
$_SESSION['_REQUEST_vars']['type'] = $_REQUEST['type'] = $_SESSION['FSA_type'];
......
......@@ -2,12 +2,12 @@
DrawHeader( ProgramTitle() );
if ( ! $_REQUEST['month'] )
if ( empty( $_REQUEST['month'] ) )
{
$_REQUEST['month'] = date( 'm' );
}
if ( ! $_REQUEST['year'] )
if ( empty( $_REQUEST['year'] ) )
{
$_REQUEST['year'] = date( 'Y' );
}
......@@ -33,7 +33,7 @@ else
}
$menus_RET = DBGet(DBQuery('SELECT MENU_ID,TITLE FROM FOOD_SERVICE_MENUS WHERE SCHOOL_ID=\''.UserSchool().'\' ORDER BY SORT_ORDER'),array(),array('MENU_ID'));
if ( ! $_REQUEST['menu_id'])
if ( empty( $_REQUEST['menu_id'] ) )
if ( ! $_SESSION['FSA_menu_id'])
if (count($menus_RET))
$_REQUEST['menu_id'] = $_SESSION['FSA_menu_id'] = key($menus_RET);
......@@ -73,7 +73,7 @@ if ( $_REQUEST['submit']['save']
RedirectURL( 'food_service' );
}
if ( $_REQUEST['submit']['print'] )
if ( ! empty( $_REQUEST['submit']['print'] ) )
{
$events_RET = DBGet(DBQuery("SELECT TITLE,DESCRIPTION,SCHOOL_DATE
FROM CALENDAR_EVENTS
......@@ -86,7 +86,7 @@ if ( $_REQUEST['submit']['print'] )
echo '<br /><table class="width-100p">';
if ( $_REQUEST['_ROSARIO_PDF'] )
if ( ! empty( $_REQUEST['_ROSARIO_PDF'] ) )
{
// Landscape PDF.
$_SESSION['orientation'] = 'landscape';
......
......@@ -5,11 +5,11 @@ DrawHeader( ProgramTitle() );
if ( $_REQUEST['modfunc'] === 'update' )
{
if ( $_REQUEST['values']
&& $_POST['values']
if ( ! empty( $_REQUEST['values'] )
&& ! empty( $_POST['values'] )
&& AllowEdit() )
{
if ( $_REQUEST['tab_id'] )
if ( ! empty( $_REQUEST['tab_id'] ) )
{
foreach ( (array) $_REQUEST['values'] as $id => $columns)
{
......@@ -20,7 +20,11 @@ if ( $_REQUEST['modfunc'] === 'update' )
{
//FJ fix SQL bug PRICE_STAFF & PRICE not null
//FJ fix SQL bug PRICE_FREE & PRICE_REDUCED numeric
if ( $_REQUEST['tab_id']!='new' || ((empty($columns['PRICE_FREE']) || is_numeric($columns['PRICE_FREE'])) && (empty($columns['PRICE_REDUCED']) || is_numeric($columns['PRICE_REDUCED'])) && (empty($columns['PRICE_STAFF']) || is_numeric($columns['PRICE_STAFF'])) && (empty($columns['PRICE']) || is_numeric($columns['PRICE']))))
if ( $_REQUEST['tab_id'] !== 'new'
|| ( ( empty( $columns['PRICE_FREE'] ) || is_numeric( $columns['PRICE_FREE'] ) )
&& ( empty( $columns['PRICE_REDUCED'] ) || is_numeric( $columns['PRICE_REDUCED'] ) )
&& ( empty( $columns['PRICE_STAFF'] ) || is_numeric( $columns['PRICE_STAFF'] ) )
&& ( empty( $columns['PRICE'] ) || is_numeric( $columns['PRICE'] ) ) ) )
{
if ( $_REQUEST['tab_id']!='new')
......@@ -80,12 +84,19 @@ if ( $_REQUEST['modfunc'] === 'update' )
}
if ( $go )
{
//FJ fix SQL bug PRICE_STAFF & PRICE not null
//FJ fix SQL bug PRICE_FREE & PRICE_REDUCED numeric
if ( $_REQUEST['tab_id']!='new' || ((empty($columns['PRICE_FREE']) || is_numeric($columns['PRICE_FREE'])) && (empty($columns['PRICE_REDUCED']) || is_numeric($columns['PRICE_REDUCED'])) && is_numeric($columns['PRICE_STAFF']) && is_numeric($columns['PRICE']) ))
DBQuery($sql);
if ( $_REQUEST['tab_id'] !== 'new'
|| ( ( empty( $columns['PRICE_FREE'] ) || is_numeric( $columns['PRICE_FREE'] ) )
&& ( empty($columns['PRICE_REDUCED'] ) || is_numeric( $columns['PRICE_REDUCED'] ) )
&& is_numeric( $columns['PRICE_STAFF'] ) && is_numeric( $columns['PRICE'] ) ) )
{
DBQuery( $sql );
}
else
$error[] = _('Please enter valid Numeric data.');
}
}
}
else
......@@ -129,7 +140,7 @@ if ( $_REQUEST['modfunc'] === 'remove'
if ( ! $_REQUEST['modfunc'] )
{
$menus_RET = DBGet(DBQuery('SELECT MENU_ID,TITLE FROM FOOD_SERVICE_MENUS WHERE SCHOOL_ID=\''.UserSchool().'\' ORDER BY SORT_ORDER'),array(),array('MENU_ID'));
if ( $_REQUEST['tab_id'])
if ( ! empty( $_REQUEST['tab_id'] ) )
{
if ( $_REQUEST['tab_id']!='new')
if ( $menus_RET[$_REQUEST['tab_id']])
......
......@@ -45,7 +45,7 @@ if ( empty( $end_date ) )
DrawHeader(ProgramTitle());
$menus_RET = DBGet(DBQuery("SELECT MENU_ID,TITLE FROM FOOD_SERVICE_MENUS WHERE SCHOOL_ID='".UserSchool()."' ORDER BY SORT_ORDER"),array(),array('MENU_ID'));
if ( $_REQUEST['menu_id'])
if ( ! empty( $_REQUEST['menu_id'] ) )
{
if ( $_REQUEST['menu_id']!='new')
if ( $menus_RET[$_REQUEST['menu_id']])
......@@ -120,42 +120,42 @@ $type_select = '<select name="type_select" onchange="ajaxPostForm(this.form,true
//$calendars_RET = DBGet(DBQuery("SELECT acs.CALENDAR_ID,(SELECT count(1) FROM ATTENDANCE_CALENDAR WHERE CALENDAR_ID=acs.CALENDAR_ID AND SCHOOL_DATE BETWEEN '".$start_date."' AND '".$end_date."') AS DAY_COUNT FROM ATTENDANCE_CALENDARS acs WHERE acs.SCHOOL_ID='".UserSchool()."' AND SYEAR='".UserSyear()."'"));
$RET = DBGet(DBQuery("SELECT 'Student' AS TYPE, fssa.DISCOUNT,count(1) AS DAYS,(SELECT count(1) FROM ATTENDANCE_CALENDAR WHERE CALENDAR_ID=ac.CALENDAR_ID AND SCHOOL_DATE BETWEEN '".$start_date."' AND '".$end_date."') AS ELLIGIBLE
FROM FOOD_SERVICE_STUDENT_ACCOUNTS fssa,STUDENT_ENROLLMENT ssm,ATTENDANCE_CALENDAR ac
WHERE ac.CALENDAR_ID=ssm.CALENDAR_ID
AND ac.SCHOOL_DATE BETWEEN '".$start_date."' AND '".$end_date."'
AND fssa.STATUS IS NULL
AND ssm.STUDENT_ID=fssa.STUDENT_ID
AND ssm.SYEAR='".UserSyear()."'
AND ssm.SCHOOL_ID='".UserSchool()."'
AND (ac.SCHOOL_DATE BETWEEN ssm.START_DATE AND ssm.END_DATE OR ssm.END_DATE IS NULL AND ac.SCHOOL_DATE>=ssm.START_DATE)
$RET = DBGet(DBQuery("SELECT 'Student' AS TYPE, fssa.DISCOUNT,count(1) AS DAYS,(SELECT count(1) FROM ATTENDANCE_CALENDAR WHERE CALENDAR_ID=ac.CALENDAR_ID AND SCHOOL_DATE BETWEEN '".$start_date."' AND '".$end_date."') AS ELLIGIBLE
FROM FOOD_SERVICE_STUDENT_ACCOUNTS fssa,STUDENT_ENROLLMENT ssm,ATTENDANCE_CALENDAR ac
WHERE ac.CALENDAR_ID=ssm.CALENDAR_ID
AND ac.SCHOOL_DATE BETWEEN '".$start_date."' AND '".$end_date."'
AND fssa.STATUS IS NULL
AND ssm.STUDENT_ID=fssa.STUDENT_ID
AND ssm.SYEAR='".UserSyear()."'
AND ssm.SCHOOL_ID='".UserSchool()."'
AND (ac.SCHOOL_DATE BETWEEN ssm.START_DATE AND ssm.END_DATE OR ssm.END_DATE IS NULL AND ac.SCHOOL_DATE>=ssm.START_DATE)
GROUP BY fssa.DISCOUNT,ac.CALENDAR_ID"),array('ELLIGIBLE' => 'bump_dep','DAYS' => 'bump_dep'));
//echo '<pre>'; var_dump($RET); echo '</pre>';
$RET = DBGet(DBQuery("SELECT 'User' AS TYPE,'' AS DISCOUNT,count(1) AS DAYS,(SELECT count(1) FROM ATTENDANCE_CALENDAR WHERE CALENDAR_ID=ac.CALENDAR_ID AND SCHOOL_DATE BETWEEN '".$start_date."' AND '".$end_date."') AS ELLIGIBLE
FROM FOOD_SERVICE_STAFF_ACCOUNTS fssa,STAFF s,ATTENDANCE_CALENDAR ac
WHERE ac.CALENDAR_ID=(SELECT CALENDAR_ID FROM ATTENDANCE_CALENDARS WHERE SCHOOL_ID='".UserSchool()."' AND SYEAR='".UserSyear()."' AND DEFAULT_CALENDAR='Y')
AND ac.SCHOOL_DATE BETWEEN '".$start_date."' AND '".$end_date."'
AND fssa.STATUS IS NULL
AND s.STAFF_ID=fssa.STAFF_ID
AND (s.SCHOOLS IS NULL OR position(','||'".UserSchool()."'||',' IN s.SCHOOLS)>0)
$RET = DBGet(DBQuery("SELECT 'User' AS TYPE,'' AS DISCOUNT,count(1) AS DAYS,(SELECT count(1) FROM ATTENDANCE_CALENDAR WHERE CALENDAR_ID=ac.CALENDAR_ID AND SCHOOL_DATE BETWEEN '".$start_date."' AND '".$end_date."') AS ELLIGIBLE
FROM FOOD_SERVICE_STAFF_ACCOUNTS fssa,STAFF s,ATTENDANCE_CALENDAR ac
WHERE ac.CALENDAR_ID=(SELECT CALENDAR_ID FROM ATTENDANCE_CALENDARS WHERE SCHOOL_ID='".UserSchool()."' AND SYEAR='".UserSyear()."' AND DEFAULT_CALENDAR='Y')
AND ac.SCHOOL_DATE BETWEEN '".$start_date."' AND '".$end_date."'
AND fssa.STATUS IS NULL
AND s.STAFF_ID=fssa.STAFF_ID
AND (s.SCHOOLS IS NULL OR position(','||'".UserSchool()."'||',' IN s.SCHOOLS)>0)
GROUP BY ac.CALENDAR_ID"),array('ELLIGIBLE' => 'bump_dep','DAYS' => 'bump_dep'));
//echo '<pre>'; var_dump($RET); echo '</pre>';
$RET = DBGet(DBQuery("SELECT DISTINCT ON (STUDENT_ID) 'Student' AS TYPE, DISCOUNT,count(1) AS PARTICIPATED
FROM FOOD_SERVICE_TRANSACTIONS
WHERE SYEAR='".UserSyear()."'
AND SHORT_NAME='".$menus_RET[$_REQUEST['menu_id']][1]['TITLE']."'
AND TIMESTAMP BETWEEN '".$start_date."' AND date '".$end_date."' +1
AND SCHOOL_ID='".UserSchool()."'
$RET = DBGet(DBQuery("SELECT DISTINCT ON (STUDENT_ID) 'Student' AS TYPE, DISCOUNT,count(1) AS PARTICIPATED
FROM FOOD_SERVICE_TRANSACTIONS
WHERE SYEAR='".UserSyear()."'
AND SHORT_NAME='".$menus_RET[$_REQUEST['menu_id']][1]['TITLE']."'
AND TIMESTAMP BETWEEN '".$start_date."' AND date '".$end_date."' +1
AND SCHOOL_ID='".UserSchool()."'
GROUP BY STUDENT_ID,DISCOUNT"),array('PARTICIPATED' => 'bump_dep'));
$RET = DBGet(DBQuery("SELECT DISTINCT ON (STAFF_ID) 'User' AS TYPE,'' AS DISCOUNT,count(1) AS PARTICIPATED
FROM FOOD_SERVICE_STAFF_TRANSACTIONS
WHERE SYEAR='".UserSyear()."'
AND SHORT_NAME='".$menus_RET[$_REQUEST['menu_id']][1]['TITLE']."'
AND TIMESTAMP BETWEEN '".$start_date."' AND date '".$end_date."' +1
AND SCHOOL_ID='".UserSchool()."'
$RET = DBGet(DBQuery("SELECT DISTINCT ON (STAFF_ID) 'User' AS TYPE,'' AS DISCOUNT,count(1) AS PARTICIPATED
FROM FOOD_SERVICE_STAFF_TRANSACTIONS
WHERE SYEAR='".UserSyear()."'
AND SHORT_NAME='".$menus_RET[$_REQUEST['menu_id']][1]['TITLE']."'
AND TIMESTAMP BETWEEN '".$start_date."' AND date '".$end_date."' +1
AND SCHOOL_ID='".UserSchool()."'
GROUP BY STAFF_ID"),array('PARTICIPATED' => 'bump_dep'));
//FJ add translation
......@@ -163,21 +163,21 @@ $users_locale = array('Student' => _('Student'), 'User' => _('User'));
if ( $_REQUEST['type_select']=='sales')
{
$RET = DBGet(DBQuery("SELECT 'Student' AS TYPE,fsti.SHORT_NAME,fst.DISCOUNT,-sum((SELECT AMOUNT FROM FOOD_SERVICE_TRANSACTION_ITEMS WHERE TRANSACTION_ID=fsti.TRANSACTION_ID AND ITEM_ID=fsti.ITEM_ID)) AS COUNT
FROM FOOD_SERVICE_TRANSACTIONS fst,FOOD_SERVICE_TRANSACTION_ITEMS fsti
WHERE fsti.TRANSACTION_ID=fst.TRANSACTION_ID
AND fst.SYEAR='".UserSyear()."'
AND fst.SCHOOL_ID='".UserSchool()."'
AND fst.SHORT_NAME='".$menus_RET[$_REQUEST['menu_id']][1]['TITLE']."'
AND fst.TIMESTAMP BETWEEN '".$start_date."' AND date '".$end_date."' +1
$RET = DBGet(DBQuery("SELECT 'Student' AS TYPE,fsti.SHORT_NAME,fst.DISCOUNT,-sum((SELECT AMOUNT FROM FOOD_SERVICE_TRANSACTION_ITEMS WHERE TRANSACTION_ID=fsti.TRANSACTION_ID AND ITEM_ID=fsti.ITEM_ID)) AS COUNT
FROM FOOD_SERVICE_TRANSACTIONS fst,FOOD_SERVICE_TRANSACTION_ITEMS fsti
WHERE fsti.TRANSACTION_ID=fst.TRANSACTION_ID
AND fst.SYEAR='".UserSyear()."'
AND fst.SCHOOL_ID='".UserSchool()."'
AND fst.SHORT_NAME='".$menus_RET[$_REQUEST['menu_id']][1]['TITLE']."'
AND fst.TIMESTAMP BETWEEN '".$start_date."' AND date '".$end_date."' +1
GROUP BY fsti.SHORT_NAME,fst.DISCOUNT"),array('SHORT_NAME' => 'bump_count'));
$RET = DBGet(DBQuery("SELECT 'User' AS TYPE,fsti.SHORT_NAME,'' AS DISCOUNT,-sum((SELECT sum(AMOUNT) FROM FOOD_SERVICE_STAFF_TRANSACTION_ITEMS WHERE TRANSACTION_ID=fsti.TRANSACTION_ID AND SHORT_NAME=fsti.SHORT_NAME)) AS COUNT
FROM FOOD_SERVICE_STAFF_TRANSACTIONS fst,FOOD_SERVICE_STAFF_TRANSACTION_ITEMS fsti
WHERE fsti.TRANSACTION_ID=fst.TRANSACTION_ID
AND fst.SYEAR='".UserSyear()."'
AND fst.SCHOOL_ID='".UserSchool()."'
AND fst.SHORT_NAME='".$menus_RET[$_REQUEST['menu_id']][1]['TITLE']."'
AND fst.TIMESTAMP BETWEEN '".$start_date."' AND date '".$end_date."' +1
$RET = DBGet(DBQuery("SELECT 'User' AS TYPE,fsti.SHORT_NAME,'' AS DISCOUNT,-sum((SELECT sum(AMOUNT) FROM FOOD_SERVICE_STAFF_TRANSACTION_ITEMS WHERE TRANSACTION_ID=fsti.TRANSACTION_ID AND SHORT_NAME=fsti.SHORT_NAME)) AS COUNT
FROM FOOD_SERVICE_STAFF_TRANSACTIONS fst,FOOD_SERVICE_STAFF_TRANSACTION_ITEMS fsti
WHERE fsti.TRANSACTION_ID=fst.TRANSACTION_ID
AND fst.SYEAR='".UserSyear()."'
AND fst.SCHOOL_ID='".UserSchool()."'
AND fst.SHORT_NAME='".$menus_RET[$_REQUEST['menu_id']][1]['TITLE']."'
AND fst.TIMESTAMP BETWEEN '".$start_date."' AND date '".$end_date."' +1
GROUP BY fsti.SHORT_NAME"),array('SHORT_NAME' => 'bump_count'));
$LO_types = array(0 => array(array()));
......@@ -205,21 +205,21 @@ if ( $_REQUEST['type_select']=='sales')
}
else
{
$RET = DBGet(DBQuery("SELECT 'Student' AS TYPE,fst.DISCOUNT,fsti.SHORT_NAME,count(*)
FROM FOOD_SERVICE_TRANSACTIONS fst,FOOD_SERVICE_TRANSACTION_ITEMS fsti
WHERE fsti.TRANSACTION_ID=fst.TRANSACTION_ID
AND fst.SYEAR='".UserSyear()."'
AND fst.SCHOOL_ID='".UserSchool()."'
AND fst.SHORT_NAME='".$menus_RET[$_REQUEST['menu_id']][1]['TITLE']."'
AND fst.TIMESTAMP BETWEEN '".$start_date."' AND date '".$end_date."' +1
$RET = DBGet(DBQuery("SELECT 'Student' AS TYPE,fst.DISCOUNT,fsti.SHORT_NAME,count(*)
FROM FOOD_SERVICE_TRANSACTIONS fst,FOOD_SERVICE_TRANSACTION_ITEMS fsti
WHERE fsti.TRANSACTION_ID=fst.TRANSACTION_ID
AND fst.SYEAR='".UserSyear()."'
AND fst.SCHOOL_ID='".UserSchool()."'
AND fst.SHORT_NAME='".$menus_RET[$_REQUEST['menu_id']][1]['TITLE']."'
AND fst.TIMESTAMP BETWEEN '".$start_date."' AND date '".$end_date."' +1
GROUP BY fsti.SHORT_NAME,fst.DISCOUNT"),array('SHORT_NAME' => 'bump_count'));
$RET = DBGet(DBQuery("SELECT 'User' AS TYPE,'' AS DISCOUNT,fsti.SHORT_NAME,count(*)
FROM FOOD_SERVICE_STAFF_TRANSACTIONS fst,FOOD_SERVICE_STAFF_TRANSACTION_ITEMS fsti
WHERE fsti.TRANSACTION_ID=fst.TRANSACTION_ID
AND fst.SYEAR='".UserSyear()."'
AND fst.SCHOOL_ID='".UserSchool()."'
AND fst.SHORT_NAME='".$menus_RET[$_REQUEST['menu_id']][1]['TITLE']."'
AND fst.TIMESTAMP BETWEEN '".$start_date."' AND date '".$end_date."' +1
$RET = DBGet(DBQuery("SELECT 'User' AS TYPE,'' AS DISCOUNT,fsti.SHORT_NAME,count(*)
FROM FOOD_SERVICE_STAFF_TRANSACTIONS fst,FOOD_SERVICE_STAFF_TRANSACTION_ITEMS fsti
WHERE fsti.TRANSACTION_ID=fst.TRANSACTION_ID
AND fst.SYEAR='".UserSyear()."'
AND fst.SCHOOL_ID='".UserSchool()."'