% $cgi->redirect(popurl(3). 'edit/cust_location.cgi?'. $cgi->query_string );
% } else {
- <% header("Location changed") %>
+ <& /elements/header-popup.html, emt("Location changed") &>
<SCRIPT TYPE="text/javascript">
- window.top.location.reload();
+ topreload();
</SCRIPT>
</BODY>
</HTML>
});
die "unknown locationnum $locationnum" unless $cust_location;
-my $new = FS::cust_location->new_or_existing({
+my $new = FS::cust_location->new({
custnum => $cust_location->custnum,
prospectnum => $cust_location->prospectnum,
map { $_ => scalar($cgi->param($_)) } FS::cust_main->location_fields
});
-
-my $error = $cust_location->move_to($new);
+my $error = $new->find_or_insert;
+$error ||= $cust_location->move_to($new);
</%init>