This make the title field mandatory. And forces redirection to clear POST data.
---
 C4/Suggestions.pm        |   20 +++++++++++---------
 opac/opac-suggestions.pl |    2 ++
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm
index c358d7a..eed2aef 100644
--- a/C4/Suggestions.pm
+++ b/C4/Suggestions.pm
@@ -331,15 +331,17 @@ Insert a new suggestion on database with value given on 
input arg.
 
 sub NewSuggestion {
     my 
($borrowernumber,$title,$author,$publishercode,$note,$copyrightdate,$volumedesc,$publicationyear,$place,$isbn,$biblionumber,$reason)
 = @_;
-    my $dbh = C4::Context->dbh;
-    my $query = qq |
-        INSERT INTO suggestions
-            (status,suggestedby,title,author,publishercode,note,copyrightdate,
-            volumedesc,publicationyear,place,isbn,biblionumber,reason)
-        VALUES ('ASKED',?,?,?,?,?,?,?,?,?,?,?,?)
-    |;
-    my $sth = $dbh->prepare($query);
-    
$sth->execute($borrowernumber,$title,$author,$publishercode,$note,$copyrightdate,$volumedesc,$publicationyear,$place,$isbn,$biblionumber,$reason);
+    if ($title) {
+        my $dbh = C4::Context->dbh;
+        my $query = qq |
+            INSERT INTO suggestions
+                
(status,suggestedby,title,author,publishercode,note,copyrightdate,
+                volumedesc,publicationyear,place,isbn,biblionumber,reason)
+            VALUES ('ASKED',?,?,?,?,?,?,?,?,?,?,?,?)
+        |;
+        my $sth = $dbh->prepare($query);
+        
$sth->execute($borrowernumber,$title,$author,$publishercode,$note,$copyrightdate,$volumedesc,$publicationyear,$place,$isbn,$biblionumber,$reason);
+    }
 }
 
 =head2 ModStatus
diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl
index b739817..bef3e9f 100755
--- a/opac/opac-suggestions.pl
+++ b/opac/opac-suggestions.pl
@@ -84,6 +84,8 @@ if ( $op eq "add_confirm" ) {
     $place           = '';
     $isbn            = '';
     $op              = 'else';
+    
+    print $input->redirect('/cgi-bin/koha/opac-suggestions.pl');
 }
 
 if ( $op eq "delete_confirm" ) {
-- 
1.6.0.4

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha.org/mailman/listinfo/koha-patches

Reply via email to