From 2c757d7db4cb6a7b9655de13206fcc84fb7ce61f Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 14 May 2006 16:47:31 +0000 Subject: first part of ACL and re-skinning work and some other small stuff --- httemplate/edit/access_group.html | 10 ++ httemplate/edit/access_user.html | 37 +++++++ httemplate/edit/agent_type.cgi | 52 +++------- httemplate/edit/cust_bill_pay.cgi | 87 ++++++++-------- httemplate/edit/cust_credit.cgi | 71 +++++++++----- httemplate/edit/cust_credit_bill.cgi | 90 +++++++++-------- httemplate/edit/cust_main.cgi | 105 +++++++++++--------- httemplate/edit/cust_pkg.cgi | 136 +++++++++++++++----------- httemplate/edit/elements/edit.html | 36 +++++-- httemplate/edit/part_referral.cgi | 36 +++---- httemplate/edit/part_virtual_field.cgi | 19 ++-- httemplate/edit/process/access_group.html | 5 + httemplate/edit/process/access_user.html | 8 ++ httemplate/edit/process/agent_type.cgi | 39 ++------ httemplate/edit/process/cust_bill_pay.cgi | 16 ++- httemplate/edit/process/cust_credit.cgi | 17 +++- httemplate/edit/process/cust_credit_bill.cgi | 16 ++- httemplate/edit/process/elements/process.html | 19 +++- httemplate/edit/svc_domain.cgi | 55 +++++------ 19 files changed, 488 insertions(+), 366 deletions(-) create mode 100644 httemplate/edit/access_group.html create mode 100644 httemplate/edit/access_user.html create mode 100644 httemplate/edit/process/access_group.html create mode 100644 httemplate/edit/process/access_user.html (limited to 'httemplate/edit') diff --git a/httemplate/edit/access_group.html b/httemplate/edit/access_group.html new file mode 100644 index 000000000..11b8df7bc --- /dev/null +++ b/httemplate/edit/access_group.html @@ -0,0 +1,10 @@ +<%= include( 'elements/edit.html', + 'name' => 'Internal Access Group', + 'table' => 'access_group', + 'labels' => { + 'groupnum' => 'Group number', + 'groupname' => 'Group name', + }, + 'viewall_dir' => 'browse', + ) +%> diff --git a/httemplate/edit/access_user.html b/httemplate/edit/access_user.html new file mode 100644 index 000000000..2b19dbf7b --- /dev/null +++ b/httemplate/edit/access_user.html @@ -0,0 +1,37 @@ +<%= include( 'elements/edit.html', + 'name' => 'Internal User', + 'table' => 'access_user', + 'fields' => [ + 'username', + { field=>'_password', type=>'password' }, + 'last', + 'first', + ], + 'labels' => { + 'usernum' => 'User number', + 'username' => 'Username', + '_password' => 'Password', + 'last' => 'Last name', + 'first' => 'First name', + }, + 'viewall_dir' => 'browse', + 'html_bottom' => + sub { + my $access_user = shift; + + '
Internal Access Groups
'. + ntable("#cccccc",2). + ''. + include( '/elements/checkboxes-table.html', + 'source_obj' => $access_user, + 'link_table' => 'access_usergroup', + 'target_table' => 'access_group', + 'name_col' => 'groupname', + 'target_link' => $p.'edit/access_group.html?', + #'disable-able' => 1, + ). + '' + ; + }, + ) +%> diff --git a/httemplate/edit/agent_type.cgi b/httemplate/edit/agent_type.cgi index 944ddd0d0..f5afd3a96 100755 --- a/httemplate/edit/agent_type.cgi +++ b/httemplate/edit/agent_type.cgi @@ -14,9 +14,7 @@ if ( $cgi->param('error') ) { } my $action = $agent_type->typenum ? 'Edit' : 'Add'; -%> - -<%= include("/elements/header.html","$action Agent Type", menubar( +%><%= include("/elements/header.html","$action Agent Type", menubar( 'Main Menu' => "$p", 'View all agent types' => "${p}browse/agent_type.cgi", )) @@ -29,47 +27,29 @@ my $action = $agent_type->typenum ? 'Edit' : 'Add';
Agent Type #<%= $agent_type->typenum || "(NEW)" %> -

+
Agent Type

Select which packages agents of this type may sell to customers
- -<% foreach my $part_pkg ( - qsearch({ 'table' => 'part_pkg', - 'hashref' => { 'disabled' => '' }, - 'select' => 'part_pkg.*', - 'addl_from' => 'LEFT JOIN type_pkgs USING ( pkgpart )', - 'extra_sql' => ( $agent_type->typenum - ? 'OR typenum = '. $agent_type->typenum - : '' - ), - }) - ) { +<%= ntable("#cccccc", 2) %> +<%= include('/elements/checkboxes-table.html', + 'source_obj' => $agent_type, + 'link_table' => 'type_pkgs', + 'target_table' => 'part_pkg', + 'name_callback' => sub { $_[0]->pkg. ' - '. $_[0]->comment; }, + 'target_link' => $p.'edit/part_pkg.cgi?', + 'disable-able' => 1, + + ) %> - -
- $agent_type->typenum, - 'pkgpart' => $part_pkg->pkgpart, - }) - ? 'CHECKED ' - : '' - %> VALUE="ON"> - - <%= $part_pkg->pkgpart %>: - <%= $part_pkg->pkg %> - <%= $part_pkg->comment %> - <%= $part_pkg->disabled =~ /^Y/i ? ' (DISABLED)' : '' %> - -<% } %> - -

