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 868-873 CREATE TABLE `deletedborrowers` ( -- stores data related to the patrons/borrower Link Here
868
  `altcontactphone` varchar(50) default NULL, -- the phone number for the alternate contact for the patron/borrower
869
  `altcontactphone` varchar(50) default NULL, -- the phone number for the alternate contact for the patron/borrower
869
  `smsalertnumber` varchar(50) default NULL, -- the mobile phone number where the patron/borrower would like to receive notices (if SNS turned on)
870
  `smsalertnumber` varchar(50) default NULL, -- the mobile phone number where the patron/borrower would like to receive notices (if SNS turned on)
870
  `privacy` integer(11) DEFAULT '1' NOT NULL, -- patron/borrower's privacy settings related to their reading history  KEY `borrowernumber` (`borrowernumber`),
871
  `privacy` integer(11) DEFAULT '1' NOT NULL, -- patron/borrower's privacy settings related to their reading history  KEY `borrowernumber` (`borrowernumber`),
872
  `privacy_guarantor_checkouts` tinyint(1) NOT NULL DEFAULT '0', -- controls if relatives can see this patron's checkouts
871
  KEY borrowernumber (borrowernumber),
873
  KEY borrowernumber (borrowernumber),
872
  KEY `cardnumber` (`cardnumber`)
874
  KEY `cardnumber` (`cardnumber`)
873
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
875
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Lines 1114-1119 CREATE TABLE `import_items` ( Link Here
1114
1116
1115
DROP TABLE IF EXISTS `issues`;
1117
DROP TABLE IF EXISTS `issues`;
1116
CREATE TABLE `issues` ( -- information related to check outs or issues
1118
CREATE TABLE `issues` ( -- information related to check outs or issues
1119
  `issue_id` int(11) NOT NULL AUTO_INCREMENT, -- primary key for issues table
1117
  `borrowernumber` int(11), -- foreign key, linking this to the borrowers table for the patron this item was checked out to
1120
  `borrowernumber` int(11), -- foreign key, linking this to the borrowers table for the patron this item was checked out to
1118
  `itemnumber` int(11), -- foreign key, linking this to the items table for the item that was checked out
1121
  `itemnumber` int(11), -- foreign key, linking this to the items table for the item that was checked out
1119
  `date_due` datetime default NULL, -- datetime the item is due (yyyy-mm-dd hh:mm::ss)
1122
  `date_due` datetime default NULL, -- datetime the item is due (yyyy-mm-dd hh:mm::ss)
Lines 1126-1131 CREATE TABLE `issues` ( -- information related to check outs or issues Link Here
1126
  `auto_renew` BOOLEAN default FALSE, -- automatic renewal
1129
  `auto_renew` BOOLEAN default FALSE, -- automatic renewal
1127
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
1130
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
1128
  `issuedate` datetime default NULL, -- date the item was checked out or issued
1131
  `issuedate` datetime default NULL, -- date the item was checked out or issued
1132
  PRIMARY KEY (`issue_id`),
1129
  KEY `issuesborridx` (`borrowernumber`),
1133
  KEY `issuesborridx` (`borrowernumber`),
1130
  KEY `itemnumber_idx` (`itemnumber`),
1134
  KEY `itemnumber_idx` (`itemnumber`),
1131
  KEY `branchcode_idx` (`branchcode`),
1135
  KEY `branchcode_idx` (`branchcode`),
Lines 1587-1592 CREATE TABLE `oai_sets_biblios` ( Link Here
1587
1591
1588
DROP TABLE IF EXISTS `old_issues`;
1592
DROP TABLE IF EXISTS `old_issues`;
1589
CREATE TABLE `old_issues` ( -- lists items that were checked out and have been returned
1593
CREATE TABLE `old_issues` ( -- lists items that were checked out and have been returned
1594
  `issue_id` int(11) NOT NULL AUTO_INCREMENT, -- primary key for issues table
1590
  `borrowernumber` int(11) default NULL, -- foreign key, linking this to the borrowers table for the patron this item was checked out to
1595
  `borrowernumber` int(11) default NULL, -- foreign key, linking this to the borrowers table for the patron this item was checked out to
1591
  `itemnumber` int(11) default NULL, -- foreign key, linking this to the items table for the item that was checked out
1596
  `itemnumber` int(11) default NULL, -- foreign key, linking this to the items table for the item that was checked out
1592
  `date_due` datetime default NULL, -- date the item is due (yyyy-mm-dd)
1597
  `date_due` datetime default NULL, -- date the item is due (yyyy-mm-dd)
Lines 1599-1604 CREATE TABLE `old_issues` ( -- lists items that were checked out and have been r Link Here
1599
  `auto_renew` BOOLEAN default FALSE, -- automatic renewal
1604
  `auto_renew` BOOLEAN default FALSE, -- automatic renewal
1600
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
1605
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
1601
  `issuedate` datetime default NULL, -- date the item was checked out or issued
1606
  `issuedate` datetime default NULL, -- date the item was checked out or issued
1607
  PRIMARY KEY (`issue_id`),
1602
  KEY `old_issuesborridx` (`borrowernumber`),
1608
  KEY `old_issuesborridx` (`borrowernumber`),
1603
  KEY `old_issuesitemidx` (`itemnumber`),
1609
  KEY `old_issuesitemidx` (`itemnumber`),
1604
  KEY `branchcode_idx` (`branchcode`),
1610
  KEY `branchcode_idx` (`branchcode`),
(-)a/installer/data/mysql/sysprefs.sql (+2 lines)
Lines 26-36 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
('AllowRenewalLimitOverride','0',NULL,'if ON, allows renewal limits to be overridden on the circulation screen','YesNo'),
32
('AllowRenewalLimitOverride','0',NULL,'if ON, allows renewal limits to be overridden on the circulation screen','YesNo'),
32
('AllowReturnToBranch','anywhere','anywhere|homebranch|holdingbranch|homeorholdingbranch','Where an item may be returned','Choice'),
33
('AllowReturnToBranch','anywhere','anywhere|homebranch|holdingbranch|homeorholdingbranch','Where an item may be returned','Choice'),
33
('AllowSelfCheckReturns','0','','If enabled, patrons may return items through the Web-based Self Checkout','YesNo'),
34
('AllowSelfCheckReturns','0','','If enabled, patrons may return items through the Web-based Self Checkout','YesNo'),
35
('AllowStaffToSetCheckoutsVisibilityForGuarantor','0',NULL,'If enabled, library staff can set a patron''s checkouts to be visible to linked patrons from the opac.',  'YesNo'),
34
('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
('AllowTooManyOverride','1','','If on, allow staff to override and check out items when the patron has reached the maximum number of allowed checkouts','YesNo'),
35
('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
('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'),
36
('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'),
38
('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 8781-8786 if ( CheckVersion($DBversion) ) { Link Here
8781
    SetVersion($DBversion);
8782
    SetVersion($DBversion);
8782
}
8783
}
8783
8784
8785
$DBversion = "3.17.00.XXX";
8786
if(CheckVersion($DBversion)) {
8787
    $dbh->do(q{
8788
        ALTER TABLE borrowers ADD privacy_guarantor_checkouts BOOLEAN NOT NULL DEFAULT '0'
8789
    });
8790
    $dbh->do(q{
8791
        ALTER TABLE deletedborrowers ADD privacy_guarantor_checkouts BOOLEAN NOT NULL DEFAULT '0'
8792
    });
8793
    $dbh->do(q{
8794
        ALTER TABLE old_issues DROP PRIMARY KEY
8795
    });
8796
    $dbh->do(q{
8797
        ALTER TABLE old_issues ADD issue_id INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST
8798
    });
8799
    $dbh->do(q{
8800
        ALTER TABLE old_issues DROP INDEX itemnumber_idx
8801
    });
8802
    $dbh->do(q{
8803
        ALTER TABLE issues DROP PRIMARY KEY
8804
    });
8805
    $dbh->do(q{
8806
        ALTER TABLE issues ADD issue_id INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST
8807
    });
8808
    $dbh->do(q{
8809
        ALTER TABLE issues DROP INDEX itemnumber_idx
8810
    });
8811
    $dbh->do(q{
8812
        ALTER TABLE issues ADD UNIQUE itemnumber_idx (itemnumber)
8813
    });
8814
    $dbh->do(qq{
8815
        UPDATE issues SET issue_id = issue_id + ( SELECT COUNT(*) FROM old_issues ) ORDER BY issue_id DESC
8816
    });
8817
8818
    my $schema = Koha::Database->new()->schema();
8819
    my $max_issue_id = $schema->resultset('Issue')->get_column('issue_id')->max();
8820
    $max_issue_id ||= $schema->resultset('OldIssue')->get_column('issue_id')->max();
8821
    $max_issue_id ||= 0;
8822
    $max_issue_id++;
8823
    $dbh->do(qq{
8824
        ALTER TABLE issues AUTO_INCREMENT = $max_issue_id
8825
    });
8826
8827
    $dbh->do(q{
8828
        INSERT INTO systempreferences (variable, value, options, explanation, type )
8829
        VALUES (
8830
            'AllowStaffToSetCheckoutsVisibilityForGuarantor',  '0', NULL,
8831
            'If enabled, library staff can set a patron''s checkouts to be visible to linked patrons from the opac.',  'YesNo'
8832
        )
8833
    });
8834
8835
    $dbh->do(q{
8836
        INSERT INTO systempreferences (variable, value, options, explanation, type )
8837
        VALUES (
8838
            'AllowPatronToSetCheckoutsVisibilityForGuarantor',  '0', NULL,
8839
            'If enabled, the patron can set checkouts to be visible to  his or her guarantor',  'YesNo'
8840
        )
8841
    });
8842
8843
    print "Upgrade to $DBversion done (Bug 9303 - relative's checkouts in the opac)\n";
8844
    SetVersion($DBversion);
8845
}
8846
8784
=head1 FUNCTIONS
8847
=head1 FUNCTIONS
8785
8848
8786
=head2 TableExists($table)
8849
=head2 TableExists($table)
8787
- 

Return to bug 9303