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

(-)a/C4/Suggestions.pm (-6 / +6 lines)
Lines 453-464 sub NewSuggestion { Link Here
453
453
454
    $suggestion->{suggesteddate} = dt_from_string unless $suggestion->{suggesteddate};
454
    $suggestion->{suggesteddate} = dt_from_string unless $suggestion->{suggesteddate};
455
455
456
    my $rs = Koha::Database->new->schema->resultset('Suggestion');
456
    my $suggestion_object = Koha::Suggestion->new( $suggestion )->store;
457
    my $new_id = $rs->create($suggestion)->id;
457
    my $suggestion_id = $suggestion_object->suggestionid;
458
458
459
    my $emailpurchasesuggestions = C4::Context->preference("EmailPurchaseSuggestions");
459
    my $emailpurchasesuggestions = C4::Context->preference("EmailPurchaseSuggestions");
460
    if ($emailpurchasesuggestions) {
460
    if ($emailpurchasesuggestions) {
461
        my $full_suggestion = GetSuggestion( $new_id );
461
        my $full_suggestion = GetSuggestion( $suggestion_id); # We should not need to refetch it!
462
        if (
462
        if (
463
            my $letter = C4::Letters::GetPreparedLetter(
463
            my $letter = C4::Letters::GetPreparedLetter(
464
                module      => 'suggestions',
464
                module      => 'suggestions',
Lines 504-510 sub NewSuggestion { Link Here
504
        }
504
        }
505
    }
505
    }
506
506
507
    return $new_id;
507
    return $suggestion_id;
508
}
508
}
509
509
510
=head2 ModSuggestion
510
=head2 ModSuggestion
Lines 541-549 sub ModSuggestion { Link Here
541
            or $suggestion->{$field} eq '' );
541
            or $suggestion->{$field} eq '' );
542
    }
542
    }
543
543
544
    my $rs = Koha::Database->new->schema->resultset('Suggestion')->find($suggestion->{suggestionid});
544
    my $suggestion_object = Koha::Suggestions->find( $suggestion->{suggestionid} );
545
    eval { # FIXME Must raise an exception instead
545
    eval { # FIXME Must raise an exception instead
546
        $rs->update($suggestion);
546
        $suggestion_object->set($suggestion)->store;
547
    };
547
    };
548
    return 0 if $@;
548
    return 0 if $@;
549
549
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt (-2 / +6 lines)
Lines 83-96 Link Here
83
    $(document).ready(function() {
83
    $(document).ready(function() {
84
        var suggestionst = $("#suggestionst").dataTable($.extend(true, {}, dataTablesDefaults, {
84
        var suggestionst = $("#suggestionst").dataTable($.extend(true, {}, dataTablesDefaults, {
85
            "aoColumnDefs": [
85
            "aoColumnDefs": [
86
                { "aTargets": [ 0 ],  "bVisible": false, "bSearchable": true }, // must be searchable for fnFilter
86
                { "aTargets": [ 0 ],  "bVisible": false, "bSearchable": false },
87
                { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
87
                { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
88
            ],
88
            ],
89
            "sPaginationType": "four_button"
89
            "sPaginationType": "four_button"
90
        }));
90
        }));
91
        $("#show_only_mine").on('click', function(e){
91
        $("#show_only_mine").on('click', function(e){
92
            e.preventDefault();
92
            e.preventDefault();
93
            //suggestionst.settings()[0].aoColumns[index].bSearchable = true;
94
            suggestionst.setColumnSearchable(0, true);
95
            suggestionst.rows().invalidate();
93
            suggestionst.fnFilter('^[% loggedinuser | html %]$', 0, true);
96
            suggestionst.fnFilter('^[% loggedinuser | html %]$', 0, true);
97
            suggestionst.setColumnSearchable(0, false);
98
            suggestionst.rows().invalidate();
94
        });
99
        });
95
        $("#show_all").on('click', function(e){
100
        $("#show_all").on('click', function(e){
96
            e.preventDefault();
101
            e.preventDefault();
97
- 

Return to bug 22907