LP1849212: Consult physical_loc to determine if an ou is using course materials module
authorJane Sandberg <sandbej@linnbenton.edu>
Wed, 26 Aug 2020 18:22:22 +0000 (11:22 -0700)
committerGalen Charlton <gmc@equinoxinitiative.org>
Mon, 14 Sep 2020 22:17:26 +0000 (18:17 -0400)
Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Signed-off-by: Michele Morgan <mmorgan@noblenet.org>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/templates/opac/advanced.tt2
Open-ILS/src/templates/opac/browse.tt2
Open-ILS/src/templates/opac/parts/record/copy_table.tt2
Open-ILS/src/templates/opac/parts/result/table.tt2
Open-ILS/src/templates/opac/parts/searchbar.tt2

index b4be003..c7e36b0 100644 (file)
@@ -16,7 +16,7 @@
 
             <span class="browse_the_catalog_lbl"><a href="[% mkurl(ctx.opac_root _ '/browse') %]">[%
                     l('Browse the Catalog')%]</a></span>
-            [% IF ctx.get_org_setting(ctx.aou_tree.id, 'circ.course_materials_opt_in') == 1 %]
+            [% IF ctx.get_org_setting(ctx.physical_loc || ctx.aou_tree.id, 'circ.course_materials_opt_in') == 1 %]
                 <span class="search_courses_label"><a href="[% mkurl(ctx.opac_root _ '/course_search') %]">[% l('Search for Courses') %]</a></span>
                 <span class="search_courses_label"><a href="[% mkurl(ctx.opac_root _ '/course_browse') %]">[% l('Browse for Courses') %]</a></span>
             [% END %]
index cb60e3f..92ac176 100644 (file)
@@ -37,7 +37,7 @@
                     id="home_adv_search_link">[%l('Advanced Search')%]</a></span>
         
             <span class="browse_the_catalog_lbl mobile_hide">[% l('Browse the Catalog') %]</span>
-            [% IF ctx.get_org_setting(ctx.aou_tree.id, 'circ.course_materials_opt_in') == 1 %]
+            [% IF ctx.get_org_setting(ctx.physical_loc || ctx.aou_tree.id, 'circ.course_materials_opt_in') == 1 %]
                 <span class="search_courses_label"><a href="[% mkurl(ctx.opac_root _ '/course_search') %]">[% l('Search for Courses') %]</a></span>
                 <span class="search_courses_label"><a href="[% mkurl(ctx.opac_root _ '/course_browse') %]">[% l('Browse for Courses') %]</a></span>
 
index 48d9c0d..7db16c6 100644 (file)
@@ -30,6 +30,7 @@ IF has_copies or ctx.foreign_copies;
   depth = CGI.param('copy_depth').defined ? CGI.param('copy_depth') : CGI.param('depth').defined ? CGI.param('depth') : ctx.copy_summary.last.depth;
   total_copies = ctx.copy_summary.$depth.count;
 %]
+[% use_courses = (ctx.get_org_setting(ctx.aou_tree.id, 'circ.course_materials_opt_in') == 1) ? 1 : 0 %]
 <table class="table_no_border_space table_no_cell_pad table_no_border" width="100%" id="rdetails_status">
     <thead>
         <tr>
@@ -44,7 +45,7 @@ IF has_copies or ctx.foreign_copies;
             [%- END %]
             <th scope='col'>[% l("Barcode") %]</th>
             <th scope='col'>[% l("Shelving Location") %]</th>
-            [% IF ctx.is_staff || ctx.get_org_setting(ctx.aou_tree.id, 'circ.course_materials_opt_in') == 1 %]
+            [% IF ctx.is_staff || use_courses %]
             <th scope='col'>[% l("Circulation Modifier") %]</th>
             [% END %]
             [% IF ctx.is_staff %]
@@ -56,7 +57,7 @@ IF has_copies or ctx.foreign_copies;
             [%- END %]
             <th scope='col'>[% l("Status") %]</th>
             <th scope='col'>[% l("Due Date") %]</th>
