Bug 29609: Centralized code to build the link to a biblio detail page
[srvgit] / koha-tmpl / intranet-tmpl / prog / en / modules / catalogue / results.tt
index 79912db..4295c11 100644 (file)
@@ -7,20 +7,9 @@
 [% PROCESS 'i18n.inc' %]
 [% SET footerjs = 1 %]
 [% USE AuthorisedValues %]
-[% SET AdlibrisEnabled = Koha.Preference('AdlibrisCoversEnabled') %]
-[% SET AdlibrisURL = Koha.Preference('AdlibrisCoversURL') %]
-[% IF BiblioDefaultViewmarc %]
-    [% SET DetailPage="MARCdetail.pl" %]
-[% ELSIF BiblioDefaultViewlabeled_marc %]
-    [% SET DetailPage="labeledMARCdetail.pl" %]
-[% ELSIF BiblioDefaultViewisbd %]
-    [% SET DetailPage="ISBDdetail.pl" %]
-[% ELSE %]
-    [% SET DetailPage="detail.pl" %]
-[% END %]
 [% INCLUDE 'doc-head-open.inc' %]
 
-<title>Koha &rsaquo; Catalog &rsaquo; [% IF ( searchdesc ) %]Results of search [% IF ( query_desc ) %]for '[% query_desc | html %]'[% END %][% IF ( limit_desc ) %]&nbsp;with limit(s):&nbsp;'[% limit_desc | html %]'[% END %][% ELSE %]You did not specify any search criteria[% END %]</title>
+<title>[% IF ( searchdesc ) %]Results of search [% IF ( query_desc ) %]for '[% query_desc | html %]'[% END %][% IF ( limit_desc ) %]&nbsp;with limit(s):&nbsp;'[% limit_desc | html %]'[% END %][% ELSE %]You did not specify any search criteria[% END %] &rsaquo; Catalog &rsaquo; Koha</title>
 [% INCLUDE 'doc-head-close.inc' %]
 </head>
 
@@ -76,6 +65,7 @@
                     <h3>
                         [% total | html %] result(s) found [% IF ( query_desc ) %]for <span class="results_query_desc">'[% query_desc | html %]'</span>[% END %][% IF limit_desc  %]&nbsp;with limit(s): <span class="results_limit_desc">'[% limit_desc | html %]'</span>[% END %][% IF ( LibraryName ) %] in [% LibraryName | html %] Catalog[% END %].
                     </h3>
+                    <a href="/cgi-bin/koha/catalogue/search.pl?advsearch=1&edit_search=1&[% query_cgi | $raw %]&[% limit_cgi | $raw %]&sort_by=[% sort_by | $raw %]">Edit this search</a>
 
                     <div class="searchheader" id="searchheader">
                         <div id="selection_ops">
                             [% IF CAN_user_acquisition_order_manage && searchtoorder_basketno && searchtoorder_vendorid %][%# Coming from the basket or vendor view %]
                                 <p><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% searchtoorder_basketno | uri %]">View basket<a></p>
                             [% END %]
+                            <a href="/cgi-bin/koha/catalogue/search.pl?advsearch=1&edit_search=1&[% query_cgi | $raw %]&[% limit_cgi | $raw %]&sort_by=[% sort_by | $raw %]">Edit this search</a>
                         [% ELSE %]
                             <p>You did not specify any search criteria.</p>
                         [% END %]
                                 <tr>
                                     <td>
                                         [% IF ( scan_search_term_to_use ) %]
-                                            Scan Index for: <input type="text" name="q" id="scan-index" size="35" value="[% scan_search_term_to_use | html %]" />
+                                            Scan index for: <input type="text" name="q" id="scan-index" size="35" value="[% scan_search_term_to_use | html %]" />
                                         [% ELSE %]
-                                            Scan Index for: <input type="text" name="q" id="scan-index" size="35" value="" />
+                                            Scan index for: <input type="text" name="q" id="scan-index" size="35" value="" />
                                         [% END %]
                                     </td>
                                 </tr>
                                 <!-- TABLE RESULTS START -->
                                 <table>
                                     <tr>
