View | Details | Raw Unified | Return to bug 6813
Collapse All | Expand All

(-)a/C4/Biblio.pm (-22 / +10 lines)
Lines 3812-3843 sub FindBiblios { Link Here
3812
    $query .= " WHERE 1 ";
3812
    $query .= " WHERE 1 ";
3813
    my @query_params  = ();
3813
    my @query_params  = ();
3814
3814
3815
    if ( defined $title ) {
3815
    if ( defined $title and $title ne "" ) {
3816
        if ( $title eq ""){
3816
        $query .= " AND  biblio.title LIKE ? ";
3817
3817
        $title =~ s/\s+/%/g;
3818
        } else {
3818
        push @query_params, "%$title%";
3819
            $query .= " AND  biblio.title LIKE ? ";
3820
            $title =~ s/\s+/%/g;
3821
            push @query_params, "%$title%";
3822
        }
3823
    }
3819
    }
3824
3820
3825
    if ( defined $author ) {
3821
    if ( defined $author and $author ne "" ) {
3826
        if( $author eq ""){
3822
        $query .= " AND biblio.author LIKE ? ";
3827
3823
        push @query_params, "%$author%";
3828
        } else {
3829
            $query .= " AND biblio.author LIKE ? ";
3830
            push @query_params, "%$author%";
3831
        }
3832
    }
3824
    }
3833
3825
3834
    if ( defined $isbn) {
3826
    if ( defined $isbn and $isbn ne "" ) {
3835
        if ( $isbn eq ""){
3827
        $query .= " AND biblioitems.isbn LIKE ? ";
3836
3828
        push @query_params, "%$isbn%";
3837
        } else {
3838
            $query .= " AND biblioitems.isbn LIKE ? ";
3839
            push @query_params, "%$isbn%";
3840
        }
3841
    }
3829
    }
3842
3830
3843
    my $sth = $dbh->prepare($query);
3831
    my $sth = $dbh->prepare($query);
(-)a/C4/Suggestions.pm (-24 / +15 lines)
Lines 485-520 sub FindSuggestions { Link Here
485
    my $title = $params{title};
485
    my $title = $params{title};
486
    my $author = $params{author};
486
    my $author = $params{author};
487
    my $isbn   = $params{isbn};
487
    my $isbn   = $params{isbn};
488
    my $querysug="SELECT title, author, isbn, STATUS, suggestionid FROM suggestions";
488
    my $querysug = qq{
489
    $querysug .=" WHERE 1";
489
        SELECT title, author, isbn, STATUS, suggestionid
490
        FROM suggestions
491
        WHERE 1
492
    };
490
    my @query_sug  = ();
493
    my @query_sug  = ();
491
494
492
    if ( defined $title ) {
495
    if ( defined $title and $title ne "" ) {
493
        if ( $title eq ""){
496
        $querysug .= " AND  suggestions.title LIKE ? ";
494
497
        $title =~ s/\s+/%/g;
495
        } else {
498
        push @query_sug, "%$title%";
496
            $querysug .= " AND  suggestions.title LIKE ? ";
497
            $title =~ s/\s+/%/g;
498
            push @query_sug, "%$title%";
499
        }
500
    }
499
    }
501
500
502
    if ( defined $author ) {
501
    if ( defined $author and $author ne "" ) {
503
        if( $author eq ""){
502
        $querysug .= " AND suggestions.author LIKE ? ";
504
503
        push @query_sug, "%$author%";
505
        } else {
506
            $querysug .= " AND suggestions.author LIKE ? ";
507
            push @query_sug, "%$author%";
508
        }
509
    }
504
    }
510
505
511
    if ( defined $isbn) {
506
    if ( defined $isbn and $isbn ne "" ) {
512
        if ( $isbn eq ""){
507
        $querysug .= " AND suggestions.isbn LIKE ? ";
513
508
        push @query_sug, "%$isbn%";
514
        } else {
515
            $querysug .= " AND suggestions.isbn LIKE ? ";
516
            push @query_sug, "%$isbn%";
517
        }
518
    }
509
    }
519
    my $sth = $dbh->prepare($querysug);
510
    my $sth = $dbh->prepare($querysug);
520
    $sth->execute( @query_sug );
511
    $sth->execute( @query_sug );
(-)a/acqui/duplicatesearch.pl (-39 / +41 lines)
Lines 30-37 This script is used to search duplicate orders, suggestions and catalog records Link Here
30
30
31
=cut
31
=cut
32
32
33
use strict;
33
use Modern::Perl;
34
use warnings;
35
use CGI;
34
use CGI;
36
use C4::Auth;    # get_template_and_user
35
use C4::Auth;    # get_template_and_user
37
use C4::Output;
36
use C4::Output;
Lines 41-51 use C4::Biblio; Link Here
41
use C4::Debug;
40
use C4::Debug;
42
use C4::Search;
41
use C4::Search;
43
42
44
my $input             = new CGI;
43
my $input  = new CGI;
45
my $title             = $input->param( 'title');
44
my $title  = $input->param('title');
46
my $author            = $input->param('author');
45
my $author = $input->param('author');
47
my $isbn              = $input->param('isbn');
46
my $isbn   = $input->param('isbn');
48
my $op                = $input->param('op');
47
my $op     = $input->param('op');
49
48
50
# getting the template
49
# getting the template
51
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
50
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Lines 54-105 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
54
        query           => $input,
53
        query           => $input,
55
        type            => "intranet",
54
        type            => "intranet",
56
        authnotrequired => 0,
55
        authnotrequired => 0,
57
        flagsrequired   => { acquisition => 'group_manage', acquisition => 'order_manage', acquisition => 'order_receive' },
56
        flagsrequired   => {
58
        debug           => 1,
57
            acquisition => 'group_manage',
58
            acquisition => 'order_manage',
59
            acquisition => 'order_receive'
60
        },
61
        debug => 1,
59
    }
62
    }