+ +
">
- - + +<%= include('/elements/footer.html') %> diff --git a/httemplate/edit/cust_bill_pay.cgi b/httemplate/edit/cust_bill_pay.cgi index 24bce308a..9d3bdd8cb 100755 --- a/httemplate/edit/cust_bill_pay.cgi +++ b/httemplate/edit/cust_bill_pay.cgi @@ -1,4 +1,3 @@ - <% my($paynum, $amount, $invnum); @@ -18,78 +17,76 @@ my $otaker = getotaker; my $p1 = popurl(1); -print header("Apply Payment", ''); -print qq!Error: !, $cgi->param('error'), - "

" - if $cgi->param('error'); -print < -END +%><%= header("Apply Payment", '') %> +<% if ( $cgi->param('error') ) { %> + Error: <%= $cgi->param('error') %> +

+<% } %> + +
+ +<% my $cust_pay = qsearchs('cust_pay', { 'paynum' => $paynum } ); die "payment $paynum not found!" unless $cust_pay; my $unapplied = $cust_pay->unapplied; +%> + +Payment #<%= $paynum %> + -print "Payment # $paynum". - qq!!. - '
Date: '. time2str("%D", $cust_pay->_date). ''. - '
Amount: $'. $cust_pay->paid. ''. - "
Unapplied amount: \$$unapplied" - ; +
Date: <%= time2str("%D", $cust_pay->_date) %> +
Amount: $<%= $cust_pay->paid %> + +
Unapplied amount: $<%= $unapplied %> + +<% my @cust_bill = grep $_->owed != 0, qsearch('cust_bill', { 'custnum' => $cust_pay->custnum } ); -print < + -END - -print qq!
Invoice #"; -print qq!
Amount \$!; +
Invoice # + +
Amount $ -print < - -END +
-print < - - + -END - -%> diff --git a/httemplate/edit/cust_credit.cgi b/httemplate/edit/cust_credit.cgi index aae0df2fc..946b1087b 100755 --- a/httemplate/edit/cust_credit.cgi +++ b/httemplate/edit/cust_credit.cgi @@ -1,4 +1,3 @@ - <% my $conf = new FS::Conf; @@ -25,39 +24,57 @@ my $otaker = getotaker; my $p1 = popurl(1); -print header("Post Credit", ''); -print qq!Error: !, $cgi->param('error'), - "" - if $cgi->param('error'); -print <config('countrydefault')); -
- - - - - - -END - -print '

Credit'. ntable("#cccccc", 2). - 'Date'. - time2str("%D",$_date). ''; - -print qq!Amount\$!; +%> + +<%= header("Post Credit", '') %> + +<% if ( $cgi->param('error') ) { %> + Error: <%= $cgi->param('error') %> +

+<% } %> + + + + + + + + + + + +Credit + +<%= ntable("#cccccc", 2) %> + + Date + <%= time2str("%D",$_date) %> + + + + Amount + $ + + +<% #print qq! Also post refund!; +%> -print qq!Reason!; + + Reason + + -print qq!Auto-apply
to invoices!; + + Auto-apply
to invoices + + -print < +
- +
-END - -%> diff --git a/httemplate/edit/cust_credit_bill.cgi b/httemplate/edit/cust_credit_bill.cgi index 1a97e1312..409ea3c25 100755 --- a/httemplate/edit/cust_credit_bill.cgi +++ b/httemplate/edit/cust_credit_bill.cgi @@ -1,4 +1,3 @@ - <% my($crednum, $amount, $invnum); @@ -23,79 +22,78 @@ my $otaker = getotaker; my $p1 = popurl(1); -print header("Apply Credit", ''); -print qq!Error: !, $cgi->param('error'), - "

" - if $cgi->param('error'); -print < -END +%><%= header("Apply Credit", '') %> +<% if ( $cgi->param('error') ) { %> + Error: <%= $cgi->param('error') %> +

+<% } %> + +
+ +<% my $cust_credit = qsearchs('cust_credit', { 'crednum' => $crednum } ); die "credit $crednum not found!" unless $cust_credit; my $credited = $cust_credit->credited; +%> + +Credit #<%= $crednum %> + + +
Date: <%= time2str("%D", $cust_credit->_date) %> -print "Credit # $crednum". - qq!!. - '
Date: '. time2str("%D", $cust_credit->_date). ''. - '
Amount: $'. $cust_credit->amount. ''. - "
Unapplied amount: \$$credited". - '
Reason: '. $cust_credit->reason. '' - ; +
Amount: $<%= $cust_credit->amount %> +
Unapplied amount: $<%= $credited %> + +
Reason: <%= $cust_credit->reason %> + +<% my @cust_bill = grep $_->owed != 0, qsearch('cust_bill', { 'custnum' => $cust_credit->custnum } ); -print < + -END - -print qq!
Invoice #"; -print qq!
Amount \$!; +
Invoice # + +
Amount $ -print < - -END +
-print < - - + -END - -%> diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 80fec9359..bb2a8618e 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -397,49 +397,66 @@ unless ( $custnum ) { if ( @part_pkg ) { -# print "

First package", &itable("#cccccc", "0 ALIGN=LEFT"), -#apiabuse & undesirable wrapping - print "
First package", &ntable("#cccccc"), - qq!"; - - #false laziness: (mostly) copied from edit/svc_acct.cgi - #$ulen = $svc_acct->dbdef_table->column('username')->length; - my $ulen = dbdef->table('svc_acct')->column('username')->length; - my $ulen2 = $ulen+2; - my $passwordmax = $conf->config('passwordmax') || 8; - my $pmax2 = $passwordmax + 2; - print <Username - -Password - -(blank to generate) -END - - print 'Access number' - . - &FS::svc_acct_pop::popselector($popnum). - '' - ; - } -} + # print "

First package", &itable("#cccccc", "0 ALIGN=LEFT"), + #apiabuse & undesirable wrapping + + %> +
First package + <%= ntable("#cccccc") %> + + + + + + + + <% + #false laziness: (mostly) copied from edit/svc_acct.cgi + #$ulen = $svc_acct->dbdef_table->column('username')->length; + my $ulen = dbdef->table('svc_acct')->column('username')->length; + my $ulen2 = $ulen+2; + my $passwordmax = $conf->config('passwordmax') || 8; + my $pmax2 = $passwordmax + 2; + %> + + + Username + + MAXLENGTH=<%= $ulen %>> + + + + + Password + + MAXLENGTH=<%= $passwordmax %>> + (blank to generate) + + + + + Access number + <%= FS::svc_acct_pop::popselector($popnum) %> + + + + <% } %> + +<% } %> -my $otaker = $cust_main->otaker; -print qq!!, - qq!

!, - "", -; + +
+"> +
+ + +<%= include('/elements/footer.html') %> -%> diff --git a/httemplate/edit/cust_pkg.cgi b/httemplate/edit/cust_pkg.cgi index ce1c86612..174d4dde1 100755 --- a/httemplate/edit/cust_pkg.cgi +++ b/httemplate/edit/cust_pkg.cgi @@ -1,4 +1,3 @@ - <% my %pkg = (); @@ -29,48 +28,62 @@ if ( $cgi->param('error') ) { } my $p1 = popurl(1); -print header("Add/Edit Packages", ''); -print qq!Error: !, $cgi->param('error'), - "" - if $cgi->param('error'); +%><%= include('/elements/header.html', "Add/Edit Packages", '') %> -print qq!
!; +<% if ( $cgi->param('error') ) { %> + Error: <%= $cgi->param('error') %> +<% } %> -print qq!!; + + + +<% #current packages -my @cust_pkg = qsearch('cust_pkg',{ 'custnum' => $custnum, 'cancel' => '' } ); +my @cust_pkg = qsearch('cust_pkg', { 'custnum' => $custnum, 'cancel' => '' } ); if (@cust_pkg) { - print < - - Pkg # - Package description - -

-END +%> + + Current packages - select to remove (services are moved to a new package below) + + + + + +

- foreach (sort { $all_pkg{$a->getfield('pkgpart')} cmp $all_pkg{$b->getfield('pkgpart')} } @cust_pkg) { + <% + + foreach ( sort { $all_pkg{ $a->getfield('pkgpart') } + cmp $all_pkg{ $b->getfield('pkgpart') } + } + @cust_pkg + ) + { my($pkgnum,$pkgpart)=( $_->getfield('pkgnum'), $_->getfield('pkgpart') ); my $checked = $remove_pkg{$pkgnum} ? ' CHECKED' : ''; - print < - - \n - - -END - } - print qq!
Pkg #Package description
$pkgnum:$all_pkg{$pkgpart} - $all_comment{$pkgpart}


!; -} -print <
-END + %> + + + > + <%= $pkgnum %>: + <%= $all_pkg{$pkgpart} %> - <%= $all_comment{$pkgpart} %> + + + <% } %> + + +

+<% } %> + +Order new packages +

+ +<% my $cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); my $agent = qsearchs('agent',{'agentnum'=> $cust_main->agentnum }); @@ -79,13 +92,15 @@ my %agent_pkgs = map { ( $_->pkgpart , $all_pkg{$_->pkgpart} ) } my $count = 0; my $pkgparts = 0; -print < + -END + +<% #foreach my $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) { foreach my $pkgpart ( sort { $agent_pkgs{$a} cmp $agent_pkgs{$b} } keys(%agent_pkgs) ) { @@ -93,38 +108,43 @@ foreach my $pkgpart ( sort { $agent_pkgs{$a} cmp $agent_pkgs{$b} } next unless exists $pkg{$pkgpart}; #skip disabled ones #print qq!! if ( $count == 0 ); my $value = $cgi->param("pkg$pkgpart") || 0; - print < + - - - + + + -END + +<% $count ++ ; #if ( $count == 2 ) { # print qq!\n! ; # $count = 0; #} } -print qq!
Qty. Package Description
$pkgpart:$pkg{$pkgpart} - $comment{$pkgpart} + " VALUE="<%= $value %>" SIZE="2" MAXLENGTH="2"> + <%= $pkgpart %>:<%= $pkg{$pkgpart} %> - <%= $comment{$pkgpart}%>
!; - -unless ( $pkgparts ) { - my $p2 = popurl(2); - my $typenum = $agent->typenum; - my $agent_type = qsearchs( 'agent_type', { 'typenum' => $typenum } ); - my $atype = $agent_type->atype; - print <package definitions, or agent type -$atype not allowed to purchase -any packages.) -END -} +%> -#submit -print < - - - -END + + +<% unless ( $pkgparts ) { + my $p2 = popurl(2); + my $typenum = $agent->typenum; + my $agent_type = qsearchs( 'agent_type', { 'typenum' => $typenum } ); + my $atype = $agent_type->atype; %> + + (No package definitions, + or agent type + <%= $atype %> + is not allowed to purchase any packages.) + +<% } %> + +

+ + + +<%= include('/elements/footer.html') %> diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html index 5486b4b00..120c03a3c 100644 --- a/httemplate/edit/elements/edit.html +++ b/httemplate/edit/elements/edit.html @@ -17,6 +17,13 @@ # 'menubar' => '', #menubar arrayref # # 'viewall_dir' => '', #'search' or 'browse', defaults to 'search' + # + # 'html_bottom' => '', #string + # 'html_bottom' => sub { + # my $object = shift; + # # ... + # "html_string"; + # }, my(%opt) = @_; @@ -27,6 +34,7 @@ my $fields = $opt{'fields'} #|| [ grep { $_ ne $pkey } dbdef->table($table)->columns ]; || [ grep { $_ ne $pkey } fields($table) ]; + #my @actualfields = map { ref($_) ? $_->{'field'} : $_ } @$fields; my $object; if ( $cgi->param('error') ) { @@ -63,10 +71,7 @@ ); } -%> - - -<%= include("/elements/header.html", $title, +%><%= include("/elements/header.html", $title, include( '/elements/menubar.html', @menubar ) ) %> @@ -86,7 +91,18 @@ <%= ntable("#cccccc",2) %> -<% foreach my $field ( @$fields ) { %> +<% foreach my $f ( @$fields ) { + + my( $field, $type); + if ( ref($f) ) { + $field = $f->{'field'}, + $type = $f->{'type'} || 'text', + } else { + $field = $f; + $type = 'text'; + } + +%> @@ -98,12 +114,11 @@ <% - #just text in one size for now... eventually more options for - # uneditable, hidden, , etc. fields %> - + @@ -112,6 +127,11 @@ +<%= ref( $opt{'html_bottom'} ) + ? &{ $opt{'html_bottom'} }( $object ) + : $opt{'html_bottom'} +%> +
"> diff --git a/httemplate/edit/part_referral.cgi b/httemplate/edit/part_referral.cgi index f784dfa3e..dce1e6394 100755 --- a/httemplate/edit/part_referral.cgi +++ b/httemplate/edit/part_referral.cgi @@ -1,4 +1,3 @@ - <% my $part_referral; @@ -17,32 +16,29 @@ my $action = $part_referral->refnum ? 'Edit' : 'Add'; my $hashref = $part_referral->hashref; my $p1 = popurl(1); -print header("$action Advertising source", menubar( + +%><%= include('/elements/header.html', "$action Advertising source", menubar( 'Main Menu' => popurl(2), 'View all advertising sources' => popurl(2). "browse/part_referral.cgi", -)); +)) %> + +<% if ( $cgi->param('error') ) { %> + Error: <%= $cgi->param('error') %> +<% } %> -print qq!Error: !, $cgi->param('error'), - "" - if $cgi->param('error'); +

-print qq!!; + -print qq!!; +<% #print "Referral #", $hashref->{refnum} ? $hashref->{refnum} : "(NEW)"; +%> -print < -END +Advertising source -print qq!
!; +
+"> -print < - - -END + -%> +<%= include('/elements/footer.html') %> diff --git a/httemplate/edit/part_virtual_field.cgi b/httemplate/edit/part_virtual_field.cgi index fb10321e8..7b2c768a7 100644 --- a/httemplate/edit/part_virtual_field.cgi +++ b/httemplate/edit/part_virtual_field.cgi @@ -1,4 +1,3 @@ - <% my ($vfieldpart, $part_virtual_field); @@ -21,12 +20,14 @@ if ( $cgi->param('error') ) { my $action = $part_virtual_field->vfieldpart ? 'Edit' : 'Add'; my $p1 = popurl(1); -print header("$action Virtual Field Definition", ''); -print qq!Error: !, $cgi->param('error'), - "" - if $cgi->param('error'); -%> +%><%= include('/elements/header.html', "$action Virtual Field Definition") %> + +<% if ( $cgi->param('error') ) { %> + Error: <%= $cgi->param('error') %> +

