Bug 13087: Add a notice for use_zebra_facets problems in about page
authorTomas Cohen Arazi <tomascohen@gmail.com>
Wed, 22 Oct 2014 18:56:29 +0000 (15:56 -0300)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Fri, 24 Oct 2014 12:42:48 +0000 (09:42 -0300)
This patch adds two checks to about.pl:

- use_zebra_facets entry presence in koha-conf.xml
- use_zebra_facets==1 and zebra_bib_index_mode==dom

The idea is to alert the user if it has conflicting or wrong settings. Even
if there's a fallback to a working configuration.

To test:
- On clean master install, go to the about page
=> SUCCESS: No warnings regarding use_zebra_facets
- Comment out the use_zebra_facets entry, reload
=> SUCCESS: The about page mentions the use_zebra_facets entry is missing
- Uncomment the use_zebra_facets entry, make sure it is set to 1
- Change zebra_bib_index_mode to 'grs1', reload
=> SUCCESS: The about page says zebra_bib_index_mode is not set to DOM even though
  you have use_zebra_facets set.
- Sign off :-D

Regards
To+

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Followed test plan with success

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, tested by changing the koha-conf.xml file.
Note: There is no warning if use_zebra_facets is 0.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

about.pl
koha-tmpl/intranet-tmpl/prog/en/modules/about.tt

index d144e37..339f4e2 100755 (executable)
--- a/about.pl
+++ b/about.pl
@@ -121,6 +121,19 @@ if ( C4::Context->preference( 'UseQueryParser' ) ) {
     }
 }
 
+# Test Zebra facets configuration
+if ( !defined C4::Context->config('use_zebra_facets') ) {
+    push @xml_config_warnings, { error => 'use_zebra_facets_entry_missing' };
+} else {
+    if ( C4::Context->config('use_zebra_facets') &&
+         C4::Context->config('zebra_bib_index_mode') ) {
+        # use_zebra_facets works with DOM
+        push @xml_config_warnings, {
+            error => 'use_zebra_facets_needs_dom'
+        } if C4::Context->config('zebra_bib_index_mode') ne 'dom' ;
+    }
+}
+
 $template->param(
     kohaVersion   => $kohaVersion,
     osVersion     => $osVersion,
index a5ce2f8..75a367d 100644 (file)
                         file. <strong>[% config_entry.file %]</strong> is used as a fallback.
                     </td>
                 </tr>
+                [% ELSIF config_entry.error == 'use_zebra_facets_entry_missing' %]
+                <tr>
+                    <th scope="row"><b>Warning</b></th>
+                    <td>The &lt;use_zebra_facets&gt; entry is missing in your configuration file. Falling back
+                        to legacy facet calculation.
+                    </td>
+                </tr>
+                [% ELSIF config_entry.error == 'use_zebra_facets_needs_dom' %]
+                <tr>
+                    <th scope="row"><b>Warning</b></th>
+                    <td>You have set &lt;use_zebra_facets&gt; but the &lt;zebra_bib_index_mode&gt; is not set to <strong>dom</strong>. Falling back
+                        to legacy facet calculation.
+                    </td>
+                </tr>
                 [% END %]
             [% END %]
             </table>