Fix for bug 1648, specifying a due date resulted in a blank due date
authorChris Cormack <crc@liblime.com>
Mon, 17 Dec 2007 00:43:02 +0000 (18:43 -0600)
committerJoshua Ferraro <jmf@liblime.com>
Mon, 17 Dec 2007 14:19:55 +0000 (08:19 -0600)
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
C4/Branch.pm
C4/Circulation.pm
circ/circulation.pl
koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl

index f8edb6a..a13af59 100644 (file)
@@ -101,17 +101,17 @@ sub GetBranches {
     my %branches;
     my $dbh = C4::Context->dbh;
     my $sth;
-    my $query="SELECT * from branches";
+    my $query="SELECT * FROM branches";
     if ($onlymine && C4::Context->userenv && C4::Context->userenv->{branch}){
       $query .= " WHERE branchcode =".$dbh->quote(C4::Context->userenv->{branch});
     }
-    $query.=" order by branchname";
+    $query.=" ORDER BY branchname";
     $sth = $dbh->prepare($query);
     $sth->execute;
     while ( my $branch = $sth->fetchrow_hashref ) {
         my $nsth =
           $dbh->prepare(
-            "select categorycode from branchrelations where branchcode = ?");
+            "SELECT category_id FROM branchrelations WHERE branchcode = ?");
         $nsth->execute( $branch->{'branchcode'} );
         while ( my ($cat) = $nsth->fetchrow_array ) {
 
index b124de7..77708d5 100644 (file)
@@ -856,7 +856,9 @@ sub AddIssue {
                if ( $actualissue->{borrowernumber} eq $borrower->{'borrowernumber'} ) {
                        AddRenewal(
                                $borrower->{'borrowernumber'},
-                               $item->{'itemnumber'}
+                               $item->{'itemnumber'},
+                               C4::Context->userenv->{'branch'},
+                               $date
                        );
 
                }
index 7d8fb83..3c2af2d 100755 (executable)
@@ -131,10 +131,11 @@ my $print          = $query->param('print');
 #
 
 my ($datedue,$invalidduedate);
-if($duedatespec) {
-       $datedue=  C4::Dates->new($duedatespec );
+if ($duedatespec) {
+       $datedue =  C4::Dates->new($duedatespec,'iso' );
        $invalidduedate=1 unless $datedue;
 }
+
 #if (defined($year)) {
 #        $duedatespec = "$year-$month-$day";
 #} else {
@@ -196,7 +197,6 @@ if ($findborrower) {
 # get the borrower information.....
 my $borrower;
 my @lines;
-warn $borrowernumber;
 if ($borrowernumber) {
     $borrower = GetMemberDetails( $borrowernumber, 0 );
     my ( $od, $issue, $fines ) = GetMemberIssuesAndFines( $borrowernumber );
@@ -275,10 +275,8 @@ if ($barcode) {
             $noquestion = 0;
         }
         $template->param(
-                        itemhomebranch => $getmessageiteminfo->{'homebranch'} ,        
-            day   => $day,
-            month => $month,
-            year  => $year
+                        itemhomebranch => $getmessageiteminfo->{'homebranch'} ,                     
+                        duedatespec => $duedatespec,
         );
         if ( $noerror && ( $noquestion || $issueconfirmed ) ) {
             AddIssue( $borrower, $barcode, $datedue );
index cfc6f20..c2cd1cb 100755 (executable)
@@ -95,6 +95,7 @@
     <input type="hidden" name="barcode" value="<!-- TMPL_VAR NAME="barcode" -->" />
     <input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->" />
     <input type="hidden" name="issueconfirmed" value="1" />
+       <input type="hidden" name="duedatespec" value="<!-- TMPL_VAR NAME="duedatespec" -->" />
     <input type="hidden" name="day" value="<!-- TMPL_VAR name="day" -->" />
     <input type="hidden" name="month" value="<!-- TMPL_VAR name="month" -->" />
     <input type="hidden" name="year" value="<!-- TMPL_VAR name="year" -->" />