Lines 17-24
Link Here
|
17 |
# You should have received a copy of the GNU General Public License |
17 |
# You should have received a copy of the GNU General Public License |
18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
19 |
|
19 |
|
20 |
use strict; |
20 |
use Modern::Perl; |
21 |
use warnings; |
|
|
22 |
use CGI qw ( -utf8 ); |
21 |
use CGI qw ( -utf8 ); |
23 |
use C4::Auth; |
22 |
use C4::Auth; |
24 |
use C4::Koha; |
23 |
use C4::Koha; |
Lines 27-32
use C4::Review;
Link Here
|
27 |
use C4::Biblio; |
26 |
use C4::Biblio; |
28 |
use C4::Scrubber; |
27 |
use C4::Scrubber; |
29 |
use C4::Debug; |
28 |
use C4::Debug; |
|
|
29 |
use Koha::Reviews; |
30 |
|
30 |
|
31 |
my $query = new CGI; |
31 |
my $query = new CGI; |
32 |
my $biblionumber = $query->param('biblionumber'); |
32 |
my $biblionumber = $query->param('biblionumber'); |
Lines 43-49
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
Link Here
|
43 |
# FIXME: need to allow user to delete their own comment(s) |
43 |
# FIXME: need to allow user to delete their own comment(s) |
44 |
|
44 |
|
45 |
my $biblio = GetBiblioData($biblionumber); |
45 |
my $biblio = GetBiblioData($biblionumber); |
46 |
my $savedreview = getreview($biblionumber,$borrowernumber); |
46 |
# FIXME biblionumber, borrowernumber should be a unique key of reviews |
|
|
47 |
my $savedreview = Koha::Reviews->search({ biblionumber => $biblionumber, borrowernumber => $borrowernumber })->next; |
47 |
my ($clean, @errors); |
48 |
my ($clean, @errors); |
48 |
if (defined $review) { |
49 |
if (defined $review) { |
49 |
if ($review !~ /\S/) { |
50 |
if ($review !~ /\S/) { |
Lines 70-79
if (defined $review) {
Link Here
|
70 |
} |
71 |
} |
71 |
(@errors ) and $template->param( ERRORS=>\@errors); |
72 |
(@errors ) and $template->param( ERRORS=>\@errors); |
72 |
($cgi_debug) and $template->param(cgi_debug=>1 ); |
73 |
($cgi_debug) and $template->param(cgi_debug=>1 ); |
|
|
74 |
$review = $clean; |
75 |
$review ||= $savedreview->review if $savedreview; |
73 |
$template->param( |
76 |
$template->param( |
74 |
'biblionumber' => $biblionumber, |
77 |
'biblionumber' => $biblionumber, |
75 |
'borrowernumber' => $borrowernumber, |
78 |
'borrowernumber' => $borrowernumber, |
76 |
'review' => $clean || $savedreview->{'review'}, |
79 |
'review' => $review, |
77 |
'reviewid' => $query->param('reviewid') || 0, |
80 |
'reviewid' => $query->param('reviewid') || 0, |
78 |
'title' => $biblio->{'title'}, |
81 |
'title' => $biblio->{'title'}, |
79 |
); |
82 |
); |
80 |
- |
|
|