From 5e6e1da0f898ce2b6f3c0297370088b533fe2a63 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 10 Aug 2012 12:29:44 +0200 Subject: [PATCH] [SIGNED-OFF] Bug 6813: Followup: indentation + simplify conditions Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc Veron --- C4/Biblio.pm | 32 ++----- C4/Suggestions.pm | 39 +++----- acqui/duplicatesearch.pl | 80 ++++++++-------- .../prog/en/modules/acqui/duplicatesearch.tt | 98 ++++++++++---------- 4 files changed, 115 insertions(+), 134 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 45e01a7..73b5211 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -3722,32 +3722,20 @@ sub FindBiblios { $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); diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm index 8e83a0f..6fe7547 100644 --- a/C4/Suggestions.pm +++ b/C4/Suggestions.pm @@ -461,36 +461,27 @@ 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 $title and $title ne "" ) { + $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 $author and $author ne "" ) { + $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%"; - } + if ( defined $isbn and $isbn ne "" ) { + $querysug .= " AND suggestions.isbn LIKE ? "; + push @query_sug, "%$isbn%"; } my $sth = $dbh->prepare($querysug); $sth->execute( @query_sug ); diff --git a/acqui/duplicatesearch.pl b/acqui/duplicatesearch.pl index 2495c06..32c5763 100755 --- a/acqui/duplicatesearch.pl +++ b/acqui/duplicatesearch.pl @@ -30,8 +30,7 @@ This script is used to search duplicate orders, suggestions and catalog records =cut -use strict; -use warnings; +use Modern::Perl; use CGI; use C4::Auth; # get_template_and_user use C4::Output; @@ -41,11 +40,11 @@ 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, + title => $title, author => $author, - isbn => $isbn, + isbn => $isbn, ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/duplicatesearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/duplicatesearch.tt index 632e9c6..393d8f6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/duplicatesearch.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/duplicatesearch.tt @@ -38,77 +38,77 @@ $(function(){
  • Catalog ([% numresults_bib %])
  • - [% IF (numresults_order) %] - [% INCLUDE 'table-pager.inc' perpage='10' %] - - [% ELSE %] -
    - [% END %] - + [% IF (numresults_order) %] + [% INCLUDE 'table-pager.inc' perpage='10' %] +
    + [% ELSE %] +
    + [% END %] + - - - - + + + + - - [% FOREACH orders_loo IN orders_loop %] + + [% FOREACH orders_loo IN orders_loop %] - - - - + + + + - [% END %] -
    Basket NameOrder NumberSummaryVendorBasket NameOrder NumberSummaryVendor
    [% orders_loo.basketname %][% orders_loo.ordernumber %][% orders_loo.title |html %]
    [% orders_loo.author %]
    [% orders_loo.name %][% orders_loo.basketname %][% orders_loo.ordernumber %][% orders_loo.title |html %]
    [% orders_loo.author %]
    [% orders_loo.name %]
    + [% END %] +

    Suggestion Search Results

    [% IF (numresults_sugg) %] - [% INCLUDE 'table-pager.inc' perpage='10' %] - + [% INCLUDE 'table-pager.inc' perpage='10' %] +
    [% ELSE %] -
    +
    [% END %] - + - + [% FOREACH sugg_loo IN sugg_loop %] - - + + - + [% END %]
    Title Author ISBN Status
    [% sugg_loo.title %]
    [% sugg_loo.title %] [% sugg_loo.author %] [% sugg_loo.isbn %] [% sugg_loo.STATUS %]

    Catalog Search Results

    [% IF (numresults_bib) %] - [% INCLUDE 'table-pager.inc' perpage='10' %] - + [% INCLUDE 'table-pager.inc' perpage='10' %] +
    [% ELSE %] -
    +
    [% END %] - + - + [% FOREACH bib_loo IN bib_loop %] - - + + - + [% END %]
    Title Author ISBN
    [% bib_loo.title %]
    [% bib_loo.title %] [% bib_loo.author %] [% bib_loo.isbn %]
    @@ -122,20 +122,20 @@ $(function(){
    - -
    -

    Filter Results:

    -
      -
    1. -
    2. -
    3. -
    4. -
    5. -
    6. -
    7. -
    8. - -
    + +
    +

    Filter Results:

    +
      +
    1. +
    2. +
    3. +
    4. +
    5. +
    6. +
    7. +
    8. + +
    Clear All
    -- 1.7.2.5