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

(-)a/C4/Circulation.pm (-8 / +164 lines)
Lines 2724-2729 sub CanBookBeRenewed { Link Here
2724
                    'no_auto_renewal_after_hard_limit',
2724
                    'no_auto_renewal_after_hard_limit',
2725
                    'lengthunit',
2725
                    'lengthunit',
2726
                    'norenewalbefore',
2726
                    'norenewalbefore',
2727
                    'unseen_renewals_allowed'
2727
                ]
2728
                ]
2728
            }
2729
            }
2729
        );
2730
        );
Lines 2887-2898 sub CanBookBeRenewed { Link Here
2887
    return ( 0, "on_reserve" ) if $resfound;    # '' when no hold was found
2888
    return ( 0, "on_reserve" ) if $resfound;    # '' when no hold was found
2888
    return ( 0, "auto_renew" ) if $auto_renew && !$override_limit; # 0 if auto-renewal should not succeed
2889
    return ( 0, "auto_renew" ) if $auto_renew && !$override_limit; # 0 if auto-renewal should not succeed
2889
2890
2891
    return ( 1, undef ) if $override_limit;
2892
2893
    my $branchcode = _GetCircControlBranch( $item->unblessed, $patron->unblessed );
2894
    my $issuing_rule = Koha::CirculationRules->get_effective_rules(
2895
        {
2896
            categorycode => $patron->categorycode,
2897
            itemtype     => $item->effective_itemtype,
2898
            branchcode   => $branchcode,
2899
            rules => [
2900
                'renewalsallowed',
2901
                'no_auto_renewal_after',
2902
                'no_auto_renewal_after_hard_limit',
2903
                'lengthunit',
2904
                'norenewalbefore',
2905
                'unseen_renewals_allowed'
2906
            ]
2907
        }
2908
    );
2909
2910
    return ( 0, "too_many" )
2911
      if not $issuing_rule->{renewalsallowed} or $issuing_rule->{renewalsallowed} <= $issue->renewals;
2912
2913
    return ( 0, "too_unseen" )
2914
      if C4::Context->preference('UnseenRenewals') &&
2915
        $issuing_rule->{unseen_renewals_allowed} &&
2916
        $issuing_rule->{unseen_renewals_allowed} <= $issue->unseen_renewals;
2917
2918
    my $overduesblockrenewing = C4::Context->preference('OverduesBlockRenewing');
2919
    my $restrictionblockrenewing = C4::Context->preference('RestrictionBlockRenewing');
2920
    $patron         = Koha::Patrons->find($borrowernumber); # FIXME Is this really useful?
2921
    my $restricted  = $patron->is_debarred;
2922
    my $hasoverdues = $patron->has_overdues;
2923
2924
    if ( $restricted and $restrictionblockrenewing ) {
2925
        return ( 0, 'restriction');
2926
    } elsif ( ($hasoverdues and $overduesblockrenewing eq 'block') || ($issue->is_overdue and $overduesblockrenewing eq 'blockitem') ) {
2927
        return ( 0, 'overdue');
2928
    }
2929
2930
    if ( $issue->auto_renew ) {
2931
2932
        if ( $patron->category->effective_BlockExpiredPatronOpacActions and $patron->is_expired ) {
2933
            return ( 0, 'auto_account_expired' );
2934
        }
2935
2936
        if ( defined $issuing_rule->{no_auto_renewal_after}
2937
                and $issuing_rule->{no_auto_renewal_after} ne "" ) {
2938
            # Get issue_date and add no_auto_renewal_after
2939
            # If this is greater than today, it's too late for renewal.
2940
            my $maximum_renewal_date = dt_from_string($issue->issuedate, 'sql');
2941
            $maximum_renewal_date->add(
2942
                $issuing_rule->{lengthunit} => $issuing_rule->{no_auto_renewal_after}
2943
            );
2944
            my $now = dt_from_string;
2945
            if ( $now >= $maximum_renewal_date ) {
2946
                return ( 0, "auto_too_late" );
2947
            }
2948
        }
2949
        if ( defined $issuing_rule->{no_auto_renewal_after_hard_limit}
2950
                      and $issuing_rule->{no_auto_renewal_after_hard_limit} ne "" ) {
2951
            # If no_auto_renewal_after_hard_limit is >= today, it's also too late for renewal
2952
            if ( dt_from_string >= dt_from_string( $issuing_rule->{no_auto_renewal_after_hard_limit} ) ) {
2953
                return ( 0, "auto_too_late" );
2954
            }
2955
        }
2956
2957
        if ( C4::Context->preference('OPACFineNoRenewalsBlockAutoRenew') ) {
2958
            my $fine_no_renewals = C4::Context->preference("OPACFineNoRenewals");
2959
            my $amountoutstanding =
2960
              C4::Context->preference("OPACFineNoRenewalsIncludeCredit")
2961
              ? $patron->account->balance
2962
              : $patron->account->outstanding_debits->total_outstanding;
2963
            if ( $amountoutstanding and $amountoutstanding > $fine_no_renewals ) {
2964
                return ( 0, "auto_too_much_oweing" );
2965
            }
2966
        }
2967
    }
2968
2969
    if ( defined $issuing_rule->{norenewalbefore}
2970
        and $issuing_rule->{norenewalbefore} ne "" )
2971
    {
2972
2973
        # Calculate soonest renewal by subtracting 'No renewal before' from due date
2974
        my $soonestrenewal = dt_from_string( $issue->date_due, 'sql' )->subtract(
2975
            $issuing_rule->{lengthunit} => $issuing_rule->{norenewalbefore} );
2976
2977
        # Depending on syspref reset the exact time, only check the date
2978
        if ( C4::Context->preference('NoRenewalBeforePrecision') eq 'date'
2979
            and $issuing_rule->{lengthunit} eq 'days' )
2980
        {
2981
            $soonestrenewal->truncate( to => 'day' );
2982
        }
2983
2984
        if ( $soonestrenewal > DateTime->now( time_zone => C4::Context->tz() ) )
2985
        {
2986
            return ( 0, "auto_too_soon" ) if $issue->auto_renew;
2987
            return ( 0, "too_soon" );
2988
        }
2989
        elsif ( $issue->auto_renew ) {
2990
            return ( 0, "auto_renew" );
2991
        }
2992
    }
2993
2994
    # Fallback for automatic renewals:
2995
    # If norenewalbefore is undef, don't renew before due date.
2996
    if ( $issue->auto_renew ) {
2997
        my $now = dt_from_string;
2998
        return ( 0, "auto_renew" )
2999
          if $now >= dt_from_string( $issue->date_due, 'sql' );
3000
        return ( 0, "auto_too_soon" );
3001
    }
3002
2890
    return ( 1, undef );
3003
    return ( 1, undef );
2891
}
3004
}
2892
3005
2893
=head2 AddRenewal
3006
=head2 AddRenewal
2894
3007
2895
  &AddRenewal($borrowernumber, $itemnumber, $branch, [$datedue], [$lastreneweddate]);
