From 20af9c404b71b565e318bf067d3d390be7070858 Mon Sep 17 00:00:00 2001 From: Jonathan Druart <jonathan.druart@biblibre.com> Date: Tue, 10 Mar 2015 11:26:39 +0100 Subject: [PATCH] Bug 13371: Add a simple view This patch adds the ability to switch to a simple view if the complete view to too complex. --- acqui/booksellers.pl | 11 + .../prog/en/modules/acqui/booksellers.tt | 237 ++++++++++++--------- 2 files changed, 145 insertions(+), 103 deletions(-) diff --git a/acqui/booksellers.pl b/acqui/booksellers.pl index b56f73e..e981b63 100755 --- a/acqui/booksellers.pl +++ b/acqui/booksellers.pl @@ -156,11 +156,22 @@ for my $vendor (@suppliers) { }; } + +my $sessionID = $query->cookie('CGISESSID'); +my $session = C4::Auth::get_session($sessionID); +my $view = $query->param('view'); +if ( $view ) { + $session->param('bookseller_default_view', $view); +} else { + $view = $session->param('bookseller_default_view'); +} + $template->param( loop_suppliers => $loop_suppliers, supplier => ( $booksellerid || $supplier ), count => $supplier_count, has_budgets => $has_budgets, + view => $view, ); $template->{VARS}->{'allbaskets'} = $allbaskets; 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 1141923..334e111 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt @@ -126,124 +126,155 @@ $(document).ready(function() { </span> [% END %] <h1>You searched on <b>vendor [% supplier %],</b> [% count %] results found</h1> +[% IF view == "complete" %] + <p><a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=[% supplier %]&view=simple">Switch to the simple view</a></p> +[% ELSE %] + <p><a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=[% supplier %]&view=complete">Switch to the complete view</a></p> +[% END %] [% END %] [% IF ( loop_suppliers.size ) %] - [% IF allbaskets %] - <a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=[% supplier %]&booksellerid=[% booksellerid %]">Show active baskets only</a> - [% ELSE %] - <a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=[% supplier %]&booksellerid=[% booksellerid %]&allbaskets=1">Show active and inactive baskets</a> - [% END %] - | <a href="#" id="toggle_closed_baskets">Show opened baskets only</a> - <div id="acqui_order_basketlist"> - <table id="baskets" class="group"> - <thead> - <tr> - <th class='NoVisible'>bookseller</th> - <th>No.</th> - <th>Name</th> - <th>Item count</th> - <th>Biblio count</th> - <th>Items expected</th> - <th>Created by</th> - <th class="title-string">Date</th> - <th>Basket group</th> - <th class="title-string">Closed</th> - <th> </th> - </tr> - </thead> - <tbody> - [% FOREACH supplier IN loop_suppliers %] - [% IF supplier.loop_basket.size == 0 %] + [% IF view == "complete" %] + [% IF allbaskets %] + <a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=[% supplier %]&booksellerid=[% booksellerid %]">Show active baskets only</a> + [% ELSE %] + <a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=[% supplier %]&booksellerid=[% booksellerid %]&allbaskets=1">Show active and inactive baskets</a> + [% END %] + | <a href="#" id="toggle_closed_baskets">Show opened baskets only</a> + <div id="acqui_order_basketlist"> + <table id="baskets" class="group"> + <thead> <tr> - <td> - <a name="[% supplier.booksellerid %]" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% supplier.booksellerid %]">[% supplier.name %]</a> - ([% supplier.booksellerid %]) - [% PROCESS action supplier = supplier %] - </td> - <td> - [% IF allbaskets %] - No basket. - [% ELSE %] - No active basket. - [% END %] - </td> - <td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td> + <th class='NoVisible'>bookseller</th> + <th>No.</th> + <th>Name</th> + <th>Item count</th> + <th>Biblio count</th> + <th>Items expected</th> + <th>Created by</th> + <th class="title-string">Date</th> + <th>Basket group</th> + <th class="title-string">Closed</th> + <th> </th> </tr> - [% END %] - [% FOREACH basket IN supplier.loop_basket %] - [% IF ( basket.uncertainprices ) %] - <tr class="problem"> - [% ELSE %] + </thead> + <tbody> + [% FOREACH supplier IN loop_suppliers %] + [% IF supplier.loop_basket.size == 0 %] <tr> + <td> + <a name="[% supplier.booksellerid %]" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% supplier.booksellerid %]">[% supplier.name %]</a> + ([% supplier.booksellerid %]) + [% PROCESS action supplier = supplier %] + </td> + <td> + [% IF allbaskets %] + No basket. + [% ELSE %] + No active basket. + [% END %] + </td> + <td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td> + </tr> [% END %] - <td> - <a name="[% supplier.booksellerid %]" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% supplier.booksellerid %]">[% supplier.name %]</a> - ([% supplier.booksellerid %]) - [% PROCESS action supplier = supplier %] - </td> - <td>[% basket.basketno %]</td> - <td>[% basket.basketname %]</td> - <td> - [% basket.total_items %] - [% IF basket.total_items_cancelled %] - ([% basket.total_items_cancelled %] cancelled) - [% END %] - </td> - <td> - [% basket.total_biblios %] - [% IF basket.total_biblios_cancelled %] - ([% basket.total_biblios_cancelled %] cancelled) - [% END %] - </td> - <td>[% basket.expected_items %]</td> - <td> - [% basket.authorisedby_firstname %] [% basket.authorisedby_surname %] - </td> - <td><span title="[% basket.creationdate %]">[% basket.creationdate | $KohaDates %]</span></td> - <td> - [% IF basket.basketgroup %] - [% basketgroup = basket.basketgroup %] - [% IF basketgroup.closed %] - [% basketgroup.name %] (closed) - [% ELSE %] - <a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid=[% basket.booksellerid %]&basketgroupid=[% basketgroup.id %]">[% basketgroup.name %]</a> - [% END %] - [% END %] - </td> - <td> - [% IF ( basket.closedate ) %] - <span title="[% basket.closedate %]">[% basket.closedate | $KohaDates %]</span> - [% ELSE %] - <span title="9999-99-99"></span> - [% END %] - </td> - <td> - <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno %]">View</a> + [% FOREACH basket IN supplier.loop_basket %] + [% IF ( basket.uncertainprices ) %] + <tr class="problem"> + [% ELSE %] + <tr> + [% END %] + <td> + <a name="[% supplier.booksellerid %]" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% supplier.booksellerid %]">[% supplier.name %]</a> + ([% supplier.booksellerid %]) + [% PROCESS action supplier = supplier %] + </td> + <td>[% basket.basketno %]</td> + <td>[% basket.basketname %]</td> + <td> + [% basket.total_items %] + [% IF basket.total_items_cancelled %] + ([% basket.total_items_cancelled %] cancelled) + [% END %] + </td> + <td> + [% basket.total_biblios %] + [% IF basket.total_biblios_cancelled %] + ([% basket.total_biblios_cancelled %] cancelled) + [% END %] + </td> + <td>[% basket.expected_items %]</td> + <td> + [% basket.authorisedby_firstname %] [% basket.authorisedby_surname %] + </td> + <td><span title="[% basket.creationdate %]">[% basket.creationdate | $KohaDates %]</span></td> + <td> + [% IF basket.basketgroup %] + [% basketgroup = basket.basketgroup %] + [% IF basketgroup.closed %] + [% basketgroup.name %] (closed) + [% ELSE %] + <a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid=[% basket.booksellerid %]&basketgroupid=[% basketgroup.id %]">[% basketgroup.name %]</a> + [% END %] + [% END %] + </td> + <td> + [% IF ( basket.closedate ) %] + <span title="[% basket.closedate %]">[% basket.closedate | $KohaDates %]</span> + [% ELSE %] + <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> + [% 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> - </div> + [% END %] + </td> + </tr> + [% END %][%# FOREACH basket IN supplier.loop_basket %] + [% END %] + </tbody> + </table> + </div> + [% ELSE %] + <div id="acqui_order_supplierlist"> + [% FOREACH supplier IN loop_suppliers %] + <div class="supplier"> + <span class="suppliername"> + [% IF (supplier.name) %] + <a name="[% supplier.booksellerid %]" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% supplier.booksellerid %]">[% supplier.name %]</a> + [% ELSE %] + <a name="[% supplier.booksellerid %]" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% supplier.booksellerid %]">NO NAME</a> [% END %] - </td> - </tr> - [% END %][%# FOREACH basket IN supplier.loop_basket %] + </span> + <span class="action"> + [% IF ( CAN_user_acquisition_order_manage ) %] + [% IF ( supplier.active ) %] + <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 %] + <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> [% END %] - </tbody> - </table> + </div> + [% END %] [% ELSE %] <p>No pending baskets</p> [% END %][%# IF ( loop_suppliers.size ) %] </div> </div> -</div> <div class="yui-b"> [% IF ( booksellerid ) %] [% INCLUDE 'vendor-menu.inc' %] -- 2.7.0