From: miker Date: Mon, 18 Jul 2005 16:06:19 +0000 (+0000) Subject: address editing for org_units X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=36ce0933c771cbb4493af748dbe4924c61357b5f;p=Evergreen.git address editing for org_units git-svn-id: svn://svn.open-ils.org/ILS/trunk@1259 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/cgi-bin/lib-setup.cgi b/Open-ILS/src/cgi-bin/lib-setup.cgi index f24d969eb2..8e08e1f7b8 100755 --- a/Open-ILS/src/cgi-bin/lib-setup.cgi +++ b/Open-ILS/src/cgi-bin/lib-setup.cgi @@ -37,11 +37,11 @@ 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 $org = actor::org_unit->retrieve($cgi->param('id')); my $addr = {}; - $$addr{org_unit} = $cgi->param('org_unit'); + $$addr{org_unit} = $cgi->param('org_unit') || $org->id; $$addr{street1} = $cgi->param('street1'); $$addr{street2} = $cgi->param('street2'); $$addr{city} = $cgi->param('city'); @@ -50,16 +50,19 @@ if (my $action = $cgi->param('action')) { $$addr{country} = $cgi->param('country'); $$addr{post_code} = $cgi->param('post_code'); - $a_type = $cgi->param('addr_type'); + my $a_type = $cgi->param('addr_type'); - my $a = actor::org_address->retrieve($cgi->param('id')); + my $a = actor::org_address->retrieve($cgi->param('aid')); if ($a) { - $a->$_($$addr{$_}) for (keys %$addr); + for (keys %$addr) { + next unless $$addr{$_}; + $a->$_($$addr{$_}); + } $a->update; } else { - $a = actor::org_unit->create( $addr ); + $a = actor::org_address->create( {map {defined($$addr{$_}) ? ($_ => $$addr{$_}) : ()} keys %$addr} ); } $org->$a_type($a->id); @@ -227,17 +230,17 @@ if (my $action = $cgi->param('action')) { mailing_address => 'Mailing Address', billing_address => 'Physical Address' ); - for my $a (keys %addrs) { + for my $a (qw/billing_address mailing_address holds_address ill_address/) { 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:'', + county => $addr?$addr->county:'', state => $addr?$addr->state:'', country => $addr?$addr->country:'US', post_code => $addr?$addr->post_code:'', - org_unit => $addr?$addr->org_unit:'', + org_unit => $addr?$addr->org_unit:$node->id, id => $addr?$addr->id:'', ); @@ -249,6 +252,10 @@ if (my $action = $cgi->param('action')) { $addrs{$a} + SysID + + + *Street 1 @@ -278,8 +285,8 @@ if (my $action = $cgi->param('action')) { - + diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/actor.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/actor.pm index 4f027bfde1..e4679cdb89 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/actor.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/actor.pm @@ -115,7 +115,7 @@ use base qw/actor/; __PACKAGE__->table( 'actor_org_address' ); __PACKAGE__->columns( Primary => qw/id/ ); -__PACKAGE__->columns( Essential => qw/valid address_type usr street1 street2 +__PACKAGE__->columns( Essential => qw/valid address_type org_unit street1 street2 city county state country post_code/ ); #-------------------------------------------------------------------------------