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

(-)a/C4/Circulation.pm (-2 / +24 lines)
Lines 2923-2930 sub AddRenewal { Link Here
2923
        DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' });
2923
        DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' });
2924
    }
2924
    }
2925
2925
2926
    unless ( C4::Context->interface eq 'opac' ) { #if from opac we are obeying OpacRenewalBranch as calculated in opac-renew.pl
2926
    # If from opac we are obeying OpacRenewalBranch as calculated in opac-renew.pl
2927
        $branch = C4::Context->userenv ? C4::Context->userenv->{branch} : $branch;
2927
    if ( C4::Context->interface eq 'opac' ) {
2928
        my $renewalbranch = C4::Context->preference('OpacRenewalBranch');
2929
        if ( $renewalbranch eq 'itemhomebranch' ) {
2930
            my $item = GetItem($itemnumber);
2931
            $branchcode = $item->{'homebranch'};
2932
        }
2933
        elsif ( $renewalbranch eq 'patronhomebranch' ) {
2934
            $branchcode = Koha::Patrons->find($borrowernumber)->branchcode;
2935
        }
2936
        elsif ( $renewalbranch eq 'checkoutbranch' ) {
2937
            my $issue = GetOpenIssue($itemnumber);
2938
            $branchcode = $issue->{'branchcode'};
2939
        }
2940
        elsif ( $renewalbranch eq 'NULL' ) {
2941
            $branchcode = '';
2942
        }
2943
        else {
2944
            $branchcode = 'OPACRenew';
2945
        }
2946
    }
2947
    else {
2948
        $branch =
2949
          C4::Context->userenv ? C4::Context->userenv->{branch} : $branch;
2928
    }
2950
    }
2929
2951
2930
    # Add the renewal to stats
2952
    # Add the renewal to stats
(-)a/opac/opac-renew.pl (-21 / +1 lines)
Lines 62-87 else { Link Here
62
        my ( $status, $error ) =
62
        my ( $status, $error ) =
63
          CanBookBeRenewed( $borrowernumber, $itemnumber );
63
          CanBookBeRenewed( $borrowernumber, $itemnumber );
64
        if ( $status == 1 && $opacrenew == 1 ) {
64
        if ( $status == 1 && $opacrenew == 1 ) {
65
            my $renewalbranch = C4::Context->preference('OpacRenewalBranch');
65
            AddRenewal( $borrowernumber, $itemnumber );
66
            my $branchcode;
67
            if ( $renewalbranch eq 'itemhomebranch' ) {
68
                my $item = GetItem($itemnumber);
69
                $branchcode = $item->{'homebranch'};
70
            }
71
            elsif ( $renewalbranch eq 'patronhomebranch' ) {
72
                $branchcode = Koha::Patrons->find( $borrowernumber )->branchcode;
73
            }
74
            elsif ( $renewalbranch eq 'checkoutbranch' ) {
75
                my $issue = GetOpenIssue($itemnumber);
76
                $branchcode = $issue->{'branchcode'};
77
            }
78
            elsif ( $renewalbranch eq 'NULL' ) {
79
                $branchcode = '';
80
            }
81
            else {
82
                $branchcode = 'OPACRenew';
83
            }
84
            AddRenewal( $borrowernumber, $itemnumber, $branchcode, undef, undef );
85
            push( @renewed, $itemnumber );
66
            push( @renewed, $itemnumber );
86
        }
67
        }
87
        else {
68
        else {
88
- 

Return to bug 23165