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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/notices.tt (-44 / +10 lines)
Lines 7-16 Link Here
7
[% PROCESS 'i18n.inc' %]
7
[% PROCESS 'i18n.inc' %]
8
[% SET footerjs = 1 %]
8
[% SET footerjs = 1 %]
9
[% INCLUDE 'doc-head-open.inc' %]
9
[% INCLUDE 'doc-head-open.inc' %]
10
[% PROCESS "patron-search.inc" %]
11
[% SET libraries = Branches.all %]
12
[% SET categories = Categories.all.unblessed %]
13
[% SET columns = ['name', 'cardnumber', 'dateofbirth', 'category', 'branch', 'address', 'phone'] %]
14
<title>[% FILTER collapse %]
10
<title>[% FILTER collapse %]
15
    [% t("Notices management") | html %] &rsaquo;
11
    [% t("Notices management") | html %] &rsaquo;
16
    [% t("Tools") | html %] &rsaquo;
12
    [% t("Tools") | html %] &rsaquo;
Lines 50-58 Link Here
50
46
51
                <h1>Notices management</h1>
47
                <h1>Notices management</h1>
52
48
53
                <div class="dialog message">Printing a notice will mark it as sent.</div>
49
                <div class="page-section bg-warning">Printing a notice will mark it as sent.</div>
50
51
                [% IF notices.count == 0 %]
52
53
                <div class="page-section bg-info">
54
                    No sent notices were found with those search parameters.
55
                </div>
56
57
                [% ELSE %]
54
58
55
                [% IF notices && notices.count > 0 %]
56
                <div class="page-section">
59
                <div class="page-section">
57
                    <span id="checkbox_actions"><a href="#" class="select_all"><i class="fa fa-check"></i> Select all</a> | <a href="#" class="clear_all"><i class="fa fa-remove"></i> Clear all</a></span>
60
                    <span id="checkbox_actions"><a href="#" class="select_all"><i class="fa fa-check"></i> Select all</a> | <a href="#" class="clear_all"><i class="fa fa-remove"></i> Clear all</a></span>
58
                    <form id="print_multiple" action="/cgi-bin/koha/tools/print_notice.pl" method="post" target="_blank">
61
                    <form id="print_multiple" action="/cgi-bin/koha/tools/print_notice.pl" method="post" target="_blank">
Lines 92-121 Link Here
92
                    </form>
95
                    </form>
93
                </div>
96
                </div>
94
97
95
                [% ELSE %]
96
97
                    Use the search form on the left to find sent notices, or go directly to a patron's notices.
98
99
                    [% WRAPPER tabs id= "notices_patronsearch" %]
100
                        [% WRAPPER tabs_nav %]
101
                            [% WRAPPER tab_item tabname= "notices_patronsearch_pane" bt_active= 1 %] <span>Patrons</span> [% END %]
102
                        [% END %]
103
                        [% WRAPPER tab_panels %]
104
                            [% WRAPPER tab_panel tabname="notices_patronsearch_pane" bt_active= 1 %]
105
                                [% PROCESS patron_search_filters_simple %]
106
                                [% PROCESS patron_search_table table_id => 'table_borrowers', open_on_row_click => 1 %]
107
                            [% END %]
108
                        [% END %]
109
                    [% END %]
110
111
                    [% IF notices && notices.count == 0 %]
112
113
                    <div class="dialog message">
114
                        No sent notices were found with those search parameters.
115
                    </div>
116
117
                    [% END %]
118
119
                [% END %]
98
                [% END %]
120
99
121
            </main>
100
            </main>
Lines 124-132 Link Here
124
        <div class="col-md-2 order-md-1 order-sm-1">
103
        <div class="col-md-2 order-md-1 order-sm-1">
125
            <aside>
104
            <aside>
126
                <fieldset class="sidebar brief">
105
                <fieldset class="sidebar brief">
127
                    <form id="notices-search" action="/cgi-bin/koha/tools/notices.pl" method="post">
106
                    <form id="notices-search" action="/cgi-bin/koha/tools/notices.pl" method="get">
128
                        [% INCLUDE 'csrf-token.inc' %]
129
                        <input type="hidden" name="op" value="cud-search">
130
                        <h3>Search filters</h3>
107
                        <h3>Search filters</h3>
131
                        <ol>
108
                        <ol>
132
                            <li>
109
                            <li>
Lines 248-254 Link Here
248
    [% INCLUDE 'datatables.inc' %]
225
    [% INCLUDE 'datatables.inc' %]
249
226
250
    <script>
227
    <script>
251
        table_settings = [% TablesSettings.GetColumns( 'circ', 'circulation', 'table_borrowers', 'json' ) | $raw %];
