View | Details | Raw Unified | Return to bug 33641
Collapse All | Expand All

(-)a/C4/Circulation.pm (-1 / +1 lines)
Lines 2646-2652 sub MarkIssueReturned { Link Here
2646
            $issue->returndate( \'NOW()' )->store->discard_changes; # update and refetch
2646
            $issue->returndate( \'NOW()' )->store->discard_changes; # update and refetch
2647
        }
2647
        }
2648
2648
2649
        $issue->return_branch(C4::Context->userenv->{'branch'});
2649
        $issue->checkin_library(C4::Context->userenv->{'branch'});
2650
        # Create the old_issues entry
2650
        # Create the old_issues entry
2651
        my $old_checkout = Koha::Old::Checkout->new($issue->unblessed)->store;
2651
        my $old_checkout = Koha::Old::Checkout->new($issue->unblessed)->store;
2652
2652
(-)a/installer/data/mysql/atomicupdate/bug_33641.pl (-7 / +7 lines)
Lines 3-34 use Koha::Installer::Output qw(say_warning say_failure say_success say_info); Link Here
3
3
4
return {
4
return {
5
    bug_number  => "33641",
5
    bug_number  => "33641",
6
    description => "Added issues.return_branch and old_issues.return_branch",
6
    description => "Added issues.checkin_library and old_issues.checkin_library",
7
    up          => sub {
7
    up          => sub {
8
        my ($args) = @_;
8
        my ($args) = @_;
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
10
10
11
        if ( !column_exists( 'issues', 'return_branch' ) ) {
11
        if ( !column_exists( 'issues', 'checkin_library' ) ) {
12
            $dbh->do(
12
            $dbh->do(
13
                q{
13
                q{
14
                ALTER TABLE issues
14
                ALTER TABLE issues
15
                ADD COLUMN return_branch varchar(10) DEFAULT NULL
15
                ADD COLUMN checkin_library varchar(10) DEFAULT NULL
16
                COMMENT 'foreign key, linking to the branches table for the location the item was returned'
16
                COMMENT 'foreign key, linking to the branches table for the location the item was returned'
17
                AFTER returndate
17
                AFTER returndate
18
             }
18
             }
19
            );
19
            );
20
            say_success( $out, "Added column 'issues.return_branch'" );
20
            say_success( $out, "Added column 'issues.checkin_library'" );
21
        }
21
        }
22
        if ( !column_exists( 'old_issues', 'return_branch' ) ) {
22
        if ( !column_exists( 'old_issues', 'checkin_library' ) ) {
23
            $dbh->do(
23
            $dbh->do(
24
                q{
24
                q{
25
                ALTER TABLE old_issues
25
                ALTER TABLE old_issues
26
                ADD COLUMN return_branch varchar(10) DEFAULT NULL
26
                ADD COLUMN checkin_library varchar(10) DEFAULT NULL
27
                COMMENT 'foreign key, linking to the branches table for the location the item was returned'
27
                COMMENT 'foreign key, linking to the branches table for the location the item was returned'
28
                AFTER returndate
28
                AFTER returndate
29
             }
29
             }
30
            );
30
            );
31
            say_success( $out, "Added column 'old_issues.return_branch'" );
31
            say_success( $out, "Added column 'old_issues.checkin_library'" );
32
        }
32
        }
33
33
34
    },
34
    },
(-)a/installer/data/mysql/kohastructure.sql (-2 / +2 lines)
Lines 3896-3902 CREATE TABLE `issues` ( Link Here
3896
  `date_due` datetime DEFAULT NULL COMMENT 'datetime the item is due (yyyy-mm-dd hh:mm::ss)',
3896
  `date_due` datetime DEFAULT NULL COMMENT 'datetime the item is due (yyyy-mm-dd hh:mm::ss)',
3897
  `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was checked out',
3897
  `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was checked out',
3898
  `returndate` datetime DEFAULT NULL COMMENT 'date the item was returned, will be NULL until moved to old_issues',
3898
  `returndate` datetime DEFAULT NULL COMMENT 'date the item was returned, will be NULL until moved to old_issues',
3899
  `return_branch` varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was returned',
3899
  `checkin_library` varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was returned',
3900
  `lastreneweddate` datetime DEFAULT NULL COMMENT 'date the item was last renewed',
3900
  `lastreneweddate` datetime DEFAULT NULL COMMENT 'date the item was last renewed',
3901
  `renewals_count` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of times the item was renewed',
3901
  `renewals_count` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of times the item was renewed',
3902
  `unseen_renewals` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of consecutive times the item was renewed without being seen',
3902
  `unseen_renewals` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of consecutive times the item was renewed without being seen',
Lines 4986-4992 CREATE TABLE `old_issues` ( Link Here
4986
  `date_due` datetime DEFAULT NULL COMMENT 'date the item is due (yyyy-mm-dd)',
4986
  `date_due` datetime DEFAULT NULL COMMENT 'date the item is due (yyyy-mm-dd)',
4987
  `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was checked out',
4987
  `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was checked out',
4988
  `returndate` datetime DEFAULT NULL COMMENT 'date the item was returned',
4988
  `returndate` datetime DEFAULT NULL COMMENT 'date the item was returned',
4989
  `return_branch` varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was returned',
4989
  `checkin_library` varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was returned',
4990
  `lastreneweddate` datetime DEFAULT NULL COMMENT 'date the item was last renewed',
4990
  `lastreneweddate` datetime DEFAULT NULL COMMENT 'date the item was last renewed',
4991
  `renewals_count` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of times the item was renewed',
4991
  `renewals_count` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of times the item was renewed',
4992
  `unseen_renewals` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of consecutive times the item was renewed without being seen',
4992
  `unseen_renewals` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of consecutive times the item was renewed without being seen',
(-)a/t/db_dependent/Circulation/MarkIssueReturned.t (-3 / +2 lines)
Lines 305-311 subtest 'AutoRemoveOverduesRestrictions' => sub { Link Here
305
    $schema->storage->txn_rollback;
305
    $schema->storage->txn_rollback;
306
};
306
};
307
307
308
subtest 'Pass return_branch to old_issues' => sub {
308
subtest 'Pass checkin_library to old_issues' => sub {
309
    plan tests => 2;
309
    plan tests => 2;
310
310
311
    $schema->storage->txn_begin;
311
    $schema->storage->txn_begin;
Lines 330-336 subtest 'Pass return_branch to old_issues' => sub { Link Here
330
330
331
    is( $issue_id, $issue->issue_id, 'Item has been returned' );
331
    is( $issue_id, $issue->issue_id, 'Item has been returned' );
332
    my $old_issue = Koha::Old::Checkouts->find( $issue_id );
332
    my $old_issue = Koha::Old::Checkouts->find( $issue_id );
333
    is( $old_issue->return_branch, $library->branchcode, 'Return branch is passed correctly' );
333
    is( $old_issue->checkin_library, $library->branchcode, 'Return branch is passed correctly' );
334
334
335
    $schema->storage->txn_rollback
335
    $schema->storage->txn_rollback
336
};
336
};
337
- 

Return to bug 33641