A fix was submitted by Nahuel on 23 Nov 2009 and pushed, but
it combined messages for existing patrons and existing items.
This patch defines separate messages for the various cases and
corrects a typo in the original fix which left existing patrons
unreported.
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
$sthitems->execute( $branchcode, $branchcode );
$sthborrowers->execute( $branchcode );
my ($totalitems) = $sthitems->fetchrow_array;
$sthitems->execute( $branchcode, $branchcode );
$sthborrowers->execute( $branchcode );
my ($totalitems) = $sthitems->fetchrow_array;
- my ($totalborrowers) = $sthitems->fetchrow_array;
- if ($totalitems or $totalborrowers) {
+ my ($totalborrowers) = $sthborrowers->fetchrow_array;
+ if ($totalitems && !$totalborrowers) {
+ $template->param( else => 1 );
+ default("MESSAGE10", $template);
+ }
+ elsif (!$totalitems && $totalborrowers){
+ $template->param( else => 1 );
+ default("MESSAGE11", $template);
+ }
+ elsif ($totalitems && $totalborrowers){
$template->param( else => 1 );
default("MESSAGE7", $template);
}
$template->param( else => 1 );
default("MESSAGE7", $template);
}
<!-- TMPL_IF name="MESSAGE4" --><div class="dialog message">Library category added</div><!-- /TMPL_IF -->
<!-- TMPL_IF name="MESSAGE5" --><div class="dialog message">Library category modified</div><!-- /TMPL_IF -->
<!-- TMPL_IF name="MESSAGE6" --><div class="dialog message">Library category deleted</div><!-- /TMPL_IF -->
<!-- TMPL_IF name="MESSAGE4" --><div class="dialog message">Library category added</div><!-- /TMPL_IF -->
<!-- TMPL_IF name="MESSAGE5" --><div class="dialog message">Library category modified</div><!-- /TMPL_IF -->
<!-- TMPL_IF name="MESSAGE6" --><div class="dialog message">Library category deleted</div><!-- /TMPL_IF -->
- <!-- TMPL_IF name="MESSAGE7" --><div class="dialog message">Library cannot be deleted because there are patrons or items using that library</div><!-- /TMPL_IF -->
+ <!-- TMPL_IF name="MESSAGE7" --><div class="dialog message">Library cannot be deleted because there are patrons and items using that library</div><!-- /TMPL_IF -->
<!-- TMPL_IF name="MESSAGE8" --><div class="dialog message">Category cannot be deleted because there are libraries using that category</div><!-- /TMPL_IF -->
<!-- TMPL_IF name="MESSAGE9" --><div class="dialog message">Category cannot be added, categorycode already exists</div><!-- /TMPL_IF -->
<!-- TMPL_IF name="MESSAGE8" --><div class="dialog message">Category cannot be deleted because there are libraries using that category</div><!-- /TMPL_IF -->
<!-- TMPL_IF name="MESSAGE9" --><div class="dialog message">Category cannot be added, categorycode already exists</div><!-- /TMPL_IF -->
+ <!-- TMPL_IF name="MESSAGE10" --><div class="dialog message">Library cannot be deleted because there are items held by that library</div><!-- /TMPL_IF -->
+ <!-- TMPL_IF name="MESSAGE11" --><div class="dialog message">Library cannot be deleted because there are patrons registered at that library</div><!-- /TMPL_IF -->
<!-- TMPL_IF NAME="branches" -->
<table id="branchest">
<thead><tr>
<!-- TMPL_IF NAME="branches" -->
<table id="branchest">
<thead><tr>