From cf8bcb9c4aea4a35d48954556d6463eb91ca8ef1 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 789e2e044e..c6a2616ee8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -1233,7 +1233,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 5e1c097651..dacc36dd5f 100755 --- a/misc/cronjobs/j2a.pl +++ b/misc/cronjobs/j2a.pl @@ -128,7 +128,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 ) = @@ -165,7 +167,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. @@ -182,6 +183,8 @@ if ( not $noaction ) { ) |; + $schema->storage->txn_begin; + my $query = qq| DELETE relationships FROM relationships LEFT JOIN borrowers ON ( borrowers.borrowernumber = relationships.guarantee_id ) @@ -201,9 +204,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.17.2 (Apple Git-113)