bug_4415: Copy parent contact details to child when adding Let child details be manag...
authorSrdjan Jankovic <srdjan@catalyst.net.nz>
Wed, 3 Aug 2011 10:04:21 +0000 (12:04 +0200)
committerChris Cormack <chrisc@catalyst.net.nz>
Wed, 3 Aug 2011 10:19:31 +0000 (22:19 +1200)
Signed-off-by: Nicole Engard <nengard@bywatersolutions.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
members/memberentry.pl
members/moremember.pl

index 6287611..67286bf 100644 (file)
@@ -356,9 +356,9 @@ function validate1(date) {
  </div>
     <div class="action"><a href="memberentry.pl?op=modify&amp;borrowernumber=[% borrowernumber %]&amp;step=3">Edit</a></div>
  
+    [% UNLESS ( I ) %]
  <div id="patron-alternate-address" style="padding-top: 1em;">
     <h3>Alternate Address</h3>
-    [% UNLESS ( I ) %][% UNLESS ( C ) %]
     <div class="rows">  <ol><li><span class="label">Address: </span>[% B_address %]</li>
       <li><span class="label">Address 2: </span>[% B_address2 %]</li>
       <li><span class="label">City: </span>[% B_city %]</li>
@@ -367,16 +367,9 @@ function validate1(date) {
       <li><span class="label">Country: </span>[% B_country %]</li>
       [% IF ( B_phone ) %]<li><span class="label">Phone: </span>[% B_phone %]</li>[% END %]
       [% IF ( B_email ) %]<li><span class="label">Email: </span>[% B_email %]</li>[% END %]</ol></div>
-    [% END %][% END %]
-     [% IF ( C ) %]
-   <div class="rows"> <ol><li><span class="label">Surname: </span>[% contactname %]</li>
-    <li><span class="label">First name: </span>[% contactfirstname %]</li>    
-    <li><span class="label">Phone: </span>[% phone %]</li>
-    <li><span class="label">Email: </span>[% email %]</li>
-    <li><span class="label">Relationship: </span>[% relationship %]</li></ol></div>
-   [% END %]
 </div>
 <div class="action"><a href="memberentry.pl?op=modify&amp;borrowernumber=[% borrowernumber %]&amp;step=6">Edit</a></div>
+    [% END %]
 
  <div id="patron-alternative-contact" style="padding-top: 1em;">
  <h3>Alternative Contact</h3>  
index f6ca2c1..63ee154 100755 (executable)
@@ -211,13 +211,14 @@ if ( ( $op eq 'insert' ) and !$nodouble ) {
 if ( $guarantorid and ( $category_type eq 'C' || $category_type eq 'P' )) {
     if (my $guarantordata=GetMember(borrowernumber => $guarantorid)) {
         $guarantorinfo=$guarantordata->{'surname'}." , ".$guarantordata->{'firstname'};
-        if ( !defined($data{'contactname'}) or $data{'contactname'} eq '' or
-             $data{'contactname'} ne $guarantordata->{'surname'} ) {
-            $newdata{'contactfirstname'}= $guarantordata->{'firstname'};
-            $newdata{'contactname'}     = $guarantordata->{'surname'};
-            $newdata{'contacttitle'}    = $guarantordata->{'title'};
+        $newdata{'contactfirstname'}= $guarantordata->{'firstname'};
+        $newdata{'contactname'}     = $guarantordata->{'surname'};
+        $newdata{'contacttitle'}    = $guarantordata->{'title'};
+        if ( $op eq 'add' ) {
                foreach (qw(streetnumber address streettype address2
-                        zipcode country city phone phonepro mobile fax email emailpro branchcode)) {
+                        zipcode country city state phone phonepro mobile fax email emailpro branchcode
+                        B_streetnumber B_streettype B_address B_address2
+                        B_city B_state B_zipcode B_country B_email B_phone)) {
                        $newdata{$_} = $guarantordata->{$_};
                }
         }
@@ -225,12 +226,10 @@ if ( $guarantorid and ( $category_type eq 'C' || $category_type eq 'P' )) {
 }
 
 ###############test to take the right zipcode, country and city name ##############
-if (!defined($guarantorid) or $guarantorid eq '' or $guarantorid eq '0') {
-    # set only if parameter was passed from the form
-    $newdata{'city'}    = $input->param('city')    if defined($input->param('city'));
-    $newdata{'zipcode'} = $input->param('zipcode') if defined($input->param('zipcode'));
-    $newdata{'country'} = $input->param('country') if defined($input->param('country'));
-}
+# set only if parameter was passed from the form
+$newdata{'city'}    = $input->param('city')    if defined($input->param('city'));
+$newdata{'zipcode'} = $input->param('zipcode') if defined($input->param('zipcode'));
+$newdata{'country'} = $input->param('country') if defined($input->param('country'));
 
 #builds default userid
 if ( (defined $newdata{'userid'}) && ($newdata{'userid'} eq '')){
@@ -677,7 +676,7 @@ $template->param(CGIbranch=>$CGIbranch) if ($CGIbranch);
 $template->param(
   nodouble  => $nodouble,
   borrowernumber  => $borrowernumber, #register number
-  guarantorid => (($borrower_data->{'guarantorid'})) ? $borrower_data->{'guarantorid'} : $guarantorid,
+  guarantorid => ($borrower_data->{'guarantorid'} || $guarantorid),
   ethcatpopup => $ethcatpopup,
   relshiploop => \@relshipdata,
   city_loop => $city_arrayref,
index b766f2f..9292fd0 100755 (executable)
@@ -157,12 +157,6 @@ $data->{ "sex_".$data->{'sex'}."_p" } = 1;
 
 my $catcode;
 if ( $category_type eq 'C') {
-       if ($data->{guarantorid} ) {
-       my $data2 = GetMember( 'borrowernumber' => $data->{'guarantorid'} );
-       foreach (qw(address address2 city state B_address B_address2 B_city B_state phone mobile zipcode B_zipcode country B_country)) {
-           $data->{$_} = $data2->{$_};
-       }
-   }
    my  ( $catcodes, $labels ) =  GetborCatFromCatType( 'A', 'WHERE category_type = ?' );
    my $cnt = scalar(@$catcodes);