[Koha-patches] [PATCH] Bug 10737 - Add "Add to basket" link on vendor search results page

Owen Leonard oleonard at myacpl.org
Thu Aug 15 18:29:51 CEST 2013


This patch adds an "add to basket" link to the vendor search results
page for each open basket associated with each vendor. Clicking it
triggers a modal window with the "add to basket" choices for that vendor
and basket.

Other changes in this patch:

- "New basket" and "Receive shipment" buttons associated with each
  vendor search result have been converted to Bootstrap-styled buttons.
- Basket closed date has been moved into its own column so that the
  table can be sorted by that value.
- Table columns containing dates now use the "title-string" sort option,
  eliminating the need for a special date sorting algorithm.
- Converted some &'s to &'s

To test, apply the patch and search for a vendor. For each vendor in
your search results baskets which are open should include an "add to
basket" link. Clicking it should open a modal dialog with the same "add
to basket" options offered on the basket page. The correct vendor ID and
basket number should be associated with each link.

The newly-styled "new basket" and "receive shipment" buttons should work
correctly. Table sorting should work correctly, including the new
"closed" column.
---
 .../prog/en/modules/acqui/booksellers.tt           |   65 +++++++++++++++-----
 1 file changed, 49 insertions(+), 16 deletions(-)

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 525ea66..a6e0591 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt
@@ -14,17 +14,17 @@
 <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,null
+        ],
         'aoColumnDefs': [
-            { 'aTargets': [-1], 'bSortable': false }
+            { 'aTargets': [-1,-2], 'bSortable': false }
         ]
     }));
     $("#supplierlist").change(function() {
@@ -63,9 +63,9 @@ $(document).ready(function() {
         </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 %]
@@ -80,12 +80,12 @@ $(document).ready(function() {
                 <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 ) %]
@@ -99,6 +99,8 @@ $(document).ready(function() {
                                     <th>Items expected</th>
                                     <th>Created by</th>
                                     <th>Date</th>
+                                    <th>Closed</th>
+                                    <th> </th>
                                     <th> </th>
                                 </tr>
                             </thead>
@@ -118,23 +120,54 @@ $(document).ready(function() {
                                             [% 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>
+                                        </td>
+                                        <td>
+                                            [% 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">
+                                                    <div class="modal-body">
+                                                        <fieldset>
+                                                            <legend>Add order to [% supplier.name %] basket [% basket.basketname %]</legend>
+                                                              <ul>
+                                                                <li>
+                                                                  <label for="q[% basket.basketno %]">From an existing record: </label>
+                                                                  <form method="post" action="/cgi-bin/koha/acqui/neworderbiblio.pl">
+                                                                    <input type="hidden" value="[% supplier.booksellerid %]" name="booksellerid">
+                                                                    <input type="hidden" value="[% basket.basketno %]" name="basketno">
+                                                                    <input type="text" name="q" size="25" id="q[% basket.basketno %]">
+                                                                    <input type="submit" value="Search" class="submit">
+                                                                  </form>
+                                                                </li>
+                                                                <li><a href="/cgi-bin/koha/acqui/newordersuggestion.pl?booksellerid=[% supplier.booksellerid %]&basketno=[% basket.basketno %]">From a suggestion</a></li>
+                                                                <li><a href="/cgi-bin/koha/acqui/newordersubscription.pl?booksellerid=[% supplier.booksellerid %]&basketno=[% basket.basketno %]">From a subscription</a></li>
+                                                                <li><a href="/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=[% supplier.booksellerid %]&basketno=[% basket.basketno %]">From a new (empty) record</a></li>
+                                                                <li><a href="/cgi-bin/koha/acqui/z3950_search.pl?booksellerid=[% supplier.booksellerid %]&basketno=[% basket.basketno %]">From an external source</a></li>
+                                                                <li><a href="/cgi-bin/koha/acqui/addorderiso2709.pl?booksellerid=[% supplier.booksellerid %]&basketno=[% basket.basketno %]"> From a staged file</a></li>
+                                                              </ul>
+                                                        </fieldset>
+                                                    </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 ) %]
-- 
1.7.9.5


More information about the Koha-patches mailing list