[Koha-cvs] CVS: koha/admin itemtypes.pl,1.7,1.8
Ambrose Li
acli at users.sourceforge.net
Wed Feb 5 05:20:17 CET 2003
Update of /cvsroot/koha/koha/admin
In directory sc8-pr-cvs1:/tmp/cvs-serv10750/admin
Modified Files:
itemtypes.pl
Log Message:
Make sure the total number of matching itemtypes is counted correctly;
counting categoryitems is unreliable (Bug 199)
Make a note near the begining that the file has 4-space tabs, and add
Local variables at the end for Emacs people
Index: itemtypes.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/itemtypes.pl,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** itemtypes.pl 4 Feb 2003 15:11:10 -0000 1.7
--- itemtypes.pl 5 Feb 2003 04:20:14 -0000 1.8
***************
*** 1,3 ****
--- 1,4 ----
#!/usr/bin/perl
+ # NOTE: 4-character tabs
#script to administer the categories table
***************
*** 136,148 ****
#start the page and read in includes
my $dbh = C4::Context->dbh;
! my $sth=$dbh->prepare("select count(*) as total from categoryitem where itemtype='$itemtype'");
! $sth->execute;
! my $total = $sth->fetchrow_hashref;
! $sth->finish;
! # FIXME - There's already a $sth in this scope.
! my $sth=$dbh->prepare("select itemtype,description,loanlength,renewalsallowed,rentalcharge from itemtypes where itemtype='$itemtype'");
! $sth->execute;
my $data=$sth->fetchrow_hashref;
$sth->finish;
$template->param(itemtype => $itemtype,
description => $data->{'description'},
--- 137,155 ----
#start the page and read in includes
my $dbh = C4::Context->dbh;
!
! # Check both categoryitem and biblioitems, see Bug 199
! my $total = 0;
! for my $table ('categoryitem', 'biblioitems') {
! my $sth=$dbh->prepare("select count(*) as total from $table where itemtype=?");
! $sth->execute($itemtype);
! $total += $sth->fetchrow_hashref->{total};
! $sth->finish;
! }
!
! my $sth=$dbh->prepare("select itemtype,description,loanlength,renewalsallowed,rentalcharge from itemtypes where itemtype=?");
! $sth->execute($itemtype);
my $data=$sth->fetchrow_hashref;
$sth->finish;
+
$template->param(itemtype => $itemtype,
description => $data->{'description'},
***************
*** 150,154 ****
renewalsallowed => $data->{'renewalsallowed'},
rentalcharge => $data->{'rentalcharge'},
! total => $total->{'total'});
# END $OP eq DELETE_CONFIRM
################## DELETE_CONFIRMED ##################################
--- 157,161 ----
renewalsallowed => $data->{'renewalsallowed'},
rentalcharge => $data->{'rentalcharge'},
! total => $total);
# END $OP eq DELETE_CONFIRM
################## DELETE_CONFIRMED ##################################
***************
*** 188,189 ****
--- 195,200 ----
} #---- END $OP eq DEFAULT
output_html_with_http_headers $input, $cookie, $template->output;
+
+ # Local Variables:
+ # tab-width: 4
+ # End:
More information about the Koha-cvs
mailing list