-if ($op eq 'add_form') {
- #start the page and read in includes
- #---- if primkey exists, it's a modify action, so read values to modify...
- my $data;
- if ($itemtype) {
- my $dbh = C4::Context->dbh;
- my $sth=$dbh->prepare("select * from itemtypes where itemtype=?");
- $sth->execute($itemtype);
- $data=$sth->fetchrow_hashref;
- $sth->finish;
- }
- # build list of images
- my $imagedir_filesystem = getitemtypeimagedir();
- my $imagedir_web = getitemtypeimagesrc();
- opendir(DIR, $imagedir_filesystem)
- or warn "can't opendir ".$imagedir_filesystem.": ".$!;
- my @imagelist;
- my $i=0;
- my $image_per_line=12;
- while (my $line = readdir(DIR)) {
- $i++;
- if ($line =~ /\.(gif|png)$/i) {
- if($i==$image_per_line){
- $i=0;
- push @imagelist,{KohaImage => '',KohaImageSrc => ''};
- }
- else{
- push( @imagelist,
- {
- KohaImage => $line,
- KohaImageSrc => $imagedir_web.'/'.$line,
- checked => $line eq $data->{imageurl} ? 1 : 0,
- }
- );
- }
- }
- }
- closedir DIR;
+if ( $op eq 'add_form' ) {
+ #---- if primkey exists, it's a modify action, so read values to modify...
+ my $data;
+ if ($itemtype) {
+ my $sth = $dbh->prepare("select * from itemtypes where itemtype=?");
+ $sth->execute($itemtype);
+ $data = $sth->fetchrow_hashref;
+ }
+
+ my $imagesets = C4::Koha::getImageSets( checked => $data->{'imageurl'} );