[Koha-cvs] CVS: koha/C4 Shelf.pm,1.2,1.3
Steve Tonnesen
tonnesen at users.sourceforge.net
Thu Oct 24 06:12:12 CEST 2002
Update of /cvsroot/koha/koha/C4
In directory usw-pr-cvs1:/tmp/cvs-serv15561/C4
Modified Files:
Shelf.pm
Log Message:
Added a couple of tests.
Index: Shelf.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Shelf.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** Shelf.pm 23 Oct 2002 23:32:47 -0000 1.2
--- Shelf.pm 24 Oct 2002 04:12:10 -0000 1.3
***************
*** 248,251 ****
--- 248,268 ----
}
+
+ =head2 C<itemcounter()>
+
+ returns the number of items on the shelf
+
+ my $itemcount=$shelf->itemcounter();
+
+ =cut
+ sub itemcounter {
+ my $self=shift;
+ unless ($self->{ITEMCONTENTS}->{orderby}->{'natural'}) {
+ $self->loadcontents();
+ }
+ my @temparray=@{$self->{ITEMCONTENTS}->{orderby}->{'natural'}};
+ return $#temparray+1;
+ }
+
sub shelfcontents {
my $self=shift;
***************
*** 342,346 ****
$sti->execute($value, $self->{ID}, $attribute);
} else {
! my $sti=$dbh->prepare("inesrt into bookshelfattributes (bookshelfid, attribute, value) values (?, ?, ?)");
$sti->execute($self->{ID}, $attribute, $value);
}
--- 359,363 ----
$sti->execute($value, $self->{ID}, $attribute);
} else {
! my $sti=$dbh->prepare("insert into bookshelfattributes (bookshelfid, attribute, value) values (?, ?, ?)");
$sti->execute($self->{ID}, $attribute, $value);
}
***************
*** 409,412 ****
--- 426,430 ----
}
my $bookshelfid=$self->{ID};
+ ($orderby) || ($orderby='natural');
$self->{ITEMCONTENTS}->{orderby}->{$orderby}=$self->{CACHE}->get( "$bookshelfid\_ITEMCONTENTS_$orderby" );
$self->{BIBLIOITEMCONTENTS}->{orderby}->{$orderby}=$self->{CACHE}->get( "$bookshelfid\_BIBLIOITEMCONTENTS_$orderby" );
More information about the Koha-cvs
mailing list