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

(-)a/Koha/Schema/Result/Hold.pm (+437 lines)
Line 0 Link Here
1
use utf8;
2
package Koha::Schema::Result::Hold;
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::Hold
10
11
=cut
12
13
use strict;
14
use warnings;
15
16
use base 'DBIx::Class::Core';
17
18
=head1 TABLE: C<holds>
19
20
=cut
21
22
__PACKAGE__->table("holds");
23
24
=head1 ACCESSORS
25
26
=head2 id
27
28
  data_type: 'integer'
29
  is_auto_increment: 1
30
  is_nullable: 0
31
32
internal hold identifier
33
34
=head2 patron_id
35
36
  data_type: 'integer'
37
  is_foreign_key: 1
38
  is_nullable: 1
39
40
foreign key from the borrowers table defining which patron this hold is for
41
42
=head2 pickup_library_id
43
44
  data_type: 'varchar'
45
  is_foreign_key: 1
46
  is_nullable: 1
47
  size: 10
48
49
foreign key from the branches table defining which branch the patron wishes to pick this hold up at
50
51
=head2 desk_id
52
53
  data_type: 'integer'
54
  is_foreign_key: 1
55
  is_nullable: 1
56
57
foreign key from the desks table defining which desk the patron should pick this hold up at
58
59
=head2 created_date
60
61
  data_type: 'date'
62
  datetime_undef_if_invalid: 1
63
  is_nullable: 1
64
65
the date the hold was placed
66
67
=head2 biblio_id
68
69
  data_type: 'integer'
70
  is_foreign_key: 1
71
  is_nullable: 1
72
73
foreign key from the biblio table defining which bib record this hold is on
74
75
=head2 item_id
76
77
  data_type: 'integer'
78
  is_foreign_key: 1
79
  is_nullable: 1
80
81
foreign key from the items table defining the specific item the patron has placed on hold or the item this hold was filled with
82
83
=head2 item_type
84
85
  data_type: 'varchar'
86
  is_foreign_key: 1
87
  is_nullable: 1
88
  size: 10
89
90
If record level hold, the optional itemtype of the item the patron is requesting
91
92
=head2 item_level
93
94
  data_type: 'tinyint'
95
  default_value: 0
96
  is_nullable: 0
97
98
Is the hold was placed at item level
99
100
=head2 completed_date
101
102
  data_type: 'date'
103
  datetime_undef_if_invalid: 1
104
  is_nullable: 1
105
106
the date this hold was completed (fulfilled or cancelled)
107
108
=head2 notes
109
110
  data_type: 'longtext'
111
  is_nullable: 1
112
113
notes related to this hold
114
115
=head2 priority
116
117
  data_type: 'smallint'
118
  default_value: 1
119
  is_nullable: 0
120
121
where in the queue the patron sits
122
123
=head2 status
124
125
  data_type: 'enum'
126
  default_value: 'placed'
127
  extra: {list => ["placed","fulfilled","processing","waiting","in_transit","cancelled"]}
128
  is_nullable: 0
129
130
the status the hold is ('placed', 'fulfilled', 'waiting', 'in_transit', 'cancelled')
131
132
=head2 timestamp
133
134
  data_type: 'timestamp'
135
  datetime_undef_if_invalid: 1
136
  default_value: current_timestamp
137
  is_nullable: 0
138
139
the date and time this hold was last updated
140
141
=head2 waiting_date
142
143
  data_type: 'date'
144
  datetime_undef_if_invalid: 1
145
  is_nullable: 1
146
147
the date the item was marked as waiting for the patron at the library
148
149
=head2 expiration_date
150
151
  data_type: 'date'
152
  datetime_undef_if_invalid: 1
153
  is_nullable: 1
