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

(-)a/Koha/Schema/Result/Borrower.pm (-24 / +86 lines)
Lines 1-17 Link Here
1
use utf8;
1
package Koha::Schema::Result::Borrower;
2
package Koha::Schema::Result::Borrower;
2
3
3
# Created by DBIx::Class::Schema::Loader
4
# Created by DBIx::Class::Schema::Loader
4
# DO NOT MODIFY THE FIRST PART OF THIS FILE
5
# DO NOT MODIFY THE FIRST PART OF THIS FILE
5
6
7
=head1 NAME
8
9
Koha::Schema::Result::Borrower
10
11
=cut
12
6
use strict;
13
use strict;
7
use warnings;
14
use warnings;
8
15
9
use base 'DBIx::Class::Core';
16
use base 'DBIx::Class::Core';
10
17
11
18
=head1 TABLE: C<borrowers>
12
=head1 NAME
13
14
Koha::Schema::Result::Borrower
15
19
16
=cut
20
=cut
17
21
Lines 187-192 __PACKAGE__->table("borrowers"); Link Here
187
=head2 dateofbirth
191
=head2 dateofbirth
188
192
189
  data_type: 'date'
193
  data_type: 'date'
194
  datetime_undef_if_invalid: 1
190
  is_nullable: 1
195
  is_nullable: 1
191
196
192
=head2 branchcode
197
=head2 branchcode
Lines 208-218 __PACKAGE__->table("borrowers"); Link Here
208
=head2 dateenrolled
213
=head2 dateenrolled
209
214
210
  data_type: 'date'
215
  data_type: 'date'
216
  datetime_undef_if_invalid: 1
211
  is_nullable: 1
217
  is_nullable: 1
212
218
213
=head2 dateexpiry
219
=head2 dateexpiry
214
220
215
  data_type: 'date'
221
  data_type: 'date'
222
  datetime_undef_if_invalid: 1
216
  is_nullable: 1
223
  is_nullable: 1
217
224
218
=head2 gonenoaddress
225
=head2 gonenoaddress
Lines 228-233 __PACKAGE__->table("borrowers"); Link Here
228
=head2 debarred
235
=head2 debarred
229
236
230
  data_type: 'date'
237
  data_type: 'date'
238
  datetime_undef_if_invalid: 1
231
  is_nullable: 1
239
  is_nullable: 1
232
240
233
=head2 debarredcomment
241
=head2 debarredcomment
Lines 389-395 __PACKAGE__->table("borrowers"); Link Here
389
  default_value: 1
397
  default_value: 1
390
  is_nullable: 0
398
  is_nullable: 0
391
399
392
=head2 privacy_relative_checkouts
400
=head2 privacy_guarantor_checkouts
393
401
394
  data_type: 'tinyint'
402
  data_type: 'tinyint'
395
  default_value: 0
403
  default_value: 0