3008
  &AddRenewal($borrowernumber, $itemnumber, $branch, [$datedue], [$lastreneweddate], [$seen]);
2896
3009
2897
Renews a loan.
3010
Renews a loan.
2898
3011
Lines 2917-2922 syspref) Link Here
2917
If C<$datedue> is the empty string, C<&AddRenewal> will calculate the due date automatically
3030
If C<$datedue> is the empty string, C<&AddRenewal> will calculate the due date automatically
2918
from the book's item type.
3031
from the book's item type.
2919
3032
3033
C<$seen> is a boolean flag indicating if the item was seen or not during the renewal. This
3034
informs the incrementing of the unseen_renewals column. If this flag is not supplied, we
3035
fallback to a true value
3036
2920
=cut
3037
=cut
2921
3038
2922
sub AddRenewal {
3039
sub AddRenewal {
Lines 2926-2931 sub AddRenewal { Link Here
2926
    my $datedue         = shift;
3043
    my $datedue         = shift;
2927
    my $lastreneweddate = shift || DateTime->now(time_zone => C4::Context->tz);
3044
    my $lastreneweddate = shift || DateTime->now(time_zone => C4::Context->tz);
2928
    my $skipfinecalc    = shift;
3045
    my $skipfinecalc    = shift;
3046
    my $seen            = shift;
3047
3048
    # Fallback on a 'seen' renewal
3049
    $seen = defined $seen && $seen == 0 ? 0 : 1;
2929
3050
2930
    my $item_object   = Koha::Items->find($itemnumber) or return;
3051
    my $item_object   = Koha::Items->find($itemnumber) or return;
2931
    my $biblio = $item_object->biblio;
3052
    my $biblio = $item_object->biblio;
Lines 2978-2992 sub AddRenewal { Link Here
2978
            }
3099
            }
2979
        );
3100
        );
2980
3101
3102
        # Increment the unseen renewals, if appropriate
3103
        # We only do so if the syspref is enabled and
3104
        # a maximum value has been set in the circ rules
3105
        my $unseen_renewals = $issue->unseen_renewals;
3106
        if (C4::Context->preference('UnseenRenewals')) {
3107
            my $rule = Koha::CirculationRules->get_effective_rule(
3108
                {   categorycode => $patron->categorycode,
3109
                    itemtype     => $item_object->effective_itemtype,
3110
                    branchcode   => $circ_library->branchcode,
3111
                    rule_name    => 'unseen_renewals_allowed'
3112
                }
3113
            );
3114
            if (!$seen && $rule && $rule->rule_value) {
3115
                $unseen_renewals++;
3116
            } else {
3117
                # If the renewal is seen, unseen should revert to 0
3118
                $unseen_renewals = 0;
3119
            }
3120
        }
3121
2981
        # Update the issues record to have the new due date, and a new count
3122
        # Update the issues record to have the new due date, and a new count
2982
        # of how many times it has been renewed.
3123
        # of how many times it has been renewed.
2983
        my $renews = ( $issue->renewals || 0 ) + 1;
3124
        my $renews = ( $issue->renewals || 0 ) + 1;
