Generating codes

Backend functionalities: user management, course management, reports, certificates, etc.
Post Reply
jamesd
Newbie
Posts: 17
Joined: Thu Sep 10, 2020 2:18 pm

Generating codes

Post by jamesd »

Quick question, when creating codes using the code module we have the choice of including numbers as well as lowercase and uppercase letters.

I'm seeing some strange behaviour:

[x] 0-9
[ ] a-z
[ ] A-Z
= Creates numeric codes correctly.

[ ] 0-9
[×] a-z
[ ] A-Z
= Creates lower case codes correctly.

[ ] 0-9
[ ] a-z
[×] A-Z
= Wrongly creates lower case codes.

[×] 0-9
[×] a-z
[ ] A-Z
= Wrongly creates codes with a mixture of numeric and upper case.

[×] 0-9
[ ] a-z
[×] A-Z
= Wrongly creates codes with a mixture of numeric and lower case.

[ ] 0-9
[×] a-z
[×] A-Z
= Creates lower and upper case codes correctly.

[×] 0-9
[×] a-z
[×] A-Z
= Creates codes with a mixture of numeric and both upper and lower case.

Looks like it might be a relatively straightforward bug with a mixup somewhere in the logic, does anyone have a fix?

alfa24
Senior Boarder
Posts: 1006
Joined: Fri Nov 24, 2017 8:45 am
Version: forma.lms 1.4.2

Re: Generating codes

Post by alfa24 »

In /appCore/modules/code/code.php

find:

Code: Select all

elseif ($use_number && $use_low_letter) {
replace with:

Code: Select all

elseif ($use_number && $use_high_letter) {
find:

Code: Select all

elseif ($use_number && $use_high_letter) {
replace with:

Code: Select all

elseif ($use_number && $use_low_letter) {
find:

Code: Select all

if ($use_low_letter)
replace with:

Code: Select all

if ($use_high_letter)
find:

Code: Select all

if ($use_high_letter)
replace with:

Code: Select all

if ($use_low_letter)
I'm Jasmines, the One. If you need, you can contact me.

jamesd
Newbie
Posts: 17
Joined: Thu Sep 10, 2020 2:18 pm

Re: Generating codes

Post by jamesd »

Thank you again. :)

Post Reply