From 7aad47304273868385ea0380e93ace423c73631b Mon Sep 17 00:00:00 2001 From: tipaul Date: Wed, 4 May 2005 08:45:03 +0000 Subject: [PATCH] synch'ing 2.2 and head --- acqui.simple/addbiblio-nomarc.pl | 8 +- acqui.simple/addbiblio.pl | 9 ++- acqui.simple/addbooks.pl | 2 +- acqui.simple/additem-nomarc.pl | 8 +- acqui.simple/additem.pl | 3 +- acqui.simple/isbnsearch.pl | 132 +++++++++++++++++++++++-------- acqui/basket.pl | 10 +-- acqui/newbasket2.pl | 2 +- acqui/recieveorder.pl | 2 +- acqui/suggestion-select.pl | 4 +- 10 files changed, 131 insertions(+), 49 deletions(-) diff --git a/acqui.simple/addbiblio-nomarc.pl b/acqui.simple/addbiblio-nomarc.pl index 51596a3b3e..7859a60b5c 100755 --- a/acqui.simple/addbiblio-nomarc.pl +++ b/acqui.simple/addbiblio-nomarc.pl @@ -26,6 +26,12 @@ # Suite 330, Boston, MA 02111-1307 USA # $Log$ +# Revision 1.3 2005/05/04 08:45:22 tipaul +# synch'ing 2.2 and head +# +# Revision 1.2.4.1 2005/03/25 12:52:42 tipaul +# needs "editcatalogue" flag, not "catalogue" +# # Revision 1.2 2003/05/09 23:47:22 rangi # This script is now templated # 3 more to go i think @@ -45,7 +51,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => { catalogue => 1 }, + flagsrequired => { editcatalogue => 1 }, debug => 1, } ); diff --git a/acqui.simple/addbiblio.pl b/acqui.simple/addbiblio.pl index 9100055956..ffbff9905d 100755 --- a/acqui.simple/addbiblio.pl +++ b/acqui.simple/addbiblio.pl @@ -197,14 +197,17 @@ sub create_input () { $subfield_data{marc_value}=""; # it's a standard field } else { - $subfield_data{marc_value}=""; #" + if (length($value) >200) { + $subfield_data{marc_value}=""; + } else { + $subfield_data{marc_value}=""; #" + } } return \%subfield_data; } sub build_tabs ($$$$) { my($template, $record, $dbh,$encoding) = @_; - # fill arrays my @loop_data =(); my $tag; @@ -260,7 +263,7 @@ sub build_tabs ($$$$) { push (@loop_data, \%tag_data); } # If there is more than 1 field, add an empty hidden field as separator. - if ($#fields >=1) { + if ($#fields >1) { my @subfields_data; my %tag_data; push(@subfields_data, &create_input('','','',$i,$tabloop,$record,$authorised_values_sth)); diff --git a/acqui.simple/addbooks.pl b/acqui.simple/addbooks.pl index 18304b207f..4222fe7d16 100755 --- a/acqui.simple/addbooks.pl +++ b/acqui.simple/addbooks.pl @@ -52,7 +52,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( query => $query, type => "intranet", authnotrequired => 0, - flagsrequired => { catalogue => 1 }, + flagsrequired => { editcatalogue => 1 }, debug => 1, } ); diff --git a/acqui.simple/additem-nomarc.pl b/acqui.simple/additem-nomarc.pl index 8a126cbef4..6747c08b0a 100755 --- a/acqui.simple/additem-nomarc.pl +++ b/acqui.simple/additem-nomarc.pl @@ -20,6 +20,12 @@ # Suite 330, Boston, MA 02111-1307 USA # $Log$ +# Revision 1.5 2005/05/04 08:45:33 tipaul +# synch'ing 2.2 and head +# +# Revision 1.4.2.1 2005/03/25 12:52:44 tipaul +# needs "editcatalogue" flag, not "catalogue" +# # Revision 1.4 2004/11/19 16:41:49 tipaul # improving behaviour when MARC=OFF # @@ -95,7 +101,7 @@ else { query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => { catalogue => 1 }, + flagsrequired => { editcatalogue => 1 }, debug => 1, } ); diff --git a/acqui.simple/additem.pl b/acqui.simple/additem.pl index d8323b0f96..38cc1fa671 100755 --- a/acqui.simple/additem.pl +++ b/acqui.simple/additem.pl @@ -120,6 +120,7 @@ if ($op eq "additem") { } my $record = MARChtml2marc($dbh,\@tags,\@subfields,\@values,%indicators); # MARC::Record builded => now, record in DB +# warn "R: ".$record->as_formatted; my ($oldbiblionumber,$oldbibnum,$oldbibitemnum) = NEWmoditem($dbh,$record,$bibid,$itemnum,0); $itemnum=""; $nextop="additem"; @@ -269,7 +270,7 @@ my ($template, $loggedinuser, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {editcatalogue => 1}, debug => 1, }); diff --git a/acqui.simple/isbnsearch.pl b/acqui.simple/isbnsearch.pl index d014cda2e8..54619b1b62 100755 --- a/acqui.simple/isbnsearch.pl +++ b/acqui.simple/isbnsearch.pl @@ -21,34 +21,30 @@ use strict; use CGI; use C4::Auth; use C4::Biblio; -use C4::Search; +# use C4::Search; +use C4::Breeding; +use C4::SearchMarc; use C4::Output; use C4::Interface::CGI::Output; use HTML::Template; use C4::Koha; my $input = new CGI; -my $isbn = $input->param('isbn'); -my $title = $input->param('title'); my $offset = $input->param('offset'); my $num = $input->param('num'); -my $showoffset = $offset + 1; -my $total; -my $count; -my @results; +# my $total; +# my $count; +# my @results; my $marc_p = C4::Context->boolean_preference("marc"); +my $dbh = C4::Context->dbh; -if ( !$isbn && !$title ) { - print $input->redirect('addbooks.pl'); -} -else { my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { template_name => "acqui.simple/isbnsearch.tmpl", query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => { catalogue => 1 }, + flagsrequired => { editcatalogue => 1 }, debug => 1, } ); @@ -56,10 +52,77 @@ else { # fill with books in ACTIVE DB (biblio) if ( !$offset ) { $offset = 0; - $showoffset = 1; } if ( !$num ) { $num = 10 } - ( $count, @results ) = isbnsearch( $isbn, $title ); + my @marclist = $input->param('marclist'); + my @and_or = $input->param('and_or'); + my @excluding = $input->param('excluding'); + my @operator = $input->param('operator'); + my @value = $input->param('value'); + my $title= @value[0]; + my $isbn = @value[1]; + my $resultsperpage= $input->param('resultsperpage'); + $resultsperpage = 5 if(!defined $resultsperpage); + my $startfrom=$input->param('startfrom'); + $startfrom=0 if(!defined $startfrom); + my $orderby = $input->param('orderby'); + my $desc_or_asc = $input->param('desc_or_asc'); + + # builds tag and subfield arrays + my @tags; + + foreach my $marc (@marclist) { + if ($marc) { + my ($tag,$subfield) = MARCfind_marc_from_kohafield($dbh,$marc,''); + if ($tag) { + push @tags,$dbh->quote("$tag$subfield"); + } else { + push @tags, $dbh->quote(substr($marc,0,4)); + } + } else { + push @tags, ""; + } + } + findseealso($dbh,\@tags); + my ($results,$total) = catalogsearch($dbh, \@tags,\@and_or, + \@excluding, \@operator, \@value, + $startfrom, $resultsperpage,'biblio.title','ASC'); +# @results = @$resultsref; + +# my @loop_data = (); +# my $toggle; +# for ( my $i = $offset ; $i < $total ; $i++ ) { +# if ( $i % 2 ) { +# $toggle = 0; +# } else { +# $toggle = 1; +# } +# my %row_data; # get a fresh hash for the row data +# $row_data{toggle} = $toggle; +# $row_data{biblionumber} = $results[$i]->{'biblionumber'}; +# $row_data{title} = $results[$i]->{'title'}; +# $row_data{author} = $results[$i]->{'author'}; +# $row_data{copyrightdate} = $results[$i]->{'copyrightdate'}; +# $row_data{classification} = $results[$i]->{'classification'}; +# $row_data{NOTMARC} = !$marc_p; +# push ( @loop_data, \%row_data ); +# } + # multi page display gestion + my $displaynext=0; + my $displayprev=$startfrom; + if(($total - (($startfrom+1)*($resultsperpage))) > 0 ) { + $displaynext = 1; + } + + my @field_data = (); + + for(my $i = 0 ; $i <= $#marclist ; $i++) { + push @field_data, { term => "marclist", val=>$marclist[$i] }; + push @field_data, { term => "and_or", val=>$and_or[$i] }; + push @field_data, { term => "excluding", val=>$excluding[$i] }; + push @field_data, { term => "operator", val=>$operator[$i] }; + push @field_data, { term => "value", val=>$value[$i] }; + } if ( $count < ( $offset + $num ) ) { $total = $count; @@ -130,9 +193,10 @@ else { } # fill with books in breeding farm - ( $count, @results ) = breedingsearch( $title, $isbn ); + my $toggle=0; + my ( $countbr, @resultsbr ) = BreedingSearch( @value[0], @value[1] ); my @breeding_loop = (); - for ( my $i = 0 ; $i <= $#results ; $i++ ) { + for ( my $i = 0 ; $i <= $#resultsbr ; $i++ ) { my %row_data; if ( $i % 2 ) { $toggle = 0; @@ -141,16 +205,15 @@ else { $toggle = 1; } $row_data{toggle} = $toggle; - $row_data{id} = $results[$i]->{'id'}; - $row_data{isbn} = $results[$i]->{'isbn'}; - $row_data{file} = $results[$i]->{'file'}; - $row_data{title} = $results[$i]->{'title'}; - $row_data{author} = $results[$i]->{'author'}; + $row_data{id} = $resultsbr[$i]->{'id'}; + $row_data{isbn} = $resultsbr[$i]->{'isbn'}; + $row_data{file} = $resultsbr[$i]->{'file'}; + $row_data{title} = $resultsbr[$i]->{'title'}; + $row_data{author} = $resultsbr[$i]->{'author'}; $row_data{NOTMARC}= !$marc_p; push ( @breeding_loop, \%row_data ); } - # get framework list my $frameworks = getframeworks; my @frameworkcodeloop; @@ -162,16 +225,22 @@ else { } $template->param( - isbn => $isbn, - title => $title, - showoffset => $showoffset, + title => $title, + isbn => $isbn, + startfrom=> $startfrom, + displaynext=> $displaynext, + displayprev=> $displayprev, + resultsperpage => $resultsperpage, + startfromnext => $startfrom+1, + startfromprev => $startfrom-1, + searchdata=>\@field_data, + numbers=>\@numbers, + from => $from, + to => $to, total => $total, - offset => $offset, - loop => \@loop_data, +# offset => $offset, + loop => $results, breeding_loop => \@breeding_loop, - numbers => \@numbers, - term => $term, - value => $value, NOTMARC => !$marc_p, frameworkcodeloop => \@frameworkcodeloop, ); @@ -180,5 +249,4 @@ else { -type => guesstype( $template->output ), -cookie => $cookie ), - $template->output; -} # else + $template->output; \ No newline at end of file diff --git a/acqui/basket.pl b/acqui/basket.pl index 22c426f984..515abfdecc 100755 --- a/acqui/basket.pl +++ b/acqui/basket.pl @@ -64,7 +64,6 @@ my $line_total; # total of each line my $sub_total; # total of line totals my $gist; # GST my $grand_total; # $subttotal + $gist -my $toggle=0; my @books_loop; for (my $i=0;$i<$count;$i++){ @@ -74,12 +73,10 @@ for (my $i=0;$i<$count;$i++){ $line_total=$results[$i]->{'quantity'}*$results[$i]->{'ecost'}; $sub_total+=$line_total; my %line; - if ($toggle==0){ - $line{color}='#EEEEEE'; - $toggle=1; + if ($i % 2){ + $line{highlight}=1; } else { - $line{color}='white'; - $toggle=0; + $line{highlight}=0; } $line{ordernumber} = $results[$i]->{'ordernumber'}; $line{publishercode} = $results[$i]->{'publishercode'}; @@ -106,6 +103,7 @@ $template->param(basketno => $basketno, authorisedby => $basket->{authorisedby}, authorisedbyname => $basket->{authorisedbyname}, closedate => format_date($basket->{closedate}), + active => $booksellers[0]->{'active'}, booksellerid=> $booksellers[0]->{'id'}, name => $booksellers[0]->{'name'}, entrydate => format_date($results[0]->{'entrydate'}), diff --git a/acqui/newbasket2.pl b/acqui/newbasket2.pl index 7fc0cb0dd6..ab7100710c 100755 --- a/acqui/newbasket2.pl +++ b/acqui/newbasket2.pl @@ -71,7 +71,7 @@ my ($template, $loggedinuser, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {superlibrarian => 1}, + flagsrequired => {acquisition => 1}, debug => 1, }); diff --git a/acqui/recieveorder.pl b/acqui/recieveorder.pl index 024c4f8d2f..1c5f84c59a 100755 --- a/acqui/recieveorder.pl +++ b/acqui/recieveorder.pl @@ -32,7 +32,7 @@ use HTML::Template; use C4::Acquisition; my $input=new CGI; -my $supplierid=$input->param('supplierid'); +my $supplierid=$input->param('id'); my ($count,@booksellers)=bookseller($supplierid); my ($template, $loggedinuser, $cookie) diff --git a/acqui/suggestion-select.pl b/acqui/suggestion-select.pl index 8eb405faeb..f32cb73f42 100755 --- a/acqui/suggestion-select.pl +++ b/acqui/suggestion-select.pl @@ -23,7 +23,7 @@ my $publicationyear = $input->param('publicationyear'); my $place = $input->param('place'); my $isbn = $input->param('isbn'); my $status = 'ACCEPTED'; -my $suggestedbyme = 1; +my $suggestedbyme = -1; # search ALL suggestors my $op = $input->param('op'); $op = 'else' unless $op; @@ -33,7 +33,7 @@ my ($template, $borrowernumber, $cookie) type => "intranet", query => $input, authnotrequired => 1, - flagsrequired => {borrow => 1}, + flagsrequired => {acquisition => 1}, }); my $suggestions_loop= &searchsuggestion($borrowernumber,$author,$title,$publishercode,$status,$suggestedbyme); -- 2.39.5