Resolved the issue of warnings showing up when trying to add a new shool under school management.

This commit is contained in:
Armanveer Gill 2025-01-01 17:23:20 -05:00
parent e869c34ad5
commit 6c9b2ec063
7 changed files with 53 additions and 29 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
data/

View File

@ -45,20 +45,24 @@
$webfirst=get_value_from_2d_array($_POST,'webfirst', $id)=="yes"?"yes":"no";
$weblast=get_value_from_2d_array($_POST, 'weblast', $id)=="yes"?"yes":"no";
$webphoto=get_value_from_2d_array($_POST, 'webphoto', $id)=="yes"?"yes":"no";
$stmt = $pdo->prepare("UPDATE students SET
webfirst='$webfirst',
weblast='$weblast',
webphoto='$webphoto'
WHERE
id='$id'");
$stmt->execute();
}
}
if($numchanged==1)
if($numchanged==1) {
echo happy(i18n("1 student record updated"));
else if($numchanged>1)
} else if($numchanged>1) {
echo happy(i18n("%1 student records updated",array($numchanged)));
else
} else {
echo error(i18n("No student records where changed"));
}
}
?>
<script type="text/javascript">
@ -71,28 +75,28 @@
<?
$sq=$pdo->prepare("SELECT students.firstname,
students.lastname,
students.id,
projects.projectnumber,
students.webfirst,
students.weblast,
students.webphoto
FROM
students,
registrations,
projects
WHERE
students.registrations_id=registrations.id
AND ( registrations.status = 'complete' OR registrations.status='paymentpending' )
AND projects.registrations_id=registrations.id
AND registrations.year='".$config['FAIRYEAR']."'
AND projects.year='".$config['FAIRYEAR']."'
AND students.year='".$config['FAIRYEAR']."'
ORDER BY projectnumber
");
$sq->execute();
show_pdo_errors_if_any($pdo);
$sq=$pdo->prepare("SELECT students.firstname,
students.lastname,
students.id,
projects.projectnumber,
students.webfirst,
students.weblast,
students.webphoto
FROM
students,
registrations,
projects
WHERE
students.registrations_id=registrations.id
AND ( registrations.status = 'complete' OR registrations.status='paymentpending' )
AND projects.registrations_id=registrations.id
AND registrations.year='".$config['FAIRYEAR']."'
AND projects.year='".$config['FAIRYEAR']."'
AND students.year='".$config['FAIRYEAR']."'
ORDER BY projectnumber
");
$sq->execute();
show_pdo_errors_if_any($pdo);
echo "<form method=\"post\" action=\"registration_webconsent.php\">";
echo "<table class=\"tableview\">";
@ -121,5 +125,5 @@
echo "<input type=\"submit\" value=\"".i18n("Save Changes")."\">";
echo "</form>";
send_footer();
send_footer();
?>

View File

@ -54,10 +54,21 @@
$principal_update = '';
$sciencehead_update = '';
list($first, $last) = explode(' ', get_value_from_array($_POST,'principal') ?? '', 2);
// list($first, $last)
$split = explode(' ', get_value_from_array($_POST,'principal') ?? '', 2);
if(count($split) === 2){
list($first, $last) = $split;
}
else{
$first = $split[0];
$last = '';
}
/* Load existing entry if it exists, else make an entry if
* there is data, else, do nothing */
if($i['principal_uid'] > 0)
if(get_value_from_array($i, 'principal_uid') > 0)
$pl = user_load_by_uid($i['principal_uid']);
else if($first != '' && $last != '') {
$pl = user_create('principal', "*$first$last".user_generate_password());
@ -84,7 +95,15 @@
/* Get info about science head */
// FIX ME
list($first, $last) = explode(' ', get_value_from_array($_POST, 'sciencehead', ''), 2);
$split = explode(' ', get_value_from_array($_POST,'principal') ?? '', 2);
if(count($split) === 2){
list($first, $last) = $split;
}
else{
$first = $split[0];
$last = '';
}
$em = get_value_from_array($_POST,'scienceheademail');
if($em == '' && ($first != '' || $last != '')) $em = "*$first$last".user_generate_password();
/* Load existing record, or create new if there's something

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 KiB

After

Width:  |  Height:  |  Size: 192 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 81 KiB