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

Return to bug 25260