252
        $(document).ready(function() {
228
        $(document).ready(function() {
253
            $("#notices").dataTable($.extend(true, {}, dataTablesDefaults, {
229
            $("#notices").dataTable($.extend(true, {}, dataTablesDefaults, {
254
                "aoColumnDefs": [
230
                "aoColumnDefs": [
Lines 273-285 Link Here
273
                $("#noticeModal .modal-body").html("");
249
                $("#noticeModal .modal-body").html("");
274
            });
250
            });
275
251
276
            $("#notices_patronsearch").on("submit", filter);
277
            [% UNLESS notices %]
278
                [% IF ( Koha.Preference('PatronAutoComplete') ) %]
279
                    patron_autocomplete($(".search_patron_filter"), { 'link-to': 'notices' });
280
                [% END %]
281
            [% END %]
282
283
            $("#print_multiple_button").click(function(e){
252
            $("#print_multiple_button").click(function(e){
284
                var selected_notices = $("#print_multiple").find("input[name='message_ids']:checked");
253
                var selected_notices = $("#print_multiple").find("input[name='message_ids']:checked");
285
                if ( selected_notices.length == 0 ) {
254
                if ( selected_notices.length == 0 ) {
Lines 304-312 Link Here
304
            });
273
            });
305
        });
274
        });
306
    </script>
275
    </script>
307
308
    [% SET search_results_block_id = 'notices_patronsearch_pane_panel' %] [%# adjusting variable for patron-search.inc %]
309
    [% PROCESS patron_search_js table_id => 'table_borrowers', categories => categories, libraries => libraries, columns => columns, open_on_row_click => 1, on_click_url => '/cgi-bin/koha/members/notices.pl?', redirect_if_one_result => 1, redirect_url => '/cgi-bin/koha/members/notices.pl?', redirect_if_attribute_equal => 'cardnumber' %]
310
[% END %]
276
[% END %]
311
277
312
[% INCLUDE 'intranet-bottom.inc' %]
278
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/tools/notices.pl (-38 / +35 lines)
Lines 39-85 unless ( C4::Context->preference('NoticesManagement') ) { Link Here
39
39
40
my $op = $query->param('op');
40
my $op = $query->param('op');
41
41
42
if ( $op and $op eq 'cud-search' ) {
42
my $letter_code  = $query->param('letter_code')  || undef;
43
    my $letter_code  = $query->param('letter_code')  || undef;
43
my $categorycode = $query->param('categorycode') || undef;
44
    my $categorycode = $query->param('categorycode') || undef;
44
my $branchcode   = $query->param('branchcode')   || undef;
45
    my $branchcode   = $query->param('branchcode')   || undef;
45
my $from         = $query->param('from')         || undef;
46
    my $from         = $query->param('from')         || undef;
46
my $to           = $query->param('to')           || undef;
47
    my $to           = $query->param('to')           || undef;
47
my $status       = $query->param('status')       || undef;
48
    my $status       = $query->param('status')       || undef;
49
48
50
    my %where = ();
49
my %where = ();
51
    $where{'me.letter_code'}              = $letter_code  if ($letter_code);
50
$where{'me.letter_code'}              = $letter_code  if ($letter_code);
52
    $where{'borrowernumber.categorycode'} = $categorycode if ($categorycode);
51
$where{'borrowernumber.categorycode'} = $categorycode if ($categorycode);
53
    $where{'borrowernumber.branchcode'}   = $branchcode   if ($branchcode);
52
$where{'borrowernumber.branchcode'}   = $branchcode   if ($branchcode);
54
    if ($from) {
53
if ($from) {
55
        if ($to) {
54
    if ($to) {
56
            $where{'me.time_queued'} = [
55
        $where{'me.time_queued'} = [
57
                -and => { '<=', $to },
56
            -and => { '<=', $to },
58
                { '>=', $from }
57
            { '>=', $from }
59
            ];
58
        ];
60
        } else {
59
    } else {
61
            $where{'me.time_queued'} = { '>=', $from };
60
        $where{'me.time_queued'} = { '>=', $from };
62
        }
63
    } elsif ($to) {
64
        $where{'me.time_queued'} = { '<=', $to };
65
    }
61
    }
66
    $where{'me.status'} = $status if ($status);
62
} elsif ($to) {
63
    $where{'me.time_queued'} = { '<=', $to };
64
}
65
$where{'me.status'} = $status if ($status);
67
66
68
    my $notices = Koha::Notice::Messages->search_limited(
67
my $notices = Koha::Notice::Messages->search_limited(
69
        {%where},
68
    {%where},
70
        { order_by => { -desc => 'time_queued' } }
69
    { order_by => { -desc => 'time_queued' } }
71
    );
70
);
72
71
73
    $template->param(
72
$template->param(
74
        notices      => $notices,
73
    notices      => $notices,
75
        letter_code  => $letter_code,
74
    letter_code  => $letter_code,
76
        categorycode => $categorycode,
75
    categorycode => $categorycode,
77
        branchcode   => $branchcode,
76
    branchcode   => $branchcode,
78
        from         => $from,
77
    from         => $from,
79
        to           => $to,
78
    to           => $to,
80
        status       => $status,
79
    status       => $status,
81
    );
80
);
82
}
83
81
84
$template->param(
82
$template->param(
85
    letters => Koha::Notice::Templates->search(
83
    letters => Koha::Notice::Templates->search(
86
- 

Return to bug 33260