MT 1816: Granular permissions for the serials module
[koha.git] / C4 / Members.pm
index 3f22544..f5a360e 100644 (file)
@@ -655,8 +655,9 @@ Returns the borrowernumber
 sub AddMember {
     my (%data) = @_;
     my $dbh = C4::Context->dbh;
-    $data{'userid'} = '' unless $data{'password'};
+
     $data{'password'} = md5_base64( $data{'password'} ) if $data{'password'};
+    $data{'password'} = '!' if (not $data{'password'} and $data{'userid'});
     
     # WE SHOULD NEVER PASS THIS SUBROUTINE ANYTHING OTHER THAN ISO DATES
     # IF YOU UNCOMMENT THESE LINES YOU BETTER HAVE A DARN COMPELLING REASON
@@ -1131,9 +1132,9 @@ sub GetMemberAccountRecords {
                $data->{title} = $biblio->{title};
         $acctlines[$numlines] = $data;
         $numlines++;
-        $total += int(100 * $data->{'amountoutstanding'}); # convert float to integer to avoid round-off errors
+        $total += int(1000 * $data->{'amountoutstanding'}); # convert float to integer to avoid round-off errors
     }
-    $total /= 100;
+    $total /= 1000;
     $sth->finish;
     return ( $total, \@acctlines,$numlines);
 }
@@ -1858,9 +1859,8 @@ this function get all borrowers who haven't borrowed since the date given on inp
 =cut
 
 sub GetBorrowersWhoHaveNotBorrowedSince {
-### TODO : It could be dangerous to delete Borrowers who have just been entered and who have not yet borrowed any book. May be good to add a dateexpiry or dateenrolled filter.      
-       
-                my $filterdate = shift||POSIX::strftime("%Y-%m-%d",localtime());
+    my $filterdate = shift||POSIX::strftime("%Y-%m-%d",localtime());
+    my $filterexpiry = shift;
     my $filterbranch = shift || 
                         ((C4::Context->preference('IndependantBranches') 
                              && C4::Context->userenv 
@@ -1880,7 +1880,10 @@ sub GetBorrowersWhoHaveNotBorrowedSince {
     if ($filterbranch && $filterbranch ne ""){ 
         $query.=" AND borrowers.branchcode= ?";
         push @query_params,$filterbranch;
-    }    
+    }
+    if($filterexpiry){
+        $query .= " AND dateexpiry < NOW() ";
+    }
     $query.=" GROUP BY borrowers.borrowernumber";
     if ($filterdate){ 
         $query.=" HAVING latestissue <? OR latestissue IS NULL";