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

(-)a/C4/Biblio.pm (-25 / +13 lines)
Lines 3717-3753 sub FindBiblios { Link Here
3717
    my %params = @_;
3717
    my %params = @_;
3718
    my $title = $params{title};
3718
    my $title = $params{title};
3719
    my $author = $params{author};
3719
    my $author = $params{author};
3720
    my $isbn   = $params{isbn};    
3720
    my $isbn   = $params{isbn};
3721
    my $query = "SELECT title, author, isbn, biblio.biblionumber FROM biblio LEFT JOIN biblioitems ON biblio.biblionumber = biblioitems.biblionumber";
3721
    my $query = "SELECT title, author, isbn, biblio.biblionumber FROM biblio LEFT JOIN biblioitems ON biblio.biblionumber = biblioitems.biblionumber";
3722
    $query .= " WHERE 1 ";                                                                                                                            
3722
    $query .= " WHERE 1 ";
3723
    my @query_params  = ();
3723
    my @query_params  = ();
3724
        
3725
    if ( defined $title ) {
3726
        if ( $title eq ""){
3727
3724
3728
        } else {
3725
    if ( defined $title and $title ne "" ) {
3729
            $query .= " AND  biblio.title LIKE ? ";                                                                                           
3726
        $query .= " AND  biblio.title LIKE ? ";
3730
            $title =~ s/\s+/%/g;                                                                                                              
3727
        $title =~ s/\s+/%/g;
3731
            push @query_params, "%$title%";                                                                                                   
3728
        push @query_params, "%$title%";
3732
        }                                                                                                                                     
3733
    }
3729
    }
3734
3730
3735
    if ( defined $author ) {
3731
    if ( defined $author and $author ne "" ) {
3736
        if( $author eq ""){
3732
        $query .= " AND biblio.author LIKE ? ";
3737
3733
        push @query_params, "%$author%";
3738
        } else {              
3739
            $query .= " AND biblio.author LIKE ? ";
3740
            push @query_params, "%$author%";
3741
        }
3742
    }
3734
    }
3743
3735
3744
    if ( defined $isbn) {
3736
    if ( defined $isbn and $isbn ne "" ) {
3745
        if ( $isbn eq ""){
3737
        $query .= " AND biblioitems.isbn LIKE ? ";
3746
3738
        push @query_params, "%$isbn%";
3747
        } else {
3748
            $query .= " AND biblioitems.isbn LIKE ? ";
3749
            push @query_params, "%$isbn%";
3750
        }
3751
    }
3739
    }
3752
3740
3753
    my $sth = $dbh->prepare($query);
3741
    my $sth = $dbh->prepare($query);
Lines 3755-3761 sub FindBiblios { Link Here
3755
    my @bib_loop;
3743
    my @bib_loop;
3756
    while (my $data=$sth->fetchrow_hashref){
3744
    while (my $data=$sth->fetchrow_hashref){
3757
        push @bib_loop,$data;
3745
        push @bib_loop,$data;
3758
    }                    
3746
    }
3759
3747
3760
    return \@bib_loop;
3748
    return \@bib_loop;
3761
}
3749
}
(-)a/C4/Suggestions.pm (-36 / +27 lines)
Lines 461-504 sub FindSuggestions { Link Here
461
    my $title = $params{title};
461
    my $title = $params{title};
462
    my $author = $params{author};
462
    my $author = $params{author};
463
    my $isbn   = $params{isbn};
463
    my $isbn   = $params{isbn};
464
    my $querysug="SELECT title, author, isbn, STATUS, suggestionid FROM suggestions";
464
    my $querysug = qq{
465
    $querysug .=" WHERE 1";                                                          
465
        SELECT title, author, isbn, STATUS, suggestionid
466
        FROM suggestions
467
        WHERE 1
468
    };
466
    my @query_sug  = ();
469
    my @query_sug  = ();
467
470
468
    if ( defined $title ) {
471
    if ( defined $title and $title ne "" ) {
469
        if ( $title eq ""){
472
        $querysug .= " AND  suggestions.title LIKE ? ";
470
473
        $title =~ s/\s+/%/g;
471
        } else {  
474
        push @query_sug, "%$title%";
472
            $querysug .= " AND  suggestions.title LIKE ? "; 
475
    }
473
            $title =~ s/\s+/%/g;                 
476
474
            push @query_sug, "%$title%";
477
    if ( defined $author and $author ne "" ) {
475
        }                                                                    
478
        $querysug .= " AND suggestions.author LIKE ? ";
476
    }                                                                        
479
        push @query_sug, "%$author%";
477
480
    }
478
    if ( defined $author ) { 
481
479
        if( $author eq ""){
482
    if ( defined $isbn and $isbn ne "" ) {
480
483
        $querysug .= " AND suggestions.isbn LIKE ? ";
481
        } else {
484
        push @query_sug, "%$isbn%";
482
            $querysug .= " AND suggestions.author LIKE ? ";                  
485
    }
483
            push @query_sug, "%$author%";                                    
486
    my $sth = $dbh->prepare($querysug);
484
        }                                                                    
487
    $sth->execute( @query_sug );
485
    }                                                                        
488
    my @sugg_loop;
486
489
    while (my $data=$sth->fetchrow_hashref){
487
    if ( defined $isbn) {
490
        push (@sugg_loop,$data);
488
        if ( $isbn eq ""){
491
    }
489
492
490
        } else {             
491
            $querysug .= " AND suggestions.isbn LIKE ? ";
492
            push @query_sug, "%$isbn%";                  
493
        }                                                
494
    }                                                    
495
    my $sth = $dbh->prepare($querysug);                          
496
    $sth->execute( @query_sug );                                 
497
    my @sugg_loop;                                               
498
    while (my $data=$sth->fetchrow_hashref){ 
499
        push (@sugg_loop,$data);                                 
500
    }                                                         
501
   
502
    return \@sugg_loop;
493
    return \@sugg_loop;
503
}
494
}
504
495
(-)a/acqui/duplicatesearch.pl (-43 / +45 lines)
Lines 1-4 Link Here
1
#!/usr/bin/perl                                                  
1
#!/usr/bin/perl
2
2
3
#script to duplicate search  (Orders, suggestions, bibliographic records)
3
#script to duplicate search  (Orders, suggestions, bibliographic records)
4
#written by amit.gupta@osslabs.biz 08/06/2012
4
#written by amit.gupta@osslabs.biz 08/06/2012
Lines 30-51 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;
34
use CGI;
35
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;
38
use C4::Acquisition;
37
use C4::Acquisition;
39
use C4::Suggestions;
38
use C4::Suggestions;
40
use C4::Biblio;
39
use C4::Biblio;
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 (-57 / +56 lines)
Lines 14-20 Link Here
14
</script>
14
</script>
15
<script type="text/javascript">//<![CDATA[
15
<script type="text/javascript">//<![CDATA[
16
$(function(){
16
$(function(){
17
    $('#alerttabs > ul').tabs();     
17
    $('#alerttabs > ul').tabs();
18
}); //]]>
18
}); //]]>
19
</script>
19
</script>
20
</head>
20
</head>
Lines 23-36 $(function(){ Link Here
23
[% INCLUDE 'acquisitions-search.inc' %]
23
[% INCLUDE 'acquisitions-search.inc' %]
24
24
25
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <a href="duplicatesearch.pl">Duplicate Search</a></div>
25
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <a href="duplicatesearch.pl">Duplicate Search</a></div>
26
    <div id="doc3" class="yui-t2">   
26
    <div id="doc3" class="yui-t2">
27
    <div id="bd">
27
    <div id="bd">
28
    <div id="yui-main">
28
    <div id="yui-main">
29
    <div class="yui-b">
29
    <div class="yui-b">
30
30
31
    <h1>Duplicate Search</h1>
31
    <h1>Duplicate Search</h1>
32
    <div id="acq_duplicatesearch">
32
    <div id="acq_duplicatesearch">
33
    [% IF ( result ) %]   
33
    [% IF ( result ) %]
34
        <div id="alerttabs" class="toptabs">
34
        <div id="alerttabs" class="toptabs">
35
        <ul>
35
        <ul>
36
        <li><a href="#pagerordertable">Order ([% numresults_order %])</a></li>
36
        <li><a href="#pagerordertable">Order ([% numresults_order %])</a></li>
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>                                                                                              
49
                <th>Basket Name</th>
50
                <th>Order Number</th>
51
                <th>Summary</th>
52
                <th>Vendor</th>
53
                </tr>                                                                                             
54
        </thead>
55
        [% FOREACH orders_loo IN orders_loop %]
56
                <tr>
48
                <tr>
57
                <td><a href="basket.pl?basketno=[% orders_loo.basketno %]">[% orders_loo.basketname %]</a></td>                                                                                                                                                                                    
49
                    <th>Basket Name</th>
58
                <td><a href="neworderempty.pl?ordernumber=[% orders_loo.ordernumber %]">[% orders_loo.ordernumber %]</a></td>
50
                    <th>Order Number</th>
59
                <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% orders_loo.biblionumber %]">[% orders_loo.title |html %]</a><br />[% orders_loo.author %]</td>
51
                    <th>Summary</th>
60
                <td><a href="/cgi-bin/koha/acqui/supplier.pl?supplierid=[% orders_loo.id %]">[% orders_loo.name %]</a></td>
52
                    <th>Vendor</th>
61
                </tr>
53
                </tr>
62
        [% END %]
54
            </thead>
63
        </table>
55
            [% FOREACH orders_loo IN orders_loop %]
56
                <tr>
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>
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>
61
                </tr>
62
            [% END %]
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