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

(-)a/C4/Biblio.pm (+55 lines)
Lines 99-104 BEGIN { Link Here
99
      &CountBiblioInOrders
99
      &CountBiblioInOrders
100
      &GetSubscriptionsId
100
      &GetSubscriptionsId
101
      &GetHolds
101
      &GetHolds
102
      &FindBiblios
102
    );
103
    );
103
104
104
    # To modify something
105
    # To modify something
Lines 3795-3800 sub GetHolds { Link Here
3795
    return ($holds);
3796
    return ($holds);
3796
}
3797
}
3797
3798
3799
=head2 FindBiblios
3800
3801
Find biblios matching title, author, isbn and return a array containing details of matching biblios.
3802
3803
=cut
3804
3805
sub FindBiblios {
3806
    my $dbh    = C4::Context->dbh;
3807
    my %params = @_;
3808
    my $title = $params{title};
3809
    my $author = $params{author};
3810
    my $isbn   = $params{isbn};
3811
    my $query = "SELECT title, author, isbn, biblio.biblionumber FROM biblio LEFT JOIN biblioitems ON biblio.biblionumber = biblioitems.biblionumber";
3812
    $query .= " WHERE 1 ";
3813
    my @query_params  = ();
3814
3815
    if ( defined $title ) {
3816
        if ( $title eq ""){
3817
3818
        } else {
3819
            $query .= " AND  biblio.title LIKE ? ";
3820
            $title =~ s/\s+/%/g;
3821
            push @query_params, "%$title%";
3822
        }
3823
    }
3824
3825
    if ( defined $author ) {
3826
        if( $author eq ""){
3827
3828
        } else {
3829
            $query .= " AND biblio.author LIKE ? ";
3830
            push @query_params, "%$author%";
3831
        }
3832
    }
3833
3834
    if ( defined $isbn) {
3835
        if ( $isbn eq ""){
3836
3837
        } else {
3838
            $query .= " AND biblioitems.isbn LIKE ? ";
3839
            push @query_params, "%$isbn%";
3840
        }
3841
    }
3842
3843
    my $sth = $dbh->prepare($query);
3844
    $sth->execute( @query_params );
3845
    my @bib_loop;
3846
    while (my $data=$sth->fetchrow_hashref){
3847
        push @bib_loop,$data;
3848
    }
3849
3850
    return \@bib_loop;
3851
}
3852
3798
=head2 prepare_host_field
3853
=head2 prepare_host_field
3799
3854
3800
$marcfield = prepare_host_field( $hostbiblioitem, $marcflavour );
3855
$marcfield = prepare_host_field( $hostbiblioitem, $marcflavour );
(-)a/C4/Suggestions.pm (-15 / +69 lines)
Lines 34-54 use C4::Dates qw(format_date_in_iso); Link Here
34
use base qw(Exporter);
34
use base qw(Exporter);
35
35
36
our $VERSION = 3.07.00.049;
36
our $VERSION = 3.07.00.049;
37
our @EXPORT  = qw(
37
our @EXPORT  = qw<
38
  ConnectSuggestionAndBiblio
38
    ConnectSuggestionAndBiblio
39
  CountSuggestion
39
    CountSuggestion
40
  DelSuggestion
40
    DelSuggestion
41
  GetSuggestion
41
    GetSuggestion
42
  GetSuggestionByStatus
42
    GetSuggestionByStatus
43
  GetSuggestionFromBiblionumber
43
    GetSuggestionFromBiblionumber
44
  GetSuggestionInfoFromBiblionumber
44
    GetSuggestionInfoFromBiblionumber
45
  GetSuggestionInfo
45
    GetSuggestionInfo
46
  ModStatus
46
    ModStatus
47
  ModSuggestion
47
    ModSuggestion
48
  NewSuggestion
48
    NewSuggestion
49
  SearchSuggestion
49
    SearchSuggestion
50
  DelSuggestionsOlderThan
50
    DelSuggestionsOlderThan
51
);
51
    FindSuggestions
52
>;
52
53
53
=head1 NAME
54
=head1 NAME
54
55
Lines 472-477 sub ModSuggestion { Link Here
472
    return $status_update_table;
473
    return $status_update_table;
473
}
474
}
474
475
476
=head2 FindSuggestions
477
478
Find Suggestions matching title, author, isbn and return a array containing details of matching Suggestions.
479
480
=cut
481
482
sub FindSuggestions {
483
    my $dbh    = C4::Context->dbh;
484
    my %params = @_;
485
    my $title = $params{title};
486
    my $author = $params{author};
487
    my $isbn   = $params{isbn};
488
    my $querysug="SELECT title, author, isbn, STATUS, suggestionid FROM suggestions";
489
    $querysug .=" WHERE 1";
490
    my @query_sug  = ();
491
492
    if ( defined $title ) {
493
        if ( $title eq ""){
494
495
        } else {
496
            $querysug .= " AND  suggestions.title LIKE ? ";
497
            $title =~ s/\s+/%/g;
498
            push @query_sug, "%$title%";
499
        }
500
    }
501
502
    if ( defined $author ) {
503
        if( $author eq ""){
504
505
        } else {
506
            $querysug .= " AND suggestions.author LIKE ? ";
507
            push @query_sug, "%$author%";
508
        }
509
    }
510
511
    if ( defined $isbn) {
512
        if ( $isbn eq ""){
513
514
        } else {
515
            $querysug .= " AND suggestions.isbn LIKE ? ";
516
            push @query_sug, "%$isbn%";
517
        }
518
    }
519
    my $sth = $dbh->prepare($querysug);
520
    $sth->execute( @query_sug );
521
    my @sugg_loop;
522
    while (my $data=$sth->fetchrow_hashref){
523
        push (@sugg_loop,$data);
524
    }
525
526
    return \@sugg_loop;
527
}
528
475
=head2 ConnectSuggestionAndBiblio
529
=head2 ConnectSuggestionAndBiblio
476
530
477
&ConnectSuggestionAndBiblio($ordernumber,$biblionumber)
531
&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 5-10 Link Here
5
    [% IF ( CAN_user_acquisition_budget_manage ) %]
5
    [% IF ( CAN_user_acquisition_budget_manage ) %]
6
    <li><a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a></li>
6
    <li><a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a></li>
7
    <li><a href="/cgi-bin/koha/admin/aqbudgets.pl">Funds</a></li>
7
    <li><a href="/cgi-bin/koha/admin/aqbudgets.pl">Funds</a></li>
8
    <li><a href="/cgi-bin/koha/acqui/duplicatesearch.pl">Duplicate Search</a></li>
8
    [% END %]
9
    [% END %]
9
    [% IF ( CAN_user_parameters ) %]
10
    [% IF ( CAN_user_parameters ) %]
10
     <li><a href="/cgi-bin/koha/admin/currency.pl">Currencies</a></li>
11
     <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