From a5f4c575d92882bb458cda0e08c245b5e94e883b Mon Sep 17 00:00:00 2001 From: Kyle M Hall <kyle@bywatersolutions.com> Date: Wed, 15 Oct 2014 06:09:07 -0400 Subject: [PATCH] Bug 8133 [QA Followup] - Fix koha-qa.pl violations --- C4/Calendar.pm | 2 +- Koha/Calendar.pm | 8 ++-- .../intranet-tmpl/prog/en/includes/tools-menu.inc | 2 +- .../prog/en/modules/tools/calendar.tt | 50 +++++++++---------- misc/cronjobs/staticfines.pl | 2 +- tools/calendar.pl | 4 +- 6 files changed, 33 insertions(+), 35 deletions(-) diff --git a/C4/Calendar.pm b/C4/Calendar.pm index 7131b56..ffd238c 100644 --- a/C4/Calendar.pm +++ b/C4/Calendar.pm @@ -90,7 +90,7 @@ sub GetWeeklyEvents { (open_hour = 0 AND open_minute = 0 AND close_hour = 0 AND close_minute = 0) AS closed FROM calendar_repeats WHERE branchcode = ? AND weekday IS NOT NULL - }, { Slice => {} }, $branchcode ); + }, { Slice => {} }, $branchcode ); } =head2 GetYearlyEvents diff --git a/Koha/Calendar.pm b/Koha/Calendar.pm index 2aba139..91c8e14 100644 --- a/Koha/Calendar.pm +++ b/Koha/Calendar.pm @@ -36,7 +36,7 @@ sub _init { (open_hour = 0 AND open_minute = 0 AND close_hour = 0 AND close_minute = 0) AS closed FROM calendar_repeats WHERE branchcode = ? AND weekday IS NOT NULL - }, 'weekday', { Slice => {} }, $branch ); + }, 'weekday', { Slice => {} }, $branch ); my $day_month_hours = $dbh->selectall_arrayref( q{ SELECT @@ -173,7 +173,7 @@ sub addHours { my $day_len = $hours->{open_time} - $base_date; if ( DateTime::Duration->compare( $day_len, $hours_duration, $base_date ) > 0 ) { - if ( $self->{days_mode} eq 'Calendar' ) { + if ( $self->{days_mode} eq 'Calendar' ) { return $hours->{open_time}; } @@ -202,7 +202,7 @@ sub addHours { my $day_len = $hours->{close_time} - $base_date; if ( DateTime::Duration->compare( $day_len, $hours_duration, $base_date ) < 0 ) { - if ( $self->{days_mode} eq 'Calendar' ) { + if ( $self->{days_mode} eq 'Calendar' ) { return $hours->{close_time}; } @@ -418,7 +418,7 @@ sub hours_between { return $end_dt - $start_dt if ( $start_dt->ymd eq $end_dt->ymd ); my $duration = DateTime::Duration->new; - + $duration->add_duration( $start_hours->{close_time} - $start_dt ) if ( $start_dt < $start_hours->{close_time} ); for (my $date = $start_dt->clone->truncate( to => 'day' )->add( days => 1 ); diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc index 916195c..d492a32 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc @@ -87,7 +87,7 @@ <h5>Additional tools</h5> <ul> [% IF ( CAN_user_tools_edit_calendar ) %] - <li><a href="/cgi-bin/koha/tools/calendar.pl">Calendar</a></li> + <li><a href="/cgi-bin/koha/tools/calendar.pl">Calendar</a></li> [% END %] [% IF ( CAN_user_tools_manage_csv_profiles ) %] <li><a href="/cgi-bin/koha/tools/csv-profiles.pl">CSV profiles</a></li> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/calendar.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/calendar.tt index 4acb1cd..97ab300 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/calendar.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/calendar.tt @@ -5,9 +5,7 @@ [% INCLUDE 'doc-head-close.inc' %] [% INCLUDE 'calendar.inc' %] <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" /> -<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script> -[% INCLUDE 'datatables-strings.inc' %] -<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script> +[% INCLUDE 'datatables.inc' %] <script language="JavaScript" type="text/javascript"> //<![CDATA[ [% IF (dateformat == 'metric') %]dt_add_type_uk_date();[% END %] @@ -89,7 +87,7 @@ $('#showWeekday:first').val(weekDay); $('#showTitle').val(event.title); $('#showEventType').val(event.eventType); - + if (event.closed) { $('#showHoursTypeClosed')[0].checked = true; } else if (event.close_hour == 24) { @@ -97,8 +95,8 @@ } else { $('#showHoursTypeOpenSet')[0].checked = true; $('#showHoursTypeOpenSet').change(); - $('#showOpenTime').val(event.open_hour + ':' + zeroPad(event.open_minute)); - $('#showCloseTime').val(event.close_hour + ':' + zeroPad(event.close_minute)); + $('#showOpenTime').val(event.open_hour + ':' + zeroPad(event.open_minute)); + $('#showCloseTime').val(event.close_hour + ':' + zeroPad(event.close_minute)); } $("#operationDelLabel").html(_("Delete this event.")); @@ -217,7 +215,7 @@ defaultDate: new Date("[% keydate %]") }); $(".hourssel input").change(function() { - $(".hoursentry", this.form).toggle(this.value == 'openSet'); + $(".hoursentry", this.form).toggle(this.value == 'openSet'); }).each( function() { this.checked = false } ); }); //]]> @@ -263,7 +261,7 @@ li.hoursentry input { <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › [% branchname %] Calendar</div> <div id="doc3" class="yui-t1"> - + <div id="bd"> <div id="yui-main"> <div class="yui-b"> @@ -280,7 +278,7 @@ li.hoursentry input { [% END %] [% END %] </select> - + <!-- ******************************** FLAT PANELS ******************************************* --> <!-- ***** Makes all the flat panel to deal with events ***** --> <!-- **************************************************************************************** --> @@ -299,8 +297,8 @@ li.hoursentry input { </li> <li> <strong>From Date:</strong> - <span id="showDaynameOutput"></span>, - + <span id="showDaynameOutput"></span>, + [% 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 %] <input type="hidden" id="showWeekday" name="weekday" /> @@ -324,9 +322,9 @@ li.hoursentry input { <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])" /> </li> <li><label for="showTitle">Title: </label><input type="text" name="title" id="showTitle" size="35" /></li> - <!-- showTitle is necessary for exception radio button to work properly --> + <!-- showTitle is necessary for exception radio button to work properly --> <label for="showDescription">Description:</label> - <textarea rows="2" cols="40" id="showDescription" name="description"></textarea> + <textarea rows="2" cols="40" id="showDescription" name="description"></textarea> </li> <li class="radio"><input type="radio" name="op" id="showOperationDel" value="delete" /> <label for="showOperationDel" id="showOperationDelLabel">Delete this event</label> <a href="#" class="helptext">[?]</a> @@ -354,7 +352,7 @@ li.hoursentry input { <!-- ***************************** Panel to deal with new events ********************** --> <div class="panel" id="newEvent"> <form action="/cgi-bin/koha/tools/calendar.pl" method="post"> - <input type="hidden" name="branchCodes" id="branchCodes" value="[% branchcodes %]" /> + <input type="hidden" name="branchCodes" id="branchCodes" value="[% branchcodes %]" /> <input type="hidden" name="op" value="save" /> <fieldset class="brief"> <h3>Add new event</h3> @@ -367,7 +365,7 @@ li.hoursentry input { </li> <li> <strong>From date:</strong> - <span id="newDaynameOutput"></span>, + <span id="newDaynameOutput"></span>, [% 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 %] @@ -497,21 +495,21 @@ li.hoursentry input { <script type="text/javascript"> document.write(weekdays[ [% event.weekday %]]); </script> - </td> - <td>[% event.title %]</td> - <td>[% event.description %]</td> + </td> + <td>[% event.title %]</td> + <td>[% event.description %]</td> <td> [% IF event.closed %] Closed [% ELSIF event.close_hour == 24 %] Open [% ELSE %] - [% event.open_hour %]:[% event.open_minute > 10 ? event.open_minute : ( '0' _ event.open_minute) %] - + [% event.open_hour %]:[% event.open_minute > 10 ? event.open_minute : ( '0' _ event.open_minute) %] - [% event.close_hour %]:[% event.close_minute > 10 ? event.close_minute : ( '0' _ event.close_minute) %] [% END %] </td> </tr> - [% END %] + [% END %] </tbody> </table> [% END %] @@ -535,20 +533,20 @@ li.hoursentry input { [% FOREACH event IN yearly_events %] <tr> <td><span title="[% event.month_day_display %]">[% event.month_day_sort %]</span></td> - <td>[% event.title %]</td> - <td>[% event.description %]</td> + <td>[% event.title %]</td> + <td>[% event.description %]</td> <td> [% IF event.closed %] Closed [% ELSIF event.close_hour == 24 %] Open [% ELSE %] - [% event.open_hour %]:[% event.open_minute > 10 ? event.open_minute : ( '0' _ event.open_minute) %] - + [% event.open_hour %]:[% event.open_minute > 10 ? event.open_minute : ( '0' _ event.open_minute) %] - [% event.close_hour %]:[% event.close_minute > 10 ? event.close_minute : ( '0' _ event.close_minute) %] [% END %] </td> </tr> - [% END %] + [% END %] </tbody> </table> [% END %] @@ -576,12 +574,12 @@ li.hoursentry input { [% ELSIF event.close_hour == 24 %] Open [% ELSE %] - [% event.open_hour %]:[% event.open_minute > 10 ? event.open_minute : ( '0' _ event.open_minute) %] - + [% event.open_hour %]:[% event.open_minute > 10 ? event.open_minute : ( '0' _ event.open_minute) %] - [% event.close_hour %]:[% event.close_minute > 10 ? event.close_minute : ( '0' _ event.close_minute) %] [% END %] </td> </tr> - [% END %] + [% END %] </tbody> </table> [% END %] diff --git a/misc/cronjobs/staticfines.pl b/misc/cronjobs/staticfines.pl index 779678d..2f3d86c 100755 --- a/misc/cronjobs/staticfines.pl +++ b/misc/cronjobs/staticfines.pl @@ -176,7 +176,7 @@ for ( my $i = 0 ; $i < scalar(@$data) ; $i++ ) { $calendars{$branchcode} = Koha::Calendar->new( branchcode => $branchcode ); } $calendar = $calendars{$branchcode}; - my $isHoliday = $calendar->is_holiday( DateTime->new( + my $isHoliday = $calendar->is_holiday( DateTime->new( year => $tyear, month => $tmonth, day => $tday diff --git a/tools/calendar.pl b/tools/calendar.pl index 0146fad..2d13ba5 100755 --- a/tools/calendar.pl +++ b/tools/calendar.pl @@ -4,7 +4,7 @@ # # Koha is free software; you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software -# Foundation; either version 2 of the License, or (at your option) any later +# Foundation; either version 3 of the License, or (at your option) any later # version. # # Koha is distributed in the hope that it will be useful, but WITHOUT ANY @@ -61,7 +61,7 @@ my $onlymine=(C4::Context->preference('IndependentBranches') && C4::Context->userenv && C4::Context->userenv->{flags} % 2 !=1 && C4::Context->userenv->{branch}?1:0); -if ( $onlymine ) { +if ( $onlymine ) { $branch = C4::Context->userenv->{'branch'}; } my $branchname = GetBranchName($branch); -- 1.7.2.5