From: Jaswinder Singh Date: Thu, 27 Sep 2018 02:28:42 +0000 (-0400) Subject: LP#1772680: Changed code to display RBdigital only when user home library is tied... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=a85172a7f8bac7060a7c51e7b4863cad2e54d9a7;p=evergreen%2Fpines.git LP#1772680: Changed code to display RBdigital only when user home library is tied to RBdigital library Signed-off-by: Jaswinder Singh Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm index bd44b66b92..46b1c8b382 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm @@ -410,22 +410,34 @@ sub load_rbdigital_common { if (defined($self->editor->requestor)) { # Call sub to get the session id my $session_id = _get_ebook_session_id(); + $self->ctx->{vendors} = []; + $self->ctx->{wishlist} = []; + $self->ctx->{vendor_library_url} = ""; + $self->ctx->{is_patron_authorized_to_register_with_rbdigital} = 0; # Send back rbdigital_patron_id $self->ctx->{rbdigital_patron_id} = _get_patron_id($self->editor->authtoken, $session_id); $logger->info('EbookAPI: Got patron id: '. $self->ctx->{rbdigital_patron_id}); + + # Call method to know if the user's home library is tied to RBdigital portal + my $is_patron_authorized_to_register_with_rbdigital = _is_authorized($self->editor->authtoken, $session_id); + $self->ctx->{is_patron_authorized_to_register_with_rbdigital} = $is_patron_authorized_to_register_with_rbdigital; + $logger->info('EbookAPI: is_patron_authorized_to_register_with_rbdigital: '.$is_patron_authorized_to_register_with_rbdigital); + # Call sub to get all the vendors to be displayed on the UI $self->ctx->{vendors} = _get_authorized_vendors($self->editor->authtoken, $session_id); + $self->ctx->{wishlist} = _get_patron_wishlist($self->editor->authtoken, $session_id); - # Loop through vendors array and get the RBdigital library URL tied to logged in User - foreach my $value (@ {$self->ctx->{vendors}}) { - if ($value->vendor_key eq 'rbdigital') { - $self->ctx->{vendor_library_url} = $value->[0]->digital_services_library_url; - last; + if ($is_patron_authorized_to_register_with_rbdigital eq 1) { + # Loop through vendors array and get the RBdigital library URL tied to logged in User + foreach my $value (@ {$self->ctx->{vendors}}) { + if ($value->vendor_key eq 'rbdigital') { + $self->ctx->{vendor_library_url} = $value->[0]->digital_services_library_url; + last; + } } } - - $self->ctx->{wishlist} = _get_patron_wishlist($self->editor->authtoken, $session_id); + } else { $self->ctx->{rbdigital_patron_id} = 0; $self->ctx->{vendors} = _get_default_vendor(); diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm index 0c57882f67..5e422f28d5 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -2103,12 +2103,6 @@ sub load_myopac_main { }) ); - # Call sub to get the session id - my $session_id = _get_ebook_session_id(); - - # Call sub to get all the vendors to be displayed on the UI - $self->ctx->{vendors} = _get_authorized_vendors($self->editor->authtoken, $session_id); - return $self->prepare_fines($limit, $offset) || Apache2::Const::OK; } diff --git a/Open-ILS/src/templates/opac/parts/vendor_tabs.tt2 b/Open-ILS/src/templates/opac/parts/vendor_tabs.tt2 index f162c44123..d3872da844 100644 --- a/Open-ILS/src/templates/opac/parts/vendor_tabs.tt2 +++ b/Open-ILS/src/templates/opac/parts/vendor_tabs.tt2 @@ -9,6 +9,10 @@ vendor_key = 'default'; END; FOR vendor IN ctx.vendors; + + IF vendor.vendor_key == 'rbdigital'; + NEXT IF ctx.is_patron_authorized_to_register_with_rbdigital == 0; + END; IF vendor.vendor_key == vendor_key; vendor_tab_class = "acct-tab-on"; vendor_search_uri = vendor.search_uri; @@ -20,10 +24,7 @@ IF vendor.vendor_key == 'default'; vendor_search_url = ctx.opac_root _ vendor.search_uri; END; - IF vendor.vendor_key == 'rbdigital'; - # vendor_library_url = vendor.digital_services_library_url; - END; - %] + %] [% vendor.name %] [% END; %] diff --git a/Open-ILS/web/css/skin/default/ebook/rbdigital.css b/Open-ILS/web/css/skin/default/ebook/rbdigital.css index 4a91a37183..e953549f24 100644 --- a/Open-ILS/web/css/skin/default/ebook/rbdigital.css +++ b/Open-ILS/web/css/skin/default/ebook/rbdigital.css @@ -19,7 +19,7 @@ color: #FFFFFF; border: 1px solid green; padding: 10px; - font-size: 12px; + font-size: 11px; width: 600px; }