Bugzilla – Attachment 90387 Details for
Bug 23064
Cannot edit subscription with strict SQL modes turned on
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23064: Fix mod subscription with strict sql modes
Bug-23064-Fix-mod-subscription-with-strict-sql-mod.patch (text/plain), 5.96 KB, created by
Jonathan Druart
on 2019-06-06 17:41:10 UTC
(
hide
)
Description:
Bug 23064: Fix mod subscription with strict sql modes
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2019-06-06 17:41:10 UTC
Size:
5.96 KB
patch
obsolete
>From e53a1b961c96d3a8ae1093262b94d3a6b6d7ac88 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 6 Jun 2019 12:39:52 -0500 >Subject: [PATCH] Bug 23064: Fix mod subscription with strict sql modes > >--- > C4/Serials.pm | 68 ++++++++++++++++++++++++++++-------------------- > t/db_dependent/Serials.t | 26 +++++++++--------- > 2 files changed, 54 insertions(+), 40 deletions(-) > >diff --git a/C4/Serials.pm b/C4/Serials.pm >index e6eae860ff..477cd8010d 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -1306,37 +1306,49 @@ sub ModSubscription { > $itemtype, $previousitemtype, $mana_id > ) = @_; > >- my $dbh = C4::Context->dbh; >- my $query = "UPDATE subscription >- SET librarian=?, branchcode=?, aqbooksellerid=?, cost=?, aqbudgetid=?, >- startdate=?, periodicity=?, firstacquidate=?, irregularity=?, >- numberpattern=?, locale=?, numberlength=?, weeklength=?, monthlength=?, >- lastvalue1=?, innerloop1=?, lastvalue2=?, innerloop2=?, >- lastvalue3=?, innerloop3=?, status=?, biblionumber=?, >- callnumber=?, notes=?, letter=?, manualhistory=?, >- internalnotes=?, serialsadditems=?, staffdisplaycount=?, >- opacdisplaycount=?, graceperiod=?, location = ?, enddate=?, >- skip_serialseq=?, itemtype=?, previousitemtype=?, mana_id=? >- WHERE subscriptionid = ?"; >+ my $subscription = Koha::Subscriptions->find( $subscriptionid ); >+ return unless $subscription; > >- my $sth = $dbh->prepare($query); >- $sth->execute( >- $auser, $branchcode, $aqbooksellerid, $cost, >- $aqbudgetid, $startdate, $periodicity, $firstacquidate, >- $irregularity, $numberpattern, $locale, $numberlength, >- $weeklength, $monthlength, $lastvalue1, $innerloop1, >- $lastvalue2, $innerloop2, $lastvalue3, $innerloop3, >- $status, $biblionumber, $callnumber, $notes, >- $letter, ($manualhistory ? $manualhistory : 0), >- $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, >- $graceperiod, $location, $enddate, $skip_serialseq, >- $itemtype, $previousitemtype, $mana_id, >- $subscriptionid >- ); >- my $rows = $sth->rows; >+ $subscription->librarian($auser); >+ $subscription->branchcode($branchcode); >+ $subscription->aqbooksellerid($aqbooksellerid); >+ $subscription->cost($cost); >+ $subscription->aqbudgetid($aqbudgetid); >+ $subscription->biblionumber($biblionumber); >+ $subscription->startdate($startdate); >+ $subscription->periodicity($periodicity); >+ $subscription->numberlength($numberlength); >+ $subscription->weeklength($weeklength); >+ $subscription->monthlength($monthlength); >+ $subscription->lastvalue1($lastvalue1); >+ $subscription->innerloop1($innerloop1); >+ $subscription->lastvalue2($lastvalue2); >+ $subscription->lastvalue3($lastvalue3); >+ $subscription->innerloop3($innerloop3); >+ $subscription->status($status); >+ $subscription->notes($notes); >+ $subscription->letter($letter); >+ $subscription->firstacquidate($firstacquidate); >+ $subscription->irregularity($irregularity); >+ $subscription->numberpattern($numberpattern); >+ $subscription->locale($locale); >+ $subscription->callnumber($callnumber); >+ $subscription->manualhistory($manualhistory || 0); >+ $subscription->internalnotes($internalnotes); >+ $subscription->serialsadditems($serialsadditems); >+ $subscription->staffdisplaycount($staffdisplaycount); >+ $subscription->opacdisplaycount($opacdisplaycount); >+ $subscription->graceperiod($graceperiod); >+ $subscription->location($location); >+ $subscription->enddate($enddate); >+ $subscription->skip_serialseq($skip_serialseq); >+ $subscription->itemtype($itemtype); >+ $subscription->previousitemtype($previousitemtype); >+ $subscription->mana_id($mana_id); >+ my $modified = $subscription->store; > > logaction( "SERIAL", "MODIFY", $subscriptionid, "" ) if C4::Context->preference("SubscriptionLog"); >- return $rows; >+ return $modified; > } > > =head2 NewSubscription >diff --git a/t/db_dependent/Serials.t b/t/db_dependent/Serials.t >index c6b8e06778..f1f44eac9a 100755 >--- a/t/db_dependent/Serials.t >+++ b/t/db_dependent/Serials.t >@@ -355,10 +355,11 @@ subtest "NewSubscription" => sub { > my $subscriptionid = NewSubscription( > "", "", "", "", $budget_id, $biblionumber, > '2013-01-01', $frequency_id, "", "", "", >- "", "", "", "", "", "", >- 1, $notes,"", '2013-01-01', "", $pattern_id, >- "", "", 0, $internalnotes, 0, >- "", "", 0, "", '2013-12-31', 0 >+ "", "", "", "", "", >+ "", 1, $notes,"", '2013-01-01', "", >+ $pattern_id, "", "", 0, $internalnotes, >+ 0, "", "", 0, >+ "", '2013-12-31', 0, > ); > ok($subscriptionid, "Sending empty string instead of undef to reflect use of the interface"); > }; >@@ -367,13 +368,14 @@ subtest "ModSuscription" => sub { > plan tests => 1; > my $subscription = $builder->build_object({ class => 'Koha::Subscriptions' }); > my $modified = ModSubscription( >- "", "", "", "", $budget_id, $biblionumber, >- '2013-01-01', $frequency_id, "", "", "", >- "", "", "", "", "", "", >- 1, $notes,"", '2013-01-01', "", $pattern_id, >- "", "", 0, $internalnotes, 0, >- "", "", 0, "", '2013-12-31', $subscription->subscriptionid, >- 0 >+ "", "", "", "", $budget_id, '2013-01-01', >+ $frequency_id, '2013-01-01', "", $pattern_id, "", >+ "", "", "", "", "", >+ "", "", "", "", 1, >+ $biblionumber, "", "", "", 0, >+ "", 0, "", "", >+ 0, "", "", $subscription->subscriptionid, 0, > ); >- is($modified, 1); >+ >+ isnt($modified, 0); > }; >-- >2.11.0
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 23064
:
90386
|
90387
|
95611
|
97753
|
97754
|
99359