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

(-)a/C4/Circulation.pm (-8 / +164 lines)
Lines 2664-2669 sub CanBookBeRenewed { Link Here
2664
                    'no_auto_renewal_after_hard_limit',
2664
                    'no_auto_renewal_after_hard_limit',
2665
                    'lengthunit',
2665
                    'lengthunit',
2666
                    'norenewalbefore',
2666
                    'norenewalbefore',
2667
                    'unseen_renewals_allowed'
2667
                ]
2668
                ]
2668
            }
2669
            }
2669
        );
2670
        );
Lines 2836-2847 sub CanBookBeRenewed { Link Here
2836
    return ( 0, "on_reserve" ) if $resfound;    # '' when no hold was found
2837
    return ( 0, "on_reserve" ) if $resfound;    # '' when no hold was found
2837
    return ( 0, "auto_renew" ) if $auto_renew && !$override_limit; # 0 if auto-renewal should not succeed
2838
    return ( 0, "auto_renew" ) if $auto_renew && !$override_limit; # 0 if auto-renewal should not succeed
2838
2839
2840
    return ( 1, undef ) if $override_limit;
2841
2842
    my $branchcode = _GetCircControlBranch( $item->unblessed, $patron->unblessed );
2843
    my $issuing_rule = Koha::CirculationRules->get_effective_rules(
2844
        {
2845
            categorycode => $patron->categorycode,
2846
            itemtype     => $item->effective_itemtype,
2847
            branchcode   => $branchcode,
2848
            rules => [
2849
                'renewalsallowed',
2850
                'no_auto_renewal_after',
2851
                'no_auto_renewal_after_hard_limit',
2852
                'lengthunit',
2853
                'norenewalbefore',
2854
                'unseen_renewals_allowed'
2855
            ]
2856
        }
2857
    );
2858
2859
    return ( 0, "too_many" )
2860
      if not $issuing_rule->{renewalsallowed} or $issuing_rule->{renewalsallowed} <= $issue->renewals;
2861
2862
    return ( 0, "too_unseen" )
2863
      if C4::Context->preference('UnseenRenewals') &&
2864
        $issuing_rule->{unseen_renewals_allowed} &&
2865
        $issuing_rule->{unseen_renewals_allowed} <= $issue->unseen_renewals;
2866
2867
    my $overduesblockrenewing = C4::Context->preference('OverduesBlockRenewing');
2868
    my $restrictionblockrenewing = C4::Context->preference('RestrictionBlockRenewing');
2869
    $patron         = Koha::Patrons->find($borrowernumber); # FIXME Is this really useful?
2870
    my $restricted  = $patron->is_debarred;
2871
    my $hasoverdues = $patron->has_overdues;
2872
2873
    if ( $restricted and $restrictionblockrenewing ) {
2874
        return ( 0, 'restriction');
2875
    } elsif ( ($hasoverdues and $overduesblockrenewing eq 'block') || ($issue->is_overdue and $overduesblockrenewing eq 'blockitem') ) {
2876
        return ( 0, 'overdue');
2877
    }
2878
2879
    if ( $issue->auto_renew ) {
2880
2881
        if ( $patron->category->effective_BlockExpiredPatronOpacActions and $patron->is_expired ) {
2882
            return ( 0, 'auto_account_expired' );
2883
        }
2884
2885
        if ( defined $issuing_rule->{no_auto_renewal_after}
2886
                and $issuing_rule->{no_auto_renewal_after} ne "" ) {
2887
            # Get issue_date and add no_auto_renewal_after
2888
            # If this is greater than today, it's too late for renewal.
2889
            my $maximum_renewal_date = dt_from_string($issue->issuedate, 'sql');
2890
            $maximum_renewal_date->add(
2891
                $issuing_rule->{lengthunit} => $issuing_rule->{no_auto_renewal_after}
2892
            );
2893
            my $now = dt_from_string;
2894
            if ( $now >= $maximum_renewal_date ) {
2895
                return ( 0, "auto_too_late" );
2896
            }
2897
        }
2898
        if ( defined $issuing_rule->{no_auto_renewal_after_hard_limit}
2899
                      and $issuing_rule->{no_auto_renewal_after_hard_limit} ne "" ) {
2900
            # If no_auto_renewal_after_hard_limit is >= today, it's also too late for renewal
2901
            if ( dt_from_string >= dt_from_string( $issuing_rule->{no_auto_renewal_after_hard_limit} ) ) {
2902
                return ( 0, "auto_too_late" );
2903
            }
2904
        }
2905
2906
        if ( C4::Context->preference('OPACFineNoRenewalsBlockAutoRenew') ) {
2907
            my $fine_no_renewals = C4::Context->preference("OPACFineNoRenewals");
2908
            my $amountoutstanding =
2909
              C4::Context->preference("OPACFineNoRenewalsIncludeCredit")
2910
              ? $patron->account->balance
2911
              : $patron->account->outstanding_debits->total_outstanding;
2912
            if ( $amountoutstanding and $amountoutstanding > $fine_no_renewals ) {
2913
                return ( 0, "auto_too_much_oweing" );
2914
            }
2915
        }
2916
    }
2917
2918
    if ( defined $issuing_rule->{norenewalbefore}
2919
        and $issuing_rule->{norenewalbefore} ne "" )
2920
    {
2921
2922
        # Calculate soonest renewal by subtracting 'No renewal before' from due date
2923
        my $soonestrenewal = dt_from_string( $issue->date_due, 'sql' )->subtract(
2924
            $issuing_rule->{lengthunit} => $issuing_rule->{norenewalbefore} );
2925
2926
        # Depending on syspref reset the exact time, only check the date
2927
        if ( C4::Context->preference('NoRenewalBeforePrecision') eq 'date'
2928
            and $issuing_rule->{lengthunit} eq 'days' )
2929
        {
2930
            $soonestrenewal->truncate( to => 'day' );
2931
        }
2932
2933
        if ( $soonestrenewal > DateTime->now( time_zone => C4::Context->tz() ) )
2934
        {
2935
            return ( 0, "auto_too_soon" ) if $issue->auto_renew;
2936
            return ( 0, "too_soon" );
2937
        }
2938
        elsif ( $issue->auto_renew ) {
2939
            return ( 0, "auto_renew" );
2940
        }
2941
    }
2942
2943
    # Fallback for automatic renewals:
2944
    # If norenewalbefore is undef, don't renew before due date.
2945
    if ( $issue->auto_renew ) {
2946
        my $now = dt_from_string;
2947
        return ( 0, "auto_renew" )
2948
          if $now >= dt_from_string( $issue->date_due, 'sql' );
2949
        return ( 0, "auto_too_soon" );
2950
    }
2951
2839
    return ( 1, undef );
2952
    return ( 1, undef );
2840
}
2953
}
2841
2954
2842
=head2 AddRenewal
2955
=head2 AddRenewal
2843
2956
2844
  &AddRenewal($borrowernumber, $itemnumber, $branch, [$datedue], [$lastreneweddate]);
