From dc1cf5f1638cfc8c5ead33f84352fdb7e242d9b3 Mon Sep 17 00:00:00 2001 From: tipaul Date: Thu, 27 Feb 2003 16:54:10 +0000 Subject: [PATCH] road to 1.9.2 : * finishing templating acquisition * first step to acquisition/cataloguing merging. show no errors, but seems a little buggy (order counter wrong, problem at end of acquisition process...) --- acqui/acquire.pl | 382 ++++++------------ acqui/finishreceive.pl | 132 +++--- acqui/newbiblio.pl | 3 +- .../default/en/acqui/acquire.tmpl | 142 +++++++ .../default/en/acqui/basket.tmpl | 80 ++++ 5 files changed, 415 insertions(+), 324 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/default/en/acqui/acquire.tmpl create mode 100644 koha-tmpl/intranet-tmpl/default/en/acqui/basket.tmpl diff --git a/acqui/acquire.pl b/acqui/acquire.pl index 12c960707b..4d6780ced4 100755 --- a/acqui/acquire.pl +++ b/acqui/acquire.pl @@ -22,7 +22,6 @@ # You should have received a copy of the GNU General Public License along with # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, # Suite 330, Boston, MA 02111-1307 USA - use strict; use CGI; use C4::Context; @@ -30,14 +29,16 @@ use C4::Catalogue; use C4::Biblio; use C4::Output; use C4::Search; +use C4::Auth; +use C4::Biblio; +use C4::Output; +use C4::Interface::CGI::Output; +use C4::Database; +use HTML::Template; my $input=new CGI; -print $input->header(); my $id=$input->param('id'); - -print startpage; - -print startmenu('acquisitions'); +my $dbh = C4::Context->dbh; my $search=$input->param('recieve'); my $invoice=$input->param('invoice'); @@ -47,256 +48,133 @@ my $catview=$input->param('catview'); my $gst=$input->param('gst'); my ($count,@results)=ordersearch($search,$biblio,$catview); my ($count2,@booksellers)=bookseller($results[0]->{'booksellerid'}); -#print $count; my @date=split('-',$results[0]->{'entrydate'}); my $date="$date[2]/$date[1]/$date[0]"; -if ($count == 1){ - - -print < - - -
-{'biblionumber'}> -{'ordernumber'}> -{'biblioitemnumber'}> -{'booksellerid'}> - - -EOP -; -if ($catview ne 'yes'){ - print ""; -} else { - print "{'ordernumber'}&id=$results[0]->{'booksellerid'}>"; -} -print <$results[0]->{'ordernumber'} - Receive Order
-Shopping Basket For: $booksellers[0]->{'name'} -
Order placed: $date -

-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +my ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "acqui/acquire.tmpl", + query => $input, + type => "intranet", + authnotrequired => 0, + flagsrequired => {acquisition => 1}, + debug => 1, + }); - - - - - - - - - - - - - - - - -
CATALOGUE DETAILS
Title * -
Author -
Copyright Date -
Format -
ISBN -
Series -
Branch
Item Barcode *boolean_preference("autoBarcode") || 0; - # See whether barcodes should be automatically allocated. - # Defaults to 0, meaning "no". -if ($auto_barcode eq '1') { - my $dbh = C4::Context->dbh; - my $query="Select barcode from items order by barcode desc"; - my $sth=$dbh->prepare($query); - $sth->execute; - my $data=$sth->fetchrow_hashref; - print $data->{'barcode'}+1; - $sth->finish; -} - -print < -
Volume Info (for serials) * -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ACCOUNTING DETAILS
Bookfund *
Quantity Ordered{'quantity'}> -
Quantity Received *{'quantityreceived'}> -
Replacement Cost -
-Budgeted Cost -
Actual Cost * -
Invoice Number$invoice - -
Notes -
- -
-
-

 

