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

(-)a/C4/Members.pm (-26 lines)
Lines 112-118 BEGIN { Link Here
112
    push @EXPORT, qw(
112
    push @EXPORT, qw(
113
        &ModMember
113
        &ModMember
114
        &changepassword
114
        &changepassword
115
         &ModPrivacy
116
    );
115
    );
117
116
118
    #Delete data
117
    #Delete data
Lines 2216-2246 sub GetBorrowersNamesAndLatestIssue { Link Here
2216
    return $results;
2215
    return $results;
2217
}
2216
}
2218
2217
2219
=head2 ModPrivacy
2220
2221
=over 4
2222
2223
my $success = ModPrivacy( $borrowernumber, $privacy );
2224
2225
Update the privacy of a patron.
2226
2227
return :
2228
true on success, false on failure
2229
2230
=back
2231
2232
=cut
2233
2234
sub ModPrivacy {
2235
    my $borrowernumber = shift;
2236
    my $privacy = shift;
2237
    return unless defined $borrowernumber;
2238
    return unless $borrowernumber =~ /^\d+$/;
2239
2240
    return ModMember( borrowernumber => $borrowernumber,
2241
                      privacy        => $privacy );
2242
}
2243
2244
=head2 AddMessage
2218
=head2 AddMessage
2245
2219
2246
  AddMessage( $borrowernumber, $message_type, $message, $branchcode );
2220
  AddMessage( $borrowernumber, $message_type, $message, $branchcode );
(-)a/Koha/Schema/Result/Borrower.pm (-84 / +30 lines)
Lines 1-21 Link Here
1
use utf8;
2
package Koha::Schema::Result::Borrower;
1
package Koha::Schema::Result::Borrower;
3
2
4
# Created by DBIx::Class::Schema::Loader
3
# Created by DBIx::Class::Schema::Loader
5
# DO NOT MODIFY THE FIRST PART OF THIS FILE
4
# DO NOT MODIFY THE FIRST PART OF THIS FILE
6
5
7
=head1 NAME
8
9
Koha::Schema::Result::Borrower
10
11
=cut
12
13
use strict;
6
use strict;
14
use warnings;
7
use warnings;
15
8
16
use base 'DBIx::Class::Core';
9
use base 'DBIx::Class::Core';
17
10
18
=head1 TABLE: C<borrowers>
11
12
=head1 NAME
13
14
Koha::Schema::Result::Borrower
19
15
20
=cut
16
=cut
21
17
Lines 191-197 __PACKAGE__->table("borrowers"); Link Here
191
=head2 dateofbirth
187
=head2 dateofbirth
192
188
193
  data_type: 'date'
189
  data_type: 'date'
194
  datetime_undef_if_invalid: 1
195
  is_nullable: 1
190
  is_nullable: 1
196
191
197
=head2 branchcode
192
=head2 branchcode
Lines 213-225 __PACKAGE__->table("borrowers"); Link Here
213
=head2 dateenrolled
208
=head2 dateenrolled
214
209
215
  data_type: 'date'
210
  data_type: 'date'
216
  datetime_undef_if_invalid: 1
217
  is_nullable: 1
211
  is_nullable: 1
218
212
219
=head2 dateexpiry
213
=head2 dateexpiry
220
214
221
  data_type: 'date'
215
  data_type: 'date'
222
  datetime_undef_if_invalid: 1
223
  is_nullable: 1
216
  is_nullable: 1
224
217
225
=head2 gonenoaddress
218
=head2 gonenoaddress
Lines 235-241 __PACKAGE__->table("borrowers"); Link Here
235
=head2 debarred
228
=head2 debarred
236
229
237
  data_type: 'date'
230
  data_type: 'date'
238
  datetime_undef_if_invalid: 1
239
  is_nullable: 1
231
  is_nullable: 1
240
232
241
=head2 debarredcomment
233
=head2 debarredcomment
Lines 397-402 __PACKAGE__->table("borrowers"); Link Here
397
  default_value: 1
389
  default_value: 1
398
  is_nullable: 0
390
  is_nullable: 0
399
391
392
=head2 privacy_relative_checkouts
393
394
  data_type: 'tinyint'
395
  default_value: 0
396
  is_nullable: 0
