LP#1772680: Resolved multiple issues
authorJaswinder Singh <Jaswinder.Singh0011@gmail.com>
Thu, 28 Jun 2018 19:35:27 +0000 (15:35 -0400)
committerChris Sharp <csharp@georgialibraries.org>
Sat, 17 Nov 2018 13:37:03 +0000 (08:37 -0500)
Signed-off-by: Jaswinder Singh <jaswinder.singh0011@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/perlmods/lib/OpenILS/Application/EbookAPI/RBDigital.pm
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/RBDigitalSearch.pm
Open-ILS/src/templates/opac/ebook_api/rbdigital/parts/item_parser.tt2
Open-ILS/src/templates/opac/ebook_api/rbdigital/parts/record/summary.tt2
Open-ILS/src/templates/opac/ebook_api/rbdigital/parts/result/table.tt2
Open-ILS/web/js/ui/default/opac/ebook_api/rbdigital.js

index 21f4c5f..8bee8ae 100755 (executable)
@@ -184,6 +184,7 @@ sub do_patron_auth {
         
         $logger->error("EbookAPI: Unable to get RBDigital Patron ID found for $username/$email");
     }
+
     return $patron_id;
 }
 
index c432060..4a5abdd 100755 (executable)
@@ -145,12 +145,6 @@ sub load_rbdigital_results {
 
     # filters
     my $filters = [];
-    # my $query;
-    # foreach (grep /^fi:/, $cgi->param) {
-    #     /:(-?\w+)$/ or next;
-    #     my $term = join(",", $cgi->param($_));
-    #     $query .= " $1($term)" if length $term;
-    # }
 
     # Build array with Search Inputs
     # Title (if any)
@@ -245,6 +239,8 @@ sub load_rbdigital_results {
         # Return hash reference of wishlist {isbn => true}
         $ctx->{wishlist} = _get_patron_wishlist($self->editor->authtoken, $session_id);
 
+        $ctx->{holds} = _get_patron_holds($self->editor->authtoken, $session_id);
+        
         $ctx->{checkouts} = _get_patron_checkouts($self->editor->authtoken, $session_id);
 
         # Add values to returned query structure for GUI to process
index b497753..be741bc 100755 (executable)
     ebook_item.authors_detail = '';
 
     # Check title is available for Checkout Service
-    ebook_item.isTitleAvailable = false;
-    IF item.interest.isAvailable == 'true';
-        ebook_item.isTitleAvailable = true;
-    END;
+    ebook_item.isAvailable = ebook_record_item.interest.isAvailable;
 
     # Loop over AUTHORS array
     FOREACH item IN ebook_record_item.authors;
index 6ae9404..64c94f1 100755 (executable)
@@ -6,12 +6,14 @@
 
     #Set the ebook_record_item before processing the item_parser
     ebook_record_item = ctx.title_info.item;
+    ebook_record_item.interest = ctx.title_info.interest;
     ebook_record_item.summary = ctx.title_summary.summary;
     ebook_record_item.recommended_books = ctx.recommended_books;
     ebook_isbn = ebook_record_item.isbn;
     
     PROCESS "opac/ebook_api/rbdigital/parts/item_parser.tt2";
 %]
+
 <!-- ****************** rdetail_summary.xml ***************************** -->
 <!-- Ebook Spinner -->
 <span id="ebook_spinner" class="hidden">&nbsp;Processing ...&nbsp;&nbsp;<img style="width:20px;height:auto" src="[% ctx.media_prefix %]/opac/images/progressbar_green.gif[% ctx.cache_key %]" alt="[% l("Processing...") %]"/></span>
@@ -44,7 +46,7 @@
         [% END %]
 
         <div id="rdetail_actions_div">
-            [% IF ebook_item.isTitleAvailable == true; %]
+            [% IF ebook_item.isAvailable == 1; %]
                 <div class="rdetail_aux_utils ebook_action">
                 [% IF ctx.checkouts.$ebook_isbn != ""; %]
                     <a id="[% ebook_item.isbn %]_ebook_checkout_download_link" 
                     
                  [% END; %]
                  </div>
-            [% END; %]
-
-            [% IF ctx.checkouts.$ebook_isbn == ""; %]
-                
+            [% ELSE; %]
                 <div id="[% ebook_item.isbn %]_ebook_hold" class="rdetail_aux_utils ebook_action">
                     <a id="[% ebook_item.isbn %]_ebook_place_hold" 
                         href="#" data-isbn="[% ebook_item.isbn %]"
index 0d75804..894bf9b 100755 (executable)
@@ -7,6 +7,7 @@
     IF ctx.result_stop > ctx.hit_count; ctx.result_stop = ctx.hit_count; END;
 
     result_count = ctx.result_start;
+    USE Dumper;
 %]
 [% PROCESS "opac/parts/result/paginate.tt2" %]
 [% ctx.results_count_header = PROCESS results_count_header; 
@@ -44,6 +45,7 @@
                     [% 
                         FOR rec IN ctx.records;
                             ebook_record_item = rec.item;
+                            ebook_record_item.interest = rec.interest;
                             PROCESS "opac/ebook_api/rbdigital/parts/item_parser.tt2";
                             #ebook_item variable is populated inside the item_parser file
                             ebook_isbn = ebook_item.isbn;
@@ -368,31 +370,47 @@ END;
                                                 </div>
                                                 <div class="result_table_utils_cont">
                                                     <div class="result_table_utils">
-                                                        [% IF ebook_item.isTitleAvailable == true; %]
-                                                        <div id="[%- rec.item.isbn -%]_ebook_checkout" class="results_aux_utils result_util ebook_action">
-                                                            [% IF ctx.checkouts.$ebook_isbn != ""; %]
-                                                                <a id="[% ebook_item.isbn %]_ebook_checkout_download_link" 
-                                                                    href="#"
-                                                                    data-downloadurl="[% ctx.checkouts.$ebook_isbn; %]"
-                                                                    class="no-dec ebook_checkout_download_link" 
-                                                                    rel="nofollow" vocab="" 
-                                                                    data-isbn="[% ebook_item.isbn %]">
-                                                                <img src="[% ctx.media_prefix %]/images/minus_sign.png[% ctx.cache_key %]" alt="" />&nbsp;[% l("Download") %]</a>
+                                                        [% IF ebook_item.isAvailable == 1; %]
+                                                            <div id="[%- rec.item.isbn -%]_ebook_checkout" class="results_aux_utils result_util ebook_action">
+                                                                [% IF ctx.checkouts.$ebook_isbn != ""; %]
+                                                                    <a id="[% ebook_item.isbn %]_ebook_checkout_download_link" 
+                                                                        href="#"
+                                                                        data-downloadurl="[% ctx.checkouts.$ebook_isbn; %]"
+                                                                        class="no-dec ebook_checkout_download_link" 
+                                                                        rel="nofollow" vocab="" 
+                                                                        data-isbn="[% ebook_item.isbn %]">
+                                                                    <img src="[% ctx.media_prefix %]/images/minus_sign.png[% ctx.cache_key %]" alt="" />&nbsp;[% l("Download") %]</a>
 
-                                                            [% ELSE; %]
-                                                                <a href="[% mkurl(ctx.opac_root _ '/myopac/ebook_checkout',
-                                                                    {title => args.ebook.ebook_id, vendor => args.ebook.vendor, action => 'checkout'},
-                                                                    ['query','tag','subfield','term','_special','sort','page']) %]"
-                                                                    [% html_text_attr('title', l('Check Out [_1]', ebook_item.title)) %]
-                                                                    data-isbn="[% ebook_item.isbn %]" 
-                                                                    class="no-dec ebook_checkout_link" rel="nofollow" vocab="">
-                                                                <img src="[% ctx.media_prefix %]/images/green_check.png[% ctx.cache_key %]"
-                                                                    alt=""/><span class="result_place_hold">[% l('Check Out E-Item') %]</span></a>                                                            
-                                                            [% END; %]
-                                                        </div>
+                                                                [% ELSE; %]
+                                                                    <a href="[% mkurl(ctx.opac_root _ '/myopac/ebook_checkout',
+                                                                        {title => args.ebook.ebook_id, vendor => args.ebook.vendor, action => 'checkout'},
+                                                                        ['query','tag','subfield','term','_special','sort','page']) %]"
+                                                                        [% html_text_attr('title', l('Check Out [_1]', ebook_item.title)) %]
+                                                                        data-isbn="[% ebook_item.isbn %]" 
+                                                                        class="no-dec ebook_checkout_link" rel="nofollow" vocab="">
+                                                                    <img src="[% ctx.media_prefix %]/images/green_check.png[% ctx.cache_key %]"
+                                                                        alt=""/><span class="result_place_hold">[% l('Check Out E-Item') %]</span></a>                                                            
+                                                                [% END; %]
+                                                            </div>
+                                                        [% ELSE; %]
+                                                            <div id="[% ebook_item.isbn %]_ebook_hold" class="rdetail_aux_utils result_util ebook_action">
+                                                                <a id="[% ebook_item.isbn %]_ebook_place_hold" 
+                                                                    href="#" data-isbn="[% ebook_item.isbn %]"
+                                                                    class="no-dec ebook_place_hold [% IF ctx.holds.$ebook_isbn == "1"; %] hidden [% END; %]" rel="nofollow" vocab="">
+                                                                    <img src="[% ctx.media_prefix %]/images/green_check.png[% ctx.cache_key %]"
+                                                                    [% img_alt(l('Place Hold on [_1]', ebook_item.title)) %]/>
+                                                                <span class="result_place_hold">[% l('Place Hold on E-Item') %]</span></a>
+
+                                                                <a id="[% ebook_item.isbn %]_ebook_cancel_hold"
+                                                                    href="#" data-isbn="[% ebook_item.isbn %]"
+                                                                    class="no-dec ebook_cancel_hold [% IF ctx.holds.$ebook_isbn != "1"; %] hidden [% END; %]" rel="nofollow" vocab="">
+                                                                    <img src="[% ctx.media_prefix %]/images/minus_sign.png[% ctx.cache_key %]"
+                                                                    [% img_alt(l('Cancel Hold on [_1]', ebook_item.title)) %]/>
+                                                                <span class="result_place_hold">[% l('Cancel Hold on E-Item') %]</span></a>
+                                                            </div>
                                                         [% END; %]
                                                     [% IF !ctx.is_meta %]
-                                                        <div class="results_aux_utils result_util">
+                                                        <div class="results_aux_utils result_util ebook_action">
                                                         [%  IF !ctx.is_staff; %]
                                                                 <a id="[% ebook_item.isbn %]_ebook_wishlist_add" href="#" 
                                                                     class="no-dec ebook_wishlist_link_add [% IF ctx.wishlist.$ebook_isbn == "1"; %] hidden [% END; %]" 
index 337eeaa..554cfca 100755 (executable)
@@ -271,7 +271,7 @@ function placeHoldCallback(responseContents, isbn) {
 
 function cancelHoldCallback(responseContents, isbn) {
     if (responseContents.message == "success") {
-        showNotification('Success','Item is no loger on hold!','success');
+        showNotification('Success','Item is no longer on hold!','success');
         $("#"+isbn+"_ebook_place_hold").removeClass('hidden');
         $("#"+isbn+"_ebook_cancel_hold").addClass('hidden');
     } else if (responseContents.message.indexOf("already exists") > 1) {