2957
  &AddRenewal($borrowernumber, $itemnumber, $branch, [$datedue], [$lastreneweddate], [$seen]);
2845
2958
2846
Renews a loan.
2959
Renews a loan.
2847
2960
Lines 2866-2871 syspref) Link Here
2866
If C<$datedue> is the empty string, C<&AddRenewal> will calculate the due date automatically
2979
If C<$datedue> is the empty string, C<&AddRenewal> will calculate the due date automatically
2867
from the book's item type.
2980
from the book's item type.
2868
2981
2982
C<$seen> is a boolean flag indicating if the item was seen or not during the renewal. This
2983
informs the incrementing of the unseen_renewals column. If this flag is not supplied, we
2984
fallback to a true value
2985
2869
=cut
2986
=cut
2870
2987
2871
sub AddRenewal {
2988
sub AddRenewal {
Lines 2875-2880 sub AddRenewal { Link Here
2875
    my $datedue         = shift;
2992
    my $datedue         = shift;
2876
    my $lastreneweddate = shift || dt_from_string();
2993
    my $lastreneweddate = shift || dt_from_string();
2877
    my $skipfinecalc    = shift;
2994
    my $skipfinecalc    = shift;
2995
    my $seen            = shift;
2996
2997
    # Fallback on a 'seen' renewal
2998
    $seen = defined $seen && $seen == 0 ? 0 : 1;
2878
2999
2879
    my $item_object   = Koha::Items->find($itemnumber) or return;
3000
    my $item_object   = Koha::Items->find($itemnumber) or return;
2880
    my $biblio = $item_object->biblio;
3001
    my $biblio = $item_object->biblio;
Lines 2927-2941 sub AddRenewal { Link Here
2927
            }
3048
            }
2928
        );
3049
        );
2929
3050
3051
        # Increment the unseen renewals, if appropriate
3052
        # We only do so if the syspref is enabled and
3053
        # a maximum value has been set in the circ rules
3054
        my $unseen_renewals = $issue->unseen_renewals;
3055
        if (C4::Context->preference('UnseenRenewals')) {
3056
            my $rule = Koha::CirculationRules->get_effective_rule(
3057
                {   categorycode => $patron->categorycode,
3058
                    itemtype     => $item_object->effective_itemtype,
3059
                    branchcode   => $circ_library->branchcode,
3060
                    rule_name    => 'unseen_renewals_allowed'
3061
                }
3062
            );
3063
            if (!$seen && $rule && $rule->rule_value) {
3064
                $unseen_renewals++;
3065
            } else {
3066
                # If the renewal is seen, unseen should revert to 0
3067
                $unseen_renewals = 0;
3068
            }
3069
        }
3070
2930
        # Update the issues record to have the new due date, and a new count
3071
        # Update the issues record to have the new due date, and a new count
2931
        # of how many times it has been renewed.
3072
        # of how many times it has been renewed.
2932
        my $renews = ( $issue->renewals || 0 ) + 1;
3073
        my $renews = ( $issue->renewals || 0 ) + 1;
2933
        my $sth = $dbh->prepare("UPDATE issues SET date_due = ?, renewals = ?, lastreneweddate = ?
3074
        my $sth = $dbh->prepare("UPDATE issues SET date_due = ?, renewals = ?, unseen_renewals = ?, lastreneweddate = ?
2934
                                WHERE borrowernumber=?
3075
                                WHERE borrowernumber=?
2935
                                AND itemnumber=?"
3076
                                AND itemnumber=?"
2936
        );
3077
        );
2937
3078
2938
        $sth->execute( $datedue->strftime('%Y-%m-%d %H:%M'), $renews, $lastreneweddate, $borrowernumber, $itemnumber );
3079
        $sth->execute( $datedue->strftime('%Y-%m-%d %H:%M'), $renews, $unseen_renewals, $lastreneweddate, $borrowernumber, $itemnumber );
2939
3080
2940
        # Update the renewal count on the item, and tell zebra to reindex
3081
        # Update the renewal count on the item, and tell zebra to reindex
2941
        $renews = ( $item_object->renewals || 0 ) + 1;
3082
        $renews = ( $item_object->renewals || 0 ) + 1;
