Bug 11175: Add syspref MaxComponentRecords to remove hardcoded limit
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 22 Oct 2021 07:46:43 +0000 (09:46 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 26 Oct 2021 14:46:02 +0000 (16:46 +0200)
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
catalogue/detail.pl
installer/data/mysql/atomicupdate/bug_11175.perl
installer/data/mysql/mandatory/sysprefs.sql
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt
opac/opac-detail.pl

index 1660ac1..8eae183 100755 (executable)
@@ -214,7 +214,7 @@ foreach my $subscription (@subscriptions) {
 # Get component parts details
 my $showcomp = C4::Context->preference('ShowComponentRecords');
 if ( $showcomp eq 'both' || $showcomp eq 'staff' ) {
-    if ( my $components = $biblio->get_marc_components(300) ) {
+    if ( my $components = $biblio->get_marc_components(C4::Context->preference('MaxComponentRecords')) ) {
         my $parts;
         for my $part ( @{$components} ) {
             $part = C4::Search::new_record_from_zebra( 'biblioserver', $part );
index 3f56e7e..fda5178 100644 (file)
@@ -1,6 +1,9 @@
 $DBversion = 'XXX';  # will be replaced by the RM
 if( CheckVersion( $DBversion ) ) {
     $dbh->do("INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('ShowComponentRecords', 'nowhere', 'nowhere|staff|opac|both','In which record detail pages to show list of the component records, as linked via 773','Choice')");
+
+    $dbh->do("INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('MaxComponentRecords', '300', '','Max number of component records to display','Integer')");
+
     SetVersion( $DBversion );
     print "Upgrade to $DBversion done (Bug 11175: Show component records in detail views)\n";
 }
index 3968074..8d16bdc 100644 (file)
@@ -616,6 +616,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
 ('ShelfBrowserUsesLocation','1','1','Use the item location when finding items for the shelf browser.','YesNo'),
 ('ShowAllCheckins', '0', '', 'Show all checkins', 'YesNo'),
 ('ShowComponentRecords', 'nowhere', 'nowhere|staff|opac|both','In which record detail pages to show list of the component records, as linked via 773','Choice'),
+('MaxComponentRecords', '300', '','Max number of component records to display','Integer'),
 ('showLastPatron','0','','If ON, enables the last patron feature in the intranet','YesNo'),
 ('ShowPatronImageInWebBasedSelfCheck','0','','If ON, displays patron image when a patron uses web-based self-checkout','YesNo'),
 ('ShowReviewer','full','none|full|first|surname|firstandinitial|username','Choose how a commenter\'s identity is presented alongside comments in the OPAC','Choice'),
index 8ee80eb..50f3508 100644 (file)
@@ -268,14 +268,18 @@ Cataloging:
             - "<li>subfields a and b of fields 245</li>"
             - "<li>all subfields of fields 600</li>"
         -
-            - Show a list of component records, as linked via field 773, in
+            - "Show a list of component records, as linked via field 773, in"
             - pref: ShowComponentRecords
               choices:
                   nowhere: "no"
                   staff: "staff interface"
                   opac: "OPAC"
                   both: "both staff interface and OPAC"
-            - record detail pages. UNIMARC is not supported.
+            - "record detail pages."
+            - "A maximum of"
+            - pref: MaxComponentRecords
+            - "records will be displayed."
+            - "<br/> UNIMARC is not supported."
     Importing:
         -
             - When matching on ISBN with the record import tool,
index ecf6113..3aedb27 100644 (file)
@@ -687,8 +687,8 @@ Note that permanent location is a code, and location may be an authval.
             </tr>
             [% END %]
         </table>
-        [% IF ComponentParts.size == 300 %]
-        <p>Only 300 results are shown: <a href="/cgi-bin/koha/catalogue/search.pl?q=[% ComponentPartsQuery | uri %]"/>show all component parts</a></p>
+        [% IF ComponentParts.size == Koha.Preference('MaxComponentRecords')%]
+        <p>Only [% ComponentParts.size %] results are shown: <a href="/cgi-bin/koha/catalogue/search.pl?q=[% ComponentPartsQuery | uri %]"/>show all component parts</a></p>
         [% END %]
 </div>
 
index 79f50e1..caa9378 100644 (file)
                                 </tr>
                                 [% END %]
                             </table>
-                            [% IF ComponentParts.size == 300 %]
-                            <p>Only 300 results are shown: <a href="/cgi-bin/koha/catalogue/search.pl?q=[% ComponentPartsQuery | uri %]"/>show all component parts</a></p>
+                            [% IF ComponentParts.size == Koha.Preference('MaxComponentRecords')%]
+                            <p>Only [% ComponentParts.size %] results are shown: <a href="/cgi-bin/koha/opac-search.pl?q=[% ComponentPartsQuery | uri %]"/>show all component parts</a></p>
                             [% END %]
                         </div>
                     </div>
index 0e647f7..eb3124a 100755 (executable)
@@ -661,7 +661,7 @@ my $max_items_to_display = C4::Context->preference('OpacMaxItemsToDisplay') // 5
 my $showcomp = C4::Context->preference('ShowComponentRecords');
 my $parts;
 if ( $showcomp eq 'both' || $showcomp eq 'opac' ) {
-    if ( my $components = $biblio->get_marc_components(300) ) {
+    if ( my $components = $biblio->get_marc_components(C4::Context->preference('MaxComponentRecords')) ) {
         for my $part ( @{$components} ) {
             $part = C4::Search::new_record_from_zebra( 'biblioserver', $part );