Bug 11848: Move language detection function in C4::Languages
[koha_fer] / opac / opac-topissues.pl
index 95291d0..0afc692 100755 (executable)
@@ -59,10 +59,14 @@ my ($template, $borrowernumber, $cookie)
                                });
 my $dbh = C4::Context->dbh;
 # Displaying results
+my $do_it = $input->param('do_it') || 0; # as form been posted
 my $limit = $input->param('limit');
 $limit = 10 unless ($limit && $limit =~ /^\d+$/); # control user input for SQL query
 $limit = 100 if $limit > 100;
 my $branch = $input->param('branch') || '';
+if (!$do_it && C4::Context->userenv && C4::Context->userenv->{'branch'} ) {
+    $branch = C4::Context->userenv->{'branch'}; # select user branch by default
+}
 my $itemtype = $input->param('itemtype') || '';
 my $timeLimit = $input->param('timeLimit') || 3;
 my $advanced_search_types = C4::Context->preference('AdvancedSearchTypes');
@@ -77,8 +81,8 @@ if($advanced_search_types eq 'ccode'){
     $whereclause .= ' AND authorised_values.authorised_value='.$dbh->quote($itemtype) if $itemtype;
     $query = "SELECT datecreated, biblio.biblionumber, title,
                     author, sum( items.issues ) AS tot, biblioitems.itemtype,
-                    biblioitems.publishercode,biblioitems.publicationyear,
-                    authorised_values.lib as description
+                    biblioitems.publishercode, biblioitems.place, biblioitems.publicationyear, biblio.copyrightdate,
+                    authorised_values.lib as description, biblioitems.pages, biblioitems.size
                     FROM biblio
                     LEFT JOIN items USING (biblionumber)
                     LEFT JOIN biblioitems USING (biblionumber)
@@ -103,8 +107,8 @@ if($advanced_search_types eq 'ccode'){
     }
     $query = "SELECT datecreated, biblio.biblionumber, title,
                     author, sum( items.issues ) AS tot, biblioitems.itemtype,
-                    biblioitems.publishercode,biblioitems.publicationyear,
-                    itemtypes.description
+                    biblioitems.publishercode, biblioitems.place, biblioitems.publicationyear, biblio.copyrightdate,
+                    itemtypes.description, biblioitems.pages, biblioitems.size
                     FROM biblio
                     LEFT JOIN items USING (biblionumber)
                     LEFT JOIN biblioitems USING (biblionumber)
@@ -138,7 +142,7 @@ $template->param(do_it => 1,
                 results_loop => \@results,
                 );
 
-$template->param( branchloop => GetBranchesLoop(C4::Context->userenv?C4::Context->userenv->{'branch'}:''));
+$template->param( branchloop => GetBranchesLoop($branch));
 
 # the index parameter is different for item-level itemtypes
 my $itype_or_itemtype = (C4::Context->preference("item-level_itypes"))?'itype':'itemtype';