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

(-)a/C4/SIP/ILS.pm (-2 / +2 lines)
Lines 197-203 sub test_cardnumber_compare { Link Here
197
}
197
}
198
198
199
sub checkin {
199
sub checkin {
200
    my ( $self, $item_id, $trans_date, $return_date, $current_loc, $item_props, $cancel, $checked_in_ok ) = @_;
200
    my ( $self, $item_id, $trans_date, $return_date, $current_loc, $item_props, $cancel, $checked_in_ok, $cv_triggers_alert ) = @_;
201
    my ( $patron, $item, $circ );
201
    my ( $patron, $item, $circ );
202
202
203
    $circ = C4::SIP::ILS::Transaction::Checkin->new();
203
    $circ = C4::SIP::ILS::Transaction::Checkin->new();
Lines 206-212 sub checkin { Link Here
206
    $circ->item( $item = C4::SIP::ILS::Item->new($item_id) );
206
    $circ->item( $item = C4::SIP::ILS::Item->new($item_id) );
207
207
208
    if ($item) {
208
    if ($item) {
209
        $circ->do_checkin( $current_loc, $return_date );
209
        $circ->do_checkin( $current_loc, $return_date, $cv_triggers_alert );
210
    }
210
    }
211
    else {
211
    else {
212
        $circ->alert(1);
212
        $circ->alert(1);
(-)a/C4/SIP/ILS/Transaction/Checkin.pm (-1 / +12 lines)
Lines 47-52 sub do_checkin { Link Here
47
    my $self = shift;
47
    my $self = shift;
48
    my $branch = shift;
48
    my $branch = shift;
49
    my $return_date = shift;
49
    my $return_date = shift;
50
    my $cv_triggers_alert = shift;
51
50
    if (!$branch) {
52
    if (!$branch) {
51
        $branch = 'SIP2';
53
        $branch = 'SIP2';
52
    }
54
    }
Lines 66-71 sub do_checkin { Link Here
66
68
67
    $debug and warn "do_checkin() calling AddReturn($barcode, $branch)";
69
    $debug and warn "do_checkin() calling AddReturn($barcode, $branch)";
68
    my ($return, $messages, $issue, $borrower) = AddReturn($barcode, $branch, undef, undef, $return_date);
70
    my ($return, $messages, $issue, $borrower) = AddReturn($barcode, $branch, undef, undef, $return_date);
71
    $self->alert(!$return);
72
    # ignoring messages: NotIssued, WasLost, WasTransfered
69
73
70
    # biblionumber, biblioitemnumber, itemnumber
74
    # biblionumber, biblioitemnumber, itemnumber
71
    # borrowernumber, reservedate, branchcode
75
    # borrowernumber, reservedate, branchcode
Lines 115-121 sub do_checkin { Link Here
115
        $self->{item}->hold_patron_id( $messages->{ResFound}->{borrowernumber} );
119
        $self->{item}->hold_patron_id( $messages->{ResFound}->{borrowernumber} );
116
        $self->{item}->destination_loc( $messages->{ResFound}->{branchcode} );
120
        $self->{item}->destination_loc( $messages->{ResFound}->{branchcode} );
117
    }
121
    }
118
    $self->alert(defined $self->alert_type);  # alert_type could be "00", hypothetically
122
123
    my $alert = defined $self->alert_type;
124
    if ( $cv_triggers_alert ) {
125
        $self->alert($alert); # Overwrites existing alert value, should set to 0 if there is no alert type
126
    } else {
127
        $self->alert($alert) if $alert; # Doesn't affect alert value unless an alert type is set
128
    }
129
119
    $self->ok($return);
130
    $self->ok($return);
120
}
131
}
121
132
(-)a/C4/SIP/Sip/MsgType.pm (-1 / +1 lines)
Lines 637-643 sub handle_checkin { Link Here
637
        syslog( "LOG_WARNING", "received no-block checkin from terminal '%s'", $account->{id} );
637
        syslog( "LOG_WARNING", "received no-block checkin from terminal '%s'", $account->{id} );
638
        $status = $ils->checkin_no_block( $item_id, $trans_date, $return_date, $item_props, $cancel );
638
        $status = $ils->checkin_no_block( $item_id, $trans_date, $return_date, $item_props, $cancel );
639
    } else {
639
    } else {
640
        $status = $ils->checkin( $item_id, $trans_date, $return_date, $my_branch, $item_props, $cancel, $account->{checked_in_ok} );
640
        $status = $ils->checkin( $item_id, $trans_date, $return_date, $my_branch, $item_props, $cancel, $account->{checked_in_ok}, $account->{cv_triggers_alert} );
641
    }
641
    }
642
642
643
    $patron = $status->patron;
643
    $patron = $status->patron;
(-)a/etc/SIPconfig.xml (+1 lines)
Lines 53-58 Link Here
53
             send_patron_home_library_in_af="1"
53
             send_patron_home_library_in_af="1"
54
             cv_send_00_on_success="1"
54
             cv_send_00_on_success="1"
55
             ct_always_send="1"
55
             ct_always_send="1"
56
             cv_triggers_alert="1"
56
             ae_field_template="[% patron.surname %][% IF patron.firstname %], [% patron.firstname %][% END %]"
57
             ae_field_template="[% patron.surname %][% IF patron.firstname %], [% patron.firstname %][% END %]"
57
             da_field_template="[% patron.surname %][% IF patron.firstname %], [% patron.firstname %][% END %]"
58
             da_field_template="[% patron.surname %][% IF patron.firstname %], [% patron.firstname %][% END %]"
58
             av_field_template="[% accountline.description %] [% accountline.amountoutstanding | format('%.2f') %]" >
59
             av_field_template="[% accountline.description %] [% accountline.amountoutstanding | format('%.2f') %]" >
(-)a/t/db_dependent/SIP/Message.t (-2 / +20 lines)
Lines 67-73 subtest 'Testing Patron Info Request V2' => sub { Link Here
67
subtest 'Checkin V2' => sub {
67
subtest 'Checkin V2' => sub {
68
    my $schema = Koha::Database->new->schema;
68
    my $schema = Koha::Database->new->schema;
69
    $schema->storage->txn_begin;
69
    $schema->storage->txn_begin;
70
    plan tests => 25;
70
    plan tests => 27;
71
    $C4::SIP::Sip::protocol_version = 2;
71
    $C4::SIP::Sip::protocol_version = 2;
72
    test_checkin_v2();
72
    test_checkin_v2();
73
    $schema->storage->txn_rollback;
73
    $schema->storage->txn_rollback;
Lines 378-383 sub test_checkin_v2 { Link Here
378
    $server->{account}->{checked_in_ok} = 0;
378
    $server->{account}->{checked_in_ok} = 0;
379
    $server->{account}->{cv_send_00_on_success} = 0;
379
    $server->{account}->{cv_send_00_on_success} = 0;
380
380
381
    t::lib::Mocks::mock_preference( 'RecordLocalUseOnReturn', '1' );
382
    $server->{account}->{checked_in_ok} = 1;
383
    $server->{account}->{cv_triggers_alert} = 0;
384
    undef $response;
385
    $msg = C4::SIP::Sip::MsgType->new( $siprequest, 0 );
386
    $msg->handle_checkin( $server );
387
    $respcode = substr( $response, 0, 2 );
388
    is( substr( $response, 5, 1 ), 'Y', 'Checkin without CV triggers alert flag when cv_triggers_alert is off' );
389
    t::lib::Mocks::mock_preference( 'RecordLocalUseOnReturn', '0' );
390
    $server->{account}->{cv_triggers_alert} = 1;
391
    undef $response;
392
    $msg = C4::SIP::Sip::MsgType->new( $siprequest, 0 );
393
    $msg->handle_checkin( $server );
394
    $respcode = substr( $response, 0, 2 );
395
    is( substr( $response, 5, 1 ), 'N', 'Checkin without CV does not trigger alert flag when cv_triggers_alert is on' );
396
    $server->{account}->{checked_in_ok} = 0;
397
    $server->{account}->{cv_triggers_alert} = 0;
398
    t::lib::Mocks::mock_preference( 'RecordLocalUseOnReturn', '1' );
399
381
    $server->{account}->{checked_in_ok} = 1;
400
    $server->{account}->{checked_in_ok} = 1;
382
    $server->{account}->{ct_always_send} = 0;
401
    $server->{account}->{ct_always_send} = 0;
383
    undef $response;
402
    undef $response;
384
- 

Return to bug 22043