| Line 0
          
      
      
        Link Here | 
            
              |  |  | 1 | $DBversion = 'XXX'; # will be replaced by the RM | 
            
              | 2 | if( CheckVersion( $DBversion ) ) { | 
            
              | 3 |     if( !TableExists( 'return_claims' ) ) { | 
            
              | 4 |         $dbh->do(q{ | 
            
              | 5 |             CREATE TABLE return_claims ( | 
            
              | 6 |                 id int(11) auto_increment, | 
            
              | 7 |                 itemnumber int(11) NOT NULL, | 
            
              | 8 |                 issue_id int(11) NULL DEFAULT NULL, | 
            
              | 9 |                 borrowernumber int(11) NOT NULL, | 
            
              | 10 |                 notes MEDIUMTEXT DEFAULT NULL, | 
            
              | 11 |                 created_on TIMESTAMP NULL, | 
            
              | 12 |                 created_by int(11) NULL DEFAULT NULL, | 
            
              | 13 |                 updated_on TIMESTAMP NULL ON UPDATE CURRENT_TIMESTAMP, | 
            
              | 14 |                 updated_by int(11) NULL DEFAULT NULL, | 
            
              | 15 |                 resolution  varchar(80) NULL DEFAULT NULL, | 
            
              | 16 |                 resolved_on TIMESTAMP NULL DEFAULT NULL, | 
            
              | 17 |                 resolved_by int(11) NULL DEFAULT NULL, | 
            
              | 18 |                 PRIMARY KEY (`id`), | 
            
              | 19 |                 KEY `itemnumber` (`itemnumber`), | 
            
              | 20 |                 UNIQUE( issue_id ), | 
            
              | 21 |                 CONSTRAINT `rc_items_ibfk` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE, | 
            
              | 22 |                 CONSTRAINT `rc_borrowers_ibfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE, | 
            
              | 23 |                 CONSTRAINT `rc_created_by_ibfk` FOREIGN KEY (`created_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE, | 
            
              | 24 |                 CONSTRAINT `rc_updated_by_ibfk` FOREIGN KEY (`updated_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE, | 
            
              | 25 |                 CONSTRAINT `rc_resolved_by_ibfk` FOREIGN KEY (`resolved_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE | 
            
              | 26 |             ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | 
            
              | 27 |         }); | 
            
              | 28 |     } | 
            
              | 29 |  | 
            
              | 30 |     $dbh->do(q{ | 
            
              | 31 |         INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES | 
            
              | 32 |         ('ClaimReturnedChargeFee', 'ask', 'ask|charge|no_charge', 'Controls whether or not a lost item fee is charged for return claims', 'Choice'), | 
            
              | 33 |         ('ClaimReturnedLostValue', '', '', 'Sets the LOST AV value that represents "Claims returned" as a lost value', 'Free'), | 
            
              | 34 |         ('ClaimReturnedWarningThreshold', '', '', 'Sets the number of return claims past which the librarian will be warned the patron has many return claims', 'Integer'); | 
            
              | 35 |     }); | 
            
              | 36 |  | 
            
              | 37 |     $dbh->do(q{ | 
            
              | 38 |         INSERT IGNORE INTO `authorised_values` ( category, authorised_value, lib ) | 
            
              | 39 |         VALUES | 
            
              | 40 |           ('RETURN_CLAIM_RESOLUTION', 'RET_BY_PATRON', 'Returned by patron'), | 
            
              | 41 |           ('RETURN_CLAIM_RESOLUTION', 'FOUND_IN_LIB', 'Found in library'); | 
            
              | 42 |     }); | 
            
              | 43 |  | 
            
              | 44 |     SetVersion( $DBversion ); | 
            
              | 45 |     print "Upgrade to $DBversion done (Bug 14697 - Extend and enhance 'Claims returned' lost status)\n"; | 
            
              | 46 | } |