View | Details | Raw Unified | Return to bug 22907
Collapse All | Expand All

(-)a/C4/Suggestions.pm (-6 / +6 lines)
Lines 455-466 sub NewSuggestion { Link Here
455
455
456
    $suggestion->{suggesteddate} = dt_from_string unless $suggestion->{suggesteddate};
456
    $suggestion->{suggesteddate} = dt_from_string unless $suggestion->{suggesteddate};
457
457
458
    my $rs = Koha::Database->new->schema->resultset('Suggestion');
458
    my $suggestion_object = Koha::Suggestion->new( $suggestion )->store;
459
    my $new_id = $rs->create($suggestion)->id;
459
    my $suggestion_id = $suggestion_object->suggestionid;
460
460
461
    my $emailpurchasesuggestions = C4::Context->preference("EmailPurchaseSuggestions");
461
    my $emailpurchasesuggestions = C4::Context->preference("EmailPurchaseSuggestions");
462
    if ($emailpurchasesuggestions) {
462
    if ($emailpurchasesuggestions) {
463
        my $full_suggestion = GetSuggestion( $new_id );
463
        my $full_suggestion = GetSuggestion( $suggestion_id); # We should not need to refetch it!
464
        if (
464
        if (
465
            my $letter = C4::Letters::GetPreparedLetter(
465
            my $letter = C4::Letters::GetPreparedLetter(
466
                module      => 'suggestions',
466
                module      => 'suggestions',
Lines 506-512 sub NewSuggestion { Link Here
506
        }
506
        }
507
    }
507
    }
508
508
509
    return $new_id;
509
    return $suggestion_id;
510
}
510
}
511
511
512
=head2 ModSuggestion
512
=head2 ModSuggestion
Lines 543-551 sub ModSuggestion { Link Here
543
            or $suggestion->{$field} eq '' );
543
            or $suggestion->{$field} eq '' );
544
    }
544
    }
545
545
546
    my $rs = Koha::Database->new->schema->resultset('Suggestion')->find($suggestion->{suggestionid});
546
    my $suggestion_object = Koha::Suggestions->find( $suggestion->{suggestionid} );
547
    eval { # FIXME Must raise an exception instead
547
    eval { # FIXME Must raise an exception instead
548
        $rs->update($suggestion);
548
        $suggestion_object->set($suggestion)->store;
549
    };
549
    };
550
    return 0 if $@;
550
    return 0 if $@;
551
551
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt (-2 / +6 lines)
Lines 107-120 Link Here
107
    $(document).ready(function() {
107
    $(document).ready(function() {
108
        var suggestionst = $("#suggestionst").dataTable($.extend(true, {}, dataTablesDefaults, {
108
        var suggestionst = $("#suggestionst").dataTable($.extend(true, {}, dataTablesDefaults, {
109
            "aoColumnDefs": [
109
            "aoColumnDefs": [
110
                { "aTargets": [ 0 ],  "bVisible": false, "bSearchable": true }, // must be searchable for fnFilter
110
                { "aTargets": [ 0 ],  "bVisible": false, "bSearchable": false },
111
                { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
111
                { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
112
            ],
112
            ],
113
            "sPaginationType": "four_button"
113
            "sPaginationType": "four_button"
114
        }));
114
        }));
115
        $("#show_only_mine").on('click', function(e){
115
        $("#show_only_mine").on('click', function(e){
116
            e.preventDefault();
116
            e.preventDefault();
117
            //suggestionst.settings()[0].aoColumns[index].bSearchable = true;
118
            suggestionst.setColumnSearchable(0, true);
119
            suggestionst.rows().invalidate();
117
            suggestionst.fnFilter('^[% loggedinuser | html %]$', 0, true);
120
            suggestionst.fnFilter('^[% loggedinuser | html %]$', 0, true);
121
            suggestionst.setColumnSearchable(0, false);
122
            suggestionst.rows().invalidate();
118
        });
123
        });
119
        $("#show_all").on('click', function(e){
124
        $("#show_all").on('click', function(e){
120
            e.preventDefault();
125
            e.preventDefault();
121
- 

Return to bug 22907