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

(-)a/C4/Calendar.pm (-1 / +1 lines)
Lines 90-96 sub GetWeeklyEvents { Link Here
90
            (open_hour = 0 AND open_minute = 0 AND close_hour = 0 AND close_minute = 0) AS closed
90
            (open_hour = 0 AND open_minute = 0 AND close_hour = 0 AND close_minute = 0) AS closed
91
        FROM calendar_repeats
91
        FROM calendar_repeats
92
        WHERE branchcode = ? AND weekday IS NOT NULL
92
        WHERE branchcode = ? AND weekday IS NOT NULL
93
    }, { Slice => {} }, $branchcode ); 
93
    }, { Slice => {} }, $branchcode );
94
}
94
}
95
95
96
=head2 GetYearlyEvents
96
=head2 GetYearlyEvents
(-)a/Koha/Calendar.pm (-4 / +4 lines)
Lines 36-42 sub _init { Link Here
36
            (open_hour = 0 AND open_minute = 0 AND close_hour = 0 AND close_minute = 0) AS closed
36
            (open_hour = 0 AND open_minute = 0 AND close_hour = 0 AND close_minute = 0) AS closed
37
        FROM calendar_repeats
37
        FROM calendar_repeats
38
        WHERE branchcode = ? AND weekday IS NOT NULL
38
        WHERE branchcode = ? AND weekday IS NOT NULL
39
    }, 'weekday', { Slice => {} }, $branch ); 
39
    }, 'weekday', { Slice => {} }, $branch );
