From 7bfa648bddbfcda849721d4476965932aaac4e01 Mon Sep 17 00:00:00 2001 From: Bernhard Fischer Date: Tue, 28 Jan 2025 21:00:02 +0100 Subject: [PATCH] Linting --- db/upgrade.php | 1660 ++++++++++++++++++------ tests/optiondates/optiondates_test.php | 54 +- 2 files changed, 1283 insertions(+), 431 deletions(-) diff --git a/db/upgrade.php b/db/upgrade.php index d4c809f80..7e9d09e04 100755 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -38,26 +38,49 @@ function xmldb_booking_upgrade($oldversion) { $dbman = $DB->get_manager(); if ($oldversion < 2011020401) { - // Rename field text on table booking to text. $table = new xmldb_table('booking'); - $field = new xmldb_field('text', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, - 'name'); + $field = new xmldb_field( + 'text', + XMLDB_TYPE_TEXT, + 'small', + null, + XMLDB_NOTNULL, + null, + null, + 'name' + ); // Launch rename field text. $dbman->rename_field($table, $field, 'intro'); // Rename field format on table booking to format. $table = new xmldb_table('booking'); - $field = new xmldb_field('format', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, - null, '0', 'intro'); + $field = new xmldb_field( + 'format', + XMLDB_TYPE_INTEGER, + '4', + null, + XMLDB_NOTNULL, + null, + '0', + 'intro' + ); // Launch rename field format. $dbman->rename_field($table, $field, 'introformat'); $table = new xmldb_table('booking'); - $field = new xmldb_field('bookingpolicyformat', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, - null, '0', 'bookingpolicy'); + $field = new xmldb_field( + 'bookingpolicyformat', + XMLDB_TYPE_INTEGER, + '2', + null, + XMLDB_NOTNULL, + null, + '0', + 'bookingpolicy' + ); // Conditionally launch add field completionsubmit. if (!$dbman->field_exists($table, $field)) { @@ -67,8 +90,16 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2011020403) { $table = new xmldb_table('booking_options'); - $field = new xmldb_field('descriptionformat', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, - null, '0', 'description'); + $field = new xmldb_field( + 'descriptionformat', + XMLDB_TYPE_INTEGER, + '2', + null, + XMLDB_NOTNULL, + null, + '0', + 'description' + ); // Conditionally launch add field completionsubmit. if (!$dbman->field_exists($table, $field)) { @@ -80,8 +111,16 @@ function xmldb_booking_upgrade($oldversion) { if ($oldversion < 2012091601) { // Define field autoenrol to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('autoenrol', XMLDB_TYPE_INTEGER, '4', null, null, null, '0', - 'timemodified'); + $field = new xmldb_field( + 'autoenrol', + XMLDB_TYPE_INTEGER, + '4', + null, + null, + null, + '0', + 'timemodified' + ); // Conditionally launch add field autoenrol. if (!$dbman->field_exists($table, $field)) { @@ -96,25 +135,57 @@ function xmldb_booking_upgrade($oldversion) { if ($oldversion < 2012091602) { $table = new xmldb_table('booking'); - $field = new xmldb_field('bookedtext', XMLDB_TYPE_TEXT, 'medium', null, null, null, null, - 'autoenrol'); + $field = new xmldb_field( + 'bookedtext', + XMLDB_TYPE_TEXT, + 'medium', + null, + null, + null, + null, + 'autoenrol' + ); if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } - $field = new xmldb_field('waitingtext', XMLDB_TYPE_TEXT, 'medium', null, null, null, null, - 'bookedtext'); + $field = new xmldb_field( + 'waitingtext', + XMLDB_TYPE_TEXT, + 'medium', + null, + null, + null, + null, + 'bookedtext' + ); if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } - $field = new xmldb_field('statuschangetext', XMLDB_TYPE_TEXT, 'medium', null, null, null, - null, 'waitingtext'); + $field = new xmldb_field( + 'statuschangetext', + XMLDB_TYPE_TEXT, + 'medium', + null, + null, + null, + null, + 'waitingtext' + ); if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } - $field = new xmldb_field('deletedtext', XMLDB_TYPE_TEXT, 'medium', null, null, null, null, - 'statuschangetext'); + $field = new xmldb_field( + 'deletedtext', + XMLDB_TYPE_TEXT, + 'medium', + null, + null, + null, + null, + 'statuschangetext' + ); if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } @@ -124,8 +195,16 @@ function xmldb_booking_upgrade($oldversion) { if ($oldversion < 2012091603) { // Define field maxperuser to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('maxperuser', XMLDB_TYPE_INTEGER, '10', null, null, null, '0', - 'deletedtext'); + $field = new xmldb_field( + 'maxperuser', + XMLDB_TYPE_INTEGER, + '10', + null, + null, + null, + '0', + 'deletedtext' + ); // Conditionally launch add field maxperuser. if (!$dbman->field_exists($table, $field)) { @@ -135,19 +214,34 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2014012807) { - // Define field addtocalendar to be added to booking_options. $table = new xmldb_table('booking_options'); - $field = new xmldb_field('addtocalendar', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, - '0', 'timemodified'); + $field = new xmldb_field( + 'addtocalendar', + XMLDB_TYPE_INTEGER, + '2', + null, + XMLDB_NOTNULL, + null, + '0', + 'timemodified' + ); // Conditionally launch add field addtocalendar. if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } - $field = new xmldb_field('calendarid', XMLDB_TYPE_INTEGER, '10', null, null, null, '0', - 'addtocalendar'); + $field = new xmldb_field( + 'calendarid', + XMLDB_TYPE_INTEGER, + '10', + null, + null, + null, + '0', + 'addtocalendar' + ); // Conditionally launch add field calendarid. if (!$dbman->field_exists($table, $field)) { @@ -159,36 +253,75 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2014030600) { - $table = new xmldb_table('booking'); $tableoptions = new xmldb_table('booking_options'); - $field = new xmldb_field('duration', XMLDB_TYPE_CHAR, '255', null, null, null, null, - 'maxperuser'); + $field = new xmldb_field( + 'duration', + XMLDB_TYPE_CHAR, + '255', + null, + null, + null, + null, + 'maxperuser' + ); if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } - $field = new xmldb_field('points', XMLDB_TYPE_INTEGER, '10', null, null, null, null, - 'duration'); + $field = new xmldb_field( + 'points', + XMLDB_TYPE_INTEGER, + '10', + null, + null, + null, + null, + 'duration' + ); if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } - $field = new xmldb_field('organizatorname', XMLDB_TYPE_CHAR, '255', null, null, null, null, - 'points'); + $field = new xmldb_field( + 'organizatorname', + XMLDB_TYPE_CHAR, + '255', + null, + null, + null, + null, + 'points' + ); if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } - $field = new xmldb_field('pollurl', XMLDB_TYPE_CHAR, '255', null, null, null, null, - 'organizatorname'); + $field = new xmldb_field( + 'pollurl', + XMLDB_TYPE_CHAR, + '255', + null, + null, + null, + null, + 'organizatorname' + ); if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } - $field = new xmldb_field('pollurl', XMLDB_TYPE_CHAR, '255', null, null, null, null, - 'calendarid'); + $field = new xmldb_field( + 'pollurl', + XMLDB_TYPE_CHAR, + '255', + null, + null, + null, + null, + 'calendarid' + ); if (!$dbman->field_exists($tableoptions, $field)) { $dbman->add_field($tableoptions, $field); } @@ -202,8 +335,16 @@ function xmldb_booking_upgrade($oldversion) { } // Define field addtogroup to be added to booking. - $field = new xmldb_field('addtogroup', XMLDB_TYPE_INTEGER, '4', null, null, null, '0', - 'pollurl'); + $field = new xmldb_field( + 'addtogroup', + XMLDB_TYPE_INTEGER, + '4', + null, + null, + null, + '0', + 'pollurl' + ); // Conditionally launch add field addtogroup. if (!$dbman->field_exists($table, $field)) { @@ -224,11 +365,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2014030601) { - // Define field groupid to be added to booking_options. $table = new xmldb_table('booking_options'); - $field = new xmldb_field('groupid', XMLDB_TYPE_INTEGER, '11', null, null, null, null, - 'pollurl'); + $field = new xmldb_field( + 'groupid', + XMLDB_TYPE_INTEGER, + '11', + null, + null, + null, + null, + 'pollurl' + ); // Conditionally launch add field groupid. if (!$dbman->field_exists($table, $field)) { @@ -240,7 +388,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2014031100) { - // Define table booking_category to be created. $table = new xmldb_table('booking_category'); @@ -263,11 +410,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2014031200) { - // Define field categoryid to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('categoryid', XMLDB_TYPE_INTEGER, '10', null, null, null, null, - 'addtogroup'); + $field = new xmldb_field( + 'categoryid', + XMLDB_TYPE_INTEGER, + '10', + null, + null, + null, + null, + 'addtogroup' + ); // Conditionally launch add field categoryid. if (!$dbman->field_exists($table, $field)) { @@ -279,11 +433,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2014031700) { - // Define field pollurltext to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('pollurltext', XMLDB_TYPE_TEXT, null, null, null, null, null, - 'categoryid'); + $field = new xmldb_field( + 'pollurltext', + XMLDB_TYPE_TEXT, + null, + null, + null, + null, + null, + 'categoryid' + ); // Conditionally launch add field pollurltext. if (!$dbman->field_exists($table, $field)) { @@ -295,7 +456,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2014031900) { - // Define table booking_teachers to be created. $table = new xmldb_table('booking_teachers'); @@ -308,8 +468,13 @@ function xmldb_booking_upgrade($oldversion) { // Adding keys to table booking_teachers. $table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']); $table->add_key('bookingid', XMLDB_KEY_FOREIGN, ['bookingid'], 'booking', ['id']); - $table->add_key('optionid', XMLDB_KEY_FOREIGN, ['optionid'], 'booking_options', - ['id']); + $table->add_key( + 'optionid', + XMLDB_KEY_FOREIGN, + ['optionid'], + 'booking_options', + ['id'] + ); // Adding indexes to table booking_teachers. $index = new xmldb_index('userid', XMLDB_INDEX_NOTUNIQUE, ['userid']); @@ -327,11 +492,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2014032000) { - // Define field additionalfields to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('additionalfields', XMLDB_TYPE_TEXT, null, null, null, null, null, - 'pollurltext'); + $field = new xmldb_field( + 'additionalfields', + XMLDB_TYPE_TEXT, + null, + null, + null, + null, + null, + 'pollurltext' + ); // Conditionally launch add field additionalfields. if (!$dbman->field_exists($table, $field)) { @@ -343,19 +515,34 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2014032101) { - // Define field daystonotify to be added to booking_options. $table = new xmldb_table('booking_options'); - $field = new xmldb_field('daystonotify', XMLDB_TYPE_INTEGER, '3', null, null, null, '0', - 'groupid'); + $field = new xmldb_field( + 'daystonotify', + XMLDB_TYPE_INTEGER, + '3', + null, + null, + null, + '0', + 'groupid' + ); // Conditionally launch add field daystonotify. if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } - $field = new xmldb_field('sent', XMLDB_TYPE_INTEGER, '1', null, null, null, '0', - 'daystonotify'); + $field = new xmldb_field( + 'sent', + XMLDB_TYPE_INTEGER, + '1', + null, + null, + null, + '0', + 'daystonotify' + ); // Conditionally launch add field sent. if (!$dbman->field_exists($table, $field)) { @@ -367,30 +554,61 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2014032600) { - $table = new xmldb_table('booking'); $tableoptions = new xmldb_table('booking_options'); - $field = new xmldb_field('poolurl', XMLDB_TYPE_CHAR, '255', null, null, null, null, - 'organizatorname'); + $field = new xmldb_field( + 'poolurl', + XMLDB_TYPE_CHAR, + '255', + null, + null, + null, + null, + 'organizatorname' + ); if ($dbman->field_exists($table, $field)) { $dbman->rename_field($table, $field, 'pollurl'); } - $field = new xmldb_field('poolurl', XMLDB_TYPE_CHAR, '255', null, null, null, null, - 'organizatorname'); + $field = new xmldb_field( + 'poolurl', + XMLDB_TYPE_CHAR, + '255', + null, + null, + null, + null, + 'organizatorname' + ); if ($dbman->field_exists($table, $field)) { $dbman->rename_field($table, $field, 'pollurl'); } - $field = new xmldb_field('poolurltext', XMLDB_TYPE_TEXT, null, null, null, null, null, - 'categoryid'); + $field = new xmldb_field( + 'poolurltext', + XMLDB_TYPE_TEXT, + null, + null, + null, + null, + null, + 'categoryid' + ); if ($dbman->field_exists($table, $field)) { $dbman->rename_field($table, $field, 'pollurltext'); } - $field = new xmldb_field('poolurl', XMLDB_TYPE_CHAR, '255', null, null, null, null, - 'calendarid'); + $field = new xmldb_field( + 'poolurl', + XMLDB_TYPE_CHAR, + '255', + null, + null, + null, + null, + 'calendarid' + ); if ($dbman->field_exists($tableoptions, $field)) { $dbman->rename_field($tableoptions, $field, 'pollurl'); } @@ -400,11 +618,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2014032800) { - // Changing type of field categoryid on table booking to text. $table = new xmldb_table('booking'); - $field = new xmldb_field('categoryid', XMLDB_TYPE_TEXT, null, null, null, null, null, - 'addtogroup'); + $field = new xmldb_field( + 'categoryid', + XMLDB_TYPE_TEXT, + null, + null, + null, + null, + null, + 'addtogroup' + ); // Launch change of type for field categoryid. $dbman->change_field_type($table, $field); @@ -414,11 +639,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2014033101) { - // Changing the default of field eventtype on table booking to Booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('eventtype', XMLDB_TYPE_CHAR, '255', null, null, null, 'Booking', - 'additionalfields'); + $field = new xmldb_field( + 'eventtype', + XMLDB_TYPE_CHAR, + '255', + null, + null, + null, + 'Booking', + 'additionalfields' + ); // Launch change of default for field eventtype. $dbman->change_field_default($table, $field); @@ -428,11 +660,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2014040700) { - // Changing type of field points on table booking to number. $table = new xmldb_table('booking'); - $field = new xmldb_field('points', XMLDB_TYPE_NUMBER, '10, 2', null, null, null, null, - 'duration'); + $field = new xmldb_field( + 'points', + XMLDB_TYPE_NUMBER, + '10, 2', + null, + null, + null, + null, + 'duration' + ); // Launch change of type for field points. $dbman->change_field_type($table, $field); @@ -442,10 +681,17 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2014091600) { - $table = new xmldb_table('booking'); - $field = new xmldb_field('eventtype', XMLDB_TYPE_CHAR, '255', null, null, null, null, - 'additionalfields'); + $field = new xmldb_field( + 'eventtype', + XMLDB_TYPE_CHAR, + '255', + null, + null, + null, + null, + 'additionalfields' + ); // Conditionally launch add field eventtype. if (!$dbman->field_exists($table, $field)) { @@ -454,8 +700,16 @@ function xmldb_booking_upgrade($oldversion) { // Define field notificationtext to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('notificationtext', XMLDB_TYPE_TEXT, null, null, null, null, null, - 'eventtype'); + $field = new xmldb_field( + 'notificationtext', + XMLDB_TYPE_TEXT, + null, + null, + null, + null, + null, + 'eventtype' + ); // Conditionally launch add field notificationtext. if (!$dbman->field_exists($table, $field)) { @@ -463,8 +717,16 @@ function xmldb_booking_upgrade($oldversion) { } // Define field completed to be added to booking_answers. $table = new xmldb_table('booking_answers'); - $field = new xmldb_field('completed', XMLDB_TYPE_INTEGER, '1', null, null, null, '0', - 'timemodified'); + $field = new xmldb_field( + 'completed', + XMLDB_TYPE_INTEGER, + '1', + null, + null, + null, + '0', + 'timemodified' + ); // Conditionally launch add field completed. if (!$dbman->field_exists($table, $field)) { @@ -473,8 +735,16 @@ function xmldb_booking_upgrade($oldversion) { // Define field userleave to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('userleave', XMLDB_TYPE_TEXT, null, null, null, null, null, - 'notificationtext'); + $field = new xmldb_field( + 'userleave', + XMLDB_TYPE_TEXT, + null, + null, + null, + null, + null, + 'notificationtext' + ); // Conditionally launch add field userleave. if (!$dbman->field_exists($table, $field)) { @@ -483,8 +753,16 @@ function xmldb_booking_upgrade($oldversion) { // Define field enablecompletion to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('enablecompletion', XMLDB_TYPE_INTEGER, '1', null, null, null, '0', - 'userleave'); + $field = new xmldb_field( + 'enablecompletion', + XMLDB_TYPE_INTEGER, + '1', + null, + null, + null, + '0', + 'userleave' + ); // Conditionally launch add field enablecompletion. if (!$dbman->field_exists($table, $field)) { @@ -496,26 +774,49 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2014092901) { - // Define field pollurlteachers to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('pollurlteachers', XMLDB_TYPE_CHAR, '255', null, null, null, null, - 'enablecompletion'); + $field = new xmldb_field( + 'pollurlteachers', + XMLDB_TYPE_CHAR, + '255', + null, + null, + null, + null, + 'enablecompletion' + ); // Conditionally launch add field pollurlteachers. if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } - $field = new xmldb_field('pollurlteacherstext', XMLDB_TYPE_TEXT, null, null, null, null, - null, 'pollurlteachers'); + $field = new xmldb_field( + 'pollurlteacherstext', + XMLDB_TYPE_TEXT, + null, + null, + null, + null, + null, + 'pollurlteachers' + ); // Conditionally launch add field pollurlteacherstext. if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } - $field = new xmldb_field('pollurlteachers', XMLDB_TYPE_CHAR, '255', null, null, null, null, - 'address'); + $field = new xmldb_field( + 'pollurlteachers', + XMLDB_TYPE_CHAR, + '255', + null, + null, + null, + null, + 'address' + ); // Conditionally launch add field pollurlteachers. if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); @@ -530,16 +831,32 @@ function xmldb_booking_upgrade($oldversion) { $dbman->add_field($table, $field); } - $field = new xmldb_field('institution', XMLDB_TYPE_CHAR, '255', null, null, null, null, - 'location'); + $field = new xmldb_field( + 'institution', + XMLDB_TYPE_CHAR, + '255', + null, + null, + null, + null, + 'location' + ); // Conditionally launch add field institution. if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } - $field = new xmldb_field('address', XMLDB_TYPE_CHAR, '255', null, null, null, null, - 'institution'); + $field = new xmldb_field( + 'address', + XMLDB_TYPE_CHAR, + '255', + null, + null, + null, + null, + 'institution' + ); // Conditionally launch add field address. if (!$dbman->field_exists($table, $field)) { @@ -551,11 +868,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2014111800) { - // Define field timecreated to be added to booking_answers. $table = new xmldb_table('booking_answers'); - $field = new xmldb_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, - '0', 'completed'); + $field = new xmldb_field( + 'timecreated', + XMLDB_TYPE_INTEGER, + '10', + null, + XMLDB_NOTNULL, + null, + '0', + 'completed' + ); // Conditionally launch add field timecreated. if (!$dbman->field_exists($table, $field)) { @@ -567,7 +891,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2014111900) { - // Define table booking_tags to be created. $table = new xmldb_table('booking_tags'); @@ -590,11 +913,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2014112600) { - // Define field addtocalendar to be added to booking_options. $table = new xmldb_table('booking'); - $field = new xmldb_field('sendmailtobooker', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, - null, '0', 'maxperuser'); + $field = new xmldb_field( + 'sendmailtobooker', + XMLDB_TYPE_INTEGER, + '2', + null, + XMLDB_NOTNULL, + null, + '0', + 'maxperuser' + ); // Conditionally launch add field sendmailtobooker. if (!$dbman->field_exists($table, $field)) { @@ -606,11 +936,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2014120800) { - // Define field waitinglist to be added to booking_answers. $table = new xmldb_table('booking_answers'); - $field = new xmldb_field('waitinglist', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, - '0', 'timecreated'); + $field = new xmldb_field( + 'waitinglist', + XMLDB_TYPE_INTEGER, + '1', + null, + XMLDB_NOTNULL, + null, + '0', + 'timecreated' + ); // Conditionally launch add field waitinglist. if (!$dbman->field_exists($table, $field)) { @@ -622,11 +959,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2014121000) { - // Define field cancancelbook to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('cancancelbook', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, - '0', 'pollurlteacherstext'); + $field = new xmldb_field( + 'cancancelbook', + XMLDB_TYPE_INTEGER, + '1', + null, + XMLDB_NOTNULL, + null, + '0', + 'pollurlteacherstext' + ); // Conditionally launch add field cancancelbook. if (!$dbman->field_exists($table, $field)) { @@ -638,11 +982,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2014122900) { - // Define field conectedbooking to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('conectedbooking', XMLDB_TYPE_INTEGER, '10', null, null, null, '0', - 'cancancelbook'); + $field = new xmldb_field( + 'conectedbooking', + XMLDB_TYPE_INTEGER, + '10', + null, + null, + null, + '0', + 'cancancelbook' + ); // Conditionally launch add field conectedbooking. if (!$dbman->field_exists($table, $field)) { @@ -654,11 +1005,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2014123000) { - // Define field conectedoption to be added to booking_options. $table = new xmldb_table('booking_options'); - $field = new xmldb_field('conectedoption', XMLDB_TYPE_INTEGER, '10', null, null, null, '0', - 'pollurlteachers'); + $field = new xmldb_field( + 'conectedoption', + XMLDB_TYPE_INTEGER, + '10', + null, + null, + null, + '0', + 'pollurlteachers' + ); // Conditionally launch add field conectedoption. if (!$dbman->field_exists($table, $field)) { @@ -670,11 +1028,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2014123001) { - // Define field howmanyusers to be added to booking_options. $table = new xmldb_table('booking_options'); - $field = new xmldb_field('howmanyusers', XMLDB_TYPE_INTEGER, '10', null, null, null, '0', - 'conectedoption'); + $field = new xmldb_field( + 'howmanyusers', + XMLDB_TYPE_INTEGER, + '10', + null, + null, + null, + '0', + 'conectedoption' + ); // Conditionally launch add field howmanyusers. if (!$dbman->field_exists($table, $field)) { @@ -686,11 +1051,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2015012000) { - // Define field completed to be added to booking_teachers. $table = new xmldb_table('booking_teachers'); - $field = new xmldb_field('completed', XMLDB_TYPE_INTEGER, '1', null, null, null, '0', - 'optionid'); + $field = new xmldb_field( + 'completed', + XMLDB_TYPE_INTEGER, + '1', + null, + null, + null, + '0', + 'optionid' + ); // Conditionally launch add field completed. if (!$dbman->field_exists($table, $field)) { @@ -702,11 +1074,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2015012100) { - // Define field showinapi to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('showinapi', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, - '1', 'conectedbooking'); + $field = new xmldb_field( + 'showinapi', + XMLDB_TYPE_INTEGER, + '1', + null, + XMLDB_NOTNULL, + null, + '1', + 'conectedbooking' + ); // Conditionally launch add field showinapi. if (!$dbman->field_exists($table, $field)) { @@ -718,11 +1097,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2015031000) { - // Define field pollsend to be added to booking_options. $table = new xmldb_table('booking_options'); - $field = new xmldb_field('pollsend', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', - 'howmanyusers'); + $field = new xmldb_field( + 'pollsend', + XMLDB_TYPE_INTEGER, + '1', + null, + XMLDB_NOTNULL, + null, + '0', + 'howmanyusers' + ); // Conditionally launch add field pollsend. if (!$dbman->field_exists($table, $field)) { @@ -734,11 +1120,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2015031700) { - // Define field id to be added to booking_tags. $table = new xmldb_table('booking_tags'); - $field = new xmldb_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, - null, null); + $field = new xmldb_field( + 'id', + XMLDB_TYPE_INTEGER, + '10', + null, + XMLDB_NOTNULL, + XMLDB_SEQUENCE, + null, + null + ); // Conditionally launch add field id. if (!$dbman->field_exists($table, $field)) { @@ -750,11 +1143,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2015032400) { - // Define field removeafterminutes to be added to booking_options. $table = new xmldb_table('booking_options'); - $field = new xmldb_field('removeafterminutes', XMLDB_TYPE_INTEGER, '5', null, XMLDB_NOTNULL, - null, '0', 'pollsend'); + $field = new xmldb_field( + 'removeafterminutes', + XMLDB_TYPE_INTEGER, + '5', + null, + XMLDB_NOTNULL, + null, + '0', + 'pollsend' + ); // Conditionally launch add field removeafterminutes. if (!$dbman->field_exists($table, $field)) { @@ -766,11 +1166,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2015051800) { - // Define field btncacname to be added to booking_options. $table = new xmldb_table('booking_options'); - $field = new xmldb_field('btncacname', XMLDB_TYPE_CHAR, '128', null, XMLDB_NOTNULL, null, - null, 'removeafterminutes'); + $field = new xmldb_field( + 'btncacname', + XMLDB_TYPE_CHAR, + '128', + null, + XMLDB_NOTNULL, + null, + null, + 'removeafterminutes' + ); // Conditionally launch add field btncacname. if (!$dbman->field_exists($table, $field)) { @@ -782,19 +1189,34 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2015051900) { - // Define field lblteachname to be added to booking_options. $table = new xmldb_table('booking_options'); - $field = new xmldb_field('lblteachname', XMLDB_TYPE_CHAR, '128', null, XMLDB_NOTNULL, null, - null, 'btncacname'); + $field = new xmldb_field( + 'lblteachname', + XMLDB_TYPE_CHAR, + '128', + null, + XMLDB_NOTNULL, + null, + null, + 'btncacname' + ); // Conditionally launch add field lblteachname. if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } - $field = new xmldb_field('lblsputtname', XMLDB_TYPE_CHAR, '128', null, XMLDB_NOTNULL, null, - null, 'lblteachname'); + $field = new xmldb_field( + 'lblsputtname', + XMLDB_TYPE_CHAR, + '128', + null, + XMLDB_NOTNULL, + null, + null, + 'lblteachname' + ); // Conditionally launch add field lblsputtname. if (!$dbman->field_exists($table, $field)) { @@ -806,11 +1228,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2015051901) { - // Define field notificationtext to be added to booking_options. $table = new xmldb_table('booking_options'); - $field = new xmldb_field('notificationtext', XMLDB_TYPE_TEXT, null, null, null, null, null, - 'lblsputtname'); + $field = new xmldb_field( + 'notificationtext', + XMLDB_TYPE_TEXT, + null, + null, + null, + null, + null, + 'lblsputtname' + ); // Conditionally launch add field notificationtext. if (!$dbman->field_exists($table, $field)) { @@ -822,11 +1251,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2015051902) { - // Define field notificationtextformat to be added to booking_options. $table = new xmldb_table('booking_options'); - $field = new xmldb_field('notificationtextformat', XMLDB_TYPE_INTEGER, '2', null, - XMLDB_NOTNULL, null, '0', 'notificationtext'); + $field = new xmldb_field( + 'notificationtextformat', + XMLDB_TYPE_INTEGER, + '2', + null, + XMLDB_NOTNULL, + null, + '0', + 'notificationtext' + ); // Conditionally launch add field notificationtextformat. if (!$dbman->field_exists($table, $field)) { @@ -838,19 +1274,34 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2015052000) { - // Define field btnbooknowname to be added to booking_options. $table = new xmldb_table('booking_options'); - $field = new xmldb_field('btnbooknowname', XMLDB_TYPE_CHAR, '128', null, XMLDB_NOTNULL, null, - null, 'notificationtextformat'); + $field = new xmldb_field( + 'btnbooknowname', + XMLDB_TYPE_CHAR, + '128', + null, + XMLDB_NOTNULL, + null, + null, + 'notificationtextformat' + ); // Conditionally launch add field btnbooknowname. if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } - $field = new xmldb_field('btncancelname', XMLDB_TYPE_CHAR, '128', null, XMLDB_NOTNULL, null, - null, 'btnbooknowname'); + $field = new xmldb_field( + 'btncancelname', + XMLDB_TYPE_CHAR, + '128', + null, + XMLDB_NOTNULL, + null, + null, + 'btnbooknowname' + ); // Conditionally launch add field btncancelname. if (!$dbman->field_exists($table, $field)) { @@ -862,7 +1313,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2015062200) { - // Define table booking_institutions to be created. $table = new xmldb_table('booking_institutions'); @@ -884,11 +1334,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2015092400) { - // Define field disablebookingusers to be added to booking_options. $table = new xmldb_table('booking_options'); - $field = new xmldb_field('disablebookingusers', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, - null, '0', 'btncancelname'); + $field = new xmldb_field( + 'disablebookingusers', + XMLDB_TYPE_INTEGER, + '2', + null, + XMLDB_NOTNULL, + null, + '0', + 'btncancelname' + ); // Conditionally launch add field disablebookingusers. if (!$dbman->field_exists($table, $field)) { @@ -903,40 +1360,80 @@ function xmldb_booking_upgrade($oldversion) { // Define field lblbooking to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('lblbooking', XMLDB_TYPE_CHAR, '64', null, null, null, null, - 'showinapi'); + $field = new xmldb_field( + 'lblbooking', + XMLDB_TYPE_CHAR, + '64', + null, + null, + null, + null, + 'showinapi' + ); // Conditionally launch add field lblbooking. if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } - $field = new xmldb_field('lbllocation', XMLDB_TYPE_CHAR, '64', null, null, null, null, - 'lblbooking'); + $field = new xmldb_field( + 'lbllocation', + XMLDB_TYPE_CHAR, + '64', + null, + null, + null, + null, + 'lblbooking' + ); // Conditionally launch add field lbllocation. if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } - $field = new xmldb_field('lblinstitution', XMLDB_TYPE_CHAR, '64', null, null, null, null, - 'lbllocation'); + $field = new xmldb_field( + 'lblinstitution', + XMLDB_TYPE_CHAR, + '64', + null, + null, + null, + null, + 'lbllocation' + ); // Conditionally launch add field lblinstitution. if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } - $field = new xmldb_field('lblname', XMLDB_TYPE_CHAR, '64', null, null, null, null, - 'lblinstitution'); + $field = new xmldb_field( + 'lblname', + XMLDB_TYPE_CHAR, + '64', + null, + null, + null, + null, + 'lblinstitution' + ); // Conditionally launch add field lblname. if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } - $field = new xmldb_field('lblsurname', XMLDB_TYPE_CHAR, '64', null, null, null, null, - 'lblname'); + $field = new xmldb_field( + 'lblsurname', + XMLDB_TYPE_CHAR, + '64', + null, + null, + null, + null, + 'lblname' + ); // Conditionally launch add field lblsurname. if (!$dbman->field_exists($table, $field)) { @@ -948,7 +1445,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2015110600) { - // Define field btncancelname to be dropped from booking_options. $table = new xmldb_table('booking_options'); @@ -979,32 +1475,72 @@ function xmldb_booking_upgrade($oldversion) { $table = new xmldb_table('booking'); - $field = new xmldb_field('btncacname', XMLDB_TYPE_CHAR, '64', null, null, null, null, - 'lblsurname'); + $field = new xmldb_field( + 'btncacname', + XMLDB_TYPE_CHAR, + '64', + null, + null, + null, + null, + 'lblsurname' + ); if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } - $field = new xmldb_field('lblteachname', XMLDB_TYPE_CHAR, '64', null, null, null, null, - 'btncacname'); + $field = new xmldb_field( + 'lblteachname', + XMLDB_TYPE_CHAR, + '64', + null, + null, + null, + null, + 'btncacname' + ); if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } - $field = new xmldb_field('lblsputtname', XMLDB_TYPE_CHAR, '64', null, null, null, null, - 'lblteachname'); + $field = new xmldb_field( + 'lblsputtname', + XMLDB_TYPE_CHAR, + '64', + null, + null, + null, + null, + 'lblteachname' + ); if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } - $field = new xmldb_field('btnbooknowname', XMLDB_TYPE_CHAR, '64', null, null, null, null, - 'lblsputtname'); + $field = new xmldb_field( + 'btnbooknowname', + XMLDB_TYPE_CHAR, + '64', + null, + null, + null, + null, + 'lblsputtname' + ); if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } - $field = new xmldb_field('btncancelname', XMLDB_TYPE_CHAR, '64', null, null, null, null, - 'btnbooknowname'); + $field = new xmldb_field( + 'btncancelname', + XMLDB_TYPE_CHAR, + '64', + null, + null, + null, + null, + 'btnbooknowname' + ); if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } @@ -1014,7 +1550,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2015122100) { - // Define field conectedoption to be dropped from booking_options. $table = new xmldb_table('booking_options'); $field = new xmldb_field('conectedoption'); @@ -1029,11 +1564,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2015122101) { - // Define field frombookingid to be added to booking_answers. $table = new xmldb_table('booking_answers'); - $field = new xmldb_field('frombookingid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, - null, '0', 'waitinglist'); + $field = new xmldb_field( + 'frombookingid', + XMLDB_TYPE_INTEGER, + '10', + null, + XMLDB_NOTNULL, + null, + '0', + 'waitinglist' + ); // Conditionally launch add field frombookingid. if (!$dbman->field_exists($table, $field)) { @@ -1045,11 +1587,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2016011200) { - // Define field booktootherbooking to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('booktootherbooking', XMLDB_TYPE_CHAR, '64', null, null, null, null, - 'btncancelname'); + $field = new xmldb_field( + 'booktootherbooking', + XMLDB_TYPE_CHAR, + '64', + null, + null, + null, + null, + 'btncancelname' + ); // Conditionally launch add field booktootherbooking. if (!$dbman->field_exists($table, $field)) { @@ -1061,15 +1610,21 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2016011800) { - // Define table booking_other to be created. $table = new xmldb_table('booking_other'); // Adding fields to table booking_other. $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); $table->add_field('optionid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); - $table->add_field('otheroptionid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, - null); + $table->add_field( + 'otheroptionid', + XMLDB_TYPE_INTEGER, + '10', + null, + XMLDB_NOTNULL, + null, + null + ); $table->add_field('limit', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0'); // Adding keys to table booking_other. @@ -1091,7 +1646,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2016011901) { - // Define table booking_other to be dropped. $table = new xmldb_table('booking_other'); @@ -1106,8 +1660,15 @@ function xmldb_booking_upgrade($oldversion) { // Adding fields to table booking_other. $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); $table->add_field('optionid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); - $table->add_field('otheroptionid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, - null); + $table->add_field( + 'otheroptionid', + XMLDB_TYPE_INTEGER, + '10', + null, + XMLDB_NOTNULL, + null, + null + ); $table->add_field('userslimit', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0'); // Adding keys to table booking_other. @@ -1129,19 +1690,34 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2016021100) { - // Define field lblacceptingfrom to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('lblacceptingfrom', XMLDB_TYPE_CHAR, '64', null, null, null, null, - 'booktootherbooking'); + $field = new xmldb_field( + 'lblacceptingfrom', + XMLDB_TYPE_CHAR, + '64', + null, + null, + null, + null, + 'booktootherbooking' + ); // Conditionally launch add field lblacceptingfrom. if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } - $field = new xmldb_field('lblnumofusers', XMLDB_TYPE_CHAR, '64', null, null, null, null, - 'lblacceptingfrom'); + $field = new xmldb_field( + 'lblnumofusers', + XMLDB_TYPE_CHAR, + '64', + null, + null, + null, + null, + 'lblacceptingfrom' + ); // Conditionally launch add field lblnumofusers. if (!$dbman->field_exists($table, $field)) { @@ -1153,11 +1729,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2016041500) { - // Define field numgenerator to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('numgenerator', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, - '0', 'lblnumofusers'); + $field = new xmldb_field( + 'numgenerator', + XMLDB_TYPE_INTEGER, + '1', + null, + XMLDB_NOTNULL, + null, + '0', + 'lblnumofusers' + ); // Conditionally launch add field numgenerator. if (!$dbman->field_exists($table, $field)) { @@ -1169,11 +1752,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2016041501) { - // Define field numrec to be added to booking_answers. $table = new xmldb_table('booking_answers'); - $field = new xmldb_field('numrec', XMLDB_TYPE_INTEGER, '11', null, XMLDB_NOTNULL, null, '0', - 'frombookingid'); + $field = new xmldb_field( + 'numrec', + XMLDB_TYPE_INTEGER, + '11', + null, + XMLDB_NOTNULL, + null, + '0', + 'frombookingid' + ); // Conditionally launch add field numrec. if (!$dbman->field_exists($table, $field)) { @@ -1185,11 +1775,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2016041502) { - // Define field paginationnum to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('paginationnum', XMLDB_TYPE_INTEGER, '5', null, XMLDB_NOTNULL, null, - '25', 'numgenerator'); + $field = new xmldb_field( + 'paginationnum', + XMLDB_TYPE_INTEGER, + '5', + null, + XMLDB_NOTNULL, + null, + '25', + 'numgenerator' + ); // Conditionally launch add field paginationnum. if (!$dbman->field_exists($table, $field)) { @@ -1201,7 +1798,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2016051201) { - // Define index courseid (not unique) to be added to booking_tags. $table = new xmldb_table('booking_tags'); $index = new xmldb_index('courseid', XMLDB_INDEX_NOTUNIQUE, ['courseid']); @@ -1216,18 +1812,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2016051703) { - // Course ids from all courses with booking instance. $courseids = $DB->get_fieldset_sql('SELECT DISTINCT course FROM {booking}', []); foreach ($courseids as $courseid) { - // Delete all records made by now deleted users from booking_answers. $deletedusers = $DB->get_fieldset_select('user', 'id', " deleted = 1"); - list($insql, $params) = $DB->get_in_or_equal($deletedusers); - $DB->delete_records_select('booking_answers', - " userid $insql AND bookingid IN ( SELECT id FROM {booking} WHERE course = $courseid)", - $params); + [$insql, $params] = $DB->get_in_or_equal($deletedusers); + $DB->delete_records_select( + 'booking_answers', + " userid $insql AND bookingid IN ( SELECT id FROM {booking} WHERE course = $courseid)", + $params + ); $guestenrol = false; $enrolmethods = enrol_get_instances($courseid, true); @@ -1243,27 +1839,38 @@ function xmldb_booking_upgrade($oldversion) { // Delete unenrolled and deleted users from booking_answers. This is done via events in the future. $coursecontext = context_course::instance($courseid); - list($enrolsql, $enrolparams) = get_enrolled_sql($coursecontext); + [$enrolsql, $enrolparams] = get_enrolled_sql($coursecontext); $params = array_merge(['course' => $courseid], $enrolparams); - $DB->delete_records_select('booking_answers', - ' userid NOT IN (' . $enrolsql . + $DB->delete_records_select( + 'booking_answers', + ' userid NOT IN (' . $enrolsql . ') AND bookingid IN ( SELECT id FROM {booking} WHERE course = :course)', - $params); - $DB->delete_records_select('booking_teachers', - ' userid NOT IN (' . $enrolsql . + $params + ); + $DB->delete_records_select( + 'booking_teachers', + ' userid NOT IN (' . $enrolsql . ') AND bookingid IN ( SELECT id FROM {booking} WHERE course = :course)', - $params); + $params + ); } upgrade_mod_savepoint(true, 2016051703, 'booking'); } if ($oldversion < 2016053000) { - // Define field banusernames to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('banusernames', XMLDB_TYPE_TEXT, null, null, null, null, null, - 'paginationnum'); + $field = new xmldb_field( + 'banusernames', + XMLDB_TYPE_TEXT, + null, + null, + null, + null, + null, + 'paginationnum' + ); // Conditionally launch add field banusernames. if (!$dbman->field_exists($table, $field)) { @@ -1275,11 +1882,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2016053100) { - // Define field showhelpfullnavigationlinks to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('showhelpfullnavigationlinks', XMLDB_TYPE_INTEGER, '1', null, - XMLDB_NOTNULL, null, '1', 'banusernames'); + $field = new xmldb_field( + 'showhelpfullnavigationlinks', + XMLDB_TYPE_INTEGER, + '1', + null, + XMLDB_NOTNULL, + null, + '1', + 'banusernames' + ); // Conditionally launch add field showhelpfullnavigationlinks. if (!$dbman->field_exists($table, $field)) { @@ -1291,11 +1905,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2016061500) { - // Define field daystonotify to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('daystonotify', XMLDB_TYPE_INTEGER, '3', null, null, null, '0', - 'showhelpfullnavigationlinks'); + $field = new xmldb_field( + 'daystonotify', + XMLDB_TYPE_INTEGER, + '3', + null, + null, + null, + '0', + 'showhelpfullnavigationlinks' + ); // Conditionally launch add field daystonotify. if (!$dbman->field_exists($table, $field)) { @@ -1313,8 +1934,16 @@ function xmldb_booking_upgrade($oldversion) { // Define field notifyemail to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('notifyemail', XMLDB_TYPE_TEXT, null, null, null, null, null, - 'daystonotify'); + $field = new xmldb_field( + 'notifyemail', + XMLDB_TYPE_TEXT, + null, + null, + null, + null, + null, + 'daystonotify' + ); // Conditionally launch add field notifyemail. if (!$dbman->field_exists($table, $field)) { @@ -1326,7 +1955,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2016061501) { - // Define table booking_optiondates to be created. $table = new xmldb_table('booking_optiondates'); @@ -1356,36 +1984,67 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2016062400) { - // Define fields to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('assessed', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, - '0', 'notifyemail'); + $field = new xmldb_field( + 'assessed', + XMLDB_TYPE_INTEGER, + '10', + null, + XMLDB_NOTNULL, + null, + '0', + 'notifyemail' + ); // Conditionally launch add field. if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } - $field = new xmldb_field('assesstimestart', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, - null, '0', 'assessed'); + $field = new xmldb_field( + 'assesstimestart', + XMLDB_TYPE_INTEGER, + '10', + null, + XMLDB_NOTNULL, + null, + '0', + 'assessed' + ); // Conditionally launch add field. if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } - $field = new xmldb_field('assesstimefinish', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, - null, '0', 'assesstimestart'); + $field = new xmldb_field( + 'assesstimefinish', + XMLDB_TYPE_INTEGER, + '10', + null, + XMLDB_NOTNULL, + null, + '0', + 'assesstimestart' + ); // Conditionally launch add field. if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } - $field = new xmldb_field('scale', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', - 'assesstimefinish'); + $field = new xmldb_field( + 'scale', + XMLDB_TYPE_INTEGER, + '10', + null, + XMLDB_NOTNULL, + null, + '0', + 'assesstimefinish' + ); // Conditionally launch add field. if (!$dbman->field_exists($table, $field)) { @@ -1397,11 +2056,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2016122300) { - // Define field whichview to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('whichview', XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, - 'showactive', 'scale'); + $field = new xmldb_field( + 'whichview', + XMLDB_TYPE_CHAR, + '32', + null, + XMLDB_NOTNULL, + null, + 'showactive', + 'scale' + ); // Conditionally launch add field whichview. if (!$dbman->field_exists($table, $field)) { @@ -1412,7 +2078,6 @@ function xmldb_booking_upgrade($oldversion) { upgrade_mod_savepoint(true, 2016122300, 'booking'); } if ($oldversion < 2017021000) { - $sql = "SELECT tc.id, tc.stringid FROM {tool_customlang} tc LEFT JOIN {tool_customlang_components} tcc ON tcc.id = tc.componentid @@ -1439,8 +2104,13 @@ function xmldb_booking_upgrade($oldversion) { // Adding keys to table booking_other. $table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']); $table->add_key('bookingid', XMLDB_KEY_FOREIGN, ['bookingid'], 'booking', ['id']); - $table->add_key('optionid', XMLDB_KEY_FOREIGN, ['optionid'], 'booking_options', - ['id']); + $table->add_key( + 'optionid', + XMLDB_KEY_FOREIGN, + ['optionid'], + 'booking_options', + ['id'] + ); // Conditionally launch create table for booking_customfields. if (!$dbman->table_exists($table)) { @@ -1454,8 +2124,16 @@ function xmldb_booking_upgrade($oldversion) { if ($oldversion < 2017081401) { // Define field daystonotify2 to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('daystonotify2', XMLDB_TYPE_INTEGER, '3', null, XMLDB_NOTNULL, null, - '0', 'whichview'); + $field = new xmldb_field( + 'daystonotify2', + XMLDB_TYPE_INTEGER, + '3', + null, + XMLDB_NOTNULL, + null, + '0', + 'whichview' + ); // Conditionally launch add field daystonotify2. if (!$dbman->field_exists($table, $field)) { @@ -1464,8 +2142,16 @@ function xmldb_booking_upgrade($oldversion) { // Define field sent2 to be added to booking_options. $table = new xmldb_table('booking_options'); - $field = new xmldb_field('sent2', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', - 'disablebookingusers'); + $field = new xmldb_field( + 'sent2', + XMLDB_TYPE_INTEGER, + '1', + null, + XMLDB_NOTNULL, + null, + '0', + 'disablebookingusers' + ); // Conditionally launch add field sent2. if (!$dbman->field_exists($table, $field)) { @@ -1483,8 +2169,16 @@ function xmldb_booking_upgrade($oldversion) { // Define field enablepresence to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('enablepresence', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, - null, '0', 'daystonotify2'); + $field = new xmldb_field( + 'enablepresence', + XMLDB_TYPE_INTEGER, + '2', + null, + XMLDB_NOTNULL, + null, + '0', + 'daystonotify2' + ); // Conditionally launch add field enablepresence. if (!$dbman->field_exists($table, $field)) { @@ -1493,8 +2187,16 @@ function xmldb_booking_upgrade($oldversion) { // Define field completionmodule to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('completionmodule', XMLDB_TYPE_INTEGER, '20', null, null, null, - '-1', 'enablepresence'); + $field = new xmldb_field( + 'completionmodule', + XMLDB_TYPE_INTEGER, + '20', + null, + null, + null, + '-1', + 'enablepresence' + ); // Conditionally launch add field completionmodule. if (!$dbman->field_exists($table, $field)) { @@ -1506,12 +2208,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2017082303) { - // Changing type of field responsesfields on table booking to char. $table = new xmldb_table('booking'); - $field = new xmldb_field('responsesfields', XMLDB_TYPE_CHAR, '1333', null, null, null, - 'completed,status,rating,numrec,fullname,timecreated,institution,waitinglist', - 'completionmodule'); + $field = new xmldb_field( + 'responsesfields', + XMLDB_TYPE_CHAR, + '1333', + null, + null, + null, + 'completed,status,rating,numrec,fullname,timecreated,institution,waitinglist', + 'completionmodule' + ); // Launch change of type for field responsesfields. $dbman->add_field($table, $field); @@ -1521,12 +2229,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2017082305) { - // Changing type of field responsesfields on table booking to char. $table = new xmldb_table('booking'); - $field = new xmldb_field('reportfields', XMLDB_TYPE_CHAR, '1333', null, null, null, - 'booking,location,coursestarttime,courseendtime,firstname,lastname', - 'responsesfields'); + $field = new xmldb_field( + 'reportfields', + XMLDB_TYPE_CHAR, + '1333', + null, + null, + null, + 'booking,location,coursestarttime,courseendtime,firstname,lastname', + 'responsesfields' + ); // Launch change of type for field responsesfields. $dbman->add_field($table, $field); @@ -1536,11 +2250,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2017082500) { - // Define field optionsfields to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('optionsfields', XMLDB_TYPE_CHAR, '1333', null, null, null, - 'text,coursestarttime,maxanswers', 'reportfields'); + $field = new xmldb_field( + 'optionsfields', + XMLDB_TYPE_CHAR, + '1333', + null, + null, + null, + 'text,coursestarttime,maxanswers', + 'reportfields' + ); // Conditionally launch add field optionsfields. if (!$dbman->field_exists($table, $field)) { @@ -1552,11 +2273,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2017082800) { - // Define field beforebookedtext to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('beforebookedtext', XMLDB_TYPE_TEXT, null, null, null, null, null, - 'optionsfields'); + $field = new xmldb_field( + 'beforebookedtext', + XMLDB_TYPE_TEXT, + null, + null, + null, + null, + null, + 'optionsfields' + ); // Conditionally launch add field beforebookedtext. if (!$dbman->field_exists($table, $field)) { @@ -1565,8 +2293,16 @@ function xmldb_booking_upgrade($oldversion) { // Define field beforecompletedtext to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('beforecompletedtext', XMLDB_TYPE_TEXT, null, null, null, null, - null, 'beforebookedtext'); + $field = new xmldb_field( + 'beforecompletedtext', + XMLDB_TYPE_TEXT, + null, + null, + null, + null, + null, + 'beforebookedtext' + ); // Conditionally launch add field beforecompletedtext. if (!$dbman->field_exists($table, $field)) { @@ -1575,8 +2311,16 @@ function xmldb_booking_upgrade($oldversion) { // Define field aftercompletedtext to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('aftercompletedtext', XMLDB_TYPE_TEXT, null, null, null, null, null, - 'beforecompletedtext'); + $field = new xmldb_field( + 'aftercompletedtext', + XMLDB_TYPE_TEXT, + null, + null, + null, + null, + null, + 'beforecompletedtext' + ); // Conditionally launch add field aftercompletedtext. if (!$dbman->field_exists($table, $field)) { @@ -1585,8 +2329,16 @@ function xmldb_booking_upgrade($oldversion) { // Define field beforebookedtext to be added to booking_options. $table = new xmldb_table('booking_options'); - $field = new xmldb_field('beforebookedtext', XMLDB_TYPE_TEXT, null, null, null, null, null, - 'sent2'); + $field = new xmldb_field( + 'beforebookedtext', + XMLDB_TYPE_TEXT, + null, + null, + null, + null, + null, + 'sent2' + ); // Conditionally launch add field beforebookedtext. if (!$dbman->field_exists($table, $field)) { @@ -1595,8 +2347,16 @@ function xmldb_booking_upgrade($oldversion) { // Define field beforecompletedtext to be added to booking_options. $table = new xmldb_table('booking_options'); - $field = new xmldb_field('beforecompletedtext', XMLDB_TYPE_TEXT, null, null, null, null, - null, 'beforebookedtext'); + $field = new xmldb_field( + 'beforecompletedtext', + XMLDB_TYPE_TEXT, + null, + null, + null, + null, + null, + 'beforebookedtext' + ); // Conditionally launch add field beforecompletedtext. if (!$dbman->field_exists($table, $field)) { @@ -1605,8 +2365,16 @@ function xmldb_booking_upgrade($oldversion) { // Define field aftercompletedtext to be added to booking_options. $table = new xmldb_table('booking_options'); - $field = new xmldb_field('aftercompletedtext', XMLDB_TYPE_TEXT, null, null, null, null, null, - 'beforecompletedtext'); + $field = new xmldb_field( + 'aftercompletedtext', + XMLDB_TYPE_TEXT, + null, + null, + null, + null, + null, + 'beforecompletedtext' + ); // Conditionally launch add field aftercompletedtext. if (!$dbman->field_exists($table, $field)) { @@ -1618,11 +2386,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2017090500) { - // Define field signinsheetfields to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('signinsheetfields', XMLDB_TYPE_CHAR, '1333', null, null, null, - 'fullname,signature', 'aftercompletedtext'); + $field = new xmldb_field( + 'signinsheetfields', + XMLDB_TYPE_CHAR, + '1333', + null, + null, + null, + 'fullname,signature', + 'aftercompletedtext' + ); // Conditionally launch add field signinsheetfields. if (!$dbman->field_exists($table, $field)) { @@ -1634,11 +2409,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2017090600) { - // Define field shorturl to be added to booking_options. $table = new xmldb_table('booking_options'); - $field = new xmldb_field('shorturl', XMLDB_TYPE_CHAR, '1333', null, null, null, null, - 'aftercompletedtext'); + $field = new xmldb_field( + 'shorturl', + XMLDB_TYPE_CHAR, + '1333', + null, + null, + null, + null, + 'aftercompletedtext' + ); // Conditionally launch add field shorturl. if (!$dbman->field_exists($table, $field)) { @@ -1649,11 +2431,18 @@ function xmldb_booking_upgrade($oldversion) { upgrade_mod_savepoint(true, 2017090600, 'booking'); } if ($oldversion < 2017091200) { - // Define field comments to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('comments', XMLDB_TYPE_INTEGER, '2', null, null, null, '0', - 'signinsheetfields'); + $field = new xmldb_field( + 'comments', + XMLDB_TYPE_INTEGER, + '2', + null, + null, + null, + '0', + 'signinsheetfields' + ); // Conditionally launch add field comments. if (!$dbman->field_exists($table, $field)) { @@ -1664,7 +2453,6 @@ function xmldb_booking_upgrade($oldversion) { upgrade_mod_savepoint(true, 2017091200, 'booking'); } if ($oldversion < 2017091400) { - // Define table booking_ratings to be created. $table = new xmldb_table('booking_ratings'); @@ -1688,7 +2476,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2017091401) { - // Define index optionid (not unique) to be added to booking_ratings. $table = new xmldb_table('booking_ratings'); $index = new xmldb_index('optionid', XMLDB_INDEX_NOTUNIQUE, ['optionid']); @@ -1703,11 +2490,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2017091402) { - // Define field ratings to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('ratings', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', - 'comments'); + $field = new xmldb_field( + 'ratings', + XMLDB_TYPE_INTEGER, + '2', + null, + XMLDB_NOTNULL, + null, + '0', + 'comments' + ); // Conditionally launch add field ratings. if (!$dbman->field_exists($table, $field)) { @@ -1736,7 +2530,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2018011100) { - // Define field removeuseronunenrol to be added to booking. $table = new xmldb_table('booking'); $field = new xmldb_field('removeuseronunenrol', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '1', 'ratings'); @@ -1751,7 +2544,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2018040600) { - // Changing type of field institution on table booking_options to text. $table = new xmldb_table('booking_options'); $field = new xmldb_field('institution', XMLDB_TYPE_TEXT, null, null, null, null, null, 'location'); @@ -1764,7 +2556,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2018052101) { - // Add field notes to booking_answers. $table = new xmldb_table('booking_answers'); $field = new xmldb_field('notes', XMLDB_TYPE_TEXT, null, null, null, null, null, 'status'); @@ -1779,11 +2570,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2018062100) { - // Define field additionalfields to be removed from booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('additionalfields', XMLDB_TYPE_TEXT, null, null, null, null, null, - 'pollurltext'); + $field = new xmldb_field( + 'additionalfields', + XMLDB_TYPE_TEXT, + null, + null, + null, + null, + null, + 'pollurltext' + ); // Conditionally launch drop field. if ($dbman->field_exists($table, $field)) { $dbman->drop_field($table, $field); @@ -1810,7 +2608,7 @@ function xmldb_booking_upgrade($oldversion) { if ($oldversion < 2018080701) { $ids = $DB->get_fieldset_sql('SELECT bo.id FROM {booking_options} bo WHERE bo.id > 0'); if (!empty($ids)) { - list($insql, $inparams) = $DB->get_in_or_equal($ids, SQL_PARAMS_NAMED); + [$insql, $inparams] = $DB->get_in_or_equal($ids, SQL_PARAMS_NAMED); if (count($ids) > 1) { $sql = "DELETE FROM {booking_teachers} WHERE optionid NOT $insql"; @@ -1828,7 +2626,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2018090600) { - // Define field duration to be added to booking_options. $table = new xmldb_table('booking_options'); $field = new xmldb_field('duration', XMLDB_TYPE_INTEGER, '11', null, XMLDB_NOTNULL, null, '0', 'shorturl'); @@ -1843,7 +2640,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2019071400) { - // Define field calendarid to be added to booking_teachers. $table = new xmldb_table('booking_teachers'); $field = new xmldb_field('calendarid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'completed'); @@ -1867,7 +2663,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2019071700) { - // Define field enrolmentstatus to be added to booking_options. $table = new xmldb_table('booking_options'); $field = new xmldb_field('enrolmentstatus', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '2', 'courseendtime'); @@ -1891,7 +2686,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2019071701) { - // Change title of booking option to char. $table = new xmldb_table('booking_options'); $field = new xmldb_field('text', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, 'bookingid'); @@ -1904,7 +2698,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2019072900) { - // Changing precision of field enablecompletion on table booking to (3). $table = new xmldb_table('booking'); $field = new xmldb_field('enablecompletion', XMLDB_TYPE_INTEGER, '3', null, null, null, '1', 'userleave'); @@ -1917,7 +2710,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2019080101) { - // Define field parentid to be added to booking_options. $table = new xmldb_table('booking_options'); $field = new xmldb_field('parentid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'duration'); @@ -1939,7 +2731,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2019080300) { - // Drop unused fields. $table = new xmldb_table('booking'); $field = new xmldb_field('maxoverbooking', XMLDB_TYPE_INTEGER, '10', null, null, null, '0', 'maxanswers'); @@ -1981,8 +2772,16 @@ function xmldb_booking_upgrade($oldversion) { $dbman->add_field($table, $field); } $table = new xmldb_table('booking'); - $field = new xmldb_field('showviews', XMLDB_TYPE_CHAR, '255', null, null, null, - 'mybooking,myoptions,showall,showactive,myinstitution', 'defaultoptionsort'); + $field = new xmldb_field( + 'showviews', + XMLDB_TYPE_CHAR, + '255', + null, + null, + null, + 'mybooking,myoptions,showall,showactive,myinstitution', + 'defaultoptionsort' + ); if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } @@ -1998,15 +2797,31 @@ function xmldb_booking_upgrade($oldversion) { if ($dbman->field_exists($table, $field)) { $dbman->change_field_type($table, $field); } - $field = new xmldb_field('signinsheetfields', XMLDB_TYPE_TEXT, 'small', null, null, null, - null, 'aftercompletedtext'); + $field = new xmldb_field( + 'signinsheetfields', + XMLDB_TYPE_TEXT, + 'small', + null, + null, + null, + null, + 'aftercompletedtext' + ); if ($dbman->field_exists($table, $field)) { $dbman->change_field_type($table, $field); } // Add field for views to show in view.php. $table = new xmldb_table('booking'); - $field = new xmldb_field('showviews', XMLDB_TYPE_CHAR, '255', null, null, null, - 'mybooking,myoptions,showall,showactive,myinstitution', 'defaultoptionsort'); + $field = new xmldb_field( + 'showviews', + XMLDB_TYPE_CHAR, + '255', + null, + null, + null, + 'mybooking,myoptions,showall,showactive,myinstitution', + 'defaultoptionsort' + ); if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } @@ -2016,7 +2831,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2020071300) { - // Define field autcractive to be added to booking. $table = new xmldb_table('booking'); $field = new xmldb_field('customtemplateid', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'showviews'); @@ -2130,7 +2944,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2021052700) { - // Define field eventid to be added to booking_optiondates. $table = new xmldb_table('booking_optiondates'); $field = new xmldb_field('eventid', XMLDB_TYPE_INTEGER, '10', null, null, null, '0', 'optionid'); @@ -2149,7 +2962,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2021061400) { - // Define field bookingchangedtext to be added to booking. $table = new xmldb_table('booking'); $field = new xmldb_field('bookingchangedtext', XMLDB_TYPE_TEXT, null, null, null, null, null, 'deletedtext'); @@ -2164,7 +2976,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2021061601) { - // Define field showdescriptionmode to be added to booking. $table = new xmldb_table('booking'); $field = new xmldb_field('showdescriptionmode', XMLDB_TYPE_INTEGER, '1', null, null, null, '0', 'templateid'); @@ -2179,7 +2990,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2021061603) { - // Define field showlistoncoursepage to be added to booking. $table = new xmldb_table('booking'); $field = new xmldb_field('showlistoncoursepage', XMLDB_TYPE_INTEGER, '1', null, null, null, '1', 'showdescriptionmode'); @@ -2194,7 +3004,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2021062100) { - // Define table booking_category to be created. $table = new xmldb_table('booking_icalsequence'); @@ -2258,7 +3067,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2021062801) { - // Define field coursepageshortinfo to be added to booking. $table = new xmldb_table('booking'); $field = new xmldb_field('coursepageshortinfo', XMLDB_TYPE_TEXT, null, null, null, null, null, 'showlistoncoursepage'); @@ -2273,11 +3081,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2021070100) { - // Define field activitycompletiontext to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('activitycompletiontext', XMLDB_TYPE_TEXT, null, null, null, null, null, - 'pollurlteacherstext'); + $field = new xmldb_field( + 'activitycompletiontext', + XMLDB_TYPE_TEXT, + null, + null, + null, + null, + null, + 'pollurlteacherstext' + ); // Conditionally launch add field activitycompletiontext. if (!$dbman->field_exists($table, $field)) { @@ -2289,11 +3104,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2021080400) { - // Define field mailtemplatessource to be added to booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('mailtemplatessource', XMLDB_TYPE_INTEGER, '1', null, - null, null, '0', 'bookingmanager'); + $field = new xmldb_field( + 'mailtemplatessource', + XMLDB_TYPE_INTEGER, + '1', + null, + null, + null, + '0', + 'bookingmanager' + ); // Conditionally launch add field mailtemplatessource. if (!$dbman->field_exists($table, $field)) { @@ -2305,20 +3127,35 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2021080900) { - // Define fields daystonotifyteachers, notifyemailteachers to be added to booking. $table = new xmldb_table('booking'); // Conditionally launch add field daystonotifyteachers. - $field1 = new xmldb_field('daystonotifyteachers', XMLDB_TYPE_INTEGER, '3', null, - null, null, '0', 'notifyemail'); + $field1 = new xmldb_field( + 'daystonotifyteachers', + XMLDB_TYPE_INTEGER, + '3', + null, + null, + null, + '0', + 'notifyemail' + ); if (!$dbman->field_exists($table, $field1)) { $dbman->add_field($table, $field1); } // Conditionally launch add field notifyemailteachers. - $field2 = new xmldb_field('notifyemailteachers', XMLDB_TYPE_TEXT, null, null, - null, null, null, 'daystonotifyteachers'); + $field2 = new xmldb_field( + 'notifyemailteachers', + XMLDB_TYPE_TEXT, + null, + null, + null, + null, + null, + 'daystonotifyteachers' + ); if (!$dbman->field_exists($table, $field2)) { $dbman->add_field($table, $field2); } @@ -2328,12 +3165,19 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2021080901) { - // Define field sentteachers to be added to booking_options. $table = new xmldb_table('booking_options'); - $field = new xmldb_field('sentteachers', XMLDB_TYPE_INTEGER, '1', null, - XMLDB_NOTNULL, null, '0', 'sent2'); + $field = new xmldb_field( + 'sentteachers', + XMLDB_TYPE_INTEGER, + '1', + null, + XMLDB_NOTNULL, + null, + '0', + 'sent2' + ); // Conditionally launch add field sentteachers. if (!$dbman->field_exists($table, $field)) { @@ -2345,7 +3189,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2021121703) { - $table = new xmldb_table('booking_prices'); // Adding fields to table. @@ -2368,7 +3211,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2022012607) { - // Add new table. $table = new xmldb_table('booking_pricecategories'); @@ -2393,7 +3235,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2022030100) { - // Add new table. $table = new xmldb_table('booking_semesters'); @@ -2417,7 +3258,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2022030901) { - // Define fields to be added to booking_options. $table = new xmldb_table('booking_options'); @@ -2450,12 +3290,19 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2022032500) { - // Define field bookingimagescustomfield to be added to table booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('bookingimagescustomfield', XMLDB_TYPE_INTEGER, '10', null, - null, null, '0', 'coursepageshortinfo'); + $field = new xmldb_field( + 'bookingimagescustomfield', + XMLDB_TYPE_INTEGER, + '10', + null, + null, + null, + '0', + 'coursepageshortinfo' + ); if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); @@ -2466,7 +3313,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2022042900) { - // Define field invisible to be added to booking_options. $table = new xmldb_table('booking_options'); $field = new xmldb_field('invisible', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'dayofweektime'); @@ -2481,7 +3327,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2022050502) { - // Define table booking_optiondates_teachers to be created. $table = new xmldb_table('booking_optiondates_teachers'); @@ -2529,7 +3374,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2022060900) { - // Define table booking_optionformconfig to be created. $table = new xmldb_table('booking_optionformconfig'); @@ -2551,11 +3395,18 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2022062700) { - // Define field annotation to be added to booking_options. $table = new xmldb_table('booking_options'); - $field = new xmldb_field('annotation', XMLDB_TYPE_TEXT, null, null, null, null, null, - 'invisible'); + $field = new xmldb_field( + 'annotation', + XMLDB_TYPE_TEXT, + null, + null, + null, + null, + null, + 'invisible' + ); // Conditionally launch add field. if (!$dbman->field_exists($table, $field)) { @@ -2567,7 +3418,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2022062800) { - // Define field identifier to be added to booking_options. $table = new xmldb_table('booking_options'); $identifier = new xmldb_field('identifier', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'annotation'); @@ -2585,7 +3435,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2022070100) { - $table = new xmldb_table('booking_options'); $priceformulaadd = new xmldb_field('priceformulaadd', XMLDB_TYPE_NUMBER, '10, 2', null, null, null, '0', 'titleprefix'); @@ -2593,8 +3442,16 @@ function xmldb_booking_upgrade($oldversion) { $dbman->add_field($table, $priceformulaadd); } - $priceformulamultiply = new xmldb_field('priceformulamultiply', XMLDB_TYPE_NUMBER, '10, 2', null, null, null, '1', - 'priceformulaadd'); + $priceformulamultiply = new xmldb_field( + 'priceformulamultiply', + XMLDB_TYPE_NUMBER, + '10, 2', + null, + null, + null, + '1', + 'priceformulaadd' + ); if (!$dbman->field_exists($table, $priceformulamultiply)) { $dbman->add_field($table, $priceformulamultiply); } @@ -2604,7 +3461,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2022070400) { - // Define field semesterid to be added to booking. $table = new xmldb_table('booking'); $field = new xmldb_field('semesterid', XMLDB_TYPE_INTEGER, '10', null, null, null, '0', 'autcrtemplate'); @@ -2619,7 +3475,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2022071100) { - // Define field invisible to be added to booking_options. $table = new xmldb_table('booking_options'); $field = new xmldb_field('dayofweek', XMLDB_TYPE_CHAR, '255', null, null, null, '', 'priceformulamultiply'); @@ -2634,7 +3489,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2022071900) { - // Define field priceformulaoff to be added to booking_options. $table = new xmldb_table('booking_options'); $field = new xmldb_field('priceformulaoff', XMLDB_TYPE_INTEGER, '1', null, null, null, '0', 'priceformulamultiply'); @@ -2649,7 +3503,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2022080800) { - // Define field bookingopeningtime to be added to booking_options. $table = new xmldb_table('booking_options'); $field = new xmldb_field('bookingopeningtime', XMLDB_TYPE_INTEGER, '10', null, null, null, '0', 'maxoverbooking'); @@ -2664,7 +3517,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2022080900) { - // Define field availability to be added to booking_options. $table = new xmldb_table('booking_options'); $field = new xmldb_field('availability', XMLDB_TYPE_TEXT, null, null, null, null, null, 'dayofweek'); @@ -2679,13 +3531,17 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2022082900) { - // Define field semesteridentifier to be dropped from booking_holidays. $table = new xmldb_table('booking_holidays'); $semesteridentifier = new xmldb_field('semesteridentifier'); $name = new xmldb_field('name'); - $key = new xmldb_key('fk_semesteridentifier', XMLDB_KEY_FOREIGN, ['semesteridentifier'], - 'booking_semesters', ['identifier']); + $key = new xmldb_key( + 'fk_semesteridentifier', + XMLDB_KEY_FOREIGN, + ['semesteridentifier'], + 'booking_semesters', + ['identifier'] + ); // Launch drop key fk_semesteridentifier. $dbman->drop_key($table, $key); @@ -2714,7 +3570,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2022091901) { - // Define field 'name' to be added to table booking_holidays. $table = new xmldb_table('booking_holidays'); $field = new xmldb_field('name', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'enddate'); @@ -2729,7 +3584,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2022092900) { - // Define table booking_rules to be created. $table = new xmldb_table('booking_rules'); @@ -2751,7 +3605,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2022092901) { - // Define field availability to be added to booking_options. $table = new xmldb_table('booking_options'); $field = new xmldb_field('availability', XMLDB_TYPE_TEXT, null, null, null, null, null, 'dayofweek'); @@ -2766,7 +3619,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2022100300) { - // Define field reason to be added to booking_optiondates. $table = new xmldb_table('booking_optiondates'); $field = new xmldb_field('reason', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'sent'); @@ -2781,7 +3633,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2022100600) { - // Define field minanswers to be added to booking_options. $table = new xmldb_table('booking_options'); $field = new xmldb_field('minanswers', XMLDB_TYPE_INTEGER, '10', null, null, null, '0', 'maxoverbooking'); @@ -2796,7 +3647,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2022110600) { - // Define field bookingid to be added to booking_rules. $table = new xmldb_table('booking_rules'); $field = new xmldb_field('bookingid', XMLDB_TYPE_INTEGER, '10', null, null, null, '0', 'id'); @@ -2811,7 +3661,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2022110800) { - // Define field status to be added to booking_options. $table = new xmldb_table('booking_options'); $field = new xmldb_field('status', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'availability'); @@ -2825,7 +3674,6 @@ function xmldb_booking_upgrade($oldversion) { upgrade_mod_savepoint(true, 2022110800, 'booking'); } if ($oldversion < 2022112201) { - // Define index userid (not unique) to be added to booking_answers. $table = new xmldb_table('booking_answers'); $index = new xmldb_index('userid', XMLDB_INDEX_NOTUNIQUE, ['userid']); @@ -2855,8 +3703,11 @@ function xmldb_booking_upgrade($oldversion) { $dbman->add_index($table, $index); } // Define index userid-bookingid-waitinglist-optionid (not unique) to be added to booking_answers. - $index = new xmldb_index('userid-bookingid-waitinglist-optionid', - XMLDB_INDEX_NOTUNIQUE, ['userid', 'bookingid', 'waitinglist', 'optionid']); + $index = new xmldb_index( + 'userid-bookingid-waitinglist-optionid', + XMLDB_INDEX_NOTUNIQUE, + ['userid', 'bookingid', 'waitinglist', 'optionid'] + ); // Conditionally launch add index userid-bookingid-waitinglist-optionid. if (!$dbman->index_exists($table, $index)) { @@ -2965,7 +3816,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2022112400) { - // Define table booking_subbooking_options to be created. $table = new xmldb_table('booking_subbooking_options'); @@ -2992,7 +3842,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2022112800) { - // Define table booking_subbooking_answers to be created. $table = new xmldb_table('booking_subbooking_answers'); @@ -3022,7 +3871,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2022112801) { - // Define field block to be added to booking_subbooking_options. $table = new xmldb_table('booking_subbooking_options'); $field = new xmldb_field('block', XMLDB_TYPE_INTEGER, '1', null, null, null, '0', 'json'); @@ -3037,7 +3885,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2022112900) { - // Rename field optionid on table booking_prices to itemid. $table = new xmldb_table('booking_prices'); @@ -3069,7 +3916,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2022120302) { - // Define index userid (not unique) to be added to booking_answers. $table = new xmldb_table('booking_answers'); // Define index optionid-userid-bookingid (not unique) to be added to booking_answers. @@ -3080,8 +3926,11 @@ function xmldb_booking_upgrade($oldversion) { } // Define index userid-bookingid-waitinglist-optionid (not unique) to be added to booking_answers. - $index = new xmldb_index('userid-bookingid-waitinglist-optionid', XMLDB_INDEX_NOTUNIQUE, - ['userid', 'bookingid', 'waitinglist', 'optionid']); + $index = new xmldb_index( + 'userid-bookingid-waitinglist-optionid', + XMLDB_INDEX_NOTUNIQUE, + ['userid', 'bookingid', 'waitinglist', 'optionid'] + ); // Conditionally launch drop index userid-bookingid-waitinglist-optionid. if ($dbman->index_exists($table, $index)) { @@ -3164,8 +4013,16 @@ function xmldb_booking_upgrade($oldversion) { // Changing the default of field showviews on table booking to mybooking,myoptions,showall,showactive,myinstitution. $table = new xmldb_table('booking'); - $field = new xmldb_field('showviews', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, - 'mybooking,myoptions,showall,showactive,myinstitution', 'defaultoptionsort'); + $field = new xmldb_field( + 'showviews', + XMLDB_TYPE_CHAR, + '255', + null, + XMLDB_NOTNULL, + null, + 'mybooking,myoptions,showall,showactive,myinstitution', + 'defaultoptionsort' + ); // Launch change of default for field showviews. $dbman->change_field_default($table, $field); @@ -3297,7 +4154,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2022122200) { - // Define field pricecatsortorder to be added to booking_pricecategories. $table = new xmldb_table('booking_pricecategories'); $field = new xmldb_field('pricecatsortorder', XMLDB_TYPE_INTEGER, '10', null, null, null, '0', 'defaultvalue'); @@ -3312,7 +4168,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2023011600) { - // Define table booking_institutions to be dropped. $table = new xmldb_table('booking_institutions'); @@ -3326,7 +4181,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2023020300) { - // Define field showhelpfullnavigationlinks to be dropped from booking. $table = new xmldb_table('booking'); $field = new xmldb_field('showhelpfullnavigationlinks'); @@ -3341,7 +4195,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2023020600) { - // Define field showdescriptionmode to be dropped from booking. $table = new xmldb_table('booking'); $field = new xmldb_field('showdescriptionmode'); @@ -3356,7 +4209,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2023021000) { - // Define field itemid to be added to booking_subbooking_answers. $table = new xmldb_table('booking_subbooking_answers'); $field = new xmldb_field('itemid', XMLDB_TYPE_INTEGER, '10', null, null, null, '0', 'id'); @@ -3371,7 +4223,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2023021100) { - // Define field optionid to be added to booking_subbooking_answers. $table = new xmldb_table('booking_subbooking_answers'); $field = new xmldb_field('optionid', XMLDB_TYPE_INTEGER, '10', null, null, null, '0', 'itemid'); @@ -3400,8 +4251,16 @@ function xmldb_booking_upgrade($oldversion) { if ($oldversion < 2023022100) { // Add field optionsdownloadfields to table booking. $table = new xmldb_table('booking'); - $field = new xmldb_field('optionsdownloadfields', XMLDB_TYPE_TEXT, 'small', null, null, null, null, - 'optionsfields'); + $field = new xmldb_field( + 'optionsdownloadfields', + XMLDB_TYPE_TEXT, + 'small', + null, + null, + null, + null, + 'optionsfields' + ); if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); @@ -3412,7 +4271,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2023022600) { - // Define field json to be added to booking_answers. $table = new xmldb_table('booking_answers'); $field = new xmldb_field('json', XMLDB_TYPE_TEXT, null, null, null, null, null, 'notes'); @@ -3435,7 +4293,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2023031301) { - // Changing precision of field allowupdatedays on table booking to (10). $table = new xmldb_table('booking'); $field = new xmldb_field('allowupdatedays', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'teacherroleid'); @@ -3448,7 +4305,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2023040600) { - // Define field reviewed to be added to booking_optiondates. $table = new xmldb_table('booking_optiondates'); $field = new xmldb_field('reviewed', XMLDB_TYPE_INTEGER, '1', null, null, null, '0', 'reason'); @@ -3463,7 +4319,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2023041101) { - // Define table booking_campaigns to be created. $table = new xmldb_table('booking_campaigns'); @@ -3490,7 +4345,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2023042600) { - // Define field responsiblecontact to be added to booking_options. $table = new xmldb_table('booking_options'); $field = new xmldb_field('responsiblecontact', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'status'); @@ -3506,7 +4360,6 @@ function xmldb_booking_upgrade($oldversion) { // Add the elective tables & upgrades. if ($oldversion < 2023061200) { - // Add booking combinations table. $table = new xmldb_table('booking_combinations'); // Adding fields to table booking_instancetemplate. @@ -3583,7 +4436,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2023082301) { - // Define field json to be added to booking_options. $table = new xmldb_table('booking_options'); $field = new xmldb_field('json', XMLDB_TYPE_TEXT, null, null, null, null, null, 'sortorder'); @@ -3598,7 +4450,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2023091300) { - // Define field json to be added to booking. $table = new xmldb_table('booking'); $field = new xmldb_field('json', XMLDB_TYPE_TEXT, null, null, null, null, null, 'enforceteacherorder'); @@ -3613,7 +4464,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2023102001) { - // Define table booking_odt_deductions to be created. $table = new xmldb_table('booking_odt_deductions'); @@ -3652,7 +4502,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2024021400) { - // Define table booking_form_config to be created. $table = new xmldb_table('booking_form_config'); @@ -3684,7 +4533,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2024022801) { - // Changing the default of field whichview on table booking to showall. $table = new xmldb_table('booking'); $field = new xmldb_field('whichview', XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, 'showall', 'scale'); @@ -3697,7 +4545,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2024030800) { - // Define table booking_optionformconfig to be dropped. $table = new xmldb_table('booking_optionformconfig'); @@ -3711,7 +4558,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2024030801) { - // Fix bugs with showlistoncoursepage field. fix_showlistoncoursepage_2024030801(); @@ -3733,7 +4579,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2024040901) { - // Define key bookingid (foreign) to be dropped form booking_rules. $table = new xmldb_table('booking_rules'); $key = new xmldb_key('bookingid', XMLDB_KEY_FOREIGN, ['bookingid'], 'booking', ['id']); @@ -3754,7 +4599,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2024052200) { - // Define field sqlfilter to be added to booking_options. $table = new xmldb_table('booking_options'); $field = new xmldb_field('sqlfilter', XMLDB_TYPE_INTEGER, '2', null, null, null, '0', 'json'); @@ -3805,7 +4649,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2024082903) { - // Define field places to be added to booking_answers. $table = new xmldb_table('booking_answers'); $field = new xmldb_field('places', XMLDB_TYPE_INTEGER, '10', null, null, null, '1', 'status'); @@ -3822,7 +4665,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2024101700) { - // Define field extendlimitforoverbooked to be added to booking_campaigns. $table = new xmldb_table('booking_campaigns'); $field = new xmldb_field('extendlimitforoverbooked', XMLDB_TYPE_INTEGER, '2', null, null, null, null, 'limitfactor'); @@ -3837,7 +4679,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2024112601) { - // Define table booking_enrollink_bundles to be created. $table = new xmldb_table('booking_enrollink_bundles'); @@ -3889,7 +4730,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2024112602) { - // Define field baid to be added to booking_enrollink_bundles. $table = new xmldb_table('booking_enrollink_bundles'); $field = new xmldb_field('baid', XMLDB_TYPE_INTEGER, '10', null, null, null, '0', 'usermodified'); @@ -3903,7 +4743,6 @@ function xmldb_booking_upgrade($oldversion) { upgrade_mod_savepoint(true, 2024112602, 'booking'); } if ($oldversion < 2024112603) { - // Define field optionid to be added to booking_enrollink_bundles. $table = new xmldb_table('booking_enrollink_bundles'); $field = new xmldb_field('optionid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'baid'); @@ -3918,7 +4757,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2024112604) { - // Define index erlid (unique) to be dropped form booking_enrollink_items. $table = new xmldb_table('booking_enrollink_items'); $index = new xmldb_index('erlid', XMLDB_INDEX_UNIQUE, ['erlid']); @@ -3933,7 +4771,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2024121600) { - // Fetch all booking options where availability is empty or null. $records = $DB->get_records_select('booking_options', "availability = '' OR availability IS NULL"); @@ -3947,7 +4784,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2024121701) { - // Define field isactive to be added to booking_rules. $table = new xmldb_table('booking_rules'); $field = new xmldb_field('isactive', XMLDB_TYPE_INTEGER, '2', null, null, null, '1', 'useastemplate'); @@ -3970,7 +4806,6 @@ function xmldb_booking_upgrade($oldversion) { } if ($oldversion < 2025012701) { - // Define table booking_optiondates_answers to be created. $table = new xmldb_table('booking_optiondates_answers'); @@ -4003,6 +4838,5 @@ function xmldb_booking_upgrade($oldversion) { upgrade_mod_savepoint(true, 2025012701, 'booking'); } - return true; } diff --git a/tests/optiondates/optiondates_test.php b/tests/optiondates/optiondates_test.php index f8304b843..5d728ad66 100644 --- a/tests/optiondates/optiondates_test.php +++ b/tests/optiondates/optiondates_test.php @@ -55,14 +55,20 @@ public static function data_provider(): array { * * @covers \mod_booking/local/optiondates/optiondate * @dataProvider data_provider + * @param int $userid + * @param int $optiondateid + * @param int $optionid + * @param int $status + * @param string|null $notes + * @param string|null $json */ public function test_save_and_get_record( - $userid, - $optiondateid, - $optionid, - $status, - $notes, - $json + int $userid, + int $optiondateid, + int $optionid, + int $status, + string $notes, + string $json ): void { global $DB; $this->resetAfterTest(true); @@ -86,14 +92,20 @@ public function test_save_and_get_record( * * @covers \mod_booking/local/optiondates/optiondate * @dataProvider data_provider + * @param int $userid + * @param int $optiondateid + * @param int $optionid + * @param int $status + * @param string|null $notes + * @param string|null $json */ public function test_delete_record( - $userid, - $optiondateid, - $optionid, - $status, - $notes, - $json + int $userid, + int $optiondateid, + int $optionid, + int $status, + string $notes, + string $json ): void { $this->resetAfterTest(true); @@ -111,14 +123,20 @@ public function test_delete_record( * * @covers \mod_booking/local/optiondates/optiondate * @dataProvider data_provider + * @param int $userid + * @param int $optiondateid + * @param int $optionid + * @param int $status + * @param string|null $notes + * @param string|null $json */ public function test_update_record( - $userid, - $optiondateid, - $optionid, - $status, - $notes, - $json + int $userid, + int $optiondateid, + int $optionid, + int $status, + string $notes, + string $json ): void { $this->resetAfterTest(true);