2 package Koha::Schema::Result::Issue;
4 # Created by DBIx::Class::Schema::Loader
5 # DO NOT MODIFY THE FIRST PART OF THIS FILE
9 Koha::Schema::Result::Issue
16 use base 'DBIx::Class::Core';
18 =head1 TABLE: C<issues>
22 __PACKAGE__->table("issues");
32 primary key for issues table
40 foreign key, linking this to the borrowers table for the patron this item was checked out to
48 foreign key, linking this to the borrowers table for the user who checked out this item
56 foreign key, linking this to the items table for the item that was checked out
61 datetime_undef_if_invalid: 1
64 datetime the item is due (yyyy-mm-dd hh:mm::ss)
72 foreign key, linking to the branches table for the location the item was checked out
77 datetime_undef_if_invalid: 1
80 date the item was returned, will be NULL until moved to old_issues
82 =head2 lastreneweddate
85 datetime_undef_if_invalid: 1
88 date the item was last renewed
96 lists the number of times the item was renewed
98 =head2 unseen_renewals
104 lists the number of consecutive times the item was renewed without being seen
114 =head2 auto_renew_error
120 automatic renewal error
124 data_type: 'timestamp'
125 datetime_undef_if_invalid: 1
126 default_value: current_timestamp
129 the date and time this record was last touched
133 data_type: 'datetime'
134 datetime_undef_if_invalid: 1
137 date the item was checked out or issued
139 =head2 onsite_checkout
149 data_type: 'longtext'
156 data_type: 'datetime'
157 datetime_undef_if_invalid: 1
160 datetime of issue note (yyyy-mm-dd hh:mm::ss)
167 describes whether checkout note has been seen 1, not been seen 0 or doesn't exist null
171 __PACKAGE__->add_columns(
173 { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
175 { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
177 { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
179 { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
182 data_type => "datetime",
183 datetime_undef_if_invalid => 1,
187 { data_type => "varchar", is_nullable => 1, size => 10 },
190 data_type => "datetime",
191 datetime_undef_if_invalid => 1,
196 data_type => "datetime",
197 datetime_undef_if_invalid => 1,
201 { data_type => "tinyint", default_value => 0, is_nullable => 0 },
203 { data_type => "tinyint", default_value => 0, is_nullable => 0 },
205 { data_type => "tinyint", default_value => 0, is_nullable => 1 },
207 { data_type => "varchar", is_nullable => 1, size => 32 },
210 data_type => "timestamp",
211 datetime_undef_if_invalid => 1,
212 default_value => \"current_timestamp",
217 data_type => "datetime",
218 datetime_undef_if_invalid => 1,
222 { data_type => "integer", default_value => 0, is_nullable => 0 },
224 { data_type => "longtext", is_nullable => 1 },
227 data_type => "datetime",
228 datetime_undef_if_invalid => 1,
232 { data_type => "integer", is_nullable => 1 },
245 __PACKAGE__->set_primary_key("issue_id");
247 =head1 UNIQUE CONSTRAINTS
253 =item * L</itemnumber>
259 __PACKAGE__->add_unique_constraint("itemnumber", ["itemnumber"]);
263 =head2 borrowernumber
267 Related object: L<Koha::Schema::Result::Borrower>
271 __PACKAGE__->belongs_to(
273 "Koha::Schema::Result::Borrower",
274 { borrowernumber => "borrowernumber" },
278 on_delete => "RESTRICT",
279 on_update => "CASCADE",
287 Related object: L<Koha::Schema::Result::Borrower>
291 __PACKAGE__->belongs_to(
293 "Koha::Schema::Result::Borrower",
294 { borrowernumber => "issuer_id" },
298 on_delete => "SET NULL",
299 on_update => "CASCADE",
307 Related object: L<Koha::Schema::Result::Item>
311 __PACKAGE__->belongs_to(
313 "Koha::Schema::Result::Item",
314 { itemnumber => "itemnumber" },
318 on_delete => "RESTRICT",
319 on_update => "CASCADE",
324 # Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-03-11 15:10:14
325 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:TERiBbm+B4jMEuNM2dVbfQ
327 __PACKAGE__->add_columns(
328 '+auto_renew' => { is_boolean => 1 },
329 '+noteseen' => { is_boolean => 1 },
330 '+onsite_checkout' => { is_boolean => 1 }
333 __PACKAGE__->belongs_to(
335 "Koha::Schema::Result::Borrower",
336 { borrowernumber => "borrowernumber" },
337 { join_type => "LEFT", on_delete => "CASCADE", on_update => "CASCADE" },
340 __PACKAGE__->belongs_to(
342 "Koha::Schema::Result::Item",
343 { itemnumber => "itemnumber" },
347 on_delete => "CASCADE",
348 on_update => "CASCADE",
352 __PACKAGE__->belongs_to(
354 "Koha::Schema::Result::Branch",
355 { branchcode => "branchcode" },
359 on_delete => "CASCADE",
360 on_update => "CASCADE",
364 __PACKAGE__->belongs_to(
366 "Koha::Schema::Result::Branch",
367 { "foreign.branchcode" => "self.branchcode" },
371 on_delete => "CASCADE",
372 on_update => "CASCADE",
380 Related object: L<Koha::Schema::Result::CheckoutRenewal>
384 __PACKAGE__->has_many(
386 "Koha::Schema::Result::CheckoutRenewal",
387 { "foreign.checkout_id" => "self.issue_id" },
388 { cascade_copy => 0, cascade_delete => 0 },
395 Related object: L<Koha::Schema::Result::ReturnClaim>
399 __PACKAGE__->might_have(
401 "Koha::Schema::Result::ReturnClaim",
402 { "foreign.issue_id" => "self.issue_id" },
403 { cascade_copy => 0, cascade_delete => 0 },
406 sub koha_object_class {
409 sub koha_objects_class {