From f29ce59691b349687d2a023c07383997d7d55dcb Mon Sep 17 00:00:00 2001 From: tipaul Date: Thu, 15 Jul 2004 09:41:03 +0000 Subject: [PATCH] Acquisition & Suggestion : * acquisition rewritte : create a aqbasket table to deal with "bookseller order header". * add "close basket" feature : a closed basket can't be modified * suggestion feature : manage suggestions in acquisition (after suggestion filled in OPAC) --- C4/Acquisition.pm | 302 ++++++++---------- C4/Suggestions.pm | 80 ++++- acqui/addorder.pl | 54 ++-- acqui/basket.pl | 37 ++- acqui/newbiblio.pl | 49 ++- acqui/order.pl | 21 +- acqui/suggestion-select.pl | 50 +++ .../default/en/suggestion/acceptorreject.tmpl | 51 +++ .../suggestion/mail_suggestion_ACCEPTED.tmpl | 10 + .../suggestion/mail_suggestion_AVAILABLE.tmpl | 8 + .../suggestion/mail_suggestion_ORDERED.tmpl | 9 + .../suggestion/mail_suggestion_REJECTED.tmpl | 9 + opac/opac-ISBDdetail.pl | 2 +- opac/opac-MARCdetail.pl | 2 +- opac/opac-search.pl | 2 +- opac/opac-suggestions.pl | 14 +- suggestion/acceptorreject.pl | 59 ++++ 17 files changed, 497 insertions(+), 262 deletions(-) create mode 100755 acqui/suggestion-select.pl create mode 100644 koha-tmpl/intranet-tmpl/default/en/suggestion/acceptorreject.tmpl create mode 100644 koha-tmpl/intranet-tmpl/default/en/suggestion/mail_suggestion_ACCEPTED.tmpl create mode 100644 koha-tmpl/intranet-tmpl/default/en/suggestion/mail_suggestion_AVAILABLE.tmpl create mode 100644 koha-tmpl/intranet-tmpl/default/en/suggestion/mail_suggestion_ORDERED.tmpl create mode 100644 koha-tmpl/intranet-tmpl/default/en/suggestion/mail_suggestion_REJECTED.tmpl create mode 100755 suggestion/acceptorreject.pl diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index d5f06ed6a9..950411a3e4 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -1,12 +1,4 @@ -package C4::Catalogue; - -# Continue working on updateItem!!!!!! -# -# updateItem is looking not bad. Need to add addSubfield and deleteSubfield -# functions -# -# Trying to track down $dbh's that aren't disconnected.... - +package C4::Acquisition; # Copyright 2000-2002 Katipo Communications # @@ -29,7 +21,7 @@ use strict; require Exporter; use C4::Context; use MARC::Record; -use C4::Biblio; +# use C4::Biblio; use vars qw($VERSION @ISA @EXPORT); @@ -38,11 +30,11 @@ $VERSION = 0.01; =head1 NAME -C4::Catalogue - Koha functions for dealing with orders and acquisitions +C4::Acquisition - Koha functions for dealing with orders and acquisitions =head1 SYNOPSIS - use C4::Catalogue; + use C4::Acquisition; =head1 DESCRIPTION @@ -57,19 +49,19 @@ orders, converting money to different currencies, and so forth. @ISA = qw(Exporter); @EXPORT = qw( - &basket &newbasket + &getbasket &getbasketcontent &newbasket &closebasket - &getorders &getallorders &getrecorders - &getorder &neworder &delorder - &ordersearch - &modorder &getsingleorder &invoice &receiveorder - &updaterecorder &newordernum + &getorders &getallorders &getrecorders + &getorder &neworder &delorder + &ordersearch + &modorder &getsingleorder &invoice &receiveorder + &updaterecorder &newordernum - &bookfunds &bookfundbreakdown &updatecost - &curconvert &getcurrencies &updatecurrencies &getcurrency + &bookfunds &curconvert &getcurrencies &bookfundbreakdown + &updatecurrencies &getcurrency - &findall &needsmod &branches &updatesup &insertsup - &bookseller &breakdown &checkitems + &branches &updatesup &insertsup + &bookseller &breakdown ); # @@ -79,9 +71,24 @@ orders, converting money to different currencies, and so forth. # # # -=item basket +=item getbasket + + $aqbasket = &getbasket($basketnumber); - ($count, @orders) = &basket($basketnumber, $booksellerID); +get all basket informations in aqbasket for a given basket +=cut + +sub getbasket { + my ($basketno)=@_; + my $dbh=C4::Context->dbh; + my $sth=$dbh->prepare("select aqbasket.*,borrowers.firstname+' '+borrowers.surname as authorisedbyname from aqbasket left join borrowers on aqbasket.authorisedby=borrowers.borrowernumber where basketno=?"); + $sth->execute($basketno); + return($sth->fetchrow_hashref); +} + +=item getbasketcontent + + ($count, @orders) = &getbasketcontent($basketnumber, $booksellerID); Looks up the pending (non-cancelled) orders with the given basket number. If C<$booksellerID> is non-empty, only orders from that seller @@ -94,64 +101,65 @@ number of elements in C<@orders>. =cut #' -sub basket { - my ($basketno,$supplier)=@_; - my $dbh = C4::Context->dbh; - my $query="Select *,biblio.title from aqorders,biblio,biblioitems - where basketno='$basketno' - and biblio.biblionumber=aqorders.biblionumber and biblioitems.biblioitemnumber - =aqorders.biblioitemnumber - and (datecancellationprinted is NULL or datecancellationprinted = - '0000-00-00')"; - if ($supplier ne ''){ - $query.=" and aqorders.booksellerid='$supplier'"; - } - $query.=" order by biblioitems.publishercode"; - my $sth=$dbh->prepare($query); - $sth->execute; - my @results; -# print $query; - my $i=0; - while (my $data=$sth->fetchrow_hashref){ - $results[$i]=$data; - $i++; - } - $sth->finish; - return($i,@results); +sub getbasketcontent { + my ($basketno,$supplier)=@_; + my $dbh = C4::Context->dbh; + my $query="Select *,biblio.title from aqorders,biblio,biblioitems + where basketno='$basketno' + and biblio.biblionumber=aqorders.biblionumber and biblioitems.biblioitemnumber + =aqorders.biblioitemnumber + and (datecancellationprinted is NULL or datecancellationprinted = + '0000-00-00')"; + if ($supplier ne ''){ + $query.=" and aqorders.booksellerid='$supplier'"; + } + $query.=" order by biblioitems.publishercode"; + my $sth=$dbh->prepare($query); + $sth->execute; + my @results; + # print $query; + my $i=0; + while (my $data=$sth->fetchrow_hashref){ + $results[$i]=$data; + $i++; + } + $sth->finish; + return($i,@results); } =item newbasket $basket = &newbasket(); -Finds the next unused basket number in the aqorders table of the Koha -database, and returns it. - +Create a new basket in aqbasket table =cut -#' -# FIXME - There's a race condition here: -# A calls &newbasket -# B calls &newbasket (gets the same number as A) -# A updates the basket -# B updates the basket, and clobbers A's result. -# A better approach might be to create a dummy order (with, say, -# requisitionedby == "Dummy-$$" or notes == "dummy