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

(-)a/Koha/ILL/Backend/Standard.pm (-1 / +1 lines)
Lines 149-155 sub metadata { Link Here
149
    my $metadata = {};
149
    my $metadata = {};
150
    my @ignore   = (
150
    my @ignore   = (
151
        'requested_partners', 'type', 'type_disclaimer_value', 'type_disclaimer_date', 'unauthenticated_first_name',
151
        'requested_partners', 'type', 'type_disclaimer_value', 'type_disclaimer_date', 'unauthenticated_first_name',
152
        'unauthenticated_last_name', 'unauthenticated_email'
152
        'unauthenticated_last_name', 'unauthenticated_email', 'historycheck_requests'
153
    );
153
    );
154
    my $core_fields = _get_core_fields();
154
    my $core_fields = _get_core_fields();
155
    while ( my $attr = $attrs->next ) {
155
    while ( my $attr = $attrs->next ) {
(-)a/Koha/ILL/Request.pm (+17 lines)
Lines 2297-2302 sub can_patron_place_ill_in_opac { Link Here
2297
    return 1;
2297
    return 1;
2298
}
2298
}
2299
2299
2300
=head3 get_history_check_requests
2301
2302
    $self->get_history_check_requests();
2303
2304
Returns a list of history check requests for this request
2305
2306
=cut
2307
2308
sub get_history_check_requests {
2309
    my ($self) = @_;
2310
2311
    my $historycheck_attribute = $self->extended_attributes->find( { 'type' => 'historycheck_requests' } );
2312
    return unless $historycheck_attribute;
2313
2314
    return Koha::ILL::Requests->search( { 'me.illrequest_id' => [ split qr{\|}, $historycheck_attribute->value ] } );
2315
}
2316
2300
=head3 get_op_param_deprecation
2317
=head3 get_op_param_deprecation
2301
2318
2302
    my $op = $req->check_url_param_deprecation($params);
2319
    my $op = $req->check_url_param_deprecation($params);
(-)a/Koha/ILL/Request/Workflow/HistoryCheck.pm (-33 / +34 lines)
Lines 85-100 sub history_check_template_params { Link Here
85
85
86
    $params->{cardnumber} = C4::Context->userenv->{'cardnumber'} || 0 if $self->{ui_context} eq 'opac';
86
    $params->{cardnumber} = C4::Context->userenv->{'cardnumber'} || 0 if $self->{ui_context} eq 'opac';
87
87
88
    my $backend = Koha::ILL::Request->new->load_backend( $params->{backend} );
88
    my $backend        = Koha::ILL::Request->new->load_backend( $params->{backend} );
89
    my $fields_mapping = {
90
        cardnumber => __('Cardnumber'),
91
        branchcode => __('Library'),
92
        backend    => __('Backend'),
93
    };
89
    my $mapping_function;
94
    my $mapping_function;
90
    eval {
95
    eval {
91
        $mapping_function = sub { return $backend->{_my_backend}->_get_core_fields()->{ $_[0] } };
96
        my $backend_mapping = $backend->{_my_backend}->_get_core_fields();
92
        $backend->{_my_backend}->_get_core_fields();
97
        $fields_mapping   = { %$fields_mapping, %$backend_mapping };
98
        $mapping_function = sub { return $fields_mapping->{ $_[0] } };
93
    };
99
    };
94
    if ($@) {
100
    if ($@) {
95
        $mapping_function = sub { return $_[0] };
101
        $mapping_function = sub { return $fields_mapping->{ $_[0] } };
96
    }
102
    }
97
103
104
    my @sorted_params = sort {
105
        my $a_val = $mapping_function->($a) // $a;
106
        my $b_val = $mapping_function->($b) // $b;
107
        lc($a_val) cmp lc($b_val)
108
    } keys %$params;
109
110
    @sorted_params = map {
111
        { $_ => $params->{$_} }
112
    } @sorted_params;
113
98
    my $matching_requests_for_patron = $self->_find_matching_requests();
114
    my $matching_requests_for_patron = $self->_find_matching_requests();
99
115
100
    return (
116
    return (
Lines 103-108 sub history_check_template_params { Link Here
103
        matching_requests_for_patron => $matching_requests_for_patron,
119
        matching_requests_for_patron => $matching_requests_for_patron,
104
        $self->{ui_context} eq 'staff'
120
        $self->{ui_context} eq 'staff'
105
        ? (
121
        ? (
122
            sorted_params      => \@sorted_params,
106
            key_mapping        => $mapping_function,
123
            key_mapping        => $mapping_function,
107
            request_patron_obj => Koha::Patrons->find( { cardnumber => $params->{cardnumber} } )
124
            request_patron_obj => Koha::Patrons->find( { cardnumber => $params->{cardnumber} } )
108
            )
125
            )
Lines 133-185 sub after_request_created { Link Here
133
    my $patron_cardnumber            = C4::Context->userenv->{'cardnumber'} || 0;
150
    my $patron_cardnumber            = C4::Context->userenv->{'cardnumber'} || 0;
134
    my $matching_requests_for_patron = $self->_find_matching_requests();
151
    my $matching_requests_for_patron = $self->_find_matching_requests();
135
152
136
    my $staffnotes;
153
    my $historycheck_requests;
137
138
    if ($matching_requests_for_patron) {
154
    if ($matching_requests_for_patron) {
139
        my $appended_self_note = 0;
140
        foreach my $matching_request ( @{$matching_requests_for_patron} ) {
155
        foreach my $matching_request ( @{$matching_requests_for_patron} ) {
141
            next if $matching_request->illrequest_id eq $request->illrequest_id;
156
            next if $matching_request->illrequest_id eq $request->illrequest_id;
142
            if ( $appended_self_note == 0 ) {
157
            $historycheck_requests .=
143
                $staffnotes .= __("Request has been submitted by this patron in the past:");
158
                $historycheck_requests ? '|' . $matching_request->illrequest_id : $matching_request->illrequest_id;
144
                $appended_self_note = 1;
145
            }
146
            $staffnotes .= ' ' . $self->_get_request_staff_link($matching_request);
147
        }
159
        }
148
    }
160
    }
149
161
150
    $request->append_to_note($staffnotes)->store() if $staffnotes;
162
    $request->extended_attributes(
151
}
163
        [
152
164
            {
153
=head3 _get_request_staff_link
165
                type  => 'historycheck_requests',
154
166
                value => $historycheck_requests,
155
    $self->_get_request_staff_link($matching_request);
167
            },
156
168
        ]
157
Returns an HTML staff link to the provided request
169
    ) if $historycheck_requests;
158
159
=cut
160
161
sub _get_request_staff_link {
162
    my ( $self, $request ) = @_;
163
164
    return
165
          '<a href="/cgi-bin/koha/ill/ill-requests.pl?op=illview&illrequest_id='
166
        . $request->illrequest_id . '">'
167
        . __("ILL Request #")
168
        . $request->illrequest_id . '</a>';
169
}
170
}
170
171
171
=head3 _find_matching_requests
172
=head3 _find_matching_requests
172
173
173
    my $matching_requests = $self->_find_matching_requests();
174
    my $matching_requests = $self->_find_matching_requests();
174
175
175
Returns a list of matching requests (match is done by doi, issn, isbn, pubmedid)
176
Returns a list of matching requests (match is done by doi, isbn, pubmedid)
176
177
177
=cut
178
=cut
178
179
179
sub _find_matching_requests {
180
sub _find_matching_requests {
180
    my ($self) = @_;
181
    my ($self) = @_;
181
182
182
    my @id_fields = ( 'doi', 'issn', 'isbn', 'pubmedid' );
183
    my @id_fields = ( 'doi', 'isbn', 'pubmedid' );
183
184
184
    my @existing_id_fields = grep { $self->{metadata}->{$_} } @id_fields;
185
    my @existing_id_fields = grep { $self->{metadata}->{$_} } @id_fields;
185
    return 0 unless scalar @existing_id_fields;
186
    return 0 unless scalar @existing_id_fields;
(-)a/installer/data/mysql/atomicupdate/bug_38441.pl (-1 / +1 lines)
Lines 14-20 return { Link Here
14
            q{
14
            q{
15
                    INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES (
15
                    INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES (
16
                            'ILLHistoryCheck', '', '',
16
                            'ILLHistoryCheck', '', '',
17
                                'If ON, during the ILL request process, a check is performed to see if the ILL request has already been previously placed',
17
                                'If ON, a verification is performed to check if the ILL request has previously been placed by the same patron. Verification is done using one of the following identifier fields: DOI, Pubmed ID or ISBN',
18
                        'YesNo'
18
                        'YesNo'
19
                    );
19
                    );
20
                }
20
                }
(-)a/installer/data/mysql/mandatory/sysprefs.sql (-1 / +1 lines)
Lines 326-332 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
326
('ILLCheckAvailability', 0, '', 'If ON, during the ILL request process third party sources will be checked for current availability', 'YesNo'),
326
('ILLCheckAvailability', 0, '', 'If ON, during the ILL request process third party sources will be checked for current availability', 'YesNo'),
327
('ILLDefaultStaffEmail', '', NULL, 'Fallback email address for staff ILL notices to be sent to in the absence of a branch address', 'Free'),
327
('ILLDefaultStaffEmail', '', NULL, 'Fallback email address for staff ILL notices to be sent to in the absence of a branch address', 'Free'),
328
('ILLHiddenRequestStatuses', NULL, NULL, 'ILL statuses that are considered finished and should not be displayed in the ILL module', 'multiple'),
328
('ILLHiddenRequestStatuses', NULL, NULL, 'ILL statuses that are considered finished and should not be displayed in the ILL module', 'multiple'),
329
('ILLHistoryCheck', 0, '', 'If ON, during the ILL request process, a check is performed to see if the ILL request has already been previously placed', 'YesNo'),
329
('ILLHistoryCheck', 0, '', 'If ON, a verification is performed to check if the ILL request has previously been placed by the same patron. Verification is done using one of the following identifier fields: DOI, Pubmed ID or ISBN', 'YesNo'),
330
('IllLog', 0, '', 'If ON, log information about ILL requests', 'YesNo'),
330
('IllLog', 0, '', 'If ON, log information about ILL requests', 'YesNo'),
331
('ILLModule','0','If ON, enables the interlibrary loans module.','','YesNo'),
331
('ILLModule','0','If ON, enables the interlibrary loans module.','','YesNo'),
332
('ILLModuleDisclaimerByType','','','YAML defining disclaimer settings for each ILL request type','Textarea'),
332
('ILLModuleDisclaimerByType','','','YAML defining disclaimer settings for each ILL request type','Textarea'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/interlibrary_loans.pref (-1 / +1 lines)
Lines 69-75 Interlibrary loans: Link Here
69
              choices:
69
              choices:
70
                  1: Check
70
                  1: Check
71
                  0: "Don't check"
71
                  0: "Don't check"
72
            - if an ILL request has already been placed during the request process.
72
            - "if an ILL request has previously been placed by the same patron. Verification is done using one of the following identifier fields: DOI, Pubmed ID or ISBN."
73
        -
73
        -
74
            - "If the ILL backend supports it, adding YAML will enable the request type disclaimer stage in request creation, prompting the user with a request type specific disclaimer as defined (staff interface and OPAC)."
74
            - "If the ILL backend supports it, adding YAML will enable the request type disclaimer stage in request creation, prompting the user with a request type specific disclaimer as defined (staff interface and OPAC)."
75
            - "For each request type, you can have 3 configuration options: <code>text</code>, <code>av_category_code</code> and <code>bypass</code><ul>"
75
            - "For each request type, you can have 3 configuration options: <code>text</code>, <code>av_category_code</code> and <code>bypass</code><ul>"
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt (-6 / +25 lines)
Lines 644-649 Link Here
644
                                    [% type | html %]
644
                                    [% type | html %]
645
                                </li>
645
                                </li>
646
                            [% END %]
646
                            [% END %]
647
                            [% historycheck_requests = request.get_history_check_requests %]
648
                            [% IF historycheck_requests.count %]
649
                                <li class="historycheck_requests_value">
650
                                    <span class="label historycheck_requests_value">History check requests:</span>
651
                                    [% FOREACH historycheck_request IN historycheck_requests %]
652
                                        [% SET status = historycheck_request.status %]
653
                                        <a target="_blank" href="/cgi-bin/koha/ill/ill-requests.pl?op=illview&amp;illrequest_id=[% historycheck_request.illrequest_id | uri %]"
654
                                            ><i class="fa fa-fw fa-external-link-square"></i>Request [% historycheck_request.id_prefix | html %][% historycheck_request.illrequest_id | html %]
655
                                            ([% historycheck_request.capabilities.$status.name | html %]) on [% historycheck_request.placed | $KohaDates %]</a
656
                                        >
657
                                    [% END %]
658
                                </li>
659
                            [% END %]
647
                            [% type_disclaimer_value = request.get_type_disclaimer_value %]
660
                            [% type_disclaimer_value = request.get_type_disclaimer_value %]
648
                            [% IF type_disclaimer_value %]
661
                            [% IF type_disclaimer_value %]
649
                                <li class="type_disclaimer_value">
662
                                <li class="type_disclaimer_value">
Lines 910-934 Link Here
910
                        [% INCLUDE 'csrf-token.inc' %]
923
                        [% INCLUDE 'csrf-token.inc' %]
911
                        <h3>You are attempting to place the following request:</h3>
924
                        <h3>You are attempting to place the following request:</h3>
912
                        <table>
925
                        <table>
913
                            [% FOREACH key IN whole.keys %]
926
                            [% FOREACH param IN sorted_params %]
914
                                [% value = whole.$key %]
927
                                [% key = param.keys.0 %]
928
                                [% value = param.$key %]
915
                                [% IF key != 'op' && key != 'method' && key != 'custom_key' && key != 'custom_value' && key != 'csrf_token' && value %]
929
                                [% IF key != 'op' && key != 'method' && key != 'custom_key' && key != 'custom_value' && key != 'csrf_token' && value %]
916
                                    <tr>
930
                                    <tr>
917
                                        <td>[% key_mapping(key) || key | html %]</td>
931
                                        <td>[% key_mapping(key) || key | ucfirst | html %]</td>
918
                                        <td>[% value | html %]</td>
932
                                        [% IF key == 'branchcode' %]
933
                                            <td>[% Branches.GetName(value) | html %]</td>
934
                                        [% ELSE %]
935
                                            <td>[% value | html %]</td>
936
                                        [% END %]
919
                                    </tr>
937
                                    </tr>
920
                                [% END %]
938
                                [% END %]
921
                            [% END %]
939
                            [% END %]
922
                        </table>
940
                        </table>
923
                        &nbsp;
941
                        &nbsp;
924
                        [% IF matching_requests_for_patron.size %]
942
                        [% IF matching_requests_for_patron.size %]
925
                            <h4>This interlibrary loan has already been placed by this patron [%- INCLUDE 'patron-title.inc' patron => request_patron_obj hide_patron_infos_if_needed => 1 -%]:</h4>
943
                            <h4>This request has already been placed by patron [%- INCLUDE 'patron-title.inc' patron => request_patron_obj hide_patron_infos_if_needed => 1 -%]:</h4>
926
                            <ul class="list-unstyled">
944
                            <ul class="list-unstyled">
927
                                [% FOREACH matching_request_for_patron IN matching_requests_for_patron %]
945
                                [% FOREACH matching_request_for_patron IN matching_requests_for_patron %]
946
                                    [% SET matching_req_status = matching_request_for_patron.status %]
928
                                    <li>
947
                                    <li>
929
                                        <a target="_blank" href="/cgi-bin/koha/ill/ill-requests.pl?op=illview&amp;illrequest_id=[% matching_request_for_patron.illrequest_id | uri %]"
948
                                        <a target="_blank" href="/cgi-bin/koha/ill/ill-requests.pl?op=illview&amp;illrequest_id=[% matching_request_for_patron.illrequest_id | uri %]"
930
                                            ><i class="fa fa-fw fa-external-link-square"></i>Request [% matching_request_for_patron.id_prefix | html %][% matching_request_for_patron.illrequest_id | html %]
949
                                            ><i class="fa fa-fw fa-external-link-square"></i>Request [% matching_request_for_patron.id_prefix | html %][% matching_request_for_patron.illrequest_id | html %]
931
                                            ([% matching_request_for_patron.status | html %]) on [% matching_request_for_patron.placed | html %]</a
950
                                            ([% matching_request_for_patron.capabilities.$matching_req_status.name | html %]) on [% matching_request_for_patron.placed | $KohaDates %]</a
932
                                        >
951
                                        >
933
                                    </li>
952
                                    </li>
934
                                [% END %]
953
                                [% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt (-2 / +4 lines)
Lines 320-328 Link Here
320
                                    [% IF matching_requests_for_patron.size %]
320
                                    [% IF matching_requests_for_patron.size %]
321
                                        <ul class="list-unstyled">
321
                                        <ul class="list-unstyled">
322
                                            [% FOREACH matching_request_for_patron IN matching_requests_for_patron %]
322
                                            [% FOREACH matching_request_for_patron IN matching_requests_for_patron %]
323
                                                [% SET matching_req_status = matching_request_for_patron.status %]
323
                                                <li>
324
                                                <li>
324
                                                    <a href="/cgi-bin/koha/opac-illrequests.pl?op=view&amp;illrequest_id=[% matching_request_for_patron.illrequest_id | uri %]"
325
                                                    <a target="_blank" href="/cgi-bin/koha/opac-illrequests.pl?op=view&amp;illrequest_id=[% matching_request_for_patron.illrequest_id | uri %]"
325
                                                        >ILL Request #[% matching_request_for_patron.illrequest_id | html %]</a
326
                                                        ><i aria-hidden="true" class="fa fa-fw fa-external-link-square"></i>Request [% matching_request_for_patron.id_prefix | html %][% matching_request_for_patron.illrequest_id | html %]
327
                                                        ([% matching_request_for_patron.capabilities.$matching_req_status.name | html %]) on [% matching_request_for_patron.placed | $KohaDates %]</a
326
                                                    >
328
                                                    >
327
                                                </li>
329
                                                </li>
328
                                            [% END %]
330
                                            [% END %]
(-)a/t/db_dependent/Koha/ILL/Request/Workflow/HistoryCheck.t (-20 / +20 lines)
Lines 30-36 use Koha::Database; Link Here
30
30
31
my $schema = Koha::Database->new->schema;
31
my $schema = Koha::Database->new->schema;
32
32
33
my $issn = '321321321';
33
my $isbn = '321321321';
34
34
35
subtest 'show_history_check' => sub {
35
subtest 'show_history_check' => sub {
36
36
Lines 53-59 subtest 'show_history_check' => sub { Link Here
53
    my $metadata = {
53
    my $metadata = {
54
        title      => 'This is a title',
54
        title      => 'This is a title',
55
        author     => 'This is an author',
55
        author     => 'This is an author',
56
        issn       => $issn,
56
        isbn       => $isbn,
57
        cardnumber => $fake_cardnumber,
57
        cardnumber => $fake_cardnumber,
58
    };
58
    };
59
59
Lines 70-76 subtest 'show_history_check' => sub { Link Here
70
70
71
    is(
71
    is(
72
        $history_check->prep_metadata($sorted),
72
        $history_check->prep_metadata($sorted),
73
        'eyJhdXRob3IiOiJUaGlzIGlzIGFuIGF1dGhvciIsImNhcmRudW1iZXIiOiIxMjM0NTY3ODkiLCJp%0Ac3NuIjoiMzIxMzIxMzIxIiwidGl0bGUiOiJUaGlzIGlzIGEgdGl0bGUifQ%3D%3D%0A',
73
        'eyJhdXRob3IiOiJUaGlzIGlzIGFuIGF1dGhvciIsImNhcmRudW1iZXIiOiIxMjM0NTY3ODkiLCJp%0Ac2JuIjoiMzIxMzIxMzIxIiwidGl0bGUiOiJUaGlzIGlzIGEgdGl0bGUifQ%3D%3D%0A',
74
        'prep_metadata works'
74
        'prep_metadata works'
75
    );
75
    );
76
76
Lines 89-107 subtest 'show_history_check' => sub { Link Here
89
    my $ill_request = $builder->build_sample_ill_request( { borrowernumber => $ill_patron->borrowernumber } );
89
    my $ill_request = $builder->build_sample_ill_request( { borrowernumber => $ill_patron->borrowernumber } );
90
    is(
90
    is(
91
        $history_check->show_history_check($ill_request),
91
        $history_check->show_history_check($ill_request),
92
        0, 'Request with ISSN ' . $issn . ' does not exist even though syspref is on. Not showing history check screen'
92
        0, 'Request with ISBN ' . $isbn . ' does not exist even though syspref is on. Not showing history check screen'
93
    );
93
    );
94
94
95
    $builder->build(
95
    $builder->build(
96
        {
96
        {
97
            source => 'Illrequestattribute',
97
            source => 'Illrequestattribute',
98
            value  => { illrequest_id => $ill_request->illrequest_id, type => 'issn', value => $issn }
98
            value  => { illrequest_id => $ill_request->illrequest_id, type => 'isbn', value => $isbn }
99
        }
99
        }
100
    );
100
    );
101
101
102
    is(
102
    is(
103
        $history_check->show_history_check($ill_request),
103
        $history_check->show_history_check($ill_request),
104
        1, 'Request with ISSN ' . $issn . ' exists, syspref is on and is same patron. Able to show history check screen'
104
        1, 'Request with ISBN ' . $isbn . ' exists, syspref is on and is same patron. Able to show history check screen'
105
    );
105
    );
106
106
107
    # Mock ILLHistoryCheck disabled
107
    # Mock ILLHistoryCheck disabled
Lines 128-134 subtest 'after_request_created' => sub { Link Here
128
    my $metadata        = {
128
    my $metadata        = {
129
        title  => 'This is a title',
129
        title  => 'This is a title',
130
        author => 'This is an author',
130
        author => 'This is an author',
131
        issn   => $issn
131
        isbn   => $isbn
132
    };
132
    };
133
133
134
    my $authenticated_patron = $builder->build_object(
134
    my $authenticated_patron = $builder->build_object(
Lines 139-186 subtest 'after_request_created' => sub { Link Here
139
139
140
    t::lib::Mocks::mock_userenv( { patron => $authenticated_patron } );
140
    t::lib::Mocks::mock_userenv( { patron => $authenticated_patron } );
141
141
142
    # Create a new request with new issn
142
    # Create a new request with new isbn
143
    my $new_ill_request =
143
    my $new_ill_request =
144
        $builder->build_sample_ill_request( { borrowernumber => $authenticated_patron->borrowernumber } );
144
        $builder->build_sample_ill_request( { borrowernumber => $authenticated_patron->borrowernumber } );
145
    my $original_staff_notes = $new_ill_request->notesstaff;
145
    my $original_staff_notes = $new_ill_request->notesstaff;
146
    $metadata->{issn} = 'nonexistentissn';
146
    $metadata->{isbn} = 'nonexistentisbn';
147
    $builder->build(
147
    $builder->build(
148
        {
148
        {
149
            source => 'Illrequestattribute',
149
            source => 'Illrequestattribute',
150
            value  => { illrequest_id => $new_ill_request->illrequest_id, type => 'issn', value => $metadata->{issn} }
150
            value  => { illrequest_id => $new_ill_request->illrequest_id, type => 'isbn', value => $metadata->{isbn} }
151
        }
151
        }
152
    );
152
    );
153
    my $opac_history_check = Koha::ILL::Request::Workflow::HistoryCheck->new( $metadata, 'opac' );
153
    my $opac_history_check = Koha::ILL::Request::Workflow::HistoryCheck->new( $metadata, 'opac' );
154
    $opac_history_check->after_request_created( $metadata, $new_ill_request );
154
    $opac_history_check->after_request_created( $metadata, $new_ill_request );
155
155
156
    is(
156
    is(
157
        $new_ill_request->notesstaff,
157
        $new_ill_request->extended_attributes->find( { 'type' => 'historycheck_requests' } ),
158
        $original_staff_notes,
158
        undef,
159
        'History check didn\'t find any matching requests. Staff notes have not been updated.'
159
        'History check didn\'t find any matching requests. historycheck_requests illrequestattribute has not been updated.'
160
    );
160
    );
161
161
162
    # Create a second request with preexisting issn by self patron
162
    # Create a second request with preexisting isbn by self patron
163
    my $second_ill_request =
163
    my $second_ill_request =
164
        $builder->build_sample_ill_request( { borrowernumber => $authenticated_patron->borrowernumber } );
164
        $builder->build_sample_ill_request( { borrowernumber => $authenticated_patron->borrowernumber } );
165
    my $third_ill_request =
165
    my $third_ill_request =
166
        $builder->build_sample_ill_request( { borrowernumber => $authenticated_patron->borrowernumber } );
166
        $builder->build_sample_ill_request( { borrowernumber => $authenticated_patron->borrowernumber } );
167
    $metadata->{issn} = $issn;
167
    $metadata->{isbn} = $isbn;
168
    $builder->build(
168
    $builder->build(
169
        {
169
        {
170
            source => 'Illrequestattribute',
170
            source => 'Illrequestattribute',
171
            value  => { illrequest_id => $second_ill_request->illrequest_id, type => 'issn', value => $issn }
171
            value  => { illrequest_id => $second_ill_request->illrequest_id, type => 'isbn', value => $isbn }
172
        }
172
        }
173
    );
173
    );
174
    $builder->build(
174
    $builder->build(
175
        {
175
        {
176
            source => 'Illrequestattribute',
176
            source => 'Illrequestattribute',
177
            value  => { illrequest_id => $third_ill_request->illrequest_id, type => 'issn', value => $issn }
177
            value  => { illrequest_id => $third_ill_request->illrequest_id, type => 'isbn', value => $isbn }
178
        }
178
        }
179
    );
179
    );
180
    $opac_history_check->after_request_created( $metadata, $third_ill_request );
180
    $opac_history_check->after_request_created( $metadata, $third_ill_request );
181
181
182
    like(
182
    is(
183
        $third_ill_request->notesstaff, qr/Request has been submitted by this patron in the past/,
183
        $third_ill_request->extended_attributes->find( { 'type' => 'historycheck_requests' } )->value,
184
        $second_ill_request->illrequest_id,
184
        'Contains staffnotes related submissions by self patron'
185
        'Contains staffnotes related submissions by self patron'
185
    );
186
    );
186
187
187
- 

Return to bug 38441