@@ -, +, @@
---
C4/Biblio.pm | 38 +++-----
C4/Suggestions.pm | 63 +++++------
acqui/duplicatesearch.pl | 88 ++++++++--------
.../prog/en/modules/acqui/duplicatesearch.tt | 112 ++++++++++----------
4 files changed, 141 insertions(+), 160 deletions(-)
--- a/C4/Biblio.pm
+++ a/C4/Biblio.pm
@@ -3717,37 +3717,25 @@ sub FindBiblios {
my %params = @_;
my $title = $params{title};
my $author = $params{author};
- my $isbn = $params{isbn};
+ my $isbn = $params{isbn};
my $query = "SELECT title, author, isbn, biblio.biblionumber FROM biblio LEFT JOIN biblioitems ON biblio.biblionumber = biblioitems.biblionumber";
- $query .= " WHERE 1 ";
+ $query .= " WHERE 1 ";
my @query_params = ();
-
- if ( defined $title ) {
- if ( $title eq ""){
- } else {
- $query .= " AND biblio.title LIKE ? ";
- $title =~ s/\s+/%/g;
- push @query_params, "%$title%";
- }
+ if ( defined $title and $title ne "" ) {
+ $query .= " AND biblio.title LIKE ? ";
+ $title =~ s/\s+/%/g;
+ push @query_params, "%$title%";
}
- if ( defined $author ) {
- if( $author eq ""){
-
- } else {
- $query .= " AND biblio.author LIKE ? ";
- push @query_params, "%$author%";
- }
+ if ( defined $author and $author ne "" ) {
+ $query .= " AND biblio.author LIKE ? ";
+ push @query_params, "%$author%";
}
- if ( defined $isbn) {
- if ( $isbn eq ""){
-
- } else {
- $query .= " AND biblioitems.isbn LIKE ? ";
- push @query_params, "%$isbn%";
- }
+ if ( defined $isbn and $isbn ne "" ) {
+ $query .= " AND biblioitems.isbn LIKE ? ";
+ push @query_params, "%$isbn%";
}
my $sth = $dbh->prepare($query);
@@ -3755,7 +3743,7 @@ sub FindBiblios {
my @bib_loop;
while (my $data=$sth->fetchrow_hashref){
push @bib_loop,$data;
- }
+ }
return \@bib_loop;
}
--- a/C4/Suggestions.pm
+++ a/C4/Suggestions.pm
@@ -461,44 +461,35 @@ sub FindSuggestions {
my $title = $params{title};
my $author = $params{author};
my $isbn = $params{isbn};
- my $querysug="SELECT title, author, isbn, STATUS, suggestionid FROM suggestions";
- $querysug .=" WHERE 1";
+ my $querysug = qq{
+ SELECT title, author, isbn, STATUS, suggestionid
+ FROM suggestions
+ WHERE 1
+ };
my @query_sug = ();
- if ( defined $title ) {
- if ( $title eq ""){
-
- } else {
- $querysug .= " AND suggestions.title LIKE ? ";
- $title =~ s/\s+/%/g;
- push @query_sug, "%$title%";
- }
- }
-
- if ( defined $author ) {
- if( $author eq ""){
-
- } else {
- $querysug .= " AND suggestions.author LIKE ? ";
- push @query_sug, "%$author%";
- }
- }
-
- if ( defined $isbn) {
- if ( $isbn eq ""){
-
- } else {
- $querysug .= " AND suggestions.isbn LIKE ? ";
- push @query_sug, "%$isbn%";
- }
- }
- my $sth = $dbh->prepare($querysug);
- $sth->execute( @query_sug );
- my @sugg_loop;
- while (my $data=$sth->fetchrow_hashref){
- push (@sugg_loop,$data);
- }
-
+ if ( defined $title and $title ne "" ) {
+ $querysug .= " AND suggestions.title LIKE ? ";
+ $title =~ s/\s+/%/g;
+ push @query_sug, "%$title%";
+ }
+
+ if ( defined $author and $author ne "" ) {
+ $querysug .= " AND suggestions.author LIKE ? ";
+ push @query_sug, "%$author%";
+ }
+
+ if ( defined $isbn and $isbn ne "" ) {
+ $querysug .= " AND suggestions.isbn LIKE ? ";
+ push @query_sug, "%$isbn%";
+ }
+ my $sth = $dbh->prepare($querysug);
+ $sth->execute( @query_sug );
+ my @sugg_loop;
+ while (my $data=$sth->fetchrow_hashref){
+ push (@sugg_loop,$data);
+ }
+
return \@sugg_loop;
}
--- a/acqui/duplicatesearch.pl
+++ a/acqui/duplicatesearch.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/perl
#script to duplicate search (Orders, suggestions, bibliographic records)
#written by amit.gupta@osslabs.biz 08/06/2012
@@ -30,22 +30,21 @@ This script is used to search duplicate orders, suggestions and catalog records
=cut
-use strict;
-use warnings;
-use CGI;
+use Modern::Perl;
+use CGI;
use C4::Auth; # get_template_and_user
-use C4::Output;
+use C4::Output;
use C4::Acquisition;
use C4::Suggestions;
use C4::Biblio;
use C4::Debug;
use C4::Search;
-my $input = new CGI;
-my $title = $input->param( 'title');
-my $author = $input->param('author');
-my $isbn = $input->param('isbn');
-my $op = $input->param('op');
+my $input = new CGI;
+my $title = $input->param('title');
+my $author = $input->param('author');
+my $isbn = $input->param('isbn');
+my $op = $input->param('op');
# getting the template
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
@@ -54,52 +53,55 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
query => $input,
type => "intranet",
authnotrequired => 0,
- flagsrequired => { acquisition => 'group_manage', acquisition => 'order_manage', acquisition => 'order_receive' },
- debug => 1,
+ flagsrequired => {
+ acquisition => 'group_manage',
+ acquisition => 'order_manage',
+ acquisition => 'order_receive'
+ },
+ debug => 1,
}
);
-
-if ($op eq "result"){
- my ( $order_loop, $total_qty, $total_price, $total_qtyreceived ) = GetHistory(
- title => $title,
- author => $author,
- isbn => $isbn,
- name => undef,
- from_placed_on => undef,
- to_placed_on => undef,
- basket => undef,
- booksellerinvoicenumber => undef,
- );
+if ( $op eq "result" ) {
+ my ( $order_loop, $total_qty, $total_price, $total_qtyreceived ) =
+ GetHistory(
+ title => $title,
+ author => $author,
+ isbn => $isbn,
+ name => undef,
+ from_placed_on => undef,
+ to_placed_on => undef,
+ basket => undef,
+ booksellerinvoicenumber => undef,
+ );
my $sugg_loop = FindSuggestions(
- title => $title,
- author => $author,
- isbn => $isbn,
- );
+ title => $title,
+ author => $author,
+ isbn => $isbn,
+ );
my $bib_loop = FindBiblios(
- title => $title,
- author => $author,
- isbn => $isbn
- );
-
+ title => $title,
+ author => $author,
+ isbn => $isbn
+ );
$template->param(
- result => 1,
- orders_loop => $order_loop,
- sugg_loop => $sugg_loop,
- bib_loop => $bib_loop,
- numresults_order => scalar(@$order_loop),
- numresults_sugg => scalar(@$sugg_loop),
- numresults_bib => scalar(@$bib_loop),
+ result => 1,
+ orders_loop => $order_loop,
+ sugg_loop => $sugg_loop,
+ bib_loop => $bib_loop,
+ numresults_order => scalar(@$order_loop),
+ numresults_sugg => scalar(@$sugg_loop),
+ numresults_bib => scalar(@$bib_loop),
);
}
$template->param(
- title => $title,
- author => $author,
- isbn => $isbn,
+ title => $title,
+ author => $author,
+ isbn => $isbn,
);
output_html_with_http_headers $input, $cookie, $template->output;
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/duplicatesearch.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/duplicatesearch.tt
@@ -14,7 +14,7 @@
@@ -23,14 +23,14 @@ $(function(){
[% INCLUDE 'acquisitions-search.inc' %]
-
+
Duplicate Search
- [% IF ( result ) %]
+ [% IF ( result ) %]