From 089d43eb1f901e192200a8e67d9b86c4a023c710 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 14 Nov 2024 12:39:49 +0000 Subject: [PATCH] Bug 33641: (follow-up) Change return_branch to checkin_library --- C4/Circulation.pm | 2 +- installer/data/mysql/atomicupdate/bug_33641.pl | 14 +++++++------- installer/data/mysql/kohastructure.sql | 4 ++-- t/db_dependent/Circulation/MarkIssueReturned.t | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 54d2feafa13..b9b66974bec 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2646,7 +2646,7 @@ sub MarkIssueReturned { $issue->returndate( \'NOW()' )->store->discard_changes; # update and refetch } - $issue->return_branch(C4::Context->userenv->{'branch'}); + $issue->checkin_library(C4::Context->userenv->{'branch'}); # Create the old_issues entry my $old_checkout = Koha::Old::Checkout->new($issue->unblessed)->store; diff --git a/installer/data/mysql/atomicupdate/bug_33641.pl b/installer/data/mysql/atomicupdate/bug_33641.pl index e738d50a0a0..fd51c2c1dfc 100755 --- a/installer/data/mysql/atomicupdate/bug_33641.pl +++ b/installer/data/mysql/atomicupdate/bug_33641.pl @@ -3,32 +3,32 @@ use Koha::Installer::Output qw(say_warning say_failure say_success say_info); return { bug_number => "33641", - description => "Added issues.return_branch and old_issues.return_branch", + description => "Added issues.checkin_library and old_issues.checkin_library", up => sub { my ($args) = @_; my ( $dbh, $out ) = @$args{qw(dbh out)}; - if ( !column_exists( 'issues', 'return_branch' ) ) { + if ( !column_exists( 'issues', 'checkin_library' ) ) { $dbh->do( q{ ALTER TABLE issues - ADD COLUMN return_branch varchar(10) DEFAULT NULL + ADD COLUMN checkin_library varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was returned' AFTER returndate } ); - say_success( $out, "Added column 'issues.return_branch'" ); + say_success( $out, "Added column 'issues.checkin_library'" ); } - if ( !column_exists( 'old_issues', 'return_branch' ) ) { + if ( !column_exists( 'old_issues', 'checkin_library' ) ) { $dbh->do( q{ ALTER TABLE old_issues - ADD COLUMN return_branch varchar(10) DEFAULT NULL + ADD COLUMN checkin_library varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was returned' AFTER returndate } ); - say_success( $out, "Added column 'old_issues.return_branch'" ); + say_success( $out, "Added column 'old_issues.checkin_library'" ); } }, diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index fd383530d29..14f15502d27 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -3896,7 +3896,7 @@ CREATE TABLE `issues` ( `date_due` datetime DEFAULT NULL COMMENT 'datetime the item is due (yyyy-mm-dd hh:mm::ss)', `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was checked out', `returndate` datetime DEFAULT NULL COMMENT 'date the item was returned, will be NULL until moved to old_issues', - `return_branch` varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was returned', + `checkin_library` varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was returned', `lastreneweddate` datetime DEFAULT NULL COMMENT 'date the item was last renewed', `renewals_count` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of times the item was renewed', `unseen_renewals` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of consecutive times the item was renewed without being seen', @@ -4986,7 +4986,7 @@ CREATE TABLE `old_issues` ( `date_due` datetime DEFAULT NULL COMMENT 'date the item is due (yyyy-mm-dd)', `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was checked out', `returndate` datetime DEFAULT NULL COMMENT 'date the item was returned', - `return_branch` varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was returned', + `checkin_library` varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was returned', `lastreneweddate` datetime DEFAULT NULL COMMENT 'date the item was last renewed', `renewals_count` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of times the item was renewed', `unseen_renewals` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of consecutive times the item was renewed without being seen', diff --git a/t/db_dependent/Circulation/MarkIssueReturned.t b/t/db_dependent/Circulation/MarkIssueReturned.t index a744e1a5d5a..7f76a40a616 100755 --- a/t/db_dependent/Circulation/MarkIssueReturned.t +++ b/t/db_dependent/Circulation/MarkIssueReturned.t @@ -305,7 +305,7 @@ subtest 'AutoRemoveOverduesRestrictions' => sub { $schema->storage->txn_rollback; }; -subtest 'Pass return_branch to old_issues' => sub { +subtest 'Pass checkin_library to old_issues' => sub { plan tests => 2; $schema->storage->txn_begin; @@ -330,7 +330,7 @@ subtest 'Pass return_branch to old_issues' => sub { is( $issue_id, $issue->issue_id, 'Item has been returned' ); my $old_issue = Koha::Old::Checkouts->find( $issue_id ); - is( $old_issue->return_branch, $library->branchcode, 'Return branch is passed correctly' ); + is( $old_issue->checkin_library, $library->branchcode, 'Return branch is passed correctly' ); $schema->storage->txn_rollback }; -- 2.39.5