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

(-)a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css (+2 lines)
Lines 554-559 div.yui-b fieldset.brief li.radio { Link Here
554
	padding : .7em 0;
554
	padding : .7em 0;
555
}
555
}
556
div.yui-b fieldset.brief li.radio label,
556
div.yui-b fieldset.brief li.radio label,
557
div.yui-b fieldset.brief li.dateinsert label,
558
div.yui-b fieldset.brief li.dateinsert span.label,
557
div.yui-b fieldset.brief li.radio span.label {
559
div.yui-b fieldset.brief li.radio span.label {
558
	display : inline;
560
	display : inline;
559
}
561
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt (-1 / +26 lines)
Lines 103-108 Link Here
103
		$("a.helptext").click(function(){
103
		$("a.helptext").click(function(){
104
			$(this).parent().find(".hint").toggle(); return false;
104
			$(this).parent().find(".hint").toggle(); return false;
105
		});
105
		});
106
		$("#dateofrange").each(function () { this.value = "" });
106
	});
107
	});
107
//]]>
108
//]]>
108
</script>
109
</script>
Lines 209-215 Link Here
209
				<input type="hidden" id="newBranchName" name="newBranchName" />
210
				<input type="hidden" id="newBranchName" name="newBranchName" />
210
			</li>
211
			</li>
211
			<li>
212
			<li>
212
				<strong>Date:</strong>
213
				<strong>From Date:</strong>
213
				<span id="newDaynameOutput"></span>, 
214
				<span id="newDaynameOutput"></span>, 
214
215
215
				[% 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 %]
216
				[% 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 %]
Lines 220-225 Link Here
220
				<input type="hidden" id="newMonth" name="newMonth" />
221
				<input type="hidden" id="newMonth" name="newMonth" />
221
				<input type="hidden" id="newYear" name="newYear" />
222
				<input type="hidden" id="newYear" name="newYear" />
222
			</li>
223
			</li>
224
			<li class="dateinsert">
225
				<b>To Date : </b>
226
				<input type="text" id="dateofrange" name="dateofrange" size="20" value="[% dateofrange %]" />
227
				<img src="[% themelang %]/lib/calendar/cal.gif" id="dateofrange_button" alt="Show Calendar" />
228
				<script language="JavaScript" type="text/javascript">
229
				Calendar.setup(
230
					{
231
					inputField : "dateofrange",
232
					ifFormat : "[% DHTMLcalendar_dateformat %]",
233
					button : "dateofrange_button"
234
					}
235
				);
236
				</script>
237
			</li>
223
			<li><label for="title">Title: </label><input type="text" name="newTitle" id="title" size="35" /></li>
238
			<li><label for="title">Title: </label><input type="text" name="newTitle" id="title" size="35" /></li>
224
			<li><label for="newDescription">Description:</label>
239
			<li><label for="newDescription">Description:</label>
225
				<textarea rows="2" cols="40" id="newDescription" name="newDescription"></textarea>
240
				<textarea rows="2" cols="40" id="newDescription" name="newDescription"></textarea>
Lines 239-244 Link Here
239
							<a href="#" class="helptext">[?]</a>
254
							<a href="#" class="helptext">[?]</a>
240
							<div class="hint">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 1st will make August 1st a holiday every year.</div>
255
							<div class="hint">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 1st will make August 1st a holiday every year.</div>
241
							</li>
256
							</li>
257
            <li class="radio"><input type="radio" name="newOperation" id="newOperationField" value="holidayrange" />
258
                            <label for="newOperationField">Holidays on a range</label>.
259
                            <a href="#" class="helptext">[?]</a>
260
                            <div class="hint">Make a single holiday on a range. For example, selecting August 1st, 2012  and August 10st, 2012 will make all days between 1st and 10st holiday, but will not affect August 1st-10st in other years.</div>
261
                            </li>
262
            <li class="radio"><input type="radio" name="newOperation" id="newOperationFieldyear" value="holidayrangerepeat" />
263
                            <label for="newOperationFieldyear">Holidays repeated yearly on a range</label>.
264
                            <a href="#" class="helptext">[?]</a>
265
                            <div class="hint">Make a single holiday on a range repeated yearly. For example, selecting August 1st, 2012  and August 10st, 2012 will make all days between 1st and 10st holiday, and will affect August 1st-10st in other years.</div>
266
                            </li>
242
				<li class="radio">
267
				<li class="radio">
243
				<input type="checkbox" name="allBranches" id="allBranches" />
268
				<input type="checkbox" name="allBranches" id="allBranches" />
244
				<label for="allBranches">Copy to all libraries</label>.
269
				<label for="allBranches">Copy to all libraries</label>.
(-)a/tools/holidays.pl (+1 lines)
Lines 147-152 $template->param(WEEK_DAYS_LOOP => \@week_days, Link Here
147
        keydate => $keydate,
147
        keydate => $keydate,
148
        branchcodes => $branchcodes,
148
        branchcodes => $branchcodes,
149
        branch => $branch,
149
        branch => $branch,
150
        DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
150
        branchname => $branchname
151
        branchname => $branchname
151
  );
