@@ -, +, @@ --- C4/Suggestions.pm | 16 ++++++++-------- .../prog/en/modules/acqui/newordersuggestion.tt | 7 ++++++- 2 files changed, 14 insertions(+), 9 deletions(-) --- a/C4/Suggestions.pm +++ a/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,12 +541,12 @@ 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} ); my $status_update_table = 1; - eval { - $rs->update($suggestion); + eval { # FIXME Must raise an exception instead + $suggestion_object->set($suggestion)->store; }; - $status_update_table = 0 if( $@ ); + $status_update_table = 0 if( $@ ); # FIXME must return now, otherwise the letter will be sent anyway! if ( $suggestion->{STATUS} ) { --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt +++ a/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(); --