-my $dbh = C4::Context->dbh;
-my $query="Select itemtype,description from itemtypes order by description";
-my $sth=$dbh->prepare($query);
-$sth->execute;
-my @itemtype;
-my %itemtypes;
-while (my ($value,$lib) = $sth->fetchrow_array) {
- push @itemtype, $value;
- $itemtypes{$value}=$lib;
+my $dbh = C4::Context->dbh;
+
+my $limit = $input->param('recentacqui');
+
+my @branches;
+my @select_branch;
+my %select_branches;
+my $branches = GetBranches();
+my @branchloop;
+foreach my $thisbranch ( keys %$branches ) {
+ my $selected = 1
+ if ( C4::Context->userenv
+ && ( $thisbranch eq C4::Context->userenv->{branch} ) );
+ my %row = (
+ value => $thisbranch,
+ selected => $selected,
+ branchname => $branches->{$thisbranch}->{'branchname'},
+ );
+ push @branchloop, \%row;
+}
+my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
+ {
+ template_name => "opac-main.tmpl",
+ type => "opac",
+ query => $input,
+ authnotrequired => 1,
+ flagsrequired => { borrow => 1 },
+ }
+);
+
+if($limit) {
+ my $recentacquiloop = GetRecentAcqui($limit);
+# warn Data::Dumper::Dumper($recentacquiloop);
+ $template->param(
+ recentacquiloop => $recentacquiloop,
+ );