From c632bbc202c9d244d462475c343ef3b487b81627 Mon Sep 17 00:00:00 2001 From: miker Date: Mon, 18 Jul 2005 15:32:27 +0000 Subject: [PATCH] adding address editing to lib setup bootstrap cgi git-svn-id: svn://svn.open-ils.org/ILS/trunk@1258 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/cgi-bin/lib-setup.cgi | 96 ++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/Open-ILS/src/cgi-bin/lib-setup.cgi b/Open-ILS/src/cgi-bin/lib-setup.cgi index 91c128db3b..f24d969eb2 100755 --- a/Open-ILS/src/cgi-bin/lib-setup.cgi +++ b/Open-ILS/src/cgi-bin/lib-setup.cgi @@ -36,6 +36,34 @@ if (my $action = $cgi->param('action')) { } } elsif ( $action eq 'Add New' ) { actor::org_unit->create( { map { defined($cgi->param($_)) ? ($_ => $cgi->param($_)) : () } keys %org_cols } ); + } elsif ( $action eq 'Save Address' ) { + my $org = actor::org_unit->retrieve($cgi->param('org_unit')); + + my $addr = {}; + + $$addr{org_unit} = $cgi->param('org_unit'); + $$addr{street1} = $cgi->param('street1'); + $$addr{street2} = $cgi->param('street2'); + $$addr{city} = $cgi->param('city'); + $$addr{county} = $cgi->param('county'); + $$addr{state} = $cgi->param('state'); + $$addr{country} = $cgi->param('country'); + $$addr{post_code} = $cgi->param('post_code'); + + $a_type = $cgi->param('addr_type'); + + + my $a = actor::org_address->retrieve($cgi->param('id')); + + if ($a) { + $a->$_($$addr{$_}) for (keys %$addr); + $a->update; + } else { + $a = actor::org_unit->create( $addr ); + } + + $org->$a_type($a->id); + $org->update; } } @@ -190,6 +218,74 @@ if (my $action = $cgi->param('action')) { print "
"; + #------------------------------------------------------------------------- + # Address edit form + #------------------------------------------------------------------------- + + my %addrs = ( ill_address => 'ILL Address', + holds_address => 'Consortial Holds Address', + mailing_address => 'Mailing Address', + billing_address => 'Physical Address' + ); + for my $a (keys %addrs) { + my $addr = actor::org_address->retrieve( $node->$a ) if ($node->$a); + + my %ah = ( street1 => $addr?$addr->street1:'', + street2 => $addr?$addr->street2:'', + city => $addr?$addr->city:'', + county => $addr?$addr->count:'', + state => $addr?$addr->state:'', + country => $addr?$addr->country:'US', + post_code => $addr?$addr->post_code:'', + org_unit => $addr?$addr->org_unit:'', + id => $addr?$addr->id:'', + ); + + print <<" TABLE"; + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
$addrs{$a}
*Street 1
Street 2
*City
County
*State
*Country
*ZIP
+ + + + +
+ + TABLE + } + print "

New Child

"; print "
". -- 2.43.2