X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=C4%2FMembers.pm;h=ce694e590ec1d2daa89effe9713ec41a8a65be35;hb=6a1b7a3321c28534579ac889c9ebf08aa13335c6;hp=4eb99798984da16857f1d03bd68e699a29ccf5b3;hpb=ae48ebbcaae50a0af7ceca00d04f2aedb8d5cc2c;p=koha.git diff --git a/C4/Members.pm b/C4/Members.pm index 4eb9979898..ce694e590e 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -802,8 +802,10 @@ Returns as undef upon any db error without further processing sub AddMember { my (%data) = @_; my $dbh = C4::Context->dbh; - $data{'userid'} = '' unless $data{'password'}; - $data{'password'} = md5_base64( $data{'password'} ) if $data{'password'}; + # generate a proper login if none provided + $data{'userid'} = Generate_Userid($data{'borrowernumber'}, $data{'firstname'}, $data{'surname'}) if $data{'userid'} eq ''; + # create a disabled account if no password provided + $data{'password'} = ($data{'password'})? md5_base64($data{'password'}) : '!'; $data{'borrowernumber'}=InsertInTable("borrowers",\%data); # mysql_insertid is probably bad. not necessarily accurate and mysql-specific at best. logaction("MEMBERS", "CREATE", $data{'borrowernumber'}, "") if C4::Context->preference("BorrowersLog"); @@ -907,7 +909,6 @@ sub fixup_cardnumber ($) { # if ($cardnumber !~ /\S/ && $autonumber_members) { ($autonumber_members) or return $cardnumber; - defined($cardnumber) or return $cardnumber; my $checkdigit = C4::Context->preference('checkdigit'); my $dbh = C4::Context->dbh; if ( $checkdigit and $checkdigit eq 'katipo' ) { @@ -1123,7 +1124,7 @@ sub GetAllIssues { LEFT JOIN items on items.itemnumber=old_issues.itemnumber LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber - WHERE borrowernumber=? + WHERE borrowernumber=? AND old_issues.itemnumber IS NOT NULL order by $order"; if ( $limit != 0 ) { $query .= " limit $limit"; @@ -1175,9 +1176,11 @@ sub GetMemberAccountRecords { $sth->execute( @bind ); my $total = 0; while ( my $data = $sth->fetchrow_hashref ) { - my $biblio = GetBiblioFromItemNumber($data->{itemnumber}) if $data->{itemnumber}; - $data->{biblionumber} = $biblio->{biblionumber}; - $data->{title} = $biblio->{title}; + if ( $data->{itemnumber} ) { + my $biblio = GetBiblioFromItemNumber( $data->{itemnumber} ); + $data->{biblionumber} = $biblio->{biblionumber}; + $data->{title} = $biblio->{title}; + } $acctlines[$numlines] = $data; $numlines++; $total += int(1000 * $data->{'amountoutstanding'}); # convert float to integer to avoid round-off errors @@ -1301,10 +1304,10 @@ sub getzipnamecity { my $dbh = C4::Context->dbh; my $sth = $dbh->prepare( - "select city_name,city_zipcode from cities where cityid=? "); + "select city_name,city_state,city_zipcode,city_country from cities where cityid=? "); $sth->execute($cityid); my @data = $sth->fetchrow; - return $data[0], $data[1]; + return $data[0], $data[1], $data[2], $data[3]; } @@ -1624,13 +1627,15 @@ sub GetCities { my $dbh = C4::Context->dbh; my $city_arr = $dbh->selectall_arrayref( - q|SELECT cityid,city_zipcode,city_name FROM cities ORDER BY city_name|, + q|SELECT cityid,city_zipcode,city_name,city_state,city_country FROM cities ORDER BY city_name|, { Slice => {} }); if ( @{$city_arr} ) { unshift @{$city_arr}, { city_zipcode => q{}, city_name => q{}, cityid => q{}, + city_state => q{}, + city_country => q{}, }; }