Bug 28082: Add acquisitions toolbar to vendors on vendor search page
This patch makes a number of changes to the vendor search/view template in order to make it work better in different contexts: - Add a vendor-specific toolbar under each vendor search result. This gives instant access to the options for a new basket, new contract, vendor edit, or to receive shipments. A delete button will appear if available. - Add a summary of the number of baskets and subscriptions. This helps the user know if there are closed baskets and whether an outstanding subscription might be blocking the option to delete. Each number is linked to the view of those entries. - Indicate whether a vendor is inactive. The vendor name appears in a different color when it is inactve and is labeled as such. To test, apply the patch and rebuild the staff interface CSS (https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client). - To test you should have multiple vendors in your system, some active and some inactive. Add some baskets and subscriptions to one or more if necessary. - Go to Acquisitions and submit an empty vendor search to show all vendors. - Verify that the page looks correct and that all controls work as expected. - Open the basket view for a single vendor and compare the two views. Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
b40d475029
commit
56aa775602
|
|
@ -92,6 +92,7 @@ if ( $supplier_count == 1 ) {
|
|||
supplier_name => $suppliers[0]->name,
|
||||
booksellerid => $suppliers[0]->id,
|
||||
basketcount => $suppliers[0]->baskets->count,
|
||||
subscriptionscount => $suppliers[0]->subscriptions->count,
|
||||
active => $suppliers[0]->active,
|
||||
);
|
||||
}
|
||||
|
|
@ -149,6 +150,8 @@ for my $vendor (@suppliers) {
|
|||
booksellerid => $vendor->id,
|
||||
name => $vendor->name,
|
||||
active => $vendor->active,
|
||||
basketcount => $vendor->baskets->count,
|
||||
subscriptioncount => $vendor->subscriptions->count,
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,8 +89,8 @@ if ( $op eq 'display' ) {
|
|||
);
|
||||
} elsif ( $op eq 'delete' ) {
|
||||
# no further message needed for the user
|
||||
# the DELETE button only appears in the template if basketcount == 0
|
||||
if ( $supplier->baskets->count == 0 ) {
|
||||
# the DELETE button only appears in the template if basketcount == 0 AND subscriptioncount == 0
|
||||
if ( $supplier->baskets->count == 0 && $supplier->subscriptions->count == 0) {
|
||||
Koha::Acquisition::Booksellers->find($booksellerid)->delete;
|
||||
}
|
||||
print $query->redirect('/cgi-bin/koha/acqui/acqui-home.pl');
|
||||
|
|
|
|||
|
|
@ -2714,28 +2714,23 @@ td {
|
|||
}
|
||||
|
||||
#acqui_order_supplierlist {
|
||||
> div {
|
||||
&.supplier {
|
||||
border: 1px solid #EEEEEE;
|
||||
margin: .5em;
|
||||
padding: 1em;
|
||||
.supplier {
|
||||
&+.supplier {
|
||||
border-top: 1px solid #EEEEEE;
|
||||
margin-top: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
> div {
|
||||
> .baskets {
|
||||
margin-top: .5em;
|
||||
}
|
||||
}
|
||||
.suppliername {
|
||||
display: inline-block;
|
||||
margin: .5em 1em .5em 0;
|
||||
|
||||
> span {
|
||||
&.action {
|
||||
margin-left: 5em;
|
||||
}
|
||||
&.inactive {
|
||||
color: #888;
|
||||
|
||||
&.suppliername {
|
||||
display: inline;
|
||||
font-size: 1.7em;
|
||||
margin-bottom: .5em;
|
||||
a:link,
|
||||
a:visited {
|
||||
color: #888;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,5 @@
|
|||
[% INCLUDE 'blocking_errors.inc' %]
|
||||
<!-- acquisitions-toolbar.inc -->
|
||||
<script>
|
||||
function confirm_deletion() {
|
||||
if (confirm(_("Are you sure you want to delete this vendor?"))) {
|
||||
window.location="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]&op=delete";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<div id="toolbar" class="btn-toolbar">
|
||||
[% IF ( booksellerid ) %]
|
||||
<div class="btn-group">
|
||||
|
|
@ -26,12 +19,20 @@
|
|||
</ul>
|
||||
</div>
|
||||
[% IF ( CAN_user_acquisition_vendors_manage ) %]
|
||||
<div class="btn-group"><a class="btn btn-default" id="editsupplier" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]&op=enter"><i class="fa fa-pencil"></i> Edit vendor</a></div>
|
||||
<div class="btn-group">
|
||||
<a class="btn btn-default" id="editsupplier" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]&op=enter"><i class="fa fa-pencil"></i> Edit vendor</a>
|
||||
</div>
|
||||
[% UNLESS ( basketcount OR subscriptioncount ) %]
|
||||
<div class="btn-group"><a class="btn btn-default" id="deletesupplier" href="javascript:confirm_deletion()"><i class="fa fa-trash"></i> Delete vendor</a></div>
|
||||
<div class="btn-group">
|
||||
<form action="/cgi-bin/koha/acqui/supplier.pl" method="post">
|
||||
<input type="hidden" name="op" value="delete" />
|
||||
<input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
|
||||
<button class="btn btn-default" id="deletesupplier" type="submit"><i class="fa fa-trash"></i> Delete vendor</button>
|
||||
</form>
|
||||
</div>
|
||||
[% END %]
|
||||
[% END %]
|
||||
[% IF CAN_user_acquisition_order_receive && basketcount %]
|
||||
[% IF CAN_user_acquisition_order_receive && basketcount && active %]
|
||||
<div class="btn-group"><a class="btn btn-default" id="receive" href="/cgi-bin/koha/acqui/parcels.pl?booksellerid=[% booksellerid | html %]"><i class="fa fa-inbox"></i> Receive shipments</a></div>
|
||||
[% END %]
|
||||
[% ELSE %]
|
||||
|
|
|
|||
|
|
@ -57,11 +57,11 @@
|
|||
[% END %]
|
||||
</select>
|
||||
</p>
|
||||
[% END %]
|
||||
[% IF ( allbaskets ) %]
|
||||
<a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=[% supplier | uri %]&booksellerid=[% booksellerid | uri %]">Show active baskets only</a>
|
||||
[% ELSE %]
|
||||
<a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=[% supplier | uri %]&booksellerid=[% booksellerid | uri %]&allbaskets=1">Show all baskets</a>
|
||||
[% IF ( allbaskets ) %]
|
||||
<a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=[% supplier | uri %]&booksellerid=[% booksellerid | uri %]">Show active baskets only</a>
|
||||
[% ELSE %]
|
||||
<a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=[% supplier | uri %]&booksellerid=[% booksellerid | uri %]&allbaskets=1">Show all baskets</a>
|
||||
[% END %]
|
||||
[% END %]
|
||||
[% UNLESS booksellerid %]
|
||||
| <a href="#" id="show_active_vendors">Show active vendors only</a><a href="#" id="show_all_vendors">Show all vendors</a>
|
||||
|
|
@ -73,25 +73,49 @@
|
|||
[% ELSE %]
|
||||
<div class="supplier inactive">
|
||||
[% END %]
|
||||
<span class="suppliername">
|
||||
[% IF (supplier.name) %]
|
||||
<a name="[% supplier.booksellerid | html %]" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% supplier.booksellerid | uri %]">[% supplier.name | html %]</a>
|
||||
[% IF ( supplier.active ) %]
|
||||
<h2 class="suppliername">
|
||||
[% ELSE %]
|
||||
<h2 class="suppliername inactive">
|
||||
[% END %]
|
||||
<a name="[% supplier.booksellerid | html %]" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% supplier.booksellerid | uri %]">
|
||||
[% IF (supplier.name) %]
|
||||
[% supplier.name | html %]
|
||||
[% ELSE %]
|
||||
NO NAME
|
||||
[% END %]
|
||||
</a>
|
||||
<a name="[% supplier.booksellerid | html %]" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% supplier.booksellerid | uri %]"></a>
|
||||
[% IF ( !supplier.active ) %]<span class="vendor_inactive">(inactive)</span>[% END %]
|
||||
</h2>
|
||||
<span class="basketcounts">
|
||||
[% IF ( count > 1 ) %]
|
||||
<a href="/cgi-bin/koha/acqui/booksellers.pl?booksellerid=[% supplier.booksellerid | uri %]">[% supplier.basketcount | html %] [% tn('basket', 'baskets', supplier.basketcount) | $raw %]</a>,
|
||||
[% ELSE %]
|
||||
<a name="[% supplier.booksellerid | html %]" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% supplier.booksellerid | uri %]">NO NAME</a>
|
||||
[% supplier.basketcount | html %] [% tn('basket', 'baskets', supplier.basketcount) | $raw %],
|
||||
[% END %]
|
||||
[% IF supplier.subscriptioncount > 0 %]
|
||||
<a href="/cgi-bin/koha/serials/serials-search.pl?bookseller_filter=[% supplier.name | uri %]&searched=1">
|
||||
[% supplier.subscriptioncount | html %] [% tn('subscription', 'subscriptions', supplier.subscriptioncount) | $raw %]
|
||||
</a>
|
||||
[% ELSE %]
|
||||
[% supplier.subscriptioncount | html %] [% tn('subscription', 'subscriptions', supplier.subscriptioncount) | $raw %]
|
||||
[% END %]
|
||||
</span>
|
||||
<span class="action">
|
||||
[% IF ( CAN_user_acquisition_order_manage ) %]
|
||||
[% IF ( supplier.active ) %]
|
||||
<a class="btn btn-default btn-sm" href="/cgi-bin/koha/acqui/basketheader.pl?booksellerid=[% supplier.booksellerid | uri %]&op=add_form"><i class="fa fa-plus"></i> New basket</a>
|
||||
[% ELSE %]
|
||||
(inactive)
|
||||
[% END %]
|
||||
[% IF ( count == 1 ) %]
|
||||
[% IF ( supplier.basketcount > 0 ) %]
|
||||
<div>
|
||||
[% IF ( allbaskets ) %]
|
||||
<a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=[% supplier.booksellerid | uri %]&booksellerid=[% booksellerid | uri %]">Show active baskets only</a>
|
||||
[% ELSE %]
|
||||
<a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=[% supplier.booksellerid | uri %]&booksellerid=[% booksellerid | uri %]&allbaskets=1">Show all baskets</a>
|
||||
[% END %]
|
||||
</div>
|
||||
[% END %]
|
||||
[% IF ( supplier.loop_basket.size ) %]
|
||||
<a class="btn btn-default btn-sm" href="/cgi-bin/koha/acqui/parcels.pl?booksellerid=[% supplier.booksellerid | uri %]"><i class="fa fa-inbox"></i> Receive shipment</a>
|
||||
[% END %]
|
||||
</span>
|
||||
[% ELSE %]
|
||||
[% INCLUDE "acquisitions-toolbar.inc" booksellerid=supplier.booksellerid active=supplier.active basketcount=supplier.loop_basket.size basketcount=supplier.basketcount subscriptioncount=supplier.subscriptioncount %]
|
||||
[% END %]
|
||||
|
||||
<div class="baskets">
|
||||
[% IF ( supplier.loop_basket.size ) %]
|
||||
<table class="baskets">
|
||||
|
|
@ -195,7 +219,13 @@
|
|||
</table>
|
||||
|
||||
[% ELSE %]
|
||||
<p>No pending baskets</p>
|
||||
<p>
|
||||
No pending baskets.
|
||||
[% IF ( supplier.basketcount > 0 && count > 1 ) %]
|
||||
<a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=1&booksellerid=[% supplier.booksellerid | uri %]&allbaskets=1">View all baskets</a>.
|
||||
[% END %]
|
||||
</p>
|
||||
|
||||
[% END %][%# IF ( supplier.loop_basket.size ) %]
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -431,6 +431,7 @@
|
|||
[% MACRO jsinclude BLOCK %]
|
||||
[% Asset.js("js/acquisitions-menu.js") | $raw %]
|
||||
[% Asset.js("lib/hc-sticky.js") | $raw %]
|
||||
[% Asset.js("js/acq.js") | $raw %]
|
||||
[% INCLUDE 'datatables.inc' %]
|
||||
<script>
|
||||
function confirm_deletion() {
|
||||
|
|
|
|||
|
|
@ -166,6 +166,7 @@
|
|||
|
||||
[% MACRO jsinclude BLOCK %]
|
||||
[% Asset.js("js/acquisitions-menu.js") | $raw %]
|
||||
[% Asset.js("js/acq.js") | $raw %]
|
||||
[% INCLUDE 'datatables.inc' %]
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
/* global confirmDelete */
|
||||
/* exported uncheckbox isNotNull isNull isNum log calcTotalRow autoFillRow messenger updateCosts calcNewsuggTotal getAuthValueDropbox totalExceedsBudget budgetExceedsParent checkBudgetParent hideColumn showColumn showAllColumns hideAllColumns */
|
||||
|
||||
//=======================================================================
|
||||
//input validation:
|
||||
// acqui/uncertainprice.tmpl uses this
|
||||
|
|
@ -380,3 +383,9 @@ function hideAllColumns(){
|
|||
$("#plan td:nth-child(2),#plan th:nth-child(2)").nextUntil("th:nth-child("+(allCols-1)+"),td:nth-child("+(allCols-1)+")").hide(); // hide all but the last two columns
|
||||
$("#hideall").prop("checked", true).parent().addClass("selected");
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
$("#deletesupplier").on("click", function(){
|
||||
confirmDelete(__("Are you sure you want to delete this vendor?") );
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue