diff --git a/admin/schools.php b/admin/schools.php
index 125d4cb2..6a2326f5 100644
--- a/admin/schools.php
+++ b/admin/schools.php
@@ -98,7 +98,7 @@ if (get_value_from_array($_POST, 'save') == 'edit' || get_value_from_array($_POS
/* Get info about science head */
// FIX ME
- $split = explode(' ', get_value_from_array($_POST, 'principal') ?? '', 2);
+ $split = explode(' ', get_value_from_array($_POST, 'principal', ''), 2);
if (count($split) === 2) {
list($first, $last) = $split;
@@ -181,7 +181,7 @@ if (get_value_from_array($_POST, 'save') == 'edit' || get_value_from_array($_POS
$stmt->execute([
get_value_from_array($_POST, 'school'),
get_value_from_array($_POST, 'schoollang'),
- get_value_from_array($_POST, 'designate'), // FIXED: Corrected key name
+ get_value_from_array($_POST, 'designate', ''),
get_value_from_array($_POST, 'schoollevel'),
get_value_from_array($_POST, 'board'),
get_value_from_array($_POST, 'district'),
@@ -192,13 +192,13 @@ if (get_value_from_array($_POST, 'save') == 'edit' || get_value_from_array($_POS
get_value_from_array($_POST, 'schoolemail'),
get_value_from_array($_POST, 'phone'),
get_value_from_array($_POST, 'fax'),
- get_value_from_array($_POST, 'registration_password'),
- get_value_from_array($_POST, 'projectlimit'),
- get_value_from_array($_POST, 'projectlimitper'),
+ get_value_from_array($_POST, 'registration_password', ''),
+ get_value_from_array($_POST, 'projectlimit', 0),
+ get_value_from_array($_POST, 'projectlimitper', 0),
get_value_from_array($_POST, 'accesscode'),
- get_value_from_array($_POST, 'sciencehead'), // FIXED: Using function for consistency
+ get_value_from_array($_POST, 'sciencehead'),
get_value_from_array($_POST, 'principal'),
- get_value_from_array($_POST, 'atrisk'),
+ get_value_from_array($_POST, 'atrisk', 'no'),
get_value_from_array($_POST, 'id')
]);
@@ -263,6 +263,7 @@ if (get_value_from_array($_GET, 'action') == 'edit' || get_value_from_array($_GE
echo '\n";
foreach ($config['languages'] AS $k => $l) {
+ $sel = ($r->schoollang == $k) ? 'selected="selected"' : '';
echo "\n";
}
echo '';
diff --git a/admin/schoolsimport.php b/admin/schoolsimport.php
index f47fa12e..e30974d0 100644
--- a/admin/schoolsimport.php
+++ b/admin/schoolsimport.php
@@ -58,7 +58,7 @@ if (get_value_from_array($_POST, 'action') == 'import') {
$row = explode(',', $raw_row[0]);
for ($n = 0; $n < count($row); $n++) {
- $row[$n] = trim($row[$n]);
+ $row[$n] = trim(trim($row[$n]), '"');
}
// $email = $row[16];
@@ -110,23 +110,23 @@ if (get_value_from_array($_POST, 'action') == 'import') {
$stmt->bindParam(':registration_password', $row[13]);
$stmt->bindParam(':projectlimit', $row[14]);
$stmt->bindParam(':projectlimitper', $row[15]);
- $stmt->bindParam(':year', $row[16]);
+ $stmt->bindParam(':year', $config['FAIRYEAR']);
$stmt->bindParam(':principal_uid', $principal['uid']);
$stmt->bindParam(':sciencehead_uid', $scienceHead['uid']);
$stmt->execute();
- if (!$pdo->errorInfo())
+ if ($pdo->errorInfo() != '00000') {
$loaded++;
- else
+ } else {
show_pdo_errors_if_any($pdo);
+ }
}
echo happy(i18n('Successfully loaded %1 schools', array($loaded)));
echo '' . i18n('School Management') . '
';
} else {
echo error(i18n('Found no CSV data in the uploaded file'));
}
- print_r($data);
} else {
echo error(i18n('Please choose a valid CSV file to upload'));
$showform = true;