Lines 3022-3029 sub GetRenewCount { Link Here
3022
    my ( $bornum, $itemno ) = @_;
3163
    my ( $bornum, $itemno ) = @_;
3023
    my $dbh           = C4::Context->dbh;
3164
    my $dbh           = C4::Context->dbh;
3024
    my $renewcount    = 0;
3165
    my $renewcount    = 0;
3166
    my $unseencount    = 0;
3025
    my $renewsallowed = 0;
3167
    my $renewsallowed = 0;
3168
    my $unseenallowed = 0;
3026
    my $renewsleft    = 0;
3169
    my $renewsleft    = 0;
3170
    my $unseenleft    = 0;
3027
3171
3028
    my $patron = Koha::Patrons->find( $bornum );
3172
    my $patron = Koha::Patrons->find( $bornum );
3029
    my $item   = Koha::Items->find($itemno);
3173
    my $item   = Koha::Items->find($itemno);
Lines 3042-3063 sub GetRenewCount { Link Here
3042
    $sth->execute( $bornum, $itemno );
3186
    $sth->execute( $bornum, $itemno );
3043
    my $data = $sth->fetchrow_hashref;
3187
    my $data = $sth->fetchrow_hashref;
3044
    $renewcount = $data->{'renewals'} if $data->{'renewals'};
3188
    $renewcount = $data->{'renewals'} if $data->{'renewals'};
3189
    $unseencount = $data->{'unseen_renewals'} if $data->{'unseen_renewals'};
3045
    # $item and $borrower should be calculated
3190
    # $item and $borrower should be calculated
3046
    my $branchcode = _GetCircControlBranch($item->unblessed, $patron->unblessed);
3191
    my $branchcode = _GetCircControlBranch($item->unblessed, $patron->unblessed);
3047
3192
3048
    my $rule = Koha::CirculationRules->get_effective_rule(
3193
    my $rules = Koha::CirculationRules->get_effective_rules(
3049
        {
3194
        {
3050
            categorycode => $patron->categorycode,
3195
            categorycode => $patron->categorycode,
3051
            itemtype     => $item->effective_itemtype,
3196
            itemtype     => $item->effective_itemtype,
3052
            branchcode   => $branchcode,
3197
            branchcode   => $branchcode,
3053
            rule_name    => 'renewalsallowed',
3198
            rules        => [ 'renewalsallowed', 'unseen_renewals_allowed' ]
3054
        }
3199
        }
3055
    );
3200
    );
3056
3201
    $renewsallowed = $rules ? $rules->{renewalsallowed} : 0;
3057
    $renewsallowed = $rule ? $rule->rule_value : 0;
3202
    $unseenallowed = $rules->{unseen_renewals_allowed} ?
3203
        $rules->{unseen_renewals_allowed} :
3204
        0;
3058
    $renewsleft    = $renewsallowed - $renewcount;
3205
    $renewsleft    = $renewsallowed - $renewcount;
3206
    $unseenleft    = $unseenallowed - $unseencount;
3059
    if($renewsleft < 0){ $renewsleft = 0; }
3207
    if($renewsleft < 0){ $renewsleft = 0; }
3060
    return ( $renewcount, $renewsallowed, $renewsleft );
3208
    if($unseenleft < 0){ $unseenleft = 0; }
3209
    return (
3210
        $renewcount,
3211
        $renewsallowed,
3212
        $renewsleft,
3213
        $unseencount,
3214
        $unseenallowed,
3215
        $unseenleft
3216
    );
3061
}
3217
}
3062
3218
3063
=head2 GetSoonestRenewDate
3219
=head2 GetSoonestRenewDate
(-)a/C4/ILSDI/Services.pm (-1 / +1 lines)
Lines 655-661 sub RenewLoan { Link Here
655
655
656
    # Add renewal if possible
656
    # Add renewal if possible
657
    my @renewal = CanBookBeRenewed( $borrowernumber, $itemnumber );
657
    my @renewal = CanBookBeRenewed( $borrowernumber, $itemnumber );
658
    if ( $renewal[0] ) { AddRenewal( $borrowernumber, $itemnumber ); }
658
    if ( $renewal[0] ) { AddRenewal( $borrowernumber, $itemnumber, undef, undef, undef, 0 ); }
659
659
660
    my $issue = $item->checkout;
660
    my $issue = $item->checkout;
661
    return unless $issue; # FIXME should be handled
661
    return unless $issue; # FIXME should be handled
(-)a/C4/SIP/ILS/Transaction/Renew.pm (+1 lines)
Lines 51-56 sub do_renew_for { Link Here
51
    } else {
51
    } else {
52
        $renewerror=~s/on_reserve/Item unavailable due to outstanding holds/;
52
        $renewerror=~s/on_reserve/Item unavailable due to outstanding holds/;
53
        $renewerror=~s/too_many/Item has reached maximum renewals/;
53
        $renewerror=~s/too_many/Item has reached maximum renewals/;
54
        $renewerror=~s/too_unseen/Item has reached maximum consecutive renewals without being seen/;
54
        $renewerror=~s/item_denied_renewal/Item renewal is not allowed/;
55
        $renewerror=~s/item_denied_renewal/Item renewal is not allowed/;
55
        $self->screen_msg($renewerror);
56
        $self->screen_msg($renewerror);
56
        $self->renewal_ok(0);
57
        $self->renewal_ok(0);
(-)a/Koha/CirculationRules.pm (+3 lines)
Lines 148-153 our $RULE_KINDS = { Link Here
148
    renewalsallowed => {
148
    renewalsallowed => {
149
        scope => [ 'branchcode', 'categorycode', 'itemtype' ],
149
        scope => [ 'branchcode', 'categorycode', 'itemtype' ],
150
    },
150
    },
151
    unseen_renewals_allowed => {
152
        scope => [ 'branchcode', 'categorycode', 'itemtype' ],
153
    },
151
    rentaldiscount => {
154
    rentaldiscount => {
152
        scope => [ 'branchcode', 'categorycode', 'itemtype' ],
155
        scope => [ 'branchcode', 'categorycode', 'itemtype' ],
153
    },
156
    },
(-)a/Koha/REST/V1/Checkouts.pm (-1 / +10 lines)
Lines 146-151 sub renew { Link Here
146
    my $c = shift->openapi->valid_input or return;
146
    my $c = shift->openapi->valid_input or return;
147
147
148
    my $checkout_id = $c->validation->param('checkout_id');
148
    my $checkout_id = $c->validation->param('checkout_id');
149
    my $seen = $c->validation->param('seen') || 1;
149
    my $checkout = Koha::Checkouts->find( $checkout_id );
150
    my $checkout = Koha::Checkouts->find( $checkout_id );
150
151
151
    unless ($checkout) {
152
    unless ($checkout) {
Lines 169-175 sub renew { Link Here
169
            );
170
            );
170
        }
171
        }
171
172
172
        AddRenewal($borrowernumber, $itemnumber, $checkout->branchcode);
173
        AddRenewal(
174
            $borrowernumber,
175
            $itemnumber,
176
            $checkout->branchcode,
177
            undef,
178
            undef,
179
            $seen
180
        );
173
        $checkout = Koha::Checkouts->find($checkout_id);
181
        $checkout = Koha::Checkouts->find($checkout_id);
174
182
175
        $c->res->headers->location( $c->req->url->to_string );
183
        $c->res->headers->location( $c->req->url->to_string );
Lines 223-228 sub allows_renewal { Link Here
223
                allows_renewal => $renewable,
231
                allows_renewal => $renewable,
224
                max_renewals => $rule->rule_value,
232
                max_renewals => $rule->rule_value,
225
                current_renewals => $checkout->renewals,
233
                current_renewals => $checkout->renewals,
234
                unseen_renewals => $checkout->unseen_renewals,
226
                error => $error
235
                error => $error
227
            }
236
            }
228
        );
237
        );
(-)a/api/v1/swagger/definitions/checkout.json (+4 lines)
Lines 35-40 Link Here
35
      "type": ["integer", "null"],
35
      "type": ["integer", "null"],
36
      "description": "Number of renewals"
36
      "description": "Number of renewals"
37
    },
37
    },
38
    "unseen_renewals": {
39
      "type": ["integer", "null"],
40
      "description": "Number of consecutive unseen renewals"
41
    },
38
    "auto_renew": {
42
    "auto_renew": {
39
      "type": "boolean",
43
      "type": "boolean",
40
      "description": "Auto renewal"
44
      "description": "Auto renewal"
(-)a/api/v1/swagger/parameters.json (+3 lines)
Lines 35-40 Link Here
35
  "checkout_id_pp": {
35
  "checkout_id_pp": {
36
    "$ref": "parameters/checkout.json#/checkout_id_pp"
36
    "$ref": "parameters/checkout.json#/checkout_id_pp"
37
  },
37
  },
38
  "seen_pp": {
39
    "$ref": "parameters/checkout.json#/seen_pp"
40
  },
38
  "match": {
41
  "match": {
39
    "name": "_match",
42
    "name": "_match",
40
    "in": "query",
43
    "in": "query",
(-)a/api/v1/swagger/parameters/checkout.json (+7 lines)
Lines 5-9 Link Here
5
    "description": "Internal checkout identifier",
5
    "description": "Internal checkout identifier",
6
    "required": true,
6
    "required": true,
7
    "type": "integer"
7
    "type": "integer"
8
  },
9
  "seen_pp": {
10
    "name": "seen",
11
    "in": "query",
12
    "description": "Item was seen flag",
13
    "required": false,
14
    "type": "integer"
8
  }
15
  }
9
}
16
}
(-)a/api/v1/swagger/paths/checkouts.json (-3 / +4 lines)
Lines 81-89 Link Here
81
      "x-mojo-to": "Checkouts#renew",