2984
        my $sth = $dbh->prepare("UPDATE issues SET date_due = ?, renewals = ?, lastreneweddate = ?
3125
        my $sth = $dbh->prepare("UPDATE issues SET date_due = ?, renewals = ?, unseen_renewals = ?, lastreneweddate = ?
2985
                                WHERE borrowernumber=?
3126
                                WHERE borrowernumber=?
2986
                                AND itemnumber=?"
3127
                                AND itemnumber=?"
2987
        );
3128
        );
2988
3129
2989
        $sth->execute( $datedue->strftime('%Y-%m-%d %H:%M'), $renews, $lastreneweddate, $borrowernumber, $itemnumber );
3130
        $sth->execute( $datedue->strftime('%Y-%m-%d %H:%M'), $renews, $unseen_renewals, $lastreneweddate, $borrowernumber, $itemnumber );
2990
3131
2991
        # Update the renewal count on the item, and tell zebra to reindex
3132
        # Update the renewal count on the item, and tell zebra to reindex
2992
        $renews = ( $item_object->renewals || 0 ) + 1;
3133
        $renews = ( $item_object->renewals || 0 ) + 1;
Lines 3068-3075 sub GetRenewCount { Link Here
3068
    my ( $bornum, $itemno ) = @_;
3209
    my ( $bornum, $itemno ) = @_;
3069
    my $dbh           = C4::Context->dbh;
3210
    my $dbh           = C4::Context->dbh;
3070
    my $renewcount    = 0;
3211
    my $renewcount    = 0;
3212
    my $unseencount    = 0;
3071
    my $renewsallowed = 0;
3213
    my $renewsallowed = 0;
3214
    my $unseenallowed = 0;
3072
    my $renewsleft    = 0;
3215
    my $renewsleft    = 0;
3216
    my $unseenleft    = 0;
3073
3217
3074
    my $patron = Koha::Patrons->find( $bornum );
3218
    my $patron = Koha::Patrons->find( $bornum );
3075
    my $item   = Koha::Items->find($itemno);
3219
    my $item   = Koha::Items->find($itemno);
Lines 3088-3109 sub GetRenewCount { Link Here
3088
    $sth->execute( $bornum, $itemno );
3232
    $sth->execute( $bornum, $itemno );
3089
    my $data = $sth->fetchrow_hashref;
3233
    my $data = $sth->fetchrow_hashref;
3090
    $renewcount = $data->{'renewals'} if $data->{'renewals'};
3234
    $renewcount = $data->{'renewals'} if $data->{'renewals'};
3235
    $unseencount = $data->{'unseen_renewals'} if $data->{'unseen_renewals'};
3091
    # $item and $borrower should be calculated
3236
    # $item and $borrower should be calculated
3092
    my $branchcode = _GetCircControlBranch($item->unblessed, $patron->unblessed);
3237
    my $branchcode = _GetCircControlBranch($item->unblessed, $patron->unblessed);
3093
3238
3094
    my $rule = Koha::CirculationRules->get_effective_rule(
3239
    my $rules = Koha::CirculationRules->get_effective_rules(
3095
        {
3240
        {
3096
            categorycode => $patron->categorycode,
3241
            categorycode => $patron->categorycode,
3097
            itemtype     => $item->effective_itemtype,
3242
            itemtype     => $item->effective_itemtype,
3098
            branchcode   => $branchcode,
3243
            branchcode   => $branchcode,
3099
            rule_name    => 'renewalsallowed',
3244
            rules        => [ 'renewalsallowed', 'unseen_renewals_allowed' ]
3100
        }
3245
        }
3101
    );
3246
    );
3102
3247
    $renewsallowed = $rules ? $rules->{renewalsallowed} : 0;
3103
    $renewsallowed = $rule ? $rule->rule_value : 0;
3248
    $unseenallowed = $rules->{unseen_renewals_allowed} ?
3249
        $rules->{unseen_renewals_allowed} :
3250
        0;
3104
    $renewsleft    = $renewsallowed - $renewcount;
3251
    $renewsleft    = $renewsallowed - $renewcount;
3252
    $unseenleft    = $unseenallowed - $unseencount;
3105
    if($renewsleft < 0){ $renewsleft = 0; }
3253
    if($renewsleft < 0){ $renewsleft = 0; }
3106
    return ( $renewcount, $renewsallowed, $renewsleft );
3254
    if($unseenleft < 0){ $unseenleft = 0; }
3255
    return (
3256
        $renewcount,
3257
        $renewsallowed,
3258
        $renewsleft,
3259
        $unseencount,
3260
        $unseenallowed,
3261
        $unseenleft
3262
    );
3107
}
3263
}
3108
3264
3109
=head2 GetSoonestRenewDate
3265
=head2 GetSoonestRenewDate
(-)a/C4/ILSDI/Services.pm (-1 / +1 lines)
Lines 644-650 sub RenewLoan { Link Here
644
644
645
    # Add renewal if possible
645
    # Add renewal if possible
646
    my @renewal = CanBookBeRenewed( $borrowernumber, $itemnumber );
646
    my @renewal = CanBookBeRenewed( $borrowernumber, $itemnumber );
647
    if ( $renewal[0] ) { AddRenewal( $borrowernumber, $itemnumber ); }
647
    if ( $renewal[0] ) { AddRenewal( $borrowernumber, $itemnumber, undef, undef, undef, 0 ); }
648
648
649
    my $issue = $item->checkout;
649
    my $issue = $item->checkout;
650
    return unless $issue; # FIXME should be handled
650
    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 145-150 our $RULE_KINDS = { Link Here
145
    renewalsallowed => {
145
    renewalsallowed => {
146
        scope => [ 'branchcode', 'categorycode', 'itemtype' ],
146
        scope => [ 'branchcode', 'categorycode', 'itemtype' ],
147
    },
147
    },
148
    unseen_renewals_allowed => {
149
        scope => [ 'branchcode', 'categorycode', 'itemtype' ],
150
    },
148
    rentaldiscount => {
151
    rentaldiscount => {
149
        scope => [ 'branchcode', 'categorycode', 'itemtype' ],
152
        scope => [ 'branchcode', 'categorycode', 'itemtype' ],
150
    },
153
    },
(-)a/Koha/REST/V1/Checkouts.pm (-1 / +3 lines)
Lines 151-156 sub renew { Link Here
151
    my $c = shift->openapi->valid_input or return;
151
    my $c = shift->openapi->valid_input or return;
152
152
153
    my $checkout_id = $c->validation->param('checkout_id');
153
    my $checkout_id = $c->validation->param('checkout_id');
154
    my $seen = $c->validation->param('seen') || 1;
154
    my $checkout = Koha::Checkouts->find( $checkout_id );
155
    my $checkout = Koha::Checkouts->find( $checkout_id );
155
156
156
    unless ($checkout) {
157
    unless ($checkout) {
Lines 173-179 sub renew { Link Here
173
        );
174
        );
174
    }
175
    }
175
176
176
    AddRenewal($borrowernumber, $itemnumber, $checkout->branchcode);
177
    AddRenewal($borrowernumber, $itemnumber, $checkout->branchcode, undef, undef, $seen);
177
    $checkout = Koha::Checkouts->find($checkout_id);
178
    $checkout = Koha::Checkouts->find($checkout_id);
178
179
179
    $c->res->headers->location( $c->req->url->to_string );
180
    $c->res->headers->location( $c->req->url->to_string );
Lines 222-227 sub allows_renewal { Link Here
222
            allows_renewal => $renewable,
223
            allows_renewal => $renewable,
223
            max_renewals => $rule->rule_value,
224
            max_renewals => $rule->rule_value,
224
            current_renewals => $checkout->renewals,
225
            current_renewals => $checkout->renewals,
226
            unseen_renewals => $checkout->unseen_renewals,
225
            error => $error
227
            error => $error
226
        }
228
        }
227
    );
