@@ -, +, @@ --- Koha/Schema/Result/Borrower.pm | 23 ++++++-- Koha/Schema/Result/BorrowerDebarment.pm | 8 +-- Koha/Schema/Result/Discharge.pm | 91 +++++++++++++++++++++++++++++++ 3 files changed, 114 insertions(+), 8 deletions(-) create mode 100644 Koha/Schema/Result/Discharge.pm --- a/Koha/Schema/Result/Borrower.pm +++ a/Koha/Schema/Result/Borrower.pm @@ -708,7 +708,7 @@ __PACKAGE__->belongs_to( "branchcode", "Koha::Schema::Result::Branch", { branchcode => "branchcode" }, - { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, + { is_deferrable => 1, on_delete => "RESTRICT", on_update => "RESTRICT" }, ); =head2 categorycode @@ -723,7 +723,7 @@ __PACKAGE__->belongs_to( "categorycode", "Koha::Schema::Result::Category", { categorycode => "categorycode" }, - { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, + { is_deferrable => 1, on_delete => "RESTRICT", on_update => "RESTRICT" }, ); =head2 course_instructors @@ -756,6 +756,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 discharges + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "discharges", + "Koha::Schema::Result::Discharge", + { "foreign.borrower" => "self.borrowernumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 hold_fill_targets Type: has_many @@ -1072,8 +1087,8 @@ Composing rels: L -> course __PACKAGE__->many_to_many("courses", "course_instructors", "course"); -# Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-10-31 16:31:19 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:z4kW3xYX1CyrwvGdZu32nA +# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-01-08 18:24:14 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:FcAcg1eLxgMJFuolIQ2sZg # You can replace this text with custom content, and it will be preserved on regeneration --- a/Koha/Schema/Result/BorrowerDebarment.pm +++ a/Koha/Schema/Result/BorrowerDebarment.pm @@ -45,7 +45,7 @@ __PACKAGE__->table("borrower_debarments"); data_type: 'enum' default_value: 'MANUAL' - extra: {list => ["SUSPENSION","OVERDUES","MANUAL"]} + extra: {list => ["SUSPENSION","OVERDUES","MANUAL","DISCHARGE"]} is_nullable: 0 =head2 comment @@ -84,7 +84,7 @@ __PACKAGE__->add_columns( { data_type => "enum", default_value => "MANUAL", - extra => { list => ["SUSPENSION", "OVERDUES", "MANUAL"] }, + extra => { list => ["SUSPENSION", "OVERDUES", "MANUAL", "DISCHARGE"] }, is_nullable => 0, }, "comment", @@ -136,8 +136,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-10-31 01:30:23 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Vq6rOYGJBK8Mw2YFAX52Vg +# Created by DBIx::Class::Schema::Loader v0.07025 @ 2014-01-07 17:25:44 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:4KkoPNcgZoANIScMWUyS/w # You can replace this text with custom code or comments, and it will be preserved on regeneration --- a/Koha/Schema/Result/Discharge.pm +++ a/Koha/Schema/Result/Discharge.pm @@ -0,0 +1,91 @@ +use utf8; +package Koha::Schema::Result::Discharge; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::Discharge + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("discharges"); + +=head1 ACCESSORS + +=head2 borrower + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 1 + +=head2 needed + + data_type: 'timestamp' + datetime_undef_if_invalid: 1 + is_nullable: 1 + +=head2 validated + + data_type: 'timestamp' + datetime_undef_if_invalid: 1 + is_nullable: 1 + +=cut + +__PACKAGE__->add_columns( + "borrower", + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, + "needed", + { + data_type => "timestamp", + datetime_undef_if_invalid => 1, + is_nullable => 1, + }, + "validated", + { + data_type => "timestamp", + datetime_undef_if_invalid => 1, + is_nullable => 1, + }, +); + +=head1 RELATIONS + +=head2 borrower + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "borrower", + "Koha::Schema::Result::Borrower", + { borrowernumber => "borrower" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "CASCADE", + on_update => "CASCADE", + }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-01-08 18:15:13 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:uq7Zb0SNf2mD3cpC4oub9A + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; --