View | Details | Raw Unified | Return to bug 15107
Collapse All | Expand All

(-)a/C4/Members.pm (-11 / +30 lines)
Lines 456-464 sub GetMember { Link Here
456
        }
456
        }
457
    }
457
    }
458
    $debug && warn $select, " ",values %information;
458
    $debug && warn $select, " ",values %information;
459
    my $sth = $dbh->prepare("$select");
459
    my $sth = $dbh->prepare_cached("$select");
460
    $sth->execute(map{$information{$_}} keys %information);
460
    $sth->execute(map{$information{$_}} keys %information);
461
    my $data = $sth->fetchall_arrayref({});
461
    my $data = $sth->fetchall_arrayref({});
462
    $sth->finish;
462
    #FIXME interface to this routine now allows generation of a result set
463
    #FIXME interface to this routine now allows generation of a result set
463
    #so whole array should be returned but bowhere in the current code expects this
464
    #so whole array should be returned but bowhere in the current code expects this
464
    if (@{$data} ) {
465
    if (@{$data} ) {
Lines 1771-1787 The routine returns 1 for success, undef for failure. Link Here
1771
=cut
1772
=cut
1772
1773
1773
sub MoveMemberToDeleted {
1774
sub MoveMemberToDeleted {
1774
    my ($member) = shift or return;
1775
    my ($borrowernumber) = shift or return;
1775
1776
    my $dbh = C4::Context->dbh;
1776
    my $schema       = Koha::Database->new()->schema();
1777
    my $borrower_columns = q{
1777
    my $borrowers_rs = $schema->resultset('Borrower');
1778
        title, surname, firstname, dateofbirth, initials, 
1778
    $borrowers_rs->result_class('DBIx::Class::ResultClass::HashRefInflator');
1779
        othernames, sex, relationship, guarantorid, streetnumber,
1779
    my $borrower = $borrowers_rs->find($member);
1780
        streettype, address, address2, city, state, zipcode, 
1780
    return unless $borrower;
1781
        country, phone, phonepro, mobile, email, emailpro, fax, 
1782
        B_streetnumber, B_streettype, B_address, B_address2, 
1783
        B_city, B_state, B_zipcode, B_country, B_phone, B_email, 
1784
        contactnote, altcontactfirstname, altcontactsurname, 
1785
        altcontactaddress1, altcontactaddress2, altcontactaddress3,
1786
        contactname, contactfirstname, contacttitle, altcontactstate,
1787
        altcontactzipcode, altcontactcountry, altcontactphone,
1788
        cardnumber, branchcode, categorycode, sort1, sort2, 
1789
        dateenrolled, dateexpiry, opacnote, borrowernotes, userid,
1790
        password, flags, gonenoaddress, lost, debarred, 
1791
        debarredcomment, smsalertnumber, privacy
1792
    };
1781
1793
1782
    my $deleted = $schema->resultset('Deletedborrower')->create($borrower);
1794
    my $insert_query = "
1795
        INSERT INTO deletedborrowers
1796
        ($borrower_columns)
1797
        SELECT $borrower_columns
1798
        FROM borrowers
1799
        WHERE borrowernumber = ?
1800
        ";
1783
1801
1784
    return $deleted ? 1 : undef;
1802
    my $sth = $dbh->prepare($insert_query);
1803
    my $result = $sth->execute($borrowernumber);
1804
    return $result ? 1 : undef;
1785
}
1805
}
1786
1806
1787
=head2 DelMember
1807
=head2 DelMember
1788
- 

Return to bug 15107