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

(-)a/C4/Members.pm (-36 lines)
Lines 654-669 sub ModMember { Link Here
654
654
655
    my $execute_success = $rs->update($new_borrower);
655
    my $execute_success = $rs->update($new_borrower);
656
    if ($execute_success ne '0E0') { # only proceed if the update was a success
656
    if ($execute_success ne '0E0') { # only proceed if the update was a success
657
658
        # ok if its an adult (type) it may have borrowers that depend on it as a guarantor
659
        # so when we update information for an adult we should check for guarantees and update the relevant part
660
        # of their records, ie addresses and phone numbers
661
        my $borrowercategory= GetBorrowercategory( $data{'category_type'} );
662
        if ( exists  $borrowercategory->{'category_type'} && $borrowercategory->{'category_type'} eq ('A' || 'S') ) {
663
            # is adult check guarantees;
664
            UpdateGuarantees(%data);
665
        }
666
667
        # If the patron changes to a category with enrollment fee, we add a fee
657
        # If the patron changes to a category with enrollment fee, we add a fee
668
        if ( $data{categorycode} and $data{categorycode} ne $old_categorycode ) {
658
        if ( $data{categorycode} and $data{categorycode} ne $old_categorycode ) {
669
            if ( C4::Context->preference('FeeOnChangePatronCategory') ) {
659
            if ( C4::Context->preference('FeeOnChangePatronCategory') ) {
Lines 972-1002 sub GetGuarantees { Link Here
972
    return ( scalar(@$data), $data );
962
    return ( scalar(@$data), $data );
973
}
963
}
974
964
975
=head2 UpdateGuarantees
976
977
  &UpdateGuarantees($parent_borrno);
978
  
979
980
C<&UpdateGuarantees> borrower data for an adult and updates all the guarantees
981
with the modified information
982
983
=cut
984
985
#'
986
sub UpdateGuarantees {
987
    my %data = shift;
988
    my $dbh = C4::Context->dbh;
989
    my ( $count, $guarantees ) = GetGuarantees( $data{'borrowernumber'} );
990
    foreach my $guarantee (@$guarantees){
991
        my $guaquery = qq|UPDATE borrowers 
992
              SET address=?,fax=?,B_city=?,mobile=?,city=?,phone=?
993
              WHERE borrowernumber=?
994
        |;
995
        my $sth = $dbh->prepare($guaquery);
996
        $sth->execute($data{'address'},$data{'fax'},$data{'B_city'},$data{'mobile'},$data{'city'},$data{'phone'},$guarantee->{'borrowernumber'});
997
    }
998
}
999
1000
=head2 GetPendingIssues
965
=head2 GetPendingIssues
1001
966
1002
  my $issues = &GetPendingIssues(@borrowernumber);
967
  my $issues = &GetPendingIssues(@borrowernumber);
1003
- 

Return to bug 15653