Lines 4719-4724
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
Link Here
|
4719 |
SetVersion ($DBversion); |
4719 |
SetVersion ($DBversion); |
4720 |
} |
4720 |
} |
4721 |
|
4721 |
|
|
|
4722 |
$DBversion = "3.07.99.XXX"; #FIXME |
4723 |
if ( C4::Context->preference("Version") lt TransformToNum($DBversion) ) { |
4724 |
$dbh->do("ALTER TABLE virtualshelves MODIFY COLUMN owner int"); #should have been int already (fk to borrowers) |
4725 |
$dbh->do("ALTER TABLE virtualshelves ADD COLUMN allow_add tinyint(1) DEFAULT 0, ADD COLUMN allow_delete_own tinyint(1) DEFAULT 1, ADD COLUMN allow_delete_other tinyint(1) DEFAULT 0, ADD CONSTRAINT `virtualshelves_ibfk_1` FOREIGN KEY (`owner`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL"); |
4726 |
$dbh->do("UPDATE virtualshelves SET allow_add=0, allow_delete_own=1, allow_delete_other=0 WHERE category=1"); |
4727 |
$dbh->do("UPDATE virtualshelves SET allow_add=0, allow_delete_own=1, allow_delete_other=0 WHERE category=2"); |
4728 |
$dbh->do("UPDATE virtualshelves SET allow_add=1, allow_delete_own=1, allow_delete_other=1 WHERE category=3"); |
4729 |
$dbh->do("UPDATE virtualshelves SET category=2 WHERE category=3"); |
4730 |
|
4731 |
$dbh->do("ALTER TABLE virtualshelfcontents ADD COLUMN borrowernumber int, ADD CONSTRAINT `shelfcontents_ibfk_3` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL"); |
4732 |
$dbh->do("UPDATE virtualshelfcontents co LEFT JOIN virtualshelves sh USING (shelfnumber) SET co.borrowernumber=sh.owner"); |
4733 |
|
4734 |
$dbh->do("CREATE TABLE virtualshelfshares |
4735 |
(id int AUTO_INCREMENT PRIMARY KEY, shelfnumber int NOT NULL, |
4736 |
borrowernumber int, invitekey varchar(10), sharedate datetime, |
4737 |
CONSTRAINT `virtualshelfshares_ibfk_1` FOREIGN KEY (`shelfnumber`) REFERENCES `virtualshelves` (`shelfnumber`) ON DELETE CASCADE ON UPDATE CASCADE, |
4738 |
CONSTRAINT `virtualshelfshares_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8"); |
4739 |
|
4740 |
$dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacAllowPublicListCreation',1,'If set, allows opac users to create public lists',NULL,'YesNo');"); |
4741 |
$dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacAllowSharingPrivateLists',0,'If set, allows opac users to share private lists with other patrons',NULL,'YesNo');"); |
4742 |
|
4743 |
print "Upgrade to $DBversion done (BZ7310: Improving list permissions)\n"; |
4744 |
SetVersion($DBversion); |
4745 |
} |
4746 |
|
4722 |
=head1 FUNCTIONS |
4747 |
=head1 FUNCTIONS |
4723 |
|
4748 |
|
4724 |
=head2 DropAllForeignKeys($table) |
4749 |
=head2 DropAllForeignKeys($table) |
4725 |
- |
|
|