@@ -632,6 +632,7 @@ public function completion_rule_enabled($data) {
632
632
* Only available on moodleform_mod.
633
633
*
634
634
* @param stdClass $data the form data to be modified.
635
+ * @throws moodle_exception
635
636
*/
636
637
public function data_postprocessing ($ data ) {
637
638
parent ::data_postprocessing ($ data );
@@ -670,15 +671,23 @@ public function data_postprocessing($data) {
670
671
if ($ data ->exescormtype === EXESCORM_TYPE_EXESCORMNET ) {
671
672
if (! isset ($ data ->showgradingmanagement )) {
672
673
if (isset ($ data ->exebutton )) {
673
- // Editar y visualizar .
674
+ // Edit and view .
674
675
$ returnto = new moodle_url ("/mod/exescorm/view.php " , ['id ' => $ data ->coursemodule , 'forceview ' => 1 ]);
675
676
} else if (isset ($ data ->exebutton2 )) {
676
- // Editar y volver al curso .
677
+ // Edit and return to the course .
677
678
$ returnto = course_get_url ($ data ->course , $ data ->coursesection ?? null , ['sr ' => $ data ->sr ]);
678
679
} else {
679
- // Fallback por si no se pulsó ningún botón personalizado .
680
+ // Fallback in case no custom button was pressed .
680
681
$ returnto = course_get_url ($ data ->course );
681
682
}
683
+
684
+ // If for some reason the return URL is the qualifier, we force redirection to the activity.
685
+ if (strpos ($ returnto ->out (false ), '/grade/report/ ' ) !== false ) {
686
+ $ returnto = new moodle_url ("/mod/exescorm/view.php " , [
687
+ 'id ' => $ data ->coursemodule ,
688
+ 'forceview ' => 1
689
+ ]);
690
+ }
682
691
// Set this becouse modedit.php expects it.
683
692
$ data ->submitbutton = true ;
684
693
// If send template is true, we'll always make an edition. On new activities,
0 commit comments