# 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 cataloguing:addbooks.pl
query => $input,
type => "intranet",
authnotrequired => 0,
- flagsrequired => { editcatalogue => 1 },
+ flagsrequired => { editcatalogue => '*' },
debug => 1,
}
);
# get framework list
my $frameworks = getframeworks;
my @frameworkcodeloop;
-foreach my $thisframeworkcode ( keys %{$frameworks} ) {
+foreach my $thisframeworkcode ( sort { uc($frameworks->{$a}->{'frameworktext'}) cmp uc($frameworks->{$b}->{'frameworktext'}) } keys %{$frameworks} ) {
push @frameworkcodeloop, {
value => $thisframeworkcode,
frameworktext => $frameworks->{$thisframeworkcode}->{'frameworktext'},
# Searching the catalog.
if ($query) {
+ # build query
+ my @operands = $query;
+
+ my $QParser;
+ $QParser = C4::Context->queryparser if (C4::Context->preference('UseQueryParser'));
+ my $builtquery;
+ if ($QParser) {
+ $builtquery = $query;
+ } else {
+ my ( $builterror,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type);
+ ( $builterror,$builtquery,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type) = buildQuery(undef,\@operands);
+ }
+
# find results
- my ( $error, $marcresults, $total_hits ) = SimpleSearch($query, $results_per_page * ($page - 1), $results_per_page);
+ my ( $error, $marcresults, $total_hits ) = SimpleSearch($builtquery, $results_per_page * ($page - 1), $results_per_page);
if ( defined $error ) {
$template->param( error => $error );
# format output
# SimpleSearch() give the results per page we want, so 0 offet here
- my $total = scalar @$marcresults;
- my @newresults = searchResults( $query, $total, $results_per_page, 0, 0, @$marcresults );
+ my $total = @{$marcresults};
+ my @newresults = searchResults( 'intranet', $query, $total, $results_per_page, 0, 0, $marcresults );
+ foreach my $line (@newresults) {
+ if ( not exists $line->{'size'} ) { $line->{'size'} = "" }
+ }
$template->param(
total => $total_hits,
query => $query,
#check is on isbn legnth 13 for new isbn and 10 for old isbn
my ( $title, $isbn );
if ($query=~/\d/) {
- my $querylength = length $query;
+ my $clean_query = $query;
+ $clean_query =~ s/-//g; # remove hyphens
+ my $querylength = length $clean_query;
if ( $querylength == 13 || $querylength == 10 ) {
$isbn = $query;
}