Bug 13726: Make Koha::Acq::Bookseller using Koha::Object
[koha.git] / catalogue / MARCdetail.pl
index ccf178e..09f9778 100755 (executable)
@@ -45,11 +45,12 @@ the items attached to the biblio
 
 use strict;
 #use warnings; FIXME - Bug 2505
+use CGI qw ( -utf8 );
+use HTML::Entities;
 
 use C4::Auth;
 use C4::Context;
 use C4::Output;
-use CGI qw ( -utf8 );
 use C4::Koha;
 use MARC::Record;
 use C4::Biblio;
@@ -58,12 +59,14 @@ use C4::Acquisition;
 use C4::Members; # to use GetMember
 use C4::Serials;    #uses getsubscriptionsfrombiblionumber GetSubscriptionsFromBiblionumber
 use C4::Search;                # enabled_staff_search_views
+use Koha::BiblioFrameworks;
 
 use List::MoreUtils qw( uniq );
 
 my $query        = new CGI;
 my $dbh          = C4::Context->dbh;
 my $biblionumber = $query->param('biblionumber');
+$biblionumber = HTML::Entities::encode($biblionumber);
 my $frameworkcode = $query->param('frameworkcode');
 $frameworkcode = GetFrameworkCode( $biblionumber ) unless ($frameworkcode);
 my $popup        =
@@ -113,21 +116,11 @@ my $itemcount = GetItemsCount($biblionumber);
 $template->param( count => $itemcount,
                                        bibliotitle => $biblio->{title}, );
 
-# Getting the list of all frameworks
-# get framework list
-my $frameworks = getframeworks;
-my @frameworkcodeloop;
-foreach my $thisframeworkcode ( keys %$frameworks ) {
-    my %row = (
-        value         => $thisframeworkcode,
-        frameworktext => $frameworks->{$thisframeworkcode}->{'frameworktext'},
-    );
-    if ($frameworkcode eq $thisframeworkcode){
-        $row{'selected'}= 1;
-        }
-    push @frameworkcodeloop, \%row;
-}
-$template->param( frameworkcodeloop => \@frameworkcodeloop, );
+my $frameworks = Koha::BiblioFrameworks->search( {}, { order_by => ['frameworktext'] } );
+$template->param(
+    frameworks    => $frameworks,
+    frameworkcode => $frameworkcode,
+);
 # fill arrays
 my @loop_data = ();