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

(-)a/C4/Circulation.pm (-3 / +3 lines)
Lines 2751-2757 sub CanBookBeRenewed { Link Here
2751
            return ( 0, 'overdue');
2751
            return ( 0, 'overdue');
2752
        }
2752
        }
2753
2753
2754
        if ( $issue->auto_renew && $patron->autorenewal ) {
2754
        if ( $issue->auto_renew && $patron->autorenew_checkouts ) {
2755
2755
2756
            if ( $patron->category->effective_BlockExpiredPatronOpacActions and $patron->is_expired ) {
2756
            if ( $patron->category->effective_BlockExpiredPatronOpacActions and $patron->is_expired ) {
2757
                return ( 0, 'auto_account_expired' );
2757
                return ( 0, 'auto_account_expired' );
Lines 2807-2816 sub CanBookBeRenewed { Link Here
2807
2807
2808
            if ( $soonestrenewal > DateTime->now( time_zone => C4::Context->tz() ) )
2808
            if ( $soonestrenewal > DateTime->now( time_zone => C4::Context->tz() ) )
2809
            {
2809
            {
2810
                return ( 0, "auto_too_soon" ) if $issue->auto_renew && $patron->autorenewal;
2810
                return ( 0, "auto_too_soon" ) if $issue->auto_renew && $patron->autorenew_checkouts;
2811
                return ( 0, "too_soon" );
2811
                return ( 0, "too_soon" );
2812
            }
2812
            }
2813
            elsif ( $issue->auto_renew && $patron->autorenewal ) {
2813
            elsif ( $issue->auto_renew && $patron->autorenew_checkouts ) {
2814
                $auto_renew = 1;
2814
                $auto_renew = 1;
2815
            }
2815
            }
2816
        }
2816
        }
(-)a/Koha/Patron.pm (-1 / +1 lines)
Lines 1616-1622 sub to_api_mapping { Link Here
1616
        smsalertnumber      => 'sms_number',
1616
        smsalertnumber      => 'sms_number',
1617
        sort1               => 'statistics_1',
1617
        sort1               => 'statistics_1',
1618
        sort2               => 'statistics_2',
1618
        sort2               => 'statistics_2',
1619
        autorenewal         => 'autorenewal',
1619
        autorenew_checkouts => 'autorenew_checkouts',
1620
        streetnumber        => 'street_number',
1620
        streetnumber        => 'street_number',
1621
        streettype          => 'street_type',
1621
        streettype          => 'street_type',
1622
        zipcode             => 'postal_code',
1622
        zipcode             => 'postal_code',
(-)a/api/v1/swagger/definitions/patron.json (-1 / +1 lines)
Lines 191-197 Link Here
191
      "type": ["string", "null"],
191
      "type": ["string", "null"],
192
      "description": "a field that can be used for any information unique to the library"
192
      "description": "a field that can be used for any information unique to the library"
193
    },
193
    },
194
    "autorenewal": {
194
    "autorenew_checkouts": {
195
      "type": "boolean",
195
      "type": "boolean",
196
      "description": "indicate whether auto-renewal is allowed for patron"
196
      "description": "indicate whether auto-renewal is allowed for patron"
197
    },
197
    },
(-)a/api/v1/swagger/paths/patrons.json (-2 / +2 lines)
Lines 296-304 Link Here
296
        "required": false,
296
        "required": false,
297
        "type": "string"
297
        "type": "string"
298
      }, {
298
      }, {
299
        "name": "autorenewal",
299
        "name": "autorenew_checkouts",
300
        "in": "query",
300
        "in": "query",
301
        "description": "Search on autorenewal",
301
        "description": "Search on autorenew_checkouts",
302
        "required": false,
302
        "required": false,
303
        "type": "boolean"
303
        "type": "boolean"
304
      }, {
304
      }, {
(-)a/installer/data/mysql/atomicupdate/bug_24476_opt_out_of_auto_renewal.perl (-8 / +8 lines)
Lines 1-20 Link Here
1
$DBversion = 'XXX';
1
$DBversion = 'XXX';
2
if( CheckVersion( $DBversion ) ) {
2
if( CheckVersion( $DBversion ) ) {
3
    unless( column_exists('borrowers','autorenewal') ){
3
    unless( column_exists('borrowers','autorenew_checkouts') ){
4
        $dbh->do( "ALTER TABLE borrowers ADD COLUMN autorenewal TINYINT(1) NOT NULL DEFAULT 1" );
4
        $dbh->do( "ALTER TABLE borrowers ADD COLUMN autorenew_checkouts TINYINT(1) NOT NULL DEFAULT 1" );
5
    }
5
    }
6
    unless( column_exists('deletedborrowers','autorenewal') ){
6
    unless( column_exists('deletedborrowers','autorenew_checkouts') ){
7
        $dbh->do( "ALTER TABLE deletedborrowers ADD COLUMN autorenewal TINYINT(1) NOT NULL DEFAULT 1" );
7
        $dbh->do( "ALTER TABLE deletedborrowers ADD COLUMN autorenew_checkouts TINYINT(1) NOT NULL DEFAULT 1" );
8
    }
8
    }
9
    unless( column_exists('borrower_modifications','autorenewal') ){
9
    unless( column_exists('borrower_modifications','autorenew_checkouts') ){
10
        $dbh->do( "ALTER TABLE borrower_modifications ADD COLUMN autorenewal TINYINT(1) NOT NULL DEFAULT 1" );
10
        $dbh->do( "ALTER TABLE borrower_modifications ADD COLUMN autorenew_checkouts TINYINT(1) NOT NULL DEFAULT 1" );
11
    }
11
    }
12
    $dbh->do(q{
12
    $dbh->do(q{
13
        UPDATE systempreferences
13
        UPDATE systempreferences
14
        SET value  = CONCAT(value,'|autorenewal')
14
        SET value  = CONCAT(value,'|autorenew_checkouts')
15
        WHERE variable IN
15
        WHERE variable IN
16
        ('PatronSelfModificationBorrowerUnwantedField','PatronSelfRegistrationBorrowerUnwantedField')
16
        ('PatronSelfModificationBorrowerUnwantedField','PatronSelfRegistrationBorrowerUnwantedField')
17
        AND value NOT LIKE '%autorenewal%'
17
        AND value NOT LIKE '%autorenew_checkouts%'
18
    });
18
    });
19
    SetVersion( $DBversion );
19
    SetVersion( $DBversion );
20
    print "Upgrade to $DBversion done (Bug 24476 - Allow patrons to opt-out of autorenewal)\n";
20
    print "Upgrade to $DBversion done (Bug 24476 - Allow patrons to opt-out of autorenewal)\n";
(-)a/installer/data/mysql/kohastructure.sql (-3 / +3 lines)
Lines 589-595 CREATE TABLE `deletedborrowers` ( -- stores data related to the patrons/borrower Link Here
589
  `login_attempts` int(4) default 0, -- number of failed login attemps
589
  `login_attempts` int(4) default 0, -- number of failed login attemps
590
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
590
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
591
  `anonymized` TINYINT(1) NOT NULL DEFAULT 0, -- flag for data anonymization
591
  `anonymized` TINYINT(1) NOT NULL DEFAULT 0, -- flag for data anonymization
592
  `autorenewal` TINYINT(1) NOT NULL DEFAULT 1, -- flag for allowing auto-renewal
592
  `autorenew_checkouts` TINYINT(1) NOT NULL DEFAULT 1, -- flag for allowing auto-renewal
593
  KEY borrowernumber (borrowernumber),
593
  KEY borrowernumber (borrowernumber),
594
  KEY `cardnumber` (`cardnumber`),
594
  KEY `cardnumber` (`cardnumber`),
595
  KEY `sms_provider_id` (`sms_provider_id`)
595
  KEY `sms_provider_id` (`sms_provider_id`)
Lines 1531-1537 CREATE TABLE `borrowers` ( -- this table includes information about your patrons Link Here
1531
  `login_attempts` int(4) default 0, -- number of failed login attemps
1531
  `login_attempts` int(4) default 0, -- number of failed login attemps
1532
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
1532
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
1533
  `anonymized` TINYINT(1) NOT NULL DEFAULT 0, -- flag for data anonymization
1533
  `anonymized` TINYINT(1) NOT NULL DEFAULT 0, -- flag for data anonymization
1534
  `autorenewal` TINYINT(1) NOT NULL DEFAULT 1, -- flag for allowing auto-renewal
1534
  `autorenew_checkouts` TINYINT(1) NOT NULL DEFAULT 1, -- flag for allowing auto-renewal
1535
  UNIQUE KEY `cardnumber` (`cardnumber`),
1535
  UNIQUE KEY `cardnumber` (`cardnumber`),
1536
  PRIMARY KEY `borrowernumber` (`borrowernumber`),
1536
  PRIMARY KEY `borrowernumber` (`borrowernumber`),
1537
  KEY `categorycode` (`categorycode`),
1537
  KEY `categorycode` (`categorycode`),
Lines 3439-3445 CREATE TABLE IF NOT EXISTS `borrower_modifications` ( Link Here
3439
  `privacy` int(11) DEFAULT NULL,
3439
  `privacy` int(11) DEFAULT NULL,
3440
  `extended_attributes` MEDIUMTEXT DEFAULT NULL,
3440
  `extended_attributes` MEDIUMTEXT DEFAULT NULL,
3441
  `gdpr_proc_consent` datetime, -- data processing consent
3441
  `gdpr_proc_consent` datetime, -- data processing consent
3442
  `autorenewal` TINYINT(1) NOT NULL DEFAULT 1, -- flag for allowing auto-renewal
3442
  `autorenew_checkouts` TINYINT(1) NOT NULL DEFAULT 1, -- flag for allowing auto-renewal
3443
  PRIMARY KEY (`verification_token` (191),`borrowernumber`),
3443
  PRIMARY KEY (`verification_token` (191),`borrowernumber`),
3444
  KEY `verification_token` (`verification_token` (191)),
3444
  KEY `verification_token` (`verification_token` (191)),
3445
  KEY `borrowernumber` (`borrowernumber`)
3445
  KEY `borrowernumber` (`borrowernumber`)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-3 / +3 lines)
Lines 568-574 Link Here
568
                                                        <div id="set-automatic-renewal" class="circ-setting">
568
                                                        <div id="set-automatic-renewal" class="circ-setting">
569
                                                            [% IF NEEDSCONFIRMATION %]
569
                                                            [% IF NEEDSCONFIRMATION %]
570
                                                                [% IF auto_renew %]
570
                                                                [% IF auto_renew %]
571
                                                                    [% IF patron.autorenewal %]
571
                                                                    [% IF patron.autorenew_checkouts %]
572
                                                                        <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" disabled="disabled"
572
                                                                        <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" disabled="disabled"
573
                                                                        title="Patron has opted out of auto-renewal"/>
573
                                                                        title="Patron has opted out of auto-renewal"/>
574
                                                                    [% ELSE %]
574
                                                                    [% ELSE %]
Lines 578-586 Link Here
578
                                                                    <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" disabled="disabled" />
578
                                                                    <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" disabled="disabled" />
579
                                                                [% END %]
579
                                                                [% END %]
580
                                                            [% ELSE %]
580
                                                            [% ELSE %]
581
                                                                [% IF ( auto_renew && patron.autorenewal ) %]
581
                                                                [% IF ( auto_renew && patron.autorenew_checkouts ) %]
582
                                                                    <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" class="circ_setting" checked="checked" />
582
                                                                    <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" class="circ_setting" checked="checked" />
583
                                                                [% ELSIF patron.autorenewal %]
583
                                                                [% ELSIF patron.autorenew_checkouts %]
584
                                                                    <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" class="circ_setting" />
584
                                                                    <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" class="circ_setting" />
585
                                                                [% ELSE %]
585
                                                                [% ELSE %]
586
                                                                    <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" disabled="disabled"
586
                                                                    <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" disabled="disabled"
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-11 / +11 lines)
Lines 874-901 legend:hover { Link Here
874
                                            </li>
874
                                            </li>
875
                                        [% END # /UNLESS nosort2 %]
875
                                        [% END # /UNLESS nosort2 %]
876
876
877
                                        [% UNLESS noautorenewal %]
877
                                        [% UNLESS noautorenew_checkouts %]
878
                                            <li class="radio">
878
                                            <li class="radio">
879
                                                <label for="yes-autorenewal">
879
                                                <label for="yes-autorenew_checkouts">
880
                                                    Allow auto-renewal of items:
880
                                                    Allow auto-renewal of items:
881
                                                </label>
881
                                                </label>
882
                                                    [% IF ( autorenewal ) %]
882
                                                    [% IF ( autorenew_checkouts ) %]
883
                                                        <label for="yes-autorenewal">
883
                                                        <label for="yes-autorenew_checkouts">
884
                                                            Yes
884
                                                            Yes
885
                                                            <input type="radio" id="yes-autorenewal" name="autorenewal" value="1" checked="checked" />
885
                                                            <input type="radio" id="yes-autorenew_checkouts" name="autorenew_checkouts" value="1" checked="checked" />
886
                                                        </label>
886
                                                        </label>
887
                                                        <label for="no-autorenewal">
887
                                                        <label for="no-autorenew_checkouts">
888
                                                            No
888
                                                            No
889
                                                            <input type="radio" id="no-autorenewal" name="autorenewal" value="0" />
889
                                                            <input type="radio" id="no-autorenew_checkouts" name="autorenew_checkouts" value="0" />
890
                                                        </label>
890
                                                        </label>
891
                                                    [% ELSE %]
891
                                                    [% ELSE %]
892
                                                        <label for="yes-autorenewal">
892
                                                        <label for="yes-autorenew_checkouts">
893
                                                            Yes
893
                                                            Yes
894
                                                            <input type="radio" id="yes-autorenewal" name="autorenewal" value="1" />
894
                                                            <input type="radio" id="yes-autorenew_checkouts" name="autorenew_checkouts" value="1" />
895
                                                        </label>
895
                                                        </label>
896
                                                        <label for="no-autorenewal">
896
                                                        <label for="no-autorenew_checkouts">
897
                                                            No
897
                                                            No
898
                                                            <input type="radio" id="no-autorenewal" name="autorenewal" value="0" checked="checked" />
898
                                                            <input type="radio" id="no-autorenew_checkouts" name="autorenew_checkouts" value="0" checked="checked" />
899
                                                        </label>
899
                                                        </label>
900
                                                    [% END %]
900
                                                    [% END %]
901
                                            </li>
901
                                            </li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt (-1 / +1 lines)
Lines 52-58 Link Here
52
[% CASE 'contacttitle'        %]<span>Contact: Title</span>
52
[% CASE 'contacttitle'        %]<span>Contact: Title</span>
53
[% CASE 'relationship'        %]<span>Contact: Relationship</span>
53
[% CASE 'relationship'        %]<span>Contact: Relationship</span>
54
[% CASE 'sex'                 %]<span>Gender</span>
54
[% CASE 'sex'                 %]<span>Gender</span>
55
[% CASE 'autorenewal'         %]<span>Auto-renewal</span>
55
[% CASE 'autorenew_checkouts' %]<span>Auto-renewal</span>
56
[% CASE 'altcontactfirstname' %]<span>Alternate contact: First name</span>
56
[% CASE 'altcontactfirstname' %]<span>Alternate contact: First name</span>
57
[% CASE 'altcontactsurname'   %]<span>Alternate contact: Surname</span>
57
[% CASE 'altcontactsurname'   %]<span>Alternate contact: Surname</span>
58
[% CASE 'altcontactaddress1'  %]<span>Alternate contact: Address</span>
58
[% CASE 'altcontactaddress1'  %]<span>Alternate contact: Address</span>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt (-1 / +1 lines)
Lines 84-90 Link Here
84
            <li><span class="label">Library: </span>[% patron.library.branchname | html %]</li>
84
            <li><span class="label">Library: </span>[% patron.library.branchname | html %]</li>
85
            [% IF ( patron.sort1 ) %]<li><span class="label">Sort field 1:</span>[% AuthorisedValues.GetByCode('Bsort1', patron.sort1) | html %]</li>[% END %]
85
            [% IF ( patron.sort1 ) %]<li><span class="label">Sort field 1:</span>[% AuthorisedValues.GetByCode('Bsort1', patron.sort1) | html %]</li>[% END %]
86
            [% IF ( patron.sort2 ) %]<li><span class="label">Sort field 2:</span>[% AuthorisedValues.GetByCode('Bsort2', patron.sort2) | html %]</li>[% END %]
86
            [% IF ( patron.sort2 ) %]<li><span class="label">Sort field 2:</span>[% AuthorisedValues.GetByCode('Bsort2', patron.sort2) | html %]</li>[% END %]
87
            [% UNLESS ( patron.autorenewal ) %]<li>Auto renewal: Patron has opted out</li>[% END %]
87
            [% UNLESS ( patron.autorenew_checkouts ) %]<li>Auto renewal: Patron has opted out</li>[% END %]
88
        </ol>
88
        </ol>
89
    </div>
89
    </div>
90
    </div>
90
    </div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-2 / +2 lines)
Lines 520-527 Link Here
520
                                                [% AuthorisedValues.GetByCode('Bsort2', patron.sort2) | html %]
520
                                                [% AuthorisedValues.GetByCode('Bsort2', patron.sort2) | html %]
521
                                            </li>
521
                                            </li>
522
                                        [% END %]
522
                                        [% END %]
523
                                        [% UNLESS ( patron.autorenewal ) %]
523
                                        [% UNLESS ( patron.autorenew_checkouts ) %]
524
                                            <li id="patron-autorenewal">
524
                                            <li id="patron-autorenew_checkouts">
525
                                                <span class="label">Auto renewal:</span>
525
                                                <span class="label">Auto renewal:</span>
526
                                                Patron has opted out
526
                                                Patron has opted out
527
                                            </li>
527
                                            </li>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt (-11 / +11 lines)
Lines 258-286 Link Here
258
                                        [% END %]
258
                                        [% END %]
259
                                    </li>
259
                                    </li>
260
                                [% END %]
260
                                [% END %]
261
                                [% UNLESS hidden.defined('autorenewal') %]
261
                                [% UNLESS hidden.defined('autorenew_checkouts') %]
262
                                    <li class="lradio">
262
                                    <li class="lradio">
263
                                        <label for="yes-autorenewal">
263
                                        <label for="yes-autorenew_checkouts">
264
                                            Allow auto-renewal:
264
                                            Allow auto-renewal:
265
                                        </label>
265
                                        </label>
266
                                            [% IF ( borrower.autorenewal ) %]
266
                                            [% IF ( borrower.autorenew_checkouts ) %]
267
                                                <label class="radio inline" for="yes-autorenewal">
267
                                                <label class="radio inline" for="yes-autorenew_checkouts">
268
                                                    Yes
268
                                                    Yes
269
                                                    <input type="radio" id="yes-autorenewal" name="borrower_autorenewal" value="1" checked="checked" />
269
                                                    <input type="radio" id="yes-autorenew_checkouts" name="borrower_autorenew_checkouts" value="1" checked="checked" />
270
                                                </label>
270
                                                </label>
271
271
272
                                                <label class="radio inline" for="no-autorenewal">
272
                                                <label class="radio inline" for="no-autorenew_checkouts">
273
                                                    No
273
                                                    No
274
                                                    <input type="radio" id="no-autorenewal" name="borrower_autorenewal" value="0" />
274
                                                    <input type="radio" id="no-autorenew_checkouts" name="borrower_autorenew_checkouts" value="0" />
275
                                                </label>
275
                                                </label>
276
                                            [% ELSE %]
276
                                            [% ELSE %]
277
                                                <label class="radio inline" for="yes-autorenewal">
277
                                                <label class="radio inline" for="yes-autorenew_checkouts">
278
                                                    Yes
278
                                                    Yes
279
                                                    <input type="radio" id="yes-autorenewal" name="borrower_autorenewal" value="1" />
279
                                                    <input type="radio" id="yes-autorenew_checkouts" name="borrower_autorenew_checkouts" value="1" />
280
                                                </label>
280
                                                </label>
281
                                                <label class="radio inline" for="no-autorenewal">
281
                                                <label class="radio inline" for="no-autorenew_checkouts">
282
                                                    No
282
                                                    No
283
                                                    <input type="radio" id="no-autorenewal" name="borrower_autorenewal" value="0" checked="checked" />
283
                                                    <input type="radio" id="no-autorenew_checkouts" name="borrower_autorenew_checkouts" value="0" checked="checked" />
284
                                                </label>
284
                                                </label>
285
                                            [% END %]
285
                                            [% END %]
286
                                    </li>
286
                                    </li>
(-)a/misc/cronjobs/automatic_renewals.pl (-1 / +1 lines)
Lines 80-86 GetOptions( Link Here
80
pod2usage(0) if $help;
80
pod2usage(0) if $help;
81
cronlogaction();
81
cronlogaction();
82
82
83
my $auto_renews = Koha::Checkouts->search({ auto_renew => 1, 'borrower.autorenewal' => 1 },{ join => 'borrower'});
83
my $auto_renews = Koha::Checkouts->search({ auto_renew => 1, 'borrower.autorenew_checkouts' => 1 },{ join => 'borrower'});
84
84
85
my %report;
85
my %report;
86
$verbose = 1 unless $verbose or $confirm;
86
$verbose = 1 unless $verbose or $confirm;
(-)a/t/db_dependent/Circulation.t (-9 / +8 lines)
Lines 657-666 subtest "CanBookBeRenewed tests" => sub { Link Here
657
657
658
658
659
659
660
    $renewing_borrower_obj->autorenewal(0)->store;
660
    $renewing_borrower_obj->autorenew_checkouts(0)->store;
661
    ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrowernumber, $item_4->itemnumber );
661
    ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrowernumber, $item_4->itemnumber );
662
    is( $renewokay, 1, 'No renewal before is undef, but patron opted out of auto_renewal' );
662
    is( $renewokay, 1, 'No renewal before is undef, but patron opted out of auto_renewal' );
663
    $renewing_borrower_obj->autorenewal(1)->store;
663
    $renewing_borrower_obj->autorenew_checkouts(1)->store;
664
664
665
665
666
    # Bug 7413
666
    # Bug 7413
Lines 706-716 subtest "CanBookBeRenewed tests" => sub { Link Here
706
        'Bug 14101: Cannot renew, renewal is automatic and premature (returned code is auto_too_soon)'
706
        'Bug 14101: Cannot renew, renewal is automatic and premature (returned code is auto_too_soon)'
707
    );
707
    );
708
708
709
    $renewing_borrower_obj->autorenewal(0)->store;
709
    $renewing_borrower_obj->autorenew_checkouts(0)->store;
710
    ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrowernumber, $item_4->itemnumber );
710
    ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrowernumber, $item_4->itemnumber );
711
    is( $renewokay, 0, 'No renewal before is 7, patron opted out of auto_renewal still cannot renew early' );
711
    is( $renewokay, 0, 'No renewal before is 7, patron opted out of auto_renewal still cannot renew early' );
712
    is( $error, 'too_soon', 'Error is too_soon, no auto' );
712
    is( $error, 'too_soon', 'Error is too_soon, no auto' );
713
    $renewing_borrower_obj->autorenewal(1)->store;
713
    $renewing_borrower_obj->autorenew_checkouts(1)->store;
714
714
715
    # Change policy so that loans can only be renewed exactly on due date (0 days prior to due date)
715
    # Change policy so that loans can only be renewed exactly on due date (0 days prior to due date)
716
    # and test automatic renewal again
716
    # and test automatic renewal again
Lines 722-732 subtest "CanBookBeRenewed tests" => sub { Link Here
722
        'Bug 14101: Cannot renew, renewal is automatic and premature, "No renewal before" = 0 (returned code is auto_too_soon)'
722
        'Bug 14101: Cannot renew, renewal is automatic and premature, "No renewal before" = 0 (returned code is auto_too_soon)'
723
    );
723
    );
724
724
725
    $renewing_borrower_obj->autorenewal(0)->store;
725
    $renewing_borrower_obj->autorenew_checkouts(0)->store;
726
    ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrowernumber, $item_4->itemnumber );
726
    ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrowernumber, $item_4->itemnumber );
727
    is( $renewokay, 0, 'No renewal before is 0, patron opted out of auto_renewal still cannot renew early' );
727
    is( $renewokay, 0, 'No renewal before is 0, patron opted out of auto_renewal still cannot renew early' );
728
    is( $error, 'too_soon', 'Error is too_soon, no auto' );
728
    is( $error, 'too_soon', 'Error is too_soon, no auto' );
729
    $renewing_borrower_obj->autorenewal(1)->store;
729
    $renewing_borrower_obj->autorenew_checkouts(1)->store;
730
730
731
    # Change policy so that loans can be renewed 99 days prior to the due date
731
    # Change policy so that loans can be renewed 99 days prior to the due date
732
    # and test automatic renewal again
732
    # and test automatic renewal again
Lines 738-747 subtest "CanBookBeRenewed tests" => sub { Link Here
738
        'Bug 14101: Cannot renew, renewal is automatic (returned code is auto_renew)'
738
        'Bug 14101: Cannot renew, renewal is automatic (returned code is auto_renew)'
739
    );
739
    );
740
740
741
    $renewing_borrower_obj->autorenewal(0)->store;
741
    $renewing_borrower_obj->autorenew_checkouts(0)->store;
742
    ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrowernumber, $item_4->itemnumber );
742
    ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrowernumber, $item_4->itemnumber );
743
    is( $renewokay, 1, 'No renewal before is 99, patron opted out of auto_renewal so can renew' );
743
    is( $renewokay, 1, 'No renewal before is 99, patron opted out of auto_renewal so can renew' );
744
    $renewing_borrower_obj->autorenewal(1)->store;
744
    $renewing_borrower_obj->autorenew_checkouts(1)->store;
745
745
746
    subtest "too_late_renewal / no_auto_renewal_after" => sub {
746
    subtest "too_late_renewal / no_auto_renewal_after" => sub {
747
        plan tests => 14;
747
        plan tests => 14;
748
- 

Return to bug 24476