397
400
=cut
398
=cut
401
399
402
__PACKAGE__->add_columns(
400
__PACKAGE__->add_columns(
Lines 463-469 __PACKAGE__->add_columns( Link Here
463
  "b_phone",
461
  "b_phone",
464
  { data_type => "mediumtext", is_nullable => 1 },
462
  { data_type => "mediumtext", is_nullable => 1 },
465
  "dateofbirth",
463
  "dateofbirth",
466
  { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
464
  { data_type => "date", is_nullable => 1 },
467
  "branchcode",
465
  "branchcode",
468
  {
466
  {
469
    data_type => "varchar",
467
    data_type => "varchar",
Lines 481-495 __PACKAGE__->add_columns( Link Here
481
    size => 10,
479
    size => 10,
482
  },
480
  },
483
  "dateenrolled",
481
  "dateenrolled",
484
  { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
482
  { data_type => "date", is_nullable => 1 },
485
  "dateexpiry",
483
  "dateexpiry",
486
  { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
484
  { data_type => "date", is_nullable => 1 },
487
  "gonenoaddress",
485
  "gonenoaddress",
488
  { data_type => "tinyint", is_nullable => 1 },
486
  { data_type => "tinyint", is_nullable => 1 },
489
  "lost",
487
  "lost",
490
  { data_type => "tinyint", is_nullable => 1 },
488
  { data_type => "tinyint", is_nullable => 1 },
491
  "debarred",
489
  "debarred",
492
  { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
490
  { data_type => "date", is_nullable => 1 },
493
  "debarredcomment",
491
  "debarredcomment",
494
  { data_type => "varchar", is_nullable => 1, size => 255 },
492
  { data_type => "varchar", is_nullable => 1, size => 255 },
495
  "contactname",
493
  "contactname",
Lines 546-577 __PACKAGE__->add_columns( Link Here
546
  { data_type => "varchar", is_nullable => 1, size => 50 },
544
  { data_type => "varchar", is_nullable => 1, size => 50 },
547
  "privacy",
545
  "privacy",
548
  { data_type => "integer", default_value => 1, is_nullable => 0 },
546
  { data_type => "integer", default_value => 1, is_nullable => 0 },
547
  "privacy_relative_checkouts",
548
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
549
);
549
);
550
551
=head1 PRIMARY KEY
552
553
=over 4
554
555
=item * L</borrowernumber>
556
557
=back
558
559
=cut
560
561
__PACKAGE__->set_primary_key("borrowernumber");
550
__PACKAGE__->set_primary_key("borrowernumber");
562
563
=head1 UNIQUE CONSTRAINTS
564
565
=head2 C<cardnumber>
566
567
=over 4
568
569
=item * L</cardnumber>
570
571
=back
572
573
=cut
574
575
__PACKAGE__->add_unique_constraint("cardnumber", ["cardnumber"]);
551
__PACKAGE__->add_unique_constraint("cardnumber", ["cardnumber"]);
576
552
577
=head1 RELATIONS
553
=head1 RELATIONS
Lines 696-729 __PACKAGE__->has_many( Link Here
696
  { cascade_copy => 0, cascade_delete => 0 },
672
  { cascade_copy => 0, cascade_delete => 0 },
697
);
673
);
698
674
699
=head2 branchcode
675
=head2 categorycode
700
676
701
Type: belongs_to
677
Type: belongs_to
702
678
703
Related object: L<Koha::Schema::Result::Branch>
679
Related object: L<Koha::Schema::Result::Category>
704
680
705
=cut
681
=cut
706
682
707
__PACKAGE__->belongs_to(
683
__PACKAGE__->belongs_to(
708
  "branchcode",
684
  "categorycode",
709
  "Koha::Schema::Result::Branch",
685
  "Koha::Schema::Result::Category",
710
  { branchcode => "branchcode" },
686
  { categorycode => "categorycode" },
711
  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
687
  { on_delete => "CASCADE", on_update => "CASCADE" },
712
);
688
);
713
689
714
=head2 categorycode
690
=head2 branchcode
715
691
716
Type: belongs_to
692
Type: belongs_to
717
693
718
Related object: L<Koha::Schema::Result::Category>
694
Related object: L<Koha::Schema::Result::Branch>
719
695
720
=cut
696
=cut
721
697
722
__PACKAGE__->belongs_to(
698
__PACKAGE__->belongs_to(
723
  "categorycode",
699
  "branchcode",
724
  "Koha::Schema::Result::Category",
700
  "Koha::Schema::Result::Branch",
725
  { categorycode => "categorycode" },
701
  { branchcode => "branchcode" },
726
  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
702
  { on_delete => "CASCADE", on_update => "CASCADE" },
727
);
703
);
728
704
729
=head2 course_instructors
705
=head2 course_instructors
Lines 1041-1079 __PACKAGE__->has_many( Link Here
1041
  { cascade_copy => 0, cascade_delete => 0 },
1017
  { cascade_copy => 0, cascade_delete => 0 },
1042
);
1018
);
1043
1019
1044
=head2 basketnoes
1045
1046
Type: many_to_many
1047
1048
Composing rels: L</aqbasketusers> -> basketno
1049
1050
=cut
1051
1052
__PACKAGE__->many_to_many("basketnoes", "aqbasketusers", "basketno");
1053
1054
=head2 budgets
1055
1056
Type: many_to_many
1057
1058
Composing rels: L</aqbudgetborrowers> -> budget
1059
1060
=cut
1061
1062
__PACKAGE__->many_to_many("budgets", "aqbudgetborrowers", "budget");
1063
1064
=head2 courses
1065
1066
Type: many_to_many
1067
1068
Composing rels: L</course_instructors> -> course
1069
1070
=cut
1071
1072
__PACKAGE__->many_to_many("courses", "course_instructors", "course");
1073
1074
1020
1075
# Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-10-31 16:31:19
1021
# Created by DBIx::Class::Schema::Loader v0.07000 @ 2013-11-07 08:15:21
1076
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:z4kW3xYX1CyrwvGdZu32nA
1022
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:TQTGI0fDt+xCFs+8nOarfA
1077
1023
1078
1024
1079
# You can replace this text with custom content, and it will be preserved on regeneration
1025
# You can replace this text with custom content, and it will be preserved on regeneration
(-)a/Koha/Schema/Result/Issue.pm (-50 / +30 lines)
Lines 1-21 Link Here
1
use utf8;
2
package Koha::Schema::Result::Issue;
1
package Koha::Schema::Result::Issue;
3
2
4
# Created by DBIx::Class::Schema::Loader
3
# Created by DBIx::Class::Schema::Loader
5
# DO NOT MODIFY THE FIRST PART OF THIS FILE
4
# DO NOT MODIFY THE FIRST PART OF THIS FILE
6
5
7
=head1 NAME
8
9
Koha::Schema::Result::Issue
10
11
=cut
12
13
use strict;
6
use strict;
14
use warnings;
7
use warnings;
15
8
16
use base 'DBIx::Class::Core';
9
use base 'DBIx::Class::Core';
17
10
18
=head1 TABLE: C<issues>
11
12
=head1 NAME
13
14
Koha::Schema::Result::Issue
19
15
20
=cut
16
=cut
21
17
Lines 23-28 __PACKAGE__->table("issues"); Link Here
23
19
24
=head1 ACCESSORS
20
=head1 ACCESSORS
25
21
22
=head2 issue_id
23
24
  data_type: 'integer'
25
  is_auto_increment: 1
26
  is_nullable: 0
27
26
=head2 borrowernumber
28
=head2 borrowernumber
27
29
28
  data_type: 'integer'
30
  data_type: 'integer'
Lines 38-44 __PACKAGE__->table("issues"); Link Here
38
=head2 date_due
40
=head2 date_due
39
41
40
  data_type: 'datetime'
42
  data_type: 'datetime'
41
  datetime_undef_if_invalid: 1
42
  is_nullable: 1
43
  is_nullable: 1
43
44
44
=head2 branchcode
45
=head2 branchcode
Lines 56-68 __PACKAGE__->table("issues"); Link Here
56
=head2 returndate
57
=head2 returndate
57
58
58
  data_type: 'datetime'
59
  data_type: 'datetime'
59
  datetime_undef_if_invalid: 1
60
  is_nullable: 1
60
  is_nullable: 1
61
61
62
=head2 lastreneweddate
62
=head2 lastreneweddate
63
63
64
  data_type: 'datetime'
64
  data_type: 'datetime'
65
  datetime_undef_if_invalid: 1
66
  is_nullable: 1
65
  is_nullable: 1
67
66
68
=head2 return
67
=head2 return
Lines 79-141 __PACKAGE__->table("issues"); Link Here
79
=head2 timestamp
78
=head2 timestamp
80
79
81
  data_type: 'timestamp'
80
  data_type: 'timestamp'
82
  datetime_undef_if_invalid: 1
83
  default_value: current_timestamp
81
  default_value: current_timestamp
84
  is_nullable: 0
82
  is_nullable: 0
85
83
86
=head2 issuedate
84
=head2 issuedate
87
85
88
  data_type: 'datetime'
86
  data_type: 'datetime'
89
  datetime_undef_if_invalid: 1
90
  is_nullable: 1
87
  is_nullable: 1
91
88
92
=cut
89
=cut
93
90
94
__PACKAGE__->add_columns(
91
__PACKAGE__->add_columns(
92
  "issue_id",
93
  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
95
  "borrowernumber",
94
  "borrowernumber",
96
  { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
95
  { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
97
  "itemnumber",
96
  "itemnumber",
98
  { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
97
  { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
99
  "date_due",
98
  "date_due",
100
  {
99
  { data_type => "datetime", is_nullable => 1 },
101
    data_type => "datetime",
102
    datetime_undef_if_invalid => 1,
103
    is_nullable => 1,
104
  },
105
  "branchcode",
100
  "branchcode",
106
  { data_type => "varchar", is_nullable => 1, size => 10 },
101
  { data_type => "varchar", is_nullable => 1, size => 10 },
107
  "issuingbranch",
102
  "issuingbranch",
108
  { data_type => "varchar", is_nullable => 1, size => 18 },
103
  { data_type => "varchar", is_nullable => 1, size => 18 },
109
  "returndate",
104
  "returndate",
110
  {
105
  { data_type => "datetime", is_nullable => 1 },
111
    data_type => "datetime",
112
    datetime_undef_if_invalid => 1,
113
    is_nullable => 1,
114
  },
115
  "lastreneweddate",
106
  "lastreneweddate",
116
  {
107
  { data_type => "datetime", is_nullable => 1 },
117
    data_type => "datetime",
118
    datetime_undef_if_invalid => 1,
119
    is_nullable => 1,
120
  },
121
  "return",
108
  "return",
122
  { data_type => "varchar", is_nullable => 1, size => 4 },
109
  { data_type => "varchar", is_nullable => 1, size => 4 },
123
  "renewals",
110
  "renewals",
124
  { data_type => "tinyint", is_nullable => 1 },
111
  { data_type => "tinyint", is_nullable => 1 },
125
  "timestamp",
112
  "timestamp",
126
  {
113
  {
127
    data_type => "timestamp",
114
    data_type     => "timestamp",
128
    datetime_undef_if_invalid => 1,
129
    default_value => \"current_timestamp",
115
    default_value => \"current_timestamp",
130
    is_nullable => 0,
116
    is_nullable   => 0,
131
  },
117
  },
132
  "issuedate",
118
  "issuedate",
133
  {
119
  { data_type => "datetime", is_nullable => 1 },
134
    data_type => "datetime",
135
    datetime_undef_if_invalid => 1,
136
    is_nullable => 1,
137
  },
138
);
120
);
121
__PACKAGE__->set_primary_key("issue_id");
139
122
140
=head1 RELATIONS
123
=head1 RELATIONS
141
124
Lines 151-162 __PACKAGE__->belongs_to( Link Here
151
  "borrowernumber",
134
  "borrowernumber",
152
  "Koha::Schema::Result::Borrower",
135
  "Koha::Schema::Result::Borrower",
153
  { borrowernumber => "borrowernumber" },
136
  { borrowernumber => "borrowernumber" },
154
  {
137
  { join_type => "LEFT", on_delete => "CASCADE", on_update => "CASCADE" },
155
    is_deferrable => 1,
156
    join_type     => "LEFT",
157
    on_delete     => "CASCADE",
158
    on_update     => "CASCADE",
159
  },
160
);
138
);
161
139
162
=head2 itemnumber
140
=head2 itemnumber
Lines 171-187 __PACKAGE__->belongs_to( Link Here
171
  "itemnumber",
149
  "itemnumber",
172
  "Koha::Schema::Result::Item",
150
  "Koha::Schema::Result::Item",
173
  { itemnumber => "itemnumber" },
151
  { itemnumber => "itemnumber" },
174
  {
152
  { join_type => "LEFT", on_delete => "CASCADE", on_update => "CASCADE" },
175
    is_deferrable => 1,
176
    join_type     => "LEFT",
177
    on_delete     => "CASCADE",
178
    on_update     => "CASCADE",
179
  },
180
);
153
);
181
154
182
155
183
# Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-10-14 20:56:21
156
# Created by DBIx::Class::Schema::Loader v0.07000 @ 2013-11-06 14:03:30
184
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ZEh31EKBmURMKxDxI+H3EA
157
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:x90AnyA32VcLbXMb7hfA9g
185
158
186
__PACKAGE__->belongs_to(
159
__PACKAGE__->belongs_to(
187
  "borrower",
160
  "borrower",
Lines 190-193 __PACKAGE__->belongs_to( Link Here
190
  { join_type => "LEFT", on_delete => "CASCADE", on_update => "CASCADE" },
163
  { join_type => "LEFT", on_delete => "CASCADE", on_update => "CASCADE" },
191
);
164
);
192
165
166
__PACKAGE__->belongs_to(
167
  "item",
168
  "Koha::Schema::Result::Item",
169
  { itemnumber => "itemnumber" },
170
  { join_type => "LEFT", on_delete => "CASCADE", on_update => "CASCADE" },
171
);
172
193
1;
173
1;
(-)a/Koha/Schema/Result/OldIssue.pm (-50 / +23 lines)
Lines 1-21 Link Here
1
use utf8;
2
package Koha::Schema::Result::OldIssue;
1
package Koha::Schema::Result::OldIssue;
3
2
4
# Created by DBIx::Class::Schema::Loader
3
# Created by DBIx::Class::Schema::Loader
5
# DO NOT MODIFY THE FIRST PART OF THIS FILE
4
# DO NOT MODIFY THE FIRST PART OF THIS FILE
6
5
7
=head1 NAME
8
9
Koha::Schema::Result::OldIssue
10
11
=cut
12
13
use strict;
6
use strict;
14
use warnings;
7
use warnings;
15
8
16
use base 'DBIx::Class::Core';
9
use base 'DBIx::Class::Core';
17
10
18
=head1 TABLE: C<old_issues>
11
12
=head1 NAME
13
14
Koha::Schema::Result::OldIssue
19
15
20
=cut
16
=cut
21
17
Lines 23-28 __PACKAGE__->table("old_issues"); Link Here
23
19
24
=head1 ACCESSORS
20
=head1 ACCESSORS
25
21
22
=head2 issue_id
23
24
  data_type: 'integer'
25
  is_auto_increment: 1
26
  is_nullable: 0
27
26
=head2 borrowernumber
28
=head2 borrowernumber
27
29
28
  data_type: 'integer'
30
  data_type: 'integer'
Lines 38-44 __PACKAGE__->table("old_issues"); Link Here
38
=head2 date_due
40
=head2 date_due
39
41
40
  data_type: 'datetime'
42
  data_type: 'datetime'
41
  datetime_undef_if_invalid: 1
42
  is_nullable: 1
43
  is_nullable: 1
43
44
44
=head2 branchcode
45
=head2 branchcode
Lines 56-68 __PACKAGE__->table("old_issues"); Link Here
56
=head2 returndate
57
=head2 returndate
57
58
58
  data_type: 'datetime'
59
  data_type: 'datetime'
59
  datetime_undef_if_invalid: 1
60
  is_nullable: 1
60
  is_nullable: 1
61
61
62
=head2 lastreneweddate
62
=head2 lastreneweddate
63
63
64
  data_type: 'datetime'
64
  data_type: 'datetime'
65
  datetime_undef_if_invalid: 1
66
  is_nullable: 1
65
  is_nullable: 1
67
66
68
=head2 return
67
=head2 return
Lines 79-141 __PACKAGE__->table("old_issues"); Link Here
79
=head2 timestamp
78
=head2 timestamp
80
79
81
  data_type: 'timestamp'
80
  data_type: 'timestamp'
82
  datetime_undef_if_invalid: 1
83
  default_value: current_timestamp
81
  default_value: current_timestamp
84
  is_nullable: 0
82
  is_nullable: 0
85
83
86
=head2 issuedate
84
=head2 issuedate
87
85
88
  data_type: 'datetime'
86
  data_type: 'datetime'
89
  datetime_undef_if_invalid: 1
90
  is_nullable: 1
87
  is_nullable: 1
91
88
92
=cut
89
=cut
93
90
94
__PACKAGE__->add_columns(
91
__PACKAGE__->add_columns(
92
  "issue_id",
93
  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
95
  "borrowernumber",
94
  "borrowernumber",
96
  { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
95
  { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
97
  "itemnumber",
96
  "itemnumber",
98
  { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
97
  { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
99
  "date_due",
98
  "date_due",
100
  {
99
  { data_type => "datetime", is_nullable => 1 },
101
    data_type => "datetime",
102
    datetime_undef_if_invalid => 1,
103
    is_nullable => 1,
104
  },
105
  "branchcode",
100
  "branchcode",
106
  { data_type => "varchar", is_nullable => 1, size => 10 },
101
  { data_type => "varchar", is_nullable => 1, size => 10 },
107
  "issuingbranch",
102
  "issuingbranch",
108
  { data_type => "varchar", is_nullable => 1, size => 18 },
103
  { data_type => "varchar", is_nullable => 1, size => 18 },
109
  "returndate",
104
  "returndate",
110
  {
105
  { data_type => "datetime", is_nullable => 1 },
111
    data_type => "datetime",
112
    datetime_undef_if_invalid => 1,
113
    is_nullable => 1,
114
  },
115
  "lastreneweddate",
106
  "lastreneweddate",
116
  {
107
  { data_type => "datetime", is_nullable => 1 },
117
    data_type => "datetime",
118
    datetime_undef_if_invalid => 1,
119
    is_nullable => 1,
120
  },
121
  "return",
108
  "return",
122
  { data_type => "varchar", is_nullable => 1, size => 4 },
109
  { data_type => "varchar", is_nullable => 1, size => 4 },
123
  "renewals",
110
  "renewals",
124
  { data_type => "tinyint", is_nullable => 1 },
111
  { data_type => "tinyint", is_nullable => 1 },
125
  "timestamp",
112
  "timestamp",
126
  {
113
  {
127
    data_type => "timestamp",
114
    data_type     => "timestamp",
128
    datetime_undef_if_invalid => 1,
129
    default_value => \"current_timestamp",
115
    default_value => \"current_timestamp",
130
    is_nullable => 0,
116
    is_nullable   => 0,
131
  },
117
  },
132
  "issuedate",
118
  "issuedate",
133
  {
119
  { data_type => "datetime", is_nullable => 1 },
134
    data_type => "datetime",
135
    datetime_undef_if_invalid => 1,
136
    is_nullable => 1,
137
  },
138
);
120
);
121
__PACKAGE__->set_primary_key("issue_id");
139
122
140
=head1 RELATIONS
123
=head1 RELATIONS
141
124
Lines 151-162 __PACKAGE__->belongs_to( Link Here
151
  "borrowernumber",
134
  "borrowernumber",
152
  "Koha::Schema::Result::Borrower",
135
  "Koha::Schema::Result::Borrower",
153
  { borrowernumber => "borrowernumber" },
136
  { borrowernumber => "borrowernumber" },
154
  {
137
  { join_type => "LEFT", on_delete => "CASCADE", on_update => "CASCADE" },
155
    is_deferrable => 1,
156
    join_type     => "LEFT",
157
    on_delete     => "CASCADE",
158
    on_update     => "CASCADE",
159
  },
160
);
138
);
161
139
162
=head2 itemnumber
140
=head2 itemnumber
Lines 171-187 __PACKAGE__->belongs_to( Link Here
171
  "itemnumber",
149
  "itemnumber",
172
  "Koha::Schema::Result::Item",
150
  "Koha::Schema::Result::Item",
173
  { itemnumber => "itemnumber" },
151
  { itemnumber => "itemnumber" },
174
  {
152
  { join_type => "LEFT", on_delete => "CASCADE", on_update => "CASCADE" },
175
    is_deferrable => 1,
176
    join_type     => "LEFT",
177
    on_delete     => "CASCADE",
178
    on_update     => "CASCADE",
179
  },
180
);
153
);
181
154
182
155
183
# Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-10-14 20:56:21
156
# Created by DBIx::Class::Schema::Loader v0.07000 @ 2013-11-07 08:15:21
184
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:uPOxNROoMMRZ0qZsXsxEjA
157
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:np3nmo0XYIYp92QbCY6/cw
185
158
186
159
187
# You can replace this text with custom content, and it will be preserved on regeneration
160
# You can replace this text with custom content, and it will be preserved on regeneration
(-)a/installer/data/mysql/kohastructure.sql (+5 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_relative_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 1107-1112 CREATE TABLE `import_items` ( Link Here
1107
1108
1108
DROP TABLE IF EXISTS `issues`;
1109
DROP TABLE IF EXISTS `issues`;
1109
CREATE TABLE `issues` ( -- information related to check outs or issues
1110
CREATE TABLE `issues` ( -- information related to check outs or issues
1111
  `issue_id` int(11) NOT NULL AUTO_INCREMENT, -- primary key for issues table
1110
  `borrowernumber` int(11), -- foreign key, linking this to the borrowers table for the patron this item was checked out to
1112
  `borrowernumber` int(11), -- foreign key, linking this to the borrowers table for the patron this item was checked out to
1111
  `itemnumber` int(11), -- foreign key, linking this to the items table for the item that was checked out
1113
  `itemnumber` int(11), -- foreign key, linking this to the items table for the item that was checked out
1112
  `date_due` datetime default NULL, -- datetime the item is due (yyyy-mm-dd hh:mm::ss)
1114
  `date_due` datetime default NULL, -- datetime the item is due (yyyy-mm-dd hh:mm::ss)
Lines 1118-1123 CREATE TABLE `issues` ( -- information related to check outs or issues Link Here
1118
  `renewals` tinyint(4) default NULL, -- lists the number of times the item was renewed
1120
  `renewals` tinyint(4) default NULL, -- lists the number of times the item was renewed
1119
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
1121
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
1120
  `issuedate` datetime default NULL, -- date the item was checked out or issued
1122
  `issuedate` datetime default NULL, -- date the item was checked out or issued
1123
  PRIMARY KEY (`issue_id`),
1121
  KEY `issuesborridx` (`borrowernumber`),
1124
  KEY `issuesborridx` (`borrowernumber`),
1122
  KEY `itemnumber_idx` (`itemnumber`),
1125
  KEY `itemnumber_idx` (`itemnumber`),
1123
  KEY `branchcode_idx` (`branchcode`),
1126
  KEY `branchcode_idx` (`branchcode`),
Lines 1570-1575 CREATE TABLE `oai_sets_biblios` ( Link Here
1570
1573
1571
DROP TABLE IF EXISTS `old_issues`;
1574
DROP TABLE IF EXISTS `old_issues`;
1572
CREATE TABLE `old_issues` ( -- lists items that were checked out and have been returned
1575
CREATE TABLE `old_issues` ( -- lists items that were checked out and have been returned
1576
  `issue_id` int(11) NOT NULL AUTO_INCREMENT, -- primary key for issues table
1573
  `borrowernumber` int(11) default NULL, -- foreign key, linking this to the borrowers table for the patron this item was checked out to
1577
  `borrowernumber` int(11) default NULL, -- foreign key, linking this to the borrowers table for the patron this item was checked out to
1574
  `itemnumber` int(11) default NULL, -- foreign key, linking this to the items table for the item that was checked out
1578
  `itemnumber` int(11) default NULL, -- foreign key, linking this to the items table for the item that was checked out
1575
  `date_due` datetime default NULL, -- date the item is due (yyyy-mm-dd)
1579
  `date_due` datetime default NULL, -- date the item is due (yyyy-mm-dd)
Lines 1581-1586 CREATE TABLE `old_issues` ( -- lists items that were checked out and have been r Link Here
1581
  `renewals` tinyint(4) default NULL, -- lists the number of times the item was renewed
1585
  `renewals` tinyint(4) default NULL, -- lists the number of times the item was renewed
1582
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
1586
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
1583
  `issuedate` datetime default NULL, -- date the item was checked out or issued
1587
  `issuedate` datetime default NULL, -- date the item was checked out or issued
1588
  PRIMARY KEY (`issue_id`),
1584
  KEY `old_issuesborridx` (`borrowernumber`),
1589
  KEY `old_issuesborridx` (`borrowernumber`),
1585
  KEY `old_issuesitemidx` (`itemnumber`),
1590
  KEY `old_issuesitemidx` (`itemnumber`),
1586
  KEY `branchcode_idx` (`branchcode`),
1591
  KEY `branchcode_idx` (`branchcode`),
(-)a/installer/data/mysql/updatedatabase.pl (+18 lines)
Lines 7743-7748 if(CheckVersion($DBversion)) { Link Here
7743
    SetVersion($DBversion);
7743
    SetVersion($DBversion);
7744
}
7744
}
7745
7745
7746
$DBversion = "3.15.00.XXX";
7747
if(CheckVersion($DBversion)) {
7748
    $dbh->do(q{
7749
        ALTER TABLE borrowers ADD privacy_relative_checkouts BOOLEAN NOT NULL DEFAULT '0'
7750
    });
7751
    $dbh->do(q{
7752
        ALTER TABLE old_issues ADD issue_id INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST
7753
    });
7754
    $dbh->do(q{
7755
        ALTER TABLE issues ADD issue_id INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST;
7756
    });
7757
    $dbh->do(qq{
7758
        UPDATE issues SET issue_id = issue_id + ( SELECT COUNT(*) FROM old_issues ) ORDER BY issue_id DESC
7759
    });
7760
    print "Upgrade to $DBversion done (Bug 9303 - relative's checkouts in the opac)\n";
7761
    SetVersion($DBversion);
7762
}
7763
7746
=head1 FUNCTIONS
7764
=head1 FUNCTIONS
7747
7765
7748
=head2 TableExists($table)
7766
=head2 TableExists($table)
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-privacy.tt (-2 / +19 lines)
Lines 35-41 Link Here
35
    </div>
35
    </div>
36
    <form action="/cgi-bin/koha/opac-privacy.pl" method="post" id="opac-privacy-update-form">
36
    <form action="/cgi-bin/koha/opac-privacy.pl" method="post" id="opac-privacy-update-form">
37
            <input type="hidden" name="op" value="update_privacy" />
37
            <input type="hidden" name="op" value="update_privacy" />
38
            <label for:"privacy">Please choose your privacy rule:</label>
38
39
            <label for="privacy">Please choose your privacy rule:</label>
39
            <select name="privacy">
40
            <select name="privacy">
40
                [% IF ( privacy0 ) %]
41
                [% IF ( privacy0 ) %]
41
                    <option value="0" selected="1" class="privacy0">Forever</option>
42
                    <option value="0" selected="1" class="privacy0">Forever</option>
Lines 53-59 Link Here
53
                    <option value="2" class="privacy2">Never</option>
54
                    <option value="2" class="privacy2">Never</option>
54
                [% END %]
55
                [% END %]
55
            </select>
56
            </select>
56
            <input type="Submit" value="Submit" />
57
58
            <p/>
59
60
            <label for="privacy_relative_checkouts">Allow relatives to view your current checkouts?</label>
61
            <select name="privacy_relative_checkouts">
62
                [% IF borrower.privacy_relative_checkouts %]
63
                    <option value="0">No</option>
64
                    <option value="1" selected>Yes</option>
65
                [% ELSE %]
66
                    <option value="0" selected>No</option>
67
                    <option value="1">Yes</option>
68
                [% END %]
69
            </select>
70
71
            <p/>
72
73
            <input type="Submit" value="Save" />
57
        </form>
74
        </form>
58
        <h2>Immediate deletion</h2>
75
        <h2>Immediate deletion</h2>
59
        <form action="/cgi-bin/koha/opac-privacy.pl" method="post" id="opac-privacy-delete-form">
76
        <form action="/cgi-bin/koha/opac-privacy.pl" method="post" id="opac-privacy-delete-form">
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt (-1 / +49 lines)
Lines 1-5 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE KohaDates %]
2
[% USE KohaDates %]
3
[% USE EncodeUTF8 %]
3
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
4
[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Your library home
5
[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Your library home
5
[% INCLUDE 'doc-head-close.inc' %]
6
[% INCLUDE 'doc-head-close.inc' %]
Lines 14-20 var MSG_CONFIRM_RESUME_HOLDS = _("Are you sure you want to resume all suspended Link Here
14
            $(function() {
15
            $(function() {
15
            $('#opac-user-views').tabs();
16
            $('#opac-user-views').tabs();
16
17
17
        var dTables = $("#checkoutst,#holdst,#overduest");
18
        var dTables = $("#checkoutst,#holdst,#overduest,#opac-user-relative-issues-table");
18
        dTables.each(function(){
19
        dTables.each(function(){
19
            var thIndex = $(this).find("th.psort").index();
20
            var thIndex = $(this).find("th.psort").index();
20
            $(this).dataTable($.extend(true, {}, dataTablesDefaults, {
21
            $(this).dataTable($.extend(true, {}, dataTablesDefaults, {
Lines 117-122 var MSG_CONFIRM_RESUME_HOLDS = _("Are you sure you want to resume all suspended Link Here
117
<div id="opac-user-views" class="toptabs">
118
<div id="opac-user-views" class="toptabs">
118
        <ul>
119
        <ul>
119
            <li><a href="#opac-user-checkouts">Checked out</a></li>
120
            <li><a href="#opac-user-checkouts">Checked out</a></li>
121
            [% IF relatives %]<li><a href="#opac-user-relative-issues">Relatives' checkouts</a></li>[% END %]
120
            [% IF ( overdues_count ) %]<li><a href="#opac-user-overdues">Overdue</a></li>[% END %]
122
            [% IF ( overdues_count ) %]<li><a href="#opac-user-overdues">Overdue</a></li>[% END %]
121
[% IF ( OPACFinesTab ) %]
123
[% IF ( OPACFinesTab ) %]
122
            [% IF ( BORROWER_INF.amountoverfive ) %]<li><a href="#opac-user-fines">Fines</a></li>[% END %]
124
            [% IF ( BORROWER_INF.amountoverfive ) %]<li><a href="#opac-user-fines">Fines</a></li>[% END %]
Lines 285-290 var MSG_CONFIRM_RESUME_HOLDS = _("Are you sure you want to resume all suspended Link Here
285
        [% END %]
287
        [% END %]
286
    [% END %]
288
    [% END %]
287
289
290
    [% IF relatives %]
291
        <div id="opac-user-relative-issues">
292
            <table id="opac-user-relative-issues-table">
293
                <thead>
294
                    <tr>
295
                        <th class="anti-the">Title</th>
296
                        <th>Due</th>
297
                        <th>Barcode</th>
298
                        <th>Call No.</th>
299
                        <th class="psort">Relative</th>
300
                    </tr>
301
                </thead>
302
303
                <tbody>
304
                    [% FOREACH r IN relatives %]
305
                        [% FOREACH i IN r.issues %]
306
                            <tr>
307
                                <td>
308
                                    <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% i.item.biblio.biblionumber %]">
309
                                        [% i.item.biblio.title | $EncodeUTF8 %]
310
                                    </a>
311
                                </td>
312
313
                                <td>
314
                                    [% i.date_due | $KohaDates %]
315
                                </td>
316
317
                                <td>
318
                                    [% i.item.barcode %]
319
                                </td>
320
321
                                <td>
322
                                    [% i.item.itemcallnumber | $EncodeUTF8 %]
323
                                </td>
324
325
                                <td>
326
                                    [% r.firstname | $EncodeUTF8 %] [% r.surname | $EncodeUTF8 %]
327
                                </td>
328
                            </tr>
329
                        [% END %]
330
                    [% END %]
331
                </tbody>
332
            </table>
333
        </div>
334
    [% END %]
335
288
[% IF ( overdues_count ) %]
336
[% IF ( overdues_count ) %]
289
<div id="opac-user-overdues"><table id="overduest">
337
<div id="opac-user-overdues"><table id="overduest">
290
<caption>Overdues <span class="count">([% overdues_count %] total)</span></caption>
338
<caption>Overdues <span class="count">([% overdues_count %] total)</span></caption>
(-)a/opac/opac-privacy.pl (-14 / +24 lines)
Lines 40-57 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
40
    }
40
    }
41
);
41
);
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
46
46
if ($op eq "update_privacy")
47
if ( $op eq "update_privacy" ) {
47
{
48
    ModMember(
48
    ModPrivacy($borrowernumber,$privacy);
49
        borrowernumber             => $borrowernumber,
49
    $template->param('privacy_updated' => 1);
50
        privacy                    => $privacy,
51
        privacy_relative_checkouts => $privacy_relative_checkouts,
52
    );
53
    $template->param( 'privacy_updated' => 1 );
50
}
54
}
51
if ($op eq "delete_record") {
55
elsif ( $op eq "delete_record" ) {
56
52
    # delete all reading records for items returned
57
    # delete all reading records for items returned
53
    # uses a hardcoded date ridiculously far in the future
58
    # uses a hardcoded date ridiculously far in the future
54
    my ($rows,$err_history_not_deleted) = AnonymiseIssueHistory('2999-12-12',$borrowernumber);
59
    my ( $rows, $err_history_not_deleted ) =
60
      AnonymiseIssueHistory( '2999-12-12', $borrowernumber );
61
55
    # confirm the user the deletion has been done
62
    # confirm the user the deletion has been done
56
    if ( !$err_history_not_deleted ) {
63
    if ( !$err_history_not_deleted ) {
57
        $template->param( 'deleted' => 1 );
64
        $template->param( 'deleted' => 1 );
Lines 60-73 if ($op eq "delete_record") { Link Here
60
        $template->param( 'err_history_not_deleted' => 1 );
67
        $template->param( 'err_history_not_deleted' => 1 );
61
    }
68
    }
62
}
69
}
70
63
# get borrower privacy ....
71
# get borrower privacy ....
64
my ( $borr ) = GetMemberDetails( $borrowernumber );
72
my $borrower = GetMemberDetails( $borrowernumber );
65
73
66
$template->param( 'Ask_data'       => '1',
74
$template->param(
67
                    'privacy'.$borr->{'privacy'} => 1,
75
    'Ask_data'                         => 1,
68
                    'firstname' => $borr->{'firstname'},
76
    'privacy' . $borrower->{'privacy'} => 1,
69
                    'surname' => $borr->{'surname'},
77
    'privacyview'                      => 1,
70
                    'privacyview' => 1,
78
    'borrower'                         => $borrower,
79
    'surname'                          => $borrower->{surname},
80
    'firstname'                        => $borrower->{firstname},
71
);
81
);
72
82
73
output_html_with_http_headers $query, $cookie, $template->output;
83
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/opac/opac-user.pl (-10 / +18 lines)
Lines 35-40 use C4::Items; Link Here
35
use C4::Letters;
35
use C4::Letters;
36
use C4::Branch; # GetBranches
36
use C4::Branch; # GetBranches
37
use Koha::DateUtils;
37
use Koha::DateUtils;
38
use Koha::Database;
38
39
39
use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE';
40
use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE';
40
41
Lines 352-369 if ( $borr->{'opacnote'} ) { Link Here
352
  );
353
  );
353
}
354
}
354
355
356
my @borrowernumbers = GetMemberRelatives($borrowernumber);
357
if ( @borrowernumbers ) {
358
    my @relatives = Koha::Database->new()->schema()->resultset("Borrower")->search(
359
        { privacy_relative_checkouts => 1,  'me.borrowernumber' => { -in => \@borrowernumbers, } },
360
        { prefetch => [ { 'issues' => { 'item' => 'biblio' } } ] }
361
    );
362
    $template->param( relatives => \@relatives );
363
}
364
355
$template->param(
365
$template->param(
356
    bor_messages_loop    => GetMessages( $borrowernumber, 'B', 'NONE' ),
366
    borrower           => $borr,
367
    bor_messages_loop  => GetMessages( $borrowernumber, 'B', 'NONE' ),
357
    waiting_count      => $wcount,
368
    waiting_count      => $wcount,
358
    patronupdate => $patronupdate,
369
    patronupdate       => $patronupdate,
359
    OpacRenewalAllowed => C4::Context->preference("OpacRenewalAllowed"),
370
    OpacRenewalAllowed => C4::Context->preference("OpacRenewalAllowed"),
360
    userview => 1,
371
    userview           => 1,
361
);
372
    SuspendHoldsOpac   => C4::Context->preference('SuspendHoldsOpac'),
362
373
    OpacHoldNotes      => C4::Context->preference('OpacHoldNotes'),
363
$template->param(
374
    AutoResumeSuspendedHolds =>
364
    SuspendHoldsOpac => C4::Context->preference('SuspendHoldsOpac'),
375
      C4::Context->preference('AutoResumeSuspendedHolds'),
365
    AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'),
366
    OpacHoldNotes => C4::Context->preference('OpacHoldNotes'),
367
);
376
);
368
377
369
output_html_with_http_headers $query, $cookie, $template->output;
378
output_html_with_http_headers $query, $cookie, $template->output;
370
- 

Return to bug 9303