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

(-)a/C4/Circulation.pm (-3 / +3 lines)
Lines 2743-2749 sub CanBookBeRenewed { Link Here
2743
            return ( 0, 'overdue');
2743
            return ( 0, 'overdue');
2744
        }
2744
        }
2745
2745
2746
        if ( $issue->auto_renew && $patron->autorenewal ) {
2746
        if ( $issue->auto_renew && $patron->autorenew_checkouts ) {
2747
2747
2748
            if ( $patron->category->effective_BlockExpiredPatronOpacActions and $patron->is_expired ) {
2748
            if ( $patron->category->effective_BlockExpiredPatronOpacActions and $patron->is_expired ) {
2749
                return ( 0, 'auto_account_expired' );
2749
                return ( 0, 'auto_account_expired' );
Lines 2799-2808 sub CanBookBeRenewed { Link Here
2799
2799
2800
            if ( $soonestrenewal > DateTime->now( time_zone => C4::Context->tz() ) )
2800
            if ( $soonestrenewal > DateTime->now( time_zone => C4::Context->tz() ) )
2801
            {
2801
            {
2802
                return ( 0, "auto_too_soon" ) if $issue->auto_renew && $patron->autorenewal;
2802
                return ( 0, "auto_too_soon" ) if $issue->auto_renew && $patron->autorenew_checkouts;
2803
                return ( 0, "too_soon" );
2803
                return ( 0, "too_soon" );
2804
            }
2804
            }
2805
            elsif ( $issue->auto_renew && $patron->autorenewal ) {
2805
            elsif ( $issue->auto_renew && $patron->autorenew_checkouts ) {
2806
                $auto_renew = 1;
2806
                $auto_renew = 1;
2807
            }
2807
            }
2808
        }
2808
        }
(-)a/Koha/Patron.pm (-1 / +1 lines)
Lines 1607-1613 sub to_api_mapping { Link Here
1607
        smsalertnumber      => 'sms_number',
1607
        smsalertnumber      => 'sms_number',
1608
        sort1               => 'statistics_1',
1608
        sort1               => 'statistics_1',
1609
        sort2               => 'statistics_2',
1609
        sort2               => 'statistics_2',
1610
        autorenewal         => 'autorenewal',
1610
        autorenew_checkouts => 'autorenew_checkouts',
1611
        streetnumber        => 'street_number',
1611
        streetnumber        => 'street_number',
1612
        streettype          => 'street_type',
1612
        streettype          => 'street_type',
1613
        zipcode             => 'postal_code',
1613
        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 590-596 CREATE TABLE `deletedborrowers` ( -- stores data related to the patrons/borrower Link Here
590
  `login_attempts` int(4) default 0, -- number of failed login attemps
590
  `login_attempts` int(4) default 0, -- number of failed login attemps
591
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
591
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
592
  `anonymized` TINYINT(1) NOT NULL DEFAULT 0, -- flag for data anonymization
592
  `anonymized` TINYINT(1) NOT NULL DEFAULT 0, -- flag for data anonymization
593
  `autorenewal` TINYINT(1) NOT NULL DEFAULT 1, -- flag for allowing auto-renewal
593
  `autorenew_checkouts` TINYINT(1) NOT NULL DEFAULT 1, -- flag for allowing auto-renewal
594
  KEY borrowernumber (borrowernumber),
594
  KEY borrowernumber (borrowernumber),
595
  KEY `cardnumber` (`cardnumber`),
595
  KEY `cardnumber` (`cardnumber`),
596
  KEY `sms_provider_id` (`sms_provider_id`)
596
  KEY `sms_provider_id` (`sms_provider_id`)
Lines 1545-1551 CREATE TABLE `borrowers` ( -- this table includes information about your patrons Link Here
1545
  `login_attempts` int(4) default 0, -- number of failed login attemps
1545
  `login_attempts` int(4) default 0, -- number of failed login attemps
1546
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
1546
  `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
1547
  `anonymized` TINYINT(1) NOT NULL DEFAULT 0, -- flag for data anonymization
1547
  `anonymized` TINYINT(1) NOT NULL DEFAULT 0, -- flag for data anonymization
1548
  `autorenewal` TINYINT(1) NOT NULL DEFAULT 1, -- flag for allowing auto-renewal
1548
  `autorenew_checkouts` TINYINT(1) NOT NULL DEFAULT 1, -- flag for allowing auto-renewal
1549
  UNIQUE KEY `cardnumber` (`cardnumber`),
1549
  UNIQUE KEY `cardnumber` (`cardnumber`),
1550
  PRIMARY KEY `borrowernumber` (`borrowernumber`),
1550
  PRIMARY KEY `borrowernumber` (`borrowernumber`),
1551
  KEY `categorycode` (`categorycode`),
1551
  KEY `categorycode` (`categorycode`),
Lines 3434-3440 CREATE TABLE IF NOT EXISTS `borrower_modifications` ( Link Here
3434
  `privacy` int(11) DEFAULT NULL,
3434
  `privacy` int(11) DEFAULT NULL,
3435
  `extended_attributes` MEDIUMTEXT DEFAULT NULL,
3435
  `extended_attributes` MEDIUMTEXT DEFAULT NULL,
3436
  `gdpr_proc_consent` datetime, -- data processing consent
3436
  `gdpr_proc_consent` datetime, -- data processing consent
3437
  `autorenewal` TINYINT(1) NOT NULL DEFAULT 1, -- flag for allowing auto-renewal
3437
  `autorenew_checkouts` TINYINT(1) NOT NULL DEFAULT 1, -- flag for allowing auto-renewal
3438
  PRIMARY KEY (`verification_token` (191),`borrowernumber`),
3438
  PRIMARY KEY (`verification_token` (191),`borrowernumber`),
3439
  KEY `verification_token` (`verification_token` (191)),
3439
  KEY `verification_token` (`verification_token` (191)),
3440
  KEY `borrowernumber` (`borrowernumber`)
3440
  KEY `borrowernumber` (`borrowernumber`)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-3 / +3 lines)
Lines 567-573 Link Here
567
                                                        <div id="set-automatic-renewal" class="circ-setting">
567
                                                        <div id="set-automatic-renewal" class="circ-setting">
568
                                                            [% IF NEEDSCONFIRMATION %]
568
                                                            [% IF NEEDSCONFIRMATION %]
569
                                                                [% IF auto_renew %]
569
                                                                [% IF auto_renew %]
570
                                                                    [% IF patron.autorenewal %]
570
                                                                    [% IF patron.autorenew_checkouts %]
571
                                                                        <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" disabled="disabled"
571
                                                                        <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" disabled="disabled"
572
                                                                        title="Patron has opted out of auto-renewal"/>
572
                                                                        title="Patron has opted out of auto-renewal"/>
573
                                                                    [% ELSE %]
573
                                                                    [% ELSE %]
Lines 577-585 Link Here
577
                                                                    <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" disabled="disabled" />
577
                                                                    <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" disabled="disabled" />
578
                                                                [% END %]
578
                                                                [% END %]
579
                                                            [% ELSE %]
579
                                                            [% ELSE %]
580
                                                                [% IF ( auto_renew && patron.autorenewal ) %]
580
                                                                [% IF ( auto_renew && patron.autorenew_checkouts ) %]
581
                                                                    <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" class="circ_setting" checked="checked" />
581
                                                                    <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" class="circ_setting" checked="checked" />
582
                                                                [% ELSIF patron.autorenewal %]
582
                                                                [% ELSIF patron.autorenew_checkouts %]
583
                                                                    <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" class="circ_setting" />
583
                                                                    <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" class="circ_setting" />
584
                                                                [% ELSE %]
584
                                                                [% ELSE %]
585
                                                                    <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" disabled="disabled"
585
                                                                    <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 810-837 Link Here
810
                                            </li>
810
                                            </li>
811
                                        [% END # /UNLESS nosort2 %]
811
                                        [% END # /UNLESS nosort2 %]
812
812
813
                                        [% UNLESS noautorenewal %]
813
                                        [% UNLESS noautorenew_checkouts %]
814
                                            <li class="radio">
814
                                            <li class="radio">
815
                                                <label for="yes-autorenewal">
815
                                                <label for="yes-autorenew_checkouts">
816
                                                    Allow auto-renewal of items:
816
                                                    Allow auto-renewal of items:
817
                                                </label>
817
                                                </label>
818
                                                    [% IF ( autorenewal ) %]
818
                                                    [% IF ( autorenew_checkouts ) %]
819
                                                        <label for="yes-autorenewal">
819
                                                        <label for="yes-autorenew_checkouts">
820
                                                            Yes
820
                                                            Yes
821
                                                            <input type="radio" id="yes-autorenewal" name="autorenewal" value="1" checked="checked" />
821
                                                            <input type="radio" id="yes-autorenew_checkouts" name="autorenew_checkouts" value="1" checked="checked" />
822
                                                        </label>
822
                                                        </label>
823
                                                        <label for="no-autorenewal">
823
                                                        <label for="no-autorenew_checkouts">
824
                                                            No
824
                                                            No
825
                                                            <input type="radio" id="no-autorenewal" name="autorenewal" value="0" />
825
                                                            <input type="radio" id="no-autorenew_checkouts" name="autorenew_checkouts" value="0" />
826
                                                        </label>
826
                                                        </label>
827
                                                    [% ELSE %]
827
                                                    [% ELSE %]
828
                                                        <label for="yes-autorenewal">
828
                                                        <label for="yes-autorenew_checkouts">
829
                                                            Yes
829
                                                            Yes
830
                                                            <input type="radio" id="yes-autorenewal" name="autorenewal" value="1" />
830
                                                            <input type="radio" id="yes-autorenew_checkouts" name="autorenew_checkouts" value="1" />
831
                                                        </label>
831
                                                        </label>
832
                                                        <label for="no-autorenewal">
832
                                                        <label for="no-autorenew_checkouts">
833
                                                            No
833
                                                            No
834
                                                            <input type="radio" id="no-autorenewal" name="autorenewal" value="0" checked="checked" />
834
                                                            <input type="radio" id="no-autorenew_checkouts" name="autorenew_checkouts" value="0" checked="checked" />
835
                                                        </label>
835
                                                        </label>
836
                                                    [% END %]
836
                                                    [% END %]
837
                                            </li>
837
                                            </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