Bugzilla – Attachment 12714 Details for
Bug 6813
Search for duplicates across orders, suggestions and catalog
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 6813: Acquistions duplicate search across orders, suggestions and catalog
Bug-6813-Acquistions-duplicate-search-across-order.patch (text/plain), 14.71 KB, created by
Kyle M Hall (khall)
on 2012-10-05 14:41:40 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 6813: Acquistions duplicate search across orders, suggestions and catalog
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2012-10-05 14:41:40 UTC
Size:
14.71 KB
patch
obsolete
>From af96ecf06101475d5095dd48116c7b2bd406ff85 Mon Sep 17 00:00:00 2001 >From: Amit Gupta <amit.gupta@osslabs.biz> >Date: Fri, 8 Jun 2012 16:45:19 +0530 >Subject: [PATCH] Bug 6813: Acquistions duplicate search across orders, suggestions and catalog >Content-Type: text/plain; charset="utf-8" > >To Test: >Create a an suggestion, order and catalog record for a certain title. Use the duplicate search tool available in the acquisitions menu (left navigation bar) to search and find the suggestion, order and catalog record matching the search term. > >Enter one or more of title, author and ISBN in the search criteria. > >Signed-off-by: Marc Veron <veron@veron.ch> >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/Biblio.pm | 55 ++++++++ > C4/Suggestions.pm | 54 +++++++ > acqui/duplicatesearch.pl | 105 ++++++++++++++ > .../prog/en/includes/acquisitions-menu.inc | 1 + > .../prog/en/modules/acqui/duplicatesearch.tt | 145 ++++++++++++++++++++ > 5 files changed, 360 insertions(+), 0 deletions(-) > create mode 100755 acqui/duplicatesearch.pl > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/acqui/duplicatesearch.tt > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 231baf3..d973384 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -98,6 +98,7 @@ BEGIN { > &CountBiblioInOrders > &GetSubscriptionsId > &GetHolds >+ &FindBiblios > ); > > # To modify something >@@ -3708,6 +3709,60 @@ sub GetHolds { > return ($holds); > } > >+=head2 FindBiblios >+ >+Find biblios matching title, author, isbn and return a array containing details of matching biblios. >+ >+=cut >+ >+sub FindBiblios { >+ my $dbh = C4::Context->dbh; >+ my %params = @_; >+ my $title = $params{title}; >+ my $author = $params{author}; >+ my $isbn = $params{isbn}; >+ my $query = "SELECT title, author, isbn, biblio.biblionumber FROM biblio LEFT JOIN biblioitems ON biblio.biblionumber = biblioitems.biblionumber"; >+ $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 $author ) { >+ if( $author eq ""){ >+ >+ } else { >+ $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%"; >+ } >+ } >+ >+ my $sth = $dbh->prepare($query); >+ $sth->execute( @query_params ); >+ my @bib_loop; >+ while (my $data=$sth->fetchrow_hashref){ >+ push @bib_loop,$data; >+ } >+ >+ return \@bib_loop; >+} >+ > =head2 prepare_host_field > > $marcfield = prepare_host_field( $hostbiblioitem, $marcflavour ); >diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm >index 0cb484a..8e83a0f 100644 >--- a/C4/Suggestions.pm >+++ b/C4/Suggestions.pm >@@ -47,6 +47,7 @@ our @EXPORT = qw< > NewSuggestion > SearchSuggestion > DelSuggestionsOlderThan >+ FindSuggestions > >; > > =head1 NAME >@@ -448,6 +449,59 @@ sub ModSuggestion { > return $status_update_table; > } > >+=head2 FindSuggestions >+ >+Find Suggestions matching title, author, isbn and return a array containing details of matching Suggestions. >+ >+=cut >+ >+sub FindSuggestions { >+ my $dbh = C4::Context->dbh; >+ my %params = @_; >+ 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 @query_sug = (); >+ >+ if ( defined $title ) { >+ if ( $title eq ""){ >+ >+ } else { >+ $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 $isbn) { >+ if ( $isbn eq ""){ >+ >+ } else { >+ $querysug .= " AND suggestions.isbn LIKE ? "; >+ push @query_sug, "%$isbn%"; >+ } >+ } >+ my $sth = $dbh->prepare($querysug); >+ $sth->execute( @query_sug ); >+ my @sugg_loop; >+ while (my $data=$sth->fetchrow_hashref){ >+ push (@sugg_loop,$data); >+ } >+ >+ return \@sugg_loop; >+} >+ > =head2 ConnectSuggestionAndBiblio > > &ConnectSuggestionAndBiblio($ordernumber,$biblionumber) >diff --git a/acqui/duplicatesearch.pl b/acqui/duplicatesearch.pl >new file mode 100755 >index 0000000..2495c06 >--- /dev/null >+++ b/acqui/duplicatesearch.pl >@@ -0,0 +1,105 @@ >+#!/usr/bin/perl >+ >+#script to duplicate search (Orders, suggestions, bibliographic records) >+#written by amit.gupta@osslabs.biz 08/06/2012 >+ >+# Copyright 2012 Nucsoft Osslabs >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 2 of the License, or (at your option) any later >+# version. >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+=head1 NAME >+ >+duplicatesearch.pl >+ >+=head1 DESCRIPTION >+ >+This script is used to search duplicate orders, suggestions and catalog records >+ >+=cut >+ >+use strict; >+use warnings; >+use CGI; >+use C4::Auth; # get_template_and_user >+use C4::Output; >+use C4::Acquisition; >+use C4::Suggestions; >+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'); >+ >+# getting the template >+my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >+ { >+ template_name => "acqui/duplicatesearch.tmpl", >+ query => $input, >+ type => "intranet", >+ authnotrequired => 0, >+ 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, >+ ); >+ >+ my $sugg_loop = FindSuggestions( >+ title => $title, >+ author => $author, >+ isbn => $isbn, >+ ); >+ >+ my $bib_loop = FindBiblios( >+ 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), >+ ); >+} >+ >+$template->param( >+ title => $title, >+ author => $author, >+ isbn => $isbn, >+); >+ >+output_html_with_http_headers $input, $cookie, $template->output; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-menu.inc >index 439118d..6ecb148 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-menu.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-menu.inc >@@ -5,6 +5,7 @@ > [% IF ( CAN_user_acquisition_budget_manage ) %] > <li><a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a></li> > <li><a href="/cgi-bin/koha/admin/aqbudgets.pl">Funds</a></li> >+ <li><a href="/cgi-bin/koha/acqui/duplicatesearch.pl">Duplicate Search</a></li> > [% END %] > [% IF ( CAN_user_parameters ) %] > <li><a href="/cgi-bin/koha/admin/currency.pl">Currencies</a></li> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/duplicatesearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/duplicatesearch.tt >new file mode 100644 >index 0000000..632e9c6 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/duplicatesearch.tt >@@ -0,0 +1,145 @@ >+[% USE KohaDates %] >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Koha › Acquisitions › Duplicate Search</title> >+[% INCLUDE 'doc-head-close.inc' %] >+<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script> >+<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.pager.js"></script> >+<script type="text/javascript">//<![CDATA[ >+ $(document).ready(function(){ >+ $(".sorted").tablesorter({ >+ sortList: [[0,0]], >+ headers: { 1: { sorter: false}} >+ }).tablesorterPager({container: $(".pager"),positionFixed: false,size: 10}); >+});//]]> >+</script> >+<script type="text/javascript">//<![CDATA[ >+$(function(){ >+ $('#alerttabs > ul').tabs(); >+}); //]]> >+</script> >+</head> >+<body id="acq_duplicatesearch" class="acq"> >+[% INCLUDE 'header.inc' %] >+[% INCLUDE 'acquisitions-search.inc' %] >+ >+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> › <a href="duplicatesearch.pl">Duplicate Search</a></div> >+ <div id="doc3" class="yui-t2"> >+ <div id="bd"> >+ <div id="yui-main"> >+ <div class="yui-b"> >+ >+ <h1>Duplicate Search</h1> >+ <div id="acq_duplicatesearch"> >+ [% IF ( result ) %] >+ <div id="alerttabs" class="toptabs"> >+ <ul> >+ <li><a href="#pagerordertable">Order ([% numresults_order %])</a></li> >+ <li><a href="#pagersuggestiontable">Suggestion ([% numresults_sugg %])</a></li> >+ <li><a href="#pagercatalogtable">Catalog ([% numresults_bib %])</a></li> >+ </ul> >+ <div id="pagerordertable"> >+ [% IF (numresults_order) %] >+ [% INCLUDE 'table-pager.inc' perpage='10' %] >+ <table id="ordertable" class="sorted"> >+ [% ELSE %] >+ <table> >+ [% END %] >+ <thead> >+ <tr> >+ <th>Basket Name</th> >+ <th>Order Number</th> >+ <th>Summary</th> >+ <th>Vendor</th> >+ </tr> >+ </thead> >+ [% FOREACH orders_loo IN orders_loop %] >+ <tr> >+ <td><a href="basket.pl?basketno=[% orders_loo.basketno %]">[% orders_loo.basketname %]</a></td> >+ <td><a href="neworderempty.pl?ordernumber=[% orders_loo.ordernumber %]">[% orders_loo.ordernumber %]</a></td> >+ <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% orders_loo.biblionumber %]">[% orders_loo.title |html %]</a><br />[% orders_loo.author %]</td> >+ <td><a href="/cgi-bin/koha/acqui/supplier.pl?supplierid=[% orders_loo.id %]">[% orders_loo.name %]</a></td> >+ </tr> >+ [% END %] >+ </table> >+ </div> >+ <div id="pagersuggestiontable"> >+ <h1>Suggestion Search Results</h1> >+ [% IF (numresults_sugg) %] >+ [% INCLUDE 'table-pager.inc' perpage='10' %] >+ <table id="suggestiontable" class="sorted"> >+ [% ELSE %] >+ <table> >+ [% END %] >+ <thead> >+ <tr> >+ <th>Title</th> >+ <th>Author</th> >+ <th>ISBN</th> >+ <th>Status</th> >+ </tr> >+ </thead> >+ [% FOREACH sugg_loo IN sugg_loop %] >+ <tr> >+ <td><a href ="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% sugg_loo.suggestionid %]&op=edit"/>[% sugg_loo.title %]</td> >+ <td>[% sugg_loo.author %]</td> >+ <td>[% sugg_loo.isbn %]</td> >+ <td>[% sugg_loo.STATUS %]</td> >+ </tr> >+ [% END %] >+ </table> >+ </div> >+ <div id="pagercatalogtable"> >+ <h1>Catalog Search Results</h1> >+ [% IF (numresults_bib) %] >+ [% INCLUDE 'table-pager.inc' perpage='10' %] >+ <table id="catalogtable" class="sorted"> >+ [% ELSE %] >+ <table> >+ [% END %] >+ <thead> >+ <tr> >+ <th>Title</th> >+ <th>Author</th> >+ <th>ISBN</th> >+ </tr> >+ </thead> >+ [% FOREACH bib_loo IN bib_loop %] >+ <tr> >+ <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% bib_loo.biblionumber %]">[% bib_loo.title %]</td> >+ <td>[% bib_loo.author %]</td> >+ <td>[% bib_loo.isbn %]</td> >+ </tr> >+ [% END %] >+ </table> >+ </div> >+ </div> >+[% ELSE %] >+ <p>No Result</p> >+[% END %] >+ >+</div> >+</div> >+</div> >+<div class="yui-b"> >+<form name="form" action="/cgi-bin/koha/acqui/duplicatesearch.pl" method="post"> >+<input type="hidden" name="op" value="result" /> >+<fieldset class="brief"> >+<h4>Filter Results:</h4> >+ <ol> >+ <li><label for="title">Title: </label> <input type="text" name="title" id="title" value="[% title %]" size="20" /></li> >+ <li><label for="author">Author: </label> <input type="text" name="author" id="author" value="[% author %]" size="20" /></li> >+ <li><label for="isbn">ISBN: </label> <input type="text" name="isbn" id="isbn" value="[% isbn %]" size="20" /></li> >+ <li><label for="title"></label><input type="hidden" name="idx" id="title" value="ti" /></li> >+ <li><input type="hidden" name="q" id="title1" value="[% title %]" /></li> >+ <li><label for="author"></label><input type="hidden" name="idx" id="author" value="au" /></li> >+ <li><input type="hidden" name="q" id="author1" value="[% author %]" /></li> >+ <li><label for="isbn"></label><input type="hidden" name="idx" id="isbn" value="nb" /></li> >+ <input type="hidden" name="q" id="isbn1" value="[% isbn %]" /> >+ </ol> >+ <input type="submit" value="Search" /> <a href="/cgi-bin/koha/acqui/duplicatesearch.pl">Clear All</a> >+ </fieldset> >+</form> >+[% INCLUDE 'acquisitions-menu.inc' %] >+</div> >+</div> >+[% INCLUDE 'intranet-bottom.inc' %] >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 6813
:
9982
|
11527
|
11531
|
11532
|
11533
|
11534
|
11537
|
11538
|
11539
|
11541
|
11542
|
12456
|
12714
|
12715
|
12716
|
13286
|
13806
|
14009
|
15793
|
15794
|
15795
|
15796