Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync from mobile branch (rosariosis) #2

Merged
merged 9 commits into from
Aug 18, 2022
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ Changes in 10.0
- Add MySQL database dump in rosariosis_mysql.sql
- Log "RosarioSIS HACKING ATTEMPT" into Apache error.log in HackingLog.fnc.php
- Force URL & menu reloading, always use JS to redirect in HackingLog.fnc.php
- Place currency symbol after amount for some locales in Currency.fnc.php
- SQL use timestamp type: standard & without time zone by default in rosariosis.sql
- CSS add .accounting-totals, .accounting-staff-payroll-totals, .student-billing-totals classes in Expenses.php, Incomes.php, Salaries.php, StaffPayments.php, StudentFees.php & StudentPayments.php

Changes in 9.3.1
----------------
Expand Down
12 changes: 6 additions & 6 deletions functions/Config.fnc.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,18 @@ function Config( $item, $value = null )

if ( ! is_null( $value ) )
{
$school_id = isset( $_ROSARIO['Config'][ (string) $item ][1]['SCHOOL_ID'] ) ?
$_ROSARIO['Config'][ (string) $item ][1]['SCHOOL_ID'] :
( UserSchool() > 0 ? UserSchool() : '0' );

if ( ! isset( $_ROSARIO['Config'][ (string) $item ][1]['TITLE'] ) )
{
$school_id = ( UserSchool() > 0 ? UserSchool() : '0' );

// Insert value (does not exist).
DBQuery( "INSERT INTO config (CONFIG_VALUE,TITLE,SCHOOL_ID)
VALUES('" . $value . "','" . $item . "','" . $school_id . "')" );
}
elseif ( $value != DBEscapeString( $_ROSARIO['Config'][ (string) $item ][1]['CONFIG_VALUE'] ) )
{
$school_id = $_ROSARIO['Config'][ (string) $item ][1]['SCHOOL_ID'];

// Update value (different from current value).
DBQuery( "UPDATE config
SET CONFIG_VALUE='" . $value . "'
Expand All @@ -72,8 +72,8 @@ function Config( $item, $value = null )

if ( $value !== DBEscapeString( $value ) )
{
$value = DBGetOne( "SELECT VALUE
FROM program_config
$value = DBGetOne( "SELECT CONFIG_VALUE
FROM config
WHERE TITLE='" . $item . "'
AND SCHOOL_ID='" . (int) $school_id . "'" );
}
Expand Down
19 changes: 18 additions & 1 deletion functions/Currency.fnc.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,28 @@ function Currency( $num, $sign = 'before', $red = false )
// Add currency symbol & format amount.
// @since 9.1 Add decimal & thousands separator configuration.
// @link https://en.wikipedia.org/wiki/Decimal_separator
$num = Config( 'CURRENCY' ) . number_format(
$num = number_format(
$num,
2,
Config( 'DECIMAL_SEPARATOR' ),
Config( 'THOUSANDS_SEPARATOR' )
);

$lang_2_chars = mb_substr( $_SESSION['locale'], 0, 2 );

$currency_after_lang = [ 'fr', 'es', 'de', 'cs', 'hu', 'ru', 'sv', 'tr', 'vi' ];

if ( in_array( $lang_2_chars, $currency_after_lang ) )
{
// @since 10.0 Place currency symbol after amount for some locales
// @link https://fastspring.com/blog/how-to-format-30-currencies-from-countries-all-over-the-world/
$num .= ' ' . Config( 'CURRENCY' );
}
else
{
$num = Config( 'CURRENCY' ) . $num;
}

// Add minus if negative.
if ( $negative )
{
Expand All @@ -58,7 +73,9 @@ function Currency( $num, $sign = 'before', $red = false )

// Add CR if credit.
elseif ( $cr )
{
$num = $num . 'CR';
}

// Red if negative amount.
if ( $red
Expand Down
2 changes: 1 addition & 1 deletion modules/Accounting/Expenses.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
WHERE f.SYEAR='" . UserSyear() . "'
AND f.SCHOOL_ID='" . UserSchool() . "'" );

$table = '<table class="align-right"><tr><td>' . _( 'Total from Incomes' ) . ': ' . '</td><td>' . Currency( $incomes_total ) . '</td></tr>';
$table = '<table class="align-right accounting-totals"><tr><td>' . _( 'Total from Incomes' ) . ': ' . '</td><td>' . Currency( $incomes_total ) . '</td></tr>';

$table .= '<tr><td>' . _( 'Less' ) . ': ' . _( 'Total from Expenses' ) . ': ' . '</td><td>' . Currency( $payments_total ) . '</td></tr>';

Expand Down
2 changes: 1 addition & 1 deletion modules/Accounting/Incomes.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
AND p.SYEAR='" . UserSyear() . "'
AND p.SCHOOL_ID='" . UserSchool() . "'" );

$table = '<table class="align-right"><tr><td>' . _( 'Total from Incomes' ) . ': ' . '</td><td>' . Currency( $incomes_total ) . '</td></tr>';
$table = '<table class="align-right accounting-totals"><tr><td>' . _( 'Total from Incomes' ) . ': ' . '</td><td>' . Currency( $incomes_total ) . '</td></tr>';

$table .= '<tr><td>' . _( 'Less' ) . ': ' . _( 'Total from Expenses' ) . ': ' . '</td><td>' . Currency( $payments_total ) . '</td></tr>';

Expand Down
2 changes: 1 addition & 1 deletion modules/Accounting/Salaries.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
AND p.SYEAR='" . UserSyear() . "'
AND p.SCHOOL_ID='" . UserSchool() . "'" );

$table = '<table class="align-right"><tr><td>' . _( 'Total from Salaries' ) . ': ' . '</td><td>' . Currency( $salaries_total ) . '</td></tr>';
$table = '<table class="align-right accounting-staff-payroll-totals"><tr><td>' . _( 'Total from Salaries' ) . ': ' . '</td><td>' . Currency( $salaries_total ) . '</td></tr>';

$table .= '<tr><td>' . _( 'Less' ) . ': ' . _( 'Total from Staff Payments' ) . ': ' . '</td><td>' . Currency( $payments_total ) . '</td></tr>';

Expand Down
2 changes: 1 addition & 1 deletion modules/Accounting/StaffPayments.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
AND f.SYEAR='" . UserSyear() . "'
AND f.SCHOOL_ID='" . UserSchool() . "'" );

$table = '<table class="align-right"><tr><td>' . _( 'Total from Salaries' ) . ': ' . '</td><td>' . Currency( $salaries_total ) . '</td></tr>';
$table = '<table class="align-right accounting-staff-payroll-totals"><tr><td>' . _( 'Total from Salaries' ) . ': ' . '</td><td>' . Currency( $salaries_total ) . '</td></tr>';

$table .= '<tr><td>' . _( 'Less' ) . ': ' . _( 'Total from Staff Payments' ) . ': ' . '</td><td>' . Currency( $payments_total ) . '</td></tr>';

Expand Down
2 changes: 2 additions & 0 deletions modules/Accounting/Statements.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

StaffWidgets( 'staff_balance' );

if ( ! isset( $_REQUEST['_ROSARIO_PDF'] ) && ! $_REQUEST['search_modfunc'] )
{
DrawHeader( ProgramTitle() );
Expand Down
7 changes: 3 additions & 4 deletions modules/Custom/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Custom Module
# Custom module

This module is part of [RosarioSIS](https://www.rosariosis.org)

Author François Jacquet
See COPYRIGHT file.
Remove Access program sponsored by Santa Cecilia school, Salvador.
Administrators can customize Registration form, sponsored by English National Program, France.
Administrators can customize the Registration form, sponsored by English National Program, France.

## Description

Expand All @@ -17,7 +16,7 @@ Students

- My Report
- Create Parent Users (created from the students' contacts)
- Registration (for parents & students to register their contacts) (administrators can customize form)
- Registration (for parents & students to register their contacts; administrators can customize the form)
- Remove Access (for students and associated parents)

Users
Expand Down
2 changes: 1 addition & 1 deletion modules/Grades/InputFinalGrades.php
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@
{
DBQuery( "INSERT INTO student_report_card_comments
(SYEAR, SCHOOL_ID, STUDENT_ID, COURSE_PERIOD_ID, MARKING_PERIOD_ID, REPORT_CARD_COMMENT_ID, COMMENT)
values('" . UserSyear() . "','" . UserSchool() . "','" . $student_id . "','" . $course_period_id . "','" . $_REQUEST['mp'] . "','" . $id . "','" . $comment . "')" );
values('" . UserSyear() . "','" . UserSchool() . "','" . $student_id . "','" . $course_period_id . "','" . $_REQUEST['mp'] . "','" . (int) $id . "','" . $comment . "')" );
}
}
}
Expand Down
1 change: 1 addition & 0 deletions modules/Student_Billing/Statements.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

Widgets( 'mailing_labels' );
Widgets( 'balance' );

if ( empty( $_REQUEST['search_modfunc'] ) )
{
Expand Down
2 changes: 1 addition & 1 deletion modules/Student_Billing/StudentFees.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@
WHERE p.STUDENT_ID='" . UserStudentID() . "'
AND p.SYEAR='" . UserSyear() . "'" );

$table = '<table class="align-right"><tr><td>' . _( 'Total from Fees' ) . ': ' . '</td><td>' . Currency( $fees_total ) . '</td></tr>';
$table = '<table class="align-right student-billing-totals"><tr><td>' . _( 'Total from Fees' ) . ': ' . '</td><td>' . Currency( $fees_total ) . '</td></tr>';

$table .= '<tr><td>' . _( 'Less' ) . ': ' . _( 'Total from Payments' ) . ': ' . '</td><td>' . Currency( $payments_total ) . '</td></tr>';

Expand Down
2 changes: 1 addition & 1 deletion modules/Student_Billing/StudentPayments.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@
WHERE f.STUDENT_ID='" . UserStudentID() . "'
AND f.SYEAR='" . UserSyear() . "'" );

$table = '<table class="align-right"><tr>
$table = '<table class="align-right student-billing-totals"><tr>
<td>' . _( 'Total from Fees' ) . ': </td>
<td>' . Currency( $fees_total ) . '</td></tr>';

Expand Down
3 changes: 2 additions & 1 deletion modules/Student_Billing/includes/DailyTransactions.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@
];

$link['add']['html'] = [
'FULL_NAME' => '<b>' . _( 'Total' ) . '</b>',
'FULL_NAME' => _( 'Total' ) . ': ' .
'<b>' . Currency( $totals['CREDIT'] - $totals['DEBIT'] ) . '</b>',
'DEBIT' => '<b>' . Currency( ( isset( $totals['DEBIT'] ) ? $totals['DEBIT'] : 0 ) ) . '</b>',
'CREDIT' => '<b>' . Currency( ( isset( $totals['CREDIT'] ) ? $totals['CREDIT'] : 0 ) ) . '</b>',
'DATE' => '&nbsp;',
Expand Down
14 changes: 7 additions & 7 deletions rosariosis.sql
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ CREATE TABLE students (
name_suffix varchar(3),
username varchar(100) UNIQUE,
password varchar(106),
last_login timestamp(0) without time zone,
last_login timestamp,
failed_login integer,
custom_200000000 text,
custom_200000001 text,
Expand Down Expand Up @@ -330,7 +330,7 @@ CREATE TABLE staff (
profile varchar(30),
homeroom varchar(5),
schools varchar(150),
last_login timestamp(0) without time zone,
last_login timestamp,
failed_login integer,
profile_id integer,
rollover_id integer,
Expand Down Expand Up @@ -431,7 +431,7 @@ CREATE TABLE access_log (
syear numeric(4,0) NOT NULL,
username varchar(100),
profile varchar(30),
login_time timestamp(0) without time zone,
login_time timestamp, -- TODO use created_at instead
ip_address varchar(50),
user_agent text,
status varchar(50),
Expand Down Expand Up @@ -1042,7 +1042,7 @@ CREATE TABLE food_service_staff_transactions (
school_id integer NOT NULL,
syear numeric(4,0) NOT NULL,
balance numeric(9,2),
"timestamp" timestamp(0) without time zone,
"timestamp" timestamp, -- TODO use created_at instead
short_name varchar(25),
description varchar(50),
seller_id integer,
Expand Down Expand Up @@ -1096,7 +1096,7 @@ CREATE TABLE food_service_transactions (
syear numeric(4,0) NOT NULL,
discount varchar(25),
balance numeric(9,2),
"timestamp" timestamp(0) without time zone,
"timestamp" timestamp, -- TODO use created_at instead
short_name varchar(25),
description varchar(50),
seller_id integer,
Expand Down Expand Up @@ -1316,7 +1316,7 @@ CREATE TABLE portal_notes (
content text,
sort_order numeric,
published_user integer,
published_date timestamp(0) without time zone,
published_date timestamp, -- TODO use created_at instead
start_date date,
end_date date,
published_profiles text,
Expand Down Expand Up @@ -1356,7 +1356,7 @@ CREATE TABLE portal_polls (
display_votes varchar(1),
sort_order numeric,
published_user integer,
published_date timestamp(0) without time zone,
published_date timestamp, -- TODO use created_at instead
start_date date,
end_date date,
published_profiles text,
Expand Down