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

(-)a/C4/Biblio.pm (+55 lines)
Lines 97-102 BEGIN { Link Here
97
      &CountBiblioInOrders
97
      &CountBiblioInOrders
98
      &GetSubscriptionsId
98
      &GetSubscriptionsId
99
      &GetHolds
99
      &GetHolds
100
      &FindBiblios
100
    );
101
    );
101
102
102
    # To modify something
103
    # To modify something
Lines 3705-3710 sub GetHolds { Link Here
3705
    return ($holds);
3706
    return ($holds);
3706
}
3707
}
3707
3708
3709
=head2 FindBiblios
3710
3711
Find biblios matching title, author, isbn and return a array containing details of matching biblios.
3712
3713
=cut
3714
3715
sub FindBiblios {
3716
    my $dbh    = C4::Context->dbh;
3717
    my %params = @_;
3718
    my $title = $params{title};
3719
    my $author = $params{author};
3720
    my $isbn   = $params{isbn};
3721
    my $query = "SELECT title, author, isbn, biblio.biblionumber FROM biblio LEFT JOIN biblioitems ON biblio.biblionumber = biblioitems.biblionumber";
3722
    $query .= " WHERE 1 ";
3723
    my @query_params  = ();
3724
3725
    if ( defined $title ) {
3726
        if ( $title eq ""){
3727
3728
        } else {
3729
            $query .= " AND  biblio.title LIKE ? ";
3730
            $title =~ s/\s+/%/g;
3731
            push @query_params, "%$title%";
3732
        }
3733
    }
3734
3735
    if ( defined $author ) {
3736
        if( $author eq ""){
3737
3738
        } else {
3739
            $query .= " AND biblio.author LIKE ? ";
3740
            push @query_params, "%$author%";
3741
        }
3742
    }
3743
3744
    if ( defined $isbn) {
3745
        if ( $isbn eq ""){
3746
3747
        } else {
3748
            $query .= " AND biblioitems.isbn LIKE ? ";
3749
            push @query_params, "%$isbn%";
3750
        }
3751
    }
3752
3753
    my $sth = $dbh->prepare($query);
3754
    $sth->execute( @query_params );
3755
    my @bib_loop;
3756
    while (my $data=$sth->fetchrow_hashref){
3757
        push @bib_loop,$data;
3758
    }
3759
3760
    return \@bib_loop;
3761
}
3762
3708
=head2 prepare_host_field
3763
=head2 prepare_host_field
3709
3764
3710
$marcfield = prepare_host_field( $hostbiblioitem, $marcflavour );
3765
$marcfield = prepare_host_field( $hostbiblioitem, $marcflavour );
(-)a/C4/Suggestions.pm (+54 lines)
Lines 47-52 our @EXPORT = qw< Link Here
47
    NewSuggestion
47
    NewSuggestion
48
    SearchSuggestion
48
    SearchSuggestion
49
    DelSuggestionsOlderThan
49
    DelSuggestionsOlderThan
50
    FindSuggestions
