chamilo / chamilo-lms

Chamilo is a learning management system focused on ease of use and accessibility
https://chamilo.org
GNU General Public License v3.0
769 stars 470 forks source link

Custom Certificate plugin: Fix bug for certificates with learnpath index as content type #5610

Open juancp-contidosdixitais opened 1 week ago

juancp-contidosdixitais commented 1 week ago

The certificate generation for certificates with learnpath index as content type is actually broken.

If we use this option, the custom certificates plugin code will attempt to instantiate a new LearnpathList object by passing a course code instead of a course_info array.

https://github.com/chamilo/chamilo-lms/blob/69d982f3f89340ae26e67a125f424c1a285ec9da/plugin/customcertificate/src/print_certificate.php#L33

https://github.com/chamilo/chamilo-lms/blob/69d982f3f89340ae26e67a125f424c1a285ec9da/plugin/customcertificate/src/print_certificate.php#L39-L47

https://github.com/chamilo/chamilo-lms/blob/69d982f3f89340ae26e67a125f424c1a285ec9da/plugin/customcertificate/src/print_certificate.php#L403-L410

https://github.com/chamilo/chamilo-lms/blob/69d982f3f89340ae26e67a125f424c1a285ec9da/main/lp/learnpathList.class.php#L31

https://github.com/chamilo/chamilo-lms/blob/69d982f3f89340ae26e67a125f424c1a285ec9da/main/lp/learnpathList.class.php#L39-L52

This PR fixes the issue by instantiating a new LearnpathList with the correct parameters. Additionally, the description of the LearnpathList constructor for the $courseInfo parameter has been corrected