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

(-)a/Koha/DiscreteCalendar.pm (-5 / +5 lines)
Lines 337-343 Returns an array of all the date objects that are unique holidays. Link Here
337
337
338
sub get_unique_holidays {
338
sub get_unique_holidays {
339
    my $self = shift;
339
    my $self = shift;
340
    my $exclude_past = shift || 1;
340
    my $exclude_past = shift // 1;
341
    my $branchcode = $self->{branchcode};
341
    my $branchcode = $self->{branchcode};
342
    my @unique_holidays;
342
    my @unique_holidays;
343
    my $schema = Koha::Database->new->schema;
343
    my $schema = Koha::Database->new->schema;
Lines 377-383 Returns an array of all the date objects that are float holidays. Link Here
377
377
378
sub get_float_holidays {
378
sub get_float_holidays {
379
    my $self = shift;
379
    my $self = shift;
380
    my $exclude_past = shift || 1;
380
    my $exclude_past = shift // 1;
381
    my $branchcode = $self->{branchcode};
381
    my $branchcode = $self->{branchcode};
382
    my @float_holidays;
382
    my @float_holidays;
383
    my $schema = Koha::Database->new->schema;
383
    my $schema = Koha::Database->new->schema;
Lines 417-423 Returns an array of all the date objects that are float holidays in need of vali Link Here
417
417
418
sub get_need_validation_holidays {
418
sub get_need_validation_holidays {
419
    my $self = shift;
419
    my $self = shift;
420
    my $exclude_past = shift || 1;
420
    my $exclude_past = shift // 1;
421
    my $branchcode = $self->{branchcode};
421
    my $branchcode = $self->{branchcode};
422
    my @need_validation_holidays;
422
    my @need_validation_holidays;
423
    my $schema = Koha::Database->new->schema;
423
    my $schema = Koha::Database->new->schema;
Lines 457-463 Returns an array of all the date objects that are repeatable holidays. Link Here
457
457
458
sub get_repeatable_holidays {
458
sub get_repeatable_holidays {
459
    my $self = shift;
459
    my $self = shift;
460
    my $exclude_past = shift || 1;
460
    my $exclude_past = shift // 1;
461
    my $branchcode = $self->{branchcode};
461
    my $branchcode = $self->{branchcode};
462
    my @repeatable_holidays;
462
    my @repeatable_holidays;
463
    my $schema = Koha::Database->new->schema;
463
    my $schema = Koha::Database->new->schema;
Lines 497-503 Returns an array of all the date objects that are weekly holidays. Link Here
497
497
498
sub get_week_days_holidays {
498
sub get_week_days_holidays {
499
    my $self = shift;
499
    my $self = shift;
500
    my $exclude_past = shift || 1;
500
    my $exclude_past = shift // 1;
501
    my $branchcode = $self->{branchcode};
501
    my $branchcode = $self->{branchcode};
502
    my @week_days;
502
    my @week_days;
503
    my $schema = Koha::Database->new->schema;
503
    my $schema = Koha::Database->new->schema;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/discrete_calendar.tt (-7 / +52 lines)
Lines 225-231 Link Here
225
                        <div id="holiday-list">
225
                        <div id="holiday-list">
226
                            [% IF ( NEED_VALIDATION_HOLIDAYS ) %]
226
                            [% IF ( NEED_VALIDATION_HOLIDAYS ) %]
227
                            <h3>Need validation holidays</h3>
227
                            <h3>Need validation holidays</h3>
228
                            <table id="holidaysvalidation">
228
                            <table id="holidaysvalidation" class="dataTable no-footer">
229
                                <thead>
229
                                <thead>
230
                                    <tr>
230
                                    <tr>
231
                                        <th class="validation">Date</th>
231
                                        <th class="validation">Date</th>
Lines 247-253 Link Here
247
247
248
                            [% IF ( WEEKLY_HOLIDAYS ) %]
248
                            [% IF ( WEEKLY_HOLIDAYS ) %]
249
                            <h3>Weekly - Repeatable holidays</h3>
249
                            <h3>Weekly - Repeatable holidays</h3>
250
                            <table id="holidayweeklyrepeatable">
250
                            <table id="holidayweeklyrepeatable" class="dataTable no-footer">
251
                                <thead>
251
                                <thead>
252
                                    <tr>
252
                                    <tr>
253
                                        <th class="repeatableweekly">Day of week</th>
253
                                        <th class="repeatableweekly">Day of week</th>
Lines 269-275 Link Here
269
269
270
                            [% IF ( REPEATABLE_HOLIDAYS ) %]
270
                            [% IF ( REPEATABLE_HOLIDAYS ) %]
271
                            <h3>Yearly - Repeatable holidays</h3>
271
                            <h3>Yearly - Repeatable holidays</h3>
272
                            <table id="holidaysyearlyrepeatable">
272
                            <table id="holidaysyearlyrepeatable" class="dataTable no-footer">
273
                                <thead>
273
                                <thead>
274
                                    <tr>
274
                                    <tr>
275
                                        [% IF ( dateformat == "metric" ) %]
275
                                        [% IF ( dateformat == "metric" ) %]
Lines 299-305 Link Here
299
299
300
                            [% IF ( UNIQUE_HOLIDAYS ) %]
300
                            [% IF ( UNIQUE_HOLIDAYS ) %]
301
                            <h3>Unique holidays</h3>
301
                            <h3>Unique holidays</h3>
302
                            <table id="holidaysunique">
302
                            <label class="controls">
303
                                <input type="checkbox" name="show_past" id="show_past_holidaysunique" class="show_past" />
304
                                Show past entries
305
                            </label>
306
                            <table id="holidaysunique" class="dataTable no-footer">
303
                                <thead>
307
                                <thead>
304
                                    <tr>
308
                                    <tr>
305
                                        <th class="holiday">Date</th>
309
                                        <th class="holiday">Date</th>
Lines 309-315 Link Here
309
                                </thead>
313
                                </thead>
310
                                <tbody>
314
                                <tbody>
311
                                    [% FOREACH HOLIDAYS_LOO IN UNIQUE_HOLIDAYS %]
315
                                    [% FOREACH HOLIDAYS_LOO IN UNIQUE_HOLIDAYS %]
312
                                    <tr>
316
                                    <tr data-date="[% HOLIDAYS_LOO.date | html %]">
313
                                        <td><a href="#main" onclick="go_to_date('[% HOLIDAYS_LOO.date | html %]')"><span title="[% HOLIDAYS_LOO.DATE_SORT | html %]">[% HOLIDAYS_LOO.outputdate | html %]</span></a></td>
317
                                        <td><a href="#main" onclick="go_to_date('[% HOLIDAYS_LOO.date | html %]')"><span title="[% HOLIDAYS_LOO.DATE_SORT | html %]">[% HOLIDAYS_LOO.outputdate | html %]</span></a></td>
314
                                        <td>[% HOLIDAYS_LOO.note | html %]</td>
318
                                        <td>[% HOLIDAYS_LOO.note | html %]</td>
315
                                        <td>[% HOLIDAYS_LOO.description.replace('\\\r\\\n', '<br />') | html %]</td>
319
                                        <td>[% HOLIDAYS_LOO.description.replace('\\\r\\\n', '<br />') | html %]</td>
Lines 321-327 Link Here
321
325
322
                            [% IF ( FLOAT_HOLIDAYS ) %]
326
                            [% IF ( FLOAT_HOLIDAYS ) %]
323
                            <h3>Floating holidays</h3>
327
                            <h3>Floating holidays</h3>
324
                            <table id="holidaysfloat">
328
                            <label class="controls">
329
                                <input type="checkbox" name="show_past" id="show_past_holidaysfloat" class="show_past" />
330
                                Show past entries
331
                            </label>
332
                            <table id="holidaysfloat" class="dataTable no-footer">
325
                                <thead>
333
                                <thead>
326
                                    <tr>
334
                                    <tr>
327
                                        <th class="float">Date</th>
335
                                        <th class="float">Date</th>
Lines 331-337 Link Here
331
                                </thead>
339
                                </thead>
332
                                <tbody>
340
                                <tbody>
333
                                    [% FOREACH float_holiday IN FLOAT_HOLIDAYS %]
341
                                    [% FOREACH float_holiday IN FLOAT_HOLIDAYS %]
334
                                    <tr>
342
                                    <tr data-date="[% float_holiday.date | html %]">
335
                                        <td><a href="#main" onclick="go_to_date('[% float_holiday.date | html %]')"><span title="[% float_holiday.DATE_SORT | html %]">[% float_holiday.outputdate | html %]</span></a></td>
343
                                        <td><a href="#main" onclick="go_to_date('[% float_holiday.date | html %]')"><span title="[% float_holiday.DATE_SORT | html %]">[% float_holiday.outputdate | html %]</span></a></td>
336
                                        <td>[% float_holiday.note | html %]</td>
344
                                        <td>[% float_holiday.note | html %]</td>
337
                                        <td>[% float_holiday.description.replace('\\\r\\\n', '<br />') | html %]</td>
345
                                        <td>[% float_holiday.description.replace('\\\r\\\n', '<br />') | html %]</td>
Lines 601-606 Link Here
601
            return true;
609
            return true;
602
        }
610
        }
603
611
612
        /* Custom table search configuration: If a table row
613
            has an "expired" class, hide it UNLESS the
614
            show_expired checkbox is checked */
615
        $.fn.dataTable.ext.search.push(
616
            function( settings, searchData, index, rowData, counter ) {
617
                var table = settings.nTable.id;
618
                var row = $(settings.aoData[index].nTr);
619
                if( row.hasClass("date_past") && !$("#show_past_" + table ).prop("checked") ){
620
                    return false;
621
                } else {
622
                    return true;
623
                }
624
            }
625
        );
626
627
        // Create current date variable
628
        var date = new Date();
629
        var datestring = date.toISOString().substring(0, 10);
630
604
        $(document).ready(function() {
631
        $(document).ready(function() {
605
            $(".hint").hide();
632
            $(".hint").hide();
606
            $("#days_of_week").hide();
633
            $("#days_of_week").hide();
Lines 616-621 Link Here
616
                var first_td = $(this).find('td').first();
643
                var first_td = $(this).find('td').first();
617
                first_td.html(weekdays[first_td.html()]);
644
                first_td.html(weekdays[first_td.html()]);
618
            });
645
            });
646
            $("#holidayweeklyrepeatable").dataTable($.extend(true, {}, dataTablesDefaults, {
647
                "sDom": 't',
648
                "bPaginate": false
649
            }));
650
            var tables = $("#holidaysyearlyrepeatable, #holidaysunique, #holidaysfloat").DataTable($.extend(true, {}, dataTablesDefaults, {
651
                "sDom": 't',
652
                "bPaginate": false,
653
                "createdRow": function( row, data, dataIndex ) {
654
                    var holiday = $(row).data("date");
655
                    if( holiday < datestring ){
656
                        $(row).addClass("date_past");
657
                    }
658
                }
659
            }));
660
661
            $(".show_past").on("change", function(){
662
                tables.draw();
663
            });
619
664
620
            $("a.helptext").click(function () {
665
            $("a.helptext").click(function () {
621
                $(this).parent().find(".hint").toggle();
666
                $(this).parent().find(".hint").toggle();
(-)a/tools/discrete_calendar.pl (-3 / +2 lines)
Lines 146-154 my @week_days = $calendar->get_week_days_holidays(); Link Here
146
my @repeatable_holidays = $calendar->get_repeatable_holidays();
146
my @repeatable_holidays = $calendar->get_repeatable_holidays();
147
147
148
#discrete_calendar unique holidays
148
#discrete_calendar unique holidays
149
my @unique_holidays =$calendar->get_unique_holidays();
149
my @unique_holidays =$calendar->get_unique_holidays(0);
150
#discrete_calendar floating holidays
150
#discrete_calendar floating holidays
151
my @float_holidays =$calendar->get_float_holidays();
151
my @float_holidays =$calendar->get_float_holidays(0);
152
#discrete_caledar need validation holidays
152
#discrete_caledar need validation holidays
153
my @need_validation_holidays =$calendar->get_need_validation_holidays();
153
my @need_validation_holidays =$calendar->get_need_validation_holidays();
154
154
155
- 

Return to bug 17015