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

(-)a/acqui/addorderiso2709.pl (+5 lines)
Lines 202-207 if ($op eq ""){ Link Here
202
202
203
        SetMatchedBiblionumber( $biblio->{import_record_id}, $biblionumber );
203
        SetMatchedBiblionumber( $biblio->{import_record_id}, $biblionumber );
204
204
205
        # Update suggestions
206
        my @suggestions_selected = $input->multi_param('attach_suggestion_record_' . $biblio->{import_record_id});
207
        my $suggestions = Koha::Suggestions->search({ suggestionid => { -in => \@suggestions_selected } });
208
        $suggestions->update({ biblionumber => $biblionumber });
209
205
        # Add items from MarcItemFieldsToOrder
210
        # Add items from MarcItemFieldsToOrder
206
        my @homebranches = $input->multi_param('homebranch_' . $biblio_count);
211
        my @homebranches = $input->multi_param('homebranch_' . $biblio_count);
207
        my $count = scalar @homebranches;
212
        my $count = scalar @homebranches;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/suggestions-search.inc (+105 lines)
Line 0 Link Here
1
<div id="suggestion_search_modal" class="modal" role="dialog" aria-hidden="true">
2
    <div class="modal-dialog modal-lg" style="width: 80%">
3
        <div class="modal-content">
4
            <div class="modal-header">
5
                <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">x</button>
6
                <h3 id="search_suggestions_label">
7
                    Search suggestions for order:
8
                    <span id="search_suggestion_modal_title"></span>
9
                </h3>
10
11
            </div>
12
            <div class="modal-body">
13
                <div class="suggestions_search">
14
                    <table id="suggestions_search_table" class="wrap">
15
                        <thead><tr>
16
                            <th>Title</th>
17
                            <th>Author</th>
18
                            <th>ISBN</th>
19
                            <th>Note</th>
20
                            <th>Publication info</th>
21
                            <th>Suggested by</th>
22
                            <th>Additional info</th>
23
                            <th>&nbsp;</th>
24
                        </tr></thead>
25
                    </table>
26
                </div>
27
            </div>
28
            <div class="modal-footer">
29
                <a href="#" data-dismiss="modal" aria-hidden="true" class="cancel">Close</a>
30
            </div>
31
        </div>
32
    </div>
33
</div>
34
35
<script>
36
$(document).ready(function(){
37
38
    suggestions_table = $("#suggestions_search_table").kohaTable({
39
        "ajax": {
40
            "url": "/api/v1/suggestions"
41
        },
42
        "stateSave": true,
43
        "columns": [
44
            {
45
                "data": "title",
46
                "searchable": true,
47
                "orderable": true,
48
                "max-width": "20%",
49
            },
50
            {
51
                "data": "author",
52
                "searchable": true,
53
                "orderable": true,
54
            },
55
            {
56
                "data": "isbn",
57
                "searchable": true,
58
                "orderable": true,
59
            },
60
            {
61
                "data": "note",
62
                "searchable": true,
63
                "orderable": true,
64
            },
65
            {
66
                "data": "publisher_code",
67
                "searchable": true,
68
                "orderable": true,
69
            },
70
            {
71
                "data": "suggested_by",
72
                "searchable": true,
73
                "orderable": true,
74
            },
75
            {
76
                "data": "status",
77
                "searchable": true,
78
                "orderable": true,
79
            },
80
            {
81
                "data": "suggestionid",
82
                "searchable": false,
83
                "orderable": false,
84
                "render": function( data, type, row, meta ) {
85
                    let modal_title = $("#search_suggestion_modal_title");
86
                    let import_id = modal_title.data('import_record_id');
87
                    console.log(row);
88
                    if( $("input[name^='attach_suggestion_'][value='"+row.suggestion_id+"'").length == 0 ){
89
                    let add_button = '<a class="btn btn-default btn-xs select_suggestion"';
90
                    add_button += ' data-suggestionid="' + row.suggestion_id;
91
                    add_button += '" data-title="' + row.title + ' (' + row.suggestion_id + ')' + '">';
92
                    add_button += 'Select</a>';
93
                    return add_button;
94
                    } else {
95
                    return '';
96
                    }
97
                    },
98
                },
99
            ],
100
        "autoWidth": false,
101
        }, null, 1);
102
103
    console.log(suggestions_table);
104
});
105
</script>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt (+16 lines)
Lines 25-30 Link Here
25
<body id="acq_addorderiso2709" class="acq">
25
<body id="acq_addorderiso2709" class="acq">
26
    [% INCLUDE 'header.inc' %]
26
    [% INCLUDE 'header.inc' %]
27
    [% INCLUDE 'acquisitions-search.inc' %]
27
    [% INCLUDE 'acquisitions-search.inc' %]
28
    [% INCLUDE 'suggestions-search.inc' %]
28
29
29
    <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
30
    <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
30
        <ol>
31
        <ol>
Lines 189-194 Link Here
189
                                                        <label for="sort2_record_[% biblio.import_record_id | html %]">Statistic 2: </label>
190
                                                        <label for="sort2_record_[% biblio.import_record_id | html %]">Statistic 2: </label>
190
                                                        <input id="sort2_record_[% biblio.import_record_id | html %]" type="text" size="20" name="sort2" value="[% biblio.sort2 | html %]" />
191
                                                        <input id="sort2_record_[% biblio.import_record_id | html %]" type="text" size="20" name="sort2" value="[% biblio.sort2 | html %]" />
191
                                                    </li>
192
                                                    </li>
193
                                                    <li class="suggestions">
194
                                                        <fieldset>
195
                                                            <legend>Suggestions</legend>
196
                                                            <ul id="link_suggestions_[% biblio.import_record_id | html %]">
197
                                                                [% FOREACH suggestion IN biblio.suggestions %]
198
                                                                    <li>
199
                                                                        <label for="attach_suggestion_record_[% biblio.import_record_id | html %]">Link suggestion: </label>
200
                                                                        <input name="attach_suggestion_record_[% biblio.import_record_id | html %]" value="[% suggestion.suggestionid %]" type="checkbox">
201
                                                                        <span>[% suggestion.title | html %] <em>[% suggestion.author | html %]</em> [% IF suggestion.isbn %]([% suggestion.isbn | html %])[% END %]</span>
202
                                                                    </li>
203
                                                                [% END %]
204
                                                            </ul>
205
                                                            <button type="button" class="add_suggestions btn btn-sm" data-title="[% biblio.citation | html %]" data-biblionumber="[% biblio.import_record_id | html %]">Link suggestions</button>
206
                                                        </fieldset>
207
                                                    </li>
192
                                                </ol>
208
                                                </ol>
193
                                            </div>
209
                                            </div>
194
                                            <div style="float:right">
210
                                            <div style="float:right">
(-)a/koha-tmpl/intranet-tmpl/prog/js/addorderiso2709.js (-1 / +26 lines)
Lines 11-16 $(document).ready(function() { Link Here
11
        "aaSorting": []
11
        "aaSorting": []
12
    }) );
