[Koha-cvs] Changes to koha/C4/Suggestions.pm [rel_2_2]

paul poulain paul at koha-fr.org
Thu Dec 1 18:27:57 CET 2005


Index: koha/C4/Suggestions.pm
diff -u koha/C4/Suggestions.pm:1.4.2.2 koha/C4/Suggestions.pm:1.4.2.3
--- koha/C4/Suggestions.pm:1.4.2.2	Fri Aug 26 12:21:49 2005
+++ koha/C4/Suggestions.pm	Thu Dec  1 17:27:55 2005
@@ -1,6 +1,6 @@
 package C4::Suggestions;
 
-# $Id: Suggestions.pm,v 1.4.2.2 2005/08/26 12:21:49 hdl Exp $
+# $Id: Suggestions.pm,v 1.4.2.3 2005/12/01 17:27:55 tipaul Exp $
 
 # Copyright 2000-2002 Katipo Communications
 #
@@ -64,6 +64,7 @@
 				&delsuggestion
 				&countsuggestion
 				&changestatus
+				&findsuggestion_from_biblionumber
 			);
 
 =item SearchSuggestion
@@ -191,15 +192,25 @@
 }
 
 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.
@@ -230,6 +241,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





More information about the Koha-cvs mailing list