diff options
Diffstat (limited to 'httemplate/browse')
-rw-r--r-- | httemplate/browse/cgp_rule.html | 34 | ||||
-rw-r--r-- | httemplate/browse/msg_template.html | 28 | ||||
-rw-r--r-- | httemplate/browse/part_event.html | 3 | ||||
-rwxr-xr-x | httemplate/browse/part_pkg.cgi | 4 | ||||
-rw-r--r-- | httemplate/browse/part_tag.html | 26 | ||||
-rw-r--r-- | httemplate/browse/rate.cgi | 2 | ||||
-rw-r--r-- | httemplate/browse/rate_detail.html | 92 | ||||
-rw-r--r-- | httemplate/browse/rate_time.html | 48 |
8 files changed, 86 insertions, 151 deletions
diff --git a/httemplate/browse/cgp_rule.html b/httemplate/browse/cgp_rule.html index 8a427b828..6f7b3e087 100644 --- a/httemplate/browse/cgp_rule.html +++ b/httemplate/browse/cgp_rule.html @@ -26,45 +26,25 @@ my $svcnum = $1; #agent virt so you can't do cross-agent communigate rules my $cust_svc = qsearchs('cust_svc', { 'svcnum' => $svcnum }) or die 'unknown svcnum'; -my $part_svc = $cust_svc->part_svc; my $count_query = "SELECT COUNT(*) FROM cgp_rule WHERE svcnum = $svcnum"; my($svc_label, $svc_value, $svcdb) = $cust_svc->label; + my $view = FS::UI::Web::svc_url( 'm' => $m, 'action' => 'view', - 'part_svc' => $part_svc, + 'part_svc' => $cust_svc->part_svc, 'svc' => $cust_svc, ); my $html_init = qq(<A HREF="$view">View this $svc_label</A><BR><BR>). - qq!<A HREF="${p}edit/cgp_rule.html?svcnum=$svcnum">Add new rule</A><BR>!; - -if ( $part_svc->svcdb eq 'svc_domain' ) { - - #areyousure for adding these? - - foreach my $line ( FS::Conf->new->config('cgp_rule-domain_templates') ) { - $line =~ /^\s*(\d+)\s+(.+)\s*$/ or next; - my($t_svcnum, $t_name) = ( $1, $2 ); - $html_init .= - qq!<A HREF="${p}misc/clone-cgp_rule.html?clone=$t_svcnum;svcnum=$svcnum">! - ."Add $t_name rule</A><BR>"; - } - -} - -$html_init .= - '<BR>'. + qq!<A HREF="${p}edit/cgp_rule.html?svcnum=$svcnum">Add new rule</A><BR><BR>!. qq! <SCRIPT> - function areyousure_delete(href) { - areyousure(href,"Are you sure you want to delete this rule?"); - } - function areyousure(href,message) { - if (confirm(message) == true) + function areyousure(href) { + if (confirm("Are you sure you want to delete this rule?") == true) window.location.href = href; } </SCRIPT> @@ -75,7 +55,7 @@ my $condition_sub = sub { [ map { [ - { data => $_->conditionname, + { data => $_->condition, #align => }, { data => $_->op, @@ -107,7 +87,7 @@ my $action_sub = sub { my $edit_sub = [ $p.'edit/cgp_rule.html?', 'rulenum' ]; my $del_sub = sub { my $rulenum = shift->rulenum; - [ "javascript:areyousure_delete('${p}misc/delete-cgp_rule.html?$rulenum')", '' ]; + [ "javascript:areyousure('${p}misc/delete-cgp_rule.html?$rulenum')", '' ]; }; </%init> diff --git a/httemplate/browse/msg_template.html b/httemplate/browse/msg_template.html deleted file mode 100644 index 0cd33c797..000000000 --- a/httemplate/browse/msg_template.html +++ /dev/null @@ -1,28 +0,0 @@ -<% include( 'elements/browse.html', - 'title' => 'Message templates', - 'name_singular' => 'template', - 'menubar' => [ 'Add a new template' => - $p.'edit/msg_template.html', - ], - 'query' => { 'table' => 'msg_template', }, - 'count_query' => 'SELECT COUNT(*) FROM msg_template', - 'disableable' => 1, - 'disabled_statuspos' => 2, - 'agent_virt' => 1, - 'agent_null_right' => 'Edit global templates', - 'agent_pos' => 3, - 'header' => [ 'Name' ], - 'fields' => [ 'msgname' ], - 'links' => [ $link ], - ) -%> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Edit templates') - || $FS::CurrentUser::CurrentUser->access_right('Edit global templates') - || $FS::CurrentUser::CurrentUser->access_right('Configuration'); - -my $link = [ "${p}edit/msg_template.html?", 'msgnum' ]; - -</%init> diff --git a/httemplate/browse/part_event.html b/httemplate/browse/part_event.html index 3d7c245ac..674004bc7 100644 --- a/httemplate/browse/part_event.html +++ b/httemplate/browse/part_event.html @@ -158,8 +158,7 @@ $html_init .= '</SELECT><INPUT TYPE="submit" VALUE="Clone existing event">'. my $count_query = 'SELECT COUNT(*) FROM part_event WHERE '. $FS::CurrentUser::CurrentUser->agentnums_sql( - 'null_right' => 'Edit global billing events', - 'viewall_right' => 'None', + 'null_right' => 'Edit global billing events', ); my $join_conditions = FS::part_event_condition->join_conditions_sql; diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index 42eb5dfcb..e226ce13e 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -84,11 +84,11 @@ my $extra_sql = scalar(@where) join( 'AND ', @where) : ''; -my $agentnums_sql = $curuser->agentnums_sql( 'table'=>'cust_main' ); +my $agentnums = join(',', $curuser->agentnums); my $count_cust_pkg = " SELECT COUNT(*) FROM cust_pkg LEFT JOIN cust_main USING ( custnum ) WHERE cust_pkg.pkgpart = part_pkg.pkgpart - AND $agentnums_sql + AND cust_main.agentnum IN ($agentnums) "; $select = " diff --git a/httemplate/browse/part_tag.html b/httemplate/browse/part_tag.html deleted file mode 100644 index d0ef72ec3..000000000 --- a/httemplate/browse/part_tag.html +++ /dev/null @@ -1,26 +0,0 @@ -<% include( 'elements/browse.html', - 'title' => 'Tags', - 'name_singular' => 'tag', - 'menubar' => [ 'Add a new tag' => - $p.'edit/part_tag.html', - ], - 'query' => { 'table' => 'part_tag', }, - 'count_query' => 'SELECT COUNT(*) FROM part_tag', - 'header' => [ 'Tag', 'Message', ], - 'fields' => [ 'tagname', 'tagdesc', ], - 'links' => [ $link, '', ], - 'cell_style' => [ '', $tagdesc_style ], - 'disableable' => 1, - 'disabled_statuspos' => 1, - ) -%> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); - -my $tagdesc_style = sub { 'background-color:#'.shift->tagcolor }; - -my $link = [ "${p}edit/part_tag.html?", 'tagnum' ]; - -</%init> diff --git a/httemplate/browse/rate.cgi b/httemplate/browse/rate.cgi index 428158a6d..02d670fbd 100644 --- a/httemplate/browse/rate.cgi +++ b/httemplate/browse/rate.cgi @@ -2,8 +2,6 @@ 'title' => 'Rate plans', 'menubar' => [ 'Regions and Prefixes' => $p.'browse/rate_region.html', - 'Time Periods' => - $p.'browse/rate_time.html', ], 'html_init' => $html_init, 'name' => 'rate plans', diff --git a/httemplate/browse/rate_detail.html b/httemplate/browse/rate_detail.html index aef550513..3371926b4 100644 --- a/httemplate/browse/rate_detail.html +++ b/httemplate/browse/rate_detail.html @@ -1,21 +1,72 @@ -<% include('/elements/init_overlib.html') %> -<% include('/elements/header.html',$title) %> -<% include('/elements/menubar.html',@menubar) %> -<% include('/edit/elements/rate_detail.html', - 'ratenum' => $ratenum, - 'countrycode' => $countrycode, -) %> -<% include('/elements/footer.html') %> - +<% include( 'elements/browse.html', + 'title' => $title, + 'name_singular' => 'rate', + 'html_init' => $html_init, + 'menubar' => [ 'Rate plans' => $p.'browse/rate.cgi' ], + 'query' => { + 'table' => 'rate_detail', + 'addl_from' => $join, + 'hashref' => { 'ratenum' => $ratenum }, + 'extra_sql' => $where, + }, + 'count_query' => "SELECT COUNT(*) FROM rate_detail $join". + " WHERE ratenum = $ratenum $where", + 'header' => [ + 'Region', + 'Prefix(es)', + 'Included<BR>minutes', + 'Connection<BR>charge', + 'Charge per<BR>minute', + 'Granularity', + 'Usage class', + ], + 'fields' => [ + 'regionname', + sub { shift->dest_region->prefixes_short }, + sub { shift->min_included. $edit_hint }, + $conn_charge_sub, + sub { $money_char. shift->min_charge. $edit_hint }, + sub { $granularity{ shift->sec_granularity } }, + 'classname', + ], + 'links' => [ '', '', $edit_link, $edit_link, '', '' ], + 'link_onclicks' => [ '', '', $edit_onclick, $edit_onclick, '', '' ], + 'align' => 'llrrcc', + ) +%> <%once> +tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities(); +tie my %conn_secs, 'Tie::IxHash', FS::rate_detail::conn_secs(); + my $conf = new FS::Conf; my $money_char = $conf->config('money_char') || '$'; -my @menubar = ( 'Rate plans' => $p.'browse/rate.cgi', - 'Regions and Prefixes' => $p.'browse/rate_region.html', - 'Time Periods' => $p.'browse/rate_time.html', - ); +my $join = + ' JOIN rate_region ON ( rate_detail.dest_regionnum = rate_region.regionnum )'; + +my $edit_link = [ 'javascript:void(0);', sub { ''; } ]; + +my $edit_onclick = sub { + my $rate_detail = shift; + my $ratedetailnum = $rate_detail->ratedetailnum; + include( '/elements/popup_link_onclick.html', + 'action' => "${p}edit/rate_detail.html?$ratedetailnum", + 'actionlabel' => 'Edit rate', + 'height' => 420, + #default# 'width' => 540, + #default# 'color' => '#333399', + ); +}; +my $edit_hint = ' <FONT SIZE="-1">(edit)</FONT>'; + +my $conn_charge_sub = sub { + my $rate_detail = shift; + #return '' unless $rate_detail->conn_charge > 0 || $rate_detail->conn_sec; + $money_char. $rate_detail->conn_charge. + ($rate_detail->conn_sec ? ' for '.$conn_secs{$rate_detail->conn_sec} : ''). + $edit_hint; +}; </%once> <%init> @@ -23,6 +74,8 @@ my @menubar = ( 'Rate plans' => $p.'browse/rate.cgi', die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); +my $html_init = include('/elements/init_overlib.html'); + $cgi->param('ratenum') =~ /^(\d+)$/ or die "unparsable ratenum"; my $ratenum = $1; my $rate = qsearchs('rate', { 'ratenum' => $ratenum } ) @@ -30,11 +83,18 @@ my $rate = qsearchs('rate', { 'ratenum' => $ratenum } ) my $ratename = $rate->ratename; my $title = "$ratename rates"; -my $where; -my $countrycode = ''; +my @where = (); + if ( $cgi->param('countrycode') =~ /^(\d+)$/ ) { - $countrycode = $1; + my $countrycode = $1; + push @where, "0 < ( SELECT COUNT(*) FROM rate_prefix + WHERE rate_prefix.regionnum = rate_region.regionnum + AND countrycode = '$countrycode' + ) + "; $title .= " for +$countrycode"; } +my $where = scalar(@where) ? ' AND '.join(' AND ', @where ) : ''; + </%init> diff --git a/httemplate/browse/rate_time.html b/httemplate/browse/rate_time.html deleted file mode 100644 index 416ded41f..000000000 --- a/httemplate/browse/rate_time.html +++ /dev/null @@ -1,48 +0,0 @@ -<% include( 'elements/browse.html', - 'title' => 'Rating Time Periods', - 'name_singular' => 'period', - 'menubar' => [ 'Rate plans' => $p.'browse/rate.cgi' ], - 'html_init' => $html_init, - 'query' => { - 'table' => 'rate_time', - 'order_by' => 'ratetimenum', # lacking anything else - 'hashref' => {}, - }, - 'count_query' => 'SELECT COUNT(*) FROM rate_time', - 'header' => \@header, - 'fields' => \@fields, - 'links' => \@links, - 'align' => \@align, - ) -%> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); - -my $edit_url = $p.'edit/rate_time.cgi'; - -my $link = [ "$edit_url?", 'ratetimenum' ]; - -my $html_init = - 'Time periods for VoIP and call billing.<BR><BR>'. - qq(<A HREF="$edit_url"><I>Add a new period</I></A><BR><BR>); - -sub interval { - my $i = shift; - '<TABLE>' - .join('', map { '<TR><TD>'.($_->description)[$i].'</TR></TD>' } - shift->intervals - ) . '</TABLE>'; -} - -# inefficient but readable -my $stime_sub = sub { interval(0,shift) }; -my $etime_sub = sub { interval(1,shift) }; - -my @header = ( '#', 'Period', 'Start', 'End' ); -my @fields = ( 'ratetimenum', 'ratetimename', $stime_sub, $etime_sub ); -my @links = ( ($link) x 2 ); -my @align = ( 'right', 'left', 'left' ); - -</%init> |