60
);
63
);
61
64
62
65
if ( $op eq "result" ) {
63
if ($op eq "result"){
66
    my ( $order_loop, $total_qty, $total_price, $total_qtyreceived ) =
64
    my ( $order_loop, $total_qty, $total_price, $total_qtyreceived ) = GetHistory(
67
      GetHistory(
65
            title => $title,
68
        title                   => $title,
66
            author => $author,
69
        author                  => $author,
67
            isbn   => $isbn,
70
        isbn                    => $isbn,
68
            name => undef,
71
        name                    => undef,
69
            from_placed_on => undef,
72
        from_placed_on          => undef,
70
            to_placed_on => undef,
73
        to_placed_on            => undef,
71
            basket => undef,
74
        basket                  => undef,
72
            booksellerinvoicenumber => undef,
75
        booksellerinvoicenumber => undef,
73
        );
76
      );
74
77
75
    my $sugg_loop = FindSuggestions(
78
    my $sugg_loop = FindSuggestions(
76
            title => $title,
79
        title  => $title,
77
            author => $author,
80
        author => $author,
78
            isbn   => $isbn,
81
        isbn   => $isbn,
79
        );
82
    );
80
83
81
    my $bib_loop = FindBiblios(
84
    my $bib_loop = FindBiblios(
82
            title => $title,
85
        title  => $title,
83
            author => $author,
86
        author => $author,
84
            isbn   => $isbn
87
        isbn   => $isbn
85
       );
88
    );
86
87
89
88
    $template->param(
90
    $template->param(
89
            result => 1,
91
        result           => 1,
90
            orders_loop => $order_loop,
92
        orders_loop      => $order_loop,
91
            sugg_loop => $sugg_loop,
93
        sugg_loop        => $sugg_loop,
92
            bib_loop => $bib_loop,
94
        bib_loop         => $bib_loop,
93
            numresults_order  => scalar(@$order_loop),
95
        numresults_order => scalar(@$order_loop),
94
            numresults_sugg  => scalar(@$sugg_loop),
96
        numresults_sugg  => scalar(@$sugg_loop),
95
            numresults_bib  => scalar(@$bib_loop),
97
        numresults_bib   => scalar(@$bib_loop),
96
    );
98
    );
97
}
99
}
98
100
99
$template->param(
101
$template->param(
100
    title => $title,
102
    title  => $title,
101
    author => $author,
103
    author => $author,
102
    isbn => $isbn,
104
    isbn   => $isbn,
103
);
105
);
104
106
105
output_html_with_http_headers $input, $cookie, $template->output;
107
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/duplicatesearch.tt (-50 / +49 lines)
Lines 38-114 $(function(){ Link Here
38
        <li><a href="#pagercatalogtable">Catalog ([% numresults_bib %])</a></li>
38
        <li><a href="#pagercatalogtable">Catalog ([% numresults_bib %])</a></li>
39
        </ul>
39
        </ul>
40
        <div id="pagerordertable">
40
        <div id="pagerordertable">
41
        [% IF (numresults_order) %]
41
            [% IF (numresults_order) %]
42
        [% INCLUDE 'table-pager.inc' perpage='10' %]
42
                [% INCLUDE 'table-pager.inc' perpage='10' %]
43
        <table id="ordertable" class="sorted">
43
                <table id="ordertable" class="sorted">
44
        [% ELSE %]
44
            [% ELSE %]
45
        <table>
45
                <table>
46
        [% END %]
46
            [% END %]
47
        <thead>
47
            <thead>
48
                <tr>
48
                <tr>
49
                <th>Basket Name</th>
49
                    <th>Basket Name</th>
50
                <th>Order Number</th>
50
                    <th>Order Number</th>
51
                <th>Summary</th>
51
                    <th>Summary</th>
52
                <th>Vendor</th>
52
                    <th>Vendor</th>
53
                </tr>
53
                </tr>
54
        </thead>
54
            </thead>
55
        [% FOREACH orders_loo IN orders_loop %]
55
            [% FOREACH orders_loo IN orders_loop %]
56
                <tr>
56
                <tr>
57
                <td><a href="basket.pl?basketno=[% orders_loo.basketno %]">[% orders_loo.basketname %]</a></td>
57
                    <td><a href="basket.pl?basketno=[% orders_loo.basketno %]">[% orders_loo.basketname %]</a></td>
58
                <td><a href="neworderempty.pl?ordernumber=[% orders_loo.ordernumber %]">[% orders_loo.ordernumber %]</a></td>
58
                    <td><a href="neworderempty.pl?ordernumber=[% orders_loo.ordernumber %]">[% orders_loo.ordernumber %]</a></td>
59
                <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% orders_loo.biblionumber %]">[% orders_loo.title |html %]</a><br />[% orders_loo.author %]</td>
59
                    <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% orders_loo.biblionumber %]">[% orders_loo.title |html %]</a><br />[% orders_loo.author %]</td>
