Attendance Code Error

Hello,
It seems there is an error with my attendance codes. I have some of them set to only show for certain groups, for example, “Field Trip” is set to only allow administrators to use it. However, it’s still showing up for teachers.

Please help, Thanks!

Hi jcarney2024, happy to help. Can you let us know which version of Gibbon you are using? If possible, can you also share a screenshot of what your Field Trip setting look like? This will help us narrow down the issue. Thanks!

I’m using Gibbon version 23.0.02. Here is what the settings look like for the “field trip” setting. However, I’ll let you know this happens with all types, not just this one.

Thanks!

Hi Sandra, just checking to see if there is any update on the issue?

Hi jcarney2024, I had a moment to dig deeper into this issue and it does appear that while the functionality was working in the past, some recent refactoring has disconnected it and it’s currently not working in v23.0.02. I have fixed it now for v24, which will release on June 20, 2022. Unlike other fixes, I don’t recommend applying this one manually, as there are a number of changes across files. Be sure to update though when the new version comes out. Thanks!

Thank you! I appreciate the help!

Hi Sandra,
In a development environment, I have updated all of the files to the latest commit of v24. I also did the /update.php function, and received no errors (I guess I’m still a little leery when it comes to knowing what to do to update your database, as it doesn’t show any updates on the updates page). It still seems to show the incorrect attendance codes, as well as on the Attendance Setup page, show a database error when trying to change or create an attendance type. Is this something I need to fix on my end? I will attach the error message, as well.

Thanks!

You shouldn’t need to use /update.php unless in an emergency. Going through the update page in System Admin > Update will show you exactly which lines are being updated, and give you an interface to check that you are up to date.

A database error here is odd, can you check to see that you are indeed up to date? Also, check your PHP error logs to see if there is an indication of what the database error is.

Hmm, that’s weird, because the System Admin Update page didn’t show that anything needed to be updated. It says I’m running v24.0.00. I did check my error logs, and I didn’t seem to find anything.

Error Log:

[Fri Jun 10 16:04:28.432264 2022] [mpm_prefork:notice] [pid 854] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured – resuming normal operations
[Fri Jun 10 16:04:28.432339 2022] [core:notice] [pid 854] AH00094: Command line: ‘/usr/sbin/apache2’
[Fri Jun 10 16:04:29.165280 2022] [mpm_prefork:notice] [pid 854] AH00171: Graceful restart requested, doing restart
[Fri Jun 10 16:04:29.240340 2022] [mpm_prefork:notice] [pid 854] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured – resuming normal operations
[Fri Jun 10 16:04:29.240358 2022] [core:notice] [pid 854] AH00094: Command line: ‘/usr/sbin/apache2’
[Fri Jun 10 16:05:11.191063 2022] [autoindex:error] [pid 1002] [client ...:53422] AH01276: Cannot serve directory /var/www/schooltool.carneyschools.org/uploads/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive
[Fri Jun 10 16:05:22.828279 2022] [autoindex:error] [pid 1201] [client ...:53426] AH01276: Cannot serve directory /var/www/schooltool.carneyschools.org/uploads/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive
[Fri Jun 10 16:05:28.027658 2022] [autoindex:error] [pid 940] [client ...:53428] AH01276: Cannot serve directory /var/www/schooltool.carneyschools.org/uploads/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive
[Fri Jun 10 16:05:49.771619 2022] [autoindex:error] [pid 1204] [client ...:53430] AH01276: Cannot serve directory /var/www/schooltool.carneyschools.org/uploads/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive
[Fri Jun 10 16:08:26.529736 2022] [php7:warn] [pid 1001] [client ..**.*:50696] PHP Warning: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘gibbonRoleIDAll’ in ‘field list’ in /var/www/schooltool.carneyschools.org/src/Database/Connection.php on line 194, referer: https://schooltool.carneyschools.org/index.php?q=%2Fmodules%2FSchool+Admin%2FattendanceSettings_manage_add.php

Sandra, I seem to have fixed the issue. It seems that the roles the code was available to changed from “gibbonRoleID” to “gibbonRoleIDAll.” My SQL server was apparently not made aware of this change, resulting in SQL code failing, when it was inputting gibbonRoleIDAll, because it wasn’t recognized. And now, the correct codes are showing to the correct people, thanks to the fix.

I’m still slightly confused as to why the database updates aren’t showing on the system admin page, though.

Hi Jack, I glanced back through the post, and I think I see what may have happened. The development version that lives on GitHub is our cutting edge version, and is flagged separately than the stable version. We recommend schools use the stable version, released on the website, for their production servers. Development installs are generally setup separately, and there is a flag in the system that marks them as cutting edge on install.

It looks like you may have had v23.0.02 installed, and then updated the v24 development release on top of that, which means your system is missing the cutting edge flag. To manually correct this, you’d need to go into your database into the gibbonSetting table and change the cuttingEdgeCode setting to Y. Then, when you go to the Update page, it should detect and be able to run line-by-line changes on your database.

Ah, I see. I wondered about that as well, but wasn’t sure about how to change the Cutting Edge Code setting! Thank you!

Okay, so not to be a complete pain, but now I seem to be getting an error:

The following SQL statements caused errors:
INSERT INTO gibbonAction (gibbonModuleID, name, precedence, category, description, URLList, entryURL, entrySidebar, menuShow, defaultPermissionAdmin, defaultPermissionTeacher, defaultPermissionStudent, defaultPermissionParent, defaultPermissionSupport, categoryPermissionStaff, categoryPermissionStudent, categoryPermissionParent, categoryPermissionOther) VALUES((SELECT gibbonModuleID FROM gibbonModule WHERE name=‘System Admin’), ‘Upload Photos & Files’, 0, ‘Data’, ‘’, ‘file_upload.php’, ‘file_upload.php’, ‘Y’, ‘Y’, ‘Y’, ‘N’, ‘N’, ‘N’, ‘N’, ‘Y’, ‘N’, ‘N’, ‘N’)
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘Upload Photos & Files-0003’ for key ‘gibbonAction.moduleActionName’

Okay, so I seem to have fixed this as well. It seems that when I ran the /update.php function earlier in the week, it did the database updates, but the php server wasn’t made aware of this, so it still wanted to update to the latest cutting edge code line. So, when it tried to do so, it was getting errors, because the changes had already been made.

Again, thank you for all your help over the past few weeks! Hopefully this thread can be closed for good! ?

Thanks,
Jack

No problem, happy to help and glad to hear you were able to sort it out.