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 (-86 / +184 lines)
Lines 1861-1867 CREATE TABLE `club_holds_to_patron_holds` ( Link Here
1861
  KEY `clubs_holds_paton_holds_ibfk_3` (`hold_id`),
1861
  KEY `clubs_holds_paton_holds_ibfk_3` (`hold_id`),
1862
  CONSTRAINT `clubs_holds_paton_holds_ibfk_1` FOREIGN KEY (`club_hold_id`) REFERENCES `club_holds` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1862
  CONSTRAINT `clubs_holds_paton_holds_ibfk_1` FOREIGN KEY (`club_hold_id`) REFERENCES `club_holds` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1863
  CONSTRAINT `clubs_holds_paton_holds_ibfk_2` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1863
  CONSTRAINT `clubs_holds_paton_holds_ibfk_2` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1864
  CONSTRAINT `clubs_holds_paton_holds_ibfk_3` FOREIGN KEY (`hold_id`) REFERENCES `reserves` (`reserve_id`) ON DELETE CASCADE ON UPDATE CASCADE
1864
  CONSTRAINT `clubs_holds_paton_holds_ibfk_3` FOREIGN KEY (`hold_id`) REFERENCES `holds` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
1865
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1865
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1866
/*!40101 SET character_set_client = @saved_cs_client */;
1866
/*!40101 SET character_set_client = @saved_cs_client */;
1867
1867
Lines 2635-2640 CREATE TABLE `hold_fill_targets` ( Link Here
2635
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2635
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2636
/*!40101 SET character_set_client = @saved_cs_client */;
2636
/*!40101 SET character_set_client = @saved_cs_client */;
2637
2637
2638
--
2639
-- Table structure for table `holds`
2640
--
2641
2642
DROP TABLE IF EXISTS `holds`;
2643
/*!40101 SET @saved_cs_client     = @@character_set_client */;
2644
/*!40101 SET character_set_client = utf8 */;
2645
CREATE TABLE `holds` (
2646
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'internal hold identifier',
2647
  `patron_id` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table defining which patron this hold is for',
2648
  `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',
2649
  `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at',
2650
  `created_date` date DEFAULT NULL COMMENT 'the date the hold was placed',
2651
  `biblio_id` int(11) DEFAULT NULL COMMENT 'foreign key from the biblio table defining which bib record this hold is on',
2652
  `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',
2653
  `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',
2654
  `item_level` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hold was placed at item level',
2655
  `completed_date` date DEFAULT NULL COMMENT 'the date this hold was completed (fulfilled or cancelled)',
2656
  `notes` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'notes related to this hold',
2657
  `priority` smallint(6) NOT NULL DEFAULT 1 COMMENT 'where in the queue the patron sits',
2658
  `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'')',
2659
  `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this hold was last updated',
2660
  `waiting_date` date DEFAULT NULL COMMENT 'the date the item was marked as waiting for the patron at the library',
2661
  `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)',
2662
  `lowest_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'if it was assigned the lowest priority',
2663
  `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'if it was assigned no priority',
2664
  `suspended` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'If it is a non-priority hold',
2665
  `suspended_until_date` datetime DEFAULT NULL COMMENT 'Date until it is suspended',
2666
  `completed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'If it has been completed (i.e. either ''fulfilled'' or ''cancelled'')',
2667
  `cancellation_reason` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'optional authorised value CANCELLATION_REASON',
2668
  PRIMARY KEY (`id`),
2669
  KEY `priority_status_idx` (`priority`,`status`),
2670
  KEY `patron_id` (`patron_id`),
2671
  KEY `biblio_id` (`biblio_id`),
2672
  KEY `item_id` (`item_id`),
2673
  KEY `pickup_library_id` (`pickup_library_id`),
2674
  KEY `item_type` (`item_type`),
2675
  KEY `holds_ibfk_2` (`desk_id`),
2676
  CONSTRAINT `holds_ibfk_1` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
2677
  CONSTRAINT `holds_ibfk_2` FOREIGN KEY (`desk_id`) REFERENCES `desks` (`desk_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2678
  CONSTRAINT `holds_ibfk_3` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE CASCADE,
2679
  CONSTRAINT `holds_ibfk_4` FOREIGN KEY (`item_type`) REFERENCES `itemtypes` (`itemtype`) ON DELETE SET NULL ON UPDATE CASCADE,
2680
  CONSTRAINT `holds_ibfk_5` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
2681
  CONSTRAINT `holds_ibfk_6` FOREIGN KEY (`pickup_library_id`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE
2682
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2683
/*!40101 SET character_set_client = @saved_cs_client */;
2684
2638
--
2685
--
2639
-- Table structure for table `housebound_profile`
2686
-- Table structure for table `housebound_profile`
2640
--
2687
--
Lines 3848-3895 CREATE TABLE `old_issues` ( Link Here
3848
/*!40101 SET character_set_client = @saved_cs_client */;
3895
/*!40101 SET character_set_client = @saved_cs_client */;
3849
3896
3850
--
3897
--
3851
-- Table structure for table `old_reserves`
3898
-- Temporary table structure for view `old_reserves`
3852
--
3899
--
3853
3900
3854
DROP TABLE IF EXISTS `old_reserves`;
3901
DROP TABLE IF EXISTS `old_reserves`;
3855
/*!40101 SET @saved_cs_client     = @@character_set_client */;
3902
/*!50001 DROP VIEW IF EXISTS `old_reserves`*/;
3856
/*!40101 SET character_set_client = utf8 */;
3903
SET @saved_cs_client     = @@character_set_client;
3857
CREATE TABLE `old_reserves` (
3904
SET character_set_client = utf8;
3858
  `reserve_id` int(11) NOT NULL COMMENT 'primary key',
3905
/*!50001 CREATE TABLE `old_reserves` (
3859
  `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table defining which patron this hold is for',
3906
  `reserve_id` tinyint NOT NULL,
3860
  `reservedate` date DEFAULT NULL COMMENT 'the date the hold was places',
3907
  `borrowernumber` tinyint NOT NULL,
3861
  `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key from the biblio table defining which bib record this hold is on',
3908
  `reservedate` tinyint NOT NULL,
3862
  `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',
3909
  `biblionumber` tinyint NOT NULL,
3863
  `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at',
3910
  `branchcode` tinyint NOT NULL,
3864
  `notificationdate` date DEFAULT NULL COMMENT 'currently unused',
3911
  `desk_id` tinyint NOT NULL,
3865
  `reminderdate` date DEFAULT NULL COMMENT 'currently unused',
3912
  `cancellationdate` tinyint NOT NULL,
3866
  `cancellationdate` date DEFAULT NULL COMMENT 'the date this hold was cancelled',
3913
  `cancellation_reason` tinyint NOT NULL,
3867
  `cancellation_reason` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'optional authorised value CANCELLATION_REASON',
3914
  `reservenotes` tinyint NOT NULL,
3868
  `reservenotes` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'notes related to this hold',
3915
  `priority` tinyint NOT NULL,
3869
  `priority` smallint(6) NOT NULL DEFAULT 1 COMMENT 'where in the queue the patron sits',
3916
  `found` tinyint NOT NULL,
3870
  `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',
3917
  `timestamp` tinyint NOT NULL,
3871
  `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this hold was last updated',
3918
  `itemnumber` tinyint NOT NULL,
3872
  `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',
3919
  `waitingdate` tinyint NOT NULL,
3873
  `waitingdate` date DEFAULT NULL COMMENT 'the date the item was marked as waiting for the patron at the library',
3920
  `expirationdate` tinyint NOT NULL,
3874
  `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)',
3921
  `lowestPriority` tinyint NOT NULL,
3875
  `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)',
3922
  `suspend` tinyint NOT NULL,
3876
  `suspend` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'in this hold suspended (1 for yes, 0 for no)',
3923
  `suspend_until` tinyint NOT NULL,
3877
  `suspend_until` datetime DEFAULT NULL COMMENT 'the date this hold is suspended until (NULL for infinitely)',
3924
  `itemtype` tinyint NOT NULL,
3878
  `itemtype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
3925
  `item_level_hold` tinyint NOT NULL,
3879
  `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hpld placed at item level',
3926
  `non_priority` tinyint NOT NULL
3880
  `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
3927
) ENGINE=MyISAM */;
3881
  PRIMARY KEY (`reserve_id`),
3928
SET character_set_client = @saved_cs_client;
3882
  KEY `old_reserves_borrowernumber` (`borrowernumber`),
3883
  KEY `old_reserves_biblionumber` (`biblionumber`),
3884
  KEY `old_reserves_itemnumber` (`itemnumber`),
3885
  KEY `old_reserves_branchcode` (`branchcode`),
3886
  KEY `old_reserves_itemtype` (`itemtype`),
3887
  CONSTRAINT `old_reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3888
  CONSTRAINT `old_reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3889
  CONSTRAINT `old_reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE SET NULL,
3890
  CONSTRAINT `old_reserves_ibfk_4` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE SET NULL ON UPDATE SET NULL
3891
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3892
/*!40101 SET character_set_client = @saved_cs_client */;
3893
3929
3894
--
3930
--
3895
-- Table structure for table `opac_news`
3931
-- Table structure for table `opac_news`
Lines 4287-4338 CREATE TABLE `reports_dictionary` ( Link Here
4287
/*!40101 SET character_set_client = @saved_cs_client */;
4323
/*!40101 SET character_set_client = @saved_cs_client */;
4288
4324
4289
--
4325
--
4290
-- Table structure for table `reserves`
4326
-- Temporary table structure for view `reserves`
4291
--
4327
--
4292
4328
4293
DROP TABLE IF EXISTS `reserves`;
4329
DROP TABLE IF EXISTS `reserves`;
4294
/*!40101 SET @saved_cs_client     = @@character_set_client */;
4330
/*!50001 DROP VIEW IF EXISTS `reserves`*/;
4295
/*!40101 SET character_set_client = utf8 */;
4331
SET @saved_cs_client     = @@character_set_client;
4296
CREATE TABLE `reserves` (
4332
SET character_set_client = utf8;
4297
  `reserve_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
4333
/*!50001 CREATE TABLE `reserves` (
4298
  `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the borrowers table defining which patron this hold is for',
4334
  `reserve_id` tinyint NOT NULL,
4299
  `reservedate` date DEFAULT NULL COMMENT 'the date the hold was placed',
4335
  `borrowernumber` tinyint NOT NULL,
4300
  `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblio table defining which bib record this hold is on',
4336
  `reservedate` tinyint NOT NULL,
4301
  `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',
4337
  `biblionumber` tinyint NOT NULL,
4302
  `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at',
4338
  `branchcode` tinyint NOT NULL,
4303
  `notificationdate` date DEFAULT NULL COMMENT 'currently unused',
4339
  `desk_id` tinyint NOT NULL,
4304
  `reminderdate` date DEFAULT NULL COMMENT 'currently unused',
4340
  `cancellationdate` tinyint NOT NULL,
4305
  `cancellationdate` date DEFAULT NULL COMMENT 'the date this hold was cancelled',
4341
  `cancellation_reason` tinyint NOT NULL,
4306
  `cancellation_reason` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'optional authorised value CANCELLATION_REASON',
4342
  `reservenotes` tinyint NOT NULL,
4307
  `reservenotes` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'notes related to this hold',
4343
  `priority` tinyint NOT NULL,
4308
  `priority` smallint(6) NOT NULL DEFAULT 1 COMMENT 'where in the queue the patron sits',
4344
  `found` tinyint NOT NULL,
4309
  `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',
4345
  `timestamp` tinyint NOT NULL,
4310
  `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this hold was last updated',
4346
  `itemnumber` tinyint NOT NULL,
4311
  `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',
4347
  `waitingdate` tinyint NOT NULL,
4312
  `waitingdate` date DEFAULT NULL COMMENT 'the date the item was marked as waiting for the patron at the library',
4348
  `expirationdate` tinyint NOT NULL,
4313
  `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)',
4349
  `lowestPriority` tinyint NOT NULL,
4314
  `lowestPriority` tinyint(1) NOT NULL DEFAULT 0,
4350
  `suspend` tinyint NOT NULL,
4315
  `suspend` tinyint(1) NOT NULL DEFAULT 0,
4351
  `suspend_until` tinyint NOT NULL,
4316
  `suspend_until` datetime DEFAULT NULL,
4352
  `itemtype` tinyint NOT NULL,
4317
  `itemtype` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'If record level hold, the optional itemtype of the item the patron is requesting',
4353
  `item_level_hold` tinyint NOT NULL,
4318
  `item_level_hold` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is the hpld placed at item level',
4354
  `non_priority` tinyint NOT NULL
4319
  `non_priority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a non priority hold',
4355
) ENGINE=MyISAM */;
4320
  PRIMARY KEY (`reserve_id`),
4356
SET character_set_client = @saved_cs_client;
4321
  KEY `priorityfoundidx` (`priority`,`found`),
4322
  KEY `borrowernumber` (`borrowernumber`),
4323
  KEY `biblionumber` (`biblionumber`),
4324
  KEY `itemnumber` (`itemnumber`),
4325
  KEY `branchcode` (`branchcode`),
4326
  KEY `desk_id` (`desk_id`),
4327
  KEY `itemtype` (`itemtype`),
4328
  CONSTRAINT `reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4329
  CONSTRAINT `reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4330
  CONSTRAINT `reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4331
  CONSTRAINT `reserves_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
4332
  CONSTRAINT `reserves_ibfk_5` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE,
4333
  CONSTRAINT `reserves_ibfk_6` FOREIGN KEY (`desk_id`) REFERENCES `desks` (`desk_id`) ON DELETE SET NULL ON UPDATE CASCADE
4334
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4335
/*!40101 SET character_set_client = @saved_cs_client */;
4336
4357
4337
--
4358
--
4338
-- Table structure for table `return_claims`
4359
-- Table structure for table `return_claims`
Lines 5325-5331 CREATE TABLE `zebraqueue` ( Link Here
5325
  KEY `zebraqueue_lookup` (`server`,`biblio_auth_number`,`operation`,`done`)
5346
  KEY `zebraqueue_lookup` (`server`,`biblio_auth_number`,`operation`,`done`)
5326
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5347
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5327
/*!40101 SET character_set_client = @saved_cs_client */;
5348
/*!40101 SET character_set_client = @saved_cs_client */;
5328
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
5349
5350
--
5351
-- Table structure for table `reserves`
5352
--
5353
5354
CREATE VIEW `reserves`
5355
AS
5356
    SELECT
5357
        `id` AS `reserve_id`,
5358
        `patron_id` AS `borrowernumber`,
5359
        `created_date` AS `reservedate`,
5360
        `biblio_id` AS `biblionumber`,
5361
        `pickup_library_id` AS `branchcode`,
5362
        `desk_id`,
5363
        NULL AS `cancellationdate`,
5364
        `cancellation_reason`,
5365
        `notes` AS `reservenotes`,
5366
        `priority`,
5367
        CASE
5368
            when `status` = 'waiting' then
5369
                'W'
5370
            when `status` = 'in_transit' then
5371
                'T'
5372
            else
5373
                NULL
5374
        END AS `found`,
5375
        `timestamp`,
5376
        `item_id` AS `itemnumber`,
5377
        `waiting_date` AS `waitingdate`,
5378
        `expiration_date` AS `expirationdate`,
5379
        `lowest_priority` AS `lowestPriority`,
5380
        `suspended` AS `suspend`,
5381
        `suspended_until_date` AS `suspend_until`,
5382
        `item_type` AS `itemtype`,
5383
        `item_level` AS `item_level_hold`,
5384
        `non_priority`
5385
    FROM `holds`
5386
    WHERE completed=0;
5387
5388
--
5389
-- Table structure for view `old_reserves`
5390
--
5391
5392
CREATE VIEW `old_reserves`
5393
AS
5394
    SELECT
5395
        `id` AS `reserve_id`,
5396
        `patron_id` AS `borrowernumber`,
5397
        `created_date` AS `reservedate`,
5398
        `biblio_id` AS `biblionumber`,
5399
        `pickup_library_id` AS `branchcode`,
5400
        `desk_id`,
5401
        CASE
5402
            WHEN `status` = 'cancelled' THEN
5403
                `completed_date`
5404
            ELSE
5405
                NULL
5406
        END AS `cancellationdate`,
5407
        `cancellation_reason`,
5408
        `notes` AS `reservenotes`,
5409
        `priority`,
5410
        CASE
5411
            WHEN `status` = 'fulfilled' THEN
5412
                'F'
5413
            ELSE
5414
                NULL
5415
        END AS `found`,
5416
        `timestamp`,
5417
        `item_id` AS `itemnumber`,
5418
        `waiting_date` AS `waitingdate`,
5419
        `expiration_date` AS `expirationdate`,
5420
        `lowest_priority` AS `lowestPriority`,
5421
        `suspended` AS `suspend`,
5422
        `suspended_until_date` AS `suspend_until`,
5423
        `item_type` AS `itemtype`,
5424
        `item_level` AS `item_level_hold`,
5425
        `non_priority`
5426
    FROM `holds`
5427
    WHERE completed=1;
5329
5428
5330
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
5429
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
5331
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
5430
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
Lines 5335-5338 CREATE TABLE `zebraqueue` ( Link Here
5335
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
5434
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
5336
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
5435
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
5337
5436
5338
-- Dump completed on 2021-01-12 11:28:48
5437
-- Dump completed on 2021-01-27 18:32:36
5339
- 

Return to bug 25260