Bugzilla – Attachment 63749 Details for
Bug 1985
Email notification of new OPAC comments
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 1985: perlcritic
Bug-1985-perlcritic.patch (text/plain), 3.68 KB, created by
Mark Tompsett
on 2017-05-26 17:51:31 UTC
(
hide
)
Description:
Bug 1985: perlcritic
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2017-05-26 17:51:31 UTC
Size:
3.68 KB
patch
obsolete
>From dcc98dcb236d9a005d9b6ff54f7ac1260632398c Mon Sep 17 00:00:00 2001 >From: Mark Tompsett <mtompset@hotmail.com> >Date: Fri, 26 May 2017 10:16:24 -0400 >Subject: [PATCH] Bug 1985: perlcritic > >After the patch is applied: >Code is not tidy at line 1, column 1. See page 33 of PBP. (Severity: 1) >Main code has high complexity score (27) at line 1, column 1. Consider refactoring. (Severity: 3) >No package-scoped "$VERSION" variable found at line 1, column 1. See page 404 of PBP. (Severity: 2) >Regular expression without "/s" flag at line 77, column 30. See pages 240,241 of PBP. (Severity: 2) >Regular expression without "/m" flag at line 77, column 30. See page 237 of PBP. (Severity: 2) >--- > opac/opac-review.pl | 20 ++++++++++---------- > 1 file changed, 10 insertions(+), 10 deletions(-) > >diff --git a/opac/opac-review.pl b/opac/opac-review.pl >index 24f9aef..a23fc79 100755 >--- a/opac/opac-review.pl >+++ b/opac/opac-review.pl >@@ -29,16 +29,16 @@ use Koha::DateUtils; > use Koha::Review; > use Koha::Reviews; > >-my $query = new CGI; >+my $query = CGI->new; > my $biblionumber = $query->param('biblionumber'); > my $review = $query->param('review'); # if defined submit > my $reviewid = $query->param('reviewid'); # if defined edit > my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > { >- template_name => "opac-review.tt", >+ template_name => 'opac-review.tt', > query => $query, >- type => "opac", >- authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), >+ type => 'opac', >+ authnotrequired => ( C4::Context->preference('OpacPublic') ? 1 : 0 ), > } > ); > >@@ -55,7 +55,7 @@ if( !$biblio ) { > push @errors, { nobiblio => 1 }; > } elsif( $reviewid ) { # edit existing one, check on creator > $savedreview = Koha::Reviews->search({ reviewid => $reviewid, borrowernumber => $borrowernumber })->next; >- push @errors, { unauthorized => 1 } if !$savedreview; >+ if (!$savedreview) { push @errors, { unauthorized => 1 } }; > } else { # this check prevents adding multiple comments > # FIXME biblionumber, borrowernumber should be a unique key of reviews > $savedreview = Koha::Reviews->search({ biblionumber => $biblionumber, borrowernumber => $borrowernumber })->next; >@@ -63,18 +63,18 @@ if( !$biblio ) { > } > > if( !@errors && $submitting ) { >- if ($review !~ /\S/) { >+ if ($review !~ /\S/xsm) { > push @errors, {empty=>1}; > } else { > $clean = C4::Scrubber->new('comment')->scrub($review); >- if ($clean !~ /\S/) { >+ if ($clean !~ /\S/xsm) { > push @errors, {scrubbed_all=>1}; > } else { > if ($clean ne $review) { > push @errors, {scrubbed=>$clean}; > } > my $js_ok_review = $clean; >- $js_ok_review =~ s/"/"/g; # probably redundant w/ TMPL ESCAPE=JS >+ $js_ok_review =~ s/"/"/gx; # probably redundant w/ TMPL ESCAPE=JS > $template->param(clean_review=>$js_ok_review); > if ($editing) { > my $updatedreview = $savedreview->set( >@@ -103,14 +103,14 @@ if( !@errors && $submitting ) { > }); > } > >- unless (@errors){ $template->param(WINDOW_CLOSE=>1); } >+ if (@errors = 0){ $template->param(WINDOW_CLOSE=>1); } > } > } > } > (@errors ) and $template->param( ERRORS=>\@errors); > ($cgi_debug) and $template->param(cgi_debug=>1 ); > $review = $clean; >-$review ||= $savedreview->review if $savedreview; >+if ($savedreview) { $review ||= $savedreview->review; } > $template->param( > 'biblionumber' => $biblionumber, > 'borrowernumber' => $borrowernumber, >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 1985
:
33916
|
33918
|
36065
|
36516
|
36517
|
36521
|
36522
|
36613
|
36614
|
36628
|
36629
|
36643
|
36644
|
36645
|
36677
|
36678
|
36720
|
38908
|
38909
|
38910
|
39062
|
63746
|
63747
|
63748
|
63749
|
63750
|
63751
|
63752
|
63761
|
63762
|
63763
|
74760
|
74761
|
74762
|
74763
|
74764
|
74769
|
74770
|
74771
|
91190
|
91191
|
91192
|
91193
|
91194
|
91195
|
91196
|
91197
|
91198
|
91818
|
91819
|
91820
|
91821
|
91822
|
91823