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

Add spaces before and after arrow: => (foreach & associative arrays)

Replace "=>$" with " => $"
Replace "=>'" with " => '"
Replace "=>array(" with " => array("
Replace "=>0" with " => 0"
Replace "=>_(" with " => _("
parent 85e62845
......@@ -57,7 +57,7 @@ function PortalPollsSaveVotes($poll_questions_RET, $votes_array)
//add votes
$voted_array = array();
foreach ($poll_questions_RET as $key=>$question)
foreach ($poll_questions_RET as $key => $question)
{
if ( !empty($question['VOTES']))
{
......@@ -115,7 +115,7 @@ function PortalPollsDisplay($value,$name)
$poll_questions_RET = DBGet(DBQuery("SELECT ID, QUESTION, OPTIONS, TYPE, VOTES
FROM PORTAL_POLL_QUESTIONS
WHERE PORTAL_POLL_ID='".$poll_id."'
ORDER BY ID"), array('OPTIONS'=>'Linkify'));
ORDER BY ID"), array('OPTIONS' => 'Linkify'));
if ( !$poll_RET || !$poll_questions_RET)
return ErrorMessage(array('Poll does not exist'));//should never be displayed, so do not translate
......@@ -280,7 +280,7 @@ if (isset($_POST['votes']) && is_array($_POST['votes']))
include($function);
}
foreach ($_POST['votes'] as $poll_id=>$votes_array)
foreach ($_POST['votes'] as $poll_id => $votes_array)
{
if ( !empty($votes_array))
{
......@@ -316,9 +316,9 @@ function makePublishing($value,$name)
//add Profiles with Custom permissions to profiles list
$profiles = array_merge(array(
array('ID'=>'admin', 'TITLE'=>_('Administrator w/Custom')),
array('ID'=>'teacher', 'TITLE'=>_('Teacher w/Custom')),
array('ID'=>'parent', 'TITLE'=>_('Parent w/Custom'))
array('ID' => 'admin', 'TITLE' => _('Administrator w/Custom')),
array('ID' => 'teacher', 'TITLE' => _('Teacher w/Custom')),
array('ID' => 'parent', 'TITLE' => _('Parent w/Custom'))
), $profiles_RET);
}
......
......@@ -12,7 +12,7 @@ function _makePercentGrade($grade_id,$course_period_id=0,$staff_id=0)
{
$config_RET = DBGet(DBQuery("SELECT TITLE,VALUE FROM PROGRAM_USER_CONFIG WHERE USER_ID='".$staff_id."' AND PROGRAM='Gradebook'"),array(),array('TITLE'));
if (count($config_RET))
foreach ( (array)$config_RET as $title=>$value)
foreach ( (array)$config_RET as $title => $value)
$programconfig[$staff_id][$title] = $value[1]['VALUE'];
else
$programconfig[$staff_id] = true;
......
......@@ -16,12 +16,12 @@
* Furthermore, the third parameter can be used to change the array index to a column in the
* result. For instance, if you selected student_id from students, and chose to index by student_id,
* you would get a result similar to this :
* $array[1031806][1] = array('STUDENT_ID'=>'1031806');
* $array[1031806][1] = array('STUDENT_ID' => '1031806');
*
* The third parameter should be an array -- ordered by the importance of the index. So, if you select
* COURSE_ID,COURSE_PERIOD_ID from COURSE_PERIODS, and choose to index by
* array('COURSE_ID','COURSE_PERIOD_ID') then you will be returned an array formatted like this:
* $array[10101][402345][1] = array('COURSE_ID'=>'10101','COURSE_PERIOD_ID'=>'402345')
* $array[10101][402345][1] = array('COURSE_ID' => '10101','COURSE_PERIOD_ID' => '402345')
*
* TODO: remove eval(), anyone?
*
......
......@@ -3,7 +3,7 @@
function GetStaffList(& $extra)
{ global $profiles_RET;
$functions = array('PROFILE'=>'makeProfile');
$functions = array('PROFILE' => 'makeProfile');
switch(User('PROFILE'))
{
case 'admin':
......@@ -79,12 +79,12 @@ function GetStaffList(& $extra)
STAFF s ".$extra['FROM']."
WHERE
s.SYEAR='".UserSyear()."'";
//$sql = appendStaffSQL($sql,array('NoSearchTerms'=>$extra['NoSearchTerms']));
//$sql = appendStaffSQL($sql,array('NoSearchTerms' => $extra['NoSearchTerms']));
if ( $_REQUEST['_search_all_schools']!='Y')
$sql .= " AND (s.SCHOOLS LIKE '%,".UserSchool().",%' OR s.SCHOOLS IS NULL OR s.SCHOOLS='') ";
$sql .= $extra['WHERE'].' ';
//$sql .= CustomFields('where','staff',array('NoSearchTerms'=>$extra['NoSearchTerms']));
//$sql .= CustomFields('where','staff',array('NoSearchTerms' => $extra['NoSearchTerms']));
// it would be easier to sort on full_name but postgres sometimes yields strange results
$sql .= 'ORDER BY s.LAST_NAME,s.FIRST_NAME,s.MIDDLE_NAME';
......
......@@ -6,7 +6,7 @@ function GetStuList(&$extra=array())
{ global $contacts_RET,$view_other_RET;
if ((empty($extra['SELECT_ONLY']) || mb_strpos($extra['SELECT_ONLY'],'GRADE_ID')!==false) && !isset($extra['functions']['GRADE_ID']))
$functions = array('GRADE_ID'=>'GetGrade');
$functions = array('GRADE_ID' => 'GetGrade');
else
$functions = array();
......@@ -296,7 +296,7 @@ function GetStuList(&$extra=array())
return ErrorMessage($error, 'fatal');
}
//$sql = appendSQL($sql,array('NoSearchTerms'=>$extra['NoSearchTerms']));
//$sql = appendSQL($sql,array('NoSearchTerms' => $extra['NoSearchTerms']));
$sql .= ' '.$extra['WHERE'].' ';
......@@ -491,7 +491,7 @@ function appendSQL($sql,$extra=array())
$_ROSARIO['SearchTerms'] .= '<b>'.ngettext('Grade','Grades',sizeof($_REQUEST['grades'])).': </b>'.($_REQUEST['grades_not']=='Y'?_('Excluded').' ':'');
$list = $sep = '';
foreach ( (array)$_REQUEST['grades'] as $id=>$y)
foreach ( (array)$_REQUEST['grades'] as $id => $y)
{
$list .= $sep."'".$id."'";
......
......@@ -131,7 +131,7 @@ function setMLvalue(id,loc,value){
</script>';
$ret .= '<DIV><INPUT type="hidden" id="' . $name . '" name="'.$name.'" value="'.$value.'" />';
foreach ($RosarioLocales as $id=>$loc) {
foreach ($RosarioLocales as $id => $loc) {
$ret .= '<label><IMG src="assets/flags/'.$loc.'.png" class="button bigger" /> ';
//FJ only first translation string required
//$ret .= TextInput(ParseMLField($value, $loc),'ML_'.$name.'['.$loc.']','',$options." onchange=\"javascript:setMLvalue('".$name."','".($id==0?'':$loc)."',this.value);\"",false);
......@@ -339,7 +339,7 @@ function SelectInput($value,$name,$title='',$options=array(),$allow_na='N/A',$ex
}
if (count($options))
{
foreach ( (array)$options as $key=>$val)
foreach ( (array)$options as $key => $val)
{
$key .= '';
$select .= '<OPTION value="'.htmlspecialchars($key,ENT_QUOTES).'"'.($value==$key && (!($value==false && $value!==$key) || ($value===0 && $key==='0'))?' SELECTED':'').'>'.(is_array($val)?$val[0]:$val).'</OPTION>';
......@@ -399,7 +399,7 @@ function MLSelectInput($value,$name,$title='',$options,$allow_na='N/A',$extra=''
}
if (count($options))
{
foreach ( (array)$options as $key=>$val)
foreach ( (array)$options as $key => $val)
{
$key .= '';
$select .= '<OPTION value="'.htmlspecialchars($key,ENT_QUOTES).'"'.($value==$key && (!($value==false && $value!==$key) || ($value===0 && $key==='0'))?' SELECTED':'').'>'.(is_array($val)?ParseMLField($val[0], $locale):ParseMLField($val, $locale)).'</OPTION>';
......@@ -453,7 +453,7 @@ function RadioInput($value,$name,$title='',$options,$allow_na='N/A',$extra='',$d
}
if (count($options))
{
foreach ( (array)$options as $key=>$val)
foreach ( (array)$options as $key => $val)
{
$key .= '';
$table .= '<TD><label><INPUT type="radio" name="'.$name.'" value="'.htmlspecialchars($key,ENT_QUOTES).'" '.($value==$key && (!($value==false && $value!==$key) || ($value==='0' && $key===0))?'checked':'').' /> '.(is_array($val)?$val[0]:$val).'</label></TD>';
......
......@@ -187,7 +187,7 @@ function ListOutput($result,$column_names,$singular='.',$plural='.',$link=false,
foreach ($ignored_words as $word)
unset($terms[trim($word)]);
foreach ( (array)$result as $key=>$value)
foreach ( (array)$result as $key => $value)
{
$values[$key] = 0;
foreach ( (array)$value as $val)
......@@ -200,7 +200,7 @@ function ListOutput($result,$column_names,$singular='.',$plural='.',$link=false,
if ( $search_term==$val)
$values[$key] += 25;
foreach ( (array)$terms as $term=>$one)
foreach ( (array)$terms as $term => $one)
{
if (mb_strpos($val,$term)!==FALSE)
$values[$key] += 3;
......@@ -287,7 +287,7 @@ function ListOutput($result,$column_names,$singular='.',$plural='.',$link=false,
ob_end_clean();
if ( $options['save_delimiter']!='xml')
{
foreach ( (array)$column_names as $key=>$value)
foreach ( (array)$column_names as $key => $value)
{
$value = ParseMLField($value);
if ( $options['save_delimiter']=='comma' && !$options['save_quotes'])
......@@ -298,7 +298,7 @@ function ListOutput($result,$column_names,$singular='.',$plural='.',$link=false,
}
foreach ( (array)$result as $item)
{
foreach ( (array)$column_names as $key=>$value)
foreach ( (array)$column_names as $key => $value)
{
$value = $item[$key];
if ( $options['save_delimiter']=='comma' && !$options['save_quotes'])
......@@ -496,7 +496,7 @@ function ListOutput($result,$column_names,$singular='.',$plural='.',$link=false,
if ( $result_count!=0 && $cols)
{
foreach ( (array)$column_names as $key=>$value)
foreach ( (array)$column_names as $key => $value)
{
if (isset($LO_sort) && $LO_sort==$key)
$direction = -1 * $_REQUEST['LO_direction'];
......@@ -543,7 +543,7 @@ function ListOutput($result,$column_names,$singular='.',$plural='.',$link=false,
elseif ( $remove && !isset($_REQUEST['_ROSARIO_PDF']))
echo '<TD>'.button('add').'</TD>';
foreach ( (array)$column_names as $key=>$value)
foreach ( (array)$column_names as $key => $value)
{
echo '<TD>'.$link['add']['html'][$key].'</TD>';
}
......@@ -567,7 +567,7 @@ function ListOutput($result,$column_names,$singular='.',$plural='.',$link=false,
$item[$key[$j]] = preg_replace("/<div onclick=[^']+'>/",'',$value);
}
/*foreach ( (array)$item as $key=>$value)
/*foreach ( (array)$item as $key => $value)
{
$value = preg_replace('!<SELECT.*SELECTED\>([^<]+)<.*</SELECT\>!i','\\1',$value);
$value = preg_replace('!<SELECT.*</SELECT\>!i','',$value);
......@@ -590,7 +590,7 @@ function ListOutput($result,$column_names,$singular='.',$plural='.',$link=false,
$button_link = $link['remove']['link'];
if (count($link['remove']['variables']))
{
foreach ( (array)$link['remove']['variables'] as $var=>$val)
foreach ( (array)$link['remove']['variables'] as $var => $val)
$button_link .= "&$var=" . urlencode($item[$val]);
}
......@@ -599,7 +599,7 @@ function ListOutput($result,$column_names,$singular='.',$plural='.',$link=false,
if ( $cols)
{
foreach ( (array)$column_names as $key=>$value)
foreach ( (array)$column_names as $key => $value)
{
if ( !empty($link[$key]) && $item[$key]!==false && !isset($_REQUEST['_ROSARIO_PDF']))
{
......@@ -612,7 +612,7 @@ function ListOutput($result,$column_names,$singular='.',$plural='.',$link=false,
echo '<A HREF="#" onclick=\'window.open("'.$link[$key]['link'];
if (count($link[$key]['variables']))
{
foreach ( (array)$link[$key]['variables'] as $var=>$val)
foreach ( (array)$link[$key]['variables'] as $var => $val)
echo "&$var=".urlencode($item[$val]);
}
echo '","","scrollbars=yes,resizable=yes,width=800,height=400");\'';
......@@ -625,7 +625,7 @@ function ListOutput($result,$column_names,$singular='.',$plural='.',$link=false,
echo '<A HREF="'.$link[$key]['link'];
if (count($link[$key]['variables']))
{
foreach ( (array)$link[$key]['variables'] as $var=>$val)
foreach ( (array)$link[$key]['variables'] as $var => $val)
echo '&'.$var.'='.urlencode($item[$val]);
}
echo '"';
......@@ -671,7 +671,7 @@ function ListOutput($result,$column_names,$singular='.',$plural='.',$link=false,
elseif ( $remove && !isset($_REQUEST['_ROSARIO_PDF']))
echo '<TD>'.button('add').'</TD>';
foreach ( (array)$column_names as $key=>$value)
foreach ( (array)$column_names as $key => $value)
{
echo '<TD>'.$link['add']['html'][$key].'</TD>';
}
......@@ -712,7 +712,7 @@ function ListOutput($result,$column_names,$singular='.',$plural='.',$link=false,
echo '"><THEAD><TR><TH>&nbsp;</TH>';
foreach ( (array)$column_names as $key=>$value)
foreach ( (array)$column_names as $key => $value)
{
echo '<TH>' . str_replace(' ','&nbsp;',$value) . '</TH>';
}
......@@ -725,7 +725,7 @@ function ListOutput($result,$column_names,$singular='.',$plural='.',$link=false,
else
echo '<TD>'.button('add').'</TD>';
foreach ( (array)$column_names as $key=>$value)
foreach ( (array)$column_names as $key => $value)
{
echo '<TD>'.$link['add']['html'][$key].'</TD>';
}
......
......@@ -1113,7 +1113,7 @@ function Widgets( $item, &$myextra = null )
unset( $_REQUEST['discipline'][$key[$i]] );
}
/*foreach ( (array)$_REQUEST['discipline'] as $key=>$value)
/*foreach ( (array)$_REQUEST['discipline'] as $key => $value)
{
if(!$value)
unset($_REQUEST['discipline'][$key]);
......@@ -1135,7 +1135,7 @@ function Widgets( $item, &$myextra = null )
unset( $_REQUEST['discipline_begin'][$key[$i]] );
}
/*foreach ( (array)$_REQUEST['discipline_begin'] as $key=>$value)
/*foreach ( (array)$_REQUEST['discipline_begin'] as $key => $value)
{
if(!$value)
unset($_REQUEST['discipline_begin'][$key]);
......@@ -1156,7 +1156,7 @@ function Widgets( $item, &$myextra = null )
unset( $_REQUEST['discipline_end'][$key[$i]] );
}
/*foreach ( (array)$_REQUEST['discipline_end'] as $key=>$value)
/*foreach ( (array)$_REQUEST['discipline_end'] as $key => $value)
{
if(!$value)
unset($_REQUEST['discipline_end'][$key]);
......
......@@ -48,7 +48,7 @@ if ( !$_REQUEST['LO_sort'])
$_REQUEST['LO_sort'] = 'DATE';
//Widgets('all');
$extra['functions'] = array('DEBIT'=>'_makeCurrency','CREDIT'=>'_makeCurrency','DATE'=>'ProperDate');
$extra['functions'] = array('DEBIT' => '_makeCurrency','CREDIT' => '_makeCurrency','DATE' => 'ProperDate');
$RET = $debit_col = $credit_col = $name_col = array();
......@@ -160,12 +160,12 @@ $credit_col = implode(' / ', $credit_col);
$columns = array('FULL_NAME'=>(empty($name_col)? _('Total') : $name_col));
if (isset($_REQUEST['staff_payroll']) && isset($_REQUEST['student_billing']))
$columns['STUDENT_NAME'] = _('Student');
$columns = $columns + array('DEBIT'=>$debit_col,'CREDIT'=>$credit_col,'DATE'=>_('Date'),'EXPLANATION'=>_('Comment'));
$columns = $columns + array('DEBIT' => $debit_col,'CREDIT' => $credit_col,'DATE' => _('Date'),'EXPLANATION' => _('Comment'));
$link['add']['html'] = array('FULL_NAME'=>(empty($name_col)? '' : _('Total').': ').'<B>'.Currency($totals['CREDIT']-$totals['DEBIT']).'</B>');
if (isset($_REQUEST['staff_payroll']) && isset($_REQUEST['student_billing']))
$link['add']['html']['STUDENT_NAME'] = '&nbsp;';
$link['add']['html'] = $link['add']['html'] + array('DEBIT'=>'<b>'.Currency($totals['DEBIT']).'</b>','CREDIT'=>'<b>'.Currency($totals['CREDIT']).'</b>','DATE'=>'&nbsp;','EXPLANATION'=>'&nbsp;');
$link['add']['html'] = $link['add']['html'] + array('DEBIT' => '<b>'.Currency($totals['DEBIT']).'</b>','CREDIT' => '<b>'.Currency($totals['CREDIT']).'</b>','DATE' => '&nbsp;','EXPLANATION' => '&nbsp;');
ListOutput($RET,$columns,'Transaction','Transactions',$link);
......
......@@ -5,13 +5,13 @@ if ( !$_REQUEST['print_statements'])
if ( $_REQUEST['values'] && $_POST['values'] && AllowEdit())
{
foreach ( (array)$_REQUEST['values'] as $id=>$columns)
foreach ( (array)$_REQUEST['values'] as $id => $columns)
{
if ( $id!='new')
{
$sql = "UPDATE ACCOUNTING_PAYMENTS SET ";
foreach ( (array)$columns as $column=>$value)
foreach ( (array)$columns as $column => $value)
{
$sql .= $column."='".$value."',";
}
......@@ -29,7 +29,7 @@ if ( $_REQUEST['values'] && $_POST['values'] && AllowEdit())
$values = "'".$id."','".UserSyear()."','".UserSchool()."','".DBDate()."',";
$go = 0;
foreach ( (array)$columns as $column=>$value)
foreach ( (array)$columns as $column => $value)
{
if ( !empty($value) || $value=='0')
{
......@@ -66,7 +66,7 @@ if ( $_REQUEST['modfunc']=='remove' && AllowEdit())
if ( !$_REQUEST['modfunc'])
{
$payments_total = 0;
$functions = array('REMOVE'=>'_makePaymentsRemove','AMOUNT'=>'_makePaymentsAmount','PAYMENT_DATE'=>'ProperDate','COMMENTS'=>'_makePaymentsTextInput');
$functions = array('REMOVE' => '_makePaymentsRemove','AMOUNT' => '_makePaymentsAmount','PAYMENT_DATE' => 'ProperDate','COMMENTS' => '_makePaymentsTextInput');
$payments_RET = DBGet(DBQuery("SELECT '' AS REMOVE,ID,AMOUNT,PAYMENT_DATE,COMMENTS FROM ACCOUNTING_PAYMENTS WHERE SYEAR='".UserSyear()."' AND STAFF_ID IS NULL ORDER BY ID"),$functions);
$i = 1;
$RET = array();
......@@ -77,11 +77,11 @@ if ( !$_REQUEST['modfunc'])
}
if (count($RET) && !$_REQUEST['print_statements'] && AllowEdit())
$columns = array('REMOVE'=>'');
$columns = array('REMOVE' => '');
else
$columns = array();
$columns += array('AMOUNT'=>_('Amount'),'PAYMENT_DATE'=>_('Date'),'COMMENTS'=>_('Comment'));
$columns += array('AMOUNT' => _('Amount'),'PAYMENT_DATE' => _('Date'),'COMMENTS' => _('Comment'));
if ( !$_REQUEST['print_statements'] && AllowEdit())
$link['add']['html'] = array('REMOVE'=>button('add'),'AMOUNT'=>_makePaymentsTextInput('','AMOUNT'),'PAYMENT_DATE'=>ProperDate(DBDate()),'COMMENTS'=>_makePaymentsTextInput('','COMMENTS'));
if ( !$_REQUEST['print_statements'] && AllowEdit())
......
......@@ -6,13 +6,13 @@ if ( !$_REQUEST['print_statements'])
if ( $_REQUEST['values'] && $_POST['values'] && AllowEdit())
{
foreach ( (array)$_REQUEST['values'] as $id=>$columns)
foreach ( (array)$_REQUEST['values'] as $id => $columns)
{
if ( $id!='new')
{
$sql = "UPDATE ACCOUNTING_INCOMES SET ";
foreach ( (array)$columns as $column=>$value)
foreach ( (array)$columns as $column => $value)
{
$sql .= $column."='".$value."',";
}
......@@ -27,7 +27,7 @@ if ( $_REQUEST['values'] && $_POST['values'] && AllowEdit())
$values = db_seq_nextval('ACCOUNTING_INCOMES_SEQ').",'".UserSchool()."','".UserSyear()."','".DBDate()."',";
$go = 0;
foreach ( (array)$columns as $column=>$value)
foreach ( (array)$columns as $column => $value)
{
if ( !empty($value) || $value=='0')
{
......@@ -59,7 +59,7 @@ if ( $_REQUEST['modfunc']=='remove' && AllowEdit())
if ( !$_REQUEST['modfunc'])
{
$incomes_total = 0;
$functions = array('REMOVE'=>'_makeIncomesRemove','ASSIGNED_DATE'=>'ProperDate','COMMENTS'=>'_makeIncomesTextInput','AMOUNT'=>'_makeIncomesAmount');
$functions = array('REMOVE' => '_makeIncomesRemove','ASSIGNED_DATE' => 'ProperDate','COMMENTS' => '_makeIncomesTextInput','AMOUNT' => '_makeIncomesAmount');
$incomes_RET = DBGet(DBQuery("SELECT '' AS REMOVE,f.ID,f.TITLE,f.ASSIGNED_DATE,f.COMMENTS,f.AMOUNT FROM ACCOUNTING_INCOMES f WHERE f.SYEAR='".UserSyear()."' ORDER BY f.ASSIGNED_DATE"),$functions);
$i = 1;
$RET = array();
......@@ -70,11 +70,11 @@ if ( !$_REQUEST['modfunc'])
}
if (count($RET) && !$_REQUEST['print_statements'] && AllowEdit() && !isset($_REQUEST['_ROSARIO_PDF']))
$columns = array('REMOVE'=>'');
$columns = array('REMOVE' => '');
else
$columns = array();
$columns += array('TITLE'=>_('Income'),'AMOUNT'=>_('Amount'),'ASSIGNED_DATE'=>_('Assigned'),'COMMENTS'=>_('Comment'));
$columns += array('TITLE' => _('Income'),'AMOUNT' => _('Amount'),'ASSIGNED_DATE' => _('Assigned'),'COMMENTS' => _('Comment'));
if ( !$_REQUEST['print_statements'])
$link['add']['html'] = array('REMOVE'=>button('add'),'TITLE'=>_makeIncomesTextInput('','TITLE'),'AMOUNT'=>_makeIncomesTextInput('','AMOUNT'),'ASSIGNED_DATE'=>ProperDate(DBDate()),'COMMENTS'=>_makeIncomesTextInput('','COMMENTS'));
if ( !$_REQUEST['print_statements'])
......
......@@ -16,9 +16,9 @@ if ( $_REQUEST['values'] && $_POST['values'] && AllowEdit())
{
if (count($_REQUEST['month_']))
{
foreach ( (array)$_REQUEST['month_'] as $id=>$columns)
foreach ( (array)$_REQUEST['month_'] as $id => $columns)
{
foreach ( (array)$columns as $column=>$value)
foreach ( (array)$columns as $column => $value)
{
if ( $_REQUEST['day_'][$id][$column] && $_REQUEST['month_'][$id][$column] && $_REQUEST['year_'][$id][$column])
$_REQUEST['values'][$id][$column] = $_REQUEST['day_'][$id][$column].'-'.$_REQUEST['month_'][$id][$column].'-'.$_REQUEST['year_'][$id][$column];
......@@ -26,13 +26,13 @@ if ( $_REQUEST['values'] && $_POST['values'] && AllowEdit())
}
}
foreach ( (array)$_REQUEST['values'] as $id=>$columns)
foreach ( (array)$_REQUEST['values'] as $id => $columns)
{
if ( $id!='new')
{
$sql = "UPDATE ACCOUNTING_SALARIES SET ";
foreach ( (array)$columns as $column=>$value)
foreach ( (array)$columns as $column => $value)
{
$sql .= $column."='".$value."',";
}
......@@ -47,7 +47,7 @@ if ( $_REQUEST['values'] && $_POST['values'] && AllowEdit())
$values = db_seq_nextval('ACCOUNTING_SALARIES_SEQ').",'".UserStaffID()."','".UserSchool()."','".UserSyear()."','".DBDate()."',";
$go = 0;
foreach ( (array)$columns as $column=>$value)
foreach ( (array)$columns as $column => $value)
{
if ( !empty($value) || $value=='0')
{
......@@ -79,7 +79,7 @@ if ( $_REQUEST['modfunc']=='remove' && AllowEdit())
if (UserStaffID() && !$_REQUEST['modfunc'])
{
$salaries_total = 0;
$functions = array('REMOVE'=>'_makeSalariesRemove','ASSIGNED_DATE'=>'ProperDate','DUE_DATE'=>'_makeSalariesDateInput','COMMENTS'=>'_makeSalariesTextInput','AMOUNT'=>'_makeSalariesAmount');
$functions = array('REMOVE' => '_makeSalariesRemove','ASSIGNED_DATE' => 'ProperDate','DUE_DATE' => '_makeSalariesDateInput','COMMENTS' => '_makeSalariesTextInput','AMOUNT' => '_makeSalariesAmount');
$salaries_RET = DBGet(DBQuery("SELECT '' AS REMOVE,f.ID,f.TITLE,f.ASSIGNED_DATE,f.DUE_DATE,f.COMMENTS,f.AMOUNT FROM ACCOUNTING_SALARIES f WHERE f.STAFF_ID='".UserStaffID()."' AND f.SYEAR='".UserSyear()."' ORDER BY f.ASSIGNED_DATE"),$functions);
$i = 1;
$RET = array();
......@@ -90,11 +90,11 @@ if (UserStaffID() && !$_REQUEST['modfunc'])
}
if (count($RET) && !$_REQUEST['print_statements'] && AllowEdit() && !isset($_REQUEST['_ROSARIO_PDF']))
$columns = array('REMOVE'=>'');
$columns = array('REMOVE' => '');
else
$columns = array();
$columns += array('TITLE'=>_('Salary'),'AMOUNT'=>_('Amount'),'ASSIGNED_DATE'=>_('Assigned'),'DUE_DATE'=>_('Due'),'COMMENTS'=>_('Comment'));
$columns += array('TITLE' => _('Salary'),'AMOUNT' => _('Amount'),'ASSIGNED_DATE' => _('Assigned'),'DUE_DATE' => _('Due'),'COMMENTS' => _('Comment'));
if ( !$_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'])
......
......@@ -3,11 +3,11 @@ DrawHeader(ProgramTitle());
$extra['SELECT'] = ',(COALESCE((SELECT SUM(f.AMOUNT) FROM ACCOUNTING_SALARIES f WHERE f.STAFF_ID=s.STAFF_ID AND f.SYEAR=s.SYEAR),0)-COALESCE((SELECT SUM(p.AMOUNT) FROM ACCOUNTING_PAYMENTS p WHERE p.STAFF_ID=s.STAFF_ID AND p.SYEAR=s.SYEAR),0)) AS BALANCE';
$extra['columns_after'] = array('BALANCE'=>_('Balance'));
$extra['columns_after'] = array('BALANCE' => _('Balance'));
$extra['link']['FULL_NAME'] = false;
$extra['new'] = true;
$extra['functions'] = array('BALANCE'=>'_makeCurrency');
$extra['functions'] = array('BALANCE' => '_makeCurrency');
//Widgets('all');
......
......@@ -14,13 +14,13 @@ if ( !$_REQUEST['print_statements'])
if ( $_REQUEST['values'] && $_POST['values'] && AllowEdit())
{
foreach ( (array)$_REQUEST['values'] as $id=>$columns)
foreach ( (array)$_REQUEST['values'] as $id => $columns)
{
if ( $id!='new')
{
$sql = "UPDATE ACCOUNTING_PAYMENTS SET ";
foreach ( (array)$columns as $column=>$value)
foreach ( (array)$columns as $column => $value)
{
$sql .= $column."='".$value."',";
}
......@@ -38,7 +38,7 @@ if ( $_REQUEST['values'] && $_POST['values'] && AllowEdit())
$values = "'".$id."','".UserStaffID()."','".UserSyear()."','".UserSchool()."','".DBDate()."',";
$go = 0;
foreach ( (array)$columns as $column=>$value)
foreach ( (array)$columns as $column => $value)
{
if ( !empty($value) || $value=='0')
{
......@@ -75,7 +75,7 @@ if ( $_REQUEST['modfunc']=='remove' && AllowEdit())
if (UserStaffID() && !$_REQUEST['modfunc'])
{
$payments_total = 0;
$functions = array('REMOVE'=>'_makePaymentsRemove','AMOUNT'=>'_makePaymentsAmount','PAYMENT_DATE'=>'ProperDate','COMMENTS'=>'_makePaymentsTextInput');
$functions = array('REMOVE' => '_makePaymentsRemove','AMOUNT' => '_makePaymentsAmount','PAYMENT_DATE' => 'ProperDate','COMMENTS' => '_makePaymentsTextInput');
$payments_RET = DBGet(DBQuery("SELECT '' AS REMOVE,ID,AMOUNT,PAYMENT_DATE,COMMENTS FROM ACCOUNTING_PAYMENTS WHERE STAFF_ID='".UserStaffID()."' AND SYEAR='".UserSyear()."' ORDER BY ID"),$functions);
$i = 1;
$RET = array();
......@@ -86,11 +86,11 @@ if (UserStaffID() && !$_REQUEST['modfunc'])
}
if (count($RET) && !$_REQUEST['print_statements'] && AllowEdit())
$columns = array('REMOVE'=>'');
$columns = array('REMOVE' => '');
else
$columns = array();
$columns += array('AMOUNT'=>_('Amount'),'PAYMENT_DATE'=>_('Date'),'COMMENTS'=>_('Comment'));
$columns += array('AMOUNT' => _('Amount'),'PAYMENT_DATE' => _('Date'),'COMMENTS' => _('Comment'));
if ( !$_REQUEST['print_statements'] && AllowEdit())
$link['add']['html'] = array('REMOVE'=>button('add'),'AMOUNT'=>_makePaymentsTextInput('','AMOUNT'),'PAYMENT_DATE'=>ProperDate(DBDate()),'COMMENTS'=>_makePaymentsTextInput('','COMMENTS'));
if ( !$_REQUEST['print_statements'] && AllowEdit())
......
......@@ -15,11 +15,11 @@ if (isset($_REQUEST['modfunc']) && $_REQUEST['modfunc']=='save')
{
if (count($_REQUEST['period']) && count($_REQUEST['student']) && count($_REQUEST['dates']))
{
foreach ( (array)$_REQUEST['period'] as $period_id=>$yes)
foreach ( (array)$_REQUEST['period'] as $period_id => $yes)
$periods_list .= ",'".$period_id."'";
$periods_list = '('.mb_substr($periods_list,1).')';
foreach ( (array)$_REQUEST['student'] as $student_id=>$yes)
foreach ( (array)$_REQUEST['student'] as $student_id => $yes)