Commit 8b644e88 authored by François Jacquet's avatar François Jacquet
Browse files

Remove isset & empty checks for $_REQUEST['modfunc']

$_REQUEST['modfunc'] is always set (see Modules.php)
parent ebf77acf
......@@ -11,8 +11,7 @@
require_once 'Warehouse.php';
// Print PDF.
if ( isset( $_REQUEST['modfunc'] )
&& $_REQUEST['modfunc'] === 'print' ) :
if ( $_REQUEST['modfunc'] === 'print' ) :
if ( $_REQUEST['expanded_view'] )
{
......@@ -49,8 +48,7 @@ if ( isset( $_REQUEST['modfunc'] )
// Inline Help.
elseif ( isset( $_REQUEST['modfunc'] ) &&
$_REQUEST['modfunc'] === 'help' ) :
elseif ( $_REQUEST['modfunc'] === 'help' ) :
$help_translated = 'Help_' . mb_substr( $locale, 0, 2 ) . '.php';
$help_english = 'Help_en.php';
......
......@@ -7,6 +7,7 @@ Changes in 2.9.1
- Use ReportCards.fnc.php functions in FinalGrades.php
- Add TipMessage with Student YTD & Period attendance in FinalGrades.php
- Fix logo image overlapped in Report Cards
- Remove isset & empty checks for $_REQUEST['modfunc'], program wide
Changes in 2.9
--------------
......
......@@ -13,8 +13,7 @@ $default_session_name = session_name();
require_once 'Warehouse.php';
// Logout.
if ( isset( $_REQUEST['modfunc'] )
&& $_REQUEST['modfunc'] === 'logout' )
if ( $_REQUEST['modfunc'] === 'logout' )
{
// FJ set logout page to old session locale.
$old_session_locale = $_SESSION['locale'];
......@@ -153,7 +152,7 @@ elseif ( isset( $_POST['USERNAME'] )
</body>
</html>
<?php
<?php
// Set Config( 'LOGIN' ) to Yes.
DBQuery( "UPDATE CONFIG
SET CONFIG_VALUE='Yes'
......
......@@ -14,7 +14,7 @@ if ( ! $_REQUEST['year'] )
else
$_REQUEST['year'] = ($_REQUEST['year']<1900?'20'.$_REQUEST['year']:$_REQUEST['year']);
if (isset($_REQUEST['modfunc']) && $_REQUEST['modfunc']=='save')
if ( $_REQUEST['modfunc'] === 'save' )
{
if (count($_REQUEST['period']) && count($_REQUEST['student']) && count($_REQUEST['dates']))
{
......@@ -26,11 +26,11 @@ if (isset($_REQUEST['modfunc']) && $_REQUEST['modfunc']=='save')
$students_list .= ",'".$student_id."'";
$students_list = '('.mb_substr($students_list,1).')';
$current_RET = DBGet(DBQuery("SELECT STUDENT_ID,PERIOD_ID,SCHOOL_DATE
FROM ATTENDANCE_PERIOD
WHERE EXTRACT(MONTH FROM SCHOOL_DATE)='".($_REQUEST['month']*1)."'
AND EXTRACT(YEAR FROM SCHOOL_DATE)='".$_REQUEST['year']."'
AND PERIOD_ID IN ".$periods_list."
$current_RET = DBGet(DBQuery("SELECT STUDENT_ID,PERIOD_ID,SCHOOL_DATE
FROM ATTENDANCE_PERIOD
WHERE EXTRACT(MONTH FROM SCHOOL_DATE)='".($_REQUEST['month']*1)."'
AND EXTRACT(YEAR FROM SCHOOL_DATE)='".$_REQUEST['year']."'
AND PERIOD_ID IN ".$periods_list."
AND STUDENT_ID IN ".$students_list),array(),array('STUDENT_ID','SCHOOL_DATE','PERIOD_ID'));
$state_code = DBGet(DBQuery("SELECT STATE_CODE FROM ATTENDANCE_CODES WHERE ID='".$_REQUEST['absence_code']."'"));
$state_code = $state_code[1]['STATE_CODE'];
......@@ -44,29 +44,29 @@ if (isset($_REQUEST['modfunc']) && $_REQUEST['modfunc']=='save')
//FJ multiple school periods for a course period
if (SchoolInfo('NUMBER_DAYS_ROTATION') !== null)
{
$course_periods_RET = DBGet(DBQuery("SELECT s.COURSE_PERIOD_ID,cpsp.PERIOD_ID,cp.HALF_DAY
FROM SCHEDULE s,COURSE_PERIODS cp,ATTENDANCE_CALENDAR ac,SCHOOL_PERIODS sp,COURSE_PERIOD_SCHOOL_PERIODS cpsp
WHERE cp.COURSE_PERIOD_ID=cpsp.COURSE_PERIOD_ID
AND sp.PERIOD_ID=cpsp.PERIOD_ID
AND ac.SCHOOL_DATE='".$date."'
AND ac.CALENDAR_ID=cp.CALENDAR_ID
AND (ac.BLOCK=sp.BLOCK OR sp.BLOCK IS NULL)
AND s.COURSE_PERIOD_ID=cp.COURSE_PERIOD_ID
AND s.STUDENT_ID='".$student_id."'
AND cpsp.PERIOD_ID IN ".$periods_list."
AND position(',0,' IN cp.DOES_ATTENDANCE)>0
AND (ac.SCHOOL_DATE BETWEEN s.START_DATE AND s.END_DATE OR (s.END_DATE IS NULL AND ac.SCHOOL_DATE>=s.START_DATE))
$course_periods_RET = DBGet(DBQuery("SELECT s.COURSE_PERIOD_ID,cpsp.PERIOD_ID,cp.HALF_DAY
FROM SCHEDULE s,COURSE_PERIODS cp,ATTENDANCE_CALENDAR ac,SCHOOL_PERIODS sp,COURSE_PERIOD_SCHOOL_PERIODS cpsp
WHERE cp.COURSE_PERIOD_ID=cpsp.COURSE_PERIOD_ID
AND sp.PERIOD_ID=cpsp.PERIOD_ID
AND ac.SCHOOL_DATE='".$date."'
AND ac.CALENDAR_ID=cp.CALENDAR_ID
AND (ac.BLOCK=sp.BLOCK OR sp.BLOCK IS NULL)
AND s.COURSE_PERIOD_ID=cp.COURSE_PERIOD_ID
AND s.STUDENT_ID='".$student_id."'
AND cpsp.PERIOD_ID IN ".$periods_list."
AND position(',0,' IN cp.DOES_ATTENDANCE)>0
AND (ac.SCHOOL_DATE BETWEEN s.START_DATE AND s.END_DATE OR (s.END_DATE IS NULL AND ac.SCHOOL_DATE>=s.START_DATE))
AND position(substring('MTWHFSU' FROM cast(
(SELECT CASE COUNT(school_date)% ".SchoolInfo('NUMBER_DAYS_ROTATION')." WHEN 0 THEN ".SchoolInfo('NUMBER_DAYS_ROTATION')." ELSE COUNT(school_date)% ".SchoolInfo('NUMBER_DAYS_ROTATION')." END AS day_number
FROM attendance_calendar
WHERE school_date>=(SELECT start_date FROM school_marking_periods WHERE start_date<=ac.SCHOOL_DATE AND end_date>=ac.SCHOOL_DATE AND mp='QTR' AND SCHOOL_ID=ac.SCHOOL_ID)
AND school_date<=ac.SCHOOL_DATE
(SELECT CASE COUNT(school_date)% ".SchoolInfo('NUMBER_DAYS_ROTATION')." WHEN 0 THEN ".SchoolInfo('NUMBER_DAYS_ROTATION')." ELSE COUNT(school_date)% ".SchoolInfo('NUMBER_DAYS_ROTATION')." END AS day_number
FROM attendance_calendar
WHERE school_date>=(SELECT start_date FROM school_marking_periods WHERE start_date<=ac.SCHOOL_DATE AND end_date>=ac.SCHOOL_DATE AND mp='QTR' AND SCHOOL_ID=ac.SCHOOL_ID)
AND school_date<=ac.SCHOOL_DATE
AND SCHOOL_ID=ac.SCHOOL_ID)
AS INT) FOR 1) IN cpsp.DAYS)>0
AND s.MARKING_PERIOD_ID IN (".$all_mp.")
AS INT) FOR 1) IN cpsp.DAYS)>0
AND s.MARKING_PERIOD_ID IN (".$all_mp.")
AND ac.SCHOOL_ID=s.SCHOOL_ID"),array(),array('PERIOD_ID'));
} else {
$course_periods_RET = DBGet(DBQuery("SELECT s.COURSE_PERIOD_ID,cpsp.PERIOD_ID,cp.HALF_DAY FROM SCHEDULE s,COURSE_PERIODS cp,ATTENDANCE_CALENDAR ac,SCHOOL_PERIODS sp,COURSE_PERIOD_SCHOOL_PERIODS cpsp WHERE sp.PERIOD_ID=cpsp.PERIOD_ID AND ac.SCHOOL_DATE='".$date."' AND ac.CALENDAR_ID=cp.CALENDAR_ID AND (ac.BLOCK=sp.BLOCK OR sp.BLOCK IS NULL) AND s.COURSE_PERIOD_ID=cp.COURSE_PERIOD_ID AND s.STUDENT_ID='".$student_id."' AND cpsp.PERIOD_ID IN $periods_list AND position(',0,' IN cp.DOES_ATTENDANCE)>0 AND (ac.SCHOOL_DATE BETWEEN s.START_DATE AND s.END_DATE OR (s.END_DATE IS NULL AND ac.SCHOOL_DATE>=s.START_DATE)) AND position(substring('UMTWHFS' FROM cast(extract(DOW FROM ac.SCHOOL_DATE) AS INT)+1 FOR 1) IN cpsp.DAYS)>0 AND s.MARKING_PERIOD_ID IN ($all_mp)"),array(),array('PERIOD_ID'));
$course_periods_RET = DBGet(DBQuery("SELECT s.COURSE_PERIOD_ID,cpsp.PERIOD_ID,cp.HALF_DAY FROM SCHEDULE s,COURSE_PERIODS cp,ATTENDANCE_CALENDAR ac,SCHOOL_PERIODS sp,COURSE_PERIOD_SCHOOL_PERIODS cpsp WHERE sp.PERIOD_ID=cpsp.PERIOD_ID AND ac.SCHOOL_DATE='".$date."' AND ac.CALENDAR_ID=cp.CALENDAR_ID AND (ac.BLOCK=sp.BLOCK OR sp.BLOCK IS NULL) AND s.COURSE_PERIOD_ID=cp.COURSE_PERIOD_ID AND s.STUDENT_ID='".$student_id."' AND cpsp.PERIOD_ID IN $periods_list AND position(',0,' IN cp.DOES_ATTENDANCE)>0 AND (ac.SCHOOL_DATE BETWEEN s.START_DATE AND s.END_DATE OR (s.END_DATE IS NULL AND ac.SCHOOL_DATE>=s.START_DATE)) AND position(substring('UMTWHFS' FROM cast(extract(DOW FROM ac.SCHOOL_DATE) AS INT)+1 FOR 1) IN cpsp.DAYS)>0 AND s.MARKING_PERIOD_ID IN ($all_mp)"),array(),array('PERIOD_ID'));
}
//echo '<pre>'; var_dump($course_periods_RET); echo '</pre>';
foreach ( (array) $_REQUEST['period'] as $period_id => $yes)
......@@ -95,7 +95,7 @@ if (isset($_REQUEST['modfunc']) && $_REQUEST['modfunc']=='save')
}
else
$error[] = _('You must choose at least one period and one student.');
unset($_SESSION['_REQUEST_vars']['modfunc']);
unset($_REQUEST['modfunc']);
}
......@@ -106,8 +106,7 @@ echo ErrorMessage( $note, 'note' );
echo ErrorMessage( $error );
if (empty($_REQUEST['modfunc']))
if ( ! $_REQUEST['modfunc'] )
{
$extra['link'] = array('FULL_NAME'=>false);
$extra['SELECT'] = ",CAST (NULL AS CHAR(1)) AS CHECKBOX";
......@@ -125,11 +124,11 @@ if (empty($_REQUEST['modfunc']))
//FJ multiple school periods for a course period
//$periods_RET = DBGet(DBQuery("SELECT SHORT_NAME,PERIOD_ID FROM SCHOOL_PERIODS WHERE SYEAR='".UserSyear()."' AND SCHOOL_ID='".UserSchool()."' AND EXISTS (SELECT '' FROM COURSE_PERIODS WHERE PERIOD_ID=SCHOOL_PERIODS.PERIOD_ID AND position(',0,' IN DOES_ATTENDANCE)>0) ORDER BY SORT_ORDER"));
$periods_RET = DBGet(DBQuery("SELECT SHORT_NAME,PERIOD_ID
FROM SCHOOL_PERIODS
WHERE SYEAR='".UserSyear()."'
AND SCHOOL_ID='".UserSchool()."'
AND EXISTS (SELECT '' FROM COURSE_PERIOD_SCHOOL_PERIODS cpsp, COURSE_PERIODS cp WHERE cp.COURSE_PERIOD_ID=cpsp.COURSE_PERIOD_ID AND cpsp.PERIOD_ID=SCHOOL_PERIODS.PERIOD_ID AND position(',0,' IN cp.DOES_ATTENDANCE)>0)
$periods_RET = DBGet(DBQuery("SELECT SHORT_NAME,PERIOD_ID
FROM SCHOOL_PERIODS
WHERE SYEAR='".UserSyear()."'
AND SCHOOL_ID='".UserSchool()."'
AND EXISTS (SELECT '' FROM COURSE_PERIOD_SCHOOL_PERIODS cpsp, COURSE_PERIODS cp WHERE cp.COURSE_PERIOD_ID=cpsp.COURSE_PERIOD_ID AND cpsp.PERIOD_ID=SCHOOL_PERIODS.PERIOD_ID AND position(',0,' IN cp.DOES_ATTENDANCE)>0)
ORDER BY SORT_ORDER"));
foreach ( (array) $periods_RET as $period)
//FJ add <label> on checkbox
......
......@@ -93,7 +93,7 @@ if ( $_REQUEST['modfunc']=='remove' && AllowEdit())
// FJ fix SQL bug invalid sort order
echo ErrorMessage( $error );
if (empty($_REQUEST['modfunc']))
if ( ! $_REQUEST['modfunc'] )
{
if ( $_REQUEST['table']!=='new')
{
......
......@@ -36,8 +36,7 @@ if ( empty( $end_date ) )
}
// Advanced Search.
if ( isset( $_REQUEST['modfunc'] )
&& $_REQUEST['modfunc'] === 'search' )
if ( $_REQUEST['modfunc'] === 'search' )
{
$extra['new'] = true;
......@@ -55,7 +54,7 @@ if ( isset( $_REQUEST['modfunc'] )
Search( 'student_id', $extra );
}
if (empty($_REQUEST['modfunc']))
if ( ! $_REQUEST['modfunc'] )
{
if ( ! isset( $extra ) )
{
......
<?php
if (isset($_REQUEST['modfunc']) && $_REQUEST['modfunc']=='save')
if ( $_REQUEST['modfunc'] === 'save' )
{
if (count($_REQUEST['st_arr']))
{
......@@ -255,7 +255,7 @@ if (isset($_REQUEST['modfunc']) && $_REQUEST['modfunc']=='save')
BackPrompt(_('You must choose at least one student.'));
}
if (empty($_REQUEST['modfunc']))
if ( ! $_REQUEST['modfunc'] )
{
DrawHeader(ProgramTitle());
......
......@@ -69,7 +69,8 @@ $profile_id = '3';
// end of user configuration
if (isset($_REQUEST['modfunc']) && $_REQUEST['modfunc']=='save' && AllowEdit())
if ( $_REQUEST['modfunc'] === 'save'
&& AllowEdit() )
{
// If $test email is set then this script will only 'go through the motions' and email the results to the $test_email address instead of parents
// no accounts are created and no associations are made. Use this to verify the behavior and email operation before actual use.
......@@ -246,7 +247,7 @@ if (isset($_REQUEST['modfunc']) && $_REQUEST['modfunc']=='save' && AllowEdit())
echo ErrorMessage( $error );
if (empty($_REQUEST['modfunc']) && !empty($email_column))
if (! $_REQUEST['modfunc'] && !empty($email_column))
{
if ( $_REQUEST['search_modfunc']=='list')
{
......
......@@ -2,7 +2,7 @@
DrawHeader(_(ProgramTitle()));
if (empty($_REQUEST['modfunc']))
if ( ! $_REQUEST['modfunc'] )
{
if ( $_REQUEST['search_modfunc']=='list')
{
......@@ -48,7 +48,7 @@ if (empty($_REQUEST['modfunc']))
$LO_columns += array('FULL_NAME' => _('Student'),'STUDENT_ID'=>sprintf(_('%s ID'),Config('NAME')),'GRADE_ID' => _('Grade Level'));
foreach ( (array) $custom_fields_RET as $field)
$LO_columns += array('CUSTOM_'.$field['ID']=>ParseMLField($field['TITLE']));
//FJ disable mailing address display
if (Config('STUDENTS_USE_MAILING'))
$LO_columns += array('ADDRESS' => _('Street'),'CITY' => _('City'),'STATE' => _('State'),'ZIPCODE' => _('Zipcode'),'PHONE' => _('Phone'),'MAIL_ADDRESS' => _('Mailing Street'),'MAIL_CITY' => _('Mailing City'),'MAIL_STATE' => _('Mailing State'),'MAIL_ZIPCODE' => _('Mailing Zipcode'));
......
......@@ -6,7 +6,7 @@
DrawHeader(ProgramTitle());
if (isset($_REQUEST['modfunc']) && $_REQUEST['modfunc']=='save')
if ( $_REQUEST['modfunc'] === 'save' )
{
// If $test email is set then this script will only 'go through the motions' and email the results to the $test_email address instead of parents
$test_email = $_REQUEST['test_email'];
......@@ -97,7 +97,7 @@ if (isset($_REQUEST['modfunc']) && $_REQUEST['modfunc']=='save')
echo ErrorMessage( $error );
if (empty($_REQUEST['modfunc']) || $_REQUEST['search_modfunc']=='list')
if (! $_REQUEST['modfunc'] || $_REQUEST['search_modfunc']=='list')
{
if ( $_REQUEST['search_modfunc']=='list')
{
......
......@@ -61,8 +61,7 @@ if ( ! isset( $_REQUEST['chart_type'] )
$chartline = false;
// Advanced Search
if ( isset( $_REQUEST['modfunc'] )
&& $_REQUEST['modfunc'] === 'search' )
if ( $_REQUEST['modfunc'] === 'search' )
{
echo '<br />';
......@@ -216,7 +215,7 @@ if ( isset( $_REQUEST['category_id'] )
}
}
if ( empty( $_REQUEST['modfunc'] ) )
if ( ! $_REQUEST['modfunc'] )
{
echo '<form action="' . PreparePHP_SELF( $_REQUEST ) . '" method="GET">';
......
......@@ -68,8 +68,7 @@ if ( ! isset( $_REQUEST['timeframe'] )
}
// Advanced Search.
if ( isset( $_REQUEST['modfunc'] )
&& $_REQUEST['modfunc'] === 'search' )
if ( $_REQUEST['modfunc'] === 'search' )
{
echo '<br />';
......@@ -396,7 +395,7 @@ if ( isset( $_REQUEST['category_id'] )
}
if ( empty( $_REQUEST['modfunc'] ) )
if ( ! $_REQUEST['modfunc'] )
{
echo '<form action="' . PreparePHP_SELF( $_REQUEST ) . '" method="GET">';
......
......@@ -23,7 +23,7 @@ if ( $_REQUEST['values'] && $_POST['values'] && AllowEdit())
$id = DBGet(DBQuery("SELECT ".db_seq_nextval('DISCIPLINE_FIELDS_SEQ').' AS ID'));
$id = $id[1]['ID'];
$sql = "INSERT INTO DISCIPLINE_FIELDS ";
$fields = "ID,COLUMN_NAME,";
$values = "'".$id."','CATEGORY_".$id."',";
......@@ -40,14 +40,14 @@ if ( $_REQUEST['values'] && $_POST['values'] && AllowEdit())
$go = true;
}
}
$sql .= '(' . mb_substr($fields,0,-1) . ') values(' . mb_substr($values,0,-1) . ')';
$usage_sql = "INSERT INTO DISCIPLINE_FIELD_USAGE ";
$fields = "ID,DISCIPLINE_FIELD_ID,SYEAR,SCHOOL_ID,";
$values = db_seq_nextval('DISCIPLINE_FIELD_USAGE_SEQ').",'".$id."','".UserSyear()."','".UserSchool()."',";
foreach ( (array) $columns as $column => $value)
{
if ( $value && $column!='DATA_TYPE')
......@@ -56,32 +56,32 @@ if ( $_REQUEST['values'] && $_POST['values'] && AllowEdit())
$values .= "'".$value."',";
}
}
$usage_sql .= '(' . mb_substr($fields,0,-1) . ') values(' . mb_substr($values,0,-1) . ')';
$create_index = true;
switch ( $columns['DATA_TYPE'])
{
case 'checkbox':
DBQuery("ALTER TABLE DISCIPLINE_REFERRALS ADD CATEGORY_$id VARCHAR(1)");
break;
case 'text':
case 'multiple_radio':
case 'multiple_checkbox':
case 'select':
DBQuery("ALTER TABLE DISCIPLINE_REFERRALS ADD CATEGORY_$id VARCHAR(1000)");
break;
case 'numeric':
DBQuery("ALTER TABLE DISCIPLINE_REFERRALS ADD CATEGORY_$id NUMERIC(20,2)");
break;
case 'date':
DBQuery("ALTER TABLE DISCIPLINE_REFERRALS ADD CATEGORY_$id DATE");
break;
case 'textarea':
DBQuery("ALTER TABLE DISCIPLINE_REFERRALS ADD CATEGORY_$id VARCHAR(5000)");
$create_index = false; //FJ SQL bugfix index row size exceeds maximum 2712 for index
......@@ -138,15 +138,15 @@ if ( $_REQUEST['modfunc']=='add_usage' && AllowEdit())
// FJ fix SQL bug invalid sort order
echo ErrorMessage( $error );
if (empty($_REQUEST['modfunc']))
if ( ! $_REQUEST['modfunc'] )
{
$sql = "SELECT NULL AS REMOVE,du.ID AS USAGE_ID,df.ID,COALESCE(du.TITLE,df.TITLE) AS TITLE,du.SORT_ORDER,df.DATA_TYPE,du.SELECT_OPTIONS
FROM DISCIPLINE_FIELDS df LEFT
OUTER JOIN DISCIPLINE_FIELD_USAGE du ON (du.DISCIPLINE_FIELD_ID=df.ID AND du.SYEAR='".UserSyear()."' AND du.SCHOOL_ID='".UserSchool()."')
$sql = "SELECT NULL AS REMOVE,du.ID AS USAGE_ID,df.ID,COALESCE(du.TITLE,df.TITLE) AS TITLE,du.SORT_ORDER,df.DATA_TYPE,du.SELECT_OPTIONS
FROM DISCIPLINE_FIELDS df LEFT
OUTER JOIN DISCIPLINE_FIELD_USAGE du ON (du.DISCIPLINE_FIELD_ID=df.ID AND du.SYEAR='".UserSyear()."' AND du.SCHOOL_ID='".UserSchool()."')
ORDER BY du.ID,du.SORT_ORDER";
$QI = DBQuery($sql);
$referrals_RET = DBGet($QI,array('REMOVE' => '_makeRemove','TITLE' => '_makeTextInput','SORT_ORDER' => '_makeTextInput','DATA_TYPE' => '_makeType','SELECT_OPTIONS' => '_makeTextAreaInput'));
foreach ( (array) $referrals_RET as $key => $item)
{
if ( ! $item['USAGE_ID'])
......@@ -160,7 +160,7 @@ if (empty($_REQUEST['modfunc']))
$columns += array('TITLE' => _('Title'),'SORT_ORDER' => _('Sort Order'),'DATA_TYPE' => _('Data Type'),'SELECT_OPTIONS' => _('Pull-Down').'/'._('Select Multiple from Options').'/'._('Select One from Options'));
$link['add']['html'] = array('REMOVE'=>button('add'),'TITLE'=>_makeTextInput('','TITLE'),'SORT_ORDER'=>_makeTextInput('','SORT_ORDER'),'SELECT_OPTIONS'=>_makeTextAreaInput('','SELECT_OPTIONS'),'DATA_TYPE'=>_makeType('','DATA_TYPE'));
echo '<form action="Modules.php?modname='.$_REQUEST['modname'].'" method="POST">';
DrawHeader('',SubmitButton(_('Save')));
......@@ -179,7 +179,7 @@ function _makeType($value,$name)
$id = 'new';
$new_options = array('checkbox' => _('Checkbox'),'text' => _('Text'),'multiple_checkbox' => _('Select Multiple from Options'),'multiple_radio' => _('Select One from Options'),'select' => _('Pull-Down'),'date' => _('Date'),'numeric' => _('Number'),'textarea' => _('Long Text'));
if ( $THIS_RET['ID'])
return $new_options[ $value ];
else
......@@ -188,21 +188,21 @@ function _makeType($value,$name)
function _makeTextInput($value,$name)
{ global $THIS_RET;
if ( $THIS_RET['USAGE_ID'])
$id = $THIS_RET['USAGE_ID'];
elseif ( $THIS_RET['ID'])
$id = 'usage';
else
$id = 'new';
if ( $name!='TITLE')
$extra = 'size=5 maxlength=2';
if ( $name=='SORT_ORDER')
$comment = '<!-- '.$value.' -->';
if ( $id=='usage')
return $value;
return $value;
else
return $comment.TextInput($value,'values['.$id.']['.$name.']','',$extra);
}
......@@ -210,7 +210,7 @@ function _makeTextInput($value,$name)
function _makeTextAreaInput( $value, $name )
{
global $THIS_RET;
if ( $THIS_RET['USAGE_ID'])
$id = $THIS_RET['USAGE_ID'];
elseif ( $THIS_RET['ID'])
......@@ -241,7 +241,7 @@ function _makeTextAreaInput( $value, $name )
function _makeRemove($value,$column)
{ global $THIS_RET;
$return = '';
if (AllowEdit())
if ( $THIS_RET['USAGE_ID'])
......
......@@ -59,8 +59,7 @@ if ( !isset( $_REQUEST['chart_type'] )
$chartline = false;
// Advanced Search
if ( isset( $_REQUEST['modfunc'] )
&& $_REQUEST['modfunc'] === 'search' )
if ( $_REQUEST['modfunc'] === 'search' )
{
echo '<br />';
......@@ -227,7 +226,7 @@ if ( isset( $_REQUEST['field_id'] )
}
}
if ( empty( $_REQUEST['modfunc'] ) )
if ( ! $_REQUEST['modfunc'] )
{
echo '<form action="' . PreparePHP_SELF( $_REQUEST ) . '" method="GET">';
......
<?php
if (isset($_REQUEST['modfunc']) && $_REQUEST['modfunc']=='save')
if ( $_REQUEST['modfunc'] === 'save' )
{
if ( !empty($_REQUEST['activity_id']))
{
......
......@@ -122,7 +122,7 @@ if ( $_REQUEST['modfunc']=='remove' && AllowEdit())
}
}
if (empty($_REQUEST['modfunc']))
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'));
......
......@@ -103,7 +103,7 @@ if ( $_REQUEST['modfunc']=='remove' && AllowEdit())
// FJ fix SQL bug invalid sort order
echo ErrorMessage( $error );
if (empty($_REQUEST['modfunc']))
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'])
......
......@@ -85,7 +85,7 @@ Search('student_id',$extra);
// FJ fix SQL bug invalid numeric data
echo ErrorMessage( $error );
if (UserStudentID() && empty($_REQUEST['modfunc']))
if (UserStudentID() && ! $_REQUEST['modfunc'])
{
$student = DBGet(DBQuery("SELECT s.STUDENT_ID,s.FIRST_NAME||' '||s.LAST_NAME AS FULL_NAME,fssa.ACCOUNT_ID,fssa.STATUS,fssa.DISCOUNT,fssa.BARCODE,(SELECT BALANCE FROM FOOD_SERVICE_ACCOUNTS WHERE ACCOUNT_ID=fssa.ACCOUNT_ID) AS BALANCE FROM STUDENTS s,FOOD_SERVICE_STUDENT_ACCOUNTS fssa WHERE s.STUDENT_ID='".UserStudentID()."' AND fssa.STUDENT_ID=s.STUDENT_ID"));
$student = $student[1];
......
......@@ -17,8 +17,8 @@ $extra['columns_after'] = array('BALANCE' => _('Balance'),'STATUS' => _('Status'
Search('student_id',$extra);
if (UserStudentID() && empty($_REQUEST['modfunc']))
{
if (UserStudentID() && ! $_REQUEST['modfunc'])
{
$where = '';
if ( $_REQUEST['type_select'])
......@@ -26,19 +26,19 @@ if (UserStudentID() && empty($_REQUEST['modfunc']))
if ( $_REQUEST['staff_select'])
$where .= "AND fst.SELLER_ID='".$_REQUEST['staff_select']."' ";
if ( $_REQUEST['detailed_view']=='true')
{
$RET = DBGet(DBQuery("SELECT fst.TRANSACTION_ID AS TRANS_ID,fst.TRANSACTION_ID,fst.ACCOUNT_ID,fst.SHORT_NAME,fst.STUDENT_ID,fst.DISCOUNT,(SELECT sum(AMOUNT) FROM FOOD_SERVICE_TRANSACTION_ITEMS WHERE TRANSACTION_ID=fst.TRANSACTION_ID) AS AMOUNT,fst.BALANCE,to_char(fst.TIMESTAMP,'YYYY-MM-DD') AS DATE,to_char(fst.TIMESTAMP,'HH:MI:SS AM') AS TIME,fst.DESCRIPTION,".db_case(array('fst.STUDENT_ID',"''",'NULL',"(SELECT LAST_NAME||', '||FIRST_NAME FROM STUDENTS WHERE STUDENT_ID=fst.STUDENT_ID)"))." AS FULL_NAME,".db_case(array('fst.SELLER_ID',"''",'NULL',"(SELECT FIRST_NAME||' '||LAST_NAME FROM STAFF WHERE STAFF_ID=fst.SELLER_ID)"))." AS SELLER
FROM FOOD_SERVICE_TRANSACTIONS fst
WHERE SYEAR='".UserSyear()."'
AND fst.TIMESTAMP BETWEEN '".$date."' AND date '".$date."' +1
$RET = DBGet(DBQuery("SELECT fst.TRANSACTION_ID AS TRANS_ID,fst.TRANSACTION_ID,fst.ACCOUNT_ID,fst.SHORT_NAME,fst.STUDENT_ID,fst.DISCOUNT,(SELECT sum(AMOUNT) FROM FOOD_SERVICE_TRANSACTION_ITEMS WHERE TRANSACTION_ID=fst.TRANSACTION_ID) AS AMOUNT,fst.BALANCE,to_char(fst.TIMESTAMP,'YYYY-MM-DD') AS DATE,to_char(fst.TIMESTAMP,'HH:MI:SS AM') AS TIME,fst.DESCRIPTION,".db_case(array('fst.STUDENT_ID',"''",'NULL',"(SELECT LAST_NAME||', '||FIRST_NAME FROM STUDENTS WHERE STUDENT_ID=fst.STUDENT_ID)"))." AS FULL_NAME,".db_case(array('fst.SELLER_ID',"''",'NULL',"(SELECT FIRST_NAME||' '||LAST_NAME FROM STAFF WHERE STAFF_ID=fst.SELLER_ID)"))." AS SELLER
FROM FOOD_SERVICE_TRANSACTIONS fst
WHERE SYEAR='".UserSyear()."'
AND fst.TIMESTAMP BETWEEN '".$date."' AND date '".$date."' +1
AND SCHOOL_ID='".UserSchool()."'".$where."
ORDER BY ".($_REQUEST['by_name']?"FULL_NAME,":'')."fst.TRANSACTION_ID DESC"),array('DATE' => 'ProperDate','SHORT_NAME' => 'bump_count'));
//FJ add translation
foreach ( (array) $RET as $RET_key => $RET_val) {
$RET[ $RET_key ]=array_map('types_locale', $RET_val);
}
}
foreach ( (array) $RET as $key => $value)
{
......@@ -48,7 +48,7 @@ if (UserStudentID() && empty($_REQUEST['modfunc']))
//FJ add translation
foreach ( (array) $tmpRET as $RET_key => $RET_val) {
$tmpRET[ $RET_key ]=array_map('options_locale', $RET_val);
}
}
// merge transaction and detail records
$RET[ $key ] = array($value) + $tmpRET;
}
......@@ -62,19 +62,19 @@ if (UserStudentID() && empty($_REQUEST['modfunc']))
{
$RET = DBGet(DBQuery("SELECT fst.TRANSACTION_ID,fst.ACCOUNT_ID,fst.SHORT_NAME,fst.STUDENT_ID,fst.DISCOUNT,
(SELECT sum(AMOUNT) FROM FOOD_SERVICE_TRANSACTION_ITEMS WHERE TRANSACTION_ID=fst.TRANSACTION_ID) AS AMOUNT,
fst.BALANCE,to_char(fst.TIMESTAMP,'YYYY-MM-DD') AS DATE,to_char(fst.TIMESTAMP,'HH:MI:SS AM') AS TIME,fst.DESCRIPTION,".db_case(array('fst.STUDENT_ID',"''",'NULL',"(SELECT LAST_NAME||', '||FIRST_NAME FROM STUDENTS WHERE STUDENT_ID=fst.STUDENT_ID)"))." AS FULL_NAME
FROM FOOD_SERVICE_TRANSACTIONS fst
WHERE SYEAR='".UserSyear()."'
AND fst.TIMESTAMP BETWEEN '".$date."' AND date '".$date."' +1
fst.BALANCE,to_char(fst.TIMESTAMP,'YYYY-MM-DD') AS DATE,to_char(fst.TIMESTAMP,'HH:MI:SS AM') AS TIME,fst.DESCRIPTION,".db_case(array('fst.STUDENT_ID',"''",'NULL',"(SELECT LAST_NAME||', '||FIRST_NAME FROM STUDENTS WHERE STUDENT_ID=fst.STUDENT_ID)"))." AS FULL_NAME
FROM FOOD_SERVICE_TRANSACTIONS fst
WHERE SYEAR='".UserSyear()."'
AND fst.TIMESTAMP BETWEEN '".$date."' AND date '".$date."' +1
AND SCHOOL_ID='".UserSchool()."'".$where."
ORDER BY ".($_REQUEST['by_name']?"FULL_NAME,":'')."fst.TRANSACTION_ID DESC"),array('DATE' => 'ProperDate','SHORT_NAME' => 'bump_count'));
$columns = array('TRANSACTION_ID' => _('ID'),'ACCOUNT_ID' => _('Account ID'),'FULL_NAME' => _('Student'),'DATE' => _('Date'),'TIME' => _('Time'),'BALANCE' => _('Balance'),'DISCOUNT' => _('Discount'),'DESCRIPTION' => _('Description'),'AMOUNT' => _('Amount'));
//FJ add translation
foreach ( (array) $RET as $RET_key => $RET_val) {
$RET[ $RET_key ]=array_map('types_locale', $RET_val);
}