152
  );
152
153
(-)a/tools/newHolidays.pl (-17 / +82 lines)
Lines 10-34 use C4::Output; Link Here
10
10
11
11
12
use C4::Calendar;
12
use C4::Calendar;
13
use DateTime;
13
14
14
my $input = new CGI;
15
my $input               = new CGI;
15
my $dbh = C4::Context->dbh();
16
my $dbh                 = C4::Context->dbh();
16
17
17
my $branchcode = $input->param('newBranchName');
18
my $branchcode          = $input->param('newBranchName');
18
my $originalbranchcode = $branchcode;
19
my $originalbranchcode  = $branchcode;
19
my $weekday = $input->param('newWeekday');
20
my $weekday             = $input->param('newWeekday');
20
my $day = $input->param('newDay');
21
my $day                 = $input->param('newDay');
21
my $month = $input->param('newMonth');
22
my $month               = $input->param('newMonth');
22
my $year = $input->param('newYear');
23
my $year                = $input->param('newYear');
23
my $title = $input->param('newTitle');
24
my $day1;
24
my $description = $input->param('newDescription');
25
my $month1;
25
my $newoperation = $input->param('newOperation');
26
my $year1;
26
my $allbranches = $input->param('allBranches');
27
my $dateofrange         = $input->param('dateofrange');
28
my $title               = $input->param('newTitle');
29
my $description         = $input->param('newDescription');
30
my $newoperation        = $input->param('newOperation');
31
my $allbranches         = $input->param('allBranches');
27
32
28
my $calendardate = sprintf("%04d-%02d-%02d", $year, $month, $day);
33
my $calendardate        = sprintf("%04d-%02d-%02d", $year, $month, $day);
29
my $isodate = C4::Dates->new($calendardate, 'iso');
34
my $isodate             = C4::Dates->new($calendardate, 'iso');
30
$calendardate = $isodate->output('syspref');
35
$calendardate           = $isodate->output('syspref');
31
36
37
my @dateend = split(/[\/-]/, $dateofrange);
38
if (C4::Context->preference("dateformat") eq "metric") {
39
    $day1 = $dateend[0];
40
    $month1 = $dateend[1];
41
    $year1 = $dateend[2];
42
}elsif (C4::Context->preference("dateformat") eq "us") {
43
    $month1 = $dateend[0];
44
    $day1 = $dateend[1];
45
    $year1 = $dateend[2];
46
} else {
47
    $year1 = $dateend[0];
48
    $month1 = $dateend[1];
49
    $day1 = $dateend[2];
50
}
32
$title || ($title = '');
51
$title || ($title = '');
33
if ($description) {
52
if ($description) {
34
	$description =~ s/\r/\\r/g;
53
	$description =~ s/\r/\\r/g;
Lines 80-84 sub add_holiday { Link Here
80
						             description => $description);
99
						             description => $description);
81
		}
100
		}
82
101
83
	}
102
	} elsif ( $newoperation eq 'holidayrange' ) {
103
        #Make an array with holiday's days
104
        my $first_dt = DateTime->new(year => $year, month  => $month,  day => $day);
105
        my $end_dt   = DateTime->new(year => $year1, month  => $month1,  day => $day1);
106
        my @holiday_list = ();
107
108
        for (my $dt = $first_dt->clone();
109
            $dt <= $end_dt;
110
            $dt->add(days => 1) )
111
            {
112
            push @holiday_list, $dt->clone();
113
            }
114
115
        foreach my $date (@holiday_list){
116
            unless ( $calendar->isHoliday( $date->{local_c}->{day}, $date->{local_c}->{month}, $date->{local_c}->{year} ) ) {
117
            $calendar->insert_single_holiday(
118
                day         => $date->{local_c}->{day},
119
                month       => $date->{local_c}->{month},
120
                year        => $date->{local_c}->{year},
121
                title       => $title,
122
                description => $description
123
                );
124
            }
125
        }
126
    } elsif ( $newoperation eq 'holidayrangerepeat' ) {
127
        #Make an array with holiday's days
128
        my $first_dt = DateTime->new(year => $year, month  => $month,  day => $day);
129
        my $end_dt   = DateTime->new(year => $year1, month  => $month1,  day => $day1);
130
        my @holiday_list = ();
131
132
        for (my $dt = $first_dt->clone();
133
            $dt <= $end_dt;
134
            $dt->add(days => 1) )
135
            {
136
            push @holiday_list, $dt->clone();
137
            }
138
139
        foreach my $date (@holiday_list){
140
            unless ( $calendar->isHoliday( $date->{local_c}->{day}, $date->{local_c}->{month}, $date->{local_c}->{year} ) ) {
141
            $calendar->insert_day_month_holiday(
142
                day         => $date->{local_c}->{day},
143
                month       => $date->{local_c}->{month},
144
                title       => $title,
145
                description => $description
146
                );
147
            }
148
        }
149
    }
84
}
150
}
85
- 

Return to bug 6663