| 
      
            Lines 4684-4689
          if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
      
      
        Link Here
      
     | 
  
        
          | 4684 | 
              SetVersion($DBversion);  | 
          4684 | 
              SetVersion($DBversion);  | 
        
        
          | 4685 | 
          }  | 
          4685 | 
          }  | 
        
        
          | 4686 | 
           | 
          4686 | 
           | 
        
            
               | 
               | 
              4687 | 
              $DBversion = "3.07.99.XXX"; #FIXME  | 
            
            
              | 4688 | 
              if ( C4::Context->preference("Version") lt TransformToNum($DBversion) ) { | 
            
            
              | 4689 | 
                  $dbh->do("ALTER TABLE virtualshelves MODIFY COLUMN owner int"); #should have been int already (fk to borrowers) | 
            
            
              | 4690 | 
                  $dbh->do("ALTER TABLE virtualshelves ADD COLUMN allow_add tinyint(1) DEFAULT 1, ADD COLUMN allow_delete_own tinyint(1) DEFAULT 1, ADD COLUMN allow_delete_other tinyint(1) DEFAULT 0"); | 
            
            
              | 4691 | 
                  $dbh->do("UPDATE virtualshelves SET allow_add=1, allow_delete_own=1, allow_delete_other=0 WHERE category=1"); | 
            
            
              | 4692 | 
                  $dbh->do("UPDATE virtualshelves SET allow_add=1, allow_delete_own=1, allow_delete_other=1 WHERE category=2"); #former behavior | 
            
            
              | 4693 | 
                  $dbh->do("UPDATE virtualshelves SET allow_add=1, allow_delete_own=1, allow_delete_other=1 WHERE category=3"); | 
            
            
              | 4694 | 
                  $dbh->do("UPDATE virtualshelves SET category=2 WHERE category=3"); | 
            
            
              | 4695 | 
               | 
            
            
              | 4696 | 
                  $dbh->do("ALTER TABLE virtualshelfcontents ADD COLUMN borrowernumber int"); | 
            
            
              | 4697 | 
                  $dbh->do("UPDATE virtualshelfcontents co LEFT JOIN virtualshelves sh USING (shelfnumber) SET co.borrowernumber=sh.owner"); | 
            
            
              | 4698 | 
               | 
            
            
              | 4699 | 
                  $dbh->do("CREATE TABLE virtualshelfshares | 
            
            
              | 4700 | 
              	(id int AUTO_INCREMENT PRIMARY KEY, shelfnumber int NOT NULL,  | 
            
            
              | 4701 | 
              	borrowernumber int, invitekey varchar(10), sharedate datetime,  | 
            
            
              | 4702 | 
              	CONSTRAINT `virtualshelfshares_ibfk_1` FOREIGN KEY (`shelfnumber`) REFERENCES `virtualshelves` (`shelfnumber`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=utf8");  | 
            
            
              | 4703 | 
               | 
            
            
              | 4704 | 
                  $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacAllowPublicListCreation',1,'If set, allows opac users to create public lists',NULL,'YesNo');"); | 
            
            
              | 4705 | 
                  $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');"); | 
            
            
              | 4706 | 
               | 
            
            
              | 4707 | 
                  print "Upgrade to $DBversion done (BZ7310: Improving list permissions)\n";  | 
            
            
              | 4708 | 
                  print "NOTE: If you want to make your public lists read-only, please check the permissions on list level or run a sql update statement on the virtualshelves table just like the ones in the updatedatabase script.\n";  | 
            
            
              | 4709 | 
                  SetVersion($DBversion);  | 
            
            
              | 4710 | 
              }  | 
            
            
              | 4711 | 
               | 
            
        
          | 4687 | 
          =head1 FUNCTIONS  | 
          4712 | 
          =head1 FUNCTIONS  | 
        
        
          | 4688 | 
           | 
          4713 | 
           | 
        
        
          | 4689 | 
          =head2 DropAllForeignKeys($table)  | 
          4714 | 
          =head2 DropAllForeignKeys($table)  | 
        
            
              | 4690 | 
              -   | 
               | 
               |