-                                        [% IF ( AmazonCoverImages  || LocalCoverImages || AdlibrisEnabled || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %]
+                                        [% IF ( AmazonCoverImages  || LocalCoverImages || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %]
                                             <th>&nbsp;</th>
                                         [% END %]
                                         <th colspan="2">Results</th>
                                     [% SET MaxSearchResultsItemsPerRecordStatusCheck = Koha.Preference('MaxSearchResultsItemsPerRecordStatusCheck') %]
                                     [% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %]
                                         <tr id="row[% SEARCH_RESULT.biblionumber | html %]">
-                                            [% IF ( AmazonCoverImages  || LocalCoverImages || AdlibrisEnabled || IntranetCoce || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %]
+                                            [% IF ( AmazonCoverImages  || LocalCoverImages || IntranetCoce || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %]
     <td class="bookcoverimg">
         <div id="cover-slides-[% SEARCH_RESULT.biblionumber | html %]" class="cover-slides" data-biblionumber="[% SEARCH_RESULT.biblionumber | html %]">
             [% IF ( LocalCoverImages ) %][% SEARCH_RESULT.localimage | html %]
                 <div id="local-coverimg-[% SEARCH_RESULT.biblionumber | html %]" class="cover-image local-coverimg">
-                    <a class="p1" href="/cgi-bin/koha/catalogue/[% DetailPage | html %]?biblionumber=[% SEARCH_RESULT.biblionumber |url %]">
+                    <a href="[% PROCESS biblio_a_href biblionumber => SEARCH_RESULT.biblionumber %]" class => 'p1'>
                         <img src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&amp;biblionumber=[% SEARCH_RESULT.biblionumber | uri %]" alt="Local cover image" />
                     </a>
                     <div class="hint">Local cover image</div>
                 </div>
             [% END %]
 
-            [% IF ( AdlibrisEnabled && SEARCH_RESULT.normalized_isbn ) %]
-                <div id="adlibris-coverimg-[% SEARCH_RESULT.biblionumber | html %]" class="cover-image adlibris-coverimg">
-                    <a href="[% AdlibrisURL | url %]?isbn=[% SEARCH_RESULT.normalized_isbn | uri %]"><img src="[% AdlibrisURL | url %]?isbn=[% SEARCH_RESULT.normalized_isbn | uri %]" class="adlibris-cover" alt="Adlibris cover image" /></a>
-                    <div class="hint">Adlibris cover image</div>
-                </div>
-            [% END %]
-
             [% IF ( AmazonCoverImages && SEARCH_RESULT.normalized_isbn ) %]
                 <div id="amazon-bookcoverimg-[% SEARCH_RESULT.biblionumber | html %]" class="cover-image amazon-bookcoverimg">
-                    <a class="p1" href="/cgi-bin/koha/catalogue/[% DetailPage | html %]?biblionumber=[% SEARCH_RESULT.biblionumber |url %]">
+                    <a href="[% PROCESS biblio_a_href biblionumber => SEARCH_RESULT.biblionumber %]" class => 'p1'>
                         <img src="https://images-na.ssl-images-amazon.com/images/P/[% SEARCH_RESULT.normalized_isbn | html %].01.TZZZZZZZ.jpg" alt="Cover image from Amazon.com" />
                     </a>
                     <div class="hint">Amazon cover image</div>
                 [% coce_id = SEARCH_RESULT.normalized_ean || SEARCH_RESULT.normalized_isbn %]
                 [% IF ( coce_id ) %]
                     <div id="coce-coverimg-[% SEARCH_RESULT.biblionumber | html %]" class="cover-image coce-coverimg">
-                        <a class="p1" href="/cgi-bin/koha/catalogue/[% DetailPage | html %]?biblionumber=[% SEARCH_RESULT.biblionumber | url %]">
+                        <a href="[% PROCESS biblio_a_href biblionumber => SEARCH_RESULT.biblionumber %]" class => 'p1'>
                             <span style="block" title="[% SEARCH_RESULT.biblionumber | url %]" class="[% coce_id | html %]" id="coce-thumbnail[% SEARCH_RESULT.biblionumber | html %]"></span>
                         </a>
                         <div class="hint">Coce cover image</div>
             [% END %]
         </div>
     </td>
-[% END # /IF( AmazonCoverImages || LocalCoverImages || AdlibrisEnabled || IntranetCoce )%]
+[% END # /IF( AmazonCoverImages || LocalCoverImages || IntranetCoce )%]
 
                                             <td>
                                                 <input type="checkbox" class="selection" id="bib[% SEARCH_RESULT.biblionumber | html %]" name="biblionumber" value="[% SEARCH_RESULT.biblionumber | html %]" style="display:none" />
                                                             Holds ([% Biblio.HoldsCount( SEARCH_RESULT.biblionumber ) | html %])
                                                         [% END %]
                                                     [% END # /IF SEARCH_RESULT.norequests %]
+                                                    [% IF Koha.Preference('UseRecalls') and CAN_user_recalls %]
+                                                        | <a id="recall_[% SEARCH_RESULT.biblionumber | html %]" href="/cgi-bin/koha/recalls/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber | html %]">Recalls ([% Biblio.RecallsCount( SEARCH_RESULT.biblionumber ) | html %])</a>
+                                                    [% END %]
 
                                                     [% IF Koha.Preference('intranetbookbag') == 1 %]
                                                         [% IF ( SEARCH_RESULT.incart ) %]
                                             <td>
                                                 <div class="availability">
                                                     [% IF ( SEARCH_RESULT.items_count ) %]
-                                                        <strong>
+                                                        <div class="results_available_count">
                                                             [% IF MaxSearchResultsItemsPerRecordStatusCheck && SEARCH_RESULT.items_count > MaxSearchResultsItemsPerRecordStatusCheck %]
                                                                 <span class="blocker inaccurate-item-statuses" title="Item statuses may be inaccurate. Please view the record details for accurate item statuses">
                                                             [% END %]
                                                             [% IF MaxSearchResultsItemsPerRecordStatusCheck && SEARCH_RESULT.items_count > MaxSearchResultsItemsPerRecordStatusCheck %]
                                                                 </span>
                                                             [% END %]
-                                                        </strong>
-
-                                                        [% IF ( SEARCH_RESULT.availablecount ) %]
-                                                            <ul>
-                                                                [% FOREACH available_items_loo IN SEARCH_RESULT.available_items_loop %]
-                                                                    [% IF item_level_itypes && !noItemTypeImages && available_items_loo.imageurl %]
-                                                                        <li style="list-style: none; list-style-type: none;">
-                                                                            <img src="[% available_items_loo.imageurl | html %]" title="[% available_items_loo.description | html %]" alt="[% available_items_loo.description | html %]" />
-                                                                    [% ELSE %]
-                                                                        <li>
-                                                                    [% END %]
-                                                                    [% IF ( available_items_loo.branchname ) %]
-                                                                        [% available_items_loo.branchname | html %]
-                                                                    [% END %]
-                                                                    [% IF ( available_items_loo.location ) %]
-                                                                        <span class="shelvingloc">[% available_items_loo.location | html %]</span>
-                                                                    [% END %]
-                                                                    [% IF ( available_items_loo.itemcallnumber ) %]
-                                                                        [<a href="/cgi-bin/koha/catalogue/search.pl?idx=callnum&amp;q=%22[% available_items_loo.itemcallnumber |uri %]%22">[% available_items_loo.itemcallnumber | html %]</a>]
-                                                                    [% END %]
-                                                                    ([% available_items_loo.count | html %])
-                                                                    [% IF item_level_itypes && available_items_loo.description %]
-                                                                        <br/>[% available_items_loo.description | html %]
-                                                                    [% END %]
-                                                                    </li>
-                                                                [% END # /FOREACH available_items_loo %]
-                                                            </ul>
-                                                        [% END # /IF SEARCH_RESULT.availablecount %]
+                                                        </div> <!-- /.results_available_count -->
 
-                                                        [% IF ( SEARCH_RESULT.onloancount ) %]
-                                                            <span class="status">[% SEARCH_RESULT.onloancount | html %] on loan:</span>
-                                                            <ul>
-                                                                [% FOREACH onloan_items_loo IN SEARCH_RESULT.onloan_items_loop %]
-                                                                    [% IF item_level_itypes && !noItemTypeImages && onloan_items_loo.imageurl %]
-                                                                        <li style="list-style: none; list-style-type: none;">
-                                                                            <img src="[% onloan_items_loo.imageurl | html %]" title="[% onloan_items_loo.description | html %]" alt="[% onloan_items_loo.description | html %]" />
-                                                                    [% ELSE %]
-                                                                        <li>
-                                                                    [% END %]
-                                                                    [% IF ( onloan_items_loo.branchname ) %]
-                                                                        [% onloan_items_loo.branchname | html %]
-                                                                    [% END %]
-                                                                    [% IF ( onloan_items_loo.location ) %]
-                                                                        <span class="shelvingloc">[% onloan_items_loo.location | html %]</span>
-                                                                    [% END %]
-                                                                    [% IF ( onloan_items_loo.itemcallnumber ) %]
-                                                                        [<a href="/cgi-bin/koha/catalogue/search.pl?idx=callnum&amp;q=%22[% onloan_items_loo.itemcallnumber |uri %]%22">[% onloan_items_loo.itemcallnumber | html %]</a>]
-                                                                    [% END %]
-                                                                    ([% onloan_items_loo.count | html %][% IF ( onloan_items_loo.longoverdue ) %], [% onloan_items_loo.longoverdue | html %] long overdue[% END %]) date due: [% onloan_items_loo.due_date | $KohaDates %]
-                                                                    [% IF item_level_itypes && onloan_items_loo.description %]
-                                                                    <br/>[% onloan_items_loo.description | html %]
+                                                        [% BLOCK search_result_items %]
+                                                            [% IF status_count == "onloancount" %]
+                                                                [% IF SEARCH_RESULT.${status_count} > 0 %]
+                                                                    <div class="results_checkedout">[% SEARCH_RESULT.${status_count} | html %] checked out:</div>
                                                                 [% END %]
-                                                                </li>
-                                                                [% END # /FOREACH onloan_items_loo %]
-                                                            </ul>
-                                                        [% END # IF SEARCH_RESULT.onloancount %]
+                                                            [% ELSIF status_count == "othercount" %]
+                                                                [% IF SEARCH_RESULT.${status_count} > 0 %]
+                                                                    <div class="results_unavailable">[% SEARCH_RESULT.${status_count} | html %] unavailable:</div>
+                                                                [% END %]
+                                                            [% END %]
+                                                            [% IF SEARCH_RESULT.${items_loop}.size > 0 %]
+                                                                <ul class="[% items_loop | html %]_items">
+                                                                    [% FOREACH items_loo IN SEARCH_RESULT.${items_loop} %]
+                                                                        [% IF item_level_itypes && !noItemTypeImages && items_loo.imageurl %]
+                                                                            <li class="result_itype_image">
+                                                                                <img src="[% items_loo.imageurl | html %]" title="[% items_loo.description | html %]" alt="[% items_loo.description | html %]" />
+                                                                        [% ELSE %]
+                                                                            <li>
+                                                                        [% END %]
+                                                                        [% IF ( items_loo.branchname ) %]
+                                                                            [% items_loo.branchname | html %]
+                                                                        [% END %]
+                                                                        [% IF ( items_loo.location ) %]
+                                                                            <span class="shelvingloc">[% items_loo.location | html %]</span>
+                                                                        [% END %]
+
+                                                                            &bull;
+                                                                            [% IF ( items_loo.itemcallnumber ) %]
+                                                                                <a href="/cgi-bin/koha/catalogue/search.pl?idx=callnum&amp;q=%22[% items_loo.itemcallnumber |uri %]%22">[% items_loo.itemcallnumber | html %]</a>
+                                                                            [% END %]
+                                                                            <div class="result_item_details">
+                                                                                [% IF ( items_loo.withdrawn ) %]
+                                                                                    ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => items_loo.withdrawn ) | html %])
+                                                                                [% END %]
+                                                                                [% IF ( items_loo.itemlost ) %]
+                                                                                    ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => items_loo.itemlost ) | html %])
+                                                                                [% END %]
+                                                                                [% IF ( items_loo.damaged ) %]
+                                                                                    ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => items_loo.damaged ) | html %])
+                                                                                [% END %]
+                                                                                [% IF ( items_loo.intransit ) %]
+                                                                                    (In transit)
+                                                                                [% END %]
+                                                                                [% IF ( items_loo.onhold ) %]
+                                                                                    (On hold)
+                                                                                [% END %]
+                                                                                [% IF ( items_loo.notforloan ) %]
+                                                                                    [% items_loo.notforloan | html %]
+                                                                                [% END %]
+                                                                                <span class="item_count">[% items_loo.count | html %]</span>
+                                                                            </div> <!-- /.result_item_details -->
+                                                                            [% IF item_level_itypes && items_loo.description %]
+                                                                                <span class="item-itype-desc">[% items_loo.description | html %]</span>
+                                                                            [% END %]
+                                                                        </li>
+                                                                    [% END # /FOREACH other_items_loo %]
+                                                                </ul> <!-- /.[% items_loop | html %]_items -->
+                                                            [% END # /IF SEARCH_RESULT.${items_loop}.size %]
+                                                        [% END # /BLOCK search_result_items %]
+
+                                                        [% PROCESS search_result_items status_count="availablecount" items_loop="available_items_loop" %]
+
+                                                        [% PROCESS search_result_items status_count="onloancount" items_loop="onloan_items_loop" %]
+
+                                                        [% PROCESS search_result_items status_count="othercount" items_loop="other_items_loop" %]
 
-                                                        [% IF ( SEARCH_RESULT.othercount ) %]
-                                                            <span class="unavailable">[% SEARCH_RESULT.othercount | html %] unavailable:</span>
-                                                            <ul>
-                                                                [% FOREACH other_items_loo IN SEARCH_RESULT.other_items_loop %]
-                                                                    [% IF item_level_itypes && !noItemTypeImages && other_items_loo.imageurl %]
-                                                                        <li style="list-style: none; list-style-type: none;">
-                                                                            <img src="[% other_items_loo.imageurl | html %]" title="[% other_items_loo.description | html %]" alt="[% other_items_loo.description | html %]" />
-                                                                    [% ELSE %]
-                                                                        <li>
-                                                                    [% END %]
-                                                                    [% IF ( other_items_loo.branchname ) %]
-                                                                        [% other_items_loo.branchname | html %]
-                                                                    [% END %]
-                                                                    [% IF ( other_items_loo.location ) %]
-                                                                        <span class="shelvingloc">[% other_items_loo.location | html %]</span>
-                                                                    [% END %]
-                                                                    [% IF ( other_items_loo.itemcallnumber ) %]
-                                                                        [<a href="/cgi-bin/koha/catalogue/search.pl?idx=callnum&amp;q=%22[% other_items_loo.itemcallnumber |uri %]%22">[% other_items_loo.itemcallnumber | html %]</a>]
-                                                                    [% END %]
-                                                                    [% IF ( other_items_loo.withdrawn ) %]
-                                                                        ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => other_items_loo.withdrawn ) | html %])
-                                                                    [% END %]
-                                                                    [% IF ( other_items_loo.itemlost ) %]
-                                                                        ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => other_items_loo.itemlost ) | html %])
-                                                                    [% END %]
-                                                                    [% IF ( other_items_loo.damaged ) %]
-                                                                        ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => other_items_loo.damaged ) | html %])
-                                                                    [% END %]
-                                                                    [% IF ( other_items_loo.intransit ) %]
-                                                                        (In transit)
-                                                                    [% END %]
-                                                                    [% IF ( other_items_loo.onhold ) %]
-                                                                        (On hold)
-                                                                    [% END %]
-                                                                    [% IF ( other_items_loo.notforloan ) %]
-                                                                        [% other_items_loo.notforloan | html %]
-                                                                    [% END %]
-                                                                    ([% other_items_loo.count | html %])
-                                                                    [% IF item_level_itypes && other_items_loo.description %]
-                                                                        <br/>[% other_items_loo.description | html %]
-                                                                    [% END %]
-                                                                    </li>
-                                                                [% END # /FOREACH other_items_loo %]
-                                                            </ul>
-                                                        [% END # /IF SEARCH_RESULT.othercount %]
 
                                                     [% ELSE # /IF ( SEARCH_RESULT.items_count ) %]
 
 
                 <form id="hold_form" method="get" action="/cgi-bin/koha/reserve/request.pl">
                     <!-- Value will be set here by placeHold() -->
-                    <input id="hold_form_biblios" type="hidden" name="biblionumbers" value="" />
                     <input type="hidden" name="findborrower" id="holdFor" value="" />
                     <input type="hidden" name="club" id="holdForClub" value="" />
                 </form>
 
                 <form id="list_form" method="get" action="/cgi-bin/koha/reserve/request.pl">
                     <!-- Value will be set here by addToList() -->
-                    <input id="list_form_biblios" type="hidden" name="biblionumbers" value="" />
                     <input type="hidden" name="multi_listadd" value="1"/>
                 </form>
 
         [%- END -%]
 
         var search_result = {
-            query_desc: "[% To.json( query_desc ) | $raw %]",
+            query_desc: "[% To.json( query_desc ) | html %]",
             query_cgi: "[% query_cgi | html %]",
             limit_cgi: "[% limit_cgi | html %]",
-            sort_cgi: "[% sort_cgi | html %]",
             sort_by: "[% sort_by | html %]",
             gotoPage: "[% gotoPage | html %]",
             gotoNumber: "[% gotoNumber | html %]",