60
                <td><a href="/cgi-bin/koha/acqui/supplier.pl?supplierid=[% orders_loo.id %]">[% orders_loo.name %]</a></td>
60
                    <td><a href="/cgi-bin/koha/acqui/supplier.pl?supplierid=[% orders_loo.id %]">[% orders_loo.name %]</a></td>
61
                </tr>
61
                </tr>
62
        [% END %]
62
            [% END %]
63
        </table>
63
            </table>
64
        </div>
64
        </div>
65
        <div id="pagersuggestiontable">
65
        <div id="pagersuggestiontable">
66
        <h1>Suggestion Search Results</h1>
66
        <h1>Suggestion Search Results</h1>
67
        [% IF (numresults_sugg) %]
67
        [% IF (numresults_sugg) %]
68
        [% INCLUDE 'table-pager.inc' perpage='10' %]
68
            [% INCLUDE 'table-pager.inc' perpage='10' %]
69
        <table id="suggestiontable" class="sorted">
69
            <table id="suggestiontable" class="sorted">
70
        [% ELSE %]
70
        [% ELSE %]
71
         <table>
71
             <table>
72
        [% END %]
72
        [% END %]
73
        <thead>
73
        <thead>
74
                <tr>
74
            <tr>
75
                <th>Title</th>
75
                <th>Title</th>
76
                <th>Author</th>
76
                <th>Author</th>
77
                <th>ISBN</th>
77
                <th>ISBN</th>
78
                <th>Status</th>
78
                <th>Status</th>
79
                </tr>
79
            </tr>
80
        </thead>
80
        </thead>
81
        [% FOREACH sugg_loo IN sugg_loop %]
81
        [% FOREACH sugg_loo IN sugg_loop %]
82
                <tr>
82
            <tr>
83
                <td><a href ="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% sugg_loo.suggestionid %]&op=edit"/>[% sugg_loo.title %]</td>
83
                <td><a href ="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% sugg_loo.suggestionid %]&op=edit"/>[% sugg_loo.title %]</a></td>
84
                <td>[% sugg_loo.author %]</td>
84
                <td>[% sugg_loo.author %]</td>
85
                <td>[% sugg_loo.isbn %]</td>
85
                <td>[% sugg_loo.isbn %]</td>
86
                <td>[% sugg_loo.STATUS %]</td>
86
                <td>[% sugg_loo.STATUS %]</td>
87
                </tr>
87
            </tr>
88
       [% END %]
88
       [% END %]
89
       </table>
89
       </table>
90
       </div>
90
       </div>
91
       <div id="pagercatalogtable">
91
       <div id="pagercatalogtable">
92
       <h1>Catalog Search Results</h1>
92
       <h1>Catalog Search Results</h1>
93
       [% IF (numresults_bib) %]
