Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 97dc2bc

Browse files
committed
v1.7.01
1 parent 382af1d commit 97dc2bc

File tree

5 files changed

+27
-10
lines changed

5 files changed

+27
-10
lines changed

Data Admin/CHANGEDB.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,8 @@
156156
$count++;
157157
$sql[$count][0]="1.7.00" ;
158158
$sql[$count][1]="";
159+
160+
//v1.7.01
161+
$count++;
162+
$sql[$count][0]="1.7.01" ;
163+
$sql[$count][1]="";

Data Admin/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
CHANGELOG
22
=========
3+
## [1.7.01] 2023-06-18
4+
- Added Gibbon Person ID to the username finder
5+
36
## [1.7.00] 2023-01-25
47
- Fixed importer errors for missing PasswordPolicy class
58

Data Admin/manifest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
$entryURL="import_manage.php" ; //The landing page for the unit, used in the main menu
2626
$type="Additional" ; //Do not change.
2727
$category="Admin" ; //The main menu area to place the module in
28-
$version="1.7.00" ; //Version number
28+
$version="1.7.01" ; //Version number
2929
$author="Sandra Kuipers" ; //Your name
3030
$url="https://github.com/SKuipers/" ; //Your URL
3131

Data Admin/tools_findUsernamesProcess.php

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,22 +59,26 @@
5959
$lastColumn = $objWorksheet->getHighestDataColumn();
6060
$lastColumn++;
6161

62+
$lastColumnID = $lastColumn;
63+
$lastColumnID++;
64+
6265
$objWorksheet->setCellValue($lastColumn.'1', 'Username');
66+
$objWorksheet->setCellValue($lastColumnID.'1', 'Gibbon ID');
6367

6468
$studentCount = 0;
6569
$studentFoundCount = 0;
6670

6771
// Grab the header & first row for Step 1
6872
foreach ($objWorksheet->getRowIterator(2) as $rowIndex => $row) {
69-
$array = $objWorksheet->rangeToArray('A'.$rowIndex.':'.$lastColumn.$rowIndex, null, true, true, false);
73+
$array = $objWorksheet->rangeToArray('A'.$rowIndex.':'.$lastColumnID.$rowIndex, null, true, true, false);
7074

7175
$studentName = isset($array[0][$nameColumn])? $array[0][$nameColumn] : '';
7276
$yearGroup = isset($array[0][$yearGroupColumn])? $array[0][$yearGroupColumn] : '';
7377

7478
if ($columnType == 'one') {
7579
// Parse the student name, then copy into variables based on the name format
7680
$matches = array();
77-
$preferredName = $firstName = $surname1 = $surname2 = '';
81+
$preferredName = $firstName = $surname1 = $surname2;
7882

7983
switch ($nameFormat) {
8084
case 'firstLast': // Handle names with spaces: Alpha Beta + Gamma as well as Alpha + Beta Gamma
@@ -118,19 +122,20 @@
118122

119123
if ($roleCategory == 'Student') {
120124
// Locate a student enrolment for the target year group with a matching student name
121-
$data = ['gibbonSchoolYearID' => $session->get('gibbonSchoolYearID'), 'yearGroup' => $yearGroup, 'preferredName' => trim($preferredName), 'firstName' => trim($firstName), 'surname1' => trim($surname1), 'surname2' => trim($surname2) ];
122-
$sql = "SELECT gibbonPerson.username
125+
$data = ['gibbonSchoolYearID' => $session->get('gibbonSchoolYearID'), 'yearGroup' => $yearGroup, 'preferredName' => trim($preferredName), 'firstName' => trim($firstName), 'surname1' => trim($surname1), 'surname2' => trim($surname2), 'fullName' => $studentName ];
126+
$sql = "SELECT gibbonPerson.username, gibbonPerson.gibbonPersonID
123127
FROM gibbonPerson
124128
JOIN gibbonStudentEnrolment ON (gibbonStudentEnrolment.gibbonPersonID=gibbonPerson.gibbonPersonID)
125129
WHERE gibbonStudentEnrolment.gibbonSchoolYearID=:gibbonSchoolYearID
126130
AND gibbonStudentEnrolment.gibbonYearGroupID=(SELECT gibbonYearGroupID FROM gibbonYearGroup WHERE nameShort=:yearGroup)
127131
AND (
128132
(gibbonPerson.surname = :surname1 AND gibbonPerson.preferredName = :preferredName)
129133
OR (gibbonPerson.surname = :surname2 AND gibbonPerson.firstName = :firstName)
134+
OR (CONCAT(gibbonPerson.preferredName, ' ', gibbonPerson.surname) =:fullName )
130135
)";
131136
} else {
132137
$data = ['preferredName' => trim($preferredName), 'firstName' => trim($firstName), 'surname1' => trim($surname1), 'surname2' => trim($surname2) ];
133-
$sql = "SELECT gibbonPerson.username
138+
$sql = "SELECT gibbonPerson.username, gibbonPerson.gibbonPersonID
134139
FROM gibbonPerson
135140
WHERE (gibbonPerson.status='Full' OR gibbonPerson.status='Expected')
136141
AND (
@@ -142,14 +147,18 @@
142147
$result = $pdo->select($sql, $data);
143148

144149
if ($result->rowCount() == 1) {
145-
$foundValue = $result->fetchColumn();
150+
$values = $result->fetch();
151+
$foundUsername = $values['username'] ?? '';
152+
$foundID = $values['gibbonPersonID'] ?? '';
146153
$studentFoundCount++;
147154
} else {
148-
$foundValue = '';
155+
$foundUsername = '';
156+
$foundID = '';
149157
}
150158

151159
// Write the ID to the last column
152-
$objWorksheet->setCellValue($lastColumn.$rowIndex, $foundValue);
160+
$objWorksheet->setCellValue($lastColumn.$rowIndex, $foundUsername);
161+
$objWorksheet->setCellValue($lastColumnID.$rowIndex, $foundID);
153162

154163
$studentCount++;
155164
}

Data Admin/version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
/**
2121
* Sets version information
2222
*/
23-
$moduleVersion="1.7.00" ;
23+
$moduleVersion="1.7.01" ;
2424
$coreVersion = '23.0.00';
2525

2626
$gibbonVersionRequired="23.0.00";

0 commit comments

Comments
 (0)