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

(-)a/C4/Circulation.pm (-6 / +30 lines)
Lines 1132-1138 Returns: Link Here
1132
1132
1133
=item C<$returnallowed> is 0 or 1, corresponding to whether the return is allowed (1) or not (0)
1133
=item C<$returnallowed> is 0 or 1, corresponding to whether the return is allowed (1) or not (0)
1134
1134
1135
=item C<$message> is the branchcode where the item SHOULD be returned, if the return is not allowed
1135
=item C<$message> is a HASHref of following possible keys:
1136
1137
C<toBranch> branchcode where the item SHOULD be returned, if the return is not allowed
1138
C<transferLimit> transfer limit exists, HASHref of following keys: C<from>, C<to>
1136
1139
1137
=back
1140
=back
1138
1141
Lines 1144-1161 sub CanBookBeReturned { Link Here
1144
1147
1145
    # assume return is allowed to start
1148
    # assume return is allowed to start
1146
    my $allowed = 1;
1149
    my $allowed = 1;
1150
    my $to_branch = $branch;
1147
    my $message;
1151
    my $message;
1148
1152
1149
    # identify all cases where return is forbidden
1153
    # identify all cases where return is forbidden
1150
    if ($allowreturntobranch eq 'homebranch' && $branch ne $item->homebranch) {
1154
    if ($allowreturntobranch eq 'homebranch' && $branch ne $item->homebranch) {
1151
        $allowed = 0;
1155
        $allowed = 0;
1152
        $message = $item->homebranch;
1156
        $message->{toBranch} = $to_branch = $item->homebranch;
1153
    } elsif ($allowreturntobranch eq 'holdingbranch' && $branch ne $item->holdingbranch) {
1157
    } elsif ($allowreturntobranch eq 'holdingbranch' && $branch ne $item->holdingbranch) {
1154
        $allowed = 0;
1158
        $allowed = 0;
1155
        $message = $item->holdingbranch;
1159
        $message->{toBranch} = $to_branch = $item->holdingbranch;
1156
    } elsif ($allowreturntobranch eq 'homeorholdingbranch' && $branch ne $item->homebranch && $branch ne $item->holdingbranch) {
1160
    } elsif ($allowreturntobranch eq 'homeorholdingbranch' && $branch ne $item->homebranch && $branch ne $item->holdingbranch) {
1157
        $allowed = 0;
1161
        $allowed = 0;
1158
        $message = $item->homebranch; # FIXME: choice of homebranch is arbitrary
1162
        $message->{toBranch} = $to_branch = $item->homebranch; # FIXME: choice of homebranch is arbitrary
1163
    }
1164
1165
    # Make sure there are no branch transfer limits between item's current
1166
    # branch (holdinbranch) and the return branch
1167
    my $to_library = Koha::Libraries->find($to_branch);
1168
    if (!$item->can_be_transferred({ to => $to_library })) {
1169
        $allowed = 0;
1170
        $message->{transferLimit} = {
1171
            from => $item->holdingbranch,
1172
            to   => $to_branch
1173
        };
1159
    }
1174
    }
1160
1175
1161
    return ($allowed, $message);
1176
    return ($allowed, $message);
Lines 1803-1808 This book has was returned to the wrong branch. The value is a hashref Link Here
1803
so that C<$messages->{Wrongbranch}->{Wrongbranch}> and C<$messages->{Wrongbranch}->{Rightbranch}>
1818
so that C<$messages->{Wrongbranch}->{Wrongbranch}> and C<$messages->{Wrongbranch}->{Rightbranch}>
1804
contain the branchcode of the incorrect and correct return library, respectively.
1819
contain the branchcode of the incorrect and correct return library, respectively.
1805
1820
1821
=item C<Transferlimit>
1822
1823
A transfer limit exists between item's holding branch and the return branch.
1824
1806
=item C<ResFound>
1825
=item C<ResFound>
1807
1826
1808
The item was reserved. The value is a reference-to-hash whose keys are
1827
The item was reserved. The value is a reference-to-hash whose keys are
Lines 1928-1935 sub AddReturn { Link Here
1928
    unless ($returnallowed){
1947
    unless ($returnallowed){
1929
        $messages->{'Wrongbranch'} = {
1948
        $messages->{'Wrongbranch'} = {
1930
            Wrongbranch => $branch,
1949
            Wrongbranch => $branch,
1931
            Rightbranch => $message
1950
            Rightbranch => $message->{toBranch}
1932
        };
1951
        } if $message->{toBranch};
1952
1953
        if ($message->{'transferLimit'}) {
1954
            $messages->{'Transferlimit'} = $message->{'transferLimit'};
1955
        }
1956
1933
        $doreturn = 0;
1957
        $doreturn = 0;
1934
        return ( $doreturn, $messages, $issue, $patron_unblessed);
1958
        return ( $doreturn, $messages, $issue, $patron_unblessed);
1935
    }
1959
    }
(-)a/C4/SIP/ILS/Transaction/Checkin.pm (+3 lines)
Lines 96-101 sub do_checkin { Link Here
96
        $self->{item}->destination_loc($messages->{Wrongbranch}->{Rightbranch});
96
        $self->{item}->destination_loc($messages->{Wrongbranch}->{Rightbranch});
97
        $self->alert_type('04');            # send to other branch
97
        $self->alert_type('04');            # send to other branch
98
    }
98
    }
99
    if ($messages->{Transferlimit}) {
100
        $self->alert_type('04');
101
    }
99
    if ($messages->{WrongTransfer}) {
102
    if ($messages->{WrongTransfer}) {
100
        $self->{item}->destination_loc($messages->{WrongTransfer});
103
        $self->{item}->destination_loc($messages->{WrongTransfer});
101
        $self->alert_type('04');            # send to other branch
104
        $self->alert_type('04');            # send to other branch
(-)a/circ/returns.pl (+3 lines)
Lines 521-526 foreach my $code ( keys %$messages ) { Link Here
521
    }
521
    }
522
    elsif ( $code eq 'Wrongbranch' ) {
522
    elsif ( $code eq 'Wrongbranch' ) {
523
    }
523
    }
524
    elsif ( $code eq 'Transferlimit' ) {
525
        $err{transferlimit} = $messages->{'Transferlimit'};
526
    }
524
    elsif ( $code eq 'Debarred' ) {
527
    elsif ( $code eq 'Debarred' ) {
525
        $err{debarred}            = $messages->{'Debarred'};
528
        $err{debarred}            = $messages->{'Debarred'};
526
        $err{debarcardnumber}     = $borrower->{cardnumber};
529
        $err{debarcardnumber}     = $borrower->{cardnumber};
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt (-1 / +3 lines)
Lines 611-616 Link Here
611
                                        [% END %]
611
                                        [% END %]
612
                                       <p class="problem">Item is withdrawn.</p>
612
                                       <p class="problem">Item is withdrawn.</p>
613
                                    [% END %]
613
                                    [% END %]
614
                                    [% IF ( errmsgloo.transferlimit ) %]
615
                                        <p class="problem">Transfer is forbidden between [% Branches.GetName( holdingbranch ) %] (item's current library) and [% LoginBranchname | html %].</p>
616
                                    [% END %]
614
                                    [% IF ( errmsgloo.debarred ) %]
617
                                    [% IF ( errmsgloo.debarred ) %]
615
                                        <p class="problem"><a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% errmsgloo.debarborrowernumber | uri %]">[% errmsgloo.debarname | html %]([% errmsgloo.debarcardnumber | html %])</a> is now debarred until [% errmsgloo.debarred | $KohaDates %].</p>
618
                                        <p class="problem"><a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% errmsgloo.debarborrowernumber | uri %]">[% errmsgloo.debarname | html %]([% errmsgloo.debarcardnumber | html %])</a> is now debarred until [% errmsgloo.debarred | $KohaDates %].</p>
616
                                    [% END %]
619
                                    [% END %]
617
- 

Return to bug 7376