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

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

Return to bug 15653