Bugzilla – Attachment 89767 Details for
Bug 22907
Cannot add new suggestion with strict SQL modes turned on
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22907: Fix new suggestion with strict sql modes
Bug-22907-Fix-new-suggestion-with-strict-sql-modes.patch (text/plain), 3.54 KB, created by
Jonathan Druart
on 2019-05-14 17:28:37 UTC
(
hide
)
Description:
Bug 22907: Fix new suggestion with strict sql modes
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2019-05-14 17:28:37 UTC
Size:
3.54 KB
patch
obsolete
>From 1d981dd3aa5a1406bea73389f240add049c150ef Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 14 May 2019 12:06:24 -0500 >Subject: [PATCH] Bug 22907: Fix new suggestion with strict sql modes > >With sql_strict_modes turned on, if you try to create a new suggestion >you will get: >Incorrect integer value: '' for column '$INT_COLUMN' at row 1 > >Test plan: >Turn on strict_sql_modes, create a new suggestion, then edit it. >--- > C4/Suggestions.pm | 12 ++++++------ > .../prog/en/modules/acqui/newordersuggestion.tt | 7 ++++++- > 2 files changed, 12 insertions(+), 7 deletions(-) > >diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm >index 9245aa4599..725382f846 100644 >--- a/C4/Suggestions.pm >+++ b/C4/Suggestions.pm >@@ -453,12 +453,12 @@ sub NewSuggestion { > > $suggestion->{suggesteddate} = dt_from_string unless $suggestion->{suggesteddate}; > >- my $rs = Koha::Database->new->schema->resultset('Suggestion'); >- my $new_id = $rs->create($suggestion)->id; >+ my $suggestion_object = Koha::Suggestion->new( $suggestion )->store; >+ my $suggestion_id = $suggestion_object->suggestionid; > > my $emailpurchasesuggestions = C4::Context->preference("EmailPurchaseSuggestions"); > if ($emailpurchasesuggestions) { >- my $full_suggestion = GetSuggestion( $new_id ); >+ my $full_suggestion = GetSuggestion( $suggestion_id); # We should not need to refetch it! > if ( > my $letter = C4::Letters::GetPreparedLetter( > module => 'suggestions', >@@ -504,7 +504,7 @@ sub NewSuggestion { > } > } > >- return $new_id; >+ return $suggestion_id; > } > > =head2 ModSuggestion >@@ -541,9 +541,9 @@ sub ModSuggestion { > or $suggestion->{$field} eq '' ); > } > >- my $rs = Koha::Database->new->schema->resultset('Suggestion')->find($suggestion->{suggestionid}); >+ my $suggestion_object = Koha::Suggestions->find( $suggestion->{suggestionid} ); > eval { # FIXME Must raise an exception instead >- $rs->update($suggestion); >+ $suggestion_object->set($suggestion)->store; > }; > return 0 if $@; > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt >index 084ae32cc4..b30f9a9a09 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt >@@ -83,14 +83,19 @@ > $(document).ready(function() { > var suggestionst = $("#suggestionst").dataTable($.extend(true, {}, dataTablesDefaults, { > "aoColumnDefs": [ >- { "aTargets": [ 0 ], "bVisible": false, "bSearchable": true }, // must be searchable for fnFilter >+ { "aTargets": [ 0 ], "bVisible": false, "bSearchable": false }, > { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }, > ], > "sPaginationType": "four_button" > })); > $("#show_only_mine").on('click', function(e){ > e.preventDefault(); >+ //suggestionst.settings()[0].aoColumns[index].bSearchable = true; >+ suggestionst.setColumnSearchable(0, true); >+ suggestionst.rows().invalidate(); > suggestionst.fnFilter('^[% loggedinuser | html %]$', 0, true); >+ suggestionst.setColumnSearchable(0, false); >+ suggestionst.rows().invalidate(); > }); > $("#show_all").on('click', function(e){ > e.preventDefault(); >-- >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 22907
:
89763
|
89764
|
89767
|
89768
|
89865
|
89872
|
89873
|
89874
|
89875
|
90168
|
90169
|
90170
|
90177
|
90178
|
90179
|
90180