229
    );
(-)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 32-37 Link Here
32
  "checkout_id_pp": {
32
  "checkout_id_pp": {
33
    "$ref": "parameters/checkout.json#/checkout_id_pp"
33
    "$ref": "parameters/checkout.json#/checkout_id_pp"
34
  },
34
  },
35
  "seen_pp": {
36
    "$ref": "parameters/checkout.json#/seen_pp"
37
  },
35
  "match": {
38
  "match": {
36
    "name": "_match",
39
    "name": "_match",
37
    "in": "query",
40
    "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 / +9 lines)
Lines 44-49 my ( $template, $librarian, $cookie, $flags ) = get_template_and_user( Link Here
44
my $schema = Koha::Database->new()->schema();
44
my $schema = Koha::Database->new()->schema();
45
45
46
my $barcode        = $cgi->param('barcode');
46
my $barcode        = $cgi->param('barcode');
47
my $unseen         = $cgi->param('unseen') || 0;
47
$barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespae
48
$barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespae
48
$barcode = barcodedecode($barcode) if( $barcode && C4::Context->preference('itemBarcodeInputFilter'));
49
$barcode = barcodedecode($barcode) if( $barcode && C4::Context->preference('itemBarcodeInputFilter'));
49
my $override_limit = $cgi->param('override_limit');
50
my $override_limit = $cgi->param('override_limit');
Lines 99-105 if ($barcode) { Link Here
99
                    if ( $cgi->param('renewonholdduedate') ) {
100
                    if ( $cgi->param('renewonholdduedate') ) {
100
                        $date_due = dt_from_string( scalar $cgi->param('renewonholdduedate'));
101
                        $date_due = dt_from_string( scalar $cgi->param('renewonholdduedate'));
101
                    }
102
                    }
102
                    $date_due = AddRenewal( undef, $item->itemnumber(), $branchcode, $date_due );
103
                    $date_due = AddRenewal(
104
                        undef,
105
                        $item->itemnumber(),
106
                        $branchcode,
107
                        $date_due,
108
                        undef,
109
                        !$unseen
110
                    );
103
                    $template->param( date_due => $date_due );
111
                    $template->param( date_due => $date_due );
104
                }
112
                }
105
            }
113
            }
(-)a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss (+12 lines)
Lines 1004-1009 div { Link Here
1004
        width: auto;
1004
        width: auto;
1005
    }
1005
    }
1006
1006
1007
    .renew_formfield {
1008
        margin-bottom: 1em;
1009
    }
