From 09a2b1b61ceb8fc3e3a50a613482934333b6aa89 Mon Sep 17 00:00:00 2001 From: tipaul Date: Thu, 1 Dec 2005 17:27:55 +0000 Subject: [PATCH] suggestion/acquisition bugfixes : - 200 field is no more splitted in 2 parts - author is after title in UNIMARC (dirty solution, but mySQL has a strange behaviour) - when the book is recieved, the suggestion is marked "available" and a mail is sent --- C4/Acquisition.pm | 5 ++++ C4/Suggestions.pm | 29 +++++++++++++++---- acqui/addorder.pl | 13 +-------- .../suggestion/mail_suggestion_AVAILABLE.tmpl | 2 +- 4 files changed, 31 insertions(+), 18 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index b7c3e91564..f7b60555c2 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -22,6 +22,7 @@ require Exporter; use C4::Context; use C4::Date; use MARC::Record; +use C4::Suggestions; # use C4::Biblio; use vars qw($VERSION @ISA @EXPORT); @@ -320,6 +321,10 @@ sub receiveorder { my $sth=$dbh->prepare("update aqorders set quantityreceived=?,datereceived=now(),booksellerinvoicenumber=?, unitprice=?,freight=?,rrp=? where biblionumber=? and ordernumber=?"); + my $suggestionid = findsuggestion_from_biblionumber($dbh,$biblio); + if ($suggestionid) { + changestatus($suggestionid,'AVAILABLE','',$biblio); + } $sth->execute($quantrec,$invoiceno,$cost,$freight,$rrp,$biblio,$ordnum); $sth->finish; } diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm index b20c91bfc7..b49854068c 100644 --- a/C4/Suggestions.pm +++ b/C4/Suggestions.pm @@ -64,6 +64,7 @@ Suggestions done by other can be seen when not "AVAILABLE" &delsuggestion &countsuggestion &changestatus + &findsuggestion_from_biblionumber ); =item SearchSuggestion @@ -191,15 +192,25 @@ sub countsuggestion { } sub changestatus { - my ($suggestionid,$status,$managedby) = @_; + my ($suggestionid,$status,$managedby,$biblionumber) = @_; my $dbh = C4::Context->dbh; my $sth; if ($managedby>0) { - $sth = $dbh->prepare("update suggestions set status=?,managedby=? where suggestionid=?"); - $sth->execute($status,$managedby,$suggestionid); + if ($biblionumber) { + $sth = $dbh->prepare("update suggestions set status=?,managedby=?,biblionumber=? where suggestionid=?"); + $sth->execute($status,$managedby,$biblionumber,$suggestionid); + } else { + $sth = $dbh->prepare("update suggestions set status=?,managedby=? where suggestionid=?"); + $sth->execute($status,$managedby,$suggestionid); + } } else { - $sth = $dbh->prepare("update suggestions set status=? where suggestionid=?"); - $sth->execute($status,$suggestionid); + if ($biblionumber) { + $sth = $dbh->prepare("update suggestions set status=?,biblionumber=? where suggestionid=?"); + $sth->execute($status,$biblionumber,$suggestionid); + } else { + $sth = $dbh->prepare("update suggestions set status=? where suggestionid=?"); + $sth->execute($status,$suggestionid); + } } # check mail sending. @@ -232,6 +243,14 @@ sendmail(%mail); # warn "sending email to $emailinfo->{byemail} from $emailinfo->{libemail} to notice new status $emailinfo->{status} for $emailinfo->{title} / $emailinfo->{author}"; } +sub findsuggestion_from_biblionumber { + my ($dbh,$biblionumber) = @_; + my $sth = $dbh->prepare("select suggestionid from suggestions where biblionumber=?"); + $sth->execute($biblionumber); + my ($biblionumber) = $sth->fetchrow; + return $biblionumber; +} + =back =head1 SEE ALSO diff --git a/acqui/addorder.pl b/acqui/addorder.pl index ef8cbee0fb..6b2804c45b 100755 --- a/acqui/addorder.pl +++ b/acqui/addorder.pl @@ -99,23 +99,12 @@ if ($quantity ne '0'){ }); # change suggestion status if applicable if ($suggestionid) { - changestatus($suggestionid,'ORDERED'); + changestatus($suggestionid,'ORDERED','',$bibnum); } } else { $bibnum=$input->param('biblio'); $bibitemnum=$input->param('bibitemnum'); my $oldtype=$input->param('oldtype'); -# &modbibitem({biblioitemnumber => $bibitemnum, -# isbn => $isbn, -# publishercode => $publishercode, -# }); -# &modbiblio({ -# biblionumber => $bibnum, -# title => $title?$title:"", -# author => $author?$author:"", -# copyrightdate => $copyrightdate?$copyrightdate:"", -# series => $series?$series:"" }, -# ); } if ($ordnum) { # warn "MODORDER $title / $ordnum / $quantity / $bookfund"; diff --git a/koha-tmpl/intranet-tmpl/default/en/suggestion/mail_suggestion_AVAILABLE.tmpl b/koha-tmpl/intranet-tmpl/default/en/suggestion/mail_suggestion_AVAILABLE.tmpl index edc4a02f39..46550c0dd2 100644 --- a/koha-tmpl/intranet-tmpl/default/en/suggestion/mail_suggestion_AVAILABLE.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/suggestion/mail_suggestion_AVAILABLE.tmpl @@ -2,7 +2,7 @@ Dear user, You have suggested that the library acquire by . -We are pleased to inform you that the item is now part of the collection of the Nelsonville Public Library. +We are pleased to inform you that the item is now part of the collection of the library. If you have any questions, please email us at . -- 2.39.5