- $template->param(itemtype => $itemtype,
- description => $data->{'description'},
- loanlength => $data->{'loanlength'},
- renewalsallowed => $data->{'renewalsallowed'},
- rentalcharge => $data->{'rentalcharge'});
-;
+ # build list of images
+ my $imagedir_filesystem = getitemtypeimagedir();
+ my $imagedir_web = getitemtypeimagesrc();
+ opendir(DIR, $imagedir_filesystem)
+ or die "can't opendir ".$imagedir_filesystem.": ".$!;
+ my @imagelist;
+ while (my $line = readdir(DIR)) {
+ if ($line =~ /\.(gif|png)$/i) {
+ push(
+ @imagelist,
+ {
+ KohaImage => $line,
+ KohaImageSrc => $imagedir_web.'/'.$line,
+ checked => $line eq $data->{imageurl} ? 1 : 0,
+ }
+ );
+ }
+ }
+ closedir DIR;
+
+ my $remote_image = undef;
+ if (defined $data->{imageurl} and $data->{imageurl} =~ m/^http/) {
+ $remote_image = $data->{imageurl};
+ }
+
+ $template->param(
+ itemtype => $itemtype,
+ description => $data->{'description'},
+ renewalsallowed => $data->{'renewalsallowed'},
+ rentalcharge => sprintf("%.2f",$data->{'rentalcharge'}),
+ notforloan => $data->{'notforloan'},
+ imageurl => $data->{'imageurl'},
+ template => C4::Context->preference('template'),
+ IMAGESLOOP => \@imagelist,
+ remote_image => $remote_image,
+ );