1010
1007
    .circmessage {
1011
    .circmessage {
1008
        margin-bottom: .3em;
1012
        margin-bottom: .3em;
1009
        padding: 0 .4em .4em;
1013
        padding: 0 .4em .4em;
Lines 2408-2413 li { Link Here
2408
    position: relative;
2412
    position: relative;
2409
}
2413
}
2410
2414
2415
#renew_as_unseen_label {
2416
    margin-left: 1em;
2417
}
2418
2419
#renew_as_unseen_checkbox {
2420
    margin-right: 1em;
2421
}
2422
2411
#clearscreen {
2423
#clearscreen {
2412
    position: absolute;
2424
    position: absolute;
2413
    right: 0;
2425
    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 11-16 Link Here
11
    var RETURN_CLAIMED_NOTES = _("Notes about return claim");
11
    var RETURN_CLAIMED_NOTES = _("Notes about return claim");
12
    var NOT_CHECKED_OUT = _("not checked out");
12
    var NOT_CHECKED_OUT = _("not checked out");
13
    var TOO_MANY_RENEWALS = _("too many renewals");
13
    var TOO_MANY_RENEWALS = _("too many renewals");
14
    var TOO_MANY_UNSEEN = _("too many consecutive renewals without being seen by the library");
14
    var ON_RESERVE = _("on hold");
15
    var ON_RESERVE = _("on hold");
15
    var REASON_UNKNOWN = _("reason unknown");
16
    var REASON_UNKNOWN = _("reason unknown");
16
    var TODAYS_CHECKOUTS = _("Today's checkouts");
17
    var TODAYS_CHECKOUTS = _("Today's checkouts");
Lines 19-24 Link Here
19
    var ON_HOLD = _("On hold");
20
    var ON_HOLD = _("On hold");
20
    var PLACE_HOLD = _("Place hold");
21
    var PLACE_HOLD = _("Place hold");
21
    var NOT_RENEWABLE = _("Not renewable");
22
    var NOT_RENEWABLE = _("Not renewable");
23
    var NOT_RENEWABLE_UNSEEN = _("Must be renewed at the library");
22
    var NOT_RENEWABLE_TOO_SOON = _("No renewal before %s");
24
    var NOT_RENEWABLE_TOO_SOON = _("No renewal before %s");
23
    var NOT_RENEWABLE_AUTO_TOO_SOON = _("Scheduled for automatic renewal");
25
    var NOT_RENEWABLE_AUTO_TOO_SOON = _("Scheduled for automatic renewal");
24
    var NOT_RENEWABLE_AUTO_TOO_LATE = _("Can no longer be auto-renewed - number of checkout days exceeded");
26
    var NOT_RENEWABLE_AUTO_TOO_LATE = _("Can no longer be auto-renewed - number of checkout days exceeded");
Lines 27-32 Link Here
27
    var NOT_RENEWABLE_AUTO_RENEW = _("Scheduled for automatic renewal");
29
    var NOT_RENEWABLE_AUTO_RENEW = _("Scheduled for automatic renewal");
28
    var NOT_RENEWABLE_DENIED = _("Renewal denied by syspref");
30
    var NOT_RENEWABLE_DENIED = _("Renewal denied by syspref");
29
    var RENEWALS_REMAINING = _("%s of %s renewals remaining");
31
    var RENEWALS_REMAINING = _("%s of %s renewals remaining");
32
    var UNSEEN_REMAINING = _("%s of %s unseen renewals remaining");
30
    var HOLD_IS_SUSPENDED = _("Hold is <strong>suspended</strong>");
33
    var HOLD_IS_SUSPENDED = _("Hold is <strong>suspended</strong>");
31
    var UNTIL = _("until %s");
34
    var UNTIL = _("until %s");
32
    var NEXT_AVAILABLE_ITYPE = _("Next available %s item");
35
    var NEXT_AVAILABLE_ITYPE = _("Next available %s item");
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (+1 lines)
Lines 1030-1035 Link Here
1030
        var logged_in_user_borrowernumber = "[% logged_in_user.borrowernumber | html %]";
1030
        var logged_in_user_borrowernumber = "[% logged_in_user.borrowernumber | html %]";
1031
        var ClaimReturnedLostValue = "[% Koha.Preference('ClaimReturnedLostValue') | html %]";
1031
        var ClaimReturnedLostValue = "[% Koha.Preference('ClaimReturnedLostValue') | html %]";
1032
        var ClaimReturnedChargeFee = "[% Koha.Preference('ClaimReturnedChargeFee') | html %]";
1032
        var ClaimReturnedChargeFee = "[% Koha.Preference('ClaimReturnedChargeFee') | html %]";
1033
        var UnseenRenewals = "[% Koha.Preference('UnseenRenewals') | html %]";
1033
        var ClaimReturnedWarningThreshold = "[% Koha.Preference('ClaimReturnedWarningThreshold') | html %]";
1034
        var ClaimReturnedWarningThreshold = "[% Koha.Preference('ClaimReturnedWarningThreshold') | html %]";
1034
        var MSG_DT_LOADING_RECORDS = _("Loading... you may continue scanning.");
1035
        var MSG_DT_LOADING_RECORDS = _("Loading... you may continue scanning.");
1035
        var interface = "[% interface | html %]";