12
    }) );
13
13
14
    $(".add_suggestions").click(function(){
15
        let the_button = $(this);
16
        let modal_title = $("#search_suggestion_modal_title");
17
        modal_title.text( the_button.data('title') );
18
        modal_title.data('import_record_id',the_button.data('biblionumber') );
19
        let the_table = $("#suggestions_search_table").DataTable();
20
        the_table.draw();
21
        $("#suggestion_search_modal").modal().show();
22
    });
23
    $("body").on("click", ".select_suggestion", function(){
24
        let suggestion_id = $(this).data('suggestionid');
25
        let import_record_id =  $("#search_suggestion_modal_title").data('import_record_id');
26
        $("ul#link_suggestions_"+import_record_id).append(`
27
            <li>
28
            <input name="attach_suggestion_record_`+import_record_id+`" type="hidden" value="`+suggestion_id+`" >
29
            <label for="attach_suggestion_record_`+import_record_id+`">Attach suggestion: </label>
30
            <span>`+$(this).data('title')+`</span>
31
            <a class="remove_suggestion">Remove</a>
32
            </li>
33
        `);
34
        $(this).remove();
35
    });
36
    $("body").on("click", ".remove_suggestion", function(){
37
        $(this).parent('li').remove();
38
    });
39
14
    checkOrderBudgets();
40
    checkOrderBudgets();
15
    var all_budget_id = $("#all_budget_id");
41
    var all_budget_id = $("#all_budget_id");
16
42
17
- 

Return to bug 31632