View | Details | Raw Unified | Return to bug 9303
Collapse All | Expand All

(-)a/installer/data/mysql/kohastructure.sql (+6 lines)
Lines 265-270 CREATE TABLE `borrowers` ( -- this table includes information about your patrons Link Here
265
  `altcontactphone` varchar(50) default NULL, -- the phone number for the alternate contact for the patron/borrower
265
  `altcontactphone` varchar(50) default NULL, -- the phone number for the alternate contact for the patron/borrower
266
  `smsalertnumber` varchar(50) default NULL, -- the mobile phone number where the patron/borrower would like to receive notices (if SNS turned on)
266
  `smsalertnumber` varchar(50) default NULL, -- the mobile phone number where the patron/borrower would like to receive notices (if SNS turned on)
267
  `privacy` integer(11) DEFAULT '1' NOT NULL, -- patron/borrower's privacy settings related to their reading history
267
  `privacy` integer(11) DEFAULT '1' NOT NULL, -- patron/borrower's privacy settings related to their reading history
268
  `privacy_guarantor_checkouts` tinyint(1) NOT NULL DEFAULT '0', -- controls if relatives can see this patron's checkouts
268
  UNIQUE KEY `cardnumber` (`cardnumber`),
269
  UNIQUE KEY `cardnumber` (`cardnumber`),
269
  PRIMARY KEY `borrowernumber` (`borrowernumber`),
270
  PRIMARY KEY `borrowernumber` (`borrowernumber`),
270
  KEY `categorycode` (`categorycode`),
271
  KEY `categorycode` (`categorycode`),
Lines 894-899 CREATE TABLE `deletedborrowers` ( -- stores data related to the patrons/borrower Link Here
894
  `altcontactphone` varchar(50) default NULL, -- the phone number for the alternate contact for the patron/borrower
895
  `altcontactphone` varchar(50) default NULL, -- the phone number for the alternate contact for the patron/borrower
895
  `smsalertnumber` varchar(50) default NULL, -- the mobile phone number where the patron/borrower would like to receive notices (if SNS turned on)
896
  `smsalertnumber` varchar(50) default NULL, -- the mobile phone number where the patron/borrower would like to receive notices (if SNS turned on)
896
  `privacy` integer(11) DEFAULT '1' NOT NULL, -- patron/borrower's privacy settings related to their reading history  KEY `borrowernumber` (`borrowernumber`),
897
  `privacy` integer(11) DEFAULT '1' NOT NULL, -- patron/borrower's privacy settings related to their reading history  KEY `borrowernumber` (`borrowernumber`),
898
  `privacy_guarantor_checkouts` tinyint(1) NOT NULL DEFAULT '0', -- controls if relatives can see this patron's checkouts
897
  KEY borrowernumber (borrowernumber),
899
  KEY borrowernumber (borrowernumber),
898
  KEY `cardnumber` (`cardnumber`)
900
  KEY `cardnumber` (`cardnumber`)
899
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
901
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
Lines 1140-1145 CREATE TABLE `import_items` ( Link Here
1140
1142
1141
DROP TABLE IF EXISTS `issues`;
1143
DROP TABLE IF EXISTS `issues`;
1142
CREATE TABLE `issues` ( -- information related to check outs or issues
1144
CREATE TABLE `issues` ( -- information related to check outs or issues
1145
  `issue_id` int(11) NOT NULL AUTO_INCREMENT, -- primary key for issues table
1143
  `borrowernumber` int(11), -- foreign key, linking this to the borrowers table for the patron this item was checked out to
1146
  `borrowernumber` int(11), -- foreign key, linking this to the borrowers table for the patron this item was checked out to
1144
  `itemnumber` int(11), -- foreign key, linking this to the items table for the item that was checked out
1147
  `itemnumber` int(11), -- foreign key, linking this to the items table for the item that was checked out
1145
  `date_due` datetime default NULL, -- datetime the item is due (yyyy-mm-dd hh:mm::ss)
1148
  `date_due` datetime default NULL, -- datetime the item is due (yyyy-mm-dd hh:mm::ss)
Lines 1153-1158 CREATE TABLE `issues` ( -- information related to check outs or issues Link Here
1153
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
1156
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
1154
  `issuedate` datetime default NULL, -- date the item was checked out or issued
1157
  `issuedate` datetime default NULL, -- date the item was checked out or issued
1155
  `onsite_checkout` int(1) NOT NULL default 0, -- in house use flag
1158
  `onsite_checkout` int(1) NOT NULL default 0, -- in house use flag
1159
  PRIMARY KEY (`issue_id`),
1156
  KEY `issuesborridx` (`borrowernumber`),
1160
  KEY `issuesborridx` (`borrowernumber`),
1157
  KEY `itemnumber_idx` (`itemnumber`),
1161
  KEY `itemnumber_idx` (`itemnumber`),
1158
  KEY `branchcode_idx` (`branchcode`),
1162
  KEY `branchcode_idx` (`branchcode`),
Lines 1614-1619 CREATE TABLE `oai_sets_biblios` ( Link Here
1614
1618
1615
DROP TABLE IF EXISTS `old_issues`;
1619
DROP TABLE IF EXISTS `old_issues`;
1616
CREATE TABLE `old_issues` ( -- lists items that were checked out and have been returned
1620
CREATE TABLE `old_issues` ( -- lists items that were checked out and have been returned
1621
  `issue_id` int(11) NOT NULL AUTO_INCREMENT, -- primary key for issues table
1617
  `borrowernumber` int(11) default NULL, -- foreign key, linking this to the borrowers table for the patron this item was checked out to
1622
  `borrowernumber` int(11) default NULL, -- foreign key, linking this to the borrowers table for the patron this item was checked out to
1618
  `itemnumber` int(11) default NULL, -- foreign key, linking this to the items table for the item that was checked out
1623
  `itemnumber` int(11) default NULL, -- foreign key, linking this to the items table for the item that was checked out
1619
  `date_due` datetime default NULL, -- date the item is due (yyyy-mm-dd)
1624
  `date_due` datetime default NULL, -- date the item is due (yyyy-mm-dd)
Lines 1627-1632 CREATE TABLE `old_issues` ( -- lists items that were checked out and have been r Link Here
1627
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
1632
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
1628
  `issuedate` datetime default NULL, -- date the item was checked out or issued
1633
  `issuedate` datetime default NULL, -- date the item was checked out or issued
1629
  `onsite_checkout` int(1) NOT NULL default 0, -- in house use flag
1634
  `onsite_checkout` int(1) NOT NULL default 0, -- in house use flag
1635
  PRIMARY KEY (`issue_id`),
1630
  KEY `old_issuesborridx` (`borrowernumber`),
1636
  KEY `old_issuesborridx` (`borrowernumber`),
1631
  KEY `old_issuesitemidx` (`itemnumber`),
1637
  KEY `old_issuesitemidx` (`itemnumber`),
1632
  KEY `branchcode_idx` (`branchcode`),
1638
  KEY `branchcode_idx` (`branchcode`),
(-)a/installer/data/mysql/sysprefs.sql (+2 lines)
Lines 26-37 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
26
('AllowNotForLoanOverride','0','','If ON, Koha will allow the librarian to loan a not for loan item.','YesNo'),
26
('AllowNotForLoanOverride','0','','If ON, Koha will allow the librarian to loan a not for loan item.','YesNo'),
27
('AllowOfflineCirculation','0','','If on, enables HTML5 offline circulation functionality.','YesNo'),
27
('AllowOfflineCirculation','0','','If on, enables HTML5 offline circulation functionality.','YesNo'),
28
('AllowOnShelfHolds','0','','Allow hold requests to be placed on items that are not on loan','YesNo'),
28
('AllowOnShelfHolds','0','','Allow hold requests to be placed on items that are not on loan','YesNo'),
29
('AllowPatronToSetCheckoutsVisibilityForGuarantor',  '0', NULL, 'If enabled, the patron can set checkouts to be visible to his or her guarantor',  'YesNo'),
29
('AllowPKIAuth','None','None|Common Name|emailAddress','Use the field from a client-side SSL certificate to look a user in the Koha database','Choice'),
30
('AllowPKIAuth','None','None|Common Name|emailAddress','Use the field from a client-side SSL certificate to look a user in the Koha database','Choice'),
30
('AllowPurchaseSuggestionBranchChoice','0','1','Allow user to choose branch when making a purchase suggestion','YesNo'),
31
('AllowPurchaseSuggestionBranchChoice','0','1','Allow user to choose branch when making a purchase suggestion','YesNo'),
31
('AllowRenewalIfOtherItemsAvailable','0',NULL,'If enabled, allow a patron to renew an item with unfilled holds if other available items can fill that hold.','YesNo'),
32
('AllowRenewalIfOtherItemsAvailable','0',NULL,'If enabled, allow a patron to renew an item with unfilled holds if other available items can fill that hold.','YesNo'),
32
('AllowRenewalLimitOverride','0',NULL,'if ON, allows renewal limits to be overridden on the circulation screen','YesNo'),
33
('AllowRenewalLimitOverride','0',NULL,'if ON, allows renewal limits to be overridden on the circulation screen','YesNo'),
33
('AllowReturnToBranch','anywhere','anywhere|homebranch|holdingbranch|homeorholdingbranch','Where an item may be returned','Choice'),
34
('AllowReturnToBranch','anywhere','anywhere|homebranch|holdingbranch|homeorholdingbranch','Where an item may be returned','Choice'),
34
('AllowSelfCheckReturns','0','','If enabled, patrons may return items through the Web-based Self Checkout','YesNo'),
35
('AllowSelfCheckReturns','0','','If enabled, patrons may return items through the Web-based Self Checkout','YesNo'),
36
('AllowStaffToSetCheckoutsVisibilityForGuarantor','0',NULL,'If enabled, library staff can set a patron''s checkouts to be visible to linked patrons from the opac.',  'YesNo'),
35
('AllowTooManyOverride','1','','If on, allow staff to override and check out items when the patron has reached the maximum number of allowed checkouts','YesNo'),
37
('AllowTooManyOverride','1','','If on, allow staff to override and check out items when the patron has reached the maximum number of allowed checkouts','YesNo'),
36
('alphabet','A B C D E F G H I J K L M N O P Q R S T U V W X Y Z',NULL,'Alphabet than can be expanded into browse links, e.g. on Home > Patrons','free'),
38
('alphabet','A B C D E F G H I J K L M N O P Q R S T U V W X Y Z',NULL,'Alphabet than can be expanded into browse links, e.g. on Home > Patrons','free'),
37
('AlternateHoldingsField','',NULL,'The MARC field/subfield that contains alternate holdings information for bibs taht do not have items attached (e.g. 852abchi for libraries converting from MARC Magician).','free'),
39
('AlternateHoldingsField','',NULL,'The MARC field/subfield that contains alternate holdings information for bibs taht do not have items attached (e.g. 852abchi for libraries converting from MARC Magician).','free'),
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +63 lines)
Lines 37-42 use Getopt::Long; Link Here
37
use C4::Context;
37
use C4::Context;
38
use C4::Installer;
38
use C4::Installer;
39
use C4::Dates;
39
use C4::Dates;
40
use Koha::Database;
40
41
41
use MARC::Record;
42
use MARC::Record;
42
use MARC::File::XML ( BinaryEncoding => 'utf8' );
43
use MARC::File::XML ( BinaryEncoding => 'utf8' );
Lines 9669-9674 if ( CheckVersion($DBversion) ) { Link Here
9669
    SetVersion ($DBversion);
9670
    SetVersion ($DBversion);
9670
}
9671
}
9671
9672
9673
$DBversion = "3.19.00.XXX";
9674
if(CheckVersion($DBversion)) {
9675
    $dbh->do(q{
9676
        ALTER TABLE borrowers ADD privacy_guarantor_checkouts BOOLEAN NOT NULL DEFAULT '0'
9677
    });
9678
    $dbh->do(q{
9679
        ALTER TABLE deletedborrowers ADD privacy_guarantor_checkouts BOOLEAN NOT NULL DEFAULT '0'
9680
    });
9681
    $dbh->do(q{
9682
        ALTER TABLE old_issues DROP PRIMARY KEY
9683
    });
9684
    $dbh->do(q{
9685
        ALTER TABLE old_issues ADD issue_id INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST
9686
    });
9687
    $dbh->do(q{
9688
        ALTER TABLE old_issues DROP INDEX itemnumber_idx
9689
    });
9690
    $dbh->do(q{
9691
        ALTER TABLE issues DROP PRIMARY KEY
9692
    });
9693
    $dbh->do(q{
9694
        ALTER TABLE issues ADD issue_id INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST
9695
    });
9696
    $dbh->do(q{
9697
        ALTER TABLE issues DROP INDEX itemnumber_idx
9698
    });
9699
    $dbh->do(q{
9700
        ALTER TABLE issues ADD UNIQUE itemnumber_idx (itemnumber)
9701
    });
9702
    $dbh->do(qq{
9703
        UPDATE issues SET issue_id = issue_id + ( SELECT COUNT(*) FROM old_issues ) ORDER BY issue_id DESC
9704
    });
9705
9706
    my $schema = Koha::Database->new()->schema();
9707
    my $max_issue_id = $schema->resultset('Issue')->get_column('issue_id')->max();
9708
    $max_issue_id ||= $schema->resultset('OldIssue')->get_column('issue_id')->max();
9709
    $max_issue_id ||= 0;
9710
    $max_issue_id++;
9711
    $dbh->do(qq{
9712
        ALTER TABLE issues AUTO_INCREMENT = $max_issue_id
9713
    });
9714
9715
    $dbh->do(q{
9716
        INSERT INTO systempreferences (variable, value, options, explanation, type )
9717
        VALUES (
9718
            'AllowStaffToSetCheckoutsVisibilityForGuarantor',  '0', NULL,
9719
            'If enabled, library staff can set a patron''s checkouts to be visible to linked patrons from the opac.',  'YesNo'
9720
        )
9721
    });
9722
9723
    $dbh->do(q{
9724
        INSERT INTO systempreferences (variable, value, options, explanation, type )
9725
        VALUES (
9726
            'AllowPatronToSetCheckoutsVisibilityForGuarantor',  '0', NULL,
9727
            'If enabled, the patron can set checkouts to be visible to  his or her guarantor',  'YesNo'
9728
        )
9729
    });
9730
9731
    print "Upgrade to $DBversion done (Bug 9303 - relative's checkouts in the opac)\n";
9732
    SetVersion($DBversion);
9733
}
9734
9672
=head1 FUNCTIONS
9735
=head1 FUNCTIONS
9673
9736
9674
=head2 TableExists($table)
9737
=head2 TableExists($table)
9675
- 

Return to bug 9303