[Koha-devel] CVS: koha insertdata.pl,1.3,1.4

Chris Cormack rangi at users.sourceforge.net
Sun Nov 25 18:04:03 CET 2001


Update of /cvsroot/koha/koha
In directory usw-pr-cvs1:/tmp/cvs-serv29415

Modified Files:
	insertdata.pl 
Log Message:
Modify an adult with guarantees now modifies the guarantees also.
IE change of address effects the guarantees record as well


Index: insertdata.pl
===================================================================
RCS file: /cvsroot/koha/koha/insertdata.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** insertdata.pl	2001/03/07 21:12:47	1.3
--- insertdata.pl	2001/11/26 02:03:23	1.4
***************
*** 8,11 ****
--- 8,12 ----
  use C4::Database;
  use C4::Input;
+ use C4::Search;
  use Date::Manip;
  use strict;
***************
*** 61,64 ****
--- 62,83 ----
    '$data{'ethnicity'}','$data{'borrowernumber'}')";
  }
+ # ok if its an adult (type) it may have borrowers that depend on it as a guarantor
+ # so when we update information for an adult we should check for guarantees and update the relevant part
+ # of their records, ie addresses and phone numbers
+ 
+ if ($data{'categorycode'} eq 'A' || $data{'categorycode'} eq 'W'){
+     # is adult check guarantees;
+     my ($count,$guarantees)=findguarantees($data{'borrowernumber'});
+     for (my $i=0;$i<$count;$i++){
+ 	my $guaquery="update borrowers set streetaddress='$data{'address'}',faxnumber='$data{'faxnumber'}',
+         streetcity='$data{'streetcity'}',phoneday='$data{'phoneday'}',city='$data{'city'}',area='$data{'area'}',phone='$data{'phone'}'
+         ,streetaddress='$data{'address'}'
+         where borrowernumber='$guarantees->[$i]->{'borrowernumber'}'";
+         my $sth3=$dbh->prepare($guaquery);
+         $sth3->execute;
+         $sth3->finish;
+      }
+ }
+ 
  #print $query;
    my $sth2=$dbh->prepare($query);





More information about the Koha-devel mailing list