81
      "x-mojo-to": "Checkouts#renew",
82
      "operationId": "renewCheckout",
82
      "operationId": "renewCheckout",
83
      "tags": ["patrons", "checkouts"],
83
      "tags": ["patrons", "checkouts"],
84
      "parameters": [{
84
      "parameters": [
85
        "$ref": "../parameters.json#/checkout_id_pp"
85
        { "$ref": "../parameters.json#/checkout_id_pp" },
86
      }],
86
        { "$ref": "../parameters.json#/seen_pp" }
87
      ],
87
      "produces": ["application/json"],
88
      "produces": ["application/json"],
88
      "responses": {
89
      "responses": {
89
        "201": {
90
        "201": {
(-)a/circ/renew.pl (-1 / +10 lines)
Lines 43-48 my ( $template, $librarian, $cookie, $flags ) = get_template_and_user( Link Here
43
my $schema = Koha::Database->new()->schema();
43
my $schema = Koha::Database->new()->schema();
44
44
45
my $barcode        = $cgi->param('barcode');
45
my $barcode        = $cgi->param('barcode');
46
my $unseen         = $cgi->param('unseen') || 0;
46
$barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespae
47
$barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespae
47
$barcode = barcodedecode($barcode) if( $barcode && C4::Context->preference('itemBarcodeInputFilter'));
48
$barcode = barcodedecode($barcode) if( $barcode && C4::Context->preference('itemBarcodeInputFilter'));
48
my $override_limit = $cgi->param('override_limit');
49
my $override_limit = $cgi->param('override_limit');
Lines 102-108 if ($barcode) { Link Here
102
                    if ( C4::Context->preference('SpecifyDueDate') && $hard_due_date ) {
103
                    if ( C4::Context->preference('SpecifyDueDate') && $hard_due_date ) {
103
                        $date_due = dt_from_string( $hard_due_date );
104
                        $date_due = dt_from_string( $hard_due_date );
104
                    }
105
                    }
105
                    $date_due = AddRenewal( undef, $item->itemnumber(), $branchcode, $date_due );
106
                    $date_due = AddRenewal(
107
                        undef,
108
                        $item->itemnumber(),
109
                        $branchcode,
110
                        $date_due,
111
                        undef,
112
                        undef,
113
                        !$unseen
114
                    );
106
                    $template->param( date_due => $date_due );
115
                    $template->param( date_due => $date_due );
107
                }
116
                }
108
            }
117
            }
(-)a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss (+12 lines)
Lines 1025-1030 div { Link Here
1025
        width: auto;
1025
        width: auto;
1026
    }
1026
    }
1027
1027
1028
    .renew_formfield {
1029
        margin-bottom: 1em;
1030
    }
1031
1028
    .circmessage {
1032
    .circmessage {
1029
        margin-bottom: .3em;
1033
        margin-bottom: .3em;
1030
        padding: 0 .4em .4em;
1034
        padding: 0 .4em .4em;
Lines 2482-2487 li { Link Here
2482
    position: relative;
2486
    position: relative;
2483
}
2487
}
2484
2488
2489
#renew_as_unseen_label {
2490
    margin-left: 1em;
2491
}
2492
2493
#renew_as_unseen_checkbox {
2494
    margin-right: 1em;
2495
}
2496
2485
#clearscreen {
2497
#clearscreen {
2486
    position: absolute;
2498
    position: absolute;
2487
    right: 0;
2499
    right: 0;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc (+4 lines)
Lines 48-53 Link Here
48
                        [% END %]
48
                        [% END %]
49
                    [% END %]
49
                    [% END %]
50
                    [% IF ( CAN_user_circulate_circulate_remaining_permissions ) %]
50
                    [% IF ( CAN_user_circulate_circulate_remaining_permissions ) %]
51
                        [% IF Koha.Preference( 'UnseenRenewals' ) %]
52
                            <label id="renew_as_unseen_label" for="override_limit">Renew as &quot;unseen&quot; if appropriate:</label>
53
                            <input type="checkbox" name="renew_as_unseen" id="renew_as_unseen_checkbox" value="1" />
54
                        [% END %]
51
                        <button class="btn btn-default" id="RenewCheckinChecked"><i class="fa fa-check"></i> Renew or check in selected items</button>
55
                        <button class="btn btn-default" id="RenewCheckinChecked"><i class="fa fa-check"></i> Renew or check in selected items</button>
52
                        <button class="btn btn-default" id="RenewAll"><i class="fa fa-book"></i> Renew all</button>
56
                        <button class="btn btn-default" id="RenewAll"><i class="fa fa-book"></i> Renew all</button>
53
                    [% END %]
