use warnings;
use C4::Auth;
use C4::Biblio;
+use C4::Budgets;
use C4::Output;
use CGI;
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',
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 = [];
loop_suppliers => $loop_suppliers,
supplier => ( $booksellerid || $supplier ),
count => $supplier_count,
+ has_budgets => $has_budgets,
);
$template->{VARS}->{'allbaskets'} = $allbaskets;
-<fieldset id="acqui_basket_add">
+<fieldset class="acqui_basket_add">
<legend>Add order to basket</legend>
[% IF has_budgets %]
<ul>
<li>
- <label for="q">From an existing record: </label>
<form action="/cgi-bin/koha/acqui/neworderbiblio.pl" method="post">
+ <label>From an existing record:
+ <input type="text" size="25" name="q" />
+ </label>
<input type="hidden" name="booksellerid" value="[% booksellerid %]" />
<input type="hidden" name="basketno" value="[% basketno %]" />
- <input id="q" type="text" size="25" name="q" />
<input type="submit" class="submit" value="Search" />
</form>
</li>
<li><a href="/cgi-bin/koha/acqui/addorderiso2709.pl?booksellerid=[% booksellerid %]&basketno=[% basketno %]"> From a staged file</a></li>
</ul>
[% ELSE %]
- You can't create any orders unless you first <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">define a budget and a fund</a>.
+ <div class="dialog alert">
+ <p>You can't create any orders unless you first <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">define a budget and a fund</a>.</p>
+ </div>
[% END %]
</fieldset>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function() {
- [% IF (dateformat == 'metric') %]
- dt_add_type_uk_date();
- [% END %]
$("table.baskets").dataTable($.extend(true, {}, dataTablesDefaults, {
'sDom': 't',
'bPaginate': false,
'bFilter': false,
'bInfo': false,
"aaSorting": [[ 1, "asc" ]],
+ "aoColumns": [
+ null,null,null,null,null,null,{ "sType": "title-string" },{ "sType": "title-string" },null
+ ],
'aoColumnDefs': [
- { 'aTargets': [-1], 'bSortable': false }
+ { 'aTargets': [-1,-2], 'bSortable': false }
]
}));
$("#supplierlist").change(function() {
var id = $(this).find("option:selected").val();
window.location.href = "#" + id;
});
+ $(".modal").on("show", function(){
+ var basket = $(this).data("basketno");
+ var legend = _("Add order to basket") + " " + basket;
+ $(this).find("legend").html(legend);
+ });
});
//]]>
</script>
</p>
[% END %]
[% IF ( allbaskets ) %]
- <p><a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=[% supplier %]&booksellerid=[% booksellerid %]">Show active baskets only</a></p>
+ <p><a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=[% supplier %]&booksellerid=[% booksellerid %]">Show active baskets only</a></p>
[% ELSE %]
- <p><a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=[% supplier %]&booksellerid=[% booksellerid %]&allbaskets=1">Show all baskets</a></p>
+ <p><a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=[% supplier %]&booksellerid=[% booksellerid %]&allbaskets=1">Show all baskets</a></p>
[% END %]
<div id="acqui_order_supplierlist">
[% FOREACH supplier IN loop_suppliers %]
<span class="action">
[% IF ( CAN_user_acquisition_order_manage ) %]
[% IF ( supplier.active ) %]
- <input type="button" value="New basket" onclick="window.location.href='/cgi-bin/koha/acqui/basketheader.pl?booksellerid=[% supplier.booksellerid %]&op=add_form'" />
+ <a class="btn btn-small" href="/cgi-bin/koha/acqui/basketheader.pl?booksellerid=[% supplier.booksellerid %]&op=add_form"><i class="icon-plus"></i> New basket</a>
[% ELSE %]
(inactive)
[% END %]
[% END %]
- <input type="button" value="Receive shipment" onclick="window.location.href='/cgi-bin/koha/acqui/parcels.pl?booksellerid=[% supplier.booksellerid %]'" />
+ <a class="btn btn-small" href="/cgi-bin/koha/acqui/parcels.pl?booksellerid=[% supplier.booksellerid %]"><i class="icon-inbox"></i> Receive shipment</a>
</span>
<div class="baskets">
[% IF ( supplier.loop_basket.size ) %]
<th>Items expected</th>
<th>Created by</th>
<th>Date</th>
+ <th>Closed</th>
<th> </th>
</tr>
</thead>
[% basket.authorisedby_firstname %]
[% basket.authorisedby_surname %]
</td>
- <td>[% basket.creationdate | $KohaDates %]</td>
+ <td><span title="[% basket.creationdate %]">[% basket.creationdate | $KohaDates %]</span></td>
<td>
[% IF ( basket.closedate ) %]
- closed on [% basket.closedate | $KohaDates %]
- <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno %]">View</a>
+ <span title="[% basket.closedate %]">[% basket.closedate | $KohaDates %]</span>
[% ELSE %]
- [% IF ( basket.active ) %]
- <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno %]">Modify</a>
- [% ELSE %]
- <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno %]">View</a>
- [% END %]
+ <span title="9999-99-99"></span>
+ [% END %]
+ </td>
+ <td>
+ <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno %]">View</a>
+
+ [% UNLESS ( basket.closedate ) %]
+ | <a id="addtoBasketLabel[% basket.basketno %]" href="#addtoBasket[% basket.basketno %]" role="button" data-toggle="modal">Add to basket</a>
+ <!-- Modal -->
+ <div id="addtoBasket[% basket.basketno %]" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="addtoBasketLabel[% basket.basketno %]" aria-hidden="true" data-basketno="[% basket.basketname %]">
+ <div class="modal-body">
+ [% INCLUDE 'acquisitions-add-to-basket.inc' booksellerid=supplier.booksellerid basketno=basket.basketno %]
+ </div>
+ <div class="modal-footer">
+ <a href="#" class="cancel" data-dismiss="modal" aria-hidden="true">Cancel</a>
+ </div>
+ </div>
[% END %]
</td>
</tr>
[% END %][%# FOREACH basket IN supplier.loop_basket %]
</tbody>
</table>
+
[% ELSE %]
<p>No pending baskets</p>
[% END %][%# IF ( supplier.loop_basket.size ) %]