Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1441 ariadna 1
<?php
2
// This file is part of Moodle - http://moodle.org/
3
//
4
// Moodle is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// Moodle is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
 
17
/**
18
 * Upgrade steps for Enrolment on payment
19
 *
20
 * Documentation: {@link https://moodledev.io/docs/guides/upgrade}
21
 *
22
 * @package    enrol_fee
23
 * @category   upgrade
24
 * @copyright  Marina Glancy
25
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
26
 */
27
 
28
/**
29
 * Execute the plugin upgrade steps from the given old version.
30
 *
31
 * @param int $oldversion
32
 * @return bool
33
 */
34
function xmldb_enrol_fee_upgrade($oldversion) {
35
    global $DB;
36
    $dbman = $DB->get_manager();
37
 
38
    if ($oldversion < 2025011300) {
39
        // Move the contents of the 'name' field into 'customchar1', it will be used as a internal description.
40
        // Starting from this version the 'name' will be visible to the potential students on the enrolment page.
41
        $DB->execute('UPDATE {enrol} SET customchar1 = name, name = ? '.
42
            'WHERE name IS NOT NULL AND name <> ? AND enrol = ?',
43
            ['', '', 'fee']);
44
        upgrade_plugin_savepoint(true, 2025011300, 'enrol', 'fee');
45
    }
46
 
47
    // Automatically generated Moodle v5.0.0 release upgrade line.
48
    // Put any upgrade step following this.
49
 
50
    return true;
51
}