[Koha-cvs] koha acqui/newordersuggestion.pl koha-tmpl/intr... [rel_3_0]

Antoine Farnault antoine at koha-fr.org
Fri Dec 1 10:35:39 CET 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_3_0
Changes by:	Antoine Farnault <toins>	06/12/01 09:35:39

Modified files:
	acqui          : newordersuggestion.pl 
	koha-tmpl/intranet-tmpl/prog/en/acqui: newordersuggestion.tmpl 

Log message:
	removing catalogsearch from newordersuggestion.pl.
	It's now (re-)possible to add an order from a suggestion.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/acqui/newordersuggestion.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.3.2.3&r2=1.3.2.4
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/acqui/newordersuggestion.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1&r2=1.1.2.1

Patches:
Index: acqui/newordersuggestion.pl
===================================================================
RCS file: /sources/koha/koha/acqui/newordersuggestion.pl,v
retrieving revision 1.3.2.3
retrieving revision 1.3.2.4
diff -u -b -r1.3.2.3 -r1.3.2.4
--- acqui/newordersuggestion.pl	30 Nov 2006 18:23:50 -0000	1.3.2.3
+++ acqui/newordersuggestion.pl	1 Dec 2006 09:35:38 -0000	1.3.2.4
@@ -15,61 +15,74 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id: newordersuggestion.pl,v 1.3.2.3 2006/11/30 18:23:50 toins Exp $
+# $Id: newordersuggestion.pl,v 1.3.2.4 2006/12/01 09:35:38 toins Exp $
 
 =head1 NAME
+
 newordersuggestion.pl
 
 =head1 DESCRIPTION
+
 this script allow to add an order from a existing suggestion.
+The suggestion must have 'ACCEPTED' as status.
 
 =head1 CGI PARAMETERS
 
 =over 4
 
 =item basketno
-the number of this basket.
+
+    the number of this basket.
 
 =item booksellerid
-the bookseller who sells this record.
+
+    the bookseller who sells this record.
 
 =item title
-the title of this record suggested.
+
+    to filter on title when searching among ACCEPTED suggestion.
 
 =item author
-the author of this suggestion.
+
+    to filter on author when searching among ACCEPTED suggestion.
 
 =item note
-this param allow to enter a note with this suggestion.
+
+    to filter on note when searching among ACCEPTED suggestion.
 
 =item copyrightdate
-the copyright date for this suggestion.
 
 =item publishercode
 
 =item volumedesc
 
 =item publicationyear
+
 the publication year of this record.
 
 =item place
 
 =item isbn
+
 the isbn of this suggestion.
 
 =item duplicateNumber
+
 is the biblionumber to put to the new suggestion.
 
 =item suggestionid
+
 the id of the suggestion to select.
 
 =item op
+
 can be equal to
     * connectDuplicate :
         then call to the function : ConnectSuggestionAndBiblio.
         i.e set the biblionumber of this suggestion.
     * else :
         is the default value.
+
 =back
 
 =cut
@@ -77,7 +90,6 @@
 use strict;
 require Exporter;
 use CGI;
-use HTML::Template;
 use C4::Auth;       # get_template_and_user
 use C4::Interface::CGI::Output;
 use C4::Suggestions;
@@ -85,98 +97,47 @@
 
 my $input = new CGI;
 
+# getting the CGI params
 my $basketno = $input->param('basketno');
 my $supplierid = $input->param('booksellerid');
-my $title = $input->param('title');
 my $author = $input->param('author');
-my $note = $input->param('note');
-my $copyrightdate =$input->param('copyrightdate');
+my $title           = $input->param('title');
 my $publishercode = $input->param('publishercode');
-my $volumedesc = $input->param('volumedesc');
-my $publicationyear = $input->param('publicationyear');
-my $place = $input->param('place');
-my $isbn = $input->param('isbn');
-my $duplicateNumber = $input->param('duplicateNumber');
+my $op              = $input->param('op');
 my $suggestionid = $input->param('suggestionid');
+my $duplicateNumber = $input->param('duplicateNumber');
 
-my $status = 'ACCEPTED'; # the suggestion had to be accepeted before to order it.
-my $suggestedbyme = -1; # search ALL suggestors
-my $op = $input->param('op');
 $op = 'else' unless $op;
 
 my $dbh = C4::Context->dbh;
-my ($template, $borrowernumber, $cookie)
-    = get_template_and_user({template_name => "acqui/newordersuggestion.tmpl",
+my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
+    {
+        template_name   => "acqui/newordersuggestion.tmpl",
                  type => "intranet",
                  query => $input,
                  authnotrequired => 1,
-                 flagsrequired => {acquisition => 1},
-             });
+        flagsrequired   => { acquisition => 1 },
+    }
+);
 
