From 398b087bf2feffa41fc318aed535fddf2a79a62d Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 21 Feb 2019 06:27:02 -0500 Subject: [PATCH] Bug 14570: (QA Follow-up) Misc changes based on QA feedback --- Koha/Object.pm | 7 ++----- installer/data/mysql/atomicupdate/bug_14570.perl | 2 +- .../prog/en/modules/members/memberentrygen.tt | 2 +- misc/cronjobs/j2a.pl | 11 +++++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Koha/Object.pm b/Koha/Object.pm index 8de78d927b..04d34c49e3 100644 --- a/Koha/Object.pm +++ b/Koha/Object.pm @@ -73,11 +73,8 @@ sub new { delete $attributes->{$column_name}; } - eval { - $self->{_result} = - $schema->resultset( $class->_type() )->new($attributes); - }; - Carp::cluck("ERROR: $@") if $@; + $self->{_result} = + $schema->resultset( $class->_type() )->new($attributes); } croak("No _type found! Koha::Object must be subclassed!") diff --git a/installer/data/mysql/atomicupdate/bug_14570.perl b/installer/data/mysql/atomicupdate/bug_14570.perl index 92b26f29a9..967fd34a21 100644 --- a/installer/data/mysql/atomicupdate/bug_14570.perl +++ b/installer/data/mysql/atomicupdate/bug_14570.perl @@ -12,7 +12,7 @@ if( CheckVersion( $DBversion ) ) { PRIMARY KEY (id), CONSTRAINT r_guarantor FOREIGN KEY ( guarantor_id ) REFERENCES borrowers ( borrowernumber ) ON UPDATE CASCADE ON DELETE CASCADE, CONSTRAINT r_guarantee FOREIGN KEY ( guarantee_id ) REFERENCES borrowers ( borrowernumber ) ON UPDATE CASCADE ON DELETE CASCADE - ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; }); $dbh->do(q{ diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt index ec200302ff..54c21b43cc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -1231,7 +1231,7 @@ [% END %] [% IF guarantor %] - select_user( '[% guarantor.borrowernumber %]', [% To.json( guarantor.unblessed ) | $raw %] ); + select_user( '[% guarantor.borrowernumber %]', [% To.json( guarantor.unblessed ) | html %] ); [% END %] $("#cn_max").hide(); diff --git a/misc/cronjobs/j2a.pl b/misc/cronjobs/j2a.pl index d66b80ad18..a63666be39 100755 --- a/misc/cronjobs/j2a.pl +++ b/misc/cronjobs/j2a.pl @@ -129,7 +129,9 @@ if ( not $fromcat && $tocat ) { #make sure we've specified the info we need. cronlogaction(); -my $dbh = C4::Context->dbh; +my $dbh = C4::Context->dbh; +my $database = Koha::Database->new(); +my $schema = $database->schema; #get today's date, format it and subtract upperagelimit my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = @@ -166,7 +168,6 @@ my $itsyourbirthday = "$year-$mon-$mday"; if ( not $noaction ) { # Start a transaction since we need to delete from relationships and update borrowers atomically - $dbh->{AutoCommit} = 0; my $success = 1; if ($mybranch) { #yep, we received a specific branch to work on. @@ -183,6 +184,8 @@ if ( not $noaction ) { ) |; + $schema->storage->txn_begin; + my $query = qq| DELETE relationships FROM relationships LEFT JOIN borrowers ON ( borrowers.borrowernumber = relationships.guarantee_id ) @@ -202,9 +205,9 @@ if ( not $noaction ) { or $success = 0; if ( $success ) { - $dbh->commit; + $schema->storage->txn_commit; } else { - $dbh->rollback; + $schema->storage->txn_rollback; die "can't execute"; } -- 2.20.1 (Apple Git-117)