40
40
41
    my $day_month_hours = $dbh->selectall_arrayref( q{
41
    my $day_month_hours = $dbh->selectall_arrayref( q{
42
        SELECT
42
        SELECT
Lines 111-117 sub addHours { Link Here
111
            my $day_len = $hours->{open_time} - $base_date;
111
            my $day_len = $hours->{open_time} - $base_date;
112
112
113
            if ( DateTime::Duration->compare( $day_len, $hours_duration, $base_date ) > 0 ) {
113
            if ( DateTime::Duration->compare( $day_len, $hours_duration, $base_date ) > 0 ) {
114
                if ( $self->{days_mode} eq 'Calendar' ) { 
114
                if ( $self->{days_mode} eq 'Calendar' ) {
115
                    return $hours->{open_time};
115
                    return $hours->{open_time};
116
                }
116
                }
117
117
Lines 140-146 sub addHours { Link Here
140
            my $day_len = $hours->{close_time} - $base_date;
140
            my $day_len = $hours->{close_time} - $base_date;
141
141
142
            if ( DateTime::Duration->compare( $day_len, $hours_duration, $base_date ) < 0 ) {
142
            if ( DateTime::Duration->compare( $day_len, $hours_duration, $base_date ) < 0 ) {
143
                if ( $self->{days_mode} eq 'Calendar' ) { 
143
                if ( $self->{days_mode} eq 'Calendar' ) {
144
                    return $hours->{close_time};
144
                    return $hours->{close_time};
145
                }
145
                }
146
146
Lines 356-362 sub hours_between { Link Here
356
    return $end_dt - $start_dt if ( $start_dt->ymd eq $end_dt->ymd );
356
    return $end_dt - $start_dt if ( $start_dt->ymd eq $end_dt->ymd );
357
357
358
    my $duration = DateTime::Duration->new;
358
    my $duration = DateTime::Duration->new;
359
    
359
360
    $duration->add_duration( $start_hours->{close_time} - $start_dt ) if ( $start_dt < $start_hours->{close_time} );
360
    $duration->add_duration( $start_hours->{close_time} - $start_dt ) if ( $start_dt < $start_hours->{close_time} );
361
361
362
    for (my $date = $start_dt->clone->truncate( to => 'day' )->add( days => 1 );
362
    for (my $date = $start_dt->clone->truncate( to => 'day' )->add( days => 1 );
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc (-1 / +1 lines)
Lines 87-93 Link Here
87
<h5>Additional tools</h5>
87
<h5>Additional tools</h5>
88
<ul>
88
<ul>
89
    [% IF ( CAN_user_tools_edit_calendar ) %]
89
    [% IF ( CAN_user_tools_edit_calendar ) %]
90
	<li><a href="/cgi-bin/koha/tools/calendar.pl">Calendar</a></li>
90
    <li><a href="/cgi-bin/koha/tools/calendar.pl">Calendar</a></li>
91
    [% END %]
91
    [% END %]
92
    [% IF ( CAN_user_tools_manage_csv_profiles ) %]
92
    [% IF ( CAN_user_tools_manage_csv_profiles ) %]
93
	<li><a href="/cgi-bin/koha/tools/csv-profiles.pl">CSV profiles</a></li>
93
	<li><a href="/cgi-bin/koha/tools/csv-profiles.pl">CSV profiles</a></li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/calendar.tt (-26 / +24 lines)
Lines 5-13 Link Here
5
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'doc-head-close.inc' %]
6
[% INCLUDE 'calendar.inc' %]
6
[% INCLUDE 'calendar.inc' %]
7
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
7
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
8
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
8
[% INCLUDE 'datatables.inc' %]
9
[% INCLUDE 'datatables-strings.inc' %]
10
<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
11
<script language="JavaScript" type="text/javascript">
9
<script language="JavaScript" type="text/javascript">
12
//<![CDATA[
10
//<![CDATA[
13
    [% IF (dateformat == 'metric') %]dt_add_type_uk_date();[% END %]
11
    [% IF (dateformat == 'metric') %]dt_add_type_uk_date();[% END %]
Lines 89-95 Link Here
89
        $('#showWeekday:first').val(weekDay);
87
        $('#showWeekday:first').val(weekDay);
90
        $('#showTitle').val(event.title);
88
        $('#showTitle').val(event.title);
91
        $('#showEventType').val(event.eventType);
89
        $('#showEventType').val(event.eventType);
92
        
90
93
        if (event.closed) {
91
        if (event.closed) {
94
            $('#showHoursTypeClosed')[0].checked = true;
92
            $('#showHoursTypeClosed')[0].checked = true;
95
        } else if (event.close_hour == 24) {
93
        } else if (event.close_hour == 24) {
Lines 97-104 Link Here
97
        } else {
95
        } else {
98
            $('#showHoursTypeOpenSet')[0].checked = true;
96
            $('#showHoursTypeOpenSet')[0].checked = true;
99
            $('#showHoursTypeOpenSet').change();
97
            $('#showHoursTypeOpenSet').change();
100
            $('#showOpenTime').val(event.open_hour + ':' + zeroPad(event.open_minute)); 
98
            $('#showOpenTime').val(event.open_hour + ':' + zeroPad(event.open_minute));
101
            $('#showCloseTime').val(event.close_hour + ':' + zeroPad(event.close_minute)); 
99
            $('#showCloseTime').val(event.close_hour + ':' + zeroPad(event.close_minute));
102
        }
100
        }
103
101
104
        $("#operationDelLabel").html(_("Delete this event."));
102
        $("#operationDelLabel").html(_("Delete this event."));
Lines 217-223 Link Here
217
            defaultDate: new Date("[% keydate %]")
215
            defaultDate: new Date("[% keydate %]")
218
        });
216
        });
219
        $(".hourssel input").change(function() {
217
        $(".hourssel input").change(function() {
220
            $(".hoursentry", this.form).toggle(this.value == 'openSet'); 
218
            $(".hoursentry", this.form).toggle(this.value == 'openSet');
221
        }).each( function() { this.checked = false } );
219
        }).each( function() { this.checked = false } );
222
    });
220
    });
223
//]]>
221
//]]>
Lines 263-269 li.hoursentry input { Link Here
263
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; [% branchname %] Calendar</div>
261
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; [% branchname %] Calendar</div>
264
262
265
<div id="doc3" class="yui-t1">
263
<div id="doc3" class="yui-t1">
266
   
264
267
   <div id="bd">
265
   <div id="bd">
268
    <div id="yui-main">
266
    <div id="yui-main">
269
    <div class="yui-b">
267
    <div class="yui-b">
Lines 280-286 li.hoursentry input { Link Here
280
                    [% END %]
278
                    [% END %]
281
                [% END %]
279
                [% END %]
282
            </select>
280
            </select>
283
    
281
284
    <!-- ******************************** FLAT PANELS ******************************************* -->
282
    <!-- ******************************** FLAT PANELS ******************************************* -->
285
    <!-- *****           Makes all the flat panel to deal with events                     ***** -->
283
    <!-- *****           Makes all the flat panel to deal with events                     ***** -->
286
    <!-- **************************************************************************************** -->
284
    <!-- **************************************************************************************** -->
Lines 299-306 li.hoursentry input { Link Here
299
            </li>
297
            </li>
300
            <li>
298
            <li>
301
                <strong>From Date:</strong>
299
                <strong>From Date:</strong>
302
                <span id="showDaynameOutput"></span>, 
300
                <span id="showDaynameOutput"></span>,
303
                
301
304
                                [% IF ( dateformat == "us" ) %]<span id="showMonthOutput"></span>/<span id="showDayOutput"></span>/<span id="showYearOutput"></span>[% ELSIF ( dateformat == "metric" ) %]<span id="showDayOutput"></span>/<span id="showMonthOutput"></span>/<span id="showYearOutput"></span>[% ELSE %]<span id="showYearOutput"></span>/<span id="showMonthOutput"></span>/<span id="showDayOutput"></span>[% END %]
302
                                [% IF ( dateformat == "us" ) %]<span id="showMonthOutput"></span>/<span id="showDayOutput"></span>/<span id="showYearOutput"></span>[% ELSIF ( dateformat == "metric" ) %]<span id="showDayOutput"></span>/<span id="showMonthOutput"></span>/<span id="showYearOutput"></span>[% ELSE %]<span id="showYearOutput"></span>/<span id="showMonthOutput"></span>/<span id="showDayOutput"></span>[% END %]
305
303
306
                <input type="hidden" id="showWeekday" name="weekday" />
304
                <input type="hidden" id="showWeekday" name="weekday" />
Lines 324-332 li.hoursentry input { Link Here
324
                <input type="time" name="closeTime" id="showCloseTime" size="3" maxlength="5" value="23:59" pattern="(0?[0-9]|1[0-9]|2[0-3]):([0-5][0-9])" />
322
                <input type="time" name="closeTime" id="showCloseTime" size="3" maxlength="5" value="23:59" pattern="(0?[0-9]|1[0-9]|2[0-3]):([0-5][0-9])" />
325
            </li>
323
            </li>
326
            <li><label for="showTitle">Title: </label><input type="text" name="title" id="showTitle" size="35" /></li>
324
            <li><label for="showTitle">Title: </label><input type="text" name="title" id="showTitle" size="35" /></li>
327
            <!-- showTitle is necessary for exception radio button to work properly --> 
325
            <!-- showTitle is necessary for exception radio button to work properly -->
328
                <label for="showDescription">Description:</label>
326
                <label for="showDescription">Description:</label>
329
                <textarea rows="2" cols="40" id="showDescription" name="description"></textarea>    
327
                <textarea rows="2" cols="40" id="showDescription" name="description"></textarea>
330
            </li>
328
            </li>
331
            <li class="radio"><input type="radio" name="op" id="showOperationDel" value="delete" /> <label for="showOperationDel" id="showOperationDelLabel">Delete this event</label>
329
            <li class="radio"><input type="radio" name="op" id="showOperationDel" value="delete" /> <label for="showOperationDel" id="showOperationDelLabel">Delete this event</label>
332
                <a href="#" class="helptext">[?]</a>
330
                <a href="#" class="helptext">[?]</a>
Lines 354-360 li.hoursentry input { Link Here
354
    <!-- ***************************** Panel to deal with new events **********************  -->
352
    <!-- ***************************** Panel to deal with new events **********************  -->
355
    <div class="panel" id="newEvent">
353
    <div class="panel" id="newEvent">
356
         <form action="/cgi-bin/koha/tools/calendar.pl" method="post">
354
         <form action="/cgi-bin/koha/tools/calendar.pl" method="post">
357
            <input type="hidden" name="branchCodes" id="branchCodes" value="[% branchcodes %]" /> 
355
            <input type="hidden" name="branchCodes" id="branchCodes" value="[% branchcodes %]" />
358
            <input type="hidden" name="op" value="save" />
356
            <input type="hidden" name="op" value="save" />
359
            <fieldset class="brief">
357
            <fieldset class="brief">
360
            <h3>Add new event</h3>
358
            <h3>Add new event</h3>
Lines 367-373 li.hoursentry input { Link Here
367
            </li>
365
            </li>
368
            <li>
366
            <li>
369
                <strong>From date:</strong>
367
                <strong>From date:</strong>
370
                <span id="newDaynameOutput"></span>, 
368
                <span id="newDaynameOutput"></span>,
371
369
372
                         [% IF ( dateformat == "us" ) %]<span id="newMonthOutput"></span>/<span id="newDayOutput"></span>/<span id="newYearOutput"></span>[% ELSIF ( dateformat == "metric" ) %]<span id="newDayOutput"></span>/<span id="newMonthOutput"></span>/<span id="newYearOutput"></span>[% ELSE %]<span id="newYearOutput"></span>/<span id="newMonthOutput"></span>/<span id="newDayOutput"></span>[% END %]
370
                         [% IF ( dateformat == "us" ) %]<span id="newMonthOutput"></span>/<span id="newDayOutput"></span>/<span id="newYearOutput"></span>[% ELSIF ( dateformat == "metric" ) %]<span id="newDayOutput"></span>/<span id="newMonthOutput"></span>/<span id="newYearOutput"></span>[% ELSE %]<span id="newYearOutput"></span>/<span id="newMonthOutput"></span>/<span id="newDayOutput"></span>[% END %]
373
371
Lines 497-517 li.hoursentry input { Link Here
497
<script type="text/javascript">
495
<script type="text/javascript">
498
  document.write(weekdays[ [% event.weekday %]]);
496
  document.write(weekdays[ [% event.weekday %]]);
499
</script>
497
</script>
500
  </td> 
498
  </td>
501
  <td>[% event.title %]</td> 
499
  <td>[% event.title %]</td>
502
  <td>[% event.description %]</td> 
500
  <td>[% event.description %]</td>
503
  <td>
501
  <td>
504
    [% IF event.closed %]
502
    [% IF event.closed %]
505
    Closed
503
    Closed
506
    [% ELSIF event.close_hour == 24 %]
504
    [% ELSIF event.close_hour == 24 %]
507
    Open
505
    Open
508
    [% ELSE %]
506
    [% ELSE %]
509
    [% event.open_hour %]:[% event.open_minute > 10 ? event.open_minute : ( '0' _ event.open_minute) %] - 
507
    [% event.open_hour %]:[% event.open_minute > 10 ? event.open_minute : ( '0' _ event.open_minute) %] -
510
    [% event.close_hour %]:[% event.close_minute > 10 ? event.close_minute : ( '0' _ event.close_minute) %]
508
    [% event.close_hour %]:[% event.close_minute > 10 ? event.close_minute : ( '0' _ event.close_minute) %]
511
    [% END %]
509
    [% END %]
512
  </td>
510
  </td>
513
  </tr>
511
  </tr>
514
  [% END %] 
512
  [% END %]
515
</tbody>
513
</tbody>
516
</table>
514
</table>
517
[% END %]
515
[% END %]
Lines 535-554 li.hoursentry input { Link Here
535
  [% FOREACH event IN yearly_events %]
533
  [% FOREACH event IN yearly_events %]
536
  <tr>
534
  <tr>
537
  <td><span title="[% event.month_day_display %]">[% event.month_day_sort %]</span></td>
535
  <td><span title="[% event.month_day_display %]">[% event.month_day_sort %]</span></td>
538
  <td>[% event.title %]</td> 
536
  <td>[% event.title %]</td>
539
  <td>[% event.description %]</td> 
537
  <td>[% event.description %]</td>
540
  <td>
538
  <td>
541
    [% IF event.closed %]
539
    [% IF event.closed %]
542
    Closed
540
    Closed
543
    [% ELSIF event.close_hour == 24 %]
541
    [% ELSIF event.close_hour == 24 %]
544
    Open
542
    Open
545
    [% ELSE %]
543
    [% ELSE %]
546
    [% event.open_hour %]:[% event.open_minute > 10 ? event.open_minute : ( '0' _ event.open_minute) %] - 
544
    [% event.open_hour %]:[% event.open_minute > 10 ? event.open_minute : ( '0' _ event.open_minute) %] -
547
    [% event.close_hour %]:[% event.close_minute > 10 ? event.close_minute : ( '0' _ event.close_minute) %]
545
    [% event.close_hour %]:[% event.close_minute > 10 ? event.close_minute : ( '0' _ event.close_minute) %]
548
    [% END %]
546
    [% END %]
549
  </td>
547
  </td>
550
  </tr>
548
  </tr>
551
  [% END %] 
549
  [% END %]
552
</tbody>
550
</tbody>
553
</table>
551
</table>
554
[% END %]
552
[% END %]
Lines 576-587 li.hoursentry input { Link Here
576
    [% ELSIF event.close_hour == 24 %]
574
    [% ELSIF event.close_hour == 24 %]
577
    Open
575
    Open
578
    [% ELSE %]
576
    [% ELSE %]
579
    [% event.open_hour %]:[% event.open_minute > 10 ? event.open_minute : ( '0' _ event.open_minute) %] - 
577
    [% event.open_hour %]:[% event.open_minute > 10 ? event.open_minute : ( '0' _ event.open_minute) %] -
580
    [% event.close_hour %]:[% event.close_minute > 10 ? event.close_minute : ( '0' _ event.close_minute) %]
578
    [% event.close_hour %]:[% event.close_minute > 10 ? event.close_minute : ( '0' _ event.close_minute) %]
581
    [% END %]
579
    [% END %]
582
  </td>
580
  </td>
583
</tr>
581
</tr>
584
  [% END %] 
582
  [% END %]
585
</tbody>
583
</tbody>
586
</table>
584
</table>
587
[% END %]
585
[% END %]
(-)a/misc/cronjobs/staticfines.pl (-1 / +1 lines)
Lines 176-182 for ( my $i = 0 ; $i < scalar(@$data) ; $i++ ) { Link Here
176
        $calendars{$branchcode} = Koha::Calendar->new( branchcode => $branchcode );
176
        $calendars{$branchcode} = Koha::Calendar->new( branchcode => $branchcode );
177
    }
177
    }
178
    $calendar = $calendars{$branchcode};
178
    $calendar = $calendars{$branchcode};
179
    my $isHoliday = $calendar->is_holiday( DateTime->new( 
179
    my $isHoliday = $calendar->is_holiday( DateTime->new(
180
        year => $tyear,
180
        year => $tyear,
181
        month => $tmonth,
181
        month => $tmonth,
182
        day => $tday
182
        day => $tday
(-)a/tools/calendar.pl (-3 / +2 lines)
Lines 4-10 Link Here
4
#
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
5
# Koha is free software; you can redistribute it and/or modify it under the
6
# terms of the GNU General Public License as published by the Free Software
6
# terms of the GNU General Public License as published by the Free Software
7
# Foundation; either version 2 of the License, or (at your option) any later
7
# Foundation; either version 3 of the License, or (at your option) any later
8
# version.
8
# version.
9
#
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
Lines 61-67 my $onlymine=(C4::Context->preference('IndependentBranches') && Link Here
61
              C4::Context->userenv &&
61
              C4::Context->userenv &&
62
              C4::Context->userenv->{flags} % 2 !=1  &&
62
              C4::Context->userenv->{flags} % 2 !=1  &&
63
              C4::Context->userenv->{branch}?1:0);
63
              C4::Context->userenv->{branch}?1:0);
64
if ( $onlymine ) { 
64
if ( $onlymine ) {
65
    $branch = C4::Context->userenv->{'branch'};
65
    $branch = C4::Context->userenv->{'branch'};
66
}
66
}
67
my $branchname = GetBranchName($branch);
67
my $branchname = GetBranchName($branch);
68
- 

Return to bug 8133