1036
        var interface = "[% interface | html %]";
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt (-4 / +25 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 168-177 Link Here
168
                    <fieldset>
180
                    <fieldset>
169
                        <legend>Renew</legend>
181
                        <legend>Renew</legend>
170
182
171
                        <label for="barcode">Enter item barcode: </label>
183
                        [% IF Koha.Preference('UnseenRenewals') %]
172
184
                            <div class="renew_formfield">
173
                        <input name="barcode" id="barcode" size="14" class="focus" type="text" />
185
                                <label for="barcode">Enter item barcode: </label>
174
186
                                <input name="barcode" id="barcode" size="14" class="focus" type="text" />
187
                            </div>
188
                            <div class="renew_formfield">
189
                                <label for="unseen">Record renewal as unseen if appropriate: </label>
190
                                <input value="1" name="unseen" id="unseen" type="checkbox" />
191
                            </div>
192
                        [% ELSE %]
193
                            <label for="barcode">Enter item barcode: </label>
194
                            <input name="barcode" id="barcode" size="14" class="focus" type="text" />
195
                        [% END %]
175
                        <input type="submit" class="submit" value="Submit" />
196
                        <input type="submit" class="submit" value="Submit" />
176
                    </fieldset>
197
                    </fieldset>
177
198
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (+1 lines)
Lines 866-871 Link Here
866
        var ClaimReturnedLostValue = "[% Koha.Preference('ClaimReturnedLostValue') | html %]";
866
        var ClaimReturnedLostValue = "[% Koha.Preference('ClaimReturnedLostValue') | html %]";
867
        var ClaimReturnedChargeFee = "[% Koha.Preference('ClaimReturnedChargeFee') | html %]";
867
        var ClaimReturnedChargeFee = "[% Koha.Preference('ClaimReturnedChargeFee') | html %]";
868
        var ClaimReturnedWarningThreshold = "[% Koha.Preference('ClaimReturnedWarningThreshold') | html %]";
868
        var ClaimReturnedWarningThreshold = "[% Koha.Preference('ClaimReturnedWarningThreshold') | html %]";
869
        var UnseenRenewals = "[% Koha.Preference('UnseenRenewals') | html %]";
869
        var interface = "[% interface | html %]";
870
        var interface = "[% interface | html %]";
870
        var theme = "[% theme | html %]";
871
        var theme = "[% theme | html %]";
871
        var borrowernumber = "[% patron.borrowernumber | html %]";
872
        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 432-437 $(document).ready(function() { Link Here
432
440
433
                            span_style = "display: none";
441
                            span_style = "display: none";
434
                            span_class = "renewals-allowed";
442
                            span_class = "renewals-allowed";
443
                        } else if ( oObj.can_renew_error == "too_unseen" ) {
444
                            msg += "<span class='renewals-disabled'>"
445
                                    + NOT_RENEWABLE_UNSEEN
446
                                    + "</span>";
447
448
                            span_style = "display: none";
449
                            span_class = "renewals-allowed";
435
                        } else if ( oObj.can_renew_error == "restriction" ) {
450
                        } else if ( oObj.can_renew_error == "restriction" ) {
436
                            msg += "<span class='renewals-disabled'>"
451
                            msg += "<span class='renewals-disabled'>"
437
                                    + NOT_RENEWABLE_RESTRICTION
452
                                    + NOT_RENEWABLE_RESTRICTION
Lines 526-534 $(document).ready(function() { Link Here
526
                        }
541
                        }
527
                        content += msg;
542
                        content += msg;
528
                        if ( can_renew || can_force_renew ) {
543
                        if ( can_renew || can_force_renew ) {
529
                            content += "<span class='renewals'>("
544
                            content += "<span class='renewals'>(";
530
                                    + RENEWALS_REMAINING.format( oObj.renewals_remaining, oObj.renewals_allowed )
545
                            content += RENEWALS_REMAINING.format( oObj.renewals_remaining, oObj.renewals_allowed );
531
                                    + ")</span>";
546
                            if (UnseenRenewals && oObj.unseen_allowed) {
547
                                content += " / " + UNSEEN_REMAINING.format( oObj.unseen_remaining, oObj.unseen_allowed );
548
                            }
549
                            content += ")</span>";
532
                        }
550
                        }
533
551
534
                        content += "</span>";
552
                        content += "</span>";
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt (-6 / +40 lines)
Lines 81-86 Link Here
81
                                            <li>Your account has expired. Please contact the library for more information.</li>
81
                                            <li>Your account has expired. Please contact the library for more information.</li>
82
                                        [% ELSIF error == 'too_many' %]
82
                                        [% ELSIF error == 'too_many' %]
83
                                            <li>You have renewed this item the maximum number of times allowed.</li>
83
                                            <li>You have renewed this item the maximum number of times allowed.</li>
84
                                        [% ELSIF error == 'too_unseen' %]
85
                                            <li>You have renewed this item the maximum number of consecutive times without it being seen by the library.</li>
84
                                        [% ELSIF error == 'too_soon' %]
86
                                        [% ELSIF error == 'too_soon' %]
85
                                            <li>It is too soon after the checkout date for this item to be renewed.</li>
87
                                            <li>It is too soon after the checkout date for this item to be renewed.</li>
86
                                        [% ELSIF error == 'on_reserve' %]
88
                                        [% ELSIF error == 'on_reserve' %]
Lines 309-335 Link Here
309
                                                        [% IF ISSUE.itemtype_object.rentalcharge_hourly > 0 %]
311
                                                        [% IF ISSUE.itemtype_object.rentalcharge_hourly > 0 %]
310
                                                            <span class="renewalfee label label-warning">[% ISSUE.itemtype_object.rentalcharge_hourly | $Price %] per hour</span>
312
                                                            <span class="renewalfee label label-warning">[% ISSUE.itemtype_object.rentalcharge_hourly | $Price %] per hour</span>
311
                                                        [% END %]
313
                                                        [% END %]
312
                                                        <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
314
                                                        <span class="renewals">(
315
                                                            [% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining
316
                                                            [% IF Koha.Preference('UnseenRenewals') && ISSUE.unseenallowed %]
317
                                                                / [% ISSUE.unseenleft | html %] of [% ISSUE.unseenallowed | html %] renewals left before the item must be seen by the library
318
                                                            [% END %]
319
                                                        )</span>
313
                                                    [% ELSIF ( ISSUE.on_reserve ) %]
320
                                                    [% ELSIF ( ISSUE.on_reserve ) %]
314
                                                        Not renewable <span class="renewals">(on hold)</span>
321
                                                        Not renewable <span class="renewals">(on hold)</span>
315
                                                    [% ELSIF ( ISSUE.too_many ) %]
322
                                                    [% ELSIF ( ISSUE.too_many ) %]
316
                                                        Not renewable
323
                                                        Not renewable
324
                                                    [% ELSIF ( ISSUE.too_unseen ) %]
325
                                                        Item must be seen by the library
317
                                                    [% ELSIF ( ISSUE.norenew_overdue ) %]
326
                                                    [% ELSIF ( ISSUE.norenew_overdue ) %]
318
                                                        Not allowed <span class="renewals">(overdue)</span>
327
                                                        Not allowed <span class="renewals">(overdue)</span>
319
                                                    [% ELSIF ( ISSUE.auto_too_late ) %]
328
                                                    [% ELSIF ( ISSUE.auto_too_late ) %]
320
                                                        No longer renewable
329
                                                        No longer renewable
321
                                                    [% ELSIF ISSUE.auto_too_much_oweing %]
330
                                                    [% ELSIF ISSUE.auto_too_much_oweing %]
322
                                                        Automatic renewal failed, you have unpaid fines.
331
                                                        Automatic renewal failed, you have unpaid fines.
323
                                                        <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
332
                                                        <span class="renewals">(
333
                                                            [% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining
334
                                                            [% IF Koha.Preference('UnseenRenewals') && ISSUE.unseenallowed %]
335
                                                                / [% ISSUE.unseenleft | html %] of [% ISSUE.unseenallowed | html %] renewals left before the item must be seen by the library
336
                                                            [% END %]
337
                                                        )</span>
324
                                                    [% ELSIF ISSUE.auto_account_expired %]
338
                                                    [% ELSIF ISSUE.auto_account_expired %]
325
                                                        Automatic renewal failed, your account is expired.
339
                                                        Automatic renewal failed, your account is expired.
326
                                                        <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
340
                                                        <span class="renewals">(
341
                                                            [% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining
342
                                                            [% IF Koha.Preference('UnseenRenewals') && ISSUE.unseenallowed %]
343
                                                                / [% ISSUE.unseenleft | html %] of [% ISSUE.unseenallowed | html %] renewals left before the item must be seen by the library
344
                                                            [% END %]
345
                                                        )</span>
327
                                                    [% ELSIF ( ISSUE.auto_renew || ISSUE.auto_too_soon ) %]
346
                                                    [% ELSIF ( ISSUE.auto_renew || ISSUE.auto_too_soon ) %]
328
                                                        Automatic renewal
347
                                                        Automatic renewal
329
                                                        <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
348
                                                        <span class="renewals">(
349
                                                            [% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining
350
                                                            [% IF Koha.Preference('UnseenRenewals') && ISSUE.unseenallowed %]
351
                                                                / [% ISSUE.unseenleft | html %] of [% ISSUE.unseenallowed | html %] renewals left before the item must be seen by the library
352
                                                            [% END %]
353
                                                        )</span>
330
                                                    [% ELSIF ( ISSUE.too_soon ) %]
354
                                                    [% ELSIF ( ISSUE.too_soon ) %]
331
                                                        No renewal before [% ISSUE.soonestrenewdate | html %]
355
                                                        No renewal before [% ISSUE.soonestrenewdate | html %]
332
                                                        <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
356
                                                        <span class="renewals">(
357
                                                            [% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining
358
                                                            [% IF Koha.Preference('UnseenRenewals') && ISSUE.unseenallowed %]
359
                                                                / [% ISSUE.unseenleft | html %] of [% ISSUE.unseenallowed | html %] renewals left before the item must be seen by the library
360
                                                            [% END %]
361
                                                        )</span>
333
                                                    [% ELSIF ( ISSUE.item_denied_renewal ) %]
362
                                                    [% ELSIF ( ISSUE.item_denied_renewal ) %]
334
                                                        Renewal not allowed
363
                                                        Renewal not allowed
335
                                                    [% END %]
364
                                                    [% END %]
Lines 582-588 Link Here
582
                                                            [% IF ( canrenew ) %]
611
                                                            [% IF ( canrenew ) %]
583
                                                                <a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&amp;item=[% OVERDUE.itemnumber | uri %]&amp;bornum=[% OVERDUE.borrowernumber | uri %]">Renew</a>
612
                                                                <a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&amp;item=[% OVERDUE.itemnumber | uri %]&amp;bornum=[% OVERDUE.borrowernumber | uri %]">Renew</a>
584
                                                            [% END %]
613
                                                            [% END %]
585
                                                                <span class="renewals">([% OVERDUE.renewsleft | html %] of [% OVERDUE.renewsallowed | html %] renewals remaining)</span>
614
                                                                <span class="renewals">(
615
                                                                    [% OVERDUE.renewsleft | html %] of [% OVERDUE.renewsallowed | html %] renewals remaining
616
                                                                    [% IF Koha.Preference('UnseenRenewals') && ISSUE.unseenallowed %]
617
                                                                        / [% OVERDUE.unseenleft | html %] of [% OVERDUE.unseenallowed | html %] renewals left before the item must be seen by the library
618
                                                                    [% END %]
619
                                                                )</span>
586
                                                        [% ELSIF ( OVERDUE.norenew_overdue ) %]
620
                                                        [% ELSIF ( OVERDUE.norenew_overdue ) %]
587
                                                            Not allowed<span class="renewals">(overdue)</span>
621
                                                            Not allowed<span class="renewals">(overdue)</span>
588
                                                        [% ELSIF ( OVERDUE.onreserve ) %]
622
                                                        [% 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 82-88 else { Link Here
82
            else {
82
            else {
83
                $branchcode = 'OPACRenew';
83
                $branchcode = 'OPACRenew';
84
            }
84
            }
85
            AddRenewal( $borrowernumber, $itemnumber, $branchcode, undef, undef );
85
            AddRenewal( $borrowernumber, $itemnumber, $branchcode, undef, undef, 0 );
86
            push( @renewed, $itemnumber );
86
            push( @renewed, $itemnumber );
87
        }
87
        }
88
        else {
88
        else {
(-)a/opac/opac-user.pl (-1 / +9 lines)
Lines 203-209 if ( $pending_checkouts->count ) { # Useless test Link Here
203
203
204
        # check if item is renewable
204
        # check if item is renewable
205
        my ($status,$renewerror) = CanBookBeRenewed( $borrowernumber, $issue->{'itemnumber'} );
205
        my ($status,$renewerror) = CanBookBeRenewed( $borrowernumber, $issue->{'itemnumber'} );
206
        ($issue->{'renewcount'},$issue->{'renewsallowed'},$issue->{'renewsleft'}) = GetRenewCount($borrowernumber, $issue->{'itemnumber'});
206
        (
207
            $issue->{'renewcount'},
208
            $issue->{'renewsallowed'},
209
            $issue->{'renewsleft'},
210
            $issue->{'unseencount'},
211
            $issue->{'unseenallowed'},
212
            $issue->{'unseenleft'}
213
        ) = GetRenewCount($borrowernumber, $issue->{'itemnumber'});
207
        ( $issue->{'renewalfee'}, $issue->{'renewalitemtype'} ) = GetIssuingCharges( $issue->{'itemnumber'}, $borrowernumber );
214
        ( $issue->{'renewalfee'}, $issue->{'renewalitemtype'} ) = GetIssuingCharges( $issue->{'itemnumber'}, $borrowernumber );
208
        $issue->{itemtype_object} = Koha::ItemTypes->find( Koha::Items->find( $issue->{itemnumber} )->effective_itemtype );
215
        $issue->{itemtype_object} = Koha::ItemTypes->find( Koha::Items->find( $issue->{itemnumber} )->effective_itemtype );
209
        if($status && C4::Context->preference("OpacRenewalAllowed")){
216
        if($status && C4::Context->preference("OpacRenewalAllowed")){
Lines 214-219 if ( $pending_checkouts->count ) { # Useless test Link Here
214
221
215
        if ($renewerror) {
222
        if ($renewerror) {
216
            $issue->{'too_many'}       = 1 if $renewerror eq 'too_many';
223
            $issue->{'too_many'}       = 1 if $renewerror eq 'too_many';
224
            $issue->{'too_unseen'}     = 1 if $renewerror eq 'too_unseen';
217
            $issue->{'on_reserve'}     = 1 if $renewerror eq 'on_reserve';
225
            $issue->{'on_reserve'}     = 1 if $renewerror eq 'on_reserve';
218
            $issue->{'norenew_overdue'} = 1 if $renewerror eq 'overdue';
226
            $issue->{'norenew_overdue'} = 1 if $renewerror eq 'overdue';
219
            $issue->{'auto_renew'}     = 1 if $renewerror eq 'auto_renew';
227
            $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