From f4c5322ba047aae19cf81b0cc53d09e9089bd87d Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Fri, 15 Dec 2023 16:20:58 +0000 Subject: [PATCH] Bug 35570: (QA follow-up): Follow QA script on Standard backend Make QA script green, fix: - Variables declared in condition - Use of DateTime->now should certainly be replaced with dt_from_string (bug 24840) - missing_filter - forbidden pattern: Do not use line breaks inside template tags (bug 18675) - Attribute type should not be used for script tags (bug 20053) - File must have the exec flag - forbidden pattern: trailing space char - valid_template: /shared-includes/custom_fields.inc: not found Signed-off-by: David Nind --- Koha/ILL/Backend/Standard.pm | 27 +-- Koha/ILL/Backend/intra-includes/cancel.inc | 7 +- Koha/ILL/Backend/intra-includes/confirm.inc | 7 +- Koha/ILL/Backend/intra-includes/create.inc | 24 +-- Koha/ILL/Backend/intra-includes/edititem.inc | 162 +++++++++--------- Koha/ILL/Backend/intra-includes/migrate.inc | 8 +- Koha/ILL/Backend/opac-includes/create.inc | 12 +- .../Backend/shared-includes/custom_fields.inc | 4 +- .../Backend/shared-includes/forms/article.inc | 20 +-- .../Backend/shared-includes/forms/book.inc | 20 +-- .../Backend/shared-includes/forms/chapter.inc | 26 +-- .../shared-includes/forms/conference.inc | 22 +-- .../Backend/shared-includes/forms/journal.inc | 12 +- .../shared-includes/forms/resource.inc | 24 +-- .../Backend/shared-includes/forms/thesis.inc | 10 +- about.pl | 2 +- .../data/mysql/atomicupdate/bug_35570.pl | 1 - 17 files changed, 195 insertions(+), 193 deletions(-) mode change 100644 => 100755 installer/data/mysql/atomicupdate/bug_35570.pl diff --git a/Koha/ILL/Backend/Standard.pm b/Koha/ILL/Backend/Standard.pm index 748680ad1a6..95c4eec858b 100644 --- a/Koha/ILL/Backend/Standard.pm +++ b/Koha/ILL/Backend/Standard.pm @@ -22,9 +22,10 @@ use DateTime; use File::Basename qw( dirname ); use C4::Installer; +use Koha::DateUtils qw/ dt_from_string /; use Koha::ILL::Requests; use Koha::ILL::Request::Attribute; -use C4::Biblio qw( AddBiblio ); +use C4::Biblio qw( AddBiblio ); use C4::Charset qw( MarcToUTF8Record ); =head1 NAME @@ -225,7 +226,7 @@ sub create { }; } elsif ( $stage eq 'form' ) { - # We may be recieving a submitted form due to an additional + # We may be receiving a submitted form due to an additional # custom field being added or deleted, or the material type # having been changed, so check for these things if ( !_can_create_request($other) ) { @@ -383,7 +384,7 @@ sub edititem { }; } elsif ( $stage eq 'form' ) { - # We may be recieving a submitted form due to an additional + # We may be receiving a submitted form due to an additional # custom field being added or deleted, or the material type # having been changed, so check for these things if ( defined $other->{'add_new_custom'} @@ -452,7 +453,7 @@ sub edititem { # ...Update Illrequest my $request = $params->{request}; - $request->updated( DateTime->now ); + $request->updated( dt_from_string() ); $request->store; # ...Populate Illrequestattributes @@ -638,7 +639,7 @@ sub migrate { my $core_fields = _get_core_string(); - # We may be recieving a submitted form due to an additional + # We may be receiving a submitted form due to an additional # custom field being added or deleted, or the material type # having been changed, so check for these things if ( defined $other->{'add_new_custom'} @@ -679,7 +680,7 @@ sub migrate { }; } - # Recieve a new request from another backend and suppliment it with + # Receive a new request from another backend and supplement it with # anything we require specifically for this backend. if ( !$stage || $stage eq 'immigrate' ) { my $original_request = Koha::ILL::Requests->find( $other->{illrequest_id} ); @@ -688,8 +689,8 @@ sub migrate { $new_request->branchcode( $original_request->branchcode ); $new_request->status('NEW'); $new_request->backend( $self->name ); - $new_request->placed( DateTime->now ); - $new_request->updated( DateTime->now ); + $new_request->placed( dt_from_string() ); + $new_request->updated( dt_from_string() ); $new_request->store; my @default_attributes = (qw/title type author year volume isbn issn article_title article_author pages/); @@ -972,8 +973,8 @@ sub add_request { $request->branchcode( $params->{other}->{branchcode} ); $request->status('NEW'); $request->backend( $params->{other}->{backend} ); - $request->placed( DateTime->now ); - $request->updated( DateTime->now ); + $request->placed( dt_from_string() ); + $request->updated( dt_from_string() ); $request->batch_id( $params->{other}->{ill_batch_id} ? $params->{other}->{ill_batch_id} : $params->{other}->{batch_id} ) if column_exists( 'illrequests', 'batch_id' ); @@ -1151,9 +1152,9 @@ sub _standard_request2biblio { return 0 unless $metadata->{type} eq 'book'; # We're going to try and populate author, title & ISBN - my $author = $metadata->{author} if $metadata->{author}; - my $title = $metadata->{title} if $metadata->{title}; - my $isbn = $metadata->{isbn} if $metadata->{isbn}; + my $author = $metadata->{author} // ''; + my $title = $metadata->{title} // ''; + my $isbn = $metadata->{isbn} // ''; # Create the MARC::Record object and populate my $record = MARC::Record->new(); diff --git a/Koha/ILL/Backend/intra-includes/cancel.inc b/Koha/ILL/Backend/intra-includes/cancel.inc index 6c107abb304..99301ffbf4c 100644 --- a/Koha/ILL/Backend/intra-includes/cancel.inc +++ b/Koha/ILL/Backend/intra-includes/cancel.inc @@ -9,9 +9,8 @@

If you can confirm this has been done, please proceed.

[% base_url = "/cgi-bin/koha/ill/ill-requests.pl" %] - [% proceed_url = base_url _ "?method=cancel&stage=confirm" _ - "&illrequest_id=" _ request.illrequest_id %] - Revert request - Cancel + [% proceed_url = base_url _ "?method=cancel&stage=confirm" _ "&illrequest_id=" _ request.illrequest_id %] + Revert request + Cancel

[% END %] diff --git a/Koha/ILL/Backend/intra-includes/confirm.inc b/Koha/ILL/Backend/intra-includes/confirm.inc index dcd003752e3..099c5d6a67b 100644 --- a/Koha/ILL/Backend/intra-includes/confirm.inc +++ b/Koha/ILL/Backend/intra-includes/confirm.inc @@ -9,10 +9,9 @@

If you can confirm this has been done, please proceed.

[% base_url = "/cgi-bin/koha/ill/ill-requests.pl" %] - [% proceed_url = base_url _ "?method=confirm&stage=confirm" _ - "&illrequest_id=" _ request.illrequest_id %] - Confirm request - Cancel + [% proceed_url = base_url _ "?method=confirm&stage=confirm" _ "&illrequest_id=" _ request.illrequest_id %] + Confirm request + Cancel

[% ELSE %]

Unknown stage. This should not have happened. diff --git a/Koha/ILL/Backend/intra-includes/create.inc b/Koha/ILL/Backend/intra-includes/create.inc index 162d88749f9..7655644d508 100644 --- a/Koha/ILL/Backend/intra-includes/create.inc +++ b/Koha/ILL/Backend/intra-includes/create.inc @@ -15,7 +15,7 @@ [% IF whole.stage == "form" %]

Create a manual ILL request

-
+
General details
    @@ -93,8 +93,8 @@ @@ -110,7 +110,7 @@ [% BLOCK backend_jsinclude %] - [% END %] - [% INCLUDE "${cwd}/shared-includes/custom_fields.inc" %] -
    - - Cancel -
    - - - - - -[% BLOCK backend_jsinclude %] - -[% END %] +[% ELSE %] +

    Unknown stage. This should not have happened. +[% END %] \ No newline at end of file diff --git a/Koha/ILL/Backend/intra-includes/migrate.inc b/Koha/ILL/Backend/intra-includes/migrate.inc index dfef8bd390c..ea85d7e1e8c 100644 --- a/Koha/ILL/Backend/intra-includes/migrate.inc +++ b/Koha/ILL/Backend/intra-includes/migrate.inc @@ -14,7 +14,7 @@ [% IF whole.stage == "form" %]

    Migrating an ILL request

    -
    +
    General details
      @@ -92,8 +92,8 @@ @@ -106,7 +106,7 @@
    [% BLOCK backend_jsinclude %] -