Lines 461-467 __PACKAGE__->add_columns( Link Here
461
  "b_phone",
469
  "b_phone",
462
  { data_type => "mediumtext", is_nullable => 1 },
470
  { data_type => "mediumtext", is_nullable => 1 },
463
  "dateofbirth",
471
  "dateofbirth",
464
  { data_type => "date", is_nullable => 1 },
472
  { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
465
  "branchcode",
473
  "branchcode",
466
  {
474
  {
467
    data_type => "varchar",
475
    data_type => "varchar",
Lines 479-493 __PACKAGE__->add_columns( Link Here
479
    size => 10,
487
    size => 10,
480
  },
488
  },
481
  "dateenrolled",
489
  "dateenrolled",
482
  { data_type => "date", is_nullable => 1 },
490
  { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
483
  "dateexpiry",
491
  "dateexpiry",
484
  { data_type => "date", is_nullable => 1 },
492
  { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
485
  "gonenoaddress",
493
  "gonenoaddress",
486
  { data_type => "tinyint", is_nullable => 1 },
494
  { data_type => "tinyint", is_nullable => 1 },
487
  "lost",
495
  "lost",
488
  { data_type => "tinyint", is_nullable => 1 },
496
  { data_type => "tinyint", is_nullable => 1 },
489
  "debarred",
497
  "debarred",
490
  { data_type => "date", is_nullable => 1 },
498
  { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
491
  "debarredcomment",
499
  "debarredcomment",
492
  { data_type => "varchar", is_nullable => 1, size => 255 },
500
  { data_type => "varchar", is_nullable => 1, size => 255 },
493
  "contactname",
501
  "contactname",
Lines 544-553 __PACKAGE__->add_columns( Link Here
544
  { data_type => "varchar", is_nullable => 1, size => 50 },
552
  { data_type => "varchar", is_nullable => 1, size => 50 },
545
  "privacy",
553
  "privacy",
546
  { data_type => "integer", default_value => 1, is_nullable => 0 },
554
  { data_type => "integer", default_value => 1, is_nullable => 0 },
547
  "privacy_relative_checkouts",
555
  "privacy_guarantor_checkouts",
548
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
556
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
549
);
557
);
558
559
=head1 PRIMARY KEY
560
561
=over 4
562
563
=item * L</borrowernumber>
564
565
=back
566
567
=cut
568
550
__PACKAGE__->set_primary_key("borrowernumber");
569
__PACKAGE__->set_primary_key("borrowernumber");
570
571
=head1 UNIQUE CONSTRAINTS
572
573
=head2 C<cardnumber>
574
575
=over 4
576
577
=item * L</cardnumber>
578
579
=back
580
581
=cut
582
551
__PACKAGE__->add_unique_constraint("cardnumber", ["cardnumber"]);
583
__PACKAGE__->add_unique_constraint("cardnumber", ["cardnumber"]);
552
584
553
=head1 RELATIONS
585
=head1 RELATIONS
Lines 672-705 __PACKAGE__->has_many( Link Here
672
  { cascade_copy => 0, cascade_delete => 0 },
704
  { cascade_copy => 0, cascade_delete => 0 },
673
);
705
);
674
706
675
=head2 categorycode
707
=head2 branchcode
676
708
677
Type: belongs_to
709
Type: belongs_to
678
710
679
Related object: L<Koha::Schema::Result::Category>
711
Related object: L<Koha::Schema::Result::Branch>
680
712
681
=cut
713
=cut
682
714
683
__PACKAGE__->belongs_to(
715
__PACKAGE__->belongs_to(
684
  "categorycode",
716
  "branchcode",
685
  "Koha::Schema::Result::Category",
717
  "Koha::Schema::Result::Branch",
686
  { categorycode => "categorycode" },
718
  { branchcode => "branchcode" },
687
  { on_delete => "CASCADE", on_update => "CASCADE" },
719
  { is_deferrable => 1, on_delete => "RESTRICT", on_update => "RESTRICT" },
688
);
720
);
689
721
690
=head2 branchcode
722
=head2 categorycode
691
723
692
Type: belongs_to
724
Type: belongs_to
693
725
694
Related object: L<Koha::Schema::Result::Branch>
726
Related object: L<Koha::Schema::Result::Category>
695
727
696
=cut
728
=cut
697
729
698
__PACKAGE__->belongs_to(
730
__PACKAGE__->belongs_to(
699
  "branchcode",
731
  "categorycode",
700
  "Koha::Schema::Result::Branch",
732
  "Koha::Schema::Result::Category",
701
  { branchcode => "branchcode" },
733
  { categorycode => "categorycode" },
702
  { on_delete => "CASCADE", on_update => "CASCADE" },
734
  { is_deferrable => 1, on_delete => "RESTRICT", on_update => "RESTRICT" },
703
);
735
);
704
736
705
=head2 course_instructors
737
=head2 course_instructors
Lines 1017-1025 __PACKAGE__->has_many( Link Here
1017
  { cascade_copy => 0, cascade_delete => 0 },
1049
  { cascade_copy => 0, cascade_delete => 0 },
1018
);
1050
);
1019
1051
1052
=head2 basketnoes
1053
1054
Type: many_to_many
1055
1056
Composing rels: L</aqbasketusers> -> basketno
1057
1058
=cut
1059
1060
__PACKAGE__->many_to_many("basketnoes", "aqbasketusers", "basketno");
1061
1062
=head2 budgets
1063
1064
Type: many_to_many
1065
1066
Composing rels: L</aqbudgetborrowers> -> budget
1067
1068
=cut
1069
1070
__PACKAGE__->many_to_many("budgets", "aqbudgetborrowers", "budget");
1071
1072
=head2 courses
1073
1074
Type: many_to_many
1075
1076
Composing rels: L</course_instructors> -> course
1077
1078
=cut
1079
1080
__PACKAGE__->many_to_many("courses", "course_instructors", "course");
1081
1020
1082
1021
# Created by DBIx::Class::Schema::Loader v0.07000 @ 2013-11-07 08:15:21
1083
# Created by DBIx::Class::Schema::Loader v0.07040 @ 2014-06-26 13:01:03
1022
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:TQTGI0fDt+xCFs+8nOarfA
1084
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:W0T8L4w9Nr/mPXzoX0/Xjg
1023
1085
1024
__PACKAGE__->belongs_to(
1086
__PACKAGE__->belongs_to(
1025
    "guarantor",
1087
    "guarantor",
(-)a/installer/data/mysql/kohastructure.sql (-2 / +2 lines)
Lines 265-271 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_relative_checkouts` tinyint(1) NOT NULL DEFAULT '0', -- controls if relatives can see this patron's checkouts
268
  `privacy_guarantor_checkouts` tinyint(1) NOT NULL DEFAULT '0', -- controls if relatives can see this patron's checkouts
269
  UNIQUE KEY `cardnumber` (`cardnumber`),
269
  UNIQUE KEY `cardnumber` (`cardnumber`),
270
  PRIMARY KEY `borrowernumber` (`borrowernumber`),
270
  PRIMARY KEY `borrowernumber` (`borrowernumber`),
271
  KEY `categorycode` (`categorycode`),
271
  KEY `categorycode` (`categorycode`),
Lines 869-875 CREATE TABLE `deletedborrowers` ( -- stores data related to the patrons/borrower Link Here
869
  `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
870
  `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)
871
  `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_relative_checkouts` tinyint(1) NOT NULL DEFAULT '0', -- controls if relatives can see this patron's checkouts
872
  `privacy_guarantor_checkouts` tinyint(1) NOT NULL DEFAULT '0', -- controls if relatives can see this patron's checkouts
873
  KEY borrowernumber (borrowernumber),
873
  KEY borrowernumber (borrowernumber),
874
  KEY `cardnumber` (`cardnumber`)
874
  KEY `cardnumber` (`cardnumber`)
875
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
875
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
(-)a/installer/data/mysql/sysprefs.sql (-2 / +2 lines)
Lines 25-37 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
25
('AllowNotForLoanOverride','0','','If ON, Koha will allow the librarian to loan a not for loan item.','YesNo'),
25
('AllowNotForLoanOverride','0','','If ON, Koha will allow the librarian to loan a not for loan item.','YesNo'),
26
('AllowOfflineCirculation','0','','If on, enables HTML5 offline circulation functionality.','YesNo'),
26
('AllowOfflineCirculation','0','','If on, enables HTML5 offline circulation functionality.','YesNo'),
27
('AllowOnShelfHolds','0','','Allow hold requests to be placed on items that are not on loan','YesNo'),
27
('AllowOnShelfHolds','0','','Allow hold requests to be placed on items that are not on loan','YesNo'),
28
('AllowPatronToSetRelativesCheckoutsVisibility',  '0', NULL, 'If enabled, the patron can set checkouts to be visible to his or her guarantor',  'YesNo'),
28
('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'),
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
('AllowPurchaseSuggestionBranchChoice','0','1','Allow user to choose branch when making a purchase suggestion','YesNo'),
30
('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'),
31
('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'),
32
('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'),
33
('AllowSelfCheckReturns','0','','If enabled, patrons may return items through the Web-based Self Checkout','YesNo'),
34
('AllowStaffToSetRelativesCheckoutsVisibility','0',NULL,'If enabled, library staff can set a patron''s checkouts to be visible to linked patrons from the opac.',  'YesNo'),
34
('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'),
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'),
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'),
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'),
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'),
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'),
(-)a/installer/data/mysql/updatedatabase.pl (-4 / +4 lines)
Lines 8564-8573 if ( CheckVersion($DBversion) ) { Link Here
8564
$DBversion = "3.15.00.XXX";
8564
$DBversion = "3.15.00.XXX";
8565
if(CheckVersion($DBversion)) {
8565
if(CheckVersion($DBversion)) {
8566
    $dbh->do(q{
8566
    $dbh->do(q{
8567
        ALTER TABLE borrowers ADD privacy_relative_checkouts BOOLEAN NOT NULL DEFAULT '0'
8567
        ALTER TABLE borrowers ADD privacy_guarantor_checkouts BOOLEAN NOT NULL DEFAULT '0'
8568
    });
8568
    });
8569
    $dbh->do(q{
8569
    $dbh->do(q{
8570
        ALTER TABLE deletedborrowers ADD privacy_relative_checkouts BOOLEAN NOT NULL DEFAULT '0'
8570
        ALTER TABLE deletedborrowers ADD privacy_guarantor_checkouts BOOLEAN NOT NULL DEFAULT '0'
8571
    });
8571
    });
8572
    $dbh->do(q{
8572
    $dbh->do(q{
8573
        ALTER TABLE old_issues DROP PRIMARY KEY
8573
        ALTER TABLE old_issues DROP PRIMARY KEY
Lines 8606-8612 if(CheckVersion($DBversion)) { Link Here
8606
    $dbh->do(q{
8606
    $dbh->do(q{
8607
        INSERT INTO systempreferences (variable, value, options, explanation, type )
8607
        INSERT INTO systempreferences (variable, value, options, explanation, type )
8608
        VALUES (
8608
        VALUES (
8609
            'AllowStaffToSetRelativesCheckoutsVisibility',  '0', NULL,
8609
            'AllowStaffToSetCheckoutsVisibilityForGuarantor',  '0', NULL,
8610
            'If enabled, library staff can set a patron''s checkouts to be visible to linked patrons from the opac.',  'YesNo'
8610
            'If enabled, library staff can set a patron''s checkouts to be visible to linked patrons from the opac.',  'YesNo'
8611
        )
8611
        )
8612
    });
8612
    });
Lines 8614-8620 if(CheckVersion($DBversion)) { Link Here
8614
    $dbh->do(q{
8614
    $dbh->do(q{
8615
        INSERT INTO systempreferences (variable, value, options, explanation, type )
8615
        INSERT INTO systempreferences (variable, value, options, explanation, type )
8616
        VALUES (
8616
        VALUES (
8617
            'AllowPatronToSetRelativesCheckoutsVisibility',  '0', NULL,
8617
            'AllowPatronToSetCheckoutsVisibilityForGuarantor',  '0', NULL,
8618
            'If enabled, the patron can set checkouts to be visible to  his or her guarantor',  'YesNo'
8618
            'If enabled, the patron can set checkouts to be visible to  his or her guarantor',  'YesNo'
8619
        )
8619
        )
8620
    });
8620
    });
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-1 / +1 lines)
Lines 588-594 OPAC: Link Here
588
                  no: "Don't allow"
588
                  no: "Don't allow"
589
            - patrons to choose their own privacy settings for their reading history.  This requires opacreadinghistory and AnonymousPatron
589
            - patrons to choose their own privacy settings for their reading history.  This requires opacreadinghistory and AnonymousPatron
590
        -
590
        -
591
            - pref: AllowPatronToSetRelativesCheckoutsVisibility
591
            - pref: AllowPatronToSetCheckoutsVisibilityForGuarantor
592
              default: 0
592
              default: 0
593
              choices:
593
              choices:
594
                  yes: Allow
594
                  yes: Allow
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (-1 / +1 lines)
Lines 134-140 Patrons: Link Here
134
               no: "Don't"
134
               no: "Don't"
135
         - enable the ability to upload and attach arbitrary files to a borrower record.
135
         - enable the ability to upload and attach arbitrary files to a borrower record.
136
     -
136
     -
137
         - pref: AllowStaffToSetRelativesCheckoutsVisibility
137
         - pref: AllowStaffToSetCheckoutsVisibilityForGuarantor
138
           choices:
138
           choices:
139
               yes: Allow
139
               yes: Allow
140
               no: "Don't allow"
140
               no: "Don't allow"
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-5 / +5 lines)
Lines 1171-1181 Link Here
1171
			[% END %]
1171
			[% END %]
1172
	  [% IF ( mandatorypassword ) %]<span class="required">Required</span>[% END %][% IF ( ERROR_password_mismatch ) %]<span class="required">Passwords do not match</span>[% END %]
1172
	  [% IF ( mandatorypassword ) %]<span class="required">Required</span>[% END %][% IF ( ERROR_password_mismatch ) %]<span class="required">Passwords do not match</span>[% END %]
1173
		</li>
1173
		</li>
1174
        [% IF Koha.Preference('AllowStaffToSetRelativesCheckoutsVisibility') %]
1174
        [% IF guarantorid && Koha.Preference('AllowStaffToSetCheckoutsVisibilityForGuarantor') %]
1175
            <li>
1175
            <li>
1176
                <label for="privacy_relative_checkouts">Show checkouts to relatives</label>
1176
                <label for="privacy_guarantor_checkouts">Show checkouts to guarantor</label>
1177
                <select name="privacy_relative_checkouts" id="privacy_relative_checkouts">
1177
                <select name="privacy_guarantor_checkouts" id="privacy_guarantor_checkouts">
1178
                    [% IF privacy_relative_checkouts %]
1178
                    [% IF privacy_guarantor_checkouts %]
1179
                        <option value="0">No</option>
1179
                        <option value="0">No</option>
1180
                        <option value="1" selected>Yes</option>
1180
                        <option value="1" selected>Yes</option>
1181
                    [% ELSE %]
1181
                    [% ELSE %]
Lines 1183-1189 Link Here
1183
                        <option value="1">Yes</option>
1183
                        <option value="1">Yes</option>
1184
                    [% END %]
1184
                    [% END %]
1185
                </select>
1185
                </select>
1186
                <div class="hint">Allow linked patron accounts to view this patron's checkouts from the OPAC</div>
1186
                <div class="hint">Allow guarantor of this patron to view this patron's checkouts from the OPAC</div>
1187
            </li>
1187
            </li>
1188
        [% END %]
1188
        [% END %]
1189
		</ol>
1189
		</ol>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-2 / +2 lines)
Lines 374-381 function validate1(date) { Link Here
374
    </li>[% END %]
374
    </li>[% END %]
375
375
376
    <li>
376
    <li>
377
        <span class="label">Show checkouts to relatives</span>
377
        <span class="label">Show checkouts to guarantor</span>
378
        [% IF privacy_relative_checkouts %]
378
        [% IF privacy_guarantor_checkouts %]
379
            Yes
379
            Yes
380
        [% ELSE %]
380
        [% ELSE %]
381
            No
381
            No
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt (-9 / +9 lines)
Lines 54-76 Link Here
54
                    <div class="alert">You typed in the wrong characters in the box before submitting. Please try again.</div>
54
                    <div class="alert">You typed in the wrong characters in the box before submitting. Please try again.</div>
55
                [% END %]
55
                [% END %]
56
56
57
                [% IF borrower.guarantorid && !Koha.Preference('OPACPrivacy') && Koha.Preference('AllowPatronToSetRelativesCheckoutsVisibility') %]
57
                [% IF borrower.guarantorid && !Koha.Preference('OPACPrivacy') && Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') %]
58
                    <fieldset class="rows" id="memberentry_privacy">
58
                    <fieldset class="rows" id="memberentry_privacy">
59
                        <legend id="privacy_legend">Privacy</legend>
59
                        <legend id="privacy_legend">Privacy</legend>
60
                        <ol>
60
                        <ol>
61
                            <li>
61
                            <li>
62
                                <label>Allow your guarantor to view your current checkouts?</label>
62
                                <label>Allow your guarantor to view your current checkouts?</label>
63
                                <select id="privacy_relative_checkouts">
63
                                <select id="privacy_guarantor_checkouts">
64
                                    <option value="0">No</option>
64
                                    <option value="0">No</option>
65
                                    [% IF borrower.privacy_relative_checkouts %]
65
                                    [% IF borrower.privacy_guarantor_checkouts %]
66
                                        <option value="1" selected="selected">Yes</option>
66
                                        <option value="1" selected="selected">Yes</option>
67
                                    [% ELSE %]
67
                                    [% ELSE %]
68
                                        <option value="1">Yes</option>
68
                                        <option value="1">Yes</option>
69
                                    [% END %]
69
                                    [% END %]
70
                                </select>
70
                                </select>
71
                                <span class="hint">
71
                                <span class="hint">
72
                                    <a id="update_privacy_relative_checkouts" href="#" class="btn">Update</a>
72
                                    <a id="update_privacy_guarantor_checkouts" href="#" class="btn">Update</a>
73
                                    <span id="update_privacy_relative_checkouts_message" class="alert" style="display:none"></span>
73
                                    <span id="update_privacy_guarantor_checkouts_message" class="alert" style="display:none"></span>
74
                                </span>
74
                                </span>
75
                                <span class="hint">
75
                                <span class="hint">
76
                                    [% SET g = Koha.Find('Borrower',borrower.guarantorid) %]
76
                                    [% SET g = Koha.Find('Borrower',borrower.guarantorid) %]
Lines 805-813 Link Here
805
                $( "#borrower_dateofbirth" ).datepicker({ yearRange: "c-120:c" });
805
                $( "#borrower_dateofbirth" ).datepicker({ yearRange: "c-120:c" });
806
            [% END %]
806
            [% END %]
807
807
808
            [% IF borrower.guarantorid && !Koha.Preference('OPACPrivacy') && Koha.Preference('AllowPatronToSetRelativesCheckoutsVisibility') %]
808
            [% IF borrower.guarantorid && !Koha.Preference('OPACPrivacy') && Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') %]
809
                $('#update_privacy_relative_checkouts').click( function() {
809
                $('#update_privacy_guarantor_checkouts').click( function() {
810
                    $.post( "/cgi-bin/koha/svc/patron/show_checkouts_to_relatives", { privacy_relative_checkouts: $('#privacy_relative_checkouts').val() })
810
                    $.post( "/cgi-bin/koha/svc/patron/show_checkouts_to_relatives", { privacy_guarantor_checkouts: $('#privacy_guarantor_checkouts').val() })
811
                     .done(function( data ) {
811
                     .done(function( data ) {
812
                         var message;
812
                         var message;
813
                         if ( data.success ) {
813
                         if ( data.success ) {
Lines 816-822 Link Here
816
                             message = _("Unable to update your setting!");
816
                             message = _("Unable to update your setting!");
817
                         }
817
                         }
818
818
819
                         $('#update_privacy_relative_checkouts_message').fadeIn("slow").text( message ).delay( 5000 ).fadeOut("slow");
819
                         $('#update_privacy_guarantor_checkouts_message').fadeIn("slow").text( message ).delay( 5000 ).fadeOut("slow");
820
                     });
820
                     });
821
                });
821
                });
822
            [% END %]
822
            [% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-privacy.tt (-4 / +4 lines)
Lines 69-79 Link Here
69
                                    </div>
69
                                    </div>
70
70
71
                                    [% SET b = Koha.Find('Borrower', borrower.borrowernumber) %]
71
                                    [% SET b = Koha.Find('Borrower', borrower.borrowernumber) %]
72
                                    [% IF b.guarantorid && Koha.Preference('AllowPatronToSetRelativesCheckoutsVisibility') %]
72
                                    [% IF b.guarantorid && Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') %]
73
                                        <div>
73
                                        <div>
74
                                            <label for="privacy_relative_checkouts">Allow your guarantor to view your current checkouts?</label>
74
                                            <label for="privacy_guarantor_checkouts">Allow your guarantor to view your current checkouts?</label>
75
                                            <select name="privacy_relative_checkouts">
75
                                            <select name="privacy_guarantor_checkouts">
76
                                                [% IF borrower.privacy_relative_checkouts %]
76
                                                [% IF borrower.privacy_guarantor_checkouts %]
77
                                                    <option value="0">No</option>
77
                                                    <option value="0">No</option>
78
                                                    <option value="1" selected>Yes</option>
78
                                                    <option value="1" selected>Yes</option>
79
                                                [% ELSE %]
79
                                                [% ELSE %]
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-memberentry.tt (-7 / +7 lines)
Lines 21-28 Link Here
21
                $( "#borrower_dateofbirth" ).datepicker({ yearRange: "c-120:c" });
21
                $( "#borrower_dateofbirth" ).datepicker({ yearRange: "c-120:c" });
22
            [% END %]
22
            [% END %]
23
23
24
            $('#update_privacy_relative_checkouts').click( function() {
24
            $('#update_privacy_guarantor_checkouts').click( function() {
25
                $.post( "/cgi-bin/koha/svc/patron/show_checkouts_to_relatives", { privacy_relative_checkouts: $('#privacy_relative_checkouts').val() })
25
                $.post( "/cgi-bin/koha/svc/patron/show_checkouts_to_relatives", { privacy_guarantor_checkouts: $('#privacy_guarantor_checkouts').val() })
26
                 .done(function( data ) {
26
                 .done(function( data ) {
27
                     var message;
27
                     var message;
28
                     if ( data.success ) {
28
                     if ( data.success ) {
Lines 31-37 Link Here
31
                         message = _("Unable to update your setting!");
31
                         message = _("Unable to update your setting!");
32
                     }
32
                     }
33
33
34
                     $('#update_privacy_relative_checkouts_message').fadeIn("slow").text( message ).delay( 5000 ).fadeOut("slow");
34
                     $('#update_privacy_guarantor_checkouts_message').fadeIn("slow").text( message ).delay( 5000 ).fadeOut("slow");
35
                 });
35
                 });
36
            });
36
            });
37
        });
37
        });
Lines 81-97 Link Here
81
                                <ol>
81
                                <ol>
82
                                    <li>
82
                                    <li>
83
                                        <label>Show checkouts to relatives</label>
83
                                        <label>Show checkouts to relatives</label>
84
                                        <select id="privacy_relative_checkouts">
84
                                        <select id="privacy_guarantor_checkouts">
85
                                            <option value="0">No</option>
85
                                            <option value="0">No</option>
86
                                            [% IF borrower.privacy_relative_checkouts %]
86
                                            [% IF borrower.privacy_guarantor_checkouts %]
87
                                                <option value="1" selected="selected">Yes</option>
87
                                                <option value="1" selected="selected">Yes</option>
88
                                            [% ELSE %]
88
                                            [% ELSE %]
89
                                                <option value="1">Yes</option>
89
                                                <option value="1">Yes</option>
90
                                            [% END %]
90
                                            [% END %]
91
                                        </select>
91
                                        </select>
92
                                        <span class="hint">
92
                                        <span class="hint">
93
                                            <button id="update_privacy_relative_checkouts" onclick="return false;">Update</button>
93
                                            <button id="update_privacy_guarantor_checkouts" onclick="return false;">Update</button>
94
                                            <span id="update_privacy_relative_checkouts_message" class="alert" style="display:none"></span>
94
                                            <span id="update_privacy_guarantor_checkouts_message" class="alert" style="display:none"></span>
95
                                        </span>
95
                                        </span>
96
                                    </li>
96
                                    </li>
97
                                </ol>
97
                                </ol>
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-privacy.tt (-3 / +3 lines)
Lines 57-65 Link Here
57
57
58
            <p/>
58
            <p/>
59
59
60
            <label for="privacy_relative_checkouts">Allow relatives to view your current checkouts?</label>
60
            <label for="privacy_guarantor_checkouts">Allow relatives to view your current checkouts?</label>
61
            <select name="privacy_relative_checkouts">
61
            <select name="privacy_guarantor_checkouts">
62
                [% IF borrower.privacy_relative_checkouts %]
62
                [% IF borrower.privacy_guarantor_checkouts %]
63
                    <option value="0">No</option>
63
                    <option value="0">No</option>
64
                    <option value="1" selected>Yes</option>
64
                    <option value="1" selected>Yes</option>
65
                [% ELSE %]
65
                [% ELSE %]
(-)a/members/moremember.pl (-1 / +1 lines)
Lines 444-450 $template->param( Link Here
444
#   reserveloop     => \@reservedata,
444
#   reserveloop     => \@reservedata,
445
    samebranch     => $samebranch,
445
    samebranch     => $samebranch,
446
    quickslip		  => $quickslip,
446
    quickslip		  => $quickslip,
447
    privacy_relative_checkouts => $data->{'privacy_relative_checkouts'},
447
    privacy_guarantor_checkouts => $data->{'privacy_guarantor_checkouts'},
448
    activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
448
    activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
449
    AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'),
449
    AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'),
450
    SuspendHoldsIntranet => C4::Context->preference('SuspendHoldsIntranet'),
450
    SuspendHoldsIntranet => C4::Context->preference('SuspendHoldsIntranet'),
(-)a/opac/opac-privacy.pl (-2 / +2 lines)
Lines 42-54 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
42
42
43
my $op                         = $query->param("op");
43
my $op                         = $query->param("op");
44
my $privacy                    = $query->param("privacy");
44
my $privacy                    = $query->param("privacy");
45
my $privacy_relative_checkouts = $query->param("privacy_relative_checkouts");
45
my $privacy_guarantor_checkouts = $query->param("privacy_guarantor_checkouts");
46
46
47
if ( $op eq "update_privacy" ) {
47
if ( $op eq "update_privacy" ) {
48
    ModMember(
48
    ModMember(
49
        borrowernumber             => $borrowernumber,
49
        borrowernumber             => $borrowernumber,
50
        privacy                    => $privacy,
50
        privacy                    => $privacy,
51
        privacy_relative_checkouts => $privacy_relative_checkouts,
51
        privacy_guarantor_checkouts => $privacy_guarantor_checkouts,
52
    );
52
    );
53
    $template->param( 'privacy_updated' => 1 );
53
    $template->param( 'privacy_updated' => 1 );
54
}
54
}
(-)a/opac/opac-user.pl (-3 / +3 lines)
Lines 374-386 if ( $borr->{'opacnote'} ) { Link Here
374
  );
374
  );
375
}
375
}
376
376
377
if (   C4::Context->preference('AllowPatronToSetRelativesCheckoutsVisibility')
377
if (   C4::Context->preference('AllowPatronToSetCheckoutsVisibilityForGuarantor')
378
    || C4::Context->preference('AllowStaffToSetRelativesCheckoutsVisibility') )
378
    || C4::Context->preference('AllowStaffToSetCheckoutsVisibilityForGuarantor') )
379
{
379
{
380
    my @relatives =
380
    my @relatives =
381
      Koha::Database->new()->schema()->resultset("Borrower")->search(
381
      Koha::Database->new()->schema()->resultset("Borrower")->search(
382
        {
382
        {
383
            privacy_relative_checkouts => 1,
383
            privacy_guarantor_checkouts => 1,
384
            'me.guarantorid'           => $borrowernumber
384
            'me.guarantorid'           => $borrowernumber
385
        },
385
        },
386
        { prefetch => [ { 'issues' => { 'item' => 'biblio' } } ] }
386
        { prefetch => [ { 'issues' => { 'item' => 'biblio' } } ] }
(-)a/opac/svc/patron/show_checkouts_to_relatives (-5 / +4 lines)
Lines 29-35 use JSON qw( to_json ); Link Here
29
29
30
my $cgi = CGI->new();
30
my $cgi = CGI->new();
31
31
32
my $privacy_relative_checkouts = $cgi->param('privacy_relative_checkouts');
32
my $privacy_guarantor_checkouts = $cgi->param('privacy_guarantor_checkouts');
33
33
34
my ( $userid, $cookie, $sessionID, $flags ) = checkauth( $cgi, 1, {}, 'opac' );
34
my ( $userid, $cookie, $sessionID, $flags ) = checkauth( $cgi, 1, {}, 'opac' );
35
35
Lines 37-49 my $borrowernumber = Link Here
37
  C4::Context->userenv ? C4::Context->userenv->{number} : undef;
37
  C4::Context->userenv ? C4::Context->userenv->{number} : undef;
38
38
39
my $success = 0;
39
my $success = 0;
40
if ( $borrowernumber && defined($privacy_relative_checkouts) ) {
40
if ( $borrowernumber && defined($privacy_guarantor_checkouts) ) {
41
    my $patron =
41
    my $patron =
42
      Koha::Database->new()->schema()->resultset('Borrower')
42
      Koha::Database->new()->schema()->resultset('Borrower')
43
      ->find($borrowernumber);
43
      ->find($borrowernumber);
44
44
45
    $success = $patron->update(
45
    $success = $patron->update(
46
        { privacy_relative_checkouts => $privacy_relative_checkouts } );
46
        { privacy_guarantor_checkouts => $privacy_guarantor_checkouts } );
47
}
47
}
48
48
49
binmode STDOUT, ":encoding(UTF-8)";
49
binmode STDOUT, ":encoding(UTF-8)";
Lines 55-60 print $cgi->header( Link Here
55
print to_json(
55
print to_json(
56
    {
56
    {
57
        success => $success ? 1 : 0,
57
        success => $success ? 1 : 0,
58
        privacy_relative_checkouts => $privacy_relative_checkouts,
58
        privacy_guarantor_checkouts => $privacy_guarantor_checkouts,
59
    }
59
    }
60
);
60
);
61
- 

Return to bug 9303