koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha/C4/Calendar Calendar.pm [dev_week]


From: Ryan Higgins
Subject: [Koha-cvs] koha/C4/Calendar Calendar.pm [dev_week]
Date: Tue, 23 Jan 2007 09:49:01 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         dev_week
Changes by:     Ryan Higgins <rych>     07/01/23 09:49:01

Modified files:
        C4/Calendar    : Calendar.pm 

Log message:
        sync Calendar with rel_3

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Calendar/Calendar.pm?cvsroot=koha&only_with_tag=dev_week&r1=1.1.2.1&r2=1.1.2.2

Patches:
Index: Calendar.pm
===================================================================
RCS file: /sources/koha/koha/C4/Calendar/Calendar.pm,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -b -r1.1.2.1 -r1.1.2.2
--- Calendar.pm 28 May 2006 19:43:24 -0000      1.1.2.1
+++ Calendar.pm 23 Jan 2007 09:49:01 -0000      1.1.2.2
@@ -1,4 +1,4 @@
-package C4::Calendar::Calendar;
+package C4::Calendar::Calendar3;
 
 # This file is part of Koha.
 #
@@ -19,12 +19,11 @@
 require Exporter;
 use vars qw($VERSION @EXPORT);
 
-use C4::Database;
-
-#use Date::Calc;
+#use Date::Manip;
+# use Date::Calc;
 
 # set the version for version checking
-$VERSION = 0.01;
+$VERSION = do { my @v = '$Revision: 1.1.2.2 $' =~ /\d+/g; shift(@v).".".join( 
"_", map { sprintf "%03d", $_ } @v ); };
 
 =head1 NAME
 
@@ -85,6 +84,7 @@
 
 sub _init {
        my $self = shift @_;
+warn "Init calendar object. - branch:" . $self->{branchcode};
 
        my $dbh = C4::Context->dbh();
        my $week_days_sql = $dbh->prepare("select weekday, title, description 
from repeatable_holidays where ('$self->{branchcode}' = branchcode) and 
(NOT(ISNULL(weekday)))");
@@ -371,7 +371,7 @@
 
        # Verify what kind of holiday that day is. For example, if it is
        # a repeatable holiday, this should check if there are some exception
-       # for that holiday rule. Otherwise, if it is a regular holiday, it´s 
+       # for that holiday rule. Otherwise, if it is a regular holiday, it´s 
        # ok just deleting it.
 
        my $dbh = C4::Context->dbh();
@@ -432,9 +432,9 @@
 
 C<$day> Is the day to check wether if is a holiday or not.
 
-C<$month> Is the month to check wether its a holiday or not.
+C<$month> Is the month to check wether if is a holiday or not.
 
-C<$year> Is the year to check wether if its a holiday or not.
+C<$year> Is the year to check wether if is a holiday or not.
 
 =cut
 
@@ -442,6 +442,7 @@
        my ($self, $day, $month, $year) = @_;
 
        my $weekday = Date_DayOfWeek($month, $day, $year) % 7;  
+    
        my $weekDays = $self->get_week_days_holidays();
        my $dayMonths = $self->get_day_month_holidays();
        my $exceptions = $self->get_exception_holidays();
@@ -484,14 +485,14 @@
 
        my $daysMode = C4::Context->preference('useDaysMode');
        if ($daysMode eq 'normal') {
-               ($year, $month, $day) = Add_Delta_Days($year, $month, $day, 
($offset - 1));
+        ($year, $month, $day) = &Date::Calc::Add_Delta_Days($year, $month, 
$day, ($offset - 1));
        } else {
                while ($offset > 0) {                                           
                
                        if (!($self->isHoliday($day, $month, $year))) {
                                $offset = $offset - 1;                          
        
                        }                               
                        if ($offset > 0) {
-                               ($year, $month, $day) = Add_Delta_Days($year, 
$month, $day, 1);
+                ($year, $month, $day) = &Date::Calc::Add_Delta_Days($year, 
$month, $day, 1);
                        }                               
                }
        }
@@ -527,7 +528,7 @@
        if ($daysMode eq 'normal') {
                while ($continue) {
                        if (($yearFrom != $yearTo) || ($monthFrom != $monthTo) 
|| ($dayFrom != $dayTo)) {
-                               ($yearFrom, $monthFrom, $dayFrom) = 
Add_Delta_Days($yearFrom, $monthFrom, $dayFrom, 1);
+                ($yearFrom, $monthFrom, $dayFrom) = 
&Date::Calc::Add_Delta_Days($yearFrom, $monthFrom, $dayFrom, 1);
                                $count++;
                        } else {
                                $continue = 0;  
@@ -539,7 +540,7 @@
                                if (!($self->isHoliday($dayFrom, $monthFrom, 
$yearFrom))) {
                                        $count++;
                                }       
-                               ($yearFrom, $monthFrom, $dayFrom) = 
Add_Delta_Days($yearFrom, $monthFrom, $dayFrom, 1);                         
+                ($yearFrom, $monthFrom, $dayFrom) = 
&Date::Calc::Add_Delta_Days($yearFrom, $monthFrom, $dayFrom, 1);
                        } else {
                                $continue = 0;  
                        }
@@ -548,29 +549,6 @@
        return($count); 
 }
 
-sub Date_DayOfWeek{
-my ($month, $day, $year)address@hidden;
-my $date=$year."-".$month."-".$day;
-my $dbh=C4::Context->dbh;
-my $sth=$dbh->prepare("SELECT DAYOFWEEK(?)");
-$sth->execute($date);
-my $dayofweek=$sth->fetchrow;
-return $dayofweek;
-}
-
-sub Add_Delta_Days{
-my ($year, $month, $day, $offset)address@hidden;
-my $date=$year."-".$month."-".$day;
-my $dbh=C4::Context->dbh;
-my $sth=$dbh->prepare(" SELECT DATE_ADD(?, INTERVAL ? DAY)");
-$sth->execute($date,$offset);
-my $date=$sth->fetchrow;
- ($year, $month, $day)=split /-/,$date;
-return ($year, $month, $day);
-}
-
-
-
 1;
 
 __END__
@@ -580,5 +558,5 @@
 =head1 AUTHOR
 
 Koha Physics Library UNLP <address@hidden>
-Modified by Tumer Garip NUE Grand Library --No more Date::Manip
+
 =cut
\ No newline at end of file




reply via email to

[Prev in Thread] Current Thread [Next in Thread]