*** empty log message ***
authorwolfpac444 <wolfpac444>
Wed, 26 Mar 2003 04:42:56 +0000 (04:42 +0000)
committerwolfpac444 <wolfpac444>
Wed, 26 Mar 2003 04:42:56 +0000 (04:42 +0000)
C4/Date.pm
moremember.pl
opac/opac-moredetail.pl
opac/opac-reserve.pl
opac/opac-user.pl
opac/opac-userdetails.pl
opac/opac-userupdate.pl
request.pl

index 5e3a6cf..f6c1e58 100644 (file)
@@ -17,10 +17,10 @@ $VERSION = 0.01;
 @EXPORT = qw(
              &display_date_format
              &format_date
+             &format_date_in_iso
 );
 
 
-
 sub get_date_format
 {
        #Get the database handle
@@ -68,16 +68,19 @@ sub format_date
        
        if ( $dateformat eq "us" )
        {
+               Date_Init("DateFormat=US");
                $olddate = ParseDate($olddate);
                $newdate = UnixDate($olddate,'%m/%d/%Y');
        }
        elsif ( $dateformat eq "metric" )
        {
+               Date_Init("DateFormat=metric");
                $olddate = ParseDate($olddate);
                $newdate = UnixDate($olddate,'%d/%m/%Y');
        }
        elsif ( $dateformat eq "iso" )
        {
+               Date_Init("DateFormat=iso");
                $olddate = ParseDate($olddate);
                $newdate = UnixDate($olddate,'%Y-%m-%d');
        }
@@ -87,4 +90,35 @@ sub format_date
        }
 }
 
+sub format_date_in_iso
+{
+        my $olddate = shift;
+        my $newdate;
+                
+        my $dateformat = get_date_format();
+
+        if ( $dateformat eq "us" )
+        {
+                Date_Init("DateFormat=US");
+                $olddate = ParseDate($olddate);
+        }
+        elsif ( $dateformat eq "metric" )
+        {
+                Date_Init("DateFormat=metric");
+                $olddate = ParseDate($olddate);
+        }
+        elsif ( $dateformat eq "iso" )
+        {
+                Date_Init("DateFormat=iso");
+                $olddate = ParseDate($olddate);
+        }
+        else
+        {
+                return "9999-99-99";
+        }
+
+       $newdate = UnixDate($olddate, '%Y-%m-%d');
+
+       return $newdate;
+}
 1;
