Skip to content

Conversation

@TamaroWalter
Copy link
Member

This is the first of many PR that redesigns this plugins. It starts with simple corrections and adds templates.

We have version control, we simply delete code and restore if
necessary.
@TamaroWalter TamaroWalter self-assigned this Dec 10, 2025
@TamaroWalter TamaroWalter requested review from dlmsr and removed request for dlmsr December 10, 2025 18:30
@dlmsr dlmsr marked this pull request as draft December 11, 2025 07:54
@dlmsr
Copy link
Member

dlmsr commented Dec 11, 2025

I am rebasing this on some previous changes from me which I did not push. So expect history-rewrites for this branch. I am, at the same time, looking at your commits, @TamaroWalter, and making some adjustments.

Copy link
Member

@dlmsr dlmsr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change remove deprecated utf8 function is a step in the right direction and we should keep it for this PR. In the long-run we should try to address #14.

Copy link
Member

@dlmsr dlmsr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add template for first overview is not quite the desired behaviour:

image

TamaroWalter and others added 4 commits December 11, 2025 11:15
Reason: utf8_encode is deprecated as of PHP 8.2.0.
We introduce a new renderable called first_overview which uses a
template for rendering the first overview.

Co-authored-by: Daniel Meißner <daniel.meissner@uni-muenster.de>
@dlmsr
Copy link
Member

dlmsr commented Dec 11, 2025

Just one quick question, @TamaroWalter:

fix SQL concatenation does not fix any bugs, does it? This is simply a reformatting of the SQL string building, right?

@TamaroWalter
Copy link
Member Author

Just one quick question, @TamaroWalter:

fix SQL concatenation does not fix any bugs, does it? This is simply a reformatting of the SQL string building, right?

When accessing the request.php i always got an exception throw in the sql query due to a false format. Because of that I added the cast to int values.

@dlmsr
Copy link
Member

dlmsr commented Dec 11, 2025

I see. I reverted the commit locally and do not get any failures. Do you remember the error message? As far as I can see veranstids is an array of strings which do indeed represent integers. However, the cast to type integer should not really have any effect as its later concatenated with the . operator which implicitely casts back to strings anyways. While we're on it, I am still fond of reformatting the SQL string to be more readable but I would drop the explicit casts to integers when there are not any errors. I will force-push my changes and maybe you can have a look and test them in your local setup to make sure you wouldn't get the error message from before (or any error message 😆).

@dlmsr dlmsr force-pushed the redesign/add_templates branch from bc7d8ff to 2c5c764 Compare December 11, 2025 15:12
@dlmsr dlmsr marked this pull request as ready for review December 11, 2025 16:06
@dlmsr
Copy link
Member

dlmsr commented Dec 11, 2025

@TamaroWalter, the pull request is ready for merge IMO. The error messages from the PHP CodeSniffer need to be addressed in another PR. Could you please test the changes with your local setup to make sure no new errors were introduced? I would want to merge this soon when you approve it.

@TamaroWalter
Copy link
Member Author

TamaroWalter commented Dec 11, 2025

Alright, I will check this

@TamaroWalter
Copy link
Member Author

TamaroWalter commented Dec 11, 2025

I see. I reverted the commit locally and do not get any failures. Do you remember the error message? As far as I can see veranstids is an array of strings which do indeed represent integers. However, the cast to type integer should not really have any effect as its later concatenated with the . operator which implicitely casts back to strings anyways. While we're on it, I am still fond of reformatting the SQL string to be more readable but I would drop the explicit casts to integers when there are not any errors. I will force-push my changes and maybe you can have a look and test them in your local setup to make sure you wouldn't get the error message from before (or any error message :D).

This was the error message i get when i click on the second option (The course exists and i am authorized to create it):

Exception - pg_fetch_object(): Argument #1 ($result) must be of type PgSql\Result, false given

[More information about this error](https://docs.moodle.org/501/en/error/moodle/generalexceptionmessage)

Debug info:
Error code: generalexceptionmessageDismiss this notification

Stack trace:
line 128 of /public/local/lsf_unification/lib_his.php: TypeError thrown
line 128 of /public/local/lsf_unification/lib_his.php: call to pg_fetch_object()
line 181 of /public/local/lsf_unification/lib_his.php: call to get_courses_by_veranstids()
line 93 of /public/local/lsf_unification/request.php: call to get_teachers_course_list()
line 180 of /public/local/lsf_unification/request.php: call to print_coursetable()
line 291 of /public/local/lsf_unification/request.php: call to print_remote_creation()

I have the tables from the beispieltabellen.sql that are linked in the documentation

@dlmsr
Copy link
Member

dlmsr commented Dec 12, 2025

Ok, thanks. Unfortunately, I cannot reproduce this one. Also, looking at the backtrace it seems to me that the error is unrelated to the modified query.

@TamaroWalter
Copy link
Member Author

Ok, thanks. Unfortunately, I cannot reproduce this one. Also, looking at the backtrace it seems to me that the error is unrelated to the modified query.

Maybe it's an error in the data...

@dlmsr dlmsr merged commit 2c5c764 into main Dec 12, 2025
3 of 4 checks passed
@TamaroWalter TamaroWalter deleted the redesign/add_templates branch December 12, 2025 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants