X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_main.cgi;h=07629dcff5fbbeb91152e3da058ea77e54516f63;hb=5c0d47bfe554a35c8906d97b9fabd9999be4f67e;hp=45cb69fc2d30c1f033c2b86e594e01377a106c2e;hpb=e47e9758f480c664bfc3917d798cd69c7d354999;p=freeside.git
diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi
index 45cb69fc2..07629dcff 100755
--- a/httemplate/edit/cust_main.cgi
+++ b/httemplate/edit/cust_main.cgi
@@ -1,444 +1,330 @@
-<%
-
- #for misplaced logic below
- #use FS::part_pkg;
-
- #for false laziness below (now more properly lazy)
- #use FS::svc_acct_pop;
+<% include('/elements/header.html',
+ $title,
+ '',
+ ' onUnload="myclose()"' #hmm, in billing.html
+) %>
- #for (other) false laziness below
- #use FS::agent;
- #use FS::type_pkgs;
+<% include('/elements/error.html') %>
-my $conf = new FS::Conf;
+
-
-Billing address
-<%= include('cust_main/contact.html', $cust_main, '', 'bill_changed(this)', '' ) %>
+<% include('/elements/footer.html') %>
-
+<%init>
-<% if ( defined $cust_main->dbdef_table->column('ship_last') ) { %>
+my $curuser = $FS::CurrentUser::CurrentUser;
-
+#get record
-<%
- my $checked = '';
- my $disabled = '';
- my $disabledselect = '';
- unless ( $cust_main->ship_last && $same ne 'Y' ) {
- $checked = 'CHECKED';
- $disabled = 'DISABLED style="background-color: #dddddd"';
- foreach (
- qw( last first company address1 address2 city county state zip country
- daytime night fax )
- ) {
- $cust_main->set("ship_$_", $cust_main->get($_) );
- }
- }
-%>
+my($custnum, $cust_main, $ss, $stateid, $payinfo, @invoicing_list);
+my $same = '';
+my $pkgpart_svcpart = ''; #first_pkg
+my($username, $password, $popnum, $saved_domsvc) = ( '', '', 0, 0 ); #svc_acct
+my %svc_phone = ();
-
-Service address
-(>same as billing address)
-<%= include('cust_main/contact.html', $cust_main, 'ship_', '', $disabled ) %>
+if ( $cgi->param('error') ) {
-<% } %>
+ $cust_main = new FS::cust_main ( {
+ map { $_, scalar($cgi->param($_)) } fields('cust_main')
+ } );
-
+ $custnum = $cust_main->custnum;
-<%= include( 'cust_main/billing.html', $cust_main,
- 'invoicing_list' => \@invoicing_list,
- )
-%>
+ die "access denied"
+ unless $curuser->access_right($custnum ? 'Edit customer' : 'New customer');
-
+ die "access denied"
+ unless $curuser->access_right('Edit customer');
-
+my $title = $custnum ? 'Edit Customer' : 'Add Customer';
+$title .= ": ". $cust_main->name if $custnum;
-<%= include('/elements/footer.html') %>
+my $r = qq!* !;
+%init>