Jonathan Druart
d533a92aa8
The C4::Suggestions::SearchSuggestion subroutine is badly written and can be replaced by calls to Koha::Suggestions->search. The hard part in this patch is suggestion.pl, the other occurrences have been replaced easily. Test plan: The idea is to test the whole suggestion workflow. 1. Create a suggestion on OPAC 2. Create a suggestion on the staff interface 3. Edit suggestions 4. Filter suggestions (use the different filters and "organize by" values) Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Bug 23991: Remove SearchSuggestion tests Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Bug 23991: (QA follow-up) Save some DB queries This patch makes the suggestion-related pages rely on array size instead of querying the DB each time they need to. In the case of suggestion/suggestion.pl it goes from 4 COUNT(*) to 1. To test, with KTD: 1. Run on the host machine: $ docker exec -ti koha_db_1 bash $ mysql -ppassword > SET GLOBAL general_log_file='/var/log/mysql/mycustom.log'; > SET GLOBAL log_output = 'FILE'; > SET GLOBAL general_log = 'ON'; > \q $ tail -f /var/log/mysql/mycustom.log | grep suggestions 2. Visit the different pages changed on this bug => SUCCESS: Some queries 3. Apply this patch 4. Repeat 2 => SUCCESS: Less queries! 5. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Bug 23991: Fix branchcode and budgetid filtering Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Bug 23991: Fix conflict with bug 28941 Well, this patchset fixed the security bug... Redoing on top of bug 28941 Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Bug 23991: (follow-up) Missing semicolon Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Bug 23991: Fix 'all' libraries Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Bug 23991: (follow-up) Add value to filter_archived Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
145 lines
5.6 KiB
Text
145 lines
5.6 KiB
Text
[% USE raw %]
|
|
[% USE Branches %]
|
|
[% USE Price %]
|
|
[% USE Asset %]
|
|
[% PROCESS 'i18n.inc' %]
|
|
[% SET footerjs = 1 %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Add order from a suggestion › Acquisitions › Koha</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
</head>
|
|
|
|
<body id="acq_newordersuggestion" class="acq">
|
|
[% INCLUDE 'header.inc' %]
|
|
[% INCLUDE 'suggestions-add-search.inc' %]
|
|
|
|
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
|
|
<ol>
|
|
<li>
|
|
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
|
|
</li>
|
|
<li>
|
|
<a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
|
|
</li>
|
|
<li>
|
|
<a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% name | html %]</a>
|
|
</li>
|
|
<li>
|
|
<a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno | uri %]">Basket [% basketno | html %]</a>
|
|
</li>
|
|
<li>
|
|
<a href="#" aria-current="page">
|
|
Add order from a suggestion
|
|
</a>
|
|
</li>
|
|
</ol>
|
|
</nav>
|
|
|
|
<div class="main container-fluid">
|
|
<div class="row">
|
|
<div class="col-sm-10 col-sm-push-2">
|
|
<main>
|
|
|
|
<h1>Suggestions</h1>
|
|
[% IF suggestions.size %]
|
|
<a href="#" id="show_only_mine">Show only mine</a> | <a href="#" id="show_all">Show all suggestions</a>
|
|
<table id="suggestionst">
|
|
<thead>
|
|
<tr>
|
|
<th>Mine</th>
|
|
<th>Suggestion</th>
|
|
<th>Suggested by</th>
|
|
<th>Accepted by</th>
|
|
<th>Library</th>
|
|
<th>Fund</th>
|
|
<th>Price</th>
|
|
<th>Quantity</th>
|
|
<th>Total</th>
|
|
<th> </th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
[% FOREACH suggestion IN suggestions %]
|
|
<tr>
|
|
<td>[% suggestion.managedby | html %]</td>
|
|
<td>
|
|
<p>[% suggestion.title | html %] - [% suggestion.author | html %]</p>
|
|
<p>
|
|
[% IF ( suggestion.copyrightdate ) %]© [% suggestion.copyrightdate | html %] [% END %]
|
|
[% IF ( suggestion.volumedesc ) %]volume: <em>[% suggestion.volumedesc | html %]</em> [% END %]
|
|
[% IF ( suggestion.isbn ) %]ISBN: <em>[% suggestion.isbn | html %]</em> [% END %]
|
|
[% IF ( suggestion.publishercode ) %]<br />published by: [% suggestion.publishercode | html %] [% END %]
|
|
[% IF ( suggestion.publicationyear ) %] in <em>[% suggestion.publicationyear | html %]</em> [% END %]
|
|
[% IF ( suggestion.place ) %] in <em>[% suggestion.place | html %]</em> [% END %]
|
|
[% IF ( suggestion.note ) %]<p><em>([% suggestion.note | html %])</em></p> [% END %]
|
|
</p>
|
|
</td>
|
|
<td>[% INCLUDE 'patron-title.inc' patron => suggestion.suggester %]</td>
|
|
<td>[% INCLUDE 'patron-title.inc' patron => suggestion.manager %]</td>
|
|
<td>
|
|
[% Branches.GetName(suggestion.branchcode) | html %]
|
|
</td>
|
|
<td>
|
|
[% suggestion.fund.budget_name | html %]
|
|
</td>
|
|
<td>
|
|
[% suggestion.price | $Price %]
|
|
</td>
|
|
<td>
|
|
[% IF (suggestion.quantity > 0) %]
|
|
[% suggestion.quantity | html %]
|
|
[% END %]
|
|
</td>
|
|
<td>
|
|
[% suggestion.total | $Price %]
|
|
</td>
|
|
<td class="actions">
|
|
[% IF ( suggestion.biblionumber ) %]
|
|
<a href="neworderempty.pl?booksellerid=[% booksellerid | uri %]&basketno=[% basketno | uri %]&suggestionid=[% suggestion.suggestionid | uri %]&biblio=[% suggestion.biblionumber | uri %]" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> [% tp('verb', 'Order') | html %]</a>
|
|
[% ELSE %]
|
|
<a href="neworderempty.pl?booksellerid=[% booksellerid | uri %]&basketno=[% basketno | uri %]&suggestionid=[% suggestion.suggestionid | uri %]" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> [% tp('verb', 'Order') | html %]</a>
|
|
[% END %]
|
|
</td>
|
|
</tr>
|
|
[% END %]
|
|
</tbody>
|
|
</table>
|
|
[% ELSE %]
|
|
There are no outstanding (accepted) suggestions.
|
|
[% END %]
|
|
</main>
|
|
</div> <!-- /.col-sm-10.col-sm-push-2 -->
|
|
|
|
<div class="col-sm-2 col-sm-pull-10">
|
|
<aside>
|
|
[% INCLUDE 'acquisitions-menu.inc' %]
|
|
</aside>
|
|
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
|
|
</div> <!-- /.row -->
|
|
|
|
[% MACRO jsinclude BLOCK %]
|
|
[% Asset.js("js/acquisitions-menu.js") | $raw %]
|
|
[% INCLUDE 'datatables.inc' %]
|
|
[% INCLUDE 'calendar.inc' %]
|
|
<script>
|
|
$(document).ready(function() {
|
|
var suggestionst = $("#suggestionst").dataTable($.extend(true, {}, dataTablesDefaults, {
|
|
"aoColumnDefs": [
|
|
{ "aTargets": [ 0 ], "bVisible": false, "bSearchable": true }, // must be searchable for fnFilter
|
|
{ "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
|
|
],
|
|
"sPaginationType": "full"
|
|
}));
|
|
$("#show_only_mine").on('click', function(e){
|
|
e.preventDefault();
|
|
suggestionst.fnFilter('^[% logged_in_user.borrowernumber | html %]$', 0, true);
|
|
});
|
|
$("#show_all").on('click', function(e){
|
|
e.preventDefault();
|
|
suggestionst.fnFilter('', 0 );
|
|
});
|
|
});
|
|
</script>
|
|
[% END %]
|
|
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|