# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA 02111-1307 USA
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
=head1 NAME
=cut
use strict; # always use
+#use warnings; FIXME - Bug 2505
## STEP 1. Load things that are used in both search page and
# results page and decide which template to load, operations
## load Koha modules
use C4::Context;
use C4::Output;
-use C4::Auth;
+use C4::Auth qw(:DEFAULT get_session);
use C4::Search;
use C4::Languages qw(getAllLanguages);
use C4::Koha;
+use C4::VirtualShelves qw(GetRecentShelves);
use POSIX qw(ceil floor);
use C4::Branch; # GetBranches
my $branches = GetBranches();
my @branch_loop;
+# we need to know the borrower branch code to set a default branch
+my $borrowerbranchcode = C4::Context->userenv->{'branch'};
+
for my $branch_hash (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) {
- push @branch_loop, {value => "$branch_hash" , branchname => $branches->{$branch_hash}->{'branchname'}, };
+ # if independantbranches is activated, set the default branch to the borrower branch
+ my $selected = (C4::Context->preference("independantbranches") and ($borrowerbranchcode eq $branch_hash)) ? 1 : undef;
+ push @branch_loop, {value => "$branch_hash" , branchname => $branches->{$branch_hash}->{'branchname'}, selected => $selected};
}
my $categories = GetBranchCategories(undef,'searchdomain');
my $primary_servers_loop;# = displayPrimaryServers();
$template->param(outer_servers_loop => $primary_servers_loop,);
- my $secondary_servers_loop;# = displaySecondaryServers();
+ my $secondary_servers_loop;
$template->param(outer_sup_servers_loop => $secondary_servers_loop,);
# set the default sorting
$template->param( expanded_options => $cgi->param('expanded_options'));
}
+ $template->param(virtualshelves => C4::Context->preference("virtualshelves"));
+
output_html_with_http_headers $cgi, $cookie, $template->output;
exit;
}
my @results;
## I. BUILD THE QUERY
-( $error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type) = buildQuery(\@operators,\@operands,\@indexes,\@limits,\@sort_by,$scan);
+my $lang = C4::Output::getlanguagecookie($cgi);
+( $error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type) = buildQuery(\@operators,\@operands,\@indexes,\@limits,\@sort_by,$scan,$lang);
## parse the query_cgi string and put it into a form suitable for <input>s
my @query_inputs;
}
# VI. BUILD THE TEMPLATE
+
+# Build drop-down list for 'Add To:' menu...
+
+my $row_count = 10; # FIXME:This probably should be a syspref
+my ($pubshelves, $total) = GetRecentShelves(2, $row_count, undef);
+my ($barshelves, $total) = GetRecentShelves(1, $row_count, $borrowernumber);
+
+my @pubshelves = @{$pubshelves};
+my @barshelves = @{$barshelves};
+
+if (@pubshelves) {
+ $template->param( addpubshelves => scalar (@pubshelves));
+ $template->param( addpubshelvesloop => @pubshelves);
+}
+
+if (@barshelves) {
+ $template->param( addbarshelves => scalar (@barshelves));
+ $template->param( addbarshelvesloop => @barshelves);
+}
+
+
+
output_html_with_http_headers $cgi, $cookie, $template->output;