+<% } %> +
@@ -83,10 +84,8 @@ Field #<%=$vfieldpart or "(NEW)"%>

-

+
If you don't understand what check_block and list_source mean, LEAVE THEM BLANK. We mean it. - - - +<%= include('/elements/footer.html') %> diff --git a/httemplate/edit/process/access_group.html b/httemplate/edit/process/access_group.html new file mode 100644 index 000000000..e8c6d07b1 --- /dev/null +++ b/httemplate/edit/process/access_group.html @@ -0,0 +1,5 @@ +<%= include( 'elements/process.html', + 'table' => 'access_group', + 'viewall_dir' => 'browse', + ) +%> diff --git a/httemplate/edit/process/access_user.html b/httemplate/edit/process/access_user.html new file mode 100644 index 000000000..a6c2a36b1 --- /dev/null +++ b/httemplate/edit/process/access_user.html @@ -0,0 +1,8 @@ +<%= include( 'elements/process.html', + 'table' => 'access_user', + 'viewall_dir' => 'browse', + 'process_m2m' => { 'link_table' => 'access_usergroup', + 'target_table' => 'access_group', + }, + ) +%> diff --git a/httemplate/edit/process/agent_type.cgi b/httemplate/edit/process/agent_type.cgi index 516594573..fd8ca8833 100755 --- a/httemplate/edit/process/agent_type.cgi +++ b/httemplate/edit/process/agent_type.cgi @@ -11,43 +11,24 @@ my $new = new FS::agent_type ( { my $error; if ( $typenum ) { - $error=$new->replace($old); + $error = $new->replace($old); } else { - $error=$new->insert; - $typenum=$new->getfield('typenum'); + $error = $new->insert; + $typenum = $new->getfield('typenum'); } +#$error ||= $new->process_m2m( ); if ( $error ) { $cgi->param('error', $error); print $cgi->redirect(popurl(2). "agent_type.cgi?". $cgi->query_string ); } else { - #false laziness w/ edit/process/part_svc.cgi - foreach my $part_pkg (qsearch('part_pkg',{})) { - my($pkgpart)=$part_pkg->getfield('pkgpart'); - - my($type_pkgs)=qsearchs('type_pkgs',{ - 'typenum' => $typenum, - 'pkgpart' => $pkgpart, - }); - if ( $type_pkgs && ! $cgi->param("pkgpart$pkgpart") ) { - my($d_type_pkgs)=$type_pkgs; #need to save $type_pkgs for below. - $error=$d_type_pkgs->delete; - die $error if $error; - - } elsif ( $cgi->param("pkgpart$pkgpart") - && ! $type_pkgs - ) { - #ok to clobber it now (but bad form nonetheless?) - $type_pkgs=new FS::type_pkgs ({ - 'typenum' => $typenum, - 'pkgpart' => $pkgpart, - }); - $error= $type_pkgs->insert; - die $error if $error; - } - - } + my $error = $new->process_m2m( + 'link_table' => 'type_pkgs', + 'target_table' => 'part_pkg', + 'params' => scalar($cgi->Vars) + ); + die $error if $error; print $cgi->redirect(popurl(3). "browse/agent_type.cgi"); } diff --git a/httemplate/edit/process/cust_bill_pay.cgi b/httemplate/edit/process/cust_bill_pay.cgi index 0025b16b5..fc668bb07 100755 --- a/httemplate/edit/process/cust_bill_pay.cgi +++ b/httemplate/edit/process/cust_bill_pay.cgi @@ -33,11 +33,19 @@ if ($cgi->param('invnum') =~ /^Refund$/) { my $error = $new->insert; if ( $error ) { + $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "cust_bill_pay.cgi?". $cgi->query_string ); + %><%= $cgi->redirect(popurl(2). "cust_bill_pay.cgi?". $cgi->query_string ) %><% + } else { - print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); -} + #print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); + + %><%= header('Payment application sucessful') %> + + + -%> +<% } %> diff --git a/httemplate/edit/process/cust_credit.cgi b/httemplate/edit/process/cust_credit.cgi index 85bfd4489..6a4ef194a 100755 --- a/httemplate/edit/process/cust_credit.cgi +++ b/httemplate/edit/process/cust_credit.cgi @@ -13,14 +13,23 @@ my $error = $new->insert; if ( $error ) { $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "cust_credit.cgi?". $cgi->query_string ); + + %><%= $cgi->redirect(popurl(2). "cust_credit.cgi?". $cgi->query_string ) %><% + } else { + if ( $cgi->param('apply') eq 'yes' ) { my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum }) or die "unknown custnum $custnum"; $cust_main->apply_credits; } - print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); -} + #print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); + + %><%= header('Credit sucessful') %> + + + -%> +<% } %> diff --git a/httemplate/edit/process/cust_credit_bill.cgi b/httemplate/edit/process/cust_credit_bill.cgi index 28f892f62..3b759536f 100755 --- a/httemplate/edit/process/cust_credit_bill.cgi +++ b/httemplate/edit/process/cust_credit_bill.cgi @@ -34,11 +34,19 @@ if ($cgi->param('invnum') =~ /^Refund$/) { my $error = $new->insert; if ( $error ) { + $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "cust_credit_bill.cgi?". $cgi->query_string ); + %><%= $cgi->redirect(popurl(2). "cust_credit_bill.cgi?". $cgi->query_string ) %><% + } else { - print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); -} + #print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); + + %><%= header('Credit application sucessful') %> + + + -%> +<% } %> diff --git a/httemplate/edit/process/elements/process.html b/httemplate/edit/process/elements/process.html index 83ff6f728..59ad35ee4 100644 --- a/httemplate/edit/process/elements/process.html +++ b/httemplate/edit/process/elements/process.html @@ -2,10 +2,21 @@ # options example... # + ### + ##req + ## # 'table' => + # # #? 'primary_key' => #required when the dbdef doesn't know...??? # #? 'fields' => [] + # + ### + ##opt + ### # 'viewall_dir' => '', #'search' or 'browse', defaults to 'search' + # 'process_m2m' => { 'link_table' => 'link_table_name', + # 'target_table' => 'target_table_name', + # }. my(%opt) = @_; @@ -31,12 +42,16 @@ if ( $pkeyvalue ) { $error = $new->replace($old); } else { - warn $new; $error = $new->insert; - warn $error; $pkeyvalue = $new->getfield($pkey); } + if ( !$error && $opt{'process_m2m'} ) { + $error = $new->process_m2m( %{ $opt{'process_m2m'} }, + 'params' => scalar($cgi->Vars), + ); + } + if ( $error ) { $cgi->param('error', $error); print $cgi->redirect(popurl(2). "$table.html?". $cgi->query_string ); diff --git a/httemplate/edit/svc_domain.cgi b/httemplate/edit/svc_domain.cgi index ca0e3398f..f47ba0a8f 100755 --- a/httemplate/edit/svc_domain.cgi +++ b/httemplate/edit/svc_domain.cgi @@ -1,4 +1,3 @@ - <% my($svcnum, $pkgnum, $svcpart, $kludge_action, $purpose, $part_svc, @@ -66,33 +65,31 @@ my $otaker = getotaker; my $domain = $svc_domain->domain; my $p1 = popurl(1); -print header("$action $svc", ''); - -print qq!Error: !, $cgi->param('error'), - "" - if $cgi->param('error'); - -print < - - - -END - -print qq!New!; -print qq!
Transfer!; - -print <Domain -
Purpose/Description: -

- - - -END %> + +<%= include('/elements/header.html', "$action $svc", '') %> + +<% if ( $cgi->param('error') ) { %> + Error: <%= $cgi->param('error') %> +<% } %> + +

+ + + + +>New +
+ +>Transfer + +

Domain + +
Purpose/Description: + +

+ +

+ +<%= include('/elements/footer.html') %> -- cgit v1.2.1