93
       [% IF (numresults_bib) %]
94
       [% INCLUDE 'table-pager.inc' perpage='10' %]
94
           [% INCLUDE 'table-pager.inc' perpage='10' %]
95
       <table id="catalogtable" class="sorted">
95
           <table id="catalogtable" class="sorted">
96
       [% ELSE %]
96
       [% ELSE %]
97
       <table>
97
           <table>
98
       [% END %]
98
       [% END %]
99
       <thead>
99
       <thead>
100
                <tr>
100
            <tr>
101
                <th>Title</th>
101
                <th>Title</th>
102
                <th>Author</th>
102
                <th>Author</th>
103
                <th>ISBN</th>
103
                <th>ISBN</th>
104
                </tr>
104
            </tr>
105
       </thead>
105
       </thead>
106
       [% FOREACH bib_loo IN bib_loop %]
106
       [% FOREACH bib_loo IN bib_loop %]
107
                <tr>
107
            <tr>
108
                <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% bib_loo.biblionumber %]">[% bib_loo.title %]</td>
108
                <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% bib_loo.biblionumber %]">[% bib_loo.title %]</a></td>
109
                <td>[% bib_loo.author %]</td>
109
                <td>[% bib_loo.author %]</td>
110
                <td>[% bib_loo.isbn %]</td>
110
                <td>[% bib_loo.isbn %]</td>
111
                </tr>
111
            </tr>
112
       [% END %]
112
       [% END %]
113
       </table>
113
       </table>
114
       </div>
114
       </div>
Lines 122-141 $(function(){ Link Here
122
</div>
122
</div>
123
<div class="yui-b">
123
<div class="yui-b">
124
<form  name="form" action="/cgi-bin/koha/acqui/duplicatesearch.pl" method="post">
124
<form  name="form" action="/cgi-bin/koha/acqui/duplicatesearch.pl" method="post">
125
<input type="hidden" name="op" value="result" />
125
    <input type="hidden" name="op" value="result" />
126
<fieldset class="brief">
126
    <fieldset class="brief">
127
<h4>Filter Results:</h4>
127
        <h4>Filter Results:</h4>
128
    <ol>
128
        <ol>
129
        <li><label for="title">Title: </label> <input type="text" name="title" id="title" value="[% title %]"  size="20" /></li>
129
            <li><label for="title">Title: </label> <input type="text" name="title" id="title" value="[% title %]"  size="20" /></li>
130
        <li><label for="author">Author: </label> <input type="text" name="author" id="author" value="[% author %]"  size="20" /></li>
130
            <li><label for="author">Author: </label> <input type="text" name="author" id="author" value="[% author %]"  size="20" /></li>
131
        <li><label for="isbn">ISBN: </label> <input type="text" name="isbn" id="isbn" value="[% isbn %]"  size="20" /></li>
131
            <li><label for="isbn">ISBN: </label> <input type="text" name="isbn" id="isbn" value="[% isbn %]"  size="20" /></li>
132
        <li><label for="title"></label><input type="hidden" name="idx" id="title" value="ti" /></li>
132
            <li><label for="title"></label><input type="hidden" name="idx" id="title" value="ti" /></li>
133
        <li><input type="hidden" name="q" id="title1" value="[% title %]" /></li>
133
            <li><input type="hidden" name="q" id="title1" value="[% title %]" /></li>
134
        <li><label for="author"></label><input type="hidden" name="idx" id="author" value="au" /></li>
134
            <li><label for="author"></label><input type="hidden" name="idx" id="author" value="au" /></li>
135
        <li><input type="hidden" name="q" id="author1" value="[% author %]" /></li>
135
            <li><input type="hidden" name="q" id="author1" value="[% author %]" /></li>
136
        <li><label for="isbn"></label><input type="hidden" name="idx" id="isbn" value="nb" /></li>
136
            <li><label for="isbn"></label><input type="hidden" name="idx" id="isbn" value="nb" /></li>
137
        <input type="hidden" name="q" id="isbn1" value="[% isbn %]" />
137
            <input type="hidden" name="q" id="isbn1" value="[% isbn %]" />
138
    </ol>
138
        </ol>
139
        <input type="submit" value="Search" /> <a href="/cgi-bin/koha/acqui/duplicatesearch.pl">Clear All</a>
139
        <input type="submit" value="Search" /> <a href="/cgi-bin/koha/acqui/duplicatesearch.pl">Clear All</a>
140
    </fieldset>
140
    </fieldset>
141
</form>
141
</form>
142
- 

Return to bug 6813