From 9dbb19e726151a74b20d16fbe286b65ed1b1d3c5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc=20V=C3=A9ron?= <veron@veron.ch>
Date: Sat, 15 Feb 2014 16:19:04 +0100
Subject: [PATCH 1/1] Bug 11772 - Show warning on About page:System
 information if no active currency is defined
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This patch displays a warning on the About page when no active currency is defined.

Test plan:
1)
Make sure that no currency is defined as active
(Home › Administration › Currencies & Exchange rates › Currencies)
2)
Go to Home › About Koha > System information
Result: No warning issued.
3)
Applay patch and reload About page
Result: Warning issued.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
---
 about.pl                                         |    3 +++
 koha-tmpl/intranet-tmpl/prog/en/modules/about.tt |    7 +++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/about.pl b/about.pl
index 6b44ea8..ba77ca6 100755
--- a/about.pl
+++ b/about.pl
@@ -77,6 +77,8 @@ my $errZebraConnection = C4::Context->Zconn("biblioserver",0)->errcode();
 
 my $warnIsRootUser   = (! $loggedinuser);
 
+my $warnNoActiveCurrency = (! defined C4::Budgets->GetCurrency());
+
 $template->param(
     kohaVersion   => $kohaVersion,
     osVersion     => $osVersion,
@@ -93,6 +95,7 @@ $template->param(
     warnPrefAnonymousPatron => $warnPrefAnonymousPatron,
     errZebraConnection => $errZebraConnection,
     warnIsRootUser => $warnIsRootUser,
+    warnNoActiveCurrency => $warnNoActiveCurrency,
 );
 
 my @components = ();
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt
index 21db9d3..7662ce3 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt
@@ -104,9 +104,9 @@
             <p>Please log in instead with a regular staff account. To create a staff account, create a library, a patron category 'Staff' and add a new patron. Then give this patron permissions from 'More' in the toolbar.</p>
         [% END %]
             <h2>Warnings regarding the system configuration</h2>
-        [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatron %]
+        [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatron || warnNoActiveCurrency %]
         <table>
-            <caption>Preferences</caption>
+            <caption>Preferences and parameters</caption>
             [% IF (warnPrefBiblioAddsAuthorities) %]
             <tr><th scope="row"><b>Warning</b> </th><td>System preference 'AutoCreateAuthorities' set, but needs 'BiblioAddsAuthorities' set as well.</td></tr>
             [% END %]
@@ -116,6 +116,9 @@
             [% IF warnPrefAnonymousPatron %]
                 <tr><th scope="row"><b>Warning</b> </th><td>System preference 'OPACPrivacy' set, but AnonymousPatron preference is set to '0'. Set it to a valid borrower number if you want that this feature works correctly.</td></tr>
             [% END %]
+            [% IF warnNoActiveCurrency %]
+                <tr><th scope="row"><b>Warning</b> </th><td>No active currency is defined. Please go to Administration:Currencies & Exchange rates and mark one currency as active.</td></tr>
+            [% END %]
         </table>
         [% ELSE %]
             <p>No warnings</p>
-- 
1.7.10.4