@@ -, +, @@ are pre filled name' field in 'Contact' section of member entry form is) --- ...bug_22534-add_PreFillGuaranteeField_syspref.sql | 1 + installer/data/mysql/sysprefs.sql | 1 + .../prog/en/modules/admin/preferences/patrons.pref | 5 +++ members/memberentry.pl | 40 ++++++++++++++++------ 4 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_22534-add_PreFillGuaranteeField_syspref.sql --- a/installer/data/mysql/atomicupdate/bug_22534-add_PreFillGuaranteeField_syspref.sql +++ a/installer/data/mysql/atomicupdate/bug_22534-add_PreFillGuaranteeField_syspref.sql @@ -0,0 +1, @@ +INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) VALUES ('PrefillGuaranteeField', 'phone|email|streetnumber|address|city|state|zipcode|country', NULL, 'Choose which guarantee fields are pre-filled from guarantor record', 'free'); --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -496,6 +496,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('PayPalSandboxMode', '1', NULL , 'If enabled, the system will use PayPal''s sandbox server for testing, rather than the production server.', 'YesNo'), ('PayPalSignature', '', NULL , 'Your PayPal API signature', 'Free'), ('PayPalUser', '', NULL , 'Your PayPal API username ( email address )', 'Free'), +('PrefillGuaranteeField', 'phone|email|streetnumber|address|city|state|zipcode|country', NULL, 'Choose which guarantee fields are pre-filled from guarantor record', 'free'), ('PrefillItem','0','','When a new item is added, should it be prefilled with last created item values?','YesNo'), ('PreserveSerialNotes','1','','When a new "Expected" issue is generated, should it be prefilled with last created issue notes?','YesNo'), ('previousIssuesDefaultSortOrder','asc','asc|desc','Specify the sort order of Previous Issues on the circulation page','Choice'), --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref @@ -122,6 +122,11 @@ Patrons: no: "Don't allow" - images to be uploaded and shown for patrons on the staff client. - + - "The following database columns will be pre-filled in guarantee entry screen from guarantor redord:" + - pref: PrefillGuaranteeField + class: multi + - (seperate columns with |) + - - By default, show - pref: PatronsPerPage class: integer --- a/members/memberentry.pl +++ a/members/memberentry.pl @@ -593,18 +593,38 @@ if (C4::Context->preference("IndependentBranches")) { } } } + +# Define the fields to be pre-filled in guarantee records +my $prefillguarantorfields=C4::Context->preference("PrefillGuaranteeField"); +my @prefill_fields=split(/\|/,$prefillguarantorfields); + if ($op eq 'add'){ if ($guarantor_id) { - foreach ( - qw( - streetnumber address streettype address2 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{$_} = $guarantor->$_; + foreach (@prefill_fields) { + if ($_ eq 'altcontactfirstname') { + $newdata{altcontactfirstname} = $guarantor->firstname; + } elsif ($_ eq 'altcontactsurname') { + $newdata{altcontactsurname} = $guarantor->surname; + } elsif ($_ eq 'altcontactaddress1') { + $newdata{altcontactaddress1} = $guarantor->address; + } elsif ($_ eq 'altcontactaddress2') { + $newdata{altcontactaddress2} = $guarantor->address2; + } elsif ($_ eq 'altcontactaddress3') { + $newdata{altcontactaddress3} = $guarantor->city; + } elsif ($_ eq 'altcontactstate') { + $newdata{altcontactstate} = $guarantor->state; + } elsif ($_ eq 'altcontactzipcode') { + $newdata{altcontactzipcode} = $guarantor->zipcode; + } elsif ($_ eq 'altcontactcountry') { + $newdata{altcontactcountry} = $guarantor->country; + } elsif ($_ eq 'altcontactphone') { + $newdata{altcontactphone} = $guarantor->phone; + } else { + eval { $newdata{$_} = $guarantor->$_; }; + if ($@) { + push @errors, $@; + } + } } } $template->param( updtype => 'I', step_1=>1, step_2=>1, step_3=>1, step_4=>1, step_5 => 1, step_6 => 1, step_7 => 1); --