-if ($op eq 'connectDuplicate') {
-    ConnectSuggestionAndBiblio($suggestionid,$duplicateNumber);
+if ( $op eq 'connectDuplicate' ) {
+    ConnectSuggestionAndBiblio( $suggestionid, $duplicateNumber );
 }
-my $suggestions_loop= &SearchSuggestion($borrowernumber,$author,$title,$publishercode,$status,$suggestedbyme);
-foreach (@$suggestions_loop) {
-    unless ($_->{biblionumber}) {
-        my (@tags, @and_or, @excluding, @operator, @value, $offset,$length);
-        # search on biblio.title
-        if ($_->{title}) {
-            my ($tag,$subfield) = MARCfind_marc_from_kohafield($dbh,"biblio.title","");
-            push @tags, "'".$tag.$subfield."'";
-            push @and_or, "and";
-            push @excluding, "";
-            push @operator, "contains";
-            push @value, $_->{title};
-        }
-        if ($_->{author}) {
-            my ($tag,$subfield) = MARCfind_marc_from_kohafield($dbh,"biblio.author","");
-            push @tags, "'".$tag.$subfield."'";
-            push @and_or, "and";
-            push @excluding, "";
-            push @operator, "contains";
-            push @value, $_->{author};
-        }
-        # ... and on publicationyear.
-        if ($_->{publicationyear}) {
-            my ($tag,$subfield) = MARCfind_marc_from_kohafield($dbh,"biblioitems.publicationyear","");
-            push @tags, "'".$tag.$subfield."'";
-            push @and_or, "and";
-            push @excluding, "";
-            push @operator, "=";
-            push @value, $_->{publicationyear};
-        }
-        # ... and on publisher.
-        if ($_->{publishercode}) {
-            my ($tag,$subfield) = MARCfind_marc_from_kohafield($dbh,"biblioitems.publishercode","");
-            push @tags, "'".$tag.$subfield."'";
-            push @and_or, "and";
-            push @excluding, "";
-            push @operator, "=";
-            push @value, $_->{publishercode};
-        }
     
-        my ($finalresult,$nbresult) = catalogsearch($dbh,\@tags,\@and_or,\@excluding,\@operator,\@value,0,10);
+# getting all suggestions.
+my $suggestions_loop =
+  &SearchSuggestion( $borrowernumber, $author, $title, $publishercode,'ACCEPTED',
+    -1 );
 
-        # there is at least 1 result => return the 1st one
-        if ($nbresult) {
-             #warn "$nbresult => ".@$finalresult[0]->{biblionumber},@$finalresult[0]->{biblionumber},@$finalresult[0]->{title};
-             #warn "DUPLICATE ==>".@$finalresult[0]->{biblionumber},@$finalresult[0]->{biblionumber},@$finalresult[0]->{title};
-            $_->{duplicateBiblionumber} = @$finalresult[0]->{biblionumber};
-        }
-    }
-}
-$template->param(suggestions_loop => $suggestions_loop,
-                title => $title,
-                author => $author,
-                publishercode => $publishercode,
-                status => $status,
-                suggestedbyme => $suggestedbyme,
+$template->param(
+    suggestions_loop        => $suggestions_loop,
                 basketno => $basketno,
                 supplierid => $supplierid,
                 "op_$op" => 1,
-                intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
+    intranetcolorstylesheet =>
+      C4::Context->preference("intranetcolorstylesheet"),
         intranetstylesheet => C4::Context->preference("intranetstylesheet"),
         IntranetNav => C4::Context->preference("IntranetNav"),
 );
+
 output_html_with_http_headers $input, $cookie, $template->output;

Index: koha-tmpl/intranet-tmpl/prog/en/acqui/newordersuggestion.tmpl
===================================================================
RCS file: /sources/koha/koha/koha-tmpl/intranet-tmpl/prog/en/acqui/newordersuggestion.tmpl,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -b -r1.1 -r1.1.2.1
--- koha-tmpl/intranet-tmpl/prog/en/acqui/newordersuggestion.tmpl	2 Aug 2006 08:20:32 -0000	1.1
+++ koha-tmpl/intranet-tmpl/prog/en/acqui/newordersuggestion.tmpl	1 Dec 2006 09:35:39 -0000	1.1.2.1
@@ -15,7 +15,8 @@
 		</tr>
 		<tr>
 			<th>
-				<p>Filter on :
+                 Filter on :
+                <p>
 				title: <input type="text" name="title" value="<!-- TMPL_VAR NAME="title"-->" />
 				author: <input type="text" name="author" value="<!-- TMPL_VAR NAME="author" -->" />
 				publisher: <input type="text" name="publishercode" value="<!-- TMPL_VAR NAME="publishercode"-->" /></p>





More information about the Koha-cvs mailing list