External database enrollment issue again ...

External database enrollment issue again ...

by Julien Thomas -
Number of replies: 3

Hi everyone,

I'm french and I apologise for any gramatical mistakes that can occur.

I'm trying to use the moodle's possibilities with its external database authentification and enrolment plugins.

The sync_users.php works correctly for the creation of accounts with my database but sync.php for enrolment doesn't and I already read a lots of posts that don't help me.

My MySQL external database :

ETUDIANTS
id => int(11), not null, autoincrement
CodePermanent () => varchar (12), not null
Numero7 => varchar (8), not null
Nom => varchar(40), not null
Prenom => varchar(25), not null
Email => varchar(45)
Ville => varchar(45)
Pays => varchar(45)

COURS
id => int(11), not null, autoincrement
NumeroCours => varchar (8), not null
TitreCompletCours => varchar (255), not null
TitreCompletProgramme =>varchar (255), not null

INSCRIPTIONS
id => int(11), not null, autoincrement
CodePermanent => varchar(12), not null
NumeroCours => varchar(8), not null

 

I use Inscriptions to enrol users and Cours tables in order tocreate courses using moodle/enrol/database/cli/sync.php

For courses :
Full name is linked to TitreCompletCours in external database
Short name is linked to  NumeroCours in external database

New Courses id is linked to NumeroCours too
Category is linked to TitreCompletProgramme in external database

For enrolment :
Courses are identified by an idnumber corresponding to NumeroCours in external database
Students are identified by their username corresponding to Codepermanent in external database

The role is Student by default.

If I use this script on the server nothing happens at all :
/usr/bin/php /var/moodle/moodle.collegia.qc.ca/moodle/enrol/database/cli/sync.php
/usr/bin/php -c etc/php5/cli/php.ini /var/moodle/moodle.collegia.qc.ca/moodle/enrol/database/cli/sync.php -d log_errors=1 -d error_reporting=E_ALL -d display_errors=0 -d html_errors=0

Then with ADOdb debog and following line :
/usr/bin/php -c etc/php5/cli/php.ini /var/moodle/moodle.collegia.qc.ca/moodle/enrol/database/cli/sync.php -d log_errors=1 -d error_reporting=E_ALL -d display_errors=0 -d html_errors=0

I get those only informations more :

-----<hr>
(mysql): SET NAMES 'utf8'

-----<hr>
-----<hr>
(mysql): SELECT titrecompletcours,numerocours,titrecompletprogramme,numerocours
FROM Cours



-----<hr>
-----<hr>
(mysql): SET NAMES 'utf8'

-----<hr>
-----<hr>
(mysql): SELECT DISTINCT numerocours
FROM Inscriptions



-----<hr>

I'm locked, anybody knows from what could the problem come from ?

Thanks a lot, looking forward to our answers.

Julien

Average of ratings: -
In reply to Julien Thomas

Re: External database enrollment issue again ...

by Ben Graham -

Hi Julien,
I've struggled a lot to get my external database enrollment to work and I might have a hint for you.

You might want to try to make your column names all lowercase. My situation is different, but this was one of the things that was causing major bugs in my installation.

Example:

TitreCompletCours should be titrecompletcours

In reply to Ben Graham

Re: External database enrollment issue again ...

by Ramesh Jambulingam -

Hi Julien,

I will suggest you to make sure that 
NumeroCours ( used for course enrolment field)  values in your external database is not trailing with spaces if it is populated from script.

It is worth to make sure you use external database table collation UTF8.

I hope this discussion also will be helpful to resolve your issue. http://tracker.moodle.org/browse/MDL-29961.       

In reply to Julien Thomas

Re: External database enrollment issue again ...

by R. Gusmão -

Hi Julien,

Did you resolved this problem?, I have the same problem. The script creates the courses but does no enrol users.

P.S- All my tables and columns are with small characters with no spaces.

Thanks in advance