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

(-)a/C4/Circulation.pm (-2 / +24 lines)
Lines 2951-2958 sub AddRenewal { Link Here
2951
        DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' });
2951
        DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' });
2952
    }
2952
    }
2953
2953
2954
    unless ( C4::Context->interface eq 'opac' ) { #if from opac we are obeying OpacRenewalBranch as calculated in opac-renew.pl
2954
    # If from opac we are obeying OpacRenewalBranch as calculated in opac-renew.pl
2955
        $branch = C4::Context->userenv ? C4::Context->userenv->{branch} : $branch;
2955
    if ( C4::Context->interface eq 'opac' ) {
2956
        my $renewalbranch = C4::Context->preference('OpacRenewalBranch');
2957
        if ( $renewalbranch eq 'itemhomebranch' ) {
2958
            my $item = Koha::Items->find($itemnumber);
2959
            $branch = $item->homebranch;
2960
        }
2961
        elsif ( $renewalbranch eq 'patronhomebranch' ) {
2962
            $branch = Koha::Patrons->find( $borrowernumber )->branchcode;
2963
        }
2964
        elsif ( $renewalbranch eq 'checkoutbranch' ) {
2965
            my $issue = GetOpenIssue($itemnumber); # FIXME Should not be $item->checkout?
2966
            $branch = $issue->{'branchcode'};
2967
        }
2968
        elsif ( $renewalbranch eq 'NULL' ) {
2969
            $branch = '';
2970
        }
2971
        else {
2972
            $branch = 'OPACRenew';
2973
        }
2974
    }
2975
    else {
2976
        $branch =
2977
          C4::Context->userenv ? C4::Context->userenv->{branch} : $branch;
2956
    }
2978
    }
2957
2979
2958
    # Add the renewal to stats
2980
    # Add the renewal to stats
(-)a/opac/opac-renew.pl (-21 / +1 lines)
Lines 63-88 else { Link Here
63
        my ( $status, $error ) =
63
        my ( $status, $error ) =
64
          CanBookBeRenewed( $borrowernumber, $itemnumber );
64
          CanBookBeRenewed( $borrowernumber, $itemnumber );
65
        if ( $status == 1 && $opacrenew == 1 ) {
65
        if ( $status == 1 && $opacrenew == 1 ) {
66
            my $renewalbranch = C4::Context->preference('OpacRenewalBranch');
66
            AddRenewal( $borrowernumber, $itemnumber );
67
            my $branchcode;
68
            if ( $renewalbranch eq 'itemhomebranch' ) {
69
                my $item = Koha::Items->find($itemnumber);
70
                $branchcode = $item->homebranch;
71
            }
72
            elsif ( $renewalbranch eq 'patronhomebranch' ) {
73
                $branchcode = Koha::Patrons->find( $borrowernumber )->branchcode;
74
            }
75
            elsif ( $renewalbranch eq 'checkoutbranch' ) {
76
                my $issue = GetOpenIssue($itemnumber); # FIXME Should not be $item->checkout?
77
                $branchcode = $issue->{'branchcode'};
78
            }
79
            elsif ( $renewalbranch eq 'NULL' ) {
80
                $branchcode = '';
81
            }
82
            else {
83
                $branchcode = 'OPACRenew';
84
            }
85
            AddRenewal( $borrowernumber, $itemnumber, $branchcode, undef, undef );
86
            push( @renewed, $itemnumber );
67
            push( @renewed, $itemnumber );
87
        }
68
        }
88
        else {
69
        else {
89
- 

Return to bug 23165