use C4::Items;
use C4::Koha;
use C4::Biblio;
+use C4::Circulation;
use XML::LibXML;
use XML::LibXSLT;
my $biblio = GetBiblioData($biblionumber);
my $frameworkcode = GetFrameworkCode($biblionumber);
my $tagslib = &GetMarcStructure(1,$frameworkcode);
- my @fields = $record->fields();
+ my @fields;
+ # FIXME: wish there was a better way to handle exceptions
+ eval {
+ @fields = $record->fields();
+ };
+ if ($@) { warn "PROBLEM WITH RECORD"; next; }
my $list_of_authvalues = getAuthorisedValues4MARCSubfields($frameworkcode);
for my $authvalue (@$list_of_authvalues) {
for my $field ( $record->field($authvalue->{tagfield}) ) {
}
sub XSLTParse4Display {
- my ($biblionumber,$type) = @_;
+ my ($biblionumber,$xslfile) = @_;
# grab the XML, run it through our stylesheet, push it out to the browser
my $record = transformMARCXML4XSLT($biblionumber);
my $itemsxml = buildKohaItemsNamespace($biblionumber);
my $xmlrecord = $record->as_xml();
$xmlrecord =~ s/\<\/record\>/$itemsxml\<\/record\>/;
- my $xslfile = C4::Context->config('opachtdocs')."/prog/en/xslt/MARC21slim2OPAC$type.xsl";
my $parser = XML::LibXML->new();
# don't die when you find &, >, etc
$parser->recover_silently(1);
my $xml;
for my $item (@items) {
my $status;
- if ( $item->{notforloan} == -1 || $item->{onloan} || $item->{wthdrawn} || $item->{itemlost} || $item->{damaged}) {
+ my ( $transfertwhen, $transfertfrom, $transfertto ) = C4::Circulation::GetTransfers($item->{itemnumber});
+ if ( $item->{notforloan} == -1 || $item->{onloan} || $item->{wthdrawn} || $item->{itemlost} || $item->{damaged} ||
+ ($transfertwhen ne '') || $item->{itemnotforloan} ) {
if ( $item->{notforloan} == -1) {
$status = "On order";
+ }
+ if ( $item->{itemnotforloan} ) {
+ $status = "Not for loan";
}
if ($item->{onloan}) {
- $status = "On loan";
+ $status = "Checked out";
}
if ( $item->{wthdrawn}) {
$status = "Withdrawn";
if ($item->{damaged}) {
$status = "Damaged";
}
+ if ($transfertwhen ne '') {
+ $status = 'In transit';
+ }
} else {
$status = "available";
}