57
                    [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc (+3 lines)
Lines 12-17 Link Here
12
    var RETURN_CLAIMED_NOTES = _("Notes about return claim");
12
    var RETURN_CLAIMED_NOTES = _("Notes about return claim");
13
    var NOT_CHECKED_OUT = _("not checked out");
13
    var NOT_CHECKED_OUT = _("not checked out");
14
    var TOO_MANY_RENEWALS = _("too many renewals");
14
    var TOO_MANY_RENEWALS = _("too many renewals");
15
    var TOO_MANY_UNSEEN = _("too many consecutive renewals without being seen by the library");
15
    var ON_RESERVE = _("on hold");
16
    var ON_RESERVE = _("on hold");
16
    var REASON_UNKNOWN = _("reason unknown");
17
    var REASON_UNKNOWN = _("reason unknown");
17
    var TODAYS_CHECKOUTS = _("Today's checkouts");
18
    var TODAYS_CHECKOUTS = _("Today's checkouts");
Lines 20-25 Link Here
20
    var ON_HOLD = _("On hold");
21
    var ON_HOLD = _("On hold");
21
    var PLACE_HOLD = _("Place hold");
22
    var PLACE_HOLD = _("Place hold");
22
    var NOT_RENEWABLE = _("Not renewable");
23
    var NOT_RENEWABLE = _("Not renewable");
24
    var NOT_RENEWABLE_UNSEEN = _("Must be renewed at the library");
23
    var NOT_RENEWABLE_TOO_SOON = _("No renewal before %s");
25
    var NOT_RENEWABLE_TOO_SOON = _("No renewal before %s");
24
    var NOT_RENEWABLE_AUTO_TOO_SOON = _("Scheduled for automatic renewal");
26
    var NOT_RENEWABLE_AUTO_TOO_SOON = _("Scheduled for automatic renewal");
25
    var NOT_RENEWABLE_AUTO_TOO_LATE = _("Can no longer be auto-renewed - number of checkout days exceeded");
27
    var NOT_RENEWABLE_AUTO_TOO_LATE = _("Can no longer be auto-renewed - number of checkout days exceeded");
Lines 28-33 Link Here
28
    var NOT_RENEWABLE_AUTO_RENEW = _("Scheduled for automatic renewal");
30
    var NOT_RENEWABLE_AUTO_RENEW = _("Scheduled for automatic renewal");
29
    var NOT_RENEWABLE_DENIED = _("Renewal denied by syspref");
31
    var NOT_RENEWABLE_DENIED = _("Renewal denied by syspref");
30
    var RENEWALS_REMAINING = _("%s of %s renewals remaining");
32
    var RENEWALS_REMAINING = _("%s of %s renewals remaining");
33
    var UNSEEN_REMAINING = _("%s of %s unseen renewals remaining");
31
    var HOLD_IS_SUSPENDED = _("Hold is <strong>suspended</strong>");
34
    var HOLD_IS_SUSPENDED = _("Hold is <strong>suspended</strong>");
32
    var UNTIL = _("until %s");
35
    var UNTIL = _("until %s");
33
    var NEXT_AVAILABLE_ITYPE = _("Next available %s item");
36
    var NEXT_AVAILABLE_ITYPE = _("Next available %s item");
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (+1 lines)
Lines 1058-1063 Link Here
1058
        var logged_in_user_borrowernumber = "[% logged_in_user.borrowernumber | html %]";
1058
        var logged_in_user_borrowernumber = "[% logged_in_user.borrowernumber | html %]";
1059
        var ClaimReturnedLostValue = "[% Koha.Preference('ClaimReturnedLostValue') | html %]";
1059
        var ClaimReturnedLostValue = "[% Koha.Preference('ClaimReturnedLostValue') | html %]";
1060
        var ClaimReturnedChargeFee = "[% Koha.Preference('ClaimReturnedChargeFee') | html %]";
1060
        var ClaimReturnedChargeFee = "[% Koha.Preference('ClaimReturnedChargeFee') | html %]";
1061
        var UnseenRenewals = "[% Koha.Preference('UnseenRenewals') | html %]";
1061
        var ClaimReturnedWarningThreshold = "[% Koha.Preference('ClaimReturnedWarningThreshold') | html %]";
1062
        var ClaimReturnedWarningThreshold = "[% Koha.Preference('ClaimReturnedWarningThreshold') | html %]";
1062
        var interface = "[% interface | html %]";
1063
        var interface = "[% interface | html %]";
1063
        var theme = "[% theme | html %]";
1064
        var theme = "[% theme | html %]";
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt (-7 / +31 lines)
Lines 52-57 Link Here
52
                                    </form>
52
                                    </form>
53
                                [% END %]
53
                                [% END %]
54
54
55
                            [% ELSIF error == "too_unseen" %]
56
57
                                <p>[% INCLUDE 'biblio-title.inc' biblio=item.biblio %] ( [% item.barcode | html %] ) has been renewed the maximum number of consecutive times without being seen by the library )</p>
58
59
                                [% IF Koha.Preference('AllowRenewalLimitOverride') %]
60
                                    <form method="post" action="/cgi-bin/koha/circ/renew.pl">
61
                                        <input type="hidden" name="barcode" value="[% item.barcode | html %]"/>
62
                                        <input type="hidden" name="override_limit" value="1" />
63
                                        <button type="submit" class="approve"><i class="fa fa-check"></i> Override limit and renew</button>
64
                                    </form>
65
                                [% END %]
66
55
                            [% ELSIF error == "too_soon" %]
67
                            [% ELSIF error == "too_soon" %]
56
68
57
                                <p>[% INCLUDE 'biblio-title.inc' biblio=item.biblio %] ( [% item.barcode | html %] ) cannot be renewed before [% soonestrenewdate | $KohaDates %]. </p>
69
                                <p>[% INCLUDE 'biblio-title.inc' biblio=item.biblio %] ( [% item.barcode | html %] ) cannot be renewed before [% soonestrenewdate | $KohaDates %]. </p>
Lines 169-180 Link Here
169
                    <fieldset>
181
                    <fieldset>
170
                        <h2>Renew</h2>
182
                        <h2>Renew</h2>
171
183
172
                        <div>
184
                        [% IF Koha.Preference('UnseenRenewals') %]
173
                            <label for="barcode" class="hint">Enter item barcode: </label>
185
                            <div class="renew_formfield">
174
                        </div>
186
                                <div>
175
187
                                    <label for="barcode" class="hint">Enter item barcode: </label>
176
                        <input name="barcode" id="barcode" size="14" class="barcode focus" type="text" />
188
                                </div>
177
189
                                <input name="barcode" id="barcode" size="14" class="barcode focus" type="text" />
190
                            </div>
191
                            <div class="renew_formfield">
192
                                <label for="unseen" class="hint">Record renewal as unseen if appropriate: </label>
193
                                <input value="1" name="unseen" id="unseen" type="checkbox" />
194
                            </div>
195
                        [% ELSE %]
196
                            <div>
197
                                <label for="barcode" class="hint">Enter item barcode: </label>
198
                            </div>
199
200
                            <input name="barcode" id="barcode" size="14" class="barcode focus" type="text" />
201
202
                        [% END %]
178
                        <button type="submit" class="btn btn-default">Submit</button>
203
                        <button type="submit" class="btn btn-default">Submit</button>
179
204
180
                        <div class="circ-settings show">
205
                        <div class="circ-settings show">
Lines 184-190 Link Here
184
                                <button type="button" class="action btn btn-default btn-xs" id="cleardate" name="cleardate">Clear</button>
209
                                <button type="button" class="action btn btn-default btn-xs" id="cleardate" name="cleardate">Clear</button>
185
                            </div> <!-- /.date-select -->
210
                            </div> <!-- /.date-select -->
186
                        </div>
211
                        </div>
187
188
                    </fieldset>
212
                    </fieldset>
189
213
190
214
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (+1 lines)
Lines 925-930 Link Here
925
        var ClaimReturnedLostValue = "[% Koha.Preference('ClaimReturnedLostValue') | html %]";
925
        var ClaimReturnedLostValue = "[% Koha.Preference('ClaimReturnedLostValue') | html %]";
926
        var ClaimReturnedChargeFee = "[% Koha.Preference('ClaimReturnedChargeFee') | html %]";
926
        var ClaimReturnedChargeFee = "[% Koha.Preference('ClaimReturnedChargeFee') | html %]";
927
        var ClaimReturnedWarningThreshold = "[% Koha.Preference('ClaimReturnedWarningThreshold') | html %]";