154
155
the date the hold expires (usually the date entered by the patron to say they don't need the hold after a certain date)
156
157
=head2 lowest_priority
158
159
  data_type: 'tinyint'
160
  default_value: 0
161
  is_nullable: 0
162
163
if it was assigned the lowest priority
164
165
=head2 non_priority
166
167
  data_type: 'tinyint'
168
  default_value: 0
169
  is_nullable: 0
170
171
if it was assigned no priority
172
173
=head2 suspended
174
175
  data_type: 'tinyint'
176
  default_value: 0
177
  is_nullable: 0
178
179
If it is a non-priority hold
180
181
=head2 suspended_until_date
182
183
  data_type: 'datetime'
184
  datetime_undef_if_invalid: 1
185
  is_nullable: 1
186
187
Date until it is suspended
188
189
=head2 completed
190
191
  data_type: 'tinyint'
192
  default_value: 0
193
  is_nullable: 0
194
195
If it has been completed (i.e. either 'fulfilled' or 'cancelled')
196
197
=head2 cancellation_reason
198
199
  data_type: 'varchar'
200
  is_nullable: 1
201
  size: 80
202
203
optional authorised value CANCELLATION_REASON
204
205
=cut
206
207
__PACKAGE__->add_columns(
208
  "id",
209
  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
210
  "patron_id",
211
  { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
212
  "pickup_library_id",
213
  { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
214
  "desk_id",
215
  { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
216
  "created_date",
217
  { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
218
  "biblio_id",
219
  { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
220
  "item_id",
221
  { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
222
  "item_type",
223
  { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
224
  "item_level",
225
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
226
  "completed_date",
227
  { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
228
  "notes",
229
  { data_type => "longtext", is_nullable => 1 },
230
  "priority",
231
  { data_type => "smallint", default_value => 1, is_nullable => 0 },
232
  "status",
233
  {
234
    data_type => "enum",
235
    default_value => "placed",
236
    extra => {
237
      list => [
238
        "placed",
239
        "fulfilled",
240
        "processing",
241
        "waiting",
242
        "in_transit",
243
        "cancelled",
244
      ],
245
    },
246
    is_nullable => 0,
247
  },
248
  "timestamp",
249
  {
250
    data_type => "timestamp",
251
    datetime_undef_if_invalid => 1,
252
    default_value => \"current_timestamp",
253
    is_nullable => 0,
254
  },
255
  "waiting_date",
256
  { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
257
  "expiration_date",
258
  { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
259
  "lowest_priority",
260
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
261
  "non_priority",
262
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
263
  "suspended",
264
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
265
  "suspended_until_date",
266
  {
267
    data_type => "datetime",
268
    datetime_undef_if_invalid => 1,
269
    is_nullable => 1,
270
  },
271
  "completed",
272
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
273
  "cancellation_reason",
274
  { data_type => "varchar", is_nullable => 1, size => 80 },
275
);
276
277
=head1 PRIMARY KEY
278
279
=over 4
280
281
=item * L</id>
282
283
=back
284
285
=cut
286
287
__PACKAGE__->set_primary_key("id");
288
289
=head1 RELATIONS
290
291
=head2 biblio
292
293
Type: belongs_to
294
295
Related object: L<Koha::Schema::Result::Biblio>
296
297
=cut
298
299
__PACKAGE__->belongs_to(
300
  "biblio",
301
  "Koha::Schema::Result::Biblio",
302
  { biblionumber => "biblio_id" },
303
  {
304
    is_deferrable => 1,
305
    join_type     => "LEFT",
306
    on_delete     => "SET NULL",
307
    on_update     => "CASCADE",
308
  },
309
);
310
311
=head2 club_holds_to_patron_holds
312
313
Type: has_many
314
315
Related object: L<Koha::Schema::Result::ClubHoldsToPatronHold>
316
317
=cut
318
319
__PACKAGE__->has_many(
320
  "club_holds_to_patron_holds",
321
  "Koha::Schema::Result::ClubHoldsToPatronHold",
322
  { "foreign.hold_id" => "self.id" },
323
  { cascade_copy => 0, cascade_delete => 0 },
324
);
325
326
=head2 desk
327
328
Type: belongs_to
329
330
Related object: L<Koha::Schema::Result::Desk>
331
332
=cut
333
334
__PACKAGE__->belongs_to(
335
  "desk",
336
  "Koha::Schema::Result::Desk",
337
  { desk_id => "desk_id" },
338
  {
339
    is_deferrable => 1,
340
    join_type     => "LEFT",
341
    on_delete     => "SET NULL",
342
    on_update     => "CASCADE",
343
  },
344
);
345
346
=head2 item
347
348
Type: belongs_to
349
350
Related object: L<Koha::Schema::Result::Item>
351
352
=cut
353
354
__PACKAGE__->belongs_to(
355
  "item",
356
  "Koha::Schema::Result::Item",
357
  { itemnumber => "item_id" },
358
  {
359
    is_deferrable => 1,
360
    join_type     => "LEFT",
361
    on_delete     => "SET NULL",
362
    on_update     => "CASCADE",
363
  },
364
);
365
366
=head2 item_type
367
368
Type: belongs_to
369
370
Related object: L<Koha::Schema::Result::Itemtype>
371
372
=cut
373
374
__PACKAGE__->belongs_to(
375
  "item_type",
376
  "Koha::Schema::Result::Itemtype",
377
  { itemtype => "item_type" },
378
  {
379
    is_deferrable => 1,
380
    join_type     => "LEFT",
381
    on_delete     => "SET NULL",
382
    on_update     => "CASCADE",
383
  },
384
);
385
386
=head2 patron
387
388
Type: belongs_to
389
390
Related object: L<Koha::Schema::Result::Borrower>
391
392
=cut
393
394
__PACKAGE__->belongs_to(
395
  "patron",
396
  "Koha::Schema::Result::Borrower",
397
  { borrowernumber => "patron_id" },
398
  {
399
    is_deferrable => 1,
400
    join_type     => "LEFT",
401
    on_delete     => "SET NULL",
402
    on_update     => "CASCADE",
403
  },
404
);
405
406
=head2 pickup_library
407
408
Type: belongs_to
409
410
Related object: L<Koha::Schema::Result::Branch>
411
412
=cut
413
414
__PACKAGE__->belongs_to(
415
  "pickup_library",
416
  "Koha::Schema::Result::Branch",
417
  { branchcode => "pickup_library_id" },
418
  {
419
    is_deferrable => 1,
420
    join_type     => "LEFT",
421
    on_delete     => "SET NULL",
422
    on_update     => "CASCADE",
423
  },
424
);
425
426
427
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2021-01-27 19:43:42
428
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:EjBk5LQLG2761uSkk/35Sw
429
430
__PACKAGE__->add_columns(
431
    '+completed'  => { is_boolean => 1 },
432
    '+item_level' => { is_boolean => 1 },
433
    '+suspended'  => { is_boolean => 1 },
434
    '+lowest_priority' => { is_boolean => 1 },
435
);
436
437
1;
(-)a/installer/data/mysql/kohastructure.sql (-85 / +183 lines)
Lines 1865-1871 CREATE TABLE `club_holds_to_patron_holds` ( Link Here
1865
  KEY `clubs_holds_paton_holds_ibfk_3` (`hold_id`),
1865
  KEY `clubs_holds_paton_holds_ibfk_3` (`hold_id`),
1866
  CONSTRAINT `clubs_holds_paton_holds_ibfk_1` FOREIGN KEY (`club_hold_id`) REFERENCES `club_holds` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1866
  CONSTRAINT `clubs_holds_paton_holds_ibfk_1` FOREIGN KEY (`club_hold_id`) REFERENCES `club_holds` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1867
  CONSTRAINT `clubs_holds_paton_holds_ibfk_2` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1867
  CONSTRAINT `clubs_holds_paton_holds_ibfk_2` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1868
  CONSTRAINT `clubs_holds_paton_holds_ibfk_3` FOREIGN KEY (`hold_id`) REFERENCES `reserves` (`reserve_id`) ON DELETE CASCADE ON UPDATE CASCADE
1868
  CONSTRAINT `clubs_holds_paton_holds_ibfk_3` FOREIGN KEY (`hold_id`) REFERENCES `holds` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1869
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1869
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1870
/*!40101 SET character_set_client = @saved_cs_client */;
1870
/*!40101 SET character_set_client = @saved_cs_client */;
1871
1871
Lines 2645-2650 CREATE TABLE `hold_fill_targets` ( Link Here
2645
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2645
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2646
/*!40101 SET character_set_client = @saved_cs_client */;
2646
/*!40101 SET character_set_client = @saved_cs_client */;
2647
2647
2648
--
2649
-- Table structure for table `holds`
2650
--
2651
2652
DROP TABLE IF EXISTS `holds`;
2653
/*!40101 SET @saved_cs_client     = @@character_set_client */;
2654
/*!40101 SET character_set_client = utf8 */;
2655
CREATE TABLE `holds` (
2656
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'internal hold identifier',
2657
  `patron_id` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table defining which patron this hold is for',
2658
  `pickup_library_id` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'foreign key from the branches table defining which branch the patron wishes to pick this hold up at',
2659
  `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at',
2660
  `created_date` date DEFAULT NULL COMMENT 'the date the hold was placed',
2661
  `biblio_id` int(11) DEFAULT NULL COMMENT 'foreign key from the biblio table defining which bib record this hold is on',
2662
  `item_id` int(11) DEFAULT NULL COMMENT 'foreign key from the items table defining the specific item the patron has placed on hold or the item this hold was filled with',
2663
  `item_type` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
2664
  `item_level` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hold was placed at item level',
2665
  `completed_date` date DEFAULT NULL COMMENT 'the date this hold was completed (fulfilled or cancelled)',
2666
  `notes` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'notes related to this hold',
2667
  `priority` smallint(6) NOT NULL DEFAULT 1 COMMENT 'where in the queue the patron sits',
2668
  `status` enum('placed','fulfilled','processing','waiting','in_transit','cancelled') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'placed' COMMENT 'the status the hold is (''placed'', ''fulfilled'', ''waiting'', ''in_transit'', ''cancelled'')',
2669
  `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this hold was last updated',
2670
  `waiting_date` date DEFAULT NULL COMMENT 'the date the item was marked as waiting for the patron at the library',
2671
  `expiration_date` date DEFAULT NULL COMMENT 'the date the hold expires (usually the date entered by the patron to say they don''t need the hold after a certain date)',
2672
  `lowest_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'if it was assigned the lowest priority',
2673
  `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'if it was assigned no priority',
2674
  `suspended` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'If it is a non-priority hold',
2675
  `suspended_until_date` datetime DEFAULT NULL COMMENT 'Date until it is suspended',
2676
  `completed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'If it has been completed (i.e. either ''fulfilled'' or ''cancelled'')',
2677
  `cancellation_reason` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'optional authorised value CANCELLATION_REASON',
2678
  PRIMARY KEY (`id`),
2679
  KEY `priority_status_idx` (`priority`,`status`),
2680
  KEY `patron_id` (`patron_id`),
2681
  KEY `biblio_id` (`biblio_id`),
2682
  KEY `item_id` (`item_id`),
2683
  KEY `pickup_library_id` (`pickup_library_id`),
2684
  KEY `item_type` (`item_type`),
2685
  KEY `holds_ibfk_2` (`desk_id`),
2686
  CONSTRAINT `holds_ibfk_1` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
2687
  CONSTRAINT `holds_ibfk_2` FOREIGN KEY (`desk_id`) REFERENCES `desks` (`desk_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2688
  CONSTRAINT `holds_ibfk_3` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE CASCADE,
2689
  CONSTRAINT `holds_ibfk_4` FOREIGN KEY (`item_type`) REFERENCES `itemtypes` (`itemtype`) ON DELETE SET NULL ON UPDATE CASCADE,
2690
  CONSTRAINT `holds_ibfk_5` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
2691
  CONSTRAINT `holds_ibfk_6` FOREIGN KEY (`pickup_library_id`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE
2692
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2693
/*!40101 SET character_set_client = @saved_cs_client */;
2694
2648
--
2695
--
2649
-- Table structure for table `housebound_profile`
2696
-- Table structure for table `housebound_profile`
2650
--
2697
--
Lines 3862-3909 CREATE TABLE `old_issues` ( Link Here
3862
/*!40101 SET character_set_client = @saved_cs_client */;
3909
/*!40101 SET character_set_client = @saved_cs_client */;
3863
3910
3864
--
3911
--
3865
-- Table structure for table `old_reserves`
3912
-- Temporary table structure for view `old_reserves`
3866
--
3913
--
3867
3914
3868
DROP TABLE IF EXISTS `old_reserves`;
3915
DROP TABLE IF EXISTS `old_reserves`;
3869
/*!40101 SET @saved_cs_client     = @@character_set_client */;
3916
/*!50001 DROP VIEW IF EXISTS `old_reserves`*/;
3870
/*!40101 SET character_set_client = utf8 */;
3917
SET @saved_cs_client     = @@character_set_client;
3871
CREATE TABLE `old_reserves` (
3918
SET character_set_client = utf8;
3872
  `reserve_id` int(11) NOT NULL COMMENT 'primary key',
3919
/*!50001 CREATE TABLE `old_reserves` (
3873
  `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table defining which patron this hold is for',
3920
  `reserve_id` tinyint NOT NULL,
3874
  `reservedate` date DEFAULT NULL COMMENT 'the date the hold was places',
3921
  `borrowernumber` tinyint NOT NULL,
3875
  `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key from the biblio table defining which bib record this hold is on',
3922
  `reservedate` tinyint NOT NULL,
3876
  `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'foreign key from the branches table defining which branch the patron wishes to pick this hold up at',
3923
  `biblionumber` tinyint NOT NULL,
3877
  `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at',
3924
  `branchcode` tinyint NOT NULL,
3878
  `notificationdate` date DEFAULT NULL COMMENT 'currently unused',
3925
  `desk_id` tinyint NOT NULL,
3879
  `reminderdate` date DEFAULT NULL COMMENT 'currently unused',
3926
  `cancellationdate` tinyint NOT NULL,
3880
  `cancellationdate` date DEFAULT NULL COMMENT 'the date this hold was cancelled',
3927
  `cancellation_reason` tinyint NOT NULL,
3881
  `cancellation_reason` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'optional authorised value CANCELLATION_REASON',
3928
  `reservenotes` tinyint NOT NULL,
3882
  `reservenotes` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'notes related to this hold',
3929
  `priority` tinyint NOT NULL,
3883
  `priority` smallint(6) NOT NULL DEFAULT 1 COMMENT 'where in the queue the patron sits',
3930
  `found` tinyint NOT NULL,
3884
  `found` varchar(1) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'a one letter code defining what the status is of the hold is after it has been confirmed',
3931
  `timestamp` tinyint NOT NULL,
3885
  `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this hold was last updated',
3932
  `itemnumber` tinyint NOT NULL,
3886
  `itemnumber` int(11) DEFAULT NULL COMMENT 'foreign key from the items table defining the specific item the patron has placed on hold or the item this hold was filled with',
3933
  `waitingdate` tinyint NOT NULL,
3887
  `waitingdate` date DEFAULT NULL COMMENT 'the date the item was marked as waiting for the patron at the library',
3934
  `expirationdate` tinyint NOT NULL,
3888
  `expirationdate` date DEFAULT NULL COMMENT 'the date the hold expires (usually the date entered by the patron to say they don''t need the hold after a certain date)',
3935
  `lowestPriority` tinyint NOT NULL,
3889
  `lowestPriority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'has this hold been pinned to the lowest priority in the holds queue (1 for yes, 0 for no)',
3936
  `suspend` tinyint NOT NULL,
3890
  `suspend` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'in this hold suspended (1 for yes, 0 for no)',
3937
  `suspend_until` tinyint NOT NULL,
3891
  `suspend_until` datetime DEFAULT NULL COMMENT 'the date this hold is suspended until (NULL for infinitely)',
3938
  `itemtype` tinyint NOT NULL,
3892
  `itemtype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
3939
  `item_level_hold` tinyint NOT NULL,
3893
  `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hpld placed at item level',
3940
  `non_priority` tinyint NOT NULL
3894
  `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
3941
) ENGINE=MyISAM */;
3895
  PRIMARY KEY (`reserve_id`),
3942
SET character_set_client = @saved_cs_client;
3896
  KEY `old_reserves_borrowernumber` (`borrowernumber`),
3897
  KEY `old_reserves_biblionumber` (`biblionumber`),
3898
  KEY `old_reserves_itemnumber` (`itemnumber`),
3899
  KEY `old_reserves_branchcode` (`branchcode`),
3900
  KEY `old_reserves_itemtype` (`itemtype`),
3901
  CONSTRAINT `old_reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3902
  CONSTRAINT `old_reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3903
  CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3904
  CONSTRAINT `old_reserves_ibfk_4` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE SET NULL ON UPDATE SET NULL
3905
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3906
/*!40101 SET character_set_client = @saved_cs_client */;
3907
3943
3908
--
3944
--
3909
-- Table structure for table `opac_news`
3945
-- Table structure for table `opac_news`
Lines 4301-4352 CREATE TABLE `reports_dictionary` ( Link Here
4301
/*!40101 SET character_set_client = @saved_cs_client */;
4337
/*!40101 SET character_set_client = @saved_cs_client */;
4302
4338
4303
--
4339
--
4304
-- Table structure for table `reserves`
4340
-- Temporary table structure for view `reserves`
4305
--
4341
--
4306
4342
4307
DROP TABLE IF EXISTS `reserves`;
4343
DROP TABLE IF EXISTS `reserves`;
4308
/*!40101 SET @saved_cs_client     = @@character_set_client */;
4344
/*!50001 DROP VIEW IF EXISTS `reserves`*/;
4309
/*!40101 SET character_set_client = utf8 */;
4345
SET @saved_cs_client     = @@character_set_client;
4310
CREATE TABLE `reserves` (
4346
SET character_set_client = utf8;
4311
  `reserve_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
4347
/*!50001 CREATE TABLE `reserves` (
4312
  `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the borrowers table defining which patron this hold is for',
4348
  `reserve_id` tinyint NOT NULL,
4313
  `reservedate` date DEFAULT NULL COMMENT 'the date the hold was placed',
4349
  `borrowernumber` tinyint NOT NULL,
4314
  `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblio table defining which bib record this hold is on',
4350
  `reservedate` tinyint NOT NULL,
4315
  `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'foreign key from the branches table defining which branch the patron wishes to pick this hold up at',
4351
  `biblionumber` tinyint NOT NULL,
4316
  `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at',
4352
  `branchcode` tinyint NOT NULL,
4317
  `notificationdate` date DEFAULT NULL COMMENT 'currently unused',
4353
  `desk_id` tinyint NOT NULL,
4318
  `reminderdate` date DEFAULT NULL COMMENT 'currently unused',
4354
  `cancellationdate` tinyint NOT NULL,
4319
  `cancellationdate` date DEFAULT NULL COMMENT 'the date this hold was cancelled',
4355
  `cancellation_reason` tinyint NOT NULL,
4320
  `cancellation_reason` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'optional authorised value CANCELLATION_REASON',
4356
  `reservenotes` tinyint NOT NULL,
4321
  `reservenotes` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'notes related to this hold',
4357
  `priority` tinyint NOT NULL,
4322
  `priority` smallint(6) NOT NULL DEFAULT 1 COMMENT 'where in the queue the patron sits',
4358
  `found` tinyint NOT NULL,
4323
  `found` varchar(1) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'a one letter code defining what the status is of the hold is after it has been confirmed',
4359
  `timestamp` tinyint NOT NULL,
4324
  `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this hold was last updated',
4360
  `itemnumber` tinyint NOT NULL,
4325
  `itemnumber` int(11) DEFAULT NULL COMMENT 'foreign key from the items table defining the specific item the patron has placed on hold or the item this hold was filled with',
4361
  `waitingdate` tinyint NOT NULL,
4326
  `waitingdate` date DEFAULT NULL COMMENT 'the date the item was marked as waiting for the patron at the library',
4362
  `expirationdate` tinyint NOT NULL,
4327
  `expirationdate` date DEFAULT NULL COMMENT 'the date the hold expires (usually the date entered by the patron to say they don''t need the hold after a certain date)',
4363
  `lowestPriority` tinyint NOT NULL,
4328
  `lowestPriority` tinyint(1) NOT NULL DEFAULT 0,
4364
  `suspend` tinyint NOT NULL,
4329
  `suspend` tinyint(1) NOT NULL DEFAULT 0,
4365
  `suspend_until` tinyint NOT NULL,
4330
  `suspend_until` datetime DEFAULT NULL,
4366
  `itemtype` tinyint NOT NULL,
4331
  `itemtype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
4367
  `item_level_hold` tinyint NOT NULL,
4332
  `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hpld placed at item level',
4368
  `non_priority` tinyint NOT NULL
4333
  `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
4369
) ENGINE=MyISAM */;
4334
  PRIMARY KEY (`reserve_id`),
4370
SET character_set_client = @saved_cs_client;
4335
  KEY `priorityfoundidx` (`priority`,`found`),
4336
  KEY `borrowernumber` (`borrowernumber`),
4337
  KEY `biblionumber` (`biblionumber`),
4338
  KEY `itemnumber` (`itemnumber`),
4339
  KEY `branchcode` (`branchcode`),
4340
  KEY `desk_id` (`desk_id`),
4341
  KEY `itemtype` (`itemtype`),
4342
  CONSTRAINT `reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4343
  CONSTRAINT `reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4344
  CONSTRAINT `reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4345
  CONSTRAINT `reserves_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
4346
  CONSTRAINT `reserves_ibfk_5` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE,
4347
  CONSTRAINT `reserves_ibfk_6` FOREIGN KEY (`desk_id`) REFERENCES `desks` (`desk_id`) ON DELETE SET NULL ON UPDATE CASCADE
4348
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4349
/*!40101 SET character_set_client = @saved_cs_client */;
4350
4371
4351
--
4372
--
4352
-- Table structure for table `return_claims`
4373
-- Table structure for table `return_claims`
Lines 5339-5345 CREATE TABLE `zebraqueue` ( Link Here
5339
  KEY `zebraqueue_lookup` (`server`,`biblio_auth_number`,`operation`,`done`)
5360
  KEY `zebraqueue_lookup` (`server`,`biblio_auth_number`,`operation`,`done`)
5340
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5361
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5341
/*!40101 SET character_set_client = @saved_cs_client */;
5362
/*!40101 SET character_set_client = @saved_cs_client */;
5342
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
5363
5364
--
5365
-- Table structure for table `reserves`
5366
--
5367
5368
CREATE VIEW `reserves`
5369
AS
5370
    SELECT
5371
        `id` AS `reserve_id`,
5372
        `patron_id` AS `borrowernumber`,
5373
        `created_date` AS `reservedate`,
5374
        `biblio_id` AS `biblionumber`,
5375
        `pickup_library_id` AS `branchcode`,
5376
        `desk_id`,
5377
        NULL AS `cancellationdate`,
5378
        `cancellation_reason`,
5379
        `notes` AS `reservenotes`,
5380
        `priority`,
5381
        CASE
5382
            when `status` = 'waiting' then
5383
                'W'
5384
            when `status` = 'in_transit' then
5385
                'T'
5386
            else
5387
                NULL
5388
        END AS `found`,
5389
        `timestamp`,
5390
        `item_id` AS `itemnumber`,
5391
        `waiting_date` AS `waitingdate`,
5392
        `expiration_date` AS `expirationdate`,
5393
        `lowest_priority` AS `lowestPriority`,
5394
        `suspended` AS `suspend`,
5395
        `suspended_until_date` AS `suspend_until`,
5396
        `item_type` AS `itemtype`,
5397
        `item_level` AS `item_level_hold`,
5398
        `non_priority`
5399
    FROM `holds`
5400
    WHERE completed=0;
5401
5402
--
5403
-- Table structure for view `old_reserves`
5404
--
5405
5406
CREATE VIEW `old_reserves`
5407
AS
5408
    SELECT
5409
        `id` AS `reserve_id`,
5410
        `patron_id` AS `borrowernumber`,
5411
        `created_date` AS `reservedate`,
5412
        `biblio_id` AS `biblionumber`,
5413
        `pickup_library_id` AS `branchcode`,
5414
        `desk_id`,
5415
        CASE
5416
            WHEN `status` = 'cancelled' THEN
5417
                `completed_date`
5418
            ELSE
5419
                NULL
5420
        END AS `cancellationdate`,
5421
        `cancellation_reason`,
5422
        `notes` AS `reservenotes`,
5423
        `priority`,
5424
        CASE
5425
            WHEN `status` = 'fulfilled' THEN
5426
                'F'
5427
            ELSE
5428
                NULL
5429
        END AS `found`,
5430
        `timestamp`,
5431
        `item_id` AS `itemnumber`,
5432
        `waiting_date` AS `waitingdate`,
5433
        `expiration_date` AS `expirationdate`,
5434
        `lowest_priority` AS `lowestPriority`,
5435
        `suspended` AS `suspend`,
5436
        `suspended_until_date` AS `suspend_until`,
5437
        `item_type` AS `itemtype`,
5438
        `item_level` AS `item_level_hold`,
5439
        `non_priority`
5440
    FROM `holds`
5441
    WHERE completed=1;
5343
5442
5344
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
5443
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
5345
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
5444
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
5346
- 

Return to bug 25260