index 41e45c6..deacfe7 100755 (executable)
@@ -128,7 +128,7 @@ for (my$i=0;$i<$numaccts;$i++){
   my %row = %$accts->[$i];
   if ($amount2 != 0){
     my $item=" &nbsp; ";
-    $row{'date'} = slashifyDate($accts->[$i]{'date'});
+    $row{'date'} = format_date($accts->[$i]{'date'});
 
     if ($accts->[$i]{'accounttype'} ne 'Res'){
       #get item data
@@ -153,7 +153,7 @@ my $today=ParseDate('today');
 my @issuedata;
 for (my $i=0;$i<$count;$i++){
   my $datedue=ParseDate($issue->[$i]{'date_due'});
-  $issue->[$i]{'date_due'} = slashifyDate($issue->[$i]{'date_due'});
+  $issue->[$i]{'date_due'} = format_date($issue->[$i]{'date_due'});
   my %row = %{$issue->[$i]};
   if ($datedue < $today){
     $row{'red'}=1; #print "<font color=red>";
@@ -190,7 +190,7 @@ my ($rescount,$reserves)=FindReserves('',$bornum); #From C4::Reserves2
 #
 my @reservedata;
 for (my $i=0;$i<$rescount;$i++){
-  $reserves->[$i]{'reservedate2'} = slashifyDate($reserves->[$i]{'reservedate'});
+  $reserves->[$i]{'reservedate2'} = format_date($reserves->[$i]{'reservedate'});
   my $restitle;
   my %row = %$reserves->[$i];
   if ($reserves->[$i]{'constrainttype'} eq 'o'){
index 59b626f..214d13e 100755 (executable)
@@ -10,6 +10,7 @@ use C4::Koha;
 use C4::Output;
 use C4::Acquisitions;
 use C4::Biblio;
+use C4::Date;
 use HTML::Template;
 
 use CGI;
@@ -139,8 +140,8 @@ my $mon=substr($items[$i]->{'timestamp0'},4,2);
 my $day=substr($items[$i]->{'timestamp0'},6,2);
 $items[$i]->{'timestamp0'}="$day/$mon/$year";
 
-$items[$i]->{'dateaccessioned'} = slashifyDate($items[$i]->{'dateaccessioned'});
-$items[$i]->{'datelastseen'} = slashifyDate($items[$i]->{'datelastseen'});
+$items[$i]->{'dateaccessioned'} = format_date($items[$i]->{'dateaccessioned'});
+$items[$i]->{'datelastseen'} = format_date($items[$i]->{'datelastseen'});
 
 print <<printend
 <FONT SIZE=2  face="arial, helvetica">
index ff54f05..081416a 100755 (executable)
@@ -12,6 +12,7 @@ use C4::Circulation::Circ2;
 use C4::Reserves2;
 use C4::Interface::CGI::Output;
 use HTML::Template;
+use C4::Date;
 
 my $MAXIMUM_NUMBER_OF_RESERVES = 5;
 
@@ -122,7 +123,7 @@ my %types;
 my %itemtypes;
 my @duedates;
 foreach my $itm (@items) {
-    push @duedates, {date_due => slashifyDate($itm->{'date_due'})} if defined $itm->{'date_due'};
+    push @duedates, {date_due => format_date($itm->{'date_due'})} if defined $itm->{'date_due'};
     $itm->{$itm->{'publictype'}} = 1;
     # FIXME CalcReserveFee is supposed to be internal-use-only
     my $fee  = CalcReserveFee(undef, $borrowernumber, $itm->{'biblionumber'},'a',($itm->{'biblioitemnumber'}));
index 0ff4c48..faf7b65 100755 (executable)
@@ -11,6 +11,7 @@ use C4::Reserves2;
 use C4::Search;
 use C4::Interface::CGI::Output;
 use HTML::Template;
+use C4::Date;
 
 my $query = new CGI;
 my ($template, $borrowernumber, $cookie) 
@@ -25,9 +26,9 @@ my ($template, $borrowernumber, $cookie)
 # get borrower information ....
 my ($borr, $flags) = getpatroninformation(undef, $borrowernumber);
 
-$borr->{'dateenrolled'} = slashifyDate($borr->{'dateenrolled'});
-$borr->{'expiry'}       = slashifyDate($borr->{'expiry'});
-$borr->{'dateofbirth'}  = slashifyDate($borr->{'dateofbirth'});
+$borr->{'dateenrolled'} = format_date($borr->{'dateenrolled'});
+$borr->{'expiry'}       = format_date($borr->{'expiry'});
+$borr->{'dateofbirth'}  = format_date($borr->{'dateofbirth'});
 $borr->{'ethnicity'}    = fixEthnicity($borr->{'ethnicity'});
 
 if ($borr->{'amountoutstanding'} > 5) {
@@ -58,7 +59,7 @@ my @overdues;
 my @issuedat;
 foreach my $key (keys %$issues) {
     my $issue = $issues->{$key};
-    $issue->{'date_due'}  = slashifyDate($issue->{'date_due'});
+    $issue->{'date_due'}  = format_date($issue->{'date_due'});
 
     # check for reserves
     my ($restype, $res) = CheckReserves($issue->{'itemnumber'});
@@ -109,7 +110,7 @@ my $branches = getbranches();
 # now the reserved items....
 my ($rcount, $reserves) = FindReserves(undef, $borrowernumber);
 foreach my $res (@$reserves) {
-    $res->{'reservedate'}  = slashifyDate($res->{'reservedate'});
+    $res->{'reservedate'}  = format_date($res->{'reservedate'});
     my $publictype = $res->{'publictype'};
     $res->{$publictype} = 1;
     $res->{'waiting'} = 1 if $res->{'found'} eq 'W';
index 5f98d19..b0bfe84 100755 (executable)
@@ -9,6 +9,7 @@ use C4::Circulation::Circ2;
 use C4::Search;
 use HTML::Template;
 use C4::Interface::CGI::Output;
+use C4::Date;
 
 my $query = new CGI;
 my ($template, $borrowernumber, $cookie) 
@@ -23,9 +24,9 @@ my ($template, $borrowernumber, $cookie)
 # get borrower information ....
 my ($borr, $flags) = getpatroninformation(undef, $borrowernumber);
 
-$borr->{'dateenrolled'} = slashifyDate($borr->{'dateenrolled'});
-$borr->{'expiry'}       = slashifyDate($borr->{'expiry'});
-$borr->{'dateofbirth'}  = slashifyDate($borr->{'dateofbirth'});
+$borr->{'dateenrolled'} = format_date($borr->{'dateenrolled'});
+$borr->{'expiry'}       = format_date($borr->{'expiry'});
+$borr->{'dateofbirth'}  = format_date($borr->{'dateofbirth'});
 $borr->{'ethnicity'}    = fixEthnicity($borr->{'ethnicity'});
 
 
index c810b2a..a34c638 100755 (executable)
@@ -10,7 +10,7 @@ use C4::Koha;
 use C4::Circulation::Circ2;
 use C4::Interface::CGI::Output;
 use HTML::Template;
-
+use C4::Date;
 
 my $query = new CGI;
 
@@ -78,9 +78,9 @@ EOF
 }
 
 
-$borr->{'dateenrolled'} = slashifyDate($borr->{'dateenrolled'});
-$borr->{'expiry'}       = slashifyDate($borr->{'expiry'});
-$borr->{'dateofbirth'}  = slashifyDate($borr->{'dateofbirth'});
+$borr->{'dateenrolled'} = format_date($borr->{'dateenrolled'});
+$borr->{'expiry'}       = format_date($borr->{'expiry'});
+$borr->{'dateofbirth'}  = format_date($borr->{'dateofbirth'});
 $borr->{'ethnicity'}    = fixEthnicity($borr->{'ethnicity'});
 
 
index 3653efe..bcf7be7 100755 (executable)
@@ -34,6 +34,8 @@ use C4::Circulation::Circ2;
 use HTML::Template;
 use C4::Catalogue;
 use CGI;
+use C4::Date;
+
 my $input = new CGI;
 
 # get biblio information....
@@ -154,7 +156,7 @@ foreach my $res (sort {$a->{'found'} cmp $b->{'found'}} @$reserves){
                $reserve{'wbrcode'} = $res->{'branchcode'};
                $reserve{'wbrname'} = $branches->{$res->{'branchcode'}}->{'branchname'};
     }
-    $reserve{'date'} = slashifyDate($res->{'reservedate'});
+    $reserve{'date'} = format_date($res->{'reservedate'});
        $reserve{'borrowernumber'}=$res->{'borrowernumber'};
        $reserve{'biblionumber'}=$res->{'biblionumber'};
        $reserve{'bornum'}=$res->{'borrowernumber'};