50
>;
51
>;
51
52
52
=head1 NAME
53
=head1 NAME
Lines 448-453 sub ModSuggestion { Link Here
448
    return $status_update_table;
449
    return $status_update_table;
449
}
450
}
450
451
452
=head2 FindSuggestions
453
454
Find Suggestions matching title, author, isbn and return a array containing details of matching Suggestions.
455
456
=cut
457
458
sub FindSuggestions {
459
    my $dbh    = C4::Context->dbh;
460
    my %params = @_;
461
    my $title = $params{title};
462
    my $author = $params{author};
463
    my $isbn   = $params{isbn};
464
    my $querysug="SELECT title, author, isbn, STATUS, suggestionid FROM suggestions";
465
    $querysug .=" WHERE 1";
466
    my @query_sug  = ();
467
468
    if ( defined $title ) {
469
        if ( $title eq ""){
470
471
        } else {
472
            $querysug .= " AND  suggestions.title LIKE ? ";
473
            $title =~ s/\s+/%/g;
474
            push @query_sug, "%$title%";
475
        }
476
    }
477
478
    if ( defined $author ) {
479
        if( $author eq ""){
480
481
        } else {
482
            $querysug .= " AND suggestions.author LIKE ? ";
483
            push @query_sug, "%$author%";
484
        }
485
    }
486
487
    if ( defined $isbn) {
488
        if ( $isbn eq ""){
489
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;
503
}
504
451
=head2 ConnectSuggestionAndBiblio
505
=head2 ConnectSuggestionAndBiblio
452
506
453
&ConnectSuggestionAndBiblio($ordernumber,$biblionumber)
507
&ConnectSuggestionAndBiblio($ordernumber,$biblionumber)
(-)a/acqui/duplicatesearch.pl (+105 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
#script to duplicate search  (Orders, suggestions, bibliographic records)
4
#written by amit.gupta@osslabs.biz 08/06/2012
5
6
# Copyright 2012 Nucsoft Osslabs
7
#
8
# This file is part of Koha.
9
#
10
# Koha is free software; you can redistribute it and/or modify it under the
11
# terms of the GNU General Public License as published by the Free Software
12
# Foundation; either version 2 of the License, or (at your option) any later
13
# version.
14
#
15
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
16
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
17
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
18
#
19
# You should have received a copy of the GNU General Public License along
20
# with Koha; if not, write to the Free Software Foundation, Inc.,
21
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22
23
=head1 NAME
24
25
duplicatesearch.pl
26
27
=head1 DESCRIPTION
28
29
This script is used to search duplicate orders, suggestions and catalog records
30
31
=cut
32
33
use strict;
34
use warnings;
35
use CGI;
36
use C4::Auth;    # get_template_and_user
37
use C4::Output;
38
use C4::Acquisition;
39
use C4::Suggestions;
40
use C4::Biblio;
41
use C4::Debug;
42
use C4::Search;
43
44
my $input             = new CGI;
45
my $title             = $input->param( 'title');
46
my $author            = $input->param('author');
47
my $isbn              = $input->param('isbn');
48
my $op                = $input->param('op');
49
50
# getting the template
51
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
52
    {
53
        template_name   => "acqui/duplicatesearch.tmpl",
54
        query           => $input,
55
        type            => "intranet",
56
        authnotrequired => 0,
57
        flagsrequired   => { acquisition => 'group_manage', acquisition => 'order_manage', acquisition => 'order_receive' },
58
        debug           => 1,
59
    }
60
);
61
62
63
if ($op eq "result"){
64
    my ( $order_loop, $total_qty, $total_price, $total_qtyreceived ) = GetHistory(
65
            title => $title,
66
            author => $author,
67
            isbn   => $isbn,
68
            name => undef,
69
            from_placed_on => undef,
70
            to_placed_on => undef,
71
            basket => undef,
72
            booksellerinvoicenumber => undef,
73
        );
74
75
    my $sugg_loop = FindSuggestions(
76
            title => $title,
77
            author => $author,
78
            isbn   => $isbn,
79
        );
80
81
    my $bib_loop = FindBiblios(
82
            title => $title,
83
            author => $author,
84
            isbn   => $isbn
85
       );
86
87
88
    $template->param(
89
            result => 1,
90
            orders_loop => $order_loop,
91
            sugg_loop => $sugg_loop,
92
            bib_loop => $bib_loop,
93
            numresults_order  => scalar(@$order_loop),
94
            numresults_sugg  => scalar(@$sugg_loop),
95
            numresults_bib  => scalar(@$bib_loop),
96
    );
97
}
98
99
$template->param(
100
    title => $title,
101
    author => $author,
102
    isbn => $isbn,
103
);
104
105
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-menu.inc (+1 lines)
Lines 4-9 Link Here
4
    [% IF ( CAN_user_acquisition_budget_manage ) %]
4
    [% IF ( CAN_user_acquisition_budget_manage ) %]
5
    <li><a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a></li>
5
    <li><a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a></li>
6
    <li><a href="/cgi-bin/koha/admin/aqbudgets.pl">Funds</a></li>
6
    <li><a href="/cgi-bin/koha/admin/aqbudgets.pl">Funds</a></li>
7
    <li><a href="/cgi-bin/koha/acqui/duplicatesearch.pl">Duplicate Search</a></li>
7
    [% END %]
8
    [% END %]
8
    [% IF ( CAN_user_parameters ) %]
9
    [% IF ( CAN_user_parameters ) %]
9
     <li><a href="/cgi-bin/koha/admin/currency.pl">Currencies</a></li>
10
     <li><a href="/cgi-bin/koha/admin/currency.pl">Currencies</a></li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/duplicatesearch.tt (-1 / +145 lines)
Line 0 Link Here
0
- 
1
[% USE KohaDates %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Acquisitions &rsaquo; Duplicate Search</title>
4
[% INCLUDE 'doc-head-close.inc' %]
5
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
6
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.pager.js"></script>
7
<script type="text/javascript">//<![CDATA[
8
    $(document).ready(function(){
9
    $(".sorted").tablesorter({
10
        sortList: [[0,0]],
11
        headers: { 1: { sorter: false}}
12
    }).tablesorterPager({container: $(".pager"),positionFixed: false,size: 10});
13
});//]]>
14
</script>
15
<script type="text/javascript">//<![CDATA[
16
$(function(){
17
    $('#alerttabs > ul').tabs();
18
}); //]]>
19
</script>
20
</head>
21
<body id="acq_duplicatesearch" class="acq">
22
[% INCLUDE 'header.inc' %]
23
[% INCLUDE 'acquisitions-search.inc' %]
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>
26
    <div id="doc3" class="yui-t2">
27
    <div id="bd">
28
    <div id="yui-main">
29
    <div class="yui-b">
30
31
    <h1>Duplicate Search</h1>
32
    <div id="acq_duplicatesearch">
33
    [% IF ( result ) %]
34
        <div id="alerttabs" class="toptabs">
35
        <ul>
36
        <li><a href="#pagerordertable">Order ([% numresults_order %])</a></li>
37
        <li><a href="#pagersuggestiontable">Suggestion ([% numresults_sugg %])</a></li>
38
        <li><a href="#pagercatalogtable">Catalog ([% numresults_bib %])</a></li>
39
        </ul>
40
        <div id="pagerordertable">
41
        [% IF (numresults_order) %]
42
        [% INCLUDE 'table-pager.inc' perpage='10' %]
43
        <table id="ordertable" class="sorted">
44
        [% ELSE %]
45
        <table>
46
        [% END %]
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>
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>
65
        <div id="pagersuggestiontable">
66
        <h1>Suggestion Search Results</h1>
67
        [% IF (numresults_sugg) %]
68
        [% INCLUDE 'table-pager.inc' perpage='10' %]
69
        <table id="suggestiontable" class="sorted">
70
        [% ELSE %]
71
         <table>
72
        [% END %]
73
        <thead>
74
                <tr>
75
                <th>Title</th>
76
                <th>Author</th>
77
                <th>ISBN</th>
78
                <th>Status</th>
79
                </tr>
80
        </thead>
81
        [% FOREACH sugg_loo IN sugg_loop %]
82
                <tr>
83
                <td><a href ="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% sugg_loo.suggestionid %]&op=edit"/>[% sugg_loo.title %]</td>
84
                <td>[% sugg_loo.author %]</td>
85
                <td>[% sugg_loo.isbn %]</td>
86
                <td>[% sugg_loo.STATUS %]</td>
87
                </tr>
88
       [% END %]
89
       </table>
90
       </div>
91
       <div id="pagercatalogtable">
92
       <h1>Catalog Search Results</h1>
93
       [% IF (numresults_bib) %]
94
       [% INCLUDE 'table-pager.inc' perpage='10' %]
95
       <table id="catalogtable" class="sorted">
96
       [% ELSE %]
97
       <table>
98
       [% END %]
99
       <thead>
100
                <tr>
101
                <th>Title</th>
102
                <th>Author</th>
103
                <th>ISBN</th>
104
                </tr>
105
       </thead>
106
       [% FOREACH bib_loo IN bib_loop %]
107
                <tr>
108
                <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% bib_loo.biblionumber %]">[% bib_loo.title %]</td>
109
                <td>[% bib_loo.author %]</td>
110
                <td>[% bib_loo.isbn %]</td>
111
                </tr>
112
       [% END %]
113
       </table>
114
       </div>
115
       </div>
116
[% ELSE %]
117
       <p>No Result</p>
118
[% END %]
119
120
</div>
121
</div>
122
</div>
123
<div class="yui-b">
124
<form  name="form" action="/cgi-bin/koha/acqui/duplicatesearch.pl" method="post">
125
<input type="hidden" name="op" value="result" />
126
<fieldset class="brief">
127
<h4>Filter Results:</h4>
128
    <ol>
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>
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>
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>
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>
137
        <input type="hidden" name="q" id="isbn1" value="[% isbn %]" />
138
    </ol>
139
        <input type="submit" value="Search" /> <a href="/cgi-bin/koha/acqui/duplicatesearch.pl">Clear All</a>
140
    </fieldset>
141
</form>
142
[% INCLUDE 'acquisitions-menu.inc' %]
143
</div>
144
</div>
145
[% INCLUDE 'intranet-bottom.inc' %]

Return to bug 6813