-            [%- IF ctx.get_org_setting(ctx.aou_tree.id, 'circ.course_materials_opt_in') == 1 %]
+            [%- IF use_courses %]
             <th scope='col'>[% l("Courses") %]</th>
             [%- END %]
         </tr>
@@ -80,8 +81,8 @@ IF has_copies or ctx.foreign_copies;
     <td>[% bib.target_copy.location.name | html %]</td>
     <td>[% bib.target_copy.status.name | html %]</td>
     <td>[% date.format(ctx.parse_datetime(copy_info.due_date, copy_info.circ_circ_lib),DATE_FORMAT) %]</td>
-    [%- IF ctx.get_org_setting(CGI.param('loc') 
-        OR ctx.aou_tree.id, 'circ.course_materials_opt_in') == 1 %]
+    [%- IF ctx.get_org_setting(CGI.param('loc'))
+        OR use_courses %]
     <td></td>
     [%- END %]
 </tr>
@@ -150,7 +151,7 @@ END; # FOREACH bib
 
             [% IF copy_info.courses.size > 0 || ctx.is_staff %]
             <td>[% copy_info.circ_modifier | html %]</td>
-            [% ELSIF ctx.get_org_setting(ctx.aou_tree.id, 'circ.course_materials_opt_in') == 1 %]
+            [% ELSIF use_courses %]
             <td></td>
             [% END %]
             [% IF ctx.is_staff %]
@@ -237,7 +238,7 @@ END; # FOREACH bib
                 ELSE;
                     '-';
                 END %]</td>
-            [%- IF ctx.get_org_setting(ctx.aou_tree.id, 'circ.course_materials_opt_in') == 1 %]
+            [%- IF use_courses %]
             <td>[%- FOREACH course IN copy_info.courses %]
                 <div>[% course.course_number %]</div>
             [% END %]</td>
index 237b8d4..c9436f9 100644 (file)
@@ -405,7 +405,7 @@ END;
                                                     [% UNLESS rec.mmr_id;
                                                             PROCESS "opac/parts/result/copy_counts.tt2";
                                                         END; %]
-                                                    [%- IF ctx.get_org_setting(ctx.search_ou, 'circ.course_materials_opt_in') == 1 %]
+                                                    [%- IF ctx.get_org_setting(ctx.physical_loc || ctx.search_ou, 'circ.course_materials_opt_in') == 1 %]
                                                         [%- courseStrings = [] %]
                                                         [% FOREACH course IN rec.courses %]
                                                             [% courseString = course.name _ ' (' _ course.course_number _ ')' %]
index 35034f3..f9fb92b 100644 (file)
@@ -44,7 +44,7 @@ END;
         <span class="adv_search_catalog_lbl"><a href="[% mkurl(ctx.opac_root _ '/advanced', {},  expert_search_parms.merge(browse_search_parms, facet_search_parms)) %]"
             id="home_adv_search_link">[% l('Advanced Search') %]</a></span>
         <span class="browse_the_catalog_lbl"><a href="[% mkurl(ctx.opac_root _ '/browse', {}, expert_search_parms.merge(general_search_parms, facet_search_parms, ['fi:has_browse_entry'])) %]">[% l('Browse the Catalog') %]</a></span>
-        [% IF ctx.get_org_setting(ctx.aou_tree.id, 'circ.course_materials_opt_in') == 1 %]
+        [% IF ctx.get_org_setting(ctx.physical_loc || ctx.aou_tree.id, 'circ.course_materials_opt_in') == 1 %]
         <span class="search_courses_label"><a href="[% mkurl(ctx.opac_root _ '/course_search') %]">[% l('Search for Courses') %]</a></span>
         <span class="search_courses_label"><a href="[% mkurl(ctx.opac_root _ '/course_browse') %]">[% l('Browse for Courses') %]</a></span>
         [% END %]