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

(-)a/installer/data/mysql/atomicupdate/bug_17015_part1_create_discrete_calendar.perl (+20 lines)
Line 0 Link Here
1
$DBversion = 'XXX';
2
if( CheckVersion( $DBversion ) ) {
3
    if ( !TableExists( 'discrete_calendar' ) ) {
4
        $dbh->do( qq{
5
            CREATE TABLE `discrete_calendar` (
6
                `date` datetime NOT NULL,
7
                `branchcode` varchar(10) NOT NULL,
8
                `is_opened` tinyint(1) DEFAULT 1,
9
                `holiday_type` varchar(1) DEFAULT '',
10
                `note` varchar(30) DEFAULT '',
11
                `description` mediumtext DEFAULT '',
12
                `open_hour` time NOT NULL,
13
                `close_hour` time NOT NULL,
14
                PRIMARY KEY (`branchcode`,`date`)
15
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
16
        } );
17
    }
18
19
    NewVersion( $DBversion, 17015, "New koha calendar Part 1 - Create discrete_calendar table to keep track of library day's information");
20
}
(-)a/installer/data/mysql/atomicupdate/bug_17015_part2_fill_discrete_calendar.perl (+150 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
#
4
#   Script that fills the discrete_calendar table with dates, using the other date-related tables
5
#
6
use Modern::Perl;
7
use DateTime;
8
use DateTime::Format::Strptime;
9
use Data::Dumper;
10
use Getopt::Long;
11
use C4::Context;
12
13
# Options
14
my $daysInFuture = 365;
15
16
my $dbh = C4::Context->dbh;
17
$dbh->{AutoCommit} = 0;
18
$dbh->{RaiseError} = 1;
19
20
my $currentDate = DateTime->today;
21
22
# two years ago
23
my $startDate = DateTime->new(
24
day       => $currentDate->day(),
25
month     => $currentDate->month(),
26
year      => $currentDate->year()-2,
27
time_zone => C4::Context->tz()
28
)->truncate( to => 'day' );
29
30
# a year into the future
31
my $endDate = DateTime->new(
32
day       => $currentDate->day(),
33
month     => $currentDate->month(),
34
year      => $currentDate->year(),
35
time_zone => C4::Context->tz()
36
)->truncate( to => 'day' );
37
$endDate->add(days => $daysInFuture);
38
39
# finds branches;
40
my $selectBranchesSt = 'SELECT branchname, branchcode FROM branches';
41
my $selectBranchesSth = $dbh->prepare($selectBranchesSt);
42
$selectBranchesSth->execute();
43
my @branches = ();
44
while (my @row = $selectBranchesSth->fetchrow_array ) {
45
    print "[$row[1]] $row[0]\n";
46
    push @branches, $row[1];
47
}
48
49
# finds what days are closed for each branch
50
my %repeatableHolidaysPerBranch = ();
51
my %specialHolidaysPerBranch = ();
52
my $selectWeeklySt;
53
my $selectWeeklySth;
54
55
foreach my $branch (@branches){
56
    if ( TableExists( 'repeatable_holidays' ) ) {
57
        $selectWeeklySt = 'SELECT weekday, title, day, month FROM repeatable_holidays WHERE branchcode = ?';
58
        $selectWeeklySth = $dbh->prepare($selectWeeklySt);
59
        $selectWeeklySth->execute($branch);
60
61
        my @weeklyHolidays = ();
62
63
        while ( my ($weekDay, $title, $day, $month) = $selectWeeklySth->fetchrow_array ) {
64
            push @weeklyHolidays,{weekday => $weekDay, title => $title, day => $day, month => $month};
65
66
        }
67
68
        $repeatableHolidaysPerBranch{$branch} = \@weeklyHolidays;
69
    }
70
71
    if ( TableExists( 'repeatable_holidays' ) ) {
72
        my $selectSpecialHolidayDateSt = 'SELECT day,month,year,title FROM special_holidays WHERE branchcode = ? AND isexception = 0';
73
        my $specialHolidayDatesSth = $dbh->prepare($selectSpecialHolidayDateSt);
74
        $specialHolidayDatesSth -> execute($branch);
75
        # Tranforms dates from specialHolidays table in DateTime for our new table
76
        my @specialHolidayDates = ();
77
        while ( my ($day, $month, $year, $title) = $specialHolidayDatesSth->fetchrow_array ) {
78
79
            my $specialHolidayDate = DateTime->new(
80
            day       => $day,
81
            month     => $month,
82
            year      => $year,
83
            time_zone => C4::Context->tz()
84
            )->truncate( to => 'day' );
85
            push @specialHolidayDates,{date=>$specialHolidayDate, title=> $title};
86
        }
87
88
        $specialHolidaysPerBranch{$branch} = \@specialHolidayDates;
89
    }
90
}
91
92
# Fills table with dates and sets 'is_opened' according to the branch's weekly restrictions (repeatable_holidays)
93
my $insertDateSt;
94
my $insertDateSth;
95
96
# Loop that does everything in the world
97
for (my $tempDate = $startDate->clone(); $tempDate <= $endDate;$tempDate->add(days => 1)){
98
    foreach my $branch (@branches){
99
        my $dayOfWeek = $tempDate->day_of_week;
100
        # Representation fix
101
        # DateTime object dow (1-7) where Monday is 1
102
        # Arrays are 0-based where 0 = Sunday, not 7.
103
        my $open_hour = "09:00:00";
104
        my $close_hour = "17:00:00";
105
106
        # Finds closed days
107
        my $is_opened =1;
108
        my $specialDescription = "";
109
        my $holiday_type ='';
110
        $dayOfWeek = $tempDate->day_of_week % 7;
111
        foreach my $holidayWeekDay ( @{$repeatableHolidaysPerBranch{$branch}} ) {
112
            if (defined($holidayWeekDay) && defined($holidayWeekDay->{weekday}) && $dayOfWeek == $holidayWeekDay->{weekday}) {
113
                $is_opened = 0;
114
                $specialDescription = $holidayWeekDay->{title};
115
                $holiday_type = 'W';
116
            } elsif ($holidayWeekDay->{day} && $holidayWeekDay->{month}) {
117
                my $date = DateTime->new(
118
                day       => $holidayWeekDay->{day},
119
                month     => $holidayWeekDay->{month},
120
                year      => $tempDate->year(),
121
                time_zone => C4::Context->tz()
122
                )->truncate( to => 'day' );
123
124
                if ($tempDate == $date) {
125
                    $is_opened = 0;
126
                    $specialDescription = $holidayWeekDay->{title};
127
                    $holiday_type = 'R';
128
                }
129
            }
130
        }
131
132
        foreach my $specialDate (@{$specialHolidaysPerBranch{$branch}}){
133
            if ($tempDate->datetime() eq $specialDate->{date}->datetime()) {
134
                $is_opened = 0;
135
                $specialDescription = $specialDate->{title};
136
                $holiday_type = 'E';
137
            }
138
        }
139
        #final insert statement
140
141
        $insertDateSt = 'INSERT IGNORE INTO discrete_calendar (date,branchcode,is_opened,holiday_type,note,open_hour,close_hour) VALUES (?,?,?,?,?,?,?)';
142
        $insertDateSth = $dbh->prepare($insertDateSt);
143
        $insertDateSth->execute($tempDate,$branch,$is_opened,$holiday_type,$specialDescription,$open_hour,$close_hour);
144
    }
145
}
146
147
# If everything went well we commit to the database
148
$dbh->commit();
149
$dbh->{AutoCommit} = 1;
150
$dbh->{RaiseError} = 0;
(-)a/installer/data/mysql/atomicupdate/bug_17015_part3_drop_calendar.perl (+11 lines)
Line 0 Link Here
1
$DBversion = 'XXX';
2
if( CheckVersion( $DBversion ) ) {
3
    if ( TableExists( 'repeatable_holidays' ) ) {
4
        $dbh->do( "DROP TABLE IF EXISTS `repeatable_holidays`;" );
5
    }
6
    if ( TableExists( 'special_holidays' ) ) {
7
        $dbh->do( "DROP TABLE IF EXISTS `special_holidays`;" );
8
    }
9
10
    NewVersion( $DBversion, 17015, "New koha calendar Part 3 - Drop deprecated calendar-related tables after creating and filling discrete_calendar");
11
}
(-)a/installer/data/mysql/updatedatabase.pl (-3 / +3 lines)
Lines 17806-17812 if ( CheckVersion($DBversion) ) { Link Here
17806
17806
17807
$DBversion = '16.12.00.032';
17807
$DBversion = '16.12.00.032';
17808
if ( CheckVersion($DBversion) ) {
17808
if ( CheckVersion($DBversion) ) {
17809
    require Koha::Calendar;
17809
    require Koha::DiscreteCalendar;
17810
17810
17811
    $dbh->do(
17811
    $dbh->do(
17812
        q{
17812
        q{
Lines 17839-17848 if ( CheckVersion($DBversion) ) { Link Here
17839
17839
17840
        my $expirationdate = dt_from_string( $hold->{waitingdate} );
17840
        my $expirationdate = dt_from_string( $hold->{waitingdate} );
17841
        if ( C4::Context->preference("ExcludeHolidaysFromMaxPickUpDelay") ) {
17841
        if ( C4::Context->preference("ExcludeHolidaysFromMaxPickUpDelay") ) {
17842
            my $calendar = Koha::Calendar->new(
17842
            my $calendar = Koha::DiscreteCalendar->new({
17843
                branchcode => $hold->{branchcode},
17843
                branchcode => $hold->{branchcode},
17844
                days_mode  => C4::Context->preference('useDaysMode')
17844
                days_mode  => C4::Context->preference('useDaysMode')
17845
            );
17845
            });
17846
            $expirationdate = $calendar->days_forward( $expirationdate, $max_pickup_delay );
17846
            $expirationdate = $calendar->days_forward( $expirationdate, $max_pickup_delay );
17847
        } else {
17847
        } else {
17848
            $expirationdate->add( days => $max_pickup_delay );
17848
            $expirationdate->add( days => $max_pickup_delay );
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/discrete_calendar.tt (-351 / +354 lines)
Lines 1-9 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Asset %]
2
[% USE Asset %]
3
[% USE Branches %]
3
[% USE Branches %]
4
[% PROCESS 'i18n.inc' %]
4
[% SET footerjs = 1 %]
5
[% SET footerjs = 1 %]
5
[% INCLUDE 'doc-head-open.inc' %]
6
[% INCLUDE 'doc-head-open.inc' %]
6
<title>[% Branches.GetName( branch ) | html %] calendar &rsaquo; Tools &rsaquo; Koha</title>
7
<title
8
    >[% FILTER collapse %]
9
        [% tx("{library} calendar", { library = Branches.GetName( branch ) }) | html %]
10
        &rsaquo; [% t("Tools") | html %] &rsaquo; [% t("Koha") | html %]
11
    [% END %]</title
12
>
7
[% INCLUDE 'doc-head-close.inc' %]
13
[% INCLUDE 'doc-head-close.inc' %]
8
[% Asset.css("css/calendar.css") | $raw %]
14
[% Asset.css("css/calendar.css") | $raw %]
9
</head>
15
</head>
Lines 19-383 Link Here
19
            <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
25
            <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
20
        [% END %]
26
        [% END %]
21
        [% WRAPPER breadcrumb_item bc_active= 1 %]
27
        [% WRAPPER breadcrumb_item bc_active= 1 %]
22
            <span>[% Branches.GetName( branch ) | html %] calendar</span>
28
            [% tx("{library} calendar", { library = Branches.GetName( branch ) }) | html %]
23
        [% END %]
29
        [% END %]
24
    [% END #/ WRAPPER breadcrumbs %]
30
    [% END #/ WRAPPER breadcrumbs %]
25
[% END #/ WRAPPER sub-header.inc %]
31
[% END #/ WRAPPER sub-header.inc %]
26
32
27
<div id="main" class="main container-fluid">
33
[% WRAPPER 'main-container.inc' aside='tools-menu' %]
28
    <div class="row">
34
    [% IF no_branch_selected %]
29
        <div class="col-sm-10 col-sm-push-2">
35
    <div class="dialog alert">
30
            <main>
36
        <strong>No library set!</strong>
31
                [% IF no_branch_selected %]
37
    </div>
32
                <div class="dialog alert">
38
    [% END %]
33
                    <strong>No library set!</strong>
39
34
                </div>
40
    [% UNLESS datesInfos %]
35
                [% END %]
41
    <div class="dialog alert">
36
42
        <strong>Error!</strong> You have to run add_days_discrete_calendar.pl in order to use Discrete Calendar.
37
                [% UNLESS datesInfos %]
43
    </div>
38
                <div class="dialog alert">
44
    [% END %]
39
                    <strong>Error!</strong> You have to run add_days_discrete_calendar.pl in order to use Discrete Calendar.
45
40
                </div>
46
    [% IF date_format_error %]
41
                [% END %]
47
    <div class="dialog alert">
48
        <strong>Error!</strong> Date format error. Please try again.
49
    </div>
50
    [% END %]
51
52
    [% IF cannot_edit_past_dates %]
53
    <div class="alert alert-danger">
54
        <strong>Error!</strong> You cannot edit the past. The date '[% error_date | html %]' was out of range for the requested action.
55
    </div>
56
    [% END %]
57
58
    <h1>[% tx("{library} calendar", { library = Branches.GetName( branch ) }) | html %]</h1>
42
59
43
                [% IF date_format_error %]
60
    <div class="row">
44
                <div class="dialog alert">
61
        <div class="col-sm-6">
45
                    <strong>Error!</strong> Date format error. Please try again.
62
            <div class="page-section">
46
                </div>
63
                <label for="branch">Define the holidays for:</label>
47
                [% END %]
64
                <form id="copyCalendar-form" method="post">
48
65
                    [% INCLUDE 'csrf-token.inc' %]
49
                [% IF cannot_edit_past_dates %]
66
                    <select id="branch" name="branch">
50
                <div class="alert alert-danger">
67
                        [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
51
                    <strong>Error!</strong> You cannot edit the past. The date '[% error_date | html %]' was out of range for the requested action.
68
                    </select>
52
                </div>
69
                    <label for="newBranch">Copy calendar to</label>
53
                [% END %]
70
                    <select id='newBranch' name ='newBranch'>
54
71
                        <option value=""></option>
55
                <h1>[% Branches.GetName( branch ) | html %] calendar</h1>
72
                        [% FOREACH l IN Branches.all() %]
56
73
                            [% UNLESS branch == l.branchcode %]
57
                <div class="row">
74
                            <option value="[% l.branchcode | html %]">[% l.branchname | html %]</option>
58
                    <div class="col-sm-6">
75
                            [% END %]
59
                        <div class="page-section">
76
                        [% END %]
60
                            <label for="branch">Define the holidays for:</label>
77
                    </select>
61
                            <form id="copyCalendar-form" method="post">
78
                    <input type="hidden" name="action" value="copyBranch" />
62
                                <select id="branch" name="branch">
79
                    <input type="submit" class="btn btn-primary" value="Clone">
63
                                    [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
80
                </form>
64
                                </select>
81
65
                                Copy calendar to
82
                <h3>Calendar information</h3>
66
                                <select id='newBranch' name ='newBranch'>
83
67
                                    <option value=""></option>
84
                <div class="calendar">
68
                                    [% FOREACH l IN Branches.all() %]
85
                    <span id="calendar-anchor"></span>
69
                                        [% UNLESS branch == l.branchcode %]
86
70
                                        <option value="[% l.branchcode | html %]">[% l.branchname | html %]</option>
87
                    <!-- ***************************** Panel to deal with new holidays ********************** -->
88
                    <div class="panel newHoliday" id="newHoliday">
89
                        <form id="newHoliday-form" method="post">
90
                            [% INCLUDE 'csrf-token.inc' %]
91
                            <fieldset class="brief">
92
                                <h3>Edit date details</h3>
93
                                <span id="holtype"></span>
94
                                <ol>
95
                                    <li>
96
                                        <strong>Library:</strong>
97
                                        <span id="newBranchNameOutput"></span>
98
                                        <input type="hidden" id="branch" name="branch" value="[% branch | html %]" />
99
                                    </li>
100
                                    <li>
101
                                        <strong>From date:</strong>
102
                                        <span id="newDaynameOutput"></span>,
103
104
                                        [% IF ( dateformat == "us" ) %]
105
                                            <span id="newMonthOutput"></span>/<span id="newDayOutput"></span>/<span id="newYearOutput"></span>
106
                                        [% ELSIF ( dateformat == "metric" ) %]
107
                                            <span id="newDayOutput"></span>/<span id="newMonthOutput"></span>/<span id="newYearOutput"></span>
108
                                        [% ELSIF ( dateformat == "dmydot" ) %]
109
                                            <span id="newDayOutput"></span>.<span id="newMonthOutput"></span>.<span id="newYearOutput"></span>
110
                                        [% ELSE %]
111
                                            <span id="newYearOutput"></span>/<span id="newMonthOutput"></span>/<span id="newDayOutput"></span>
71
                                        [% END %]
112
                                        [% END %]
72
                                    [% END %]
113
73
                                </select>
114
                                        <input type="hidden" id="newDayname" name="showDayname" />
74
                                <input type="hidden" name="action" value="copyBranch" />
115
                                        <input type="hidden" id="Day" name="Day" />
75
                                <input type="submit" value="Clone">
116
                                        <input type="hidden" id="Month" name="Month" />
76
                            </form>
117
                                        <input type="hidden" id="Year" name="Year" />
77
118
                                    </li>
78
                            <h3>Calendar information</h3>
119
                                    <li class="dateinsert">
79
120
                                        <strong>To date:</strong>
80
                            <div class="calendar">
121
                                        <input type="text" id="to_date_flatpickr" size="20" />
81
                                <span id="calendar-anchor"></span>
122
                                    </li>
82
123
                                    <li>
83
                                <!-- ***************************** Panel to deal with new holidays ********************** -->
124
                                        <label for="title">Title: </label>
84
                                <div class="panel newHoliday" id="newHoliday">
125
                                        <input type="text" name="Title" id="title" size="35" />
85
                                    <form id="newHoliday-form" method="post">
126
                                    </li>
86
                                        <fieldset class="brief">
127
                                    <li>
87
                                            <h3>Edit date details</h3>
128
                                        <label for="description">Description: </label>
88
                                            <span id="holtype"></span>
129
                                        <textarea id="description" name="description" rows="2" cols="40"></textarea>
130
                                    </li>
131
                                    <li id="holidayType">
132
                                        <label for="holidayType">Date type</label>
133
                                        <select name ='holidayType'>
134
                                            <option value="empty"></option>
135
                                            <option value="none">Working day</option>
136
                                            <option value="E">Unique holiday</option>
137
                                            <option value="W">Weekly holiday</option>
138
                                            <option value="R">Repeatable holiday</option>
139
                                            <option value="F">Floating holiday</option>
140
                                            <option value="N" disabled>Need validation</option>
141
                                        </select>
142
                                        <a href="#" class="helptext">[?]</a>
143
                                        <div class="hint">
89
                                            <ol>
144
                                            <ol>
90
                                                <li>
145
                                                <li><strong>Working day:</strong> the library is open on that day.</li>
91
                                                    <strong>Library:</strong>
146
                                                <li><strong>Unique holiday:</strong> make a single holiday. For example, selecting August 1, 2012 will make it a holiday, but will not affect August 1 in other years.</li>
92
                                                    <span id="newBranchNameOutput"></span>
147
                                                <li><strong>Weekly holiday:</strong> make this weekday a holiday, every week. For example, if your library is closed on Saturdays, use this option to make every Saturday a holiday.</li>
93
                                                    <input type="hidden" id="branch" name="branch" value="[% branch | html %]" />
148
                                                <li><strong>Repeatable holiday:</strong> this will take this day and month as a reference to make it a holiday. Through this option, you can repeat this rule for every year. For example, selecting August 1 will make August 1 a holiday every year.</li>
94
                                                </li>
149
                                                <li><strong>Floating holiday:</strong> this will take this day and month as a reference to make it a floating holiday. Through this option, you can add a holiday that repeats every year but not necessarily on the exact same day. On subsequent years the date will need validation.</li>
95
                                                <li>
150
                                                <li><strong>Need validation:</strong> this holiday has been added automatically, but needs to be validated.</li>
96
                                                    <strong>From date:</strong>
97
                                                    <span id="newDaynameOutput"></span>,
98
99
                                                    [% IF ( dateformat == "us" ) %]
100
                                                        <span id="newMonthOutput"></span>/<span id="newDayOutput"></span>/<span id="newYearOutput"></span>
101
                                                    [% ELSIF ( dateformat == "metric" ) %]
102
                                                        <span id="newDayOutput"></span>/<span id="newMonthOutput"></span>/<span id="newYearOutput"></span>
103
                                                    [% ELSIF ( dateformat == "dmydot" ) %]
104
                                                        <span id="newDayOutput"></span>.<span id="newMonthOutput"></span>.<span id="newYearOutput"></span>
105
                                                    [% ELSE %]
106
                                                        <span id="newYearOutput"></span>/<span id="newMonthOutput"></span>/<span id="newDayOutput"></span>
107
                                                    [% END %]
108
109
                                                    <input type="hidden" id="newDayname" name="showDayname" />
110
                                                    <input type="hidden" id="Day" name="Day" />
111
                                                    <input type="hidden" id="Month" name="Month" />
112
                                                    <input type="hidden" id="Year" name="Year" />
113
                                                </li>
114
                                                <li class="dateinsert">
115
                                                    <strong>To date:</strong>
116
                                                    <input type="text" id="to_date_flatpickr" size="20" />
117
                                                </li>
118
                                                <li>
119
                                                    <label for="title">Title: </label>
120
                                                    <input type="text" name="Title" id="title" size="35" />
121
                                                </li>
122
                                                <li>
123
                                                    <label for="description">Description: </label>
124
                                                    <textarea id="description" name="description" rows="2" cols="40"></textarea>
125
                                                </li>
126
                                                <li id="holidayType">
127
                                                    <label for="holidayType">Date type</label>
128
                                                    <select name ='holidayType'>
129
                                                        <option value="empty"></option>
130
                                                        <option value="none">Working day</option>
131
                                                        <option value="E">Unique holiday</option>
132
                                                        <option value="W">Weekly holiday</option>
133
                                                        <option value="R">Repeatable holiday</option>
134
                                                        <option value="F">Floating holiday</option>
135
                                                        <option value="N" disabled>Need validation</option>
136
                                                    </select>
137
                                                    <a href="#" class="helptext">[?]</a>
138
                                                    <div class="hint">
139
                                                        <ol>
140
                                                            <li><strong>Working day:</strong> the library is open on that day.</li>
141
                                                            <li><strong>Unique holiday:</strong> make a single holiday. For example, selecting August 1, 2012 will make it a holiday, but will not affect August 1 in other years.</li>
142
                                                            <li><strong>Weekly holiday:</strong> make this weekday a holiday, every week. For example, if your library is closed on Saturdays, use this option to make every Saturday a holiday.</li>
143
                                                            <li><strong>Repeatable holiday:</strong> this will take this day and month as a reference to make it a holiday. Through this option, you can repeat this rule for every year. For example, selecting August 1 will make August 1 a holiday every year.</li>
144
                                                            <li><strong>Floating holiday:</strong> this will take this day and month as a reference to make it a floating holiday. Through this option, you can add a holiday that repeats every year but not necessarily on the exact same day. On subsequent years the date will need validation.</li>
145
                                                            <li><strong>Need validation:</strong> this holiday has been added automatically, but needs to be validated.</li>
146
                                                        </ol>
147
                                                    </div>
148
                                                </li>
149
                                                <li id="days_of_week">
150
                                                    <label for="day_of_week">Week day</label>
151
                                                    <select name ='day_of_week'>
152
                                                        <option value="everyday">Everyday</option>
153
                                                        <option value="1">Sundays</option>
154
                                                        <option value="2">Mondays</option>
155
                                                        <option value="3">Tuesdays</option>
156
                                                        <option value="4">Wednesdays</option>
157
                                                        <option value="5">Thursdays</option>
158
                                                        <option value="6">Fridays</option>
159
                                                        <option value="7">Saturdays</option>
160
                                                    </select>
161
                                                </li>
162
                                                <li class="radio" id="deleteType">
163
                                                    <input type="checkbox" name="deleteType" id="deleteType_checkbox" value="1" ><label for="deleteType_checkbox"> Delete this type</label>
164
                                                    <a href="#" class="helptext">[?]</a>
165
                                                    <div class="hint">Remove all repeated or weekly holidays of the selected date or week day <br> if working day is selected.</div>
166
                                                </li>
167
                                                <li>
168
                                                    <label for="openHour">Open hours: </label><input type="text" name="openHour" id='openHour' />
169
                                                </li>
170
                                                <li>
171
                                                    <label for="closeHour">Close hours: </label><input type="text" name="closeHour" id='closeHour' />
172
                                                </li>
173
                                                <li class="radio">
174
                                                    <input type="radio" name="action" id="EditRadioButton" value="edit" checked/>
175
                                                    <label for="EditRadioButton">Edit selected dates</label>
176
                                                </li>
177
                                                <li class="radio">
178
                                                    <input type="radio" name="action" id="CopyRadioButton" value="copyDates" />
179
                                                    <label for="CopyRadioButton">Copy to different dates</label>
180
                                                </li>
181
                                                <li class="CopyDatePanel">
182
                                                    <label>From:</label>
183
                                                    <input type="text" id="copyto_from_flatpickr" size="20"/>
184
                                                    <label>To:</label>
185
                                                    <input type="text" id="copyto_to_flatpickr" size="20"/>
186
                                                </li>
187
                                                <li class="checkbox">
188
                                                    <input type="checkbox" name="all_branches" id="all_branches" />
189
                                                    <label for="all_branches">Copy to all libraries</label>.
190
                                                    <a href="#" class="helptext">[?]</a>
191
                                                    <div class="hint">If checked, this holiday will be copied to all libraries.</div>
192
                                                </li>
193
                                            </ol>
151
                                            </ol>
194
152
                                        </div>
195
                                            <!-- These yyyy-mm-dd -->
196
                                            <input type="hidden" name="from_date" id='from_date'>
197
                                            <input type="hidden" name="to_date" id='to_date'>
198
                                            <input type="hidden" name="copyto_from" id='copyto_from'>
199
                                            <input type="hidden" name="copyto_to" id='copyto_to'>
200
                                            <input type="hidden" name="daysnumber" id='daysnumber'>
201
                                            <input type="hidden" name="local_today" id='local_today'>
202
203
                                            <fieldset class="action">
204
                                                <input type="submit" name="submit" value="Save" />
205
                                                <a href="#" class="cancel hidePanel newHoliday">Cancel</a>
206
                                            </fieldset>
207
                                        </fieldset>
208
                                    </form>
209
                                </div>
210
                            </div>
211
                        </div> <!-- /.page-section -->
212
                    </div> <!-- /.col-sm-6 -->
213
214
                    <div class="col-sm-6">
215
                        <div class="page-section">
216
                            <div class="help">
217
                                <h4>Hints</h4>
218
                                <ul>
219
                                    <li>Search in the calendar the day you want to set as holiday.</li>
220
                                    <li>Click the date to add or edit a holiday.</li>
221
                                    <li>Enter a title and description for the holiday.</li>
222
                                    <li>Specify how the holiday should repeat.</li>
223
                                    <li>Click Save to finish.</li>
224
                                    <li>PS:
225
                                        <ul>
226
                                            <li>Past dates cannot be changed</li>
227
                                            <li>Weekly holidays change open/close hours for all the days affected unless inputs are empty</li>
228
                                        </ul>
229
                                    </li>
153
                                    </li>
230
                                </ul>
154
                                    <li id="days_of_week">
231
                                <h4>Key</h4>
155
                                        <label for="day_of_week">Week day</label>
232
                                <p>
156
                                        <select name ='day_of_week'>
233
                                    <span class="key normalday">Working day</span>
157
                                            <option value="everyday">Everyday</option>
234
                                    <span class="key holiday">Unique holiday</span>
158
                                            <option value="1">Sundays</option>
235
                                    <span class="key repeatableweekly">Holiday repeating weekly</span>
159
                                            <option value="2">Mondays</option>
236
                                    <span class="key repeatableyearly">Holiday repeating yearly</span>
160
                                            <option value="3">Tuesdays</option>
237
                                    <span class="key float">Floating holiday</span>
161
                                            <option value="4">Wednesdays</option>
238
                                    <span class="key exception">Need validation</span>
162
                                            <option value="5">Thursdays</option>
239
                                </p>
163
                                            <option value="6">Fridays</option>
240
                            </div> <!-- /#help -->
164
                                            <option value="7">Saturdays</option>
241
165
                                        </select>
242
                            <div id="holiday-list">
166
                                    </li>
243
                                [% IF ( NEED_VALIDATION_HOLIDAYS ) %]
167
                                    <li class="radio" id="deleteType">
244
                                <h3>Need validation holidays</h3>
168
                                        <input type="checkbox" name="deleteType" id="deleteType_checkbox" value="1" ><label for="deleteType_checkbox"> Delete this type</label>
245
                                <table id="holidayexceptions" class="dataTable no-footer">
169
                                        <a href="#" class="helptext">[?]</a>
246
                                    <thead>
170
                                        <div class="hint">Remove all repeated or weekly holidays of the selected date or week day <br> if working day is selected.</div>
247
                                        <tr>
171
                                    </li>
248
                                            <th class="exception">Date</th>
172
                                    <li>
249
                                            <th class="exception">Title</th>
173
                                        <label for="openHour">Open hours: </label><input type="text" name="openHour" id='openHour' />
250
                                            <th class="exception">Description</th>
174
                                    </li>
251
                                        </tr>
175
                                    <li>
252
                                    </thead>
176
                                        <label for="closeHour">Close hours: </label><input type="text" name="closeHour" id='closeHour' />
253
                                    <tbody>
177
                                    </li>
254
                                        [% FOREACH need_validation_holiday IN NEED_VALIDATION_HOLIDAYS %]
178
                                    <li class="radio">
255
                                        <tr>
179
                                        <input type="radio" name="action" id="EditRadioButton" value="edit" checked/>
256
                                            <td><a href="#main" onclick="go_to_date('[% need_validation_holiday.date | html %]')"><span title="[% need_validation_holiday.DATE_SORT | html %]">[% need_validation_holiday.outputdate | html %]</span></a></td>
180
                                        <label for="EditRadioButton">Edit selected dates</label>
257
                                            <td>[% need_validation_holiday.note | html %]</td>
181
                                    </li>
258
                                            <td>[% need_validation_holiday.description.replace('\\\r\\\n', '<br />') | html %]</td>
182
                                    <li class="radio">
259
                                        </tr>
183
                                        <input type="radio" name="action" id="CopyRadioButton" value="copyDates" />
260
                                        [% END %]
184
                                        <label for="CopyRadioButton">Copy to different dates</label>
261
                                    </tbody>
185
                                    </li>
262
                                </table> <!-- /#holidayexceptions -->
186
                                    <li class="CopyDatePanel">
263
                                [% END # /IF ( EXCEPTION_HOLIDAYS_LOOP ) %]
187
                                        <label>From:</label>
264
188
                                        <input type="text" id="copyto_from_flatpickr" size="20"/>
265
                                [% IF ( WEEKLY_HOLIDAYS ) %]
189
                                        <label>To:</label>
266
                                <h3>Weekly - Repeatable holidays</h3>
190
                                        <input type="text" id="copyto_to_flatpickr" size="20"/>
267
                                <table id="holidayweeklyrepeatable" class="dataTable no-footer">
191
                                    </li>
268
                                    <thead>
192
                                    <li class="checkbox">
269
                                        <tr>
193
                                        <input type="checkbox" name="all_branches" id="all_branches" />
270
                                            <th class="repeatableweekly">Day of week</th>
194
                                        <label for="all_branches">Copy to all libraries</label>.
271
                                            <th class="repeatableweekly">Title</th>
195
                                        <a href="#" class="helptext">[?]</a>
272
                                            <th class="repeatableweekly">Description</th>
196
                                        <div class="hint">If checked, this holiday will be copied to all libraries.</div>
273
                                        </tr>
197
                                    </li>
274
                                    </thead>
198
                                </ol>
275
                                    <tbody>
199
276
                                        [% FOREACH WEEK_DAYS_LOO IN WEEKLY_HOLIDAYS %]
200
                                <!-- These yyyy-mm-dd -->
277
                                        <tr>
201
                                <input type="hidden" name="from_date" id='from_date'>
278
                                            <td>[% WEEK_DAYS_LOO.weekday | html %]</td>
202
                                <input type="hidden" name="to_date" id='to_date'>
279
                                            <td>[% WEEK_DAYS_LOO.note | html %]</td>
203
                                <input type="hidden" name="copyto_from" id='copyto_from'>
280
                                            <td>[% WEEK_DAYS_LOO.description.replace('\\\r\\\n', '<br />') | html %]</td>
204
                                <input type="hidden" name="copyto_to" id='copyto_to'>
281
                                        </tr>
205
                                <input type="hidden" name="daysnumber" id='daysnumber'>
282
                                        [% END %]
206
                                <input type="hidden" name="local_today" id='local_today'>
283
                                    </tbody>
207
284
                                </table> <!-- /#holidayweeklyrepeatable -->
208
                                <fieldset class="action">
285
                                [% END # / IF ( WEEKLY_HOLIDAYS ) %]
209
                                    <input type="submit" name="submit" class="btn btn-primary" value="Save" />
286
210
                                    <a href="#" class="cancel hidePanel newHoliday">Cancel</a>
287
                                [% IF ( REPEATABLE_HOLIDAYS ) %]
211
                                </fieldset>
288
                                <h3>Yearly - Repeatable holidays</h3>
212
                            </fieldset>
289
                                <table id="holidaysyearlyrepeatable" class="dataTable no-footer">
213
                        </form>
290
                                    <thead>
214
                    </div>
291
                                        <tr>
215
                </div>
292
                                            [% IF ( dateformat == "metric" ) %]
216
            </div> <!-- /.page-section -->
293
                                            <th class="repeatableyearly">Day/month</th>
217
        </div> <!-- /.col-sm-6 -->
294
                                            [% ELSE %]
218
295
                                            <th class="repeatableyearly">Month/day</th>
219
        <div class="col-sm-6">
296
                                            [% END %]
220
            <div class="page-section">
297
                                            <th class="repeatableyearly">Title</th>
221
                <div class="help">
298
                                            <th class="repeatableyearly">Description</th>
222
                    <h4>Hints</h4>
299
                                        </tr>
223
                    <ul>
300
                                    </thead>
224
                        <li>Search in the calendar the day you want to set as holiday.</li>
301
                                    <tbody>
225
                        <li>Click the date to add or edit a holiday.</li>
302
                                        [% FOREACH DAY_MONTH_HOLIDAYS_LOO IN REPEATABLE_HOLIDAYS %]
226
                        <li>Enter a title and description for the holiday.</li>
303
                                        <tr>
227
                        <li>Specify how the holiday should repeat.</li>
304
                                            [% IF ( dateformat == "metric" ) %]
228
                        <li>Click Save to finish.</li>
305
                                            <td><span title="[% DAY_MONTH_HOLIDAYS_LOO.DATE_SORT | html %]">[% DAY_MONTH_HOLIDAYS_LOO.day | html %]/[% DAY_MONTH_HOLIDAYS_LOO.month | html %]</span></td>
229
                        <li>PS:
306
                                            [% ELSE %]
230
                            <ul>
307
                                            <td><span title="[% DAY_MONTH_HOLIDAYS_LOO.DATE_SORT | html %]">[% DAY_MONTH_HOLIDAYS_LOO.month | html %]/[% DAY_MONTH_HOLIDAYS_LOO.day | html %]</span></td>
231
                                <li>Past dates cannot be changed</li>
308
                                            [% END %]
232
                                <li>Weekly holidays change open/close hours for all the days affected unless inputs are empty</li>
309
                                            <td>[% DAY_MONTH_HOLIDAYS_LOO.note | html %]</td>
233
                            </ul>
310
                                            <td>[% DAY_MONTH_HOLIDAYS_LOO.description.replace('\\\r\\\n', '<br />') | html %]</td>
234
                        </li>
311
                                        </tr>
235
                    </ul>
312
                                        [% END %]
236
                    <h4>Key</h4>
313
                                    </tbody>
237
                    <p>
314
                                </table> <!-- /#holidaysyearlyrepeatable -->
238
                        <span class="key normalday">Working day</span>
315
                                [% END # /IF ( REPEATABLE_HOLIDAYS ) %]
239
                        <span class="key holiday">Unique holiday</span>
316
240
                        <span class="key repeatableweekly">Holiday repeating weekly</span>
317
                                [% IF ( UNIQUE_HOLIDAYS ) %]
241
                        <span class="key repeatableyearly">Holiday repeating yearly</span>
318
                                <h3>Unique holidays</h3>
242
                        <span class="key float">Floating holiday</span>
319
                                <label class="controls">
243
                        <span class="key exception">Need validation</span>
320
                                    <input type="checkbox" name="show_past" id="show_past_holidaysunique" class="show_past" />
244
                    </p>
321
                                    Show past entries
245
                </div> <!-- /#help -->
322
                                </label>
246
323
                                <table id="holidaysunique" class="dataTable no-footer">
247
                <div id="holiday-list">
324
                                    <thead>
248
                    [% IF ( NEED_VALIDATION_HOLIDAYS ) %]
325
                                        <tr>
249
                    <h3>Need validation holidays</h3>
326
                                            <th class="holiday">Date</th>
250
                    <table id="holidayexceptions" class="dataTable no-footer">
327
                                            <th class="holiday">Title</th>
251
                        <thead>
328
                                            <th class="holiday">Description</th>
252
                            <tr>
329
                                        </tr>
253
                                <th class="exception">Date</th>
330
                                    </thead>
254
                                <th class="exception">Title</th>
331
                                    <tbody>
255
                                <th class="exception">Description</th>
332
                                        [% FOREACH HOLIDAYS_LOO IN UNIQUE_HOLIDAYS %]
256
                            </tr>
333
                                        <tr data-date="[% HOLIDAYS_LOO.date | html %]">
257
                        </thead>
334
                                            <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>
258
                        <tbody>
335
                                            <td>[% HOLIDAYS_LOO.note | html %]</td>
259
                            [% FOREACH need_validation_holiday IN NEED_VALIDATION_HOLIDAYS %]
336
                                            <td>[% HOLIDAYS_LOO.description.replace('\\\r\\\n', '<br />') | html %]</td>
260
                            <tr>
337
                                        </tr>
261
                                <td>
338
                                        [% END %]
262
                                    <a href="#main" onclick="go_to_date('[% need_validation_holiday.date | html %]')"><span title="[% need_validation_holiday.DATE_SORT | html %]">[% need_validation_holiday.outputdate | html %]</span></a>
339
                                    </tbody>
263
                                </td>
340
                                </table> <!-- /#holidaysunique -->
264
                                <td>[% need_validation_holiday.note | html %]</td>
341
                                [% END # /IF ( UNIQUE_HOLIDAYS ) %]
265
                                <td>[% need_validation_holiday.description.replace('\\\r\\\n', '<br />') | html %]</td>
342
266
                            </tr>
343
                                [% IF ( FLOAT_HOLIDAYS ) %]
267
                            [% END %]
344
                                <h3>Floating holidays</h3>
268
                        </tbody>
345
                                <label class="controls">
269
                    </table> <!-- /#holidayexceptions -->
346
                                    <input type="checkbox" name="show_past" id="show_past_holidaysfloat" class="show_past" />
270
                    [% END # /IF ( EXCEPTION_HOLIDAYS_LOOP ) %]
347
                                    Show past entries
271
348
                                </label>
272
                    [% IF ( WEEKLY_HOLIDAYS ) %]
349
                                <table id="holidaysfloat" class="dataTable no-footer">
273
                    <h3>Weekly - Repeatable holidays</h3>
350
                                    <thead>
274
                    <table id="holidayweeklyrepeatable" class="dataTable no-footer">
351
                                        <tr>
275
                        <thead>
352
                                            <th class="float">Date</th>
276
                            <tr>
353
                                            <th class="float">Title</th>
277
                                <th class="repeatableweekly">Day of week</th>
354
                                            <th class="float">Description</th>
278
                                <th class="repeatableweekly">Title</th>
355
                                        </tr>
279
                                <th class="repeatableweekly">Description</th>
356
                                    </thead>
280
                            </tr>
357
                                    <tbody>
281
                        </thead>
358
                                        [% FOREACH float_holiday IN FLOAT_HOLIDAYS %]
282
                        <tbody>
359
                                        <tr data-date="[% float_holiday.date | html %]">
283
                            [% FOREACH WEEK_DAYS_LOO IN WEEKLY_HOLIDAYS %]
360
                                            <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>
284
                            <tr>
361
                                            <td>[% float_holiday.note | html %]</td>
285
                                <td>[% WEEK_DAYS_LOO.weekday | html %]</td>
362
                                            <td>[% float_holiday.description.replace('\\\r\\\n', '<br />') | html %]</td>
286
                                <td>[% WEEK_DAYS_LOO.note | html %]</td>
363
                                        </tr>
287
                                <td>[% WEEK_DAYS_LOO.description.replace('\\\r\\\n', '<br />') | html %]</td>
364
                                        [% END %]
288
                            </tr>
365
                                    </tbody>
289
                            [% END %]
366
                                </table> <!-- /#holidaysfloat -->
290
                        </tbody>
367
                                [% END # /IF ( FLOAT_HOLIDAYS ) %]
291
                    </table> <!-- /#holidayweeklyrepeatable -->
368
                            </div> <!-- /#holiday-list -->
292
                    [% END # / IF ( WEEKLY_HOLIDAYS ) %]
369
                        </div> <!-- /.page-section -->
293
370
                    </div> <!-- /.col-sm-6 -->
294
                    [% IF ( REPEATABLE_HOLIDAYS ) %]
371
                </div> <!-- /.row -->
295
                    <h3>Yearly - Repeatable holidays</h3>
372
            </main>
296
                    <table id="holidaysyearlyrepeatable" class="dataTable no-footer">
373
        </div> <!-- /.col-sm-10.col-sm-push-2 -->
297
                        <thead>
374
298
                            <tr>
375
        <div class="col-sm-2 col-sm-pull-10">
299
                                [% IF ( dateformat == "metric" ) %]
376
            <aside>
300
                                <th class="repeatableyearly">Day/month</th>
377
                [% INCLUDE 'tools-menu.inc' %]
301
                                [% ELSE %]
378
            </aside>
302
                                <th class="repeatableyearly">Month/day</th>
379
        </div> <!-- .col-sm-2.col-sm-pull-10 -->
303
                                [% END %]
380
    </div> <!-- /.row -->
304
                                <th class="repeatableyearly">Title</th>
305
                                <th class="repeatableyearly">Description</th>
306
                            </tr>
307
                        </thead>
308
                        <tbody>
309
                            [% FOREACH DAY_MONTH_HOLIDAYS_LOO IN REPEATABLE_HOLIDAYS %]
310
                            <tr>
311
                                [% IF ( dateformat == "metric" ) %]
312
                                <td><span title="[% DAY_MONTH_HOLIDAYS_LOO.DATE_SORT | html %]">[% DAY_MONTH_HOLIDAYS_LOO.day | html %]/[% DAY_MONTH_HOLIDAYS_LOO.month | html %]</span></td>
313
                                [% ELSE %]
314
                                <td><span title="[% DAY_MONTH_HOLIDAYS_LOO.DATE_SORT | html %]">[% DAY_MONTH_HOLIDAYS_LOO.month | html %]/[% DAY_MONTH_HOLIDAYS_LOO.day | html %]</span></td>
315
                                [% END %]
316
                                <td>[% DAY_MONTH_HOLIDAYS_LOO.note | html %]</td>
317
                                <td>[% DAY_MONTH_HOLIDAYS_LOO.description.replace('\\\r\\\n', '<br />') | html %]</td>
318
                            </tr>
319
                            [% END %]
320
                        </tbody>
321
                    </table> <!-- /#holidaysyearlyrepeatable -->
322
                    [% END # /IF ( REPEATABLE_HOLIDAYS ) %]
323
324
                    [% IF ( UNIQUE_HOLIDAYS ) %]
325
                    <h3>Unique holidays</h3>
326
                    <label class="controls">
327
                        <input type="checkbox" name="show_past" id="show_past_holidaysunique" class="show_past" />
328
                        Show past entries
329
                    </label>
330
                    <table id="holidaysunique" class="dataTable no-footer">
331
                        <thead>
332
                            <tr>
333
                                <th class="holiday">Date</th>
334
                                <th class="holiday">Title</th>
335
                                <th class="holiday">Description</th>
336
                            </tr>
337
                        </thead>
338
                        <tbody>
339
                            [% FOREACH HOLIDAYS_LOO IN UNIQUE_HOLIDAYS %]
340
                            <tr data-date="[% HOLIDAYS_LOO.date | html %]">
341
                                <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>
342
                                <td>[% HOLIDAYS_LOO.note | html %]</td>
343
                                <td>[% HOLIDAYS_LOO.description.replace('\\\r\\\n', '<br />') | html %]</td>
344
                            </tr>
345
                            [% END %]
346
                        </tbody>
347
                    </table> <!-- /#holidaysunique -->
348
                    [% END # /IF ( UNIQUE_HOLIDAYS ) %]
349
350
                    [% IF ( FLOAT_HOLIDAYS ) %]
351
                    <h3>Floating holidays</h3>
352
                    <label class="controls">
353
                        <input type="checkbox" name="show_past" id="show_past_holidaysfloat" class="show_past" />
354
                        Show past entries
355
                    </label>
356
                    <table id="holidaysfloat" class="dataTable no-footer">
357
                        <thead>
358
                            <tr>
359
                                <th class="float">Date</th>
360
                                <th class="float">Title</th>
361
                                <th class="float">Description</th>
362
                            </tr>
363
                        </thead>
364
                        <tbody>
365
                            [% FOREACH float_holiday IN FLOAT_HOLIDAYS %]
366
                            <tr data-date="[% float_holiday.date | html %]">
367
                                <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>
368
                                <td>[% float_holiday.note | html %]</td>
369
                                <td>[% float_holiday.description.replace('\\\r\\\n', '<br />') | html %]</td>
370
                            </tr>
371
                            [% END %]
372
                        </tbody>
373
                    </table> <!-- /#holidaysfloat -->
374
                    [% END # /IF ( FLOAT_HOLIDAYS ) %]
375
                </div>
376
                <!-- /#holiday-list -->
377
            </div>
378
            <!-- /.page-section -->
379
        </div>
380
        <!-- /.col-sm-6 -->
381
    </div>
382
    <!-- /.row -->
383
[% END %]
381
384
382
[% MACRO jsinclude BLOCK %]
385
[% MACRO jsinclude BLOCK %]
383
    [% INCLUDE 'calendar.inc' %]
386
    [% INCLUDE 'calendar.inc' %]
(-)a/misc/cronjobs/staticfines.pl (-1 / +1 lines)
Lines 32-43 use Date::Calc qw( Date_to_Days ); Link Here
32
use Koha::Script -cron;
32
use Koha::Script -cron;
33
use C4::Context;
33
use C4::Context;
34
use C4::Overdues    qw( CalcFine checkoverdues GetFine Getoverdues );
34
use C4::Overdues    qw( CalcFine checkoverdues GetFine Getoverdues );
35
use C4::DiscreteCalendar qw();                                          # don't need any exports from Calendar
36
use C4::Log         qw( cronlogaction );
35
use C4::Log         qw( cronlogaction );
37
use Getopt::Long    qw( GetOptions );
36
use Getopt::Long    qw( GetOptions );
38
use List::MoreUtils qw( none );
37
use List::MoreUtils qw( none );
39
use Koha::DateUtils qw( dt_from_string output_pref );
38
use Koha::DateUtils qw( dt_from_string output_pref );
40
use Koha::Patrons;
39
use Koha::Patrons;
40
use Koha::DiscreteCalendar;
41
41
42
my $help    = 0;
42
my $help    = 0;
43
my $verbose = 0;
43
my $verbose = 0;
(-)a/tools/discrete_calendar.pl (-8 / +7 lines)
Lines 20-40 use Modern::Perl; Link Here
20
20
21
use CGI qw ( -utf8 );
21
use CGI qw ( -utf8 );
22
22
23
use C4::Auth qw( get_template_and_user );
23
use C4::Auth   qw( get_template_and_user );
24
use C4::Output qw( output_html_with_http_headers );
24
use C4::Output qw( output_html_with_http_headers );
25
25
26
use Koha::DateUtils qw ( dt_from_string output_pref );
26
use Koha::DateUtils qw( dt_from_string output_pref );
27
use Koha::DiscreteCalendar;
27
use Koha::DiscreteCalendar;
28
28
29
my $input = CGI->new;
29
my $input = CGI->new;
30
30
31
# Get the template to use
31
# Get the template to use
32
my ($template, $loggedinuser, $cookie) = get_template_and_user(
32
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
33
    {
33
    {
34
        template_name => "tools/discrete_calendar.tt",
34
        template_name => "tools/discrete_calendar.tt",
35
        type => "intranet",
35
        type          => "intranet",
36
        query => $input,
36
        query         => $input,
37
        flagsrequired => {tools => 'edit_calendar'},
37
        flagsrequired => { tools => 'edit_calendar' },
38
    }
38
    }
39
);
39
);
40
40
Lines 57-63 my $action = $input->param('action') || ''; Link Here
57
# if the url has an invalid date default to 'now.'
57
# if the url has an invalid date default to 'now.'
58
# FIXME There is something to improve in the date handling here
58
# FIXME There is something to improve in the date handling here
59
my $calendarinput_dt = eval { dt_from_string( scalar $input->param('calendardate') ); } || dt_from_string;
59
my $calendarinput_dt = eval { dt_from_string( scalar $input->param('calendardate') ); } || dt_from_string;
60
my $calendardate = output_pref( { dt => $calendarinput_dt, dateonly => 1 } );
60
my $calendardate     = output_pref( { dt => $calendarinput_dt, dateonly => 1 } );
61
61
62
if ($action eq 'copyBranch') {
62
if ($action eq 'copyBranch') {
63
    my $new_branch = scalar $input->param('newBranch');
63
    my $new_branch = scalar $input->param('newBranch');
64
- 

Return to bug 17015