927
        var ClaimReturnedWarningThreshold = "[% Koha.Preference('ClaimReturnedWarningThreshold') | html %]";
928
        var UnseenRenewals = "[% Koha.Preference('UnseenRenewals') | html %]";
928
        var interface = "[% interface | html %]";
929
        var interface = "[% interface | html %]";
929
        var theme = "[% theme | html %]";
930
        var theme = "[% theme | html %]";
930
        var borrowernumber = "[% patron.borrowernumber | html %]";
931
        var borrowernumber = "[% patron.borrowernumber | html %]";
(-)a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js (-4 / +22 lines)
Lines 143-151 $(document).ready(function() { Link Here
143
                itemnumber:      itemnumber,
143
                itemnumber:      itemnumber,
144
                borrowernumber:  borrowernumber,
144
                borrowernumber:  borrowernumber,
145
                branchcode:      branchcode,
145
                branchcode:      branchcode,
146
                override_limit:  override_limit,
146
                override_limit:  override_limit
147
            };
147
            };
148
148
149
            if (UnseenRenewals) {
150
                var ren = $("#renew_as_unseen_checkbox");
151
                var renew_unseen = ren.length > 0 && ren.is(':checked') ? 1 : 0;
152
                params.seen = renew_unseen === 1 ? 0 : 1;
153
            }
154
149
            // Determine which due date we need to use
155
            // Determine which due date we need to use
150
            var dueDate = isOnReserve ?
156
            var dueDate = isOnReserve ?
151
                $("#newonholdduedate input").val() :
157
                $("#newonholdduedate input").val() :
