--- /dev/null
+$DBversion = 'XXX'; # will be replaced by the RM
+if( CheckVersion( $DBversion ) ) {
+
+ if ( !column_exists( 'illrequests', 'status_alias' ) ) {
+ $dbh->do( "ALTER TABLE illrequests ADD COLUMN status_alias integer DEFAULT NULL AFTER status" );
+ }
+ if ( !foreign_key_exists( 'illrequests', 'illrequests_safk' ) ) {
+ $dbh->do( "ALTER TABLE illrequests ADD CONSTRAINT illrequests_safk FOREIGN KEY (status_alias) REFERENCES authorised_values(id) ON UPDATE CASCADE ON DELETE SET NULL" );
+ }
+ $dbh->do( "INSERT IGNORE INTO authorised_value_categories SET category_name = 'ILLSTATUS'");
+
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 20581 - Allow manual selection of custom ILL request statuses)\n";
+}
biblio_id integer DEFAULT NULL, -- Potential bib linked to request
branchcode varchar(50) NOT NULL, -- The branch associated with the request
status varchar(50) DEFAULT NULL, -- Current Koha status of request
+ status_alias integer DEFAULT NULL, -- Foreign key to relevant authorised_values.id
placed date DEFAULT NULL, -- Date the request was placed
replied date DEFAULT NULL, -- Last API response
updated timestamp DEFAULT CURRENT_TIMESTAMP -- Last modification to request
FOREIGN KEY (`branchcode`)
REFERENCES `branches` (`branchcode`)
ON UPDATE CASCADE ON DELETE CASCADE
+ CONSTRAINT `illrequests_safk`
+ FOREIGN KEY (`status_alias`)
+ REFERENCES `authorised_values` (`id`)
+ ON UPDATE CASCADE ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--