Fix for Bug 3970, Warn user when there is no active currency
authorOwen Leonard <oleonard@myacpl.org>
Fri, 29 Jan 2010 15:52:05 +0000 (10:52 -0500)
committerGalen Charlton <gmcharlt@gmail.com>
Tue, 2 Feb 2010 23:43:09 +0000 (18:43 -0500)
- Adds warning to budget admin pages
- Adds warning to currency admin page

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
admin/currency.pl
koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tmpl
koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tmpl
koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tmpl
koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tmpl

index cb869e2..43e08ae 100755 (executable)
@@ -164,8 +164,10 @@ if ($op eq 'add_form') {
     my $results = StringSearch($searchfield);
     my $count = scalar(@$results);
     my @loop;
+    my $activecurrency;
     for (my $i=$offset; $i < ($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){
-        warn Data::Dumper::Dumper($results->[$i]);
+        # warn Data::Dumper::Dumper($results->[$i]);
+        if($results->[$i]{'active'} == 1){ $activecurrency = 1; }
         push @loop, {
             currency  => $results->[$i]{'currency'},
             rate      => $results->[$i]{'rate'},
@@ -174,7 +176,10 @@ if ($op eq 'add_form') {
             active    => $results->[$i]{'active'},
         };
     }
-    $template->param(loop => \@loop);
+    $template->param(
+        loop => \@loop,
+        activecurrency => $activecurrency,
+    );
 
     if ($offset>0) {
         $template->param(offsetgtzero => 1,
index 41af729..c283dfc 100644 (file)
 <!--  DEFAULT  display budget periods list -->
 <!-- TMPL_IF name="else" -->
     <h2>Root budgets administration</h2>
-    <p><!-- TMPL_IF name="cur" --><b>Currency = <!-- TMPL_VAR name="cur" --></b><!-- /TMPL_IF --></p>
+    <!-- TMPL_IF name="cur" --><p><b>Currency = <!-- TMPL_VAR name="cur" --></b></p><!-- TMPL_ELSE --><div class="dialog alert"><h3>No active currency is defined</h3><p>Please <a href="/cgi-bin/koha/admin/currency.pl">specify an active currency</a>.</p></div><!-- /TMPL_IF -->
     <table id="periodsh">
     <thead>
            <tr>
index de3d738..96b79a2 100644 (file)
@@ -96,7 +96,7 @@
     $(document).ready(function() {
         var tooltipcontent = $(".tooltipcontent");
         tooltipcontent.hide();
-        
+
         $(".tooltiped td").each(function (){
             contentelem = $(this).parent().children().filter(".tooltipcontent");
             if(contentelem.html() != ""){
                 content: contentelem.html(),
                 show: "mouseover",
                 hide: "mouseout",
-                style: { 
+                style: {
                     name: "light",
                     tip: "bottomLeft",
                     border: {
 <!-- TMPL_INCLUDE NAME="header.inc" -->
 <!-- TMPL_INCLUDE NAME="budgets-admin-search.inc" -->
 
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; 
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
     <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Root budgets</a> &rsaquo; <!-- TMPL_IF NAME="else" -->Budgets for '<!-- TMPL_VAR name="budget_period_description" -->'<!-- /TMPL_IF --><!-- TMPL_IF name="add_form" -->
     <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=<!-- TMPL_VAR NAME="budget_period_id" -->">Budgets</a> &rsaquo; <!-- TMPL_IF NAME="budget_id" -->Modify budget<!-- TMPL_IF NAME="budget_name" --> '<!-- TMPL_VAR NAME="budget_name" -->'<!-- /TMPL_IF --><!-- TMPL_ELSE -->Add budget<!-- /TMPL_IF --><!-- /TMPL_IF -->  <!-- TMPL_IF name="delete_confirm" -->
     <a href="/cgi-bin/koha/admin/aqbudgets.pl">Budgets</a> &rsaquo; Delete budget?<!-- /TMPL_IF --></div>
 <!-- TMPL_UNLESS name="delete_confirm" --><!-- TMPL_INCLUDE NAME="budgets-admin-toolbar.inc" --><!-- /TMPL_UNLESS -->
 <!-- TMPL_IF name="else" -->
 
+<!-- TMPL_UNLESS NAME="cur" --><div class="dialog alert"><h3>No active currency is defined</h3><p>Please <a href="/cgi-bin/koha/admin/currency.pl">specify an active currency</a>.</p></div><!-- /TMPL_UNLESS -->
+
 <h1>Budgets for '<!-- TMPL_VAR name="budget_period_description" -->'</h1>
 <table id="budgeth">
     <thead>
index 4e2702e..2823518 100644 (file)
@@ -155,7 +155,7 @@ Budget planning
 
     <!-- TMPL_IF NAME="budget_lines" -->
 
-    <!-- TMPL_IF name="cur" --><p><b>Currency = <!-- TMPL_VAR name="cur" --> <!-- TMPL_VAR NAME="cur_format" --></b></p><!-- /TMPL_IF -->
+    <!-- TMPL_IF name="cur" --><p><b>Currency = <!-- TMPL_VAR name="cur" --></b></p><!-- TMPL_ELSE --><div class="dialog alert"><h3>No active currency is defined</h3><p>Please <a href="/cgi-bin/koha/admin/currency.pl">specify an active currency</a>.</p></div><!-- /TMPL_IF -->
 
     <table id="plan" width="100%">
     <thead>
index 980fbd5..a75b675 100644 (file)
 <!-- TMPL_IF NAME="else" -->
 
 <h2>Currencies and Exchange Rates</h2>
+
+<!-- TMPL_IF NAME="loop" --><!-- TMPL_UNLESS NAME="activecurrency" --><div class="dialog alert"><h3>No active currency is defined</h3><p>Please edit one currency and mark it as active.</p></div><!-- /TMPL_UNLESS --><!-- /TMPL_IF -->
+
+
     <!-- TMPL_IF NAME="searchfield" -->
         You searched for <!-- TMPL_VAR NAME="searchfield" --></span>
     <!-- /TMPL_IF -->