diff --git a/acqui/booksellers.pl b/acqui/booksellers.pl index 6db0bad527..bb65dbc803 100755 --- a/acqui/booksellers.pl +++ b/acqui/booksellers.pl @@ -53,6 +53,7 @@ use strict; use warnings; use C4::Auth; use C4::Biblio; +use C4::Budgets; use C4::Output; use CGI; @@ -62,7 +63,7 @@ use C4::Members qw/GetMember/; use C4::Context; my $query = CGI->new; -my ( $template, $loggedinuser, $cookie ) = get_template_and_user( +my ( $template, $loggedinuser, $cookie, $userflags ) = get_template_and_user( { template_name => 'acqui/booksellers.tmpl', query => $query, type => 'intranet', @@ -103,6 +104,18 @@ my $viewbaskets = C4::Context->preference('AcqViewBaskets'); my $userbranch = $userenv->{branch}; +my $budgets = GetBudgetHierarchy; +my $has_budgets = 0; +foreach my $r (@{$budgets}) { + if (!defined $r->{budget_amount} || $r->{budget_amount} == 0) { + next; + } + next unless (CanUserUseBudget($loggedinuser, $r, $userflags)); + + $has_budgets = 1; + last; +} + #build result page my $loop_suppliers = []; @@ -150,6 +163,7 @@ $template->param( loop_suppliers => $loop_suppliers, supplier => ( $booksellerid || $supplier ), count => $supplier_count, + has_budgets => $has_budgets, ); $template->{VARS}->{'allbaskets'} = $allbaskets; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-add-to-basket.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-add-to-basket.inc index 01ecec91e1..46f84006bb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-add-to-basket.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-add-to-basket.inc @@ -1,13 +1,14 @@ -
+
Add order to basket [% IF has_budgets %] [% ELSE %] - You can't create any orders unless you first define a budget and a fund. +
+

You can't create any orders unless you first define a budget and a fund.

+
[% END %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt index 8cbc46e047..5da0b298ea 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -30,7 +30,7 @@ updateColumnsVisibility(false); [% UNLESS ( closedate ) %] $('#addtoBasket').on('show', function () { - $(this).find(".modal-body").html($("#acqui_basket_add")[0].outerHTML); + $(this).find(".modal-body").html($(".acqui_basket_add")[0].outerHTML); }); [% END %] }); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt index 525ea667e7..782bed1977 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt @@ -14,23 +14,28 @@ @@ -63,9 +68,9 @@ $(document).ready(function() {

[% END %] [% IF ( allbaskets ) %] -

Show active baskets only

+

Show active baskets only

[% ELSE %] -

Show all baskets

+

Show all baskets

[% END %]
[% FOREACH supplier IN loop_suppliers %] @@ -80,12 +85,12 @@ $(document).ready(function() { [% IF ( CAN_user_acquisition_order_manage ) %] [% IF ( supplier.active ) %] - + New basket [% ELSE %] (inactive) [% END %] [% END %] - + Receive shipment
[% IF ( supplier.loop_basket.size ) %] @@ -99,6 +104,7 @@ $(document).ready(function() { Items expected Created by Date + Closed   @@ -118,23 +124,35 @@ $(document).ready(function() { [% basket.authorisedby_firstname %] [% basket.authorisedby_surname %] - [% basket.creationdate | $KohaDates %] + [% basket.creationdate | $KohaDates %] [% IF ( basket.closedate ) %] - closed on [% basket.closedate | $KohaDates %] - View + [% basket.closedate | $KohaDates %] [% ELSE %] - [% IF ( basket.active ) %] - Modify - [% ELSE %] - View - [% END %] + + [% END %] + + + View + + [% UNLESS ( basket.closedate ) %] + | Add to basket + + [% END %] [% END %][%# FOREACH basket IN supplier.loop_basket %] + [% ELSE %]

No pending baskets

[% END %][%# IF ( supplier.loop_basket.size ) %]