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

(-)a/Koha/Schema/Result/Biblio.pm (-3 / +17 lines)
Lines 270-275 __PACKAGE__->has_many( Link Here
270
  { cascade_copy => 0, cascade_delete => 0 },
270
  { cascade_copy => 0, cascade_delete => 0 },
271
);
271
);
272
272
273
=head2 holdings
274
275
Type: has_many
276
277
Related object: L<Koha::Schema::Result::Holding>
278
279
=cut
280
281
__PACKAGE__->has_many(
282
  "holdings",
283
  "Koha::Schema::Result::Holding",
284
  { "foreign.biblionumber" => "self.biblionumber" },
285
  { cascade_copy => 0, cascade_delete => 0 },
286
);
287
273
=head2 items
288
=head2 items
274
289
275
Type: has_many
290
Type: has_many
Lines 451-459 __PACKAGE__->has_many( Link Here
451
);
466
);
452
467
453
468
454
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-04-17 09:15:51
469
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-05-15 12:52:12
455
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:p2SIq565zPyE3ZUkSuXyBA
470
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:pMd7Zf97YHGqAAKpz/MmFg
456
457
471
458
__PACKAGE__->has_one(
472
__PACKAGE__->has_one(
459
  "metadata",
473
  "metadata",
(-)a/Koha/Schema/Result/Branch.pm (-2 / +17 lines)
Lines 578-583 __PACKAGE__->has_many( Link Here
578
  { cascade_copy => 0, cascade_delete => 0 },
578
  { cascade_copy => 0, cascade_delete => 0 },
579
);
579
);
580
580
581
=head2 holdings
582
583
Type: has_many
584
585
Related object: L<Koha::Schema::Result::Holding>
586
587
=cut
588
589
__PACKAGE__->has_many(
590
  "holdings",
591
  "Koha::Schema::Result::Holding",
592
  { "foreign.holdingbranch" => "self.branchcode" },
593
  { cascade_copy => 0, cascade_delete => 0 },
594
);
595
581
=head2 illrequests
596
=head2 illrequests
582
597
583
Type: has_many
598
Type: has_many
Lines 819-826 __PACKAGE__->has_many( Link Here
819
);
834
);
820
835
821
836
822
# Created by DBIx::Class::Schema::Loader v0.07048 @ 2020-06-12 14:01:29
837
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-08-13 15:59:04
823
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:hU6Ldf0uN2iV1h7llLH+4g
838
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fVZBpz5PmLW8msfjYU9e0Q
824
839
825
__PACKAGE__->add_columns(
840
__PACKAGE__->add_columns(
826
    '+pickup_location' => { is_boolean => 1 }
841
    '+pickup_location' => { is_boolean => 1 }
(-)a/Koha/Schema/Result/Deleteditem.pm (-2 / +9 lines)
Lines 287-292 __PACKAGE__->table("deleteditems"); Link Here
287
  data_type: 'tinyint'
287
  data_type: 'tinyint'
288
  is_nullable: 1
288
  is_nullable: 1
289
289
290
=head2 holding_id
291
292
  data_type: 'integer'
293
  is_nullable: 1
294
290
=cut
295
=cut
291
296
292
__PACKAGE__->add_columns(
297
__PACKAGE__->add_columns(
Lines 399-404 __PACKAGE__->add_columns( Link Here
399
  { data_type => "varchar", is_nullable => 1, size => 32 },
404
  { data_type => "varchar", is_nullable => 1, size => 32 },
400
  "exclude_from_local_holds_priority",
405
  "exclude_from_local_holds_priority",
401
  { data_type => "tinyint", is_nullable => 1 },
406
  { data_type => "tinyint", is_nullable => 1 },
407
  "holding_id",
408
  { data_type => "integer", is_nullable => 1 },
402
);
409
);
403
410
404
=head1 PRIMARY KEY
411
=head1 PRIMARY KEY
Lines 414-421 __PACKAGE__->add_columns( Link Here
414
__PACKAGE__->set_primary_key("itemnumber");
421
__PACKAGE__->set_primary_key("itemnumber");
415
422
416
423
417
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-06-05 20:21:47
424
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-09-07 10:42:02
418
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:4xydPpkFXE+oOR46jY5L8Q
425
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:bRSjhOZo+WQgkTi4xD18AA
419
426
420
__PACKAGE__->add_columns(
427
__PACKAGE__->add_columns(
421
    '+exclude_from_local_holds_priority' => { is_boolean => 1 },
428
    '+exclude_from_local_holds_priority' => { is_boolean => 1 },
(-)a/Koha/Schema/Result/Holding.pm (+234 lines)
Line 0 Link Here
1
use utf8;
2
package Koha::Schema::Result::Holding;
3
4
# Created by DBIx::Class::Schema::Loader
5
# DO NOT MODIFY THE FIRST PART OF THIS FILE
6
7
=head1 NAME
8
9
Koha::Schema::Result::Holding
10
11
=cut
12
13
use strict;
14
use warnings;
15
16
use base 'DBIx::Class::Core';
17
18
=head1 TABLE: C<holdings>
19
20
=cut
21
22
__PACKAGE__->table("holdings");
23
24
=head1 ACCESSORS
25
26
=head2 holding_id
27
28
  data_type: 'integer'
29
  is_auto_increment: 1
30
  is_nullable: 0
31
32
=head2 biblionumber
33
34
  data_type: 'integer'
35
  default_value: 0
36
  is_foreign_key: 1
37
  is_nullable: 0
38
39
=head2 frameworkcode
40
41
  data_type: 'varchar'
42
  default_value: (empty string)
43
  is_nullable: 0
44
  size: 4
45
46
=head2 holdingbranch
47
48
  data_type: 'varchar'
49
  is_foreign_key: 1
50
  is_nullable: 1
51
  size: 10
52
53
=head2 location
54
55
  data_type: 'varchar'
56
  is_nullable: 1
57
  size: 80
58
59
=head2 ccode
60
61
  data_type: 'varchar'
62
  is_nullable: 1
63
  size: 80
64
65
=head2 callnumber
66
67
  data_type: 'varchar'
68
  is_nullable: 1
69
  size: 255
70
71
=head2 suppress
72
73
  data_type: 'tinyint'
74
  is_nullable: 1
75
76
=head2 timestamp
77
78
  data_type: 'timestamp'
79
  datetime_undef_if_invalid: 1
80
  default_value: current_timestamp
81
  is_nullable: 0
82
83
=head2 datecreated
84
85
  data_type: 'date'
86
  datetime_undef_if_invalid: 1
87
  is_nullable: 0
88
89
=head2 deleted_on
90
91
  data_type: 'datetime'
92
  datetime_undef_if_invalid: 1
93
  is_nullable: 1
94
95
=cut
96
97
__PACKAGE__->add_columns(
98
  "holding_id",
99
  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
100
  "biblionumber",
101
  {
102
    data_type      => "integer",
103
    default_value  => 0,
104
    is_foreign_key => 1,
105
    is_nullable    => 0,
106
  },
107
  "frameworkcode",
108
  { data_type => "varchar", default_value => "", is_nullable => 0, size => 4 },
109
  "holdingbranch",
110
  { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
111
  "location",
112
  { data_type => "varchar", is_nullable => 1, size => 80 },
113
  "ccode",
114
  { data_type => "varchar", is_nullable => 1, size => 80 },
115
  "callnumber",
116
  { data_type => "varchar", is_nullable => 1, size => 255 },
117
  "suppress",
118
  { data_type => "tinyint", is_nullable => 1 },
119
  "timestamp",
120
  {
121
    data_type => "timestamp",
122
    datetime_undef_if_invalid => 1,
123
    default_value => \"current_timestamp",
124
    is_nullable => 0,
125
  },
126
  "datecreated",
127
  { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 0 },
128
  "deleted_on",
129
  {
130
    data_type => "datetime",
131
    datetime_undef_if_invalid => 1,
132
    is_nullable => 1,
133
  },
134
);
135
136
=head1 PRIMARY KEY
137
138
=over 4
139
140
=item * L</holding_id>
141
142
=back
143
144
=cut
145
146
__PACKAGE__->set_primary_key("holding_id");
147
148
=head1 RELATIONS
149
150
=head2 biblionumber
151
152
Type: belongs_to
153
154
Related object: L<Koha::Schema::Result::Biblio>
155
156
=cut
157
158
__PACKAGE__->belongs_to(
159
  "biblionumber",
160
  "Koha::Schema::Result::Biblio",
161
  { biblionumber => "biblionumber" },
162
  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
163
);
164
165
=head2 holdingbranch
166
167
Type: belongs_to
168
169
Related object: L<Koha::Schema::Result::Branch>
170
171
=cut
172
173
__PACKAGE__->belongs_to(
174
  "holdingbranch",
175
  "Koha::Schema::Result::Branch",
176
  { branchcode => "holdingbranch" },
177
  {
178
    is_deferrable => 1,
179
    join_type     => "LEFT",
180
    on_delete     => "RESTRICT",
181
    on_update     => "CASCADE",
182
  },
183
);
184
185
=head2 holdings_metadatas
186
187
Type: has_many
188
189
Related object: L<Koha::Schema::Result::HoldingsMetadata>
190
191
=cut
192
193
__PACKAGE__->has_many(
194
  "holdings_metadatas",
195
  "Koha::Schema::Result::HoldingsMetadata",
196
  { "foreign.holding_id" => "self.holding_id" },
197
  { cascade_copy => 0, cascade_delete => 0 },
198
);
199
200
=head2 items
201
202
Type: has_many
203
204
Related object: L<Koha::Schema::Result::Item>
205
206
=cut
207
208
__PACKAGE__->has_many(
209
  "items",
210
  "Koha::Schema::Result::Item",
211
  { "foreign.holding_id" => "self.holding_id" },
212
  { cascade_copy => 0, cascade_delete => 0 },
213
);
214
215
216
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-05-15 12:37:06
217
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:r5dS7lMIAG11s3PYFp/NKQ
218
219
=head2 metadata
220
221
This relationship makes it possible to use metadata as a prefetch table:
222
223
my $holdings = Koha::Holdings->search({}, {prefetch => 'metadata'});
224
my $metadata = $holdings->next()->metadata();
225
226
=cut
227
228
__PACKAGE__->has_one(
229
  "metadata",
230
  "Koha::Schema::Result::HoldingsMetadata",
231
  { "foreign.holding_id" => "self.holding_id" },
232
  { cascade_copy => 0, cascade_delete => 0 },
233
);
234
1;
(-)a/Koha/Schema/Result/HoldingsMetadata.pm (+138 lines)
Line 0 Link Here
1
use utf8;
2
package Koha::Schema::Result::HoldingsMetadata;
3
4
# Created by DBIx::Class::Schema::Loader
5
# DO NOT MODIFY THE FIRST PART OF THIS FILE
6
7
=head1 NAME
8
9
Koha::Schema::Result::HoldingsMetadata
10
11
=cut
12
13
use strict;
14
use warnings;
15
16
use base 'DBIx::Class::Core';
17
18
=head1 TABLE: C<holdings_metadata>
19
20
=cut
21
22
__PACKAGE__->table("holdings_metadata");
23
24
=head1 ACCESSORS
25
26
=head2 id
27
28
  data_type: 'integer'
29
  is_auto_increment: 1
30
  is_nullable: 0
31
32
=head2 holding_id
33
34
  data_type: 'integer'
35
  is_foreign_key: 1
36
  is_nullable: 0
37
38
=head2 format
39
40
  data_type: 'varchar'
41
  is_nullable: 0
42
  size: 16
43
44
=head2 schema
45
46
  data_type: 'varchar'
47
  is_nullable: 0
48
  size: 16
49
50
=head2 metadata
51
52
  data_type: 'longtext'
53
  is_nullable: 0
54
55
=head2 deleted_on
56
57
  data_type: 'datetime'
58
  datetime_undef_if_invalid: 1
59
  is_nullable: 1
60
61
=cut
62
63
__PACKAGE__->add_columns(
64
  "id",
65
  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
66
  "holding_id",
67
  { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
68
  "format",
69
  { data_type => "varchar", is_nullable => 0, size => 16 },
70
  "schema",
71
  { data_type => "varchar", is_nullable => 0, size => 16 },
72
  "metadata",
73
  { data_type => "longtext", is_nullable => 0 },
74
  "deleted_on",
75
  {
76
    data_type => "datetime",
77
    datetime_undef_if_invalid => 1,
78
    is_nullable => 1,
79
  },
80
);
81
82
=head1 PRIMARY KEY
83
84
=over 4
85
86
=item * L</id>
87
88
=back
89
90
=cut
91
92
__PACKAGE__->set_primary_key("id");
93
94
=head1 UNIQUE CONSTRAINTS
95
96
=head2 C<holdings_metadata_uniq_key>
97
98
=over 4
99
100
=item * L</holding_id>
101
102
=item * L</format>
103
104
=item * L</schema>
105
106
=back
107
108
=cut
109
110
__PACKAGE__->add_unique_constraint(
111
  "holdings_metadata_uniq_key",
112
  ["holding_id", "format", "schema"],
113
);
114
115
=head1 RELATIONS
116
117
=head2 holding
118
119
Type: belongs_to
120
121
Related object: L<Koha::Schema::Result::Holding>
122
123
=cut
124
125
__PACKAGE__->belongs_to(
126
  "holding",
127
  "Koha::Schema::Result::Holding",
128
  { holding_id => "holding_id" },
129
  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
130
);
131
132
133
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2019-02-20 16:55:21
134
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:42bY17ncjs1OZKH23z4SgQ
135
136
137
# You can replace this text with custom code or comments, and it will be preserved on regeneration
138
1;
(-)a/Koha/Schema/Result/Item.pm (-16 / +30 lines)
Lines 291-296 __PACKAGE__->table("items"); Link Here
291
  data_type: 'tinyint'
291
  data_type: 'tinyint'
292
  is_nullable: 1
292
  is_nullable: 1
293
293
294
=head2 holding_id
295
296
  data_type: 'integer'
297
  is_foreign_key: 1
298
  is_nullable: 1
299
294
=cut
300
=cut
295
301
296
__PACKAGE__->add_columns(
302
__PACKAGE__->add_columns(
Lines 413-418 __PACKAGE__->add_columns( Link Here
413
  { data_type => "varchar", is_nullable => 1, size => 32 },
419
  { data_type => "varchar", is_nullable => 1, size => 32 },
414
  "exclude_from_local_holds_priority",
420
  "exclude_from_local_holds_priority",
415
  { data_type => "tinyint", is_nullable => 1 },
421
  { data_type => "tinyint", is_nullable => 1 },
422
  "holding_id",
423
  { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
416
);
424
);
417
425
418
=head1 PRIMARY KEY
426
=head1 PRIMARY KEY
Lines 578-583 __PACKAGE__->might_have( Link Here
578
  { cascade_copy => 0, cascade_delete => 0 },
586
  { cascade_copy => 0, cascade_delete => 0 },
579
);
587
);
580
588
589
=head2 holding
590
591
Type: belongs_to
592
593
Related object: L<Koha::Schema::Result::Holding>
594
595
=cut
596
597
__PACKAGE__->belongs_to(
598
  "holding",
599
  "Koha::Schema::Result::Holding",
600
  { holding_id => "holding_id" },
601
  {
602
    is_deferrable => 1,
603
    join_type     => "LEFT",
604
    on_delete     => "CASCADE",
605
    on_update     => "CASCADE",
606
  },
607
);
608
581
=head2 holdingbranch
609
=head2 holdingbranch
582
610
583
Type: belongs_to
611
Type: belongs_to
Lines 754-761 __PACKAGE__->has_many( Link Here
754
);
782
);
755
783
756
784
757
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-06-05 20:21:47
785
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-09-07 10:42:02
758
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9AxhV/hJnavWY4OTDTNRcQ
786
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:hLPpKWQKNBYYE95/2eE52A
759
787
760
__PACKAGE__->belongs_to( biblioitem => "Koha::Schema::Result::Biblioitem", "biblioitemnumber" );
788
__PACKAGE__->belongs_to( biblioitem => "Koha::Schema::Result::Biblioitem", "biblioitemnumber" );
761
789
Lines 770-788 __PACKAGE__->add_columns( Link Here
770
    '+exclude_from_local_holds_priority' => { is_boolean => 1 },
798
    '+exclude_from_local_holds_priority' => { is_boolean => 1 },
771
);
799
);
772
800
773
# Relationship with orders via the aqorders_item table that not have foreign keys
774
__PACKAGE__->has_many(
775
  "aqorders_item",
776
  "Koha::Schema::Result::AqordersItem",
777
  { "foreign.itemnumber" => "self.itemnumber" },
778
  { cascade_copy => 0, cascade_delete => 0 },
779
);
780
__PACKAGE__->many_to_many(
781
  "item_orders",
782
  "aqorders_item",
783
  "ordernumber",
784
);
785
786
use C4::Context;
801
use C4::Context;
787
sub effective_itemtype {
802
sub effective_itemtype {
788
    my ( $self ) = @_;
803
    my ( $self ) = @_;
789
- 

Return to bug 20447