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

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

Return to bug 15653