Lines 168-173 $(document).ready(function() { Link Here
168
                        content += NOT_CHECKED_OUT;
174
                        content += NOT_CHECKED_OUT;
169
                    } else if ( data.error == "too_many" ) {
175
                    } else if ( data.error == "too_many" ) {
170
                        content += TOO_MANY_RENEWALS;
176
                        content += TOO_MANY_RENEWALS;
177
                    } else if ( data.error == "too_unseen" ) {
178
                        content += TOO_MANY_UNSEEN;
171
                    } else if ( data.error == "on_reserve" ) {
179
                    } else if ( data.error == "on_reserve" ) {
172
                        content += ON_RESERVE;
180
                        content += ON_RESERVE;
173
                    } else if ( data.error == "restriction" ) {
181
                    } else if ( data.error == "restriction" ) {
Lines 431-436 $(document).ready(function() { Link Here
431
                                    + NOT_RENEWABLE
439
                                    + NOT_RENEWABLE
432
                                    + "</span>";
440
                                    + "</span>";
433
441
442
                            span_style = "display: none";
443
                            span_class = "renewals-allowed";
444
                        } else if ( oObj.can_renew_error == "too_unseen" ) {
445
                            msg += "<span class='renewals-disabled'>"
446
                                    + NOT_RENEWABLE_UNSEEN
447
                                    + "</span>";
448
434
                            span_style = "display: none";
449
                            span_style = "display: none";
435
                            span_class = "renewals-allowed";
450
                            span_class = "renewals-allowed";
436
                        } else if ( oObj.can_renew_error == "restriction" ) {
451
                        } else if ( oObj.can_renew_error == "restriction" ) {
Lines 527-535 $(document).ready(function() { Link Here
527
                        }
542
                        }
528
                        content += msg;
543
                        content += msg;
529
                        if ( can_renew || can_force_renew ) {
544
                        if ( can_renew || can_force_renew ) {
530
                            content += "<span class='renewals'>("
545
                            content += "<span class='renewals'>(";
531
                                    + RENEWALS_REMAINING.format( oObj.renewals_remaining, oObj.renewals_allowed )
546
                            content += RENEWALS_REMAINING.format( oObj.renewals_remaining, oObj.renewals_allowed );
532
                                    + ")</span>";
547
                            if (UnseenRenewals && oObj.unseen_allowed) {
548
                                content += " / " + UNSEEN_REMAINING.format( oObj.unseen_remaining, oObj.unseen_allowed );
549
                            }
550
                            content += ")</span>";
533
                        }
551
                        }
534
552
535
                        content += "</span>";
553
                        content += "</span>";
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt (-6 / +40 lines)
Lines 95-100 Link Here
95
                                            <li>Your account has expired. Please contact the library for more information.</li>
95
                                            <li>Your account has expired. Please contact the library for more information.</li>
96
                                        [% ELSIF error == 'too_many' %]
96
                                        [% ELSIF error == 'too_many' %]
97
                                            <li>You have renewed this item the maximum number of times allowed.</li>
97
                                            <li>You have renewed this item the maximum number of times allowed.</li>
98
                                        [% ELSIF error == 'too_unseen' %]
99
                                            <li>You have renewed this item the maximum number of consecutive times without it being seen by the library.</li>
98
                                        [% ELSIF error == 'too_soon' %]
100
                                        [% ELSIF error == 'too_soon' %]
99
                                            <li>It is too soon after the checkout date for this item to be renewed.</li>
101
                                            <li>It is too soon after the checkout date for this item to be renewed.</li>
100
                                        [% ELSIF error == 'on_reserve' %]
102
                                        [% ELSIF error == 'on_reserve' %]
Lines 360-386 Link Here
360
                                                        [% IF ISSUE.itemtype_object.rentalcharge_hourly > 0 %]
362
                                                        [% IF ISSUE.itemtype_object.rentalcharge_hourly > 0 %]
361
                                                            <span class="renewalfee label label-warning">[% ISSUE.itemtype_object.rentalcharge_hourly | $Price %] per hour</span>
363
                                                            <span class="renewalfee label label-warning">[% ISSUE.itemtype_object.rentalcharge_hourly | $Price %] per hour</span>
362
                                                        [% END %]
364
                                                        [% END %]
363
                                                        <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
365
                                                        <span class="renewals">(
366
                                                            [% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining
367
                                                            [% IF Koha.Preference('UnseenRenewals') && ISSUE.unseenallowed %]
368
                                                                / [% ISSUE.unseenleft | html %] of [% ISSUE.unseenallowed | html %] renewals left before the item must be seen by the library
369
                                                            [% END %]
370
                                                        )</span>
364
                                                    [% ELSIF ( ISSUE.on_reserve ) %]
371
                                                    [% ELSIF ( ISSUE.on_reserve ) %]
365
                                                        Not renewable <span class="renewals">(on hold)</span>
372
                                                        Not renewable <span class="renewals">(on hold)</span>
366
                                                    [% ELSIF ( ISSUE.too_many ) %]
373
                                                    [% ELSIF ( ISSUE.too_many ) %]
367
                                                        Not renewable
374
                                                        Not renewable
375
                                                    [% ELSIF ( ISSUE.too_unseen ) %]
376
                                                        Item must be seen by the library
368
                                                    [% ELSIF ( ISSUE.norenew_overdue ) %]
377
                                                    [% ELSIF ( ISSUE.norenew_overdue ) %]
369
                                                        Not allowed <span class="renewals">(overdue)</span>
378
                                                        Not allowed <span class="renewals">(overdue)</span>
370
                                                    [% ELSIF ( ISSUE.auto_too_late ) %]
379
                                                    [% ELSIF ( ISSUE.auto_too_late ) %]
371
                                                        No longer renewable
380
                                                        No longer renewable
372
                                                    [% ELSIF ISSUE.auto_too_much_oweing %]
381
                                                    [% ELSIF ISSUE.auto_too_much_oweing %]
373
                                                        Automatic renewal failed, you have unpaid fines.
382
                                                        Automatic renewal failed, you have unpaid fines.
374
                                                        <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
383
                                                        <span class="renewals">(
384
                                                            [% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining
385
                                                            [% IF Koha.Preference('UnseenRenewals') && ISSUE.unseenallowed %]
386
                                                                / [% ISSUE.unseenleft | html %] of [% ISSUE.unseenallowed | html %] renewals left before the item must be seen by the library
387
                                                            [% END %]
388
                                                        )</span>
375
                                                    [% ELSIF ISSUE.auto_account_expired %]
389
                                                    [% ELSIF ISSUE.auto_account_expired %]
376
                                                        Automatic renewal failed, your account is expired.
390
                                                        Automatic renewal failed, your account is expired.
377
                                                        <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
391
                                                        <span class="renewals">(
392
                                                            [% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining
393
                                                            [% IF Koha.Preference('UnseenRenewals') && ISSUE.unseenallowed %]
394
                                                                / [% ISSUE.unseenleft | html %] of [% ISSUE.unseenallowed | html %] renewals left before the item must be seen by the library
395
                                                            [% END %]
396
                                                        )</span>
378
                                                    [% ELSIF ( ISSUE.too_soon ) %]
397
                                                    [% ELSIF ( ISSUE.too_soon ) %]
379
                                                        No renewal before [% ISSUE.soonestrenewdate | html %]
398
                                                        No renewal before [% ISSUE.soonestrenewdate | html %]
380
                                                        <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
399
                                                        <span class="renewals">(
400
                                                            [% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining
401
                                                            [% IF Koha.Preference('UnseenRenewals') && ISSUE.unseenallowed %]
402
                                                                / [% ISSUE.unseenleft | html %] of [% ISSUE.unseenallowed | html %] renewals left before the item must be seen by the library
403
                                                            [% END %]
404
                                                        )</span>
381
                                                    [% ELSIF ( ISSUE.auto_renew || ISSUE.auto_too_soon ) %]
405
                                                    [% ELSIF ( ISSUE.auto_renew || ISSUE.auto_too_soon ) %]
382
                                                        Automatic renewal
406
                                                        Automatic renewal
383
                                                        <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
407
                                                        <span class="renewals">(
408
                                                            [% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining
409
                                                            [% IF Koha.Preference('UnseenRenewals') && ISSUE.unseenallowed %]
410
                                                                / [% ISSUE.unseenleft | html %] of [% ISSUE.unseenallowed | html %] renewals left before the item must be seen by the library
411
                                                            [% END %]
412
                                                        )</span>
384
                                                    [% ELSIF ( ISSUE.item_denied_renewal ) %]
413
                                                    [% ELSIF ( ISSUE.item_denied_renewal ) %]
385
                                                        Renewal not allowed
414
                                                        Renewal not allowed
386
                                                    [% END %]
415
                                                    [% END %]
Lines 635-641 Link Here
635
                                                            [% IF ( canrenew ) %]
664
                                                            [% IF ( canrenew ) %]
636
                                                                <a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&amp;item=[% OVERDUE.itemnumber | uri %]&amp;bornum=[% OVERDUE.borrowernumber | uri %]">Renew</a>
665
                                                                <a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&amp;item=[% OVERDUE.itemnumber | uri %]&amp;bornum=[% OVERDUE.borrowernumber | uri %]">Renew</a>
637
                                                            [% END %]
666
                                                            [% END %]
638
                                                                <span class="renewals">([% OVERDUE.renewsleft | html %] of [% OVERDUE.renewsallowed | html %] renewals remaining)</span>
667
                                                                <span class="renewals">(
668
                                                                    [% OVERDUE.renewsleft | html %] of [% OVERDUE.renewsallowed | html %] renewals remaining
669
                                                                    [% IF Koha.Preference('UnseenRenewals') && ISSUE.unseenallowed %]
670
                                                                        / [% OVERDUE.unseenleft | html %] of [% OVERDUE.unseenallowed | html %] renewals left before the item must be seen by the library
671
                                                                    [% END %]
672
                                                                )</span>
639
                                                        [% ELSIF ( OVERDUE.norenew_overdue ) %]
673
                                                        [% ELSIF ( OVERDUE.norenew_overdue ) %]
640
                                                            Not allowed<span class="renewals">(overdue)</span>
674
                                                            Not allowed<span class="renewals">(overdue)</span>
641
                                                        [% ELSIF ( OVERDUE.onreserve ) %]
675
                                                        [% ELSIF ( OVERDUE.onreserve ) %]
(-)a/misc/cronjobs/automatic_renewals.pl (-1 / +1 lines)
Lines 95-101 while ( my $auto_renew = $auto_renews->next ) { Link Here
95
              $auto_renew->issue_id, $auto_renew->borrowernumber, $auto_renew->itemnumber;
95
              $auto_renew->issue_id, $auto_renew->borrowernumber, $auto_renew->itemnumber;
96
        }
96
        }
97
        if ($confirm){
97
        if ($confirm){
98
            my $date_due = AddRenewal( $auto_renew->borrowernumber, $auto_renew->itemnumber, $auto_renew->branchcode );
98
            my $date_due = AddRenewal( $auto_renew->borrowernumber, $auto_renew->itemnumber, $auto_renew->branchcode, undef, undef, 0 );
99
            $auto_renew->auto_renew_error(undef)->store;
99
            $auto_renew->auto_renew_error(undef)->store;
100
        }
100
        }
101
        push @{ $report{ $auto_renew->borrowernumber } }, $auto_renew;
101
        push @{ $report{ $auto_renew->borrowernumber } }, $auto_renew;
(-)a/offline_circ/download.pl (+1 lines)
Lines 67-72 my $issues_query = q{SELECT Link Here
67
    issues.date_due AS date_due,
67
    issues.date_due AS date_due,
68
    issues.issuedate AS issuedate,
68
    issues.issuedate AS issuedate,
69
    issues.renewals AS renewals,
69
    issues.renewals AS renewals,
70
    issues.unseen_renewals AS unseen_renewals,
70
    borrowers.cardnumber AS cardnumber,
71
    borrowers.cardnumber AS cardnumber,
71
    CONCAT(borrowers.surname, ', ', borrowers.firstname) AS borrower_name
72
    CONCAT(borrowers.surname, ', ', borrowers.firstname) AS borrower_name
72
    FROM issues
73
    FROM issues
(-)a/opac/opac-renew.pl (-1 / +1 lines)
Lines 62-68 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
            AddRenewal( $borrowernumber, $itemnumber, undef, undef, undef );
65
            AddRenewal( $borrowernumber, $itemnumber, undef, undef, undef, undef, 0 );
66
            push( @renewed, $itemnumber );
66
            push( @renewed, $itemnumber );
67
        }
67
        }
68
        else {
68
        else {
(-)a/opac/opac-user.pl (-1 / +9 lines)
Lines 223-229 if ( $pending_checkouts->count ) { # Useless test Link Here
223
223
224
        # check if item is renewable
224
        # check if item is renewable
225
        my ($status,$renewerror) = CanBookBeRenewed( $borrowernumber, $issue->{'itemnumber'} );
225
        my ($status,$renewerror) = CanBookBeRenewed( $borrowernumber, $issue->{'itemnumber'} );
226
        ($issue->{'renewcount'},$issue->{'renewsallowed'},$issue->{'renewsleft'}) = GetRenewCount($borrowernumber, $issue->{'itemnumber'});
226
        (
227
            $issue->{'renewcount'},
228
            $issue->{'renewsallowed'},
229
            $issue->{'renewsleft'},
230
            $issue->{'unseencount'},
231
            $issue->{'unseenallowed'},
232
            $issue->{'unseenleft'}
233
        ) = GetRenewCount($borrowernumber, $issue->{'itemnumber'});
227
        ( $issue->{'renewalfee'}, $issue->{'renewalitemtype'} ) = GetIssuingCharges( $issue->{'itemnumber'}, $borrowernumber );
234
        ( $issue->{'renewalfee'}, $issue->{'renewalitemtype'} ) = GetIssuingCharges( $issue->{'itemnumber'}, $borrowernumber );
228
        $issue->{itemtype_object} = Koha::ItemTypes->find( Koha::Items->find( $issue->{itemnumber} )->effective_itemtype );
235
        $issue->{itemtype_object} = Koha::ItemTypes->find( Koha::Items->find( $issue->{itemnumber} )->effective_itemtype );
229
        if($status && C4::Context->preference("OpacRenewalAllowed")){
236
        if($status && C4::Context->preference("OpacRenewalAllowed")){
Lines 235-240 if ( $pending_checkouts->count ) { # Useless test Link Here
235
242
236
        if ($renewerror) {
243
        if ($renewerror) {
237
            $issue->{'too_many'}       = 1 if $renewerror eq 'too_many';
244
            $issue->{'too_many'}       = 1 if $renewerror eq 'too_many';
245
            $issue->{'too_unseen'}     = 1 if $renewerror eq 'too_unseen';
238
            $issue->{'on_reserve'}     = 1 if $renewerror eq 'on_reserve';
246
            $issue->{'on_reserve'}     = 1 if $renewerror eq 'on_reserve';
239
            $issue->{'norenew_overdue'} = 1 if $renewerror eq 'overdue';
247
            $issue->{'norenew_overdue'} = 1 if $renewerror eq 'overdue';
240
            $issue->{'auto_renew'}     = 1 if $renewerror eq 'auto_renew';
248
            $issue->{'auto_renew'}     = 1 if $renewerror eq 'auto_renew';
(-)a/svc/checkouts (-1 / +11 lines)
Lines 158-164 while ( my $c = $sth->fetchrow_hashref() ) { Link Here
158
      )
158
      )
159
      : undef;
159
      : undef;
160
160
161
    my ( $renewals_count, $renewals_allowed, $renewals_remaining ) =
161
    my (
162
        $renewals_count,
163
        $renewals_allowed,
164
        $renewals_remaining,
165
        $unseen_count,
166
        $unseen_allowed,
167
        $unseen_remaining
168
    ) =
162
      GetRenewCount( $c->{borrowernumber}, $c->{itemnumber} );
169
      GetRenewCount( $c->{borrowernumber}, $c->{itemnumber} );
163
170
164
    my $type_for_stat = Koha::ItemTypes->find( $item_level_itypes ? $c->{itype} : $c->{itemtype} );
171
    my $type_for_stat = Koha::ItemTypes->find( $item_level_itypes ? $c->{itype} : $c->{itemtype} );
Lines 225-230 while ( my $c = $sth->fetchrow_hashref() ) { Link Here
225
        renewals_count      => $renewals_count,
232
        renewals_count      => $renewals_count,
226
        renewals_allowed    => $renewals_allowed,
233
        renewals_allowed    => $renewals_allowed,
227
        renewals_remaining  => $renewals_remaining,
234
        renewals_remaining  => $renewals_remaining,
235
        unseen_count        => $unseen_count,
236
        unseen_allowed      => $unseen_allowed,
237
        unseen_remaining    => $unseen_remaining,
228
238
229
        return_claim_id         => $c->{return_claim_id},
239
        return_claim_id         => $c->{return_claim_id},
230
        return_claim_notes      => $c->{return_claim_notes},
240
        return_claim_notes      => $c->{return_claim_notes},
(-)a/svc/renew (-2 / +2 lines)
Lines 46-51 my $borrowernumber = $input->param('borrowernumber'); Link Here
46
my $override_limit = $input->param('override_limit');
46
my $override_limit = $input->param('override_limit');
47
my $branchcode     = $input->param('branchcode')
47
my $branchcode     = $input->param('branchcode')
48
  || C4::Context->userenv->{'branch'};
48
  || C4::Context->userenv->{'branch'};
49
my $seen           = $input->param('seen');
49
my $date_due;
50
my $date_due;
50
if ( $input->param('date_due') ) {
51
if ( $input->param('date_due') ) {
51
    $date_due = dt_from_string( scalar $input->param('date_due') );
52
    $date_due = dt_from_string( scalar $input->param('date_due') );
Lines 66-72 if ( $data->{error} && $data->{error} eq 'on_reserve' && C4::Context->preference Link Here
66
}
67
}
67
68
68
if ( $data->{renew_okay} ) {
69
if ( $data->{renew_okay} ) {
69
    $date_due = AddRenewal( $borrowernumber, $itemnumber, $branchcode, $date_due );
70
    $date_due = AddRenewal( $borrowernumber, $itemnumber, $branchcode, $date_due, undef, $seen );
70
    $data->{date_due} = output_pref( { dt => $date_due, as_due_date => 1 } );
71
    $data->{date_due} = output_pref( { dt => $date_due, as_due_date => 1 } );
71
}
72
}
72
73
73
- 

Return to bug 24083