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

(-)a/C4/SIP/Sip/MsgType.pm (-1 / +1 lines)
Lines 996-1002 sub handle_patron_info { Link Here
996
996
997
    $resp = (PATRON_INFO_RESP);
997
    $resp = (PATRON_INFO_RESP);
998
    if ($patron) {
998
    if ($patron) {
999
        if ( C4::Context->preference('TrackLastPatronActivity') ) {
999
        if ( C4::Context->preference('TrackLastPatronActivityTriggers') ) {
1000
            my $koha_patron = Koha::Patrons->find($patron->{borrowernumber});
1000
            my $koha_patron = Koha::Patrons->find($patron->{borrowernumber});
1001
            $koha_patron->update_lastseen('connection');
1001
            $koha_patron->update_lastseen('connection');
1002
        }
1002
        }
(-)a/Koha/Patron.pm (-5 / +5 lines)
Lines 843-849 sub is_active { Link Here
843
    return 1 if DateTime->compare( dt_from_string( $self->dateenrolled ), $dt ) > -1;
843
    return 1 if DateTime->compare( dt_from_string( $self->dateenrolled ), $dt ) > -1;
844
844
845
    # Last seen? Updated each login when you track patron activity
845
    # Last seen? Updated each login when you track patron activity
846
    if ( C4::Context->preference('TrackLastPatronActivity') ) {
846
    if ( C4::Context->preference('TrackLastPatronActivityTriggers') ) {
847
        return 1 if DateTime->compare( dt_from_string( $self->lastseen ), $dt ) > -1;
847
        return 1 if DateTime->compare( dt_from_string( $self->lastseen ), $dt ) > -1;
848
    }
848
    }
849
849
Lines 1170-1184 sub _get_overdue_debarred_delay { Link Here
1170
1170
1171
  $patron->update_lastseen('activity');
1171
  $patron->update_lastseen('activity');
1172
1172
1173
Tracks a (successful) login attempt when the TrackLastPatronActivity preference is enabled
1173
Updates the lastseen field, limited to one update per day, whenever the activity passed is 
1174
and the activity passed is in the TrackLastPatronActivityTriggers list.
1174
listed in TrackLastPatronActivityTriggers.
1175
1176
The method should be called upon successful completion of the activity.
1175
1177
1176
=cut
1178
=cut
1177
1179
1178
sub update_lastseen {
1180
sub update_lastseen {
1179
    my ( $self, $activity ) = @_;
1181
    my ( $self, $activity ) = @_;
1180
    return $self if !C4::Context->preference('TrackLastPatronActivity');
1181
1182
    my $tracked_activities = {
1182
    my $tracked_activities = {
1183
        map { ( lc $_, 1 ); } split /\s*\,\s*/,
1183
        map { ( lc $_, 1 ); } split /\s*\,\s*/,
1184
        C4::Context->preference('TrackLastPatronActivityTriggers')
1184
        C4::Context->preference('TrackLastPatronActivityTriggers')
(-)a/installer/data/mysql/atomicupdate/bug_15504-add-tracklastpatronactivityoptions.pl (+6 lines)
Lines 18-22 return { Link Here
18
        );
18
        );
19
19
20
        say $out "Added system preference 'TrackLastPatronActivityTriggers'";
20
        say $out "Added system preference 'TrackLastPatronActivityTriggers'";
21
22
        $dbh->do(q{
23
            DELETE FROM systempreferences WHERE variable='TrackLastPatronActivity'
24
        });
25
26
        say $out "Removed system preference 'TrackLastPatronActivity'";
21
    },
27
    },
22
};
28
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (-1 lines)
Lines 747-753 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
747
('TraceCompleteSubfields','0','0','Force subject tracings to only match complete subfields.','YesNo'),
747
('TraceCompleteSubfields','0','0','Force subject tracings to only match complete subfields.','YesNo'),
748
('TraceSubjectSubdivisions','0','1','Create searches on all subdivisions for subject tracings.','YesNo'),
748
('TraceSubjectSubdivisions','0','1','Create searches on all subdivisions for subject tracings.','YesNo'),
749
('TrackClicks','0',NULL,'Track links clicked','Integer'),
749
('TrackClicks','0',NULL,'Track links clicked','Integer'),
750
('TrackLastPatronActivity','0',NULL,'If set, the field borrowers.lastseen will be updated everytime a patron is seen','YesNo'),
751
('TrackLastPatronActivityTriggers','',NULL,'If set, the field borrowers.lastseen will be updated everytime a patron is does a selected option','multiple'),
750
('TrackLastPatronActivityTriggers','',NULL,'If set, the field borrowers.lastseen will be updated everytime a patron is does a selected option','multiple'),
752
('TransfersBlockCirc','1',NULL,'Should the transfer modal block circulation staff from continuing scanning items','YesNo'),
751
('TransfersBlockCirc','1',NULL,'Should the transfer modal block circulation staff from continuing scanning items','YesNo'),
753
('TransfersMaxDaysWarning','3',NULL,'Define the days before a transfer is suspected of having a problem','Integer'),
752
('TransfersMaxDaysWarning','3',NULL,'Define the days before a transfer is suspected of having a problem','Integer'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (-7 / +1 lines)
Lines 93-105 Patrons: Link Here
93
               0: "Don't"
93
               0: "Don't"
94
         - charge a fee when a patron changes to a category with an enrollment fee.
94
         - charge a fee when a patron changes to a category with an enrollment fee.
95
     -
95
     -
96
         - pref: TrackLastPatronActivity
96
         - Select which patron activities should be tracked to signify patron activity. The first time each day that one of these activities occurs, borrowers.lastseen will update with the current date and time.
97
           choices:
98
               1: Do
99
               0: "Don't"
100
         - track last patron activity. Use TrackLastPatronActivityTriggers to select which activities should be tracked.
101
     -
102
         - Select which activities should be tracked. The first time each day that one of these activities occurs, borrowers.lastseen will update with the current date and time.
103
         - pref: TrackLastPatronActivityTriggers
97
         - pref: TrackLastPatronActivityTriggers
104
           multiple:
98
           multiple:
105
               login: "Login"
99
               login: "Login"
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/cleanborrowers.tt (-3 / +3 lines)
Lines 116-122 Link Here
116
                    <input size="10" id="borrower_dateexpiry" name="borrower_dateexpiry" type="text" class="flatpickr" />
116
                    <input size="10" id="borrower_dateexpiry" name="borrower_dateexpiry" type="text" class="flatpickr" />
117
                    <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
117
                    <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
118
                </li>
118
                </li>
119
                [% IF Koha.Preference('TrackLastPatronActivity') %]
119
                [% IF Koha.Preference('TrackLastPatronActivityTriggers') %]
120
                    <li>
120
                    <li>
121
                        <label for="borrower_lastseen">who have not been active since:</label>
121
                        <label for="borrower_lastseen">who have not been active since:</label>
122
                        <input size="10" id="borrower_lastseen" name="borrower_lastseen" type="text" class="flatpickr" />
122
                        <input size="10" id="borrower_lastseen" name="borrower_lastseen" type="text" class="flatpickr" />
Lines 222-228 Link Here
222
            <input type="hidden" name="not_borrowed_since" value="[% not_borrowed_since | $KohaDates dateformat => 'iso' %]" />
222
            <input type="hidden" name="not_borrowed_since" value="[% not_borrowed_since | $KohaDates dateformat => 'iso' %]" />
223
            <input type="hidden" name="last_issue_date" value="[% last_issue_date | $KohaDates dateformat => 'iso' %]" />
223
            <input type="hidden" name="last_issue_date" value="[% last_issue_date | $KohaDates dateformat => 'iso' %]" />
224
            <input type="hidden" name="borrower_dateexpiry" value="[% borrower_dateexpiry | $KohaDates dateformat => 'iso' %]" />
224
            <input type="hidden" name="borrower_dateexpiry" value="[% borrower_dateexpiry | $KohaDates dateformat => 'iso' %]" />
225
            [% IF Koha.Preference('TrackLastPatronActivity') %]
225
            [% IF Koha.Preference('TrackLastPatronActivityTriggers') %]
226
                <input type="hidden" name="borrower_lastseen" value="[% borrower_lastseen | $KohaDates dateformat => 'iso' %]" />
226
                <input type="hidden" name="borrower_lastseen" value="[% borrower_lastseen | $KohaDates dateformat => 'iso' %]" />
227
            [% END %]
227
            [% END %]
228
            <input type="hidden" name="borrower_categorycode" value="[% borrower_categorycode | html %]" />
228
            <input type="hidden" name="borrower_categorycode" value="[% borrower_categorycode | html %]" />
Lines 299-305 Link Here
299
         */
299
         */
300
        function checkForm(form) {
300
        function checkForm(form) {
301
            if((form.checkbox[0].checked)){
301
            if((form.checkbox[0].checked)){
302
                if ( (!form.date1.value) && (!form.borrower_dateexpiry.value) [% IF Koha.Preference('TrackLastPatronActivity') %]&& (!form.borrower_lastseen.value) [% END %]&& (!form.borrower_categorycode.value) && (!form.patron_list_id.value)){
302
                if ( (!form.date1.value) && (!form.borrower_dateexpiry.value) [% IF Koha.Preference('TrackLastPatronActivityTriggers') %]&& (!form.borrower_lastseen.value) [% END %]&& (!form.borrower_categorycode.value) && (!form.patron_list_id.value)){
303
                  alert(_("Please enter at least one criterion for deletion!"));
303
                  alert(_("Please enter at least one criterion for deletion!"));
304
                  return false;
304
                  return false;
305
                }
305
                }
(-)a/misc/cronjobs/delete_patrons.pl (-4 / +3 lines)
Lines 38-45 $not_borrowed_since = dt_from_string( $not_borrowed_since, 'iso' ) Link Here
38
$expired_before = dt_from_string( $expired_before, 'iso' )
38
$expired_before = dt_from_string( $expired_before, 'iso' )
39
  if $expired_before;
39
  if $expired_before;
40
40
41
if ( $last_seen and not C4::Context->preference('TrackLastPatronActivity') ) {
41
if ( $last_seen and not C4::Context->preference('TrackLastPatronActivityTriggers') ) {
42
    pod2usage(q{The --last_seen will be ineffective if TrackLastPatronActivity turned off or there are not TrackLastPatronActivityTriggers defined});
42
    pod2usage(q{The --last_seen will be ineffective if there are not TrackLastPatronActivityTriggers enabled});
43
}
43
}
44
44
45
unless ( $not_borrowed_since or $expired_before or $last_seen or @category_code or $branchcode or $file ) {
45
unless ( $not_borrowed_since or $expired_before or $last_seen or @category_code or $branchcode or $file ) {
Lines 185-192 Delete patrons with an account expired before this date. Link Here
185
185
186
Delete patrons who have not been active since this date.
186
Delete patrons who have not been active since this date.
187
187
188
The system preference TrackLastPatronActivity must be enabled and at least one TrackLastPatronActivityTriggers
188
The system preference TrackLastPatronActivityTriggers must be contain least trigger to use this option.
189
must be set to use this option.
190
189
191
=item B<--category_code>
190
=item B<--category_code>
192
191
(-)a/t/db_dependent/ILSDI_Services.t (-3 / +2 lines)
Lines 47-53 subtest 'AuthenticatePatron test' => sub { Link Here
47
47
48
    $schema->storage->txn_begin;
48
    $schema->storage->txn_begin;
49
49
50
    t::lib::Mocks::mock_preference( 'TrackLastPatronActivityTriggers', 'connection' );
51
50
52
    my $plain_password = 'tomasito';
51
    my $plain_password = 'tomasito';
53
52
Lines 71-77 subtest 'AuthenticatePatron test' => sub { Link Here
71
    $query->param( 'username', $borrower->{userid});
70
    $query->param( 'username', $borrower->{userid});
72
    $query->param( 'password', $plain_password);
71
    $query->param( 'password', $plain_password);
73
72
74
    t::lib::Mocks::mock_preference( 'TrackLastPatronActivity', '' );
73
    t::lib::Mocks::mock_preference( 'TrackLastPatronActivityTriggers', '' );
75
    my $reply = C4::ILSDI::Services::AuthenticatePatron( $query );
74
    my $reply = C4::ILSDI::Services::AuthenticatePatron( $query );
76
    is( $reply->{id}, $borrower->{borrowernumber}, "userid and password - Patron authenticated" );
75
    is( $reply->{id}, $borrower->{borrowernumber}, "userid and password - Patron authenticated" );
77
    is( $reply->{code}, undef, "Error code undef");
76
    is( $reply->{code}, undef, "Error code undef");
Lines 89-95 subtest 'AuthenticatePatron test' => sub { Link Here
89
    is( $reply->{code}, 'PatronNotFound', "non-existing userid - PatronNotFound" );
88
    is( $reply->{code}, 'PatronNotFound', "non-existing userid - PatronNotFound" );
90
    is( $reply->{id}, undef, "id undef");
89
    is( $reply->{id}, undef, "id undef");
91
90
92
    t::lib::Mocks::mock_preference( 'TrackLastPatronActivity', '1' );
91
    t::lib::Mocks::mock_preference( 'TrackLastPatronActivityTriggers', 'connection' );
93
    $query->param( 'username', uc( $borrower->{userid} ));
92
    $query->param( 'username', uc( $borrower->{userid} ));
94
    $reply = C4::ILSDI::Services::AuthenticatePatron( $query );
93
    $reply = C4::ILSDI::Services::AuthenticatePatron( $query );
95
    my $now = dt_from_string;
94
    my $now = dt_from_string;
(-)a/t/db_dependent/Koha/Patron.t (-6 / +5 lines)
Lines 338-351 subtest 'is_active' => sub { Link Here
338
    $patron->dateenrolled('2020-01-01')->store;
338
    $patron->dateenrolled('2020-01-01')->store;
339
339
340
    # Check lastseen, test days parameter
340
    # Check lastseen, test days parameter
341
    t::lib::Mocks::mock_preference( 'TrackLastPatronActivity', 1 );
341
    t::lib::Mocks::mock_preference( 'TrackLastPatronActivityTriggers', 'login' );
342
    $patron->update_lastseen('login');
342
    $patron->update_lastseen('login');
343
    is( $patron->is_active( { days => 1 } ), 1, 'Just logged in' );
343
    is( $patron->is_active( { days => 1 } ), 1, 'Just logged in' );
344
    my $ago = dt_from_string->subtract( days => 2 );
344
    my $ago = dt_from_string->subtract( days => 2 );
345
    $patron->lastseen($ago)->store;
345
    $patron->lastseen($ago)->store;
346
    is( $patron->is_active( { days => 1 } ), 0, 'Not active since yesterday' );
346
    is( $patron->is_active( { days => 1 } ), 0, 'Not active since yesterday' );
347
    is( $patron->is_active( { days => 3 } ), 1, 'Active within last 3 days' );
347
    is( $patron->is_active( { days => 3 } ), 1, 'Active within last 3 days' );
348
    t::lib::Mocks::mock_preference( 'TrackLastPatronActivity', 0 );
348
    t::lib::Mocks::mock_preference( 'TrackLastPatronActivityTriggers', '' );
349
    is( $patron->is_active( { days => 3 } ), 0, 'Pref disabled' );
349
    is( $patron->is_active( { days => 3 } ), 0, 'Pref disabled' );
350
350
351
    # Look at holds, test with weeks
351
    # Look at holds, test with weeks
Lines 1967-1973 subtest 'update_lastseen tests' => sub { Link Here
1967
    my $cache_key = "track_activity_" . $patron->borrowernumber;
1967
    my $cache_key = "track_activity_" . $patron->borrowernumber;
1968
    $cache->clear_from_cache($cache_key);
1968
    $cache->clear_from_cache($cache_key);
1969
1969
1970
    t::lib::Mocks::mock_preference( 'TrackLastPatronActivity',         '1' );
1971
    t::lib::Mocks::mock_preference( 'TrackLastPatronActivityTriggers', 'login,connection,check_in,check_out,renewal' );
1970
    t::lib::Mocks::mock_preference( 'TrackLastPatronActivityTriggers', 'login,connection,check_in,check_out,renewal' );
1972
1971
1973
    is( $patron->lastseen, undef, 'Patron should have not last seen when newly created' );
1972
    is( $patron->lastseen, undef, 'Patron should have not last seen when newly created' );
Lines 1977-1983 subtest 'update_lastseen tests' => sub { Link Here
1977
1976
1978
    $patron->update_lastseen('login');
1977
    $patron->update_lastseen('login');
1979
    $patron->_result()->discard_changes();
1978
    $patron->_result()->discard_changes();
1980
    isnt( $patron->lastseen, undef, 'Patron should have last seen set when TrackLastPatronActivity = 1' );
1979
    isnt( $patron->lastseen, undef, 'Patron should have last seen set when TrackLastPatronActivityTriggers contains values' );
1981
    my $last_seen = $patron->lastseen;
1980
    my $last_seen = $patron->lastseen;
1982
1981
1983
    Time::Fake->offset( $now->epoch + 5 );
1982
    Time::Fake->offset( $now->epoch + 5 );
Lines 2076-2087 subtest 'update_lastseen tests' => sub { Link Here
2076
    isnt( $patron->lastseen, $last_seen, 'Patron last seen should be changed after a renewal if we cleared the cache' );
2075
    isnt( $patron->lastseen, $last_seen, 'Patron last seen should be changed after a renewal if we cleared the cache' );
2077
2076
2078
    # Check that the preference takes effect
2077
    # Check that the preference takes effect
2079
    t::lib::Mocks::mock_preference( 'TrackLastPatronActivity', '0' );
2078
    t::lib::Mocks::mock_preference( 'TrackLastPatronActivityTriggers', '' );
2080
    $patron->lastseen(undef)->store;
2079
    $patron->lastseen(undef)->store;
2081
    $cache->clear_from_cache($cache_key);
2080
    $cache->clear_from_cache($cache_key);
2082
    $patron->update_lastseen('login');
2081
    $patron->update_lastseen('login');
2083
    $patron->_result()->discard_changes();
2082
    $patron->_result()->discard_changes();
2084
    is( $patron->lastseen, undef, 'Patron should still have last seen unchanged when TrackLastPatronActivity = 0' );
2083
    is( $patron->lastseen, undef, 'Patron should still have last seen unchanged when TrackLastPatronActivityTriggers is unset' );
2085
2084
2086
    Time::Fake->reset;
2085
    Time::Fake->reset;
2087
    $schema->storage->txn_rollback;
2086
    $schema->storage->txn_rollback;
(-)a/t/db_dependent/Koha/Patrons.t (-2 / +1 lines)
Lines 1619-1628 subtest 'BorrowersLog tests' => sub { Link Here
1619
    is( scalar @logs, 1, 'With BorrowerLogs, one detailed MODIFY action should be logged for the modification.' );
1619
    is( scalar @logs, 1, 'With BorrowerLogs, one detailed MODIFY action should be logged for the modification.' );
1620
1620
1621
    t::lib::Mocks::mock_preference( 'TrackLastPatronActivityTriggers', 'connection' );
1621
    t::lib::Mocks::mock_preference( 'TrackLastPatronActivityTriggers', 'connection' );
1622
    t::lib::Mocks::mock_preference( 'TrackLastPatronActivity', 1 );
1623
    $patron->update_lastseen('connection');
1622
    $patron->update_lastseen('connection');
1624
    @logs = $schema->resultset('ActionLog')->search( { module => 'MEMBERS', action => 'MODIFY', object => $patron->borrowernumber } );
1623
    @logs = $schema->resultset('ActionLog')->search( { module => 'MEMBERS', action => 'MODIFY', object => $patron->borrowernumber } );
1625
    is( scalar @logs, 1, 'With BorrowerLogs and TrackLastPatronActivity we should not spam the logs');
1624
    is( scalar @logs, 1, 'With BorrowerLogs and TrackLastPatronActivityTriggers we should not spam the logs');
1626
};
1625
};
1627
$schema->storage->txn_rollback;
1626
$schema->storage->txn_rollback;
1628
1627
(-)a/t/db_dependent/Members.t (-9 / +5 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 50;
20
use Test::More tests => 49;
21
use Test::MockModule;
21
use Test::MockModule;
22
use Test::Exception;
22
use Test::Exception;
23
23
Lines 280-286 is( scalar(@$patstodel),2,'Borrowers without issues deleted by expiration_date a Link Here
280
$patstodel = GetBorrowersToExpunge( {not_borrowed_since => '2016-01-02', patron_list_id => $list1->patron_list_id() } );
280
$patstodel = GetBorrowersToExpunge( {not_borrowed_since => '2016-01-02', patron_list_id => $list1->patron_list_id() } );
281
is( scalar(@$patstodel),2,'Borrowers without issues deleted by last issue date');
281
is( scalar(@$patstodel),2,'Borrowers without issues deleted by last issue date');
282
282
283
# Test GetBorrowersToExpunge and TrackLastPatronActivity
283
# Test GetBorrowersToExpunge and TrackLastPatronActivityTriggers
284
$dbh->do(q|UPDATE borrowers SET lastseen=NULL|);
284
$dbh->do(q|UPDATE borrowers SET lastseen=NULL|);
285
$builder->build({
285
$builder->build({
286
    source => 'Borrower',
286
    source => 'Borrower',
Lines 307-317 $builder->build({ Link Here
307
    }
307
    }
308
});
308
});
309
$patstodel = GetBorrowersToExpunge( { last_seen => '1999-12-12' });
309
$patstodel = GetBorrowersToExpunge( { last_seen => '1999-12-12' });
310
is( scalar @$patstodel, 0, 'TrackLastPatronActivity - 0 patrons must be deleted' );
310
is( scalar @$patstodel, 0, 'TrackLastPatronActivityTriggers - 0 patrons must be deleted' );
311
$patstodel = GetBorrowersToExpunge( { last_seen => '2016-02-15' });
311
$patstodel = GetBorrowersToExpunge( { last_seen => '2016-02-15' });
312
is( scalar @$patstodel, 2, 'TrackLastPatronActivity - 2 patrons must be deleted' );
312
is( scalar @$patstodel, 2, 'TrackLastPatronActivityTriggers - 2 patrons must be deleted' );
313
$patstodel = GetBorrowersToExpunge( { last_seen => '2016-04-04' });
313
$patstodel = GetBorrowersToExpunge( { last_seen => '2016-04-04' });
314
is( scalar @$patstodel, 3, 'TrackLastPatronActivity - 3 patrons must be deleted' );
314
is( scalar @$patstodel, 3, 'TrackLastPatronActivityTriggers - 3 patrons must be deleted' );
315
my $patron2 = $builder->build({
315
my $patron2 = $builder->build({
316
    source => 'Borrower',
316
    source => 'Borrower',
317
    value => {
317
    value => {
Lines 320-329 my $patron2 = $builder->build({ Link Here
320
    }
320
    }
321
});
321
});
322
t::lib::Mocks::mock_preference( 'TrackLastPatronActivityTriggers', 'connection' );
322
t::lib::Mocks::mock_preference( 'TrackLastPatronActivityTriggers', 'connection' );
323
t::lib::Mocks::mock_preference( 'TrackLastPatronActivity', '0' );
324
Koha::Patrons->find( $patron2->{borrowernumber} )->update_lastseen('connection');
325
is( Koha::Patrons->find( $patron2->{borrowernumber} )->lastseen, undef, 'Lastseen should not be changed' );
326
t::lib::Mocks::mock_preference( 'TrackLastPatronActivity', '1' );
327
Koha::Patrons->find( $patron2->{borrowernumber} )->update_lastseen('connection');
323
Koha::Patrons->find( $patron2->{borrowernumber} )->update_lastseen('connection');
328
isnt( Koha::Patrons->find( $patron2->{borrowernumber} )->lastseen, undef, 'Lastseen should be changed now' );
324
isnt( Koha::Patrons->find( $patron2->{borrowernumber} )->lastseen, undef, 'Lastseen should be changed now' );
329
325
(-)a/t/db_dependent/SIP/Message.t (-4 / +2 lines)
Lines 194-200 subtest 'Lastseen response' => sub { Link Here
194
    my $schema = Koha::Database->new->schema;
194
    my $schema = Koha::Database->new->schema;
195
    $schema->storage->txn_begin;
195
    $schema->storage->txn_begin;
196
196
197
    t::lib::Mocks::mock_preference( 'TrackLastPatronActivityTriggers', 'connection' );
198
197
199
    my $builder = t::lib::TestBuilder->new();
198
    my $builder = t::lib::TestBuilder->new();
200
    my $branchcode = $builder->build({ source => 'Branch' })->{branchcode};
199
    my $branchcode = $builder->build({ source => 'Branch' })->{branchcode};
Lines 220-226 subtest 'Lastseen response' => sub { Link Here
220
219
221
    my $server = { ils => $mocks->{ils} };
220
    my $server = { ils => $mocks->{ils} };
222
    undef $response;
221
    undef $response;
223
    t::lib::Mocks::mock_preference( 'TrackLastPatronActivity', '' );
222
    t::lib::Mocks::mock_preference( 'TrackLastPatronActivityTriggers', '' );
224
    $msg->handle_patron_info( $server );
223
    $msg->handle_patron_info( $server );
225
224
226
    isnt( $response, undef, 'At least we got a response.' );
225
    isnt( $response, undef, 'At least we got a response.' );
Lines 229-235 subtest 'Lastseen response' => sub { Link Here
229
    $seen_patron = Koha::Patrons->find({ cardnumber => $seen_patron->{cardnumber} });
228
    $seen_patron = Koha::Patrons->find({ cardnumber => $seen_patron->{cardnumber} });
230
    is( output_pref({str => $seen_patron->lastseen(), dateonly => 1}), output_pref({str => '2001-01-01', dateonly => 1}),'Last seen not updated if not tracking patrons');
229
    is( output_pref({str => $seen_patron->lastseen(), dateonly => 1}), output_pref({str => '2001-01-01', dateonly => 1}),'Last seen not updated if not tracking patrons');
231
    undef $response;
230
    undef $response;
232
    t::lib::Mocks::mock_preference( 'TrackLastPatronActivity', '1' );
231
    t::lib::Mocks::mock_preference( 'TrackLastPatronActivityTriggers', 'connection' );
233
    $msg->handle_patron_info( $server );
232
    $msg->handle_patron_info( $server );
234
233
235
    isnt( $response, undef, 'At least we got a response.' );
234
    isnt( $response, undef, 'At least we got a response.' );
236
- 

Return to bug 15504