From b6f16a22bd93ec66ffbb1da30e63f7e950b3b819 Mon Sep 17 00:00:00 2001 From: Jonathan Prykop Date: Thu, 15 Oct 2015 21:07:34 -0500 Subject: RT#34960: Quotations --- httemplate/elements/popup_link.html | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'httemplate/elements') diff --git a/httemplate/elements/popup_link.html b/httemplate/elements/popup_link.html index 2b6b187e9..e9728ac1c 100644 --- a/httemplate/elements/popup_link.html +++ b/httemplate/elements/popup_link.html @@ -18,11 +18,13 @@ Example: 'height' => 336, 'color' => '#ff0000', 'closetext' => 'Go Away', # the value '' removes the link + 'title' => 'Hover Text', #uncommon opt 'aname' => "target", # link NAME= value, useful for #targets 'target' => '_parent', 'style' => 'css-attribute:value', + 'html_label' => '', # overrides label } &> @@ -30,6 +32,7 @@ Example: % if ($params->{'action'} && $label) { {'title'} ? 'TITLE="' . $params->{'title'}. '"' : '' |n %> <% $params->{'aname'} ? 'NAME="'. $params->{'aname'}. '"' : '' |n %> <% $params->{'target'} ? 'TARGET="'. $params->{'target'}. '"' : '' |n %> <% $params->{'style'} ? 'STYLE="'. $params->{'style'}. '"' : '' |n %> @@ -48,6 +51,7 @@ if (ref($_[0]) eq 'HASH') { my $label = $params->{'label'}; $label =~ s/ / /g; +$label = $params->{'html_label'} || $label; my $onclick = include('/elements/popup_link_onclick.html', $params); -- cgit v1.2.1 From f641486e28214ad1eca18c47d2252701b83614f1 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Fri, 16 Oct 2015 15:32:32 -0700 Subject: separate setup and recur discounts, #14092 --- httemplate/elements/select-months.html | 11 ++ httemplate/elements/tr-select-months.html | 16 +- httemplate/elements/tr-select-pkg-discount.html | 196 ++++++++++++++++++++++++ 3 files changed, 212 insertions(+), 11 deletions(-) create mode 100644 httemplate/elements/select-months.html create mode 100644 httemplate/elements/tr-select-pkg-discount.html (limited to 'httemplate/elements') diff --git a/httemplate/elements/select-months.html b/httemplate/elements/select-months.html new file mode 100644 index 000000000..1cd72fcba --- /dev/null +++ b/httemplate/elements/select-months.html @@ -0,0 +1,11 @@ +<%init> +my %opt = @_; +$opt{id} ||= $opt{field}; # should be the default everywhere +my $max = $opt{max} || 36; +$opt{options} = [ '', 1 .. $max ]; +$opt{labels} = { '' => '', + map { $_ => emt('[quant,_1,month]', $_) } 1 .. $max + }; + + +<& select.html, %opt &> diff --git a/httemplate/elements/tr-select-months.html b/httemplate/elements/tr-select-months.html index b90ce1ed7..4d8576411 100644 --- a/httemplate/elements/tr-select-months.html +++ b/httemplate/elements/tr-select-months.html @@ -1,11 +1,5 @@ -<%init> -my %opt = @_; -$opt{id} ||= $opt{field}; # should be the default everywhere -my $max = $opt{max} || 36; -$opt{options} = [ '', 1 .. $max ]; -$opt{labels} = { '' => '', - map { $_ => emt('[quant,_1,month]', $_) } 1 .. $max - }; - - -<& tr-select.html, %opt &> +<& tr-td-label.html, @_ &> + + <& select-months.html, @_ &> + + diff --git a/httemplate/elements/tr-select-pkg-discount.html b/httemplate/elements/tr-select-pkg-discount.html new file mode 100644 index 000000000..dc38cff3e --- /dev/null +++ b/httemplate/elements/tr-select-pkg-discount.html @@ -0,0 +1,196 @@ +<%doc> + +In order_pkg.html or similar: + +<& /elements/tr-select-pkg-discount.html, + curr_value_setup => ($cgi->param('setup_discountnum') || ''), + curr_value_recur => ($cgi->param('recur_discountnum') || ''), + disable_setup => 0, + disable_recur => 0, +&> + +This provides the following: +- If the user can waive setup fees or apply a discount, they get a + select box for the setup discount, with "Waive setup fee" as an option. +- If they can custom discount, they will also get "Custom discount" as an + option. If selected, this will show fields to enter the custom discount + amount/percentage. +- If they can waive setup fees but NOT apply a discount, they only get a + checkbox to waive setup fee. +- Same for recurring fee, but without the "waive setup fee" stuff, obviously. +- Custom recurring discounts also have an option for a duration in months. + +"disable_setup" locks the setup discount, but will still show a static +description if curr_value_setup is set. Likewise "disable_recur". + + +% # SETUP DISCOUNT + +% # select-discount knows about the "custom discount" ACL +% if ( $curuser->access_right('Discount customer package') +% and !$opt{disable_setup} ) +% { +% my $pre_options = [ '' => '(none)' ]; +% if ( $curuser->access_right('Waive setup fee') ) { +% push @$pre_options, -2 => 'Waive setup fee'; +% } +<& tr-td-label.html, label => emt('Setup fee') &> + + <& select-discount.html, + field => 'setup_discountnum', + id => 'setup_discountnum', + hashref => { disabled => '', + setup => 'Y' + }, + extra_sql => ' AND (percent > 0 OR months = 1)', + curr_value => $opt{'curr_value_setup'}, + disable_empty => 1, + pre_options => $pre_options, + &> + + +% # custom discount + + + Amount <% $money_char %> + <& input-text.html, + field => 'setup_discountnum_amount', + curr_value => ($cgi->param('setup_discountnum_amount') || ''), + size => 5, + &> + or percentage + <& input-text.html, + field => 'setup_discountnum_percent', + curr_value => ($cgi->param('setup_discountnum_percent') || ''), + size => 5, + &> % + + + +% } elsif ( $curuser->access_right('Waive setup fee') +% and !$opt{disable_setup} ) +% { + +<& tr-td-label.html, label => emt('Waive setup fee') &> + + <& checkbox.html, + field => 'setup_discountnum', + id => 'setup_discountnum', + value => '-2', + curr_value => $opt{'curr_value_setup'}, + &> + + + +% } elsif ( $opt{'curr_value_setup'} ) { # user can't do anything +% +% my $discount = FS::discount->by_key($opt{'curr_value_setup'}); + + + + <% $discount->description_short %> + +% } + +% # RECUR DISCOUNT + +% if ( $curuser->access_right('Discount customer package') +% and !$opt{disable_recur} ) { + +<& tr-td-label.html, label => emt('Recurring fee') &> + + <& select-discount.html, + field => 'recur_discountnum', + id => 'recur_discountnum', + hashref => { disabled => '' }, + curr_value => $opt{'curr_value_recur'}, + &> + + + +% # custom discount + + + Amount <% $money_char %> + <& input-text.html, + field => 'recur_discountnum_amount', + curr_value => ($cgi->param('recur_discountnum_amount') || ''), + size => 5, + &> + or percentage + <& input-text.html, + field => 'recur_discountnum_percent', + curr_value => ($cgi->param('recur_discountnum_percent') || ''), + size => 5, + &> % + + + + + Expires after + <& /elements/select-months.html, + field => 'recur_discountnum_months', + curr_value => ($cgi->param('recur_discountnum_months') || ''), + &> + + + +% } elsif ( $opt{'curr_value_recur'} ) { +% +% my $discount = FS::discount->by_key($opt{'curr_value_recur'}); + + + + <% $discount->description %> + +% } + + +<%init> + +my %opt = ( + 'curr_value_setup' => ($cgi->param('setup_discountnum') || ''), + 'curr_value_recur' => ($cgi->param('recur_discountnum') || ''), + @_ +); +my $curuser = $FS::CurrentUser::CurrentUser; +my $money_char = FS::Conf->new->config('money_char') || '$'; + + -- cgit v1.2.1 From 974fceaaca8e1404750a60a4daafb568b1be5159 Mon Sep 17 00:00:00 2001 From: Jonathan Prykop Date: Tue, 20 Oct 2015 20:56:13 -0500 Subject: RT#38217: Send email when logging conditions are met --- httemplate/elements/menu.html | 4 ++++ httemplate/elements/tr-select-msg_template.html | 12 ++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 httemplate/elements/tr-select-msg_template.html (limited to 'httemplate/elements') diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html index ea6933198..dcc02c2b1 100644 --- a/httemplate/elements/menu.html +++ b/httemplate/elements/menu.html @@ -787,6 +787,10 @@ $config_misc{'Inventory classes and inventory'} = [ $fsurl.'browse/inventory_cla $config_misc{'Upload targets'} = [ $fsurl.'browse/upload_target.html', 'Billing and payment upload destinations' ] if $curuser->access_right('Configuration'); +$config_misc{'System log emails'} = [ $fsurl.'browse/log_email.html', 'Configure conditions for sending email when logging' ] + if $curuser->access_right('View system logs') + || $curuser->access_right('Configuration'); + tie my %config_menu, 'Tie::IxHash'; if ( $curuser->access_right('Configuration' ) ) { %config_menu = ( diff --git a/httemplate/elements/tr-select-msg_template.html b/httemplate/elements/tr-select-msg_template.html new file mode 100644 index 000000000..1f899e01c --- /dev/null +++ b/httemplate/elements/tr-select-msg_template.html @@ -0,0 +1,12 @@ +<% include('/elements/tr-td-label.html', + 'label' => $opt{'label'} || 'Message template: ', + 'required' => $opt{'required'} ) %> + <% include('select-msg_template.html', %opt) %> + + +<%init> + +my %opt = @_; + + + -- cgit v1.2.1