- -EOP -; +$template->param($count); +if ($count == 1){ + my $query="Select itemtype,description from itemtypes order by description"; + my $sth=$dbh->prepare($query); + $sth->execute; + my @itemtype; + my %itemtypes; + push @itemtype, ""; + $itemtypes{''} = "Please choose"; + while (my ($value,$lib) = $sth->fetchrow_array) { + push @itemtype, $value; + $itemtypes{$value}=$lib; + } + + my $CGIitemtype=CGI::scrolling_list( -name => 'format', + -values => \@itemtype, + -default => $results[0]->{'itemtype'}, + -labels => \%itemtypes, + -size => 1, + -multiple => 0 ); + $sth->finish; + + my @branches; + my @select_branch; + my %select_branches; + my ($count2,@branches)=branches(); + for (my $i=0;$i<$count2;$i++){ + push @select_branch, $branches[$i]->{'branchcode'};# + $select_branches{$branches[$i]->{'branchcode'}} = $branches[$i]->{'branchname'}; + } + my $CGIbranch=CGI::scrolling_list( -name => 'branch', + -values => \@select_branch, + -default => $results[0]->{'branchcode'}, + -labels => \%select_branches, + -size => 1, + -multiple => 0 ); + $sth->finish; + + my $auto_barcode = C4::Context->boolean_preference("autoBarcode") || 0; + # See whether barcodes should be automatically allocated. + # Defaults to 0, meaning "no". + my $barcode; + if ($auto_barcode eq '1') { + $sth=$dbh->prepare("Select max(barcode) from items"); + $sth->execute; + my $data=$sth->fetchrow_hashref; + $barcode = $results[0]->{'barcode'}+1; + $sth->finish; + } + + my @bookfund; + my @select_bookfund; + my %select_bookfunds; + ($count2,@bookfund)=bookfunds(); + for (my $i=0;$i<$count2;$i++){ + push @select_bookfund, $bookfund[$i]->{'bookfundid'}; + $select_bookfunds{$bookfund[$i]->{'bookfundid'}} = $bookfund[$i]->{'bookfundname'} + } + my $CGIbookfund=CGI::scrolling_list( -name => 'bookfund', + -values => \@select_bookfund, + -default => $results[0]->{'bookfundid'}, + -labels => \%select_bookfunds, + -size => 1, + -multiple => 0 ); + + my $rrp=$results[0]->{'rrp'}; + if ($results[0]->{'quantityreceived'} == 0){ + $results[0]->{'quantityreceived'}=''; + } + if ($results[0]->{'unitprice'} == 0){ + $results[0]->{'unitprice'}=''; + } + $template->param( + count => 1, + biblionumber => $results[0]->{'biblionumber'}, + ordernumber => $results[0]->{'ordernumber'}, + biblioitemnumber => $results[0]->{'biblioitemnumber'}, + booksellerid => $results[0]->{'booksellerid'}, + freight => $freight, + gst => $gst, + catview => ($catview ne 'yes'?1:0), + name => $booksellers[0]->{'name'}, + date => $date, + title => $results[0]->{'title'}, + author => $results[0]->{'author'}, + copyrightdate => $results[0]->{'copyrightdate'}, + CGIitemtype => $CGIitemtype, + CGIbranch => $CGIbranch, + isbn => $results[0]->{'isbn'}, + seriestitle => $results[0]->{'seriestitle'}, + barcode => $barcode, + CGIbookfund => $CGIbookfund, + quantity => $results[0]->{'quantity'}, + quantityreceived => $results[0]->{'quantityreceived'}, + rrp => $rrp, + ecost => $results[0]->{'ecost'}, + unitprice => $results[0]->{'unitprice'}, + invoice => $invoice, + notes => $results[0]->{'notes'}, + ); } else { -print "
"; -print < + my @loop; + for (my $i=0;$i<$count;$i++){ + my %line; + $line{isbn} = $results[$i]->{'isbn'}; + $line{ordernumber} = $results[$i]->{'ordernumber'}; + $line{biblionumber} = $results[$i]->{'biblionumber'}; + $line{invoice} = $invoice; + $line{freight} = $freight; + $line{gst} = $gst; + $line{title} = $results[$i]->{'title'}; + $line{author} = $results[$i]->{'author'}; + push @loop,\%line; + } + $template->param( loop => \@loop); - - - - -EOP -; -for (my $i=0;$i<$count;$i++){ - print " - - "; -} -print "
ISBNTITLEAUTHOR
$results[$i]->{'isbn'}{'ordernumber'}&biblio=$results[$i]->{'biblionumber'}&invoice=$invoice&freight=$freight&gst=$gst>$results[$i]->{'title'}$results[$i]->{'author'}
"; } - - - -print endmenu('acquisitions'); - -print endpage; +output_html_with_http_headers $input, $cookie, $template->output; diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl index 4e05ebd77c..5a387f4e41 100755 --- a/acqui/finishreceive.pl +++ b/acqui/finishreceive.pl @@ -28,10 +28,8 @@ use CGI; use C4::Search; my $input=new CGI; -#print $input->header; my $user=$input->remote_user; -#print $input->dump; my $biblionumber = $input->param('biblio'); my $ordnum=$input->param('ordnum'); my $quantrec=$input->param('quantityrec'); @@ -58,15 +56,15 @@ my $isbn=$input->param('ISBN'); my $bookseller = $input->param('bookseller'); my $id = $bookseller; my $biblio = { - biblionumber => $biblionumber, - title => $input->param('title')?$input->param('title'):"", - author => $input->param('author')?$input->param('author'):"", - copyrightdate => $input->param('copyright')?$input->param('copyright'):"", - series => $input->param('Series')?$input->param('Series'):"" + biblionumber => $biblionumber, + title => $input->param('title')?$input->param('title'):"", + author => $input->param('author')?$input->param('author'):"", + copyrightdate => $input->param('copyright')?$input->param('copyright'):"", + series => $input->param('Series')?$input->param('Series'):"" }; # my $biblio if ($quantrec != 0){ - $cost /= $quantrec; + $cost /= $quantrec; } my $gst=$input->param('gst'); @@ -74,72 +72,66 @@ my $freight=$input->param('freight'); my $volinf=$input->param('volinf'); my $loan=0; if ($itemtype =~ /REF/){ - $loan=1; + $loan=1; } if ($itemtype =~ /PER/){ -# print "$bibitemno"; - $class="Periodical"; - $bibitemno = &newbiblioitem({ - biblionumber => $biblionumber, - itemtype => $itemtype?$itemtype:"", - isbn => $isbn?$isbn:"", - volumeddesc => $volinf?$volinf:"", - classification => $class?$class:"" }); -# print "here $bibitemno"; + $class="Periodical"; + $bibitemno = &newbiblioitem({ + biblionumber => $biblionumber, + itemtype => $itemtype?$itemtype:"", + isbn => $isbn?$isbn:"", + volumeddesc => $volinf?$volinf:"", + classification => $class?$class:"" }); } +warn "qty : $quantity"; if ($quantity != 0){ - receiveorder($biblionumber,$ordnum,$quantrec,$user,$cost,$invoiceno,$bibitemno,$freight,$bookfund); - modbiblio($biblio); - &modbibitem({ - biblioitemnumber => $bibitemno, - biblionumber => $biblionumber, - itemtype => $itemtype?$itemtype:"", - isbn => $isbn?$isbn:"", - publisher => $publisher?$publisher:"", - publicationyear => $pubdate?$pubdate:"", - class => $class?$class:"", - dewey => $dewey?$dewey:"", - subclass => $subclass?$subclass:"", - illus => $illus?$illus:"", - pages => $pages?$pages:"", - volumeddesc => $volinf?$volinf:"", - notes => $notes?$notes:"", - size => $size?$size:"" }); - - my $barcode=$input->param('barcode'); - my @barcodes; - if ($barcode =~ /\,/){ - @barcodes=split(/\,/,$barcode); - }elsif ($barcode =~ /\|/){ - @barcodes=split(/\|/,$barcode); - } else { - $barcodes[0]=$barcode; - # print $input->header; - # print @barcodes; - # print $barcode; - } -# print STDERR "************ biblionumber => $biblionumber\n"; - my ($error) = newitems({ biblioitemnumber => $bibitemno, - biblionumber => $biblionumber, - replacementprice => $replacement, - price => $cost, - booksellerid => $bookseller, - homebranch => $branch, - loan => $loan }, - @barcodes); - if ($error eq ''){ - if ($itemtype ne 'PER'){ - print $input->redirect("/cgi-bin/koha/acqui/receive.pl?invoice=$invoiceno&id=$id&freight=$freight&gst=$gst"); - } else { - print $input->redirect("/acquisitions/"); - } - } else { - print $input->header; - print $error; - } + receiveorder($biblionumber,$ordnum,$quantrec,$user,$cost,$invoiceno,$bibitemno,$freight,$bookfund); + modbiblio($biblio); + &modbibitem({ + biblioitemnumber => $bibitemno, + biblionumber => $biblionumber, + itemtype => $itemtype?$itemtype:"", + isbn => $isbn?$isbn:"", + publisher => $publisher?$publisher:"", + publicationyear => $pubdate?$pubdate:"", + class => $class?$class:"", + dewey => $dewey?$dewey:"", + subclass => $subclass?$subclass:"", + illus => $illus?$illus:"", + pages => $pages?$pages:"", + volumeddesc => $volinf?$volinf:"", + notes => $notes?$notes:"", + size => $size?$size:"" }); + my $barcode=$input->param('barcode'); + my @barcodes; + if ($barcode =~ /\,/){ + @barcodes=split(/\,/,$barcode); + }elsif ($barcode =~ /\|/){ + @barcodes=split(/\|/,$barcode); + } else { + $barcodes[0]=$barcode; + } + my ($error) = newitems({ biblioitemnumber => $bibitemno, + biblionumber => $biblionumber, + replacementprice => $replacement, + price => $cost, + booksellerid => $bookseller, + homebranch => $branch, + loan => $loan }, + @barcodes); + if ($error eq ''){ + if ($itemtype ne 'PER'){ + print $input->redirect("/cgi-bin/koha/acqui/receive.pl?invoice=$invoiceno&id=$id&freight=$freight&gst=$gst"); + } else { + print $input->redirect("/acquisitions/"); + } + } else { + print $input->header; + print $error; + } } else { - print $input->header; - delorder($biblionumber,$ordnum); - print $input->redirect("/acquisitions/"); + print $input->header; + delorder($biblionumber,$ordnum); + print $input->redirect("/acquisitions/"); } diff --git a/acqui/newbiblio.pl b/acqui/newbiblio.pl index 82402cfda2..c6a6d81ad1 100755 --- a/acqui/newbiblio.pl +++ b/acqui/newbiblio.pl @@ -36,7 +36,6 @@ use C4::Database; use HTML::Template; my $input=new CGI; -#print $input->header(); my $id=$input->param('id'); my $title=$input->param('title'); my $author=$input->param('author'); @@ -102,7 +101,7 @@ my $CGIitemtype=CGI::scrolling_list( -name => 'format', -size => 1, -multiple => 0 ); $sth->finish; -# TODO + my @branches; my @select_branch; my %select_branches; diff --git a/koha-tmpl/intranet-tmpl/default/en/acqui/acquire.tmpl b/koha-tmpl/intranet-tmpl/default/en/acqui/acquire.tmpl new file mode 100644 index 0000000000..b231d70e74 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/default/en/acqui/acquire.tmpl @@ -0,0 +1,142 @@ + + + + +
+ > + > + > + "> + "> + "> + + + + &id=> + + - Receive Order
+ Shopping Basket For: +
Order placed: +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ CATALOGUE DETAILS +
Title *" > +
Author" > +
Copyright Date" > +
Format
ISBN">
Series">
Branch
Item Barcode *">
Volume Info (for serials) *
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ACCOUNTING DETAILS
Bookfund * +
Quantity Ordered"> +
Quantity Received *"> +
Replacement Cost"> +
Budgeted Cost ">
Actual Cost *">
Invoice Number + + "> +
Notes">
+ +
+
+

 

+ +
+ + + + + + + + + + + + +
ISBNTITLEAUTHOR
&biblio=&invoice=&freight=&gst=>
+ diff --git a/koha-tmpl/intranet-tmpl/default/en/acqui/basket.tmpl b/koha-tmpl/intranet-tmpl/default/en/acqui/basket.tmpl new file mode 100644 index 0000000000..d750328fac --- /dev/null +++ b/koha-tmpl/intranet-tmpl/default/en/acqui/basket.tmpl @@ -0,0 +1,80 @@ + + +Shopping Basket for >
+(Our Reference: , #, authorised by: )
+
+ +

+

+ + + + + + + + + + + + + "> + + + + + + + + + value=> + value=> + + + > + "> + + + + + + + + + + + + + + + + + + + + + + + + + + +
OrderIsbnTitleAuthor$ rrp$estQtyTotal
&id=&basket="> size=6 value=""> size=6 value=""> size=6 value="" onchange='update(this.form)'> size=10 value=>
+ HELP
+ To cancel an order, just change the quantity to 0 and click "save changes".
+ To change any of the catalogue or accounting information attached to an order, click on the title.
+
SubTotal$>
GST$>
TOTAL$>
+ + +
+
+ "> + "> + Add order : enter keyword or title: +
+
+
+ + -- 2.39.5