Koha/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt
Brendan Lawlor c18f368411
Bug 37304: Fix created by filter in Acquisitions advanced search
This patch updates the field for the created by filter from
ui.item.borrowernumber to ui.item.patron_id

Test plan:
1. Add a vendor and a basket
2. Use advanced order search to search for created by 'koha'
3. Use the autofill dropdown to make the selection and click 'Search'
4. Your search returned no results.
5. Apply patch and repeat steps 2 and 3
6. Confirm the search returns the basket you created earlier

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-10-18 14:26:06 +02:00

204 lines
8.1 KiB
Text

[% USE raw %]
[% USE Asset %]
[% USE KohaDates %]
[% USE TablesSettings %]
[% USE Branches %]
[% SET footerjs = 1 %]
[% PROCESS 'i18n.inc' %]
[% INCLUDE 'doc-head-open.inc' %]
<title>[% FILTER collapse %]
[% IF ( order_loop ) %]
[% t("Orders search") | html %] &rsaquo;
[% t("Search results") | html %]
[% ELSE %]
[% t("Order search") | html %]
[% END %] &rsaquo;
[% t("Acquisitions") | html %] &rsaquo;
[% t("Koha") | html %]
[% END %]</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="acq_histsearch" class="acq">
[% WRAPPER 'header.inc' %]
[% INCLUDE 'acquisitions-search.inc' %]
[% END %]
[% WRAPPER 'sub-header.inc' %]
[% WRAPPER breadcrumbs %]
[% WRAPPER breadcrumb_item %]
<a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
[% END %]
[% IF ( order_loop ) %]
[% WRAPPER breadcrumb_item %]
<a href="/cgi-bin/koha/acqui/histsearch.pl">Orders search</a>
[% END %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
<span>Search results</span>
[% END %]
[% ELSE %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
<span>Order search</span>
[% END %]
[% END %]
[% END #/ WRAPPER breadcrumbs %]
[% END #/ WRAPPER sub-header.inc %]
<div class="main container-fluid">
<div class="row">
<div class="col-md-10 order-md-2 order-sm-2">
<main>
[% INCLUDE 'messages.inc' %]
<h1>Order search</h1>
[% IF !order_loop && search_done %]
<div class="alert alert-info">
Your search returned no results.
</div>
[% END %]
[% UNLESS ( order_loop ) %]
[% PROCESS acquisitions_filter_form context => "main" %]
[% END %]
[% IF ( order_loop ) %]
<div id="acqui_histsearch" class="page-section">
<h2>Search results</h2>
<table id="histsearcht">
<thead>
<tr>
<th>Order line (parent)</th>
<th>Status</th>
<th>Basket</th>
<th>Basket creator</th>
<th>Basket group</th>
<th>Managing library</th>
<th>Invoice number</th>
<th class="anti-the">Summary</th>
<th>Vendor</th>
<th>Placed on</th>
<th>Received on</th>
<th>Quantity received</th>
<th>Quantity ordered</th>
<th>Unit cost</th>
<th>Fund</th>
<th>Internal note</th>
<th>Vendor note</th>
</tr>
</thead>
<tbody>
[% FOREACH order IN order_loop %]
<tr>
<td>
[% order.ordernumber | html %]
[% IF order.ordernumber != order.parent_ordernumber %]([% order.parent_ordernumber | html %])[% END %]
</td>
<td>
[% SWITCH order.orderstatus %]
[% CASE 'new' %]<span>New</span>
[% CASE 'ordered' %]<span>Ordered</span>
[% CASE 'partial' %]<span>Partially received</span>
[% CASE 'complete' %]<span>Received</span>
[% CASE 'cancelled' %]<span>Cancelled</span>
[% END %]
[% IF order.is_standing %](standing order)[% END %]
</td>
<td><a href="basket.pl?basketno=[% order.basketno | uri %]">[% order.basketname | html %] ([% order.basketno | html %])</a></td>
<td>[% order.authorisedbyname | html %]</td>
<td>
[% IF ( order.basketgroupid ) %]
<a href="basketgroup.pl?op=add&booksellerid=[% order.id | uri %]&basketgroupid=[% order.basketgroupid | uri %]">[% order.groupname | html %] ([% order.basketgroupid | html %])</a>
[% ELSE %]
&nbsp;
[% END %]
</td>
<td>[% Branches.GetName(order.managing_library) | html %]</td>
<td>[% IF ( order.invoicenumber ) %]
<a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% order.invoiceid | uri %]">[% order.invoicenumber | html %]</a>
[% ELSE %]
&nbsp;
[% END %]
</td>
<td>
<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% order.biblionumber | uri %]">[% order.title | html %]</a>
<br />[% order.author | html %] <br /> [% order.isbn | html %]
</td>
<td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% order.id | uri %]">[% order.name | html %]</a></td>
<td data-order="[% order.creationdate | html %]">[% order.creationdate | $KohaDates %]</td>
<td data-order="[% order.datereceived | html %]">
[% order.datereceived | $KohaDates %]
</td>
<td>[% order.quantityreceived | html %]</td>
<td>[% order.quantity | html %]</td>
<td>[% order.ecost | html %]</td>
<td>[% order.budget_name | html %]</td>
<td>[% order.order_internalnote | html %]</td>
<td>[% order.order_vendornote | html %]</td>
</tr>
[% END %]
</tbody>
</table>
</div>
[% END %]
</main>
</div> <!-- /.col-md-10.order-md-2 -->
<div class="col-md-2 order-sm-2 order-md-1">
<aside>
[% IF ( order_loop ) %]
[% PROCESS acquisitions_filter_form context => "sidebar" %]
[% END %]
[% INCLUDE 'acquisitions-menu.inc' %]
</aside>
</div> <!-- /.col-md-2.order-md-1 -->
</div>
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/acquisitions-menu.js") | $raw %]
[% INCLUDE 'calendar.inc' %]
[% INCLUDE 'datatables.inc' %]
[% INCLUDE 'columns_settings.inc' %]
<script>
var MSG_REMOVE_PATRON = _("Remove");
$(document).ready(function() {
var table_settings = [% TablesSettings.GetTableSettings( 'acqui', 'histsearch', 'histsearcht', 'json' ) | $raw %];
KohaTable("histsearcht", {
"pagingType": "full"
}, table_settings );
function AddPatron( patron_name, value, container, input_name ) {
div = "<div id='borrower_" + value + "'>" + patron_name + " ( <a href='#' class='removePatron'><i class='fa fa-trash-can' aria-hidden='true'></i> " + MSG_REMOVE_PATRON + " </a> ) <input type='hidden' name='" + input_name + "' value='" + value + "' /></div>";
$(container).append( div );
$(container).parent().show( 800 );
}
function RemovePatron( cardnumber, container ) {
$( '#borrower_' + cardnumber ).remove();
if ( ! $(container).html() ) {
$(container).parent("fieldset").hide( 800 );
}
}
patron_autocomplete($("#find_patron"), {
'on-select-callback': function( event, ui ) {
var field = ui.item.patron_id;
AddPatron( ui.item.firstname + " " + ( ui.item.middle_name || "" ) + " " + ui.item.surname, field, $("#basket_creators"), 'created_by' );
$("#find_patron").val('').focus();
return false;
}
});
$("body").on("click",".removePatron",function(e){
e.preventDefault();
var divid = $(this).parent().attr("id");
var cardnumber = divid.replace("borrower_","");
RemovePatron(cardnumber, $("#basket_creators"));
});
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]