summaryrefslogtreecommitdiff
path: root/httemplate/edit
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2015-10-13 10:10:40 -0700
committerIvan Kohler <ivan@freeside.biz>2015-10-13 10:10:40 -0700
commit2b2dd969f3c18751afc583ad1e836ab8e6f73b5d (patch)
tree72ad19092f9d3a5118add9a55067b8a97c168f46 /httemplate/edit
parentd31d59c63c8f4dfd52ca19a02ffcf32fcf49f497 (diff)
parentcd468ecb9a321ca96254b7204f6dc193b11cd903 (diff)
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'httemplate/edit')
-rwxr-xr-xhttemplate/edit/cust_refund.cgi10
-rw-r--r--httemplate/edit/deploy_zone-fixed.html85
-rw-r--r--httemplate/edit/deploy_zone-mobile.html21
-rw-r--r--httemplate/edit/msg_template.html376
-rw-r--r--httemplate/edit/msg_template/email.html385
-rw-r--r--httemplate/edit/msg_template/http.html82
-rwxr-xr-xhttemplate/edit/part_pkg.cgi23
-rw-r--r--httemplate/edit/process/change-cust_pkg.html39
-rwxr-xr-xhttemplate/edit/process/cust_credit_bill.cgi3
-rwxr-xr-xhttemplate/edit/process/cust_refund.cgi31
-rw-r--r--httemplate/edit/process/deploy_zone-fixed.html35
-rw-r--r--httemplate/edit/process/deploy_zone-mobile.html19
-rw-r--r--httemplate/edit/process/elements/process.html23
-rw-r--r--httemplate/edit/process/msg_template.html18
-rw-r--r--httemplate/edit/process/rate_detail.html1
-rw-r--r--httemplate/edit/rate.cgi4
16 files changed, 685 insertions, 470 deletions
diff --git a/httemplate/edit/cust_refund.cgi b/httemplate/edit/cust_refund.cgi
index fa049a39a..bfcbfe725 100755
--- a/httemplate/edit/cust_refund.cgi
+++ b/httemplate/edit/cust_refund.cgi
@@ -139,16 +139,8 @@ my $payinfo = $cgi->param('payinfo');
my $reason = $cgi->param('reason');
my $link = $cgi->param('popup') ? 'popup' : '';
-my @rights = ();
-push @rights, 'Post refund' if $payby =~ /^(BILL|CASH|MCRD|MCHK)$/;
-push @rights, 'Post check refund' if $payby eq 'BILL';
-push @rights, 'Post cash refund ' if $payby eq 'CASH';
-push @rights, 'Refund payment' if $payby =~ /^(CARD|CHEK)$/;
-push @rights, 'Refund credit card payment' if $payby eq 'CARD';
-push @rights, 'Refund Echeck payment' if $payby eq 'CHEK';
-
die "access denied"
- unless $FS::CurrentUser::CurrentUser->access_right(\@rights);
+ unless $FS::CurrentUser::CurrentUser->refund_access_right($payby);
my( $paynum, $cust_pay ) = ( '', '' );
if ( $cgi->param('paynum') =~ /^(\d+)$/ ) {
diff --git a/httemplate/edit/deploy_zone-fixed.html b/httemplate/edit/deploy_zone-fixed.html
index 90d1b6667..b8d9f8bbc 100644
--- a/httemplate/edit/deploy_zone-fixed.html
+++ b/httemplate/edit/deploy_zone-fixed.html
@@ -54,29 +54,36 @@
value => 'Contractually guaranteed speed (Mbps)' },
'cir_speed_down',
'cir_speed_up',
-
- { type => 'tablebreak-tr-title', value => 'Census blocks'},
- { field => 'file',
- type => 'file-upload',
- },
- { field => 'format',
- type => 'hidden',
- value => 'plain',
- },
- { field => 'censusyear',
- type => 'select',
- options => [ '', qw( 2013 2012 2011 ) ],
- },
-
- { type => 'tablebreak-tr-title', value => '', },
- { field => 'blocknum',
- type => 'deploy_zone_block',
- o2m_table => 'deploy_zone_block',
- m2_label => ' ',
- m2_error_callback => $m2_error_callback,
- },
+ { type => 'tablebreak-tr-title', value => 'Footprint'},
+ { field => 'vertices',
+ type => 'polygon',
+ curr_value_callback => sub {
+ my ($cgi, $object) = @_;
+ $cgi->param('vertices') || $object->vertices_json;
+ },
+ }
+#
+# { type => 'tablebreak-tr-title', value => 'Census blocks'},
+# { field => 'file',
+# type => 'file-upload',
+# },
+# { field => 'format',
+# type => 'hidden',
+# value => 'plain',
+# },
+# { field => 'censusyear',
+# type => 'hidden',
+# options => [ '', qw( 2013 2012 2011 ) ],
+# },
+#
+# { type => 'tablebreak-tr-title', value => '', },
+# { field => 'blocknum',
+# type => 'deploy_zone_block',
+# o2m_table => 'deploy_zone_block',
+# m2_label => ' ',
+# m2_error_callback => $m2_error_callback,
+# },
],
-
&>
<%init>
my $curuser = $FS::CurrentUser::CurrentUser;
@@ -90,22 +97,22 @@ my $technology_labels = FS::part_pkg_fcc_option->technology_labels;
my $media_types = FS::part_pkg_fcc_option->media_types;
delete $media_types->{'Mobile Wireless'}; # cause this is the fixed zone page
-my $m2_error_callback = sub {
- my ($cgi, $deploy_zone) = @_;
- my @blocknums = grep {
- /^blocknum\d+/ and length($cgi->param($_.'_censusblock'))
- } $cgi->param;
-
- sort { $a->censusblock <=> $b->censusblock }
- map {
- my $k = $_;
- FS::deploy_zone_block->new({
- blocknum => scalar($cgi->param($k)),
- zonenum => $deploy_zone->zonenum,
- censusblock => scalar($cgi->param($k.'_censusblock')),
- censusyear => scalar($cgi->param($k.'_censusyear')),
- })
- } @blocknums;
-};
+#my $m2_error_callback = sub {
+# my ($cgi, $deploy_zone) = @_;
+# my @blocknums = grep {
+# /^blocknum\d+/ and length($cgi->param($_.'_censusblock'))
+# } $cgi->param;
+#
+# sort { $a->censusblock <=> $b->censusblock }
+# map {
+# my $k = $_;
+# FS::deploy_zone_block->new({
+# blocknum => scalar($cgi->param($k)),
+# zonenum => $deploy_zone->zonenum,
+# censusblock => scalar($cgi->param($k.'_censusblock')),
+# censusyear => scalar($cgi->param($k.'_censusyear')),
+# })
+# } @blocknums;
+#};
</%init>
diff --git a/httemplate/edit/deploy_zone-mobile.html b/httemplate/edit/deploy_zone-mobile.html
index d049cb018..8cec298bf 100644
--- a/httemplate/edit/deploy_zone-mobile.html
+++ b/httemplate/edit/deploy_zone-mobile.html
@@ -49,14 +49,21 @@
'adv_speed_down',
'adv_speed_up',
{ type => 'tablebreak-tr-title', value => 'Footprint'},
- { field => 'vertexnum',
- type => 'deploy_zone_vertex',
- o2m_table => 'deploy_zone_vertex',
- m2_label => ' ',
- m2_error_callback => $m2_error_callback,
- },
- ],
+ { field => 'vertices',
+ type => 'polygon',
+ curr_value_callback => sub {
+ my ($cgi, $object) = @_;
+ $cgi->param('vertices') || $object->vertices_json;
+ },
+ }
+# { field => 'vertexnum',
+# type => 'deploy_zone_vertex',
+# o2m_table => 'deploy_zone_vertex',
+# m2_label => ' ',
+# m2_error_callback => $m2_error_callback,
+# },
+ ],
&>
<%init>
my $curuser = $FS::CurrentUser::CurrentUser;
diff --git a/httemplate/edit/msg_template.html b/httemplate/edit/msg_template.html
index 7f3824127..889b10731 100644
--- a/httemplate/edit/msg_template.html
+++ b/httemplate/edit/msg_template.html
@@ -1,373 +1,9 @@
-<& elements/edit.html,
- 'html_init' => '<TABLE id="outerTable"><TR><TD>',
- 'body_etc' => $body_etc,
- 'name_singular' => 'template',
- 'table' => 'msg_template',
- 'viewall_dir' => 'browse',
- 'agent_virt' => 1,
- 'agent_null' => 1,
- 'agent_null_right' => [ 'View global templates', 'Edit global templates' ],
-
- 'fields' => \@fields,
- 'labels' => {
- 'msgnum' => 'Template',
- 'agentnum' => 'Agent',
- 'msgname' => 'Template name',
- 'from_addr' => 'From: ',
- 'bcc_addr' => 'Bcc: ',
- 'locale' => 'Locale',
- 'subject' => 'Subject: ',
- 'body' => 'Message body',
- },
- 'edit_callback' => \&edit_callback,
- 'error_callback' => \&edit_callback,
- 'html_bottom' => '</DIV>',
- 'html_table_bottom'=> \&html_table_bottom,
- 'html_foot' => ( $no_submit ? '' : "</TD>$sidebar</TR></TABLE>" ),
- 'no_submit' => $no_submit,
-&>
<%init>
-
-my $curuser = $FS::CurrentUser::CurrentUser;
-
-die "access denied"
- unless $curuser->access_right([ 'View templates', 'View global templates',
- 'Edit templates', 'Edit global templates',
- ]);
-
-my $body_etc = '';
-$body_etc = q!onload="document.getElementById('locale').onchange()"!
- if $cgi->param('locale') eq 'new';
-
-my $msgnum = $cgi->param('msgnum');
-my $msg_template = $msgnum ? qsearchs('msg_template', {msgnum=>$msgnum}) : '';
-
-my $no_submit = 0;
-my @fields = ();
-if ( $curuser->access_right('Edit global templates')
- || ( $curuser->access_right('Edit templates')
- && $msg_template
- && $msg_template->agentnum
- && $curuser->agentnums_href->{$msg_template->agentnum}
- )
- )
-{
- push @fields,
- { field => 'agentnum',
- type => 'select-agent',
- },
- { field => 'msgname', size=>60, },
- { field => 'from_addr', size=>60, },
- { field => 'bcc_addr', size=>60, },
- { type => 'tablebreak-tabs',
- include_opt_callback => \&menubar_opt_callback,
- },
- # template_content fields
- { field => 'locale', type => 'hidden' },
- { field => 'subject', size=>60, },
- { field => 'body',
- type => 'htmlarea',
- width => 763,
- config=> { extraPlugins => 'blockprotect' },
- },
- ;
-} else { #readonly
-
- $no_submit = 1;
-
- push @fields,
- { field => 'agentnum',
- type => 'select-agent',
- fixed => 1,
- },
- { field => 'msgname', type => 'fixed', },
- { field => 'from_addr', type => 'fixed', },
- { field => 'bcc_addr', type => 'fixed', },
- { type => 'tablebreak-tabs',
- include_opt_callback => \&menubar_opt_callback,
- },
- # template_content fields
- { field => 'locale', type => 'hidden' },
- { field => 'subject', type => 'fixed', },
- { field => 'body',
- type => 'fixed',
- noescape => 1,
- },
- ;
-
+my $msgclass = 'email';
+if ( $cgi->param('msgnum') =~ /^(\d+)$/ ) {
+ my $msg_template = FS::msg_template->by_key($1)
+ or die "unknown msgnum $1";
+ $msgclass = $msg_template->msgclass;
}
-
-sub new_callback {
- my ($cgi, $object, $fields_listref, $opt_hashref) = @_;
- my $template_content = new FS::template_content { 'locale' => '' };
- $object->{'Hash'} = { $object->hash, $template_content->hash };
-}
-
-sub edit_callback {
- my ($cgi, $object, $fields_listref, $opt_hashref) = @_;
- $cgi->param('locale') =~ /^(\w*)$/ or die 'bad locale '.$cgi->param('locale');
- my $locale = $1;
-
- # fetch the content object and merge its fields
- my %args = (
- 'msgnum' => $object->msgnum,
- 'locale' => $locale
- );
- my $template_content = qsearchs('template_content', \%args)
- || new FS::template_content( { %args });
- $object->{'Hash'} = { $object->hash, $template_content->hash };
-
- # set up the locale selector if this is a new content
- if ( $locale eq 'new' ) {
-
- # make a list of available locales
- my $content_locales = $object->content_locales;
- my @locales = grep { !exists($content_locales->{$_}) }
- FS::Conf->new->config('available-locales');
- my %labels;
- foreach (@locales) {
- my %info = FS::Locales->locale_info($_);
- $labels{$_} = $info{'label'};
- }
- unshift @locales, 'new';
- $labels{'new'} = 'Select language';
-
- # insert a field def
- my $i = 0;
- $i++ until ( $fields_listref->[$i]->{'field'} eq 'locale' );
- my $locale_field = $fields_listref->[$i];
-
- my $onchange_locale = "document.getElementById('submit').disabled =
- (this.options[this.selectedIndex].value == 'new');";
-
- %$locale_field = (
- field => 'locale',
- type => 'select',
- options => \@locales,
- labels => \%labels,
- curr_value => 'new',
- onchange => $onchange_locale,
- );
- }
-}
-
-sub menubar_opt_callback {
- my $object = shift;
- # generate no tabs for new msg_templates.
- my $msgnum = $object->msgnum or return;
- my (@tabs, @options, %labels);
- push @tabs, mt('Default'), '';
- my $display_new = 0;
- my $selected = '';
- foreach my $l (FS::Locales->locales) {
- if ( exists $object->content_locales->{$l} ) {
- my %info = FS::Locales->locale_info($l);
- push @tabs,
- $info{'label'},
- ';locale='.$l;
- $selected = $info{'label'} if $object->locale eq $l;
- }
- else {
- $display_new = 1; # there is at least one unused locale left
- }
- }
- push @tabs, mt('New'), ';locale=new' if $display_new;
- $selected = mt('New') if $object->locale eq 'new';
- $selected ||= mt('Default');
- (
- 'url_base' => $p.'edit/msg_template.html?msgnum='.$msgnum,
- 'selected' => $selected,
- 'tabs' => \@tabs
- );
-}
-
-my $onchange_locale = '';
-
-# Create hints pane
-
-my %substitutions = (
- 'cust_main' => [
- '$display_custnum'=> 'Customer#',
- '$agentnum' => 'Agent#',
- '$agent_name' => 'Agent name',
- '$payby' => 'Payment method',
- '$paymask' => 'Card/account# (masked)',
- '$payname' => 'Name on card/bank name',
- '$paytype' => 'Account type',
- '$payip' => 'IP address used to submit payment info',
- '$num_ncancelled_pkgs' => '# of active packages',
- '$num_cancelled_pkgs' => '# of cancelled packages',
- '$num_pkgs' => '# of packages',
- '$classname' => 'Customer class',
- '$categoryname' => 'Customer category',
- '$balance' => 'Current balance',
- '$credit_limit' => 'Credit limit',
- '$invoicing_list_emailonly' => 'Billing email address',
- #'$cust_status' => 'Status (raw internal label)',
- '$cust_status_label' => 'Status (display label)',
- '$cust_statuscolor' => 'Status color code',
- '$company_name' => 'Our company name',
- '$company_address'=> 'Our company address',
- '$company_phonenum' => 'Our phone number',
- '$selfservice_server_base_url' => 'Base URL of customer self-service',
- ],
- 'contact' => [ # duplicate this for shipping
- '$name' => 'Company and contact name',
- '$name_short' => 'Company or contact name',
- '$company' => 'Company name',
- '$contact' => 'Contact name (last, first)',
- '$contact_firstlast'=> 'Contact name (first last)',
- '$first' => 'First name',
- '$last' => 'Last name',
- '$address1' => 'Address line 1',
- '$address2' => 'Address line 2',
- '$city' => 'City',
- '$county' => 'County',
- '$state' => 'State',
- '$zip' => 'Zip',
- '$country' => 'Country',
- '$daytime' => 'Day phone',
- '$night' => 'Night phone',
- '$mobile' => 'Mobile phone',
- '$fax' => 'Fax',
- ],
- 'service' => [
- '$ship_address1' => 'Address line 1',
- '$ship_address2' => 'Address line 2',
- '$ship_city' => 'City',
- '$ship_county' => 'County',
- '$ship_state' => 'State',
- '$ship_zip' => 'Zip',
- '$ship_country' => 'Country',
- ],
- 'cust_bill' => [
- '$invnum' => 'Invoice#',
- '$_date_pretty' => 'Invoice date',
- '$due_date' => 'Invoice due date (timestamp)',
- '$due_date2str' => 'Invoice due date (human readable)',
- ],
- 'cust_pkg' => [
- '$pkgnum' => 'Package#',
- '$pkg' => 'Package description',
- '$pkg_label' => 'Description + comment',
- '$status' => 'Status',
- '$statuscolor' => 'Status color code',
- '$start_ymd' => 'Start date',
- '$setup_ymd' => 'Setup date',
- '$last_bill_ymd' => 'Last bill date',
- '$next_bill_ymd' => 'Next bill date',
- '$susp_ymd' => 'Suspended on date',
- '$cancel_ymd' => 'Canceled on date',
- '$adjourn_ymd' => 'Adjournment date',
- '$expire_ymd' => 'Expiration date',
- '$labels_short' => 'Service labels',
- '$location_label' => 'Service location',
- ],
- 'svc_acct' => [
- '$svcnum' => 'Service#',
- '$username' => 'Login name',
- '$password' => 'Password',
- '$domain' => 'Domain name',
- ],
- 'svc_domain' => [
- '$svcnum' => 'Service#',
- '$domain' => 'Domain name',
- '$registrar' => 'Registrar name',
- '$catchall' => 'Catchall email',
- ],
- 'svc_phone' => [
- '$svcnum' => 'Service#',
- '$phonenum' => 'Phone number',
- '$countrycode' => 'Country code',
- '$domain' => 'Domain name'
- ],
- 'svc_broadband' => [
- '$svcnum' => 'Service#',
- '$ip_addr' => 'IP address',
- '$mac_addr' => 'MAC address',
- '$speed_up' => 'Upstream speed',
- '$speed_down' => 'Downstream speed',
- ],
- 'cust_pay' => [
- '$paynum' => 'Payment#',
- '$paid' => 'Amount',
- '$payby' => 'Payment method',
- '$date' => 'Payment date',
- '$payinfo' => 'Card/account# (masked)',
- '$error' => 'Decline reason',
- ],
-);
-
-tie my %sections, 'Tie::IxHash', (
-'contact' => 'Name and contact info (billing)',
-'service' => 'Service address',
-'cust_main' => 'Customer status and payment info',
-'cust_pkg' => 'Package fields',
-'cust_bill' => 'Invoice fields',
-'cust_pay' => 'Payment fields',
-'svc_acct' => 'Login service fields',
-'svc_domain'=> 'Domain service fields',
-'svc_phone' => 'Phone service fields',
-'svc_broadband' => 'Broadband service fields',
-);
-
-my $widget = new HTML::Widgets::SelectLayers(
- 'options' => \%sections,
- 'form_name' => 'dummy',
- 'html_between'=>'</FORM><FONT SIZE=-1>',
- 'selected_layer'=>(keys(%sections))[0],
- 'layer_callback' => sub {
- my $section = shift;
- my $html = include('/elements/table-grid.html');
- my @hints = @{ $substitutions{$section} };
- while(@hints) {
- my $key = shift @hints;
- $html .= qq!\n<TR><TD><A href="javascript:insertHtml('{$key}')">$key</A></TD>!;
- $html .= "\n<TD>".shift(@hints).'</TD></TR>';
- }
- $html .= "\n</TABLE>";
- return $html;
- },
-);
-
-my $sidebar = '
-<SCRIPT TYPE="text/javascript">
-function insertHtml(what) {
- var oEditor = CKEDITOR.instances["body"];
- oEditor.insertHtml(what);
-};
-
-function areyousure(url, message) {
- if (confirm(message))
- window.location.href = url;
-}
-</SCRIPT>
-<TD valign="top"><FORM name="dummy">
-Substitutions: '
-. $widget->html .
-'<BR>Click links to insert.
-<BR>Enclose substitutions and other Perl expressions in braces:
-<BR>{ $name } = ExampleCo (Smith, John)
-<BR>{ time2str("%D", time) } = '.time2str("%D", time).'
-</FONT></TD>
-';
-
-sub html_table_bottom {
- my $object = shift;
- $cgi->param('locale') =~ /^(\w+)$/;
- my $locale = $1;
- my $html;
- if ( $locale and $locale ne 'new' ) {
- # set up a delete link
- my $msgnum = $object->msgnum;
- my $url = $p."misc/delete-template_content.html?msgnum=$msgnum;locale=$1";
- my $link = qq!<A HREF="javascript:areyousure('$url','Really delete this template?')">! .
- 'Delete this template' .
- '</A>';
- $html = qq!<TR><TD></TD>
- <TD STYLE="font-style: italic; font-size: small">$link</TD></TR>!;
- }
- $html;
-}
-
+print $cgi->redirect($fsurl."edit/msg_template/$msgclass.html?".$cgi->query_string);
</%init>
diff --git a/httemplate/edit/msg_template/email.html b/httemplate/edit/msg_template/email.html
new file mode 100644
index 000000000..dc70ef6ec
--- /dev/null
+++ b/httemplate/edit/msg_template/email.html
@@ -0,0 +1,385 @@
+<& /edit/elements/edit.html,
+ 'post_url' => $fsurl.'edit/process/msg_template.html',
+ 'html_init' => '<TABLE id="outerTable"><TR><TD>',
+ 'body_etc' => $body_etc,
+ 'name_singular' => 'template',
+ 'table' => 'msg_template',
+ 'viewall_dir' => 'browse',
+ 'agent_virt' => 1,
+ 'agent_null' => 1,
+ 'agent_null_right' => [ 'View global templates', 'Edit global templates' ],
+
+ 'fields' => \@fields,
+ 'labels' => {
+ 'msgnum' => 'Template',
+ 'agentnum' => 'Agent',
+ 'msgname' => 'Template name',
+ 'from_addr' => 'From: ',
+ 'bcc_addr' => 'Bcc: ',
+ 'locale' => 'Locale',
+ 'subject' => 'Subject: ',
+ 'body' => 'Message body',
+ },
+ 'edit_callback' => \&edit_callback,
+ 'error_callback' => \&edit_callback,
+ 'html_bottom' => '</DIV>',
+ 'html_table_bottom'=> \&html_table_bottom,
+ 'html_foot' => ( $no_submit ? '' : "</TD>$sidebar</TR></TABLE>" ),
+ 'no_submit' => $no_submit,
+&>
+<%init>
+use FS::template_image;
+
+my $curuser = $FS::CurrentUser::CurrentUser;
+
+die "access denied"
+ unless $curuser->access_right([ 'View templates', 'View global templates',
+ 'Edit templates', 'Edit global templates',
+ ]);
+
+my $body_etc = '';
+$body_etc = q!onload="document.getElementById('locale').onchange()"!
+ if $cgi->param('locale') eq 'new';
+
+my $msgnum = $cgi->param('msgnum');
+my $msg_template = $msgnum ? qsearchs('msg_template', {msgnum=>$msgnum}) : '';
+
+my $no_submit = 0;
+my @fields = ();
+if ( $curuser->access_right('Edit global templates')
+ || ( $curuser->access_right('Edit templates')
+ && $msg_template
+ && $msg_template->agentnum
+ && $curuser->agentnums_href->{$msg_template->agentnum}
+ )
+ )
+{
+ push @fields,
+ { field => 'msgclass',
+ type => 'hidden',
+ value => 'email',
+ },
+ { field => 'agentnum',
+ type => 'select-agent',
+ },
+ { field => 'msgname', size=>60, },
+ { field => 'from_addr', size=>60, },
+ { field => 'bcc_addr', size=>60, },
+ { type => 'tablebreak-tabs',
+ include_opt_callback => \&menubar_opt_callback,
+ },
+ # template_content fields
+ { field => 'locale', type => 'hidden' },
+ { field => 'subject', size=>60, },
+ { field => 'body',
+ type => 'htmlarea',
+ width => 763,
+ config=> { extraPlugins => 'blockprotect' },
+ },
+ ;
+} else { #readonly
+
+ $no_submit = 1;
+
+ push @fields,
+ { field => 'agentnum',
+ type => 'select-agent',
+ fixed => 1,
+ },
+ { field => 'msgname', type => 'fixed', },
+ { field => 'from_addr', type => 'fixed', },
+ { field => 'bcc_addr', type => 'fixed', },
+ { type => 'tablebreak-tabs',
+ include_opt_callback => \&menubar_opt_callback,
+ },
+ # template_content fields
+ { field => 'locale', type => 'hidden' },
+ { field => 'subject', type => 'fixed', },
+ { field => 'body',
+ type => 'fixed',
+ noescape => 1,
+ },
+ ;
+
+}
+
+sub new_callback {
+ my ($cgi, $object, $fields_listref, $opt_hashref) = @_;
+ my $template_content = new FS::template_content { 'locale' => '' };
+ $object->{'Hash'} = { $object->hash, $template_content->hash };
+}
+
+sub edit_callback {
+ my ($cgi, $object, $fields_listref, $opt_hashref) = @_;
+ $cgi->param('locale') =~ /^(\w*)$/ or die 'bad locale '.$cgi->param('locale');
+ my $locale = $1;
+
+ # fetch the content object and merge its fields
+ my %args = (
+ 'msgnum' => $object->msgnum,
+ 'locale' => $locale
+ );
+ my $template_content = qsearchs('template_content', \%args)
+ || new FS::template_content( { %args });
+ $object->{'Hash'} = { $object->hash, $template_content->hash };
+
+ # set up the locale selector if this is a new content
+ if ( $locale eq 'new' ) {
+
+ # make a list of available locales
+ my $content_locales = $object->content_locales;
+ my @locales = grep { !exists($content_locales->{$_}) }
+ FS::Conf->new->config('available-locales');
+ my %labels;
+ foreach (@locales) {
+ my %info = FS::Locales->locale_info($_);
+ $labels{$_} = $info{'label'};
+ }
+ unshift @locales, 'new';
+ $labels{'new'} = 'Select language';
+
+ # insert a field def
+ my $i = 0;
+ $i++ until ( $fields_listref->[$i]->{'field'} eq 'locale' );
+ my $locale_field = $fields_listref->[$i];
+
+ my $onchange_locale = "document.getElementById('submit').disabled =
+ (this.options[this.selectedIndex].value == 'new');";
+
+ %$locale_field = (
+ field => 'locale',
+ type => 'select',
+ options => \@locales,
+ labels => \%labels,
+ curr_value => 'new',
+ onchange => $onchange_locale,
+ );
+ }
+}
+
+sub menubar_opt_callback {
+ my $object = shift;
+ # generate no tabs for new msg_templates.
+ my $msgnum = $object->msgnum or return;
+ my (@tabs, @options, %labels);
+ push @tabs, mt('Default'), '';
+ my $display_new = 0;
+ my $selected = '';
+ foreach my $l (FS::Locales->locales) {
+ if ( exists $object->content_locales->{$l} ) {
+ my %info = FS::Locales->locale_info($l);
+ push @tabs,
+ $info{'label'},
+ ';locale='.$l;
+ $selected = $info{'label'} if $object->locale eq $l;
+ }
+ else {
+ $display_new = 1; # there is at least one unused locale left
+ }
+ }
+ push @tabs, mt('New'), ';locale=new' if $display_new;
+ $selected = mt('New') if $object->locale eq 'new';
+ $selected ||= mt('Default');
+ (
+ 'url_base' => $fsurl.'edit/msg_template.html?msgnum='.$msgnum,
+ 'selected' => $selected,
+ 'tabs' => \@tabs
+ );
+}
+
+my $onchange_locale = '';
+
+# Create hints pane
+
+my %substitutions = (
+ 'cust_main' => [
+ '$display_custnum'=> 'Customer#',
+ '$agentnum' => 'Agent#',
+ '$agent_name' => 'Agent name',
+ '$payby' => 'Payment method',
+ '$paymask' => 'Card/account# (masked)',
+ '$payname' => 'Name on card/bank name',
+ '$paytype' => 'Account type',
+ '$payip' => 'IP address used to submit payment info',
+ '$num_ncancelled_pkgs' => '# of active packages',
+ '$num_cancelled_pkgs' => '# of cancelled packages',
+ '$num_pkgs' => '# of packages',
+ '$classname' => 'Customer class',
+ '$categoryname' => 'Customer category',
+ '$balance' => 'Current balance',
+ '$credit_limit' => 'Credit limit',
+ '$invoicing_list_emailonly' => 'Billing email address',
+ #'$cust_status' => 'Status (raw internal label)',
+ '$cust_status_label' => 'Status (display label)',
+ '$cust_statuscolor' => 'Status color code',
+ '$company_name' => 'Our company name',
+ '$company_address'=> 'Our company address',
+ '$company_phonenum' => 'Our phone number',
+ '$selfservice_server_base_url' => 'Base URL of customer self-service',
+ ],
+ 'contact' => [ # duplicate this for shipping
+ '$name' => 'Company and contact name',
+ '$name_short' => 'Company or contact name',
+ '$company' => 'Company name',
+ '$contact' => 'Contact name (last, first)',
+ '$contact_firstlast'=> 'Contact name (first last)',
+ '$first' => 'First name',
+ '$last' => 'Last name',
+ '$address1' => 'Address line 1',
+ '$address2' => 'Address line 2',
+ '$city' => 'City',
+ '$county' => 'County',
+ '$state' => 'State',
+ '$zip' => 'Zip',
+ '$country' => 'Country',
+ '$daytime' => 'Day phone',
+ '$night' => 'Night phone',
+ '$mobile' => 'Mobile phone',
+ '$fax' => 'Fax',
+ ],
+ 'service' => [
+ '$ship_address1' => 'Address line 1',
+ '$ship_address2' => 'Address line 2',
+ '$ship_city' => 'City',
+ '$ship_county' => 'County',
+ '$ship_state' => 'State',
+ '$ship_zip' => 'Zip',
+ '$ship_country' => 'Country',
+ ],
+ 'cust_bill' => [
+ '$invnum' => 'Invoice#',
+ '$_date_pretty' => 'Invoice date',
+ '$due_date' => 'Invoice due date (timestamp)',
+ '$due_date2str' => 'Invoice due date (human readable)',
+ ],
+ 'cust_pkg' => [
+ '$pkgnum' => 'Package#',
+ '$pkg' => 'Package description',
+ '$pkg_label' => 'Description + comment',
+ '$status' => 'Status',
+ '$statuscolor' => 'Status color code',
+ '$start_ymd' => 'Start date',
+ '$setup_ymd' => 'Setup date',
+ '$last_bill_ymd' => 'Last bill date',
+ '$next_bill_ymd' => 'Next bill date',
+ '$susp_ymd' => 'Suspended on date',
+ '$cancel_ymd' => 'Canceled on date',
+ '$adjourn_ymd' => 'Adjournment date',
+ '$expire_ymd' => 'Expiration date',
+ '$labels_short' => 'Service labels',
+ '$location_label' => 'Service location',
+ ],
+ 'svc_acct' => [
+ '$svcnum' => 'Service#',
+ '$username' => 'Login name',
+ '$password' => 'Password',
+ '$domain' => 'Domain name',
+ ],
+ 'svc_domain' => [
+ '$svcnum' => 'Service#',
+ '$domain' => 'Domain name',
+ '$registrar' => 'Registrar name',
+ '$catchall' => 'Catchall email',
+ ],
+ 'svc_phone' => [
+ '$svcnum' => 'Service#',
+ '$phonenum' => 'Phone number',
+ '$countrycode' => 'Country code',
+ '$domain' => 'Domain name'
+ ],
+ 'svc_broadband' => [
+ '$svcnum' => 'Service#',
+ '$ip_addr' => 'IP address',
+ '$mac_addr' => 'MAC address',
+ '$speed_up' => 'Upstream speed',
+ '$speed_down' => 'Downstream speed',
+ ],
+ 'cust_pay' => [
+ '$paynum' => 'Payment#',
+ '$paid' => 'Amount',
+ '$payby' => 'Payment method',
+ '$date' => 'Payment date',
+ '$payinfo' => 'Card/account# (masked)',
+ '$error' => 'Decline reason',
+ ],
+);
+
+tie my %sections, 'Tie::IxHash', (
+'contact' => 'Name and contact info (billing)',
+'service' => 'Service address',
+'cust_main' => 'Customer status and payment info',
+'cust_pkg' => 'Package fields',
+'cust_bill' => 'Invoice fields',
+'cust_pay' => 'Payment fields',
+'svc_acct' => 'Login service fields',
+'svc_domain'=> 'Domain service fields',
+'svc_phone' => 'Phone service fields',
+'svc_broadband' => 'Broadband service fields',
+);
+
+my $widget = new HTML::Widgets::SelectLayers(
+ 'options' => \%sections,
+ 'form_name' => 'dummy',
+ 'html_between'=>'</FORM><FONT SIZE=-1>',
+ 'selected_layer'=>(keys(%sections))[0],
+ 'layer_callback' => sub {
+ my $section = shift;
+ my $html = include('/elements/table-grid.html');
+ my @hints = @{ $substitutions{$section} };
+ while(@hints) {
+ my $key = shift @hints;
+ $html .= qq!\n<TR><TD><A href="javascript:insertHtml('{$key}')">$key</A></TD>!;
+ $html .= "\n<TD>".shift(@hints).'</TD></TR>';
+ }
+ $html .= "\n</TABLE>";
+ return $html;
+ },
+);
+
+my $sidebar = '
+<SCRIPT TYPE="text/javascript">
+function insertHtml(what) {
+ var oEditor = CKEDITOR.instances["body"];
+ oEditor.insertHtml(what);
+};
+
+function areyousure(url, message) {
+ if (confirm(message))
+ window.location.href = url;
+}
+</SCRIPT>
+<TD valign="top"><FORM name="dummy">
+Substitutions: '
+. $widget->html .
+'<P>Click above links to insert substitution code.</P>
+<P>
+Enclose substitutions and other Perl expressions in braces:
+<BR>{ $name } = ExampleCo (Smith, John)
+<BR>{ time2str("%D", time) } = '.time2str("%D", time).'
+</P>';
+$sidebar .= include('/elements/template_image-dialog.html',
+ 'callback' => 'insertHtml'
+ );
+$sidebar .= '<P><A HREF="javascript:insertImageDialog()">Insert Uploaded Image</A></P>
+</FONT></TD>
+';
+
+sub html_table_bottom {
+ my $object = shift;
+ $cgi->param('locale') =~ /^(\w+)$/;
+ my $locale = $1;
+ my $html;
+ if ( $locale and $locale ne 'new' ) {
+ # set up a delete link
+ my $msgnum = $object->msgnum;
+ my $url = $fsurl."misc/delete-template_content.html?msgnum=$msgnum;locale=$1";
+ my $link = qq!<A HREF="javascript:areyousure('$url','Really delete this template?')">! .
+ 'Delete this template' .
+ '</A>';
+ $html = qq!<TR><TD></TD>
+ <TD STYLE="font-style: italic; font-size: small">$link</TD></TR>!;
+ }
+ $html;
+}
+
+</%init>
diff --git a/httemplate/edit/msg_template/http.html b/httemplate/edit/msg_template/http.html
new file mode 100644
index 000000000..e82cc0c60
--- /dev/null
+++ b/httemplate/edit/msg_template/http.html
@@ -0,0 +1,82 @@
+<& /edit/elements/edit.html,
+ 'post_url' => $fsurl.'edit/process/msg_template.html',
+ 'name_singular' => 'message interface',
+ 'table' => 'msg_template',
+ 'viewall_dir' => 'browse',
+ 'agent_virt' => 1,
+ 'agent_null' => 1,
+ 'agent_null_right' => [ 'View global templates', 'Edit global templates' ],
+
+ 'fields' => [], # callback takes care of this
+ 'new_callback' => $edit_callback,
+ 'edit_callback' => $edit_callback,
+ 'error_callback' => $edit_callback,
+ 'labels' => \%labels,
+ 'no_submit' => $no_submit,
+&>
+<%init>
+my $curuser = $FS::CurrentUser::CurrentUser;
+
+die "access denied"
+ unless $curuser->access_right([ 'View templates', 'View global templates',
+ 'Edit templates', 'Edit global templates',
+ ]);
+
+my %labels = (
+ 'msgnum' => 'Template', # it's still a template number
+ 'agentnum' => 'Agent',
+ 'msgname' => 'Interface name',
+ 'prepare_url' => 'Prepare URL',
+ 'send_url' => 'Send URL',
+ 'username' => 'HTTP username',
+ 'password' => 'HTTP password',
+ 'content' => 'Additional POST content',
+);
+
+my $no_submit = 0;
+
+my $edit_callback = sub {
+ my ($cgi, $msg_template, $fields, $opt) = @_;
+ if ( $curuser->access_right('Edit global templates')
+ || ( $curuser->access_right('Edit templates')
+ && $msg_template
+ && $msg_template->agentnum
+ && $curuser->agentnums_href->{$msg_template->agentnum}
+ )
+ ) {
+ @$fields = (
+ { field => 'msgclass',
+ type => 'hidden',
+ value => 'http',
+ },
+ { field => 'agentnum',
+ type => 'select-agent',
+ },
+ { field => 'msgname', size=>60, required => 1 },
+ { field => 'prepare_url', size=>60, required => 1 },
+ { field => 'send_url', size=>60, required => 1 },
+ { field => 'username', size=>20 },
+ { field => 'password', size=>20 },
+ { field => 'content', type => 'textarea' },
+ );
+ } else { #readonly
+
+ $no_submit = 1;
+
+ @$fields = (
+ { field => 'agentnum',
+ type => 'select-agent',
+ fixed => 1,
+ },
+ { field => 'msgname', type => 'fixed', },
+ { field => 'prepare_url', type => 'fixed', },
+ { field => 'send_url', type => 'fixed', },
+ { field => 'username', type => 'fixed', },
+ { field => 'password', type => 'fixed', },
+ { field => 'content', type => 'fixed' },
+ );
+
+ }
+};
+
+</%init>
diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi
index 9f5510d65..570c5ac75 100755
--- a/httemplate/edit/part_pkg.cgi
+++ b/httemplate/edit/part_pkg.cgi
@@ -989,9 +989,13 @@ my $html_bottom = sub {
#$html .= '</SELECT></TD></TR>';
my $href = $plans{$layer}->{'fields'};
- my @fields = exists($plans{$layer}->{'fieldorder'})
- ? @{$plans{$layer}->{'fieldorder'}}
- : keys %{ $href };
+ my @fields;
+ if ( $plans{$layer}->{'fieldorder'} ) {
+ @fields = @{ $plans{$layer}->{'fieldorder'} };
+ } else {
+ warn "FS::part_pkg::$layer has no fieldorder.\n";
+ @fields = keys %$href;
+ }
# hash of dependencies for each of the Pricing Plan fields.
# make sure NOT to use double-quotes inside the 'msg' value.
@@ -1015,7 +1019,7 @@ my $html_bottom = sub {
}
}
};
-
+
foreach my $field ( grep $_ !~ /^(setup|recur)_fee$/, @fields ) {
if(!exists($href->{$field})) {
@@ -1029,7 +1033,8 @@ my $html_bottom = sub {
next if !$display;
}
- $html .= '<TR><TD ALIGN="right">'. $href->{$field}{'name'}. '</TD><TD>';
+ $html .= '<TR><TD ALIGN="right">'. $href->{$field}{'name'}. '</TD><TD>
+ ';
my $format = sub { shift };
$format = $href->{$field}{'format'} if exists($href->{$field}{'format'});
@@ -1128,9 +1133,11 @@ my $html_bottom = sub {
$html .= '</TD></TR>';
}
$html .= '</TABLE>';
-
- $html .= qq(<INPUT TYPE="hidden" NAME="${layer}__OPTIONS" VALUE=").
- join(',', keys %{ $href } ). '">';
+
+ $html .= include('/elements/hidden.html',
+ field => $layer.'__OPTIONS',
+ value => join(',', @fields)
+ );
$html;
diff --git a/httemplate/edit/process/change-cust_pkg.html b/httemplate/edit/process/change-cust_pkg.html
index 046a9795c..308ea8ffd 100644
--- a/httemplate/edit/process/change-cust_pkg.html
+++ b/httemplate/edit/process/change-cust_pkg.html
@@ -59,6 +59,40 @@ unless ($error) {
$error = $cust_pkg->change_later(\%change);
}
} else {
+
+ # for now, can't change usageprice with change_later
+ my @old_cust_pkg_usageprice = $cust_pkg->cust_pkg_usageprice;
+
+ # build new usageprice array
+ # false laziness with /edit/process/quick-cust_pkg.cgi
+ my @cust_pkg_usageprice = ();
+ foreach my $quantity_param ( grep { $cgi->param($_) && $cgi->param($_) > 0 }
+ grep /^usagepricenum(\d+)_quantity$/,
+ $cgi->param
+ )
+ {
+ $quantity_param =~ /^usagepricenum(\d+)_quantity$/ or die 'unpossible';
+ my $num = $1;
+ push @cust_pkg_usageprice, new FS::cust_pkg_usageprice {
+ usagepricepart => scalar($cgi->param("usagepricenum${num}_usagepricepart")),
+ quantity => scalar($cgi->param($quantity_param)),
+ };
+ }
+
+ # Need to figure out if usagepricepart quantities changed
+ my %oldup = map { $_->usagepricepart, $_->quantity } @old_cust_pkg_usageprice;
+ my %newup = map { $_->usagepricepart, $_->quantity } @cust_pkg_usageprice;
+ my $usagechanged = 0;
+ foreach my $up (keys %oldup) {
+ last if $usagechanged;
+ $usagechanged = 1 unless $oldup{$up} == $newup{$up};
+ }
+ foreach my $up (keys %newup) {
+ last if $usagechanged;
+ $usagechanged = 1 unless $oldup{$up} == $newup{$up};
+ }
+ $change{'cust_pkg_usageprice'} = \@cust_pkg_usageprice;
+
# special case: if there's a package change scheduled, and it matches
# the parameters the user requested this time, then change to the existing
# future package.
@@ -68,12 +102,13 @@ unless ($error) {
$change_to->pkgpart == $change{'pkgpart'} and
$change_to->locationnum == $change{'locationnum'} and
$change_to->quantity == $change{'quantity'} and
- $change_to->contract_end == $change{'contract_end'}
+ $change_to->contract_end == $change{'contract_end'} and
+ !$usagechanged
) {
%change = ( 'cust_pkg' => $change_to );
}
}
-
+
# do a package change right now
my $pkg_or_error = $cust_pkg->change( \%change );
$error = ref($pkg_or_error) ? '' : $pkg_or_error;
diff --git a/httemplate/edit/process/cust_credit_bill.cgi b/httemplate/edit/process/cust_credit_bill.cgi
index d3847dc40..db15eac18 100755
--- a/httemplate/edit/process/cust_credit_bill.cgi
+++ b/httemplate/edit/process/cust_credit_bill.cgi
@@ -12,8 +12,7 @@ die "access denied"
if ( $cgi->param('src_amount') ) {
die "access denied"
- unless ( $FS::CurrentUser::CurrentUser->access_right('Post credit') &&
- $FS::CurrentUser::CurrentUser->access_right('Delete credit') );
+ unless $FS::CurrentUser::CurrentUser->access_right('Post credit')
}
</%init>
diff --git a/httemplate/edit/process/cust_refund.cgi b/httemplate/edit/process/cust_refund.cgi
index 52fede8ec..6ad468b6c 100755
--- a/httemplate/edit/process/cust_refund.cgi
+++ b/httemplate/edit/process/cust_refund.cgi
@@ -12,7 +12,7 @@
</BODY></HTML>
% } else {
-<% $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum") %>
+<% $cgi->redirect(popurl(3). "view/cust_main.cgi?custnum=$custnum;show=payment_history") %>
% }
%}
<%init>
@@ -30,16 +30,8 @@ my $link = $cgi->param('popup') ? 'popup' : '';
my $payby = $cgi->param('payby');
-my @rights = ();
-push @rights, 'Post refund' if $payby =~ /^(BILL|CASH|MCRD|MCHK)$/;
-push @rights, 'Post check refund' if $payby eq 'BILL';
-push @rights, 'Post cash refund ' if $payby eq 'CASH';
-push @rights, 'Refund payment' if $payby =~ /^(CARD|CHEK)$/;
-push @rights, 'Refund credit card payment' if $payby eq 'CARD';
-push @rights, 'Refund Echeck payment' if $payby eq 'CHEK';
-
die "access denied"
- unless $FS::CurrentUser::CurrentUser->access_right(\@rights);
+ unless $FS::CurrentUser::CurrentUser->refund_access_right($payby);
$cgi->param('reasonnum') =~ /^(-?\d+)$/ or die "Illegal reasonnum";
my ($reasonnum, $error) = $m->comp('/misc/process/elements/reason');
@@ -63,12 +55,19 @@ if ( $error ) {
'reason' => $reason,
%options );
} else {
- my $new = new FS::cust_refund ( {
- map {
- $_, scalar($cgi->param($_));
- } fields('cust_refund') #huh? , 'paynum' )
- } );
- $error = $new->insert;
+ my %hash = map {
+ $_, scalar($cgi->param($_))
+ } fields('cust_refund');
+ my $paynum = $cgi->param('paynum');
+ $paynum =~ /^(\d*)$/ or die "Illegal paynum!";
+ if ($paynum) {
+ my $cust_pay = qsearchs('cust_pay',{ 'paynum' => $paynum });
+ die "Could not find paynum $paynum" unless $cust_pay;
+ $error = $cust_pay->refund(\%hash);
+ } else {
+ my $new = new FS::cust_refund ( \%hash );
+ $error = $new->insert;
+ }
}
</%init>
diff --git a/httemplate/edit/process/deploy_zone-fixed.html b/httemplate/edit/process/deploy_zone-fixed.html
index eae3a746d..0033bbe52 100644
--- a/httemplate/edit/process/deploy_zone-fixed.html
+++ b/httemplate/edit/process/deploy_zone-fixed.html
@@ -3,12 +3,31 @@
error_redirect => popurl(2).'deploy_zone-fixed.html',
table => 'deploy_zone',
viewall_dir => 'browse',
- process_o2m => {
- 'table' => 'deploy_zone_block',
- 'fields' => [qw( censusblock censusyear )]
- },
- process_upload => {
- 'process' => 'misc/process/deploy_zone-import.html',
- 'fields' => [qw( censusyear format )],
- },
+ precheck_callback => $precheck_callback,
+ process_o2m =>
+ { 'table' => 'deploy_zone_vertex',
+ 'fields' => [qw( latitude longitude )]
+ },
+ progress_init => [
+ 'PostForm',
+ [ 'zonenum' ],
+ $fsurl.'misc/process/deploy_zone-block_lookup.cgi',
+ $fsurl.'browse/deploy_zone.html',
+ ],
&>
+<%init>
+my $precheck_callback = sub {
+ # convert the vertex list into a process_o2m-style parameter list
+ if ( $cgi->param('vertices') ) {
+ my $vertices = decode_json($cgi->param('vertices'));
+ my $i = 0;
+ foreach (@$vertices) {
+ $cgi->param("vertexnum${i}", '');
+ $cgi->param("vertexnum${i}_latitude", $_->[0]);
+ $cgi->param("vertexnum${i}_longitude", $_->[1]);
+ $i++;
+ }
+ }
+ '';
+};
+</%init>
diff --git a/httemplate/edit/process/deploy_zone-mobile.html b/httemplate/edit/process/deploy_zone-mobile.html
index 7b8f911ec..d36d5d448 100644
--- a/httemplate/edit/process/deploy_zone-mobile.html
+++ b/httemplate/edit/process/deploy_zone-mobile.html
@@ -2,8 +2,25 @@
error_redirect => popurl(2).'deploy_zone-mobile.html',
table => 'deploy_zone',
viewall_dir => 'browse',
- process_o2m =>
+ precheck_callback => $precheck_callback,
+ process_o2m =>
{ 'table' => 'deploy_zone_vertex',
'fields' => [qw( latitude longitude )]
},
&>
+<%init>
+my $precheck_callback = sub {
+ # convert the vertex list into a process_o2m-style parameter list
+ if ( $cgi->param('vertices') ) {
+ my $vertices = decode_json($cgi->param('vertices'));
+ my $i = 0;
+ foreach (@$vertices) {
+ $cgi->param("vertexnum${i}", '');
+ $cgi->param("vertexnum${i}_latitude", $_->[0]);
+ $cgi->param("vertexnum${i}_longitude", $_->[1]);
+ $i++;
+ }
+ }
+ '';
+};
+</%init>
diff --git a/httemplate/edit/process/elements/process.html b/httemplate/edit/process/elements/process.html
index 69bd605f6..fd12c61d9 100644
--- a/httemplate/edit/process/elements/process.html
+++ b/httemplate/edit/process/elements/process.html
@@ -160,7 +160,28 @@ process();
</script>
<& /elements/footer.html &>
-%} elsif ( $opt{'popup_reload'} ) {
+% } elsif ( $opt{'progress_init'} ) {
+% # some false laziness with the above
+% my ($form_name, $job_fields) = @{ $opt{'progress_init'} };
+<form name="<% $form_name %>">
+ <input type="hidden" name="<% $pkey %>" value="<% $new->get($pkey) %>">
+% foreach my $field (@$job_fields) {
+% next if $field eq $pkey;
+ <input type="hidden" name="<% $field %>" value="<% $cgi->param($field) |h %>">
+% }
+<& /elements/progress-init.html,
+ @{ $opt{'progress_init'} }
+&>
+<input type="submit" style="display:none">
+</form>
+<script>
+<&| /elements/onload.js &>
+process();
+</&>
+</script>
+<& /elements/footer.html &>
+
+% } elsif ( $opt{'popup_reload'} ) {
<% include('/elements/header-popup.html', $opt{'popup_reload'} ) %>
diff --git a/httemplate/edit/process/msg_template.html b/httemplate/edit/process/msg_template.html
index e146adf76..d8b125ae0 100644
--- a/httemplate/edit/process/msg_template.html
+++ b/httemplate/edit/process/msg_template.html
@@ -1,7 +1,7 @@
<% include( 'elements/process.html',
'table' => 'msg_template',
- 'viewall_dir' => 'browse',
- #'popup_reload'=> 1,
+ 'fields' => $fields,
+ 'viewall_url' => "browse/msg_template/$msgclass.html",
'debug' => 0,
'precheck_callback' => \&precheck_callback,
'args_callback' => \&args_callback,
@@ -11,9 +11,21 @@
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right(['Edit templates','Edit global templates']);
+my $msgclass = 'email';
+if ( $cgi->param('msgclass') =~ /^(\w+)$/ ) {
+ $msgclass = $1;
+}
+
+my $fields = [ fields('msg_template') ];
+my $class = "FS::msg_template::$msgclass";
+eval "use $class;";
+if ( $class->extension_table ) {
+ push @$fields, fields($class->extension_table);
+}
+
sub precheck_callback {
my $cgi = shift;
- # validate some fields
+ # validate locale field (for email-type records)
$cgi->param('locale') =~ /^(\w*)$/;
my $locale = $1;
return mt('Language required') if $locale eq 'new'; # the user didn't choose
diff --git a/httemplate/edit/process/rate_detail.html b/httemplate/edit/process/rate_detail.html
index 0709d5079..f8a744418 100644
--- a/httemplate/edit/process/rate_detail.html
+++ b/httemplate/edit/process/rate_detail.html
@@ -12,7 +12,6 @@ die "access denied"
my $set_default_detail = sub {
my ($cgi, $rate_detail) = @_;
-warn Dumper $rate_detail;
if (!$rate_detail->dest_regionnum) {
# then this is a global default rate
my $rate = $rate_detail->rate;
diff --git a/httemplate/edit/rate.cgi b/httemplate/edit/rate.cgi
index 183ea8a42..1b052d62d 100644
--- a/httemplate/edit/rate.cgi
+++ b/httemplate/edit/rate.cgi
@@ -5,7 +5,7 @@
<% include('/elements/progress-init.html',
'OneTrueForm',
- [ 'rate', 'agentnum', 'preserve_rate_detail' ], # 'rate', 'min_', 'sec_' ],
+ [ 'rate', 'agentnum' ],
'process/rate.cgi',
$p.'browse/rate.cgi',
)
@@ -27,8 +27,6 @@
</TABLE>
<BR>
-<INPUT TYPE="hidden" NAME="preserve_rate_detail" VALUE="1">
-
<INPUT NAME="submit" TYPE="button" VALUE="<%
$rate->ratenum ? "Apply changes" : "Add rate plan"
%>" onClick="document.OneTrueForm.submit.disabled=true; process();">