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

(-)a/C4/SIP/ILS/Patron.pm (+17 lines)
Lines 28-33 use Koha::Libraries; Link Here
28
use Koha::Patrons;
28
use Koha::Patrons;
29
use Koha::Checkouts;
29
use Koha::Checkouts;
30
use Koha::TemplateUtils qw( process_tt );
30
use Koha::TemplateUtils qw( process_tt );
31
use Koha::Patron::Messages;
32
use Koha::DateUtils qw(dt_from_string output_pref);
31
33
32
our $kp;    # koha patron
34
our $kp;    # koha patron
33
35
Lines 164-169 sub new { Link Here
164
            }
166
            }
165
        }
167
        }
166
    }
168
    }
169
    my $patron_messages = Koha::Patron::Messages->search(
170
        {
171
            borrowernumber => $kp->{borrowernumber},
172
            message_type => 'B',
173
        }
174
    );
175
    my @messages_array;
176
    while ( my $message = $patron_messages->next ) {
177
        my $messagedt = dt_from_string( $message->message_date, 'iso' );
178
        my $formatted_date = output_pref({ dt => $messagedt, dateonly => 1});
179
        push @messages_array, $formatted_date . ": " . $message->message;
180
    }
181
    if (@messages_array) {
182
        $ilspatron{screen_msg} .= ". Messages for you: " . join(' / ', @messages_array);
183
    }
167
184
168
    # FIXME: populate fine_items recall_items
185
    # FIXME: populate fine_items recall_items
169
    $ilspatron{unavail_holds} = _get_outstanding_holds($kp->{borrowernumber});
186
    $ilspatron{unavail_holds} = _get_outstanding_holds($kp->{borrowernumber});
(-)a/t/db_dependent/SIP/Patron.t (-2 / +28 lines)
Lines 4-10 Link Here
4
# This needs to be extended! Your help is appreciated..
4
# This needs to be extended! Your help is appreciated..
5
5
6
use Modern::Perl;
6
use Modern::Perl;
7
use Test::More tests => 10;
7
use Test::More tests => 11;
8
8
9
use t::lib::Mocks;
9
use t::lib::Mocks;
10
use t::lib::TestBuilder;
10
use t::lib::TestBuilder;
Lines 405-407 subtest "NoIssuesChargeGuarantorsWithGuarantees tests" => sub { Link Here
405
405
406
    $schema->storage->txn_rollback;
406
    $schema->storage->txn_rollback;
407
};
407
};
408
- 
408
409
subtest "Patron messages tests" => sub {
410
    plan tests => 1;
411
    $schema->storage->txn_begin;
412
    my $today = output_pref({ dt => dt_from_string(), dateonly => 1});
413
    my $patron = $builder->build_object({ class => 'Koha::Patrons' });
414
    my $library = $builder->build_object ({ class => 'Koha::Libraries' });
415
    my $new_message_1  = Koha::Patron::Message->new(
416
        { borrowernumber => $patron->id,
417
          branchcode     => $library->branchcode,
418
          message_type   => 'B',
419
          message        => 'my message 1',
420
        })->store;
421
422
    my $new_message_2  = Koha::Patron::Message->new(
423
        { borrowernumber => $patron->id,
424
          branchcode     => $library->branchcode,
425
          message_type   => 'B',
426
          message        => 'my message 2',
427
        })->store;
428
429
430
    my $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber );
431
    like( $sip_patron->screen_msg, qr/Messages for you: $today: my message 1 \/ $today: my message 2/,"Screen message includes patron messages");
432
433
    $schema->storage->txn_rollback;
434
};

Return to bug 25816