From 33a9aec802f6833bc7d3b6eb1eeb8e6dce2742f8 Mon Sep 17 00:00:00 2001 From: Srdjan Jankovic Date: Wed, 3 Aug 2011 12:04:21 +0200 Subject: [PATCH] bug_4415: Copy parent contact details to child when adding Let child details be managed separately Signed-off-by: Nicole Engard Signed-off-by: Paul Poulain Signed-off-by: Chris Cormack --- .../prog/en/modules/members/moremember.tt | 11 ++------ members/memberentry.pl | 25 +++++++++---------- members/moremember.pl | 6 ----- 3 files changed, 14 insertions(+), 28 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt index 6287611d89..67286bf215 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -356,9 +356,9 @@ function validate1(date) { + [% UNLESS ( I ) %]

Alternate Address

- [% UNLESS ( I ) %][% UNLESS ( C ) %]
  1. Address: [% B_address %]
  2. Address 2: [% B_address2 %]
  3. City: [% B_city %]
  4. @@ -367,16 +367,9 @@ function validate1(date) {
  5. Country: [% B_country %]
  6. [% IF ( B_phone ) %]
  7. Phone: [% B_phone %]
  8. [% END %] [% IF ( B_email ) %]
  9. Email: [% B_email %]
  10. [% END %]
- [% END %][% END %] - [% IF ( C ) %] -
  1. Surname: [% contactname %]
  2. -
  3. First name: [% contactfirstname %]
  4. -
  5. Phone: [% phone %]
  6. -
  7. Email: [% email %]
  8. -
  9. Relationship: [% relationship %]
- [% END %]
+ [% END %]

Alternative Contact

diff --git a/members/memberentry.pl b/members/memberentry.pl index f6ca2c1b6d..63ee1547ad 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -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, diff --git a/members/moremember.pl b/members/moremember.pl index b766f2f9f7..9292fd0d96 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -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); -- 2.39.2