diff options
Diffstat (limited to 'httemplate')
116 files changed, 597 insertions, 2455 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> diff --git a/httemplate/config/config-delete.cgi b/httemplate/config/config-delete.cgi index 488886824..a05cb1e14 100644 --- a/httemplate/config/config-delete.cgi +++ b/httemplate/config/config-delete.cgi @@ -1,17 +1,6 @@ <%init> - -my $curuser = $FS::CurrentUser::CurrentUser; -die "access denied\n" unless $curuser->access_right('Configuration'); - -my $fsconf = new FS::Conf; -if ( $fsconf->exists('disable_settings_changes') ) { - my @changers = split(/\s*,\s*/, $fsconf->config('disable_settings_changes')); - my %changers = map { $_=>1 } @changers; - unless ( $changers{$curuser->username} ) { - errorpage("Disabled in web demo"); - die "shouldn't be reached"; - } -} +die "access denied\n" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); $cgi->param('confnum') =~ /^(\d+)$/ or die "illegal or missing confnum"; my $confnum = $1; diff --git a/httemplate/config/config-process.cgi b/httemplate/config/config-process.cgi index 4e1c85a03..788d9016e 100644 --- a/httemplate/config/config-process.cgi +++ b/httemplate/config/config-process.cgi @@ -1,30 +1,3 @@ -%if ( scalar(@error) ) { -% -% my $url = popurl(1)."config.cgi"; -% if ( length($cgi->query_string) > 1920 ) { #stupid IE 2083 URL limit -% -% my $session = int(rand(4294967296)); #XXX -% my $pref = new FS::access_user_pref({ -% 'usernum' => $FS::CurrentUser::CurrentUser->usernum, -% 'prefname' => "redirect$session", -% 'prefvalue' => $cgi->query_string, -% 'expiration' => time + 3600, #1h? 1m? -% }); -% my $pref_error = $pref->insert; -% if ( $pref_error ) { -% die "FATAL: couldn't even set redirect cookie: $pref_error". -% " attempting to set redirect$session to ". $cgi->query_string."\n"; -% } -% -<% $cgi->redirect("$url?redirect=$session") %> -% -% } else { -% -<% $cgi->redirect("$url?". $cgi->query_string ) %> -% -% } -% -%} else { <% header('Configuration set') %> <SCRIPT TYPE="text/javascript"> % my $n = 0; @@ -73,7 +46,7 @@ % my $record = qsearchs($table, { $pkey => $key }); % my $value = $record ? "$key: ".$record->$namecol() : $key; configCell.innerHTML = <% $value |js_string %>; -% } elsif ( $type eq 'select-sub' && ! $i->multiple ) { +% } elsif ( $type eq 'select-sub' ) { configCell.innerHTML = <% $conf->config($i->key, $agentnum) |js_string %> + ': ' + <% &{ $i->option_sub }( $conf->config($i->key, $agentnum) ) |js_string %>; @@ -88,7 +61,6 @@ </SCRIPT> </BODY> </HTML> -%} <%once> #false laziness w/config-view.cgi my %namecol = ( @@ -98,21 +70,10 @@ my %namecol = ( ); </%once> <%init> - -my $curuser = $FS::CurrentUser::CurrentUser; -die "access denied\n" unless $curuser->access_right('Configuration'); +die "access denied\n" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); my $conf = new FS::Conf; - -if ( $conf->exists('disable_settings_changes') ) { - my @changers = split(/\s*,\s*/, $conf->config('disable_settings_changes')); - my %changers = map { $_=>1 } @changers; - unless ( $changers{$curuser->username} ) { - errorpage_popup("Disabled in web demo"); - die "shouldn't be reached"; - } -} - $FS::Conf::DEBUG = 1; my @config_items = grep { $_->key != ~/^invoice_(html|latex|template)/ } $conf->config_items; @@ -122,7 +83,6 @@ my $agentnum = $cgi->param('agentnum'); my $key = $cgi->param('key'); my $i = $confitems{$key}; -my @error = (); my @touch = (); my @delete = (); my $n = 0; @@ -132,8 +92,6 @@ foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) { if ( $cgi->param($i->key.$n) ne '' ) { my $value = $cgi->param($i->key.$n); $value =~ s/\r\n/\n/g; #browsers? - my $error = &{$i->validate}($value, $n) if $i->validate; - push @error, $error if $error; $conf->set($i->key, $value, $agentnum); } else { $conf->delete($i->key, $agentnum); @@ -141,8 +99,6 @@ foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) { } elsif ( $type eq 'binary' || $type eq 'image' ) { if ( defined($cgi->param($i->key.$n)) && $cgi->param($i->key.$n) ) { my $fh = $cgi->upload($i->key.$n); - my $error = &{$i->validate}($fh, $n) if $i->validate; - push @error, $error if $error; if (defined($fh)) { local $/; $conf->set_binary($i->key, <$fh>, $agentnum); @@ -162,16 +118,12 @@ foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) { || $i->multiple ) ) { if ( scalar(@{[ $cgi->param($i->key.$n) ]}) ) { - my $error = &{$i->validate}([ $cgi->param($i->key.$n) ], $n) if $i->validate; - push @error, $error if $error; $conf->set($i->key, join("\n", @{[ $cgi->param($i->key.$n) ]} ), $agentnum); } else { $conf->delete($i->key, $agentnum); } } elsif ( $type =~ /^(text|select(-(sub|part_svc|part_pkg|pkg_class))?)$/ ) { if ( $cgi->param($i->key.$n) ne '' ) { - my $error = &{$i->validate}($cgi->param($i->key.$n), $n) if $i->validate; - push @error, $error if $error; $conf->set($i->key, $cgi->param($i->key.$n), $agentnum); } else { $conf->delete($i->key, $agentnum); @@ -183,8 +135,4 @@ foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) { $conf->touch($_, $agentnum) foreach @touch; $conf->delete($_, $agentnum) foreach @delete; -if (scalar(@error)) { - $cgi->param('error', join(' ', @error)); -} - </%init> diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi index 11e75707c..08f6c1020 100644 --- a/httemplate/config/config-view.cgi +++ b/httemplate/config/config-view.cgi @@ -349,7 +349,7 @@ my @config_items = grep { $page_agent ? $_->per_agent : 1 } my @deleteable = qw( invoice_latexreturnaddress invoice_htmlreturnaddress ); my %deleteable = map { $_ => 1 } @deleteable; -my @sections = qw(required billing invoicing notification UI self-service username password session shell BIND ); +my @sections = qw(required billing invoicing UI self-service username password session shell BIND ); push @sections, '', 'deprecated'; my %section_items = (); diff --git a/httemplate/config/config.cgi b/httemplate/config/config.cgi index cde48382a..ce96bc162 100644 --- a/httemplate/config/config.cgi +++ b/httemplate/config/config.cgi @@ -131,11 +131,7 @@ Setting <b><% $key %></b> % } elsif ( $type eq 'select-sub' ) { - <select name="<% "$key$n" %>" <% $config_item->multiple ? 'MULTIPLE' : '' %>> - -% unless ( $config_item->multiple ) { - <option value=""> -% } + <select name="<% "$key$n" %>"><option value=""> % my %options = &{$config_item->options_sub}; % my @options = sort { $a <=> $b } keys %options; @@ -143,17 +139,7 @@ Setting <b><% $key %></b> % foreach my $value ( @options ) { % local($^W)=0; next if $saw{$value}++; - <option value="<% $value %>" - -% if ( $value eq $conf->config($key, $agentnum) -% || ( $config_item->multiple -% && grep { $_ eq $value } $conf->config($key, $agentnum) ) ){ - - SELECTED - -% } - - ><% $value %>: <% $options{$value} %> + <option value="<% $value %>" <% $value eq $conf->config($key, $agentnum) ? 'SELECTED' : '' %>><% $value %>: <% $options{$value} %> % } % my $curvalue = $conf->config($key, $agentnum); diff --git a/httemplate/docs/about.html b/httemplate/docs/about.html index 2a0e83261..50600a460 100644 --- a/httemplate/docs/about.html +++ b/httemplate/docs/about.html @@ -29,7 +29,7 @@ GNU <b>Affero</b> General Public License.<BR> <BR> <CENTER> -<FONT SIZE="-3">"Brown eyed women and red grenadine / the bottle was dusty but the liquor was clean" -R. Hunter</FONT> +<FONT SIZE="-3">"Once in a while you get shown the light, in the strangest of places if you look at it right" -R. Hunter</FONT> </CENTER> <SCRIPT TYPE="text/javascript"> diff --git a/httemplate/docs/credits.html b/httemplate/docs/credits.html index 6500e73ba..641be46bb 100644 --- a/httemplate/docs/credits.html +++ b/httemplate/docs/credits.html @@ -31,6 +31,7 @@ <CENTER> <H3>Core Team</H3> +Peter Bowen<BR> Jeremy Davis<BR> Jeff Finucane<BR> Jason Hall<BR> @@ -40,7 +41,6 @@ Mark Wells<BR> <BR> <H3>Core Emeritus</H3> -Peter Bowen<BR> Kristian Hoffman<BR> Brian McCane<BR> Matt Simerson<BR> diff --git a/httemplate/edit/cgp_rule-redirect_all.html b/httemplate/edit/cgp_rule-redirect_all.html deleted file mode 100644 index 898eef8fc..000000000 --- a/httemplate/edit/cgp_rule-redirect_all.html +++ /dev/null @@ -1,57 +0,0 @@ -<% include('/elements/header-popup.html', 'Redirect all mail') %> - -<FORM NAME="RedirectAllForm" ACTION="process/cgp_rule-redirect_all.html" METHOD=POST> - -%# XXX upstream Redirect 1 - -<% ntable("#cccccc", 2) %> - -<TR> - <TD ALIGN="right">Redirect all mail to</TD> - <TD><textarea name="RedirectText" rows="5" cols="50"></textarea></TD> -</TR> - -<% include('/elements/tr-checkbox.html', - 'name' => 'RedirKeep', - 'label' => 'Keep a copy', - 'value' => 1, - 'curr_value' => '', #XXX - ) -%> - -<% include('/elements/tr-checkbox.html', - 'name' => 'RedirHuman', - 'label' => 'Do not redirect automatic messages', - 'value' => 1, - 'curr_value' => '', #XXX - ) -%> - -<% include('/elements/tr-checkbox.html', - 'name' => 'KeepToAndCc', - 'label' => 'Preserve To/Cc fields', - 'value' => 1, - 'curr_value' => '', #XXX - ) -%> - -</TABLE> - -<BR> -<INPUT TYPE="submit" VALUE="Redirect all mail"> -%#XXX Add/Edit - -</FORM> - -</BODY> -</HTML> -<%init> - -my %opt = @_; - -my $svc_acct = qsearchs('svc_acct', { 'svcnum' => $opt{'svcnum'} } ) - or die "unknown svcnum"; - -#XXX look for existing redirect all rule - -</%init> diff --git a/httemplate/edit/cgp_rule-vacation.html b/httemplate/edit/cgp_rule-vacation.html deleted file mode 100644 index efdc5417e..000000000 --- a/httemplate/edit/cgp_rule-vacation.html +++ /dev/null @@ -1,47 +0,0 @@ -<% include('/elements/header-popup.html', 'Vacation rule') %> - -<FORM NAME="VacationForm" ACTION="process/cgp_rule-vacation.html" METHOD=POST> - -%# XXX upstream Vacation 1 - -<% ntable("#cccccc", 2) %> - -<TR> - <TD ALIGN="right">Vacation message</TD> - <TD><textarea name="VacationText" rows="5" cols="50"></textarea></TD> -</TR> - -<% include('/elements/tr-input-date-field.html', { - 'label' => 'Ends', - 'name' => 'vacationTill', - 'value' => '', #XXX - }) -%> -%# XXX upstream: -%# VacationTill 1 -%# vacationDay -%# vacationMonth -%# vacationYear - -%#XXX Clear 'Replied Addresses' List - -</TABLE> - -<BR> -<INPUT TYPE="submit" VALUE="Add vacation message"> -%#XXX Add/Edit - -</FORM> - -</BODY> -</HTML> -<%init> - -my %opt = @_; - -my $svc_acct = qsearchs('svc_acct', { 'svcnum' => $opt{'svcnum'} } ) - or die "unknown svcnum"; - -#XXX look for existing vacation rule - -</%init> diff --git a/httemplate/edit/cgp_rule.html b/httemplate/edit/cgp_rule.html index 41275aba7..d9c19a150 100644 --- a/httemplate/edit/cgp_rule.html +++ b/httemplate/edit/cgp_rule.html @@ -51,7 +51,7 @@ my %opt = @_; my $m2_error_callback_cond = sub { my($cgi, $object) = @_; - my @fields = qw( conditionname op params ); + my @fields = qw( condition op params ); my @gfields = ( '', map "_$_", @fields ); map { @@ -83,7 +83,7 @@ my $m2_error_callback_action = sub { if ( /^ruleactionnum(\d+)$/ ) { my $num = $1; if ( grep $cgi->param("ruleactionnum$num$_"), @gfields ) { - my $x = new FS::cgp_rule_action { + my $x = new FS::cgp_rule_condition { 'ruleactionnum' => $cgi->param("ruleactionnum$num"), map { $_ => scalar($cgi->param("ruleactionnum${num}_$_")) } @fields, }; diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 57dc3597a..fac7ef27c 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -1,5 +1,5 @@ <% include('/elements/header.html', - $title, + "Customer $action", '', ' onUnload="myclose()"' #hmm, in billing.html ) %> @@ -190,7 +190,7 @@ function samechanged(what) { % } -<INPUT TYPE="hidden" NAME="usernum" VALUE="<% $cust_main->usernum %>"> +<INPUT TYPE="hidden" NAME="otaker" VALUE="<% $cust_main->otaker %>"> %# cust_main/bottomfixup.js % foreach my $hidden ( @@ -313,8 +313,8 @@ my $error = $cgi->param('error'); $cgi->delete_all(); $cgi->param('error', $error); -my $title = $custnum ? 'Edit Customer' : 'Add Customer'; -$title .= ": ". $cust_main->name if $custnum; +my $action = $custnum ? 'Edit' : 'Add'; +$action .= ": ". $cust_main->name if $custnum; my $r = qq!<font color="#ff0000">*</font> !; diff --git a/httemplate/edit/cust_main/birthdate.html b/httemplate/edit/cust_main/birthdate.html index b4e78e3b9..415aba3c4 100644 --- a/httemplate/edit/cust_main/birthdate.html +++ b/httemplate/edit/cust_main/birthdate.html @@ -1,11 +1,10 @@ <% ntable("#cccccc", 2) %> - <% include( '/elements/tr-input-date-field.html', - 'birthdate', - $cust_main->birthdate, - 'Date of Birth', - ( $conf->config('date_format') || "%m/%d/%Y" ), - 1 - ) + <% include ('/elements/tr-input-date-field.html', + 'birthdate', + $cust_main->birthdate, + 'Date of Birth', + $conf->config('date_format') || "%m/%d/%Y", + 1) %> </TABLE> <%init> diff --git a/httemplate/edit/cust_main/top_misc.html b/httemplate/edit/cust_main/top_misc.html index 441a36334..36add3721 100644 --- a/httemplate/edit/cust_main/top_misc.html +++ b/httemplate/edit/cust_main/top_misc.html @@ -1,19 +1,11 @@ <% &ntable("#cccccc") %> -%# tags -<% include('/elements/tr-select-cust_tag.html', - 'custnum' => $custnum, - 'cgi' => $cgi, - ) -%> - %# agent <% include('/elements/tr-select-agent.html', 'curr_value' => $cust_main->agentnum, 'label' => "<B>${r}Agent</B>", 'empty_label' => 'Select agent', 'disable_empty' => ( $cust_main->agentnum ? 1 : 0 ), - 'viewall_right' => 'None', #override default 'View customers of all agents' ) %> diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html index b19b3618c..0417dc536 100644 --- a/httemplate/edit/elements/edit.html +++ b/httemplate/edit/elements/edit.html @@ -307,11 +307,6 @@ Example: % foreach grep exists($f->{$_}), % qw( hashref agent_virt agent_null agent_null_right ); % -% #htmlarea -% $include_common{$_} = $f->{$_} -% foreach grep exists($f->{$_}), qw( width height ); -% -% % if ( $type eq 'tablebreak-tr-title' ) { % $include_common{'table_id'} = 'TableNumber'. $tablenum++; % } @@ -541,7 +536,7 @@ Example: var field_regex = /(\d+)(_[a-z]+)?$/; var match = field_regex.exec(what.name); if ( !match ) { - alert(what.name + " didn't match for " + what); + alert(what.name + " didn't match?!"); return; } if ( match[1] != <%$field%>_fieldnum ) { diff --git a/httemplate/edit/elements/rate_detail.html b/httemplate/edit/elements/rate_detail.html deleted file mode 100644 index faf11f844..000000000 --- a/httemplate/edit/elements/rate_detail.html +++ /dev/null @@ -1,239 +0,0 @@ -<%doc> -<% include('/edit/elements/rate_detail.html', - # required - 'ratenum' => '1', - - # optional - 'regionnum' => '25', - # or - 'countrycode' => '237', -) %> - -If regionnum is specified, this produces column headers plus -one row of rate details for that region (in all time periods). -Otherwise, there's one row for each region in the specified -countrycode (or each region anywhere, if there is no countrycode), -with row headers showing the region name and prefixes. - -</%doc> -<% include('/elements/table-grid.html') %> -<TR> -% my $col = 0; -% foreach (@header) { -% my $hlink = $hlinks[$col]; - <TH CLASS = "grid", - BGCOLOR = "#cccccc"> - <% $hlink ? qq!<A HREF="$hlink">$_</A>! : $_ %> - </TH> -% $col++; -% } #foreach @header -</TR><TR> -% my $row = 0; -% foreach my $r (@rows) { -% $col = 0; -% if ( !$opt{'regionnum'} ) { -% $region = $r; -% foreach ($r->regionname, $r->prefixes_short) { - <TD> - <A HREF="<% $p.'edit/rate_region.cgi?'.$r->regionnum %>"><% $_ %></A> - </TD> -% } -% } -% elsif ( !$opt{'ratenum'} ) { -% $rate = $r; - <TD> - <A HREF="<% $p.'edit/rate.cgi?'.$r->ratenum %>"><% $r->ratename %></A> - </TD> -% } -% foreach my $rate_time (@rate_time, '') { - <TD> -% my $detail = $details[$row][$col]; -% if($detail) { - <TABLE CLASS="inv" STYLE="border:none"> - <TR><TD><% edit_link($detail) %><% $money_char.$detail->min_charge %> - <% $detail->sec_granularity ? ' / minute':' / call' %> - <% $edit_hint %></A> - </TD></TR> - <% granularity_detail($detail) %> - <% min_included_detail($detail) %> - <% conn_charge_detail($detail) %> - <TR><TD><% $rate_time ? delete_link($detail) : '' %></TD></TR> - </TABLE> -% } -% else { #!$detail - <% add_link($rate, $region, $rate_time) %> -% } -% $col++; - </TD> -% } # foreach @rate_time -</TR> -% $row++; -% }# foreach @rate_region -</TABLE> - -<%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') || '$'; - -sub small { - '<FONT SIZE="-1">'.shift.'</FONT>' -} -my $edit_hint = small('(edit)'); - -sub edit_link { - my $rate_detail = shift; - my $ratedetailnum = $rate_detail->ratedetailnum; - '<A HREF="javascript:void(0);" onclick="'. - include( '/elements/popup_link_onclick.html', - 'action' => "${p}edit/rate_detail.html?$ratedetailnum", - 'actionlabel' => 'Edit rate', - 'height' => 420, - #default# 'width' => 540, - #default# 'color' => '#333399', - ) . '">' -} - -sub add_link { - my ($rate, $region, $rate_time) = @_; - '<A HREF="javascript:void(0);" onclick="'. - include( '/elements/popup_link_onclick.html', - 'action' => "${p}edit/rate_detail.html?ratenum=". - $rate->ratenum. - ';dest_regionnum='. - $region->regionnum. - ($rate_time ? - ';ratetimenum='.$rate_time->ratetimenum : - ''), - 'actionlabel' => 'Add rate', - 'height' => 420, - ).'">'.small('(add)').'</A>' -} - -sub delete_link { - my $rate_detail = shift; - my $ratedetailnum = $rate_detail->ratedetailnum; - my $onclick = include( '/elements/popup_link_onclick.html', - 'action' => "${p}misc/delete-rate_detail.html?$ratedetailnum", - 'actionlabel' => 'Delete rate', - 'width' => 510, - 'height' => 315, - 'frame' => 'top', - ); - $onclick = "if(confirm('Delete this rate?')) { $onclick }"; - qq!<A HREF="javascript:void(0);" onclick="$onclick">!.small('(delete)').'</A>' -} - -sub granularity_detail { - my $rate_detail = shift; - if($rate_detail->sec_granularity != 60 && $rate_detail->sec_granularity > 0) { - '<TR><TD>'. - small('in '.$granularity{$rate_detail->sec_granularity}.' increments'). - '</TD></TR>'; - } - else { '' } -} - -sub min_included_detail { - my $rate_detail = shift; - if($rate_detail->min_included) { - '<TR><TD>'. - small( $rate_detail->min_included . - ($rate_detail->sec_granularity ? - ' minutes included' : - ' calls included') ). - '</TD></TR>' - } - else { '' } -} - -sub conn_charge_detail { - my $rate_detail = shift; - if($rate_detail->conn_charge > 0) { - #return '' unless $rate_detail->conn_charge > 0 || $rate_detail->conn_sec; - '<TR><TD>'. - small( $money_char. $rate_detail->conn_charge. - ' for '.$conn_secs{$rate_detail->conn_sec} - ). - '</TD></TR>' - } - else { '' } -} - -</%once> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); - -my %opt = @_; -my $ratenum = $opt{'ratenum'} || ''; -my $regionnum = $opt{'regionnum'} || ''; - -# either of these, if the $opt isn't passed, will be set to the -# correct object when generating each row. -my $rate = qsearchs('rate', { 'ratenum' => $ratenum } ) if $ratenum; -my $region = qsearchs('rate_region', { 'regionnum' => $regionnum }) if $regionnum; - -my @rate_time = qsearch('rate_time', {}); -my @header = ( - map( { $_->ratetimename } @rate_time ), - 'Default rate'); -my @hlinks = map( {$p.'edit/rate_time.cgi?'.$_->ratetimenum} @rate_time ), ''; -my @rtns = ( map( { $_->ratetimenum } @rate_time ), '' ); - -my @details; -my @rows; -if ( $ratenum ) { - if ( $regionnum ) { - @rows = qsearch('rate_region', - { ratenum => $ratenum, regionnum => $regionnum }); - } - else { - my $where = ''; - if ( $opt{'countrycode'} ) { - $where = "WHERE 0 < ( - SELECT COUNT(*) FROM rate_prefix - WHERE rate_prefix.regionnum = rate_region.regionnum - AND countrycode = '$opt{countrycode}' - )"; - } - @rows = qsearch({ table => 'rate_region', - hashref => { }, - extra_sql => $where, - }); - die "no region found" if !@rows; - - unshift @header, 'Region', 'Prefix(es)'; - unshift @hlinks, '', ''; - } - foreach my $region (@rows) { - push @details, [ map { qsearchs('rate_detail', - { 'ratenum' => $ratenum, - 'dest_regionnum' => $region->regionnum, - 'ratetimenum' => $_ } ) or '' - } @rtns - ]; - } -} -elsif ( $regionnum ) { - @rows = qsearch('rate', {}) or die "no rate plans found"; - unshift @header, 'Rate plan'; - unshift @hlinks, ''; - foreach my $rate (@rows) { - push @details, [ map { qsearchs('rate_detail', - { 'ratenum' => $rate->ratenum, - 'dest_regionnum' => $regionnum, - 'ratetimenum' => $_ } ) or '' - } @rtns - ]; - } -} -else { - die "no ratenum or regionnum specified"; -} - -</%init> diff --git a/httemplate/edit/msg_template.html b/httemplate/edit/msg_template.html deleted file mode 100644 index 67eae185d..000000000 --- a/httemplate/edit/msg_template.html +++ /dev/null @@ -1,158 +0,0 @@ -<% include( 'elements/edit.html', - 'html_init' => '<TABLE id="outerTable"><TR><TD>', - 'name_singular' => 'template', - 'table' => 'msg_template', - 'viewall_dir' => 'browse', - 'agent_virt' => 1, - 'agent_null' => 1, - 'agent_null_right' => 'Edit global templates', - - 'fields' => [ 'msgname', - 'subject', - 'from_addr', - { field=>'body', type=>'htmlarea', width=>763 }, - ], - 'labels' => { 'msgnum' => 'Template', - 'msgname' => 'Template name', - 'from_addr' => 'Return address', - 'subject' => 'Message subject', - 'body' => 'Message template', - }, - 'html_foot' => "</TD>$sidebar</TR></TABLE>", - ) -%> -<%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'); - -# 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', - '$invoicing_list_emailonly' => 'Billing email address', - '$cust_status' => 'Status', - '$ucfirst_cust_status' => 'Status, capitalized', - '$cust_statuscolor' => 'Status color code', - '$company_name' => 'Our company name', - ], - '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', - '$fax' => 'Fax', - ], - 'cust_bill' => [ - '$invnum' => 'Invoice#', - ], - 'cust_pkg' => [ - '$pkgnum' => 'Package#', - '$pkg_label' => 'Package label (short)', - '$pkg_label_long' => 'Package label (long)', - '$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' => [ - '$username' => 'Login name', - '$password' => 'Password', - ], - 'cust_pay' => [ - '$paynum' => 'Payment#', - '$paid' => 'Amount', - '$payby' => 'Payment method', - '$date' => 'Payment date', - '$payinfo' => 'Card/account# (masked)', - ], -); -my @c = @{ $substitutions{'contact'} }; -for (my $i=0; $i<scalar(@c); $i += 2) { - $c[$i] =~ s/\$(.*)/\$ship_$1/; -} -$substitutions{'shipping'} = \@c; - -tie my %sections, 'Tie::IxHash', ( -'contact' => 'Name and contact info (billing)', -'shipping' => 'Name and contact info (shipping)', -'cust_main' => 'Customer status and payment info', -'cust_pkg' => 'Package fields', -'cust_bill' => 'Invoice fields', -'cust_pay' => 'Payment fields', -'svc_acct' => 'Login 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 = FCKeditorAPI.GetInstance("body"); - oEditor.InsertHtml(what); -}; -</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> -'; - -</%init> diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index deefa9cc1..c8b7ecb58 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -563,10 +563,6 @@ my $html_bottom = sub { $html .= ' MULTIPLE' if $href->{$field}{'type'} eq 'select_multiple'; $html .= qq! NAME="${layer}__$field">!; - - $html .= '<OPTION VALUE="">'. $href->{$field}{'empty_label'} - if exists($href->{$field}{'disable_empty'}) - && ! $href->{$field}{'disable_empty'}; if ( $href->{$field}{'select_table'} ) { foreach my $record ( diff --git a/httemplate/edit/part_tag.html b/httemplate/edit/part_tag.html deleted file mode 100644 index 87c77fa98..000000000 --- a/httemplate/edit/part_tag.html +++ /dev/null @@ -1,29 +0,0 @@ -<% include( 'elements/edit.html', - 'table' => 'part_tag', - 'name_singular' => 'tag', - 'fields' => [ - { field=>'tagname', type=>'text', size=>10 }, - { field=>'disabled', type=>'checkbox', value=>'Y' }, - { field=>'tagdesc', type=>'text', size=>60 }, - $tagcolor, - ], - 'labels' => { 'tagnum' => 'Tag #', - 'tagname' => 'Tag', - 'tagdesc' => 'Message', - 'tagcolor' => 'Highlight Color', - 'disabled' => 'Disabled', - }, - 'viewall_dir' => 'browse', - ) -%> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); - -my $tagcolor = { - field => 'tagcolor', - type => 'pickcolor', -}; - -</%init> diff --git a/httemplate/edit/process/access_group.html b/httemplate/edit/process/access_group.html index 2d125c387..ab25cb3a2 100644 --- a/httemplate/edit/process/access_group.html +++ b/httemplate/edit/process/access_group.html @@ -1,3 +1,6 @@ +% if ( $conf->exists('disable_acl_changes') ) { + ACL changes disabled in public demo. +% } else { <% include( 'elements/process.html', 'table' => 'access_group', 'viewall_dir' => 'browse', @@ -14,14 +17,12 @@ }, ) %> +% } <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); -if ( FS::Conf->new->exists('disable_acl_changes') ) { - errorpage('ACL changes disabled in public demo.'); - die "shouldn't be reached"; -} +my $conf = new FS::Conf; </%init> diff --git a/httemplate/edit/process/access_user.html b/httemplate/edit/process/access_user.html index e6258a9b1..ca6bb603f 100644 --- a/httemplate/edit/process/access_user.html +++ b/httemplate/edit/process/access_user.html @@ -18,9 +18,4 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); -if ( FS::Conf->new->exists('disable_acl_changes') ) { - errorpage('ACL changes disabled in public demo.'); - die "shouldn't be reached"; -} - </%init> diff --git a/httemplate/edit/process/agent.cgi b/httemplate/edit/process/agent.cgi index e776d281c..3cdf40c9b 100755 --- a/httemplate/edit/process/agent.cgi +++ b/httemplate/edit/process/agent.cgi @@ -13,9 +13,4 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); -if ( FS::Conf->new->exists('disable_acl_changes') ) { - errorpage('ACL changes disabled in public demo.'); - die "shouldn't be reached"; -} - </%init> diff --git a/httemplate/edit/process/cgp_rule.html b/httemplate/edit/process/cgp_rule.html index 5326587cb..f427b6ccf 100644 --- a/httemplate/edit/process/cgp_rule.html +++ b/httemplate/edit/process/cgp_rule.html @@ -4,19 +4,13 @@ 'process_o2m' => [ { 'table' => 'cgp_rule_condition', - 'fields' => [qw( conditionname op params )], + 'fields' => [qw( condition op params )], }, { 'table' => 'cgp_rule_action', 'fields' => [qw( action params )], }, ], - 'noerror_callback' => sub { - my( $cgi, $object ) = @_; - my $error = $object->svc_export; - #shit, not a good place for error handling :/ - die $error if $error; - }, ) %> <%init> diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index 3158d7bbf..1311ba4f3 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -73,8 +73,6 @@ if ( defined($cgi->param('same')) && $cgi->param('same') eq "Y" ) { ); } -$new->tagnum( [ $cgi->param('tagnum') ] ); - my %usedatetime = ( 'birthdate' => 1 ); foreach my $dfield (qw( birthdate signupdate )) { diff --git a/httemplate/edit/process/elements/process.html b/httemplate/edit/process/elements/process.html index 53419cde0..87cadb774 100644 --- a/httemplate/edit/process/elements/process.html +++ b/httemplate/edit/process/elements/process.html @@ -65,9 +65,6 @@ Example: #return an error string or empty for no error 'precheck_callback' => sub { my( $cgi ) = @_; }, - #after everything's inserted - 'noerror_callback' => sub { my( $cgi, $object ) = @_; }, - #supplies arguments to insert() and replace() # for use with tables that are FS::option_Common (among other things) 'args_callback' => sub { my( $cgi, $object ) = @_; }, @@ -207,7 +204,6 @@ if ( $opt{'agent_virt'} ) { die "illegal agentnum" unless $curuser->agentnums_href->{$new->agentnum} - or $curuser->access_right('View customers of all agents') or $opt{'agent_null_right'} && ! $new->agentnum && $curuser->access_right($opt{'agent_null_right'}); @@ -302,20 +298,12 @@ if ( !$error && $opt{'process_o2m'} ) { if ( $error ) { - $cgi->param('error', $error); if ( $opt{'clear_on_error'} && scalar(@{$opt{'clear_on_error'}}) ) { foreach my $field (@{$opt{'clear_on_error'}}) { $cgi->param($field, '') } } - -} else { - - if ( $opt{'noerror_callback'} ) { - &{ $opt{'noerror_callback'} }( $cgi, $new ); - } - } </%init> diff --git a/httemplate/edit/process/elements/svc_Common.html b/httemplate/edit/process/elements/svc_Common.html index 5a8afbd6c..8e8c99a42 100644 --- a/httemplate/edit/process/elements/svc_Common.html +++ b/httemplate/edit/process/elements/svc_Common.html @@ -1,14 +1,15 @@ +% +% +% my %opt = @_; +% my $table = $opt{'table'}; +% $opt{'fields'} ||= [ fields($table) ]; +% push @{ $opt{'fields'} }, qw( pkgnum svcpart ); +% +% <% include( 'process.html', 'edit_ext' => 'cgi', 'redirect' => popurl(3)."view/$table.cgi?", %opt, ) %> -<%init> -my %opt = @_; -my $table = $opt{'table'}; -$opt{'fields'} ||= [ fields($table) ]; -push @{ $opt{'fields'} }, qw( pkgnum svcpart ); - -</%init> diff --git a/httemplate/edit/process/msg_template.html b/httemplate/edit/process/msg_template.html deleted file mode 100644 index 70d451b72..000000000 --- a/httemplate/edit/process/msg_template.html +++ /dev/null @@ -1,13 +0,0 @@ -<% include( 'elements/process.html', - 'table' => 'msg_template', - 'viewall_dir' => 'browse', - ) -%> -<%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'); - -</%init> diff --git a/httemplate/edit/process/part_tag.html b/httemplate/edit/process/part_tag.html deleted file mode 100644 index 077dc4cd9..000000000 --- a/httemplate/edit/process/part_tag.html +++ /dev/null @@ -1,11 +0,0 @@ -<% include( 'elements/process.html', - 'table' => 'part_tag', - 'viewall_dir' => 'browse', - ) -%> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); - -</%init> diff --git a/httemplate/edit/process/rate_region.cgi b/httemplate/edit/process/rate_region.cgi index d342e605a..8036f7388 100755 --- a/httemplate/edit/process/rate_region.cgi +++ b/httemplate/edit/process/rate_region.cgi @@ -1,8 +1,6 @@ %if ( $error ) { % $cgi->param('error', $error); <% $cgi->redirect(popurl(2). "rate_region.cgi?". $cgi->query_string ) %> -%} elsif ( $action eq 'Add' ) { -<% $cgi->redirect(popurl(2). "rate_region.cgi?$regionnum") %> %} else { <% $cgi->redirect(popurl(3). "browse/rate_region.html") %> %} @@ -13,7 +11,6 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); my $regionnum = $cgi->param('regionnum'); -my $action = $regionnum ? 'Edit' : 'Add'; my $old = qsearchs('rate_region', { 'regionnum' => $regionnum } ) if $regionnum; @@ -36,12 +33,24 @@ my @rate_prefix = map { 'npa' => $_, } } @npa; -# we no longer process dest_detail records here + +my @dest_detail = map { + my $ratenum = $_->ratenum; + new FS::rate_detail { + 'ratenum' => $ratenum, + map { $_ => $cgi->param("$_$ratenum") } + qw( min_included conn_charge conn_sec min_charge sec_granularity classnum ) + }; +} qsearch('rate', {} ); + + my $error; if ( $regionnum ) { - $error = $new->replace($old, 'rate_prefix' => \@rate_prefix ); + $error = $new->replace($old, 'rate_prefix' => \@rate_prefix, + 'dest_detail' => \@dest_detail, ); } else { - $error = $new->insert( 'rate_prefix' => \@rate_prefix ); + $error = $new->insert( 'rate_prefix' => \@rate_prefix, + 'dest_detail' => \@dest_detail, ); $regionnum = $new->getfield('regionnum'); } diff --git a/httemplate/edit/process/rate_time.cgi b/httemplate/edit/process/rate_time.cgi deleted file mode 100644 index 4fa78ce6d..000000000 --- a/httemplate/edit/process/rate_time.cgi +++ /dev/null @@ -1,94 +0,0 @@ -% if ( $error ) { -% $cgi->param('error', $error); -<% $cgi->redirect(popurl(2). "rate_time.cgi?". $cgi->query_string ) %> -% } else { -<% $cgi->redirect(popurl(3). "browse/rate_time.html" ) %> -% } -%# dumper_html(\%vars, \%old_ints, {$rate_time->intervals}) %> -<%init> -my $error = ''; -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); -my $ratetimenum = $cgi->param('ratetimenum'); -my $ratetimename = $cgi->param('ratetimename'); -my $delete = $cgi->param('delete'); - -my %vars = $cgi->Vars; -#warn Dumper(\%vars)."\n"; - -my $rate_time; - -my %old_ints; -if( $ratetimenum ) { - # editing - $rate_time = FS::rate_time->by_key($ratetimenum); - - # make a list of existing intervals that will be deleted - foreach ($rate_time->intervals) { - $old_ints{$_->intervalnum} = $_; - } - - if ( $delete ) { - $error = $rate_time->delete; - # intervals will be deleted later - } - elsif( $ratetimename ne $rate_time->ratetimename ) { - # the only case where the rate_time itself must be replaced - $rate_time->ratetimename($ratetimename); - $error = $rate_time->replace; - } -} -else { #!$ratetimenum, adding new - $rate_time = FS::rate_time->new({ ratetimename => $ratetimename }); - $error = $rate_time->insert; - $ratetimenum = $rate_time->ratetimenum; -} - -my @new_ints; -if(!$delete and !$error) { - foreach my $i (map { /^sd(\d+)$/ } keys(%vars)) { - my $stime = l2wtime(@vars{"sd$i", "sh$i", "sm$i", "sa$i"}); - my $etime = l2wtime(@vars{"ed$i", "eh$i", "em$i", "ea$i"}); - #warn "$i: $stime - $etime"; - next if !defined($stime) or !defined($etime) or $etime == $stime; - # try to avoid needlessly wiping and replacing intervals every - # time this is edited. - if( %old_ints ) { - my $this_int = qsearchs('rate_time_interval', - { ratetimenum => $ratetimenum, - stime => $stime, - etime => $etime, } ); - if($this_int) { - delete $old_ints{$this_int->intervalnum}; - #warn "not deleting $stime-$etime\n"; - next; #$i - } - } - push @new_ints, FS::rate_time_interval->new({ ratetimenum => $ratetimenum, - stime => $stime, - etime => $etime, } ); - } -} -if(!$error) { - foreach (values(%old_ints)) { - $error = $_->delete; - #warn "deleting ".$_->stime.' '.$_->etime."\n"; - last if $error; - } -} -if(!$error) { - # do this last to avoid overlap errors with deleted intervals - foreach (@new_ints) { - $error = $_->insert; - #warn "inserting $stime-$etime\n"; - last if $error; - } -} - -sub l2wtime { - my ($d, $h, $m, $a) = @_; - $h += 24*$d + 12*$a; - $m += 60*$h; - return 60*$m -} -</%init> diff --git a/httemplate/edit/process/svc_acct.cgi b/httemplate/edit/process/svc_acct.cgi index 0b272b5b1..0d2c007f1 100755 --- a/httemplate/edit/process/svc_acct.cgi +++ b/httemplate/edit/process/svc_acct.cgi @@ -70,7 +70,6 @@ if ( $svcnum ) { grep { $new->$_ } qw( seconds upbytes downbytes totalbytes ); - $error ||= "invalid $_" foreach grep { $hash{$_} !~ /^\d+$/ } keys %hash; $error ||= $new->set_usage(\%hash); #unoverlimit and trigger radius changes last; #once is enough } diff --git a/httemplate/edit/prospect_main.html b/httemplate/edit/prospect_main.html index e867907ed..8ae76a9a1 100644 --- a/httemplate/edit/prospect_main.html +++ b/httemplate/edit/prospect_main.html @@ -98,6 +98,7 @@ my $m2_error_callback = sub { 'contactnum' => $cgi->param("contactnum$num"), map { $_ => scalar($cgi->param("contactnum${num}_$_")) } @fields, }; + use Data::Dumper; warn Dumper $x; $x; } else { (); @@ -109,6 +110,6 @@ my $m2_error_callback = sub { $cgi->param; }; -#my @agentnums = $FS::CurrentUser::CurrentUser->agentnums; +my @agentnums = $FS::CurrentUser::CurrentUser->agentnums; </%init> diff --git a/httemplate/edit/rate.cgi b/httemplate/edit/rate.cgi index 13717dc1a..75c714322 100644 --- a/httemplate/edit/rate.cgi +++ b/httemplate/edit/rate.cgi @@ -22,14 +22,8 @@ Rate plan <INPUT NAME="submit" TYPE="button" VALUE="<% $rate->ratenum ? "Apply changes" : "Add rate plan" %>" onClick="document.OneTrueForm.submit.disabled=true; process();"> -</FORM> -% if($rate->ratenum) { -<BR><BR><FONT SIZE="+2">Rates in this plan</FONT> -<% include('/edit/elements/rate_detail.html', - 'ratenum' => $rate->ratenum -) %> -% } +</FORM> <% include('/elements/footer.html') %> diff --git a/httemplate/edit/rate_detail.html b/httemplate/edit/rate_detail.html index ec04e4cbb..869ace8d4 100644 --- a/httemplate/edit/rate_detail.html +++ b/httemplate/edit/rate_detail.html @@ -5,7 +5,6 @@ 'labels' => { 'ratedetailnum' => 'Rate', #should hide... 'dest_regionname' => 'Region', 'dest_prefixes_short' => 'Prefix(es)', - 'rate_time_name' => 'Time period', 'min_included' => 'Included minutes/calls', 'conn_charge' => 'Connection charge', 'conn_sec' => 'For', @@ -17,10 +16,8 @@ { field=>'ratenum', type=>'hidden', }, { field=>'orig_regionnum', type=>'hidden', }, { field=>'dest_regionnum', type=>'hidden', }, - { field=>'ratetimenum', type=>'hidden', }, { field=>'dest_regionname', type=>'fixed', }, { field=>'dest_prefixes_short', type=>'fixed', }, - { field=>'rate_time_name', type=>'fixed', }, { field=>'min_included', type=>'text', size=>5 }, { field=>'conn_charge', type=>'money', size=>4 }, { field =>'conn_sec', @@ -45,12 +42,6 @@ }, ], - 'new_hashref_callback' => sub { - { ratenum => $cgi->param('ratenum'), - dest_regionnum => $cgi->param('dest_regionnum'), - ratetimenum => $cgi->param('ratetimenum'), - } - }, ) %> <%once> diff --git a/httemplate/edit/rate_region.cgi b/httemplate/edit/rate_region.cgi index cae30030a..f77c0dbe7 100644 --- a/httemplate/edit/rate_region.cgi +++ b/httemplate/edit/rate_region.cgi @@ -35,20 +35,114 @@ </TABLE> -<BR><BR> -<INPUT TYPE="submit" VALUE="<% $rate_region->regionnum ? "Apply changes" : "Add region" %>"> -</FORM> -%# rate plan info, if the region has been created yet +%# rate plan info -% if($rate_region->regionnum) { <BR> -<BR> -<FONT SIZE="+2">Rates in this region</FONT> -<% include('/edit/elements/rate_detail.html', - 'regionnum' => $rate_region->regionnum, -) %> + +<% include('/elements/table-grid.html') %> +% my $bgcolor1 = '#eeeeee'; +% my $bgcolor2 = '#ffffff'; +% my $bgcolor = ''; + + <TR> + <TH CLASS="grid" BGCOLOR="#cccccc"> + Rate plan + </TH> + <TH CLASS="grid" BGCOLOR="#cccccc"> + <FONT SIZE=-1>Included<BR>minutes/calls</FONT> + </TH> + <TH CLASS="grid" BGCOLOR="#cccccc"> + <FONT SIZE=-1>Connection<BR>charge</FONT> + </TH> + <TH CLASS="grid" BGCOLOR="#cccccc"> + <FONT SIZE=-1>Connection<BR>charge for</FONT> + </TH> + <TH CLASS="grid" BGCOLOR="#cccccc"> + <FONT SIZE=-1>Charge per<BR>minute/call</FONT> + </TH> + <TH CLASS="grid" BGCOLOR="#cccccc"> + <FONT SIZE=-1>Granularity</FONT> + </TH> + <TH CLASS="grid" BGCOLOR="#cccccc"> + <FONT SIZE=-1>Usage class</FONT> + </TH> + </TR> + +% foreach my $rate ( qsearch('rate', {}) ) { +% +% my $n = $rate->ratenum; +% my $rate_detail = $rate->dest_detail($rate_region) +% || new FS::rate_region { 'min_included' => 0, +% 'min_charge' => 0, +% 'sec_granularity' => '60' +% }; +% +% if ( $bgcolor eq $bgcolor1 ) { +% $bgcolor = $bgcolor2; +% } else { +% $bgcolor = $bgcolor1; % } + <TR> + + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> + <A HREF="<%$p%>edit/rate.cgi?<% $rate->ratenum %>"><% $rate->ratename %></A> + </TD> + + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> + <INPUT TYPE="text" SIZE=9 NAME="min_included<%$n%>" VALUE="<% $cgi->param("min_included$n") || $rate_detail->min_included |h %>"> + </TD> + + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> + <%$money_char%><INPUT TYPE="text" SIZE=9 NAME="conn_charge<%$n%>" VALUE="<% $cgi->param("conn_charge$n") || $rate_detail->conn_charge |h %>"> + </TD> + + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> + <SELECT NAME="conn_sec<%$n%>"> +% foreach my $conn_sec ( keys %conn_secs ) { +% my $curr_value = $cgi->param("conn_sec$n") || $rate_detail->conn_sec; +% my $selected = ($conn_sec==$curr_value) ? ' SELECTED' : ''; + <OPTION VALUE="<% $conn_sec %>" <%$selected%>><% $conn_secs{$conn_sec} %></OPTION> +% } + </TD> + + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> + <%$money_char%><INPUT TYPE="text" SIZE=6 NAME="min_charge<%$n%>" VALUE="<% $cgi->param("min_charge$n") || $rate_detail->min_charge |h %>"> + </TD> + + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> + <SELECT NAME="sec_granularity<%$n%>"> +% foreach my $granularity ( keys %granularity ) { + <OPTION VALUE="<%$granularity%>"<% $granularity == ( $cgi->param("sec_granularity$n") || $rate_detail->sec_granularity ) ? ' SELECTED' : '' %>><%$granularity{$granularity}%> +% } + </SELECT> + </TD> + + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> + <% include( '/elements/select-table.html', + 'element_name' => "classnum$n", + 'table' => 'usage_class', + 'name_col' => 'classname', + 'empty_label' => '(default)', + 'hashref' => { disabled => '' }, + 'curr_value' => ( $cgi->param("classnum$n") || + $rate_detail->classnum ), + ) + %> + </TD> + + </TR> + +% } + +</TABLE> + + +<BR><BR> +<INPUT TYPE="submit" VALUE="<% $rate_region->regionnum ? "Apply changes" : "Add region" %>"> + +</FORM> + <% include('/elements/footer.html') %> <%once> diff --git a/httemplate/edit/rate_time.cgi b/httemplate/edit/rate_time.cgi deleted file mode 100644 index eca8fbb61..000000000 --- a/httemplate/edit/rate_time.cgi +++ /dev/null @@ -1,69 +0,0 @@ -<% include("/elements/header.html", { title => "$action Time Period" }) %> -<% include("/elements/menubar.html", - 'Rate plans' => "${p}browse/rate.cgi", - ) %> -<BR> -<% include('/elements/error.html') %> -<BR> - -<FORM METHOD="POST" ACTION="<% "${p}edit/process/rate_time.cgi" %>"> -<INPUT TYPE="hidden" NAME="ratetimenum" VALUE="<% $ratetimenum %>"> -<% ntable('#cccccc',2) %> -<TABLE> - <TR> - <TH ALIGN="right">Period name</TH> - <TD><INPUT TYPE="text" NAME="ratetimename" VALUE="<% $rate_time ? $rate_time->ratetimename : '' %>"></TD> - </TR> -</TABLE> -<% include('/elements/auto-table.html', - 'header' => [ '', 'Start','','', '','End','','' ], - 'fields' => [ qw(sd sh sm sa ed eh em ea) ], - 'select' => [ ($day, $hour, $min, $ampm) x 2 ], - 'data' => \@data, - ) %> -<INPUT TYPE="submit" VALUE="<% $rate_time ? 'Apply changes' : 'Add period'%>"> -</FORM> -<BR> -<A HREF="<% "${p}edit/process/rate_time.cgi?ratetimenum=$ratetimenum;delete=1" %>">Delete this period</A> -<% include('/elements/footer.html') %> - -<%init> -my $ratetimenum = ($cgi->keywords)[0] || $cgi->param('ratetimenum') || ''; -my $action = 'Add'; -my $rate_time; -my @data = (); -my $day = [ 0 => 'Sun', - 1 => 'Mon', - 2 => 'Tue', - 3 => 'Wed', - 4 => 'Thu', - 5 => 'Fri', - 6 => 'Sat', ]; -my $hour = [ map( {$_, sprintf('%02d',$_) } 0..11 )]; -my $min = [ map( {$_, sprintf('%02d',$_) } 0,30 )]; -my $ampm = [ 0 => 'AM', 1 => 'PM' ]; - -if($ratetimenum) { - $action = 'Edit'; - $rate_time = qsearchs('rate_time', {ratetimenum => $ratetimenum}) - or die "ratetimenum $ratetimenum not found"; - if($cgi->param('error')) { - my %vars = $cgi->Vars; - foreach my $i (sort {$a <=> $b } map { /^sd(\d+)$/ } keys(%vars)) { - push @data, [ @vars{"sd$i", "sh$i", "sm$i", "sa$i", - "ed$i", "eh$i", "em$i", "ea$i"} ]; - } - } - else { - foreach my $interval ($rate_time->intervals) { - push @data, [ map { int($_/86400) % 7, - int($_/3600) % 12, - int($_/60) % 60, - int($_/43200) % 2, } - ( $interval->stime, $interval->etime ) - ]; - } - } -} - -</%init> diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index 59b5d10f3..5c2d5f495 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -392,16 +392,10 @@ Service # <% $svcnum ? "<B>$svcnum</B>" : " (NEW)" %><BR> </TD> </TR> - <% include('/elements/tr-select.html', - 'label' => 'On logout remove trash', - 'field' => 'cgp_emptytrash', - 'options' => $svc_acct->cgp_emptytrash_values, - 'labels' => { - '' => 'default (92 days)', #right? - }, - 'curr_value' => $svc_acct->cgp_emptytrash, - ) - %> + <TR> + <TD ALIGN="right">On logout remove trash</TD> + <TD><INPUT TYPE="text" NAME="cgp_emptytrash" VALUE="<% $svc_acct->cgp_emptytrash %>"></TD> + </TR> <% include('/elements/tr-select.html', 'label' => 'Language', @@ -417,7 +411,69 @@ Service # <% $svcnum ? "<B>$svcnum</B>" : " (NEW)" %><BR> <% include('/elements/tr-select.html', 'label' => 'Time zone', 'field' => 'cgp_timezone', - 'options' => $svc_acct->cgp_timezone_values, + 'options' => [ + 'HostOS', + '(+0100) Algeria/Congo', + '(+0200) Egypt/South Africa', + '(+0300) Saudi Arabia', + '(+0400) Oman', + '(+0500) Pakistan', + '(+0600) Bangladesh', + '(+0700) Thailand/Vietnam', + '(+0800) China/Malaysia', + '(+0900) Japan/Korea', + '(+1000) Queensland', + '(+1100) Micronesia', + '(+1200) Fiji', + '(+1300) Tonga/Kiribati', + '(+1400) Christmas Islands', + '(-0100) Azores/Cape Verde', + '(-0200) Fernando de Noronha', + '(-0300) Argentina/Uruguay', + '(-0400) Venezuela/Guyana', + '(-0500) Haiti/Peru', + '(-0600) Central America', + '(-0700) Arisona', + '(-0800) Adamstown', + '(-0900) Marquesas Islands', + '(-1000) Hawaii/Tahiti', + '(-1100) Samoa', + 'Asia/Afghanistan', + 'Asia/India', + 'Asia/Iran', + 'Asia/Iraq', + 'Asia/Israel', + 'Asia/Jordan', + 'Asia/Lebanon', + 'Asia/Syria', + 'Australia/Adelaide', + 'Australia/East', + 'Australia/NorthernTerritory', + 'Europe/Central', + 'Europe/Eastern', + 'Europe/Moscow', + 'Europe/Western', + 'GMT (+0000)', + 'Newfoundland', + 'NewZealand/Auckland', + 'NorthAmerica/Alaska', + 'NorthAmerica/Atlantic', + 'NorthAmerica/Central', + 'NorthAmerica/Eastern', + 'NorthAmerica/Mountain', + 'NorthAmerica/Pacific', + 'Russia/Ekaterinburg', + 'Russia/Irkutsk', + 'Russia/Kamchatka', + 'Russia/Krasnoyarsk', + 'Russia/Magadan', + 'Russia/Novosibirsk', + 'Russia/Vladivostok', + 'Russia/Yakutsk', + 'SouthAmerica/Brasil', + 'SouthAmerica/Chile', + 'SouthAmerica/Paraguay', + ], 'labels' => { '' => 'default (HostOS)', }, diff --git a/httemplate/edit/svc_domain.cgi b/httemplate/edit/svc_domain.cgi index 5abe9d6b5..b19e9ee15 100755 --- a/httemplate/edit/svc_domain.cgi +++ b/httemplate/edit/svc_domain.cgi @@ -220,17 +220,11 @@ Account defaults </TD> </TR> - <% include('/elements/tr-select.html', + <% include('/elements/tr-input-text.html', 'label' => 'On logout remove trash', - 'field' => 'acct_def_cgp_emptytrash', - 'options' => $svc_domain->cgp_emptytrash_values, - 'labels' => { - '' => 'default (92 days)', #right? - }, 'curr_value' => $svc_domain->acct_def_cgp_emptytrash, ) %> - <% include('/elements/tr-select.html', 'label' => 'Language', 'field' => 'acct_def_cgp_language', @@ -245,7 +239,69 @@ Account defaults <% include('/elements/tr-select.html', 'label' => 'Time zone', 'field' => 'acct_def_cgp_timezone', - 'options' => $svc_domain->cgp_timezone_values, + 'options' => [ + 'HostOS', + '(+0100) Algeria/Congo', + '(+0200) Egypt/South Africa', + '(+0300) Saudi Arabia', + '(+0400) Oman', + '(+0500) Pakistan', + '(+0600) Bangladesh', + '(+0700) Thailand/Vietnam', + '(+0800) China/Malaysia', + '(+0900) Japan/Korea', + '(+1000) Queensland', + '(+1100) Micronesia', + '(+1200) Fiji', + '(+1300) Tonga/Kiribati', + '(+1400) Christmas Islands', + '(-0100) Azores/Cape Verde', + '(-0200) Fernando de Noronha', + '(-0300) Argentina/Uruguay', + '(-0400) Venezuela/Guyana', + '(-0500) Haiti/Peru', + '(-0600) Central America', + '(-0700) Arisona', + '(-0800) Adamstown', + '(-0900) Marquesas Islands', + '(-1000) Hawaii/Tahiti', + '(-1100) Samoa', + 'Asia/Afghanistan', + 'Asia/India', + 'Asia/Iran', + 'Asia/Iraq', + 'Asia/Israel', + 'Asia/Jordan', + 'Asia/Lebanon', + 'Asia/Syria', + 'Australia/Adelaide', + 'Australia/East', + 'Australia/NorthernTerritory', + 'Europe/Central', + 'Europe/Eastern', + 'Europe/Moscow', + 'Europe/Western', + 'GMT (+0000)', + 'Newfoundland', + 'NewZealand/Auckland', + 'NorthAmerica/Alaska', + 'NorthAmerica/Atlantic', + 'NorthAmerica/Central', + 'NorthAmerica/Eastern', + 'NorthAmerica/Mountain', + 'NorthAmerica/Pacific', + 'Russia/Ekaterinburg', + 'Russia/Irkutsk', + 'Russia/Kamchatka', + 'Russia/Krasnoyarsk', + 'Russia/Magadan', + 'Russia/Novosibirsk', + 'Russia/Vladivostok', + 'Russia/Yakutsk', + 'SouthAmerica/Brasil', + 'SouthAmerica/Chile', + 'SouthAmerica/Paraguay', + ], 'labels' => { '' => 'default (HostOS)', }, diff --git a/httemplate/elements/auto-table.html b/httemplate/elements/auto-table.html deleted file mode 100644 index 9c7dfd09a..000000000 --- a/httemplate/elements/auto-table.html +++ /dev/null @@ -1,161 +0,0 @@ -<%doc> - -Example: -<% include('/elements/auto-table.html', - - ### - # required - ### - - 'header' => [ '#', 'Item', 'Amount' ], - 'fields' => [ 'id', 'name', 'amount' ], - - ### - # highly recommended - ### - - 'size' => [ 4, 12, 8 ], - 'maxl' => [ 4, 12, 8 ], - 'align' => [ 'right', 'left', 'right' ], - - ### - # optional - ### - - 'data' => [ [ 1, 'Widget', 25 ], - [ 12, 'Super Widget, 7 ] ], - #or - 'records' => [ qsearch('item', { } ) ], - # or any other array of FS::Record objects - - 'select' => [ '', - [ 1 => 'option 1', - 2 => 'option 2', ... - ], # options for second field - '' ], - - 'prefix' => 'mytable_', -) %> - -Values will be passed through as "mytable_id1", etc. -</%doc> - -<TABLE ID="<% $prefix %>AutoTable" BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0> - <TR> -% foreach (@header) { - <TH><% $_ %></TH> -% } - </TR> -% my $row = 0; -% for ( $row = 0; $row < scalar @data; $row++ ) { - <TR> -% my $col = 0; -% for ( $col = 0; $col < scalar @fields; $col++ ) { -% my $id = $prefix . $fields[$col] . $row; - <TD> -% my @o = @{ $select[$col] }; -% if( @o ) { - <SELECT NAME="<% $id %>" ID="<% $id %>"> -% while(@o) { -% my $val = shift @o; - <OPTION VALUE=<% $val %><% -$val eq $data[$row][$col] ? ' SELECTED' : ''%>><% shift @o %></OPTION> -% } - </SELECT> -% } -% else { - <INPUT TYPE = "text" - NAME = "<% $id %>" - ID = "<% $id %>" - SIZE = <% $size[$col] %> - MAXLENGTH = <% $maxl[$col] %> - STYLE = "text-align:<% $align[$col] %>" - VALUE = "<% $data[$row][$col] %>" -% if( $opt{'autoadd'} ) { - onchange = "possiblyAddRow(this);" -% } - > - </TD> -% } -% } - <TD> - <IMG SRC = "<% "${p}images/cross.png" %>" - ALT = "X" - onclick = "deleteRow(this);" - > - </TD> - </TR> -% } -</TABLE> -% if( !$opt{'autoadd'} ) { -<INPUT TYPE="button" VALUE="Add" onclick="<% $prefix %>addRow();"><BR> -% } - -<SCRIPT TYPE="text/javascript"> - var <% $prefix %>rownum = <% $row %>; - var <% $prefix %>table = document.getElementById('<% $prefix %>AutoTable'); - // last row is initially blank, clone it and remove it - var <% $prefix %>_blank = - <% $prefix %>table.rows[<% $prefix %>table.rows.length-1].cloneNode(true); -% if( !$opt{'autoadd'} ) { - <% $prefix %>table.deleteRow(<% $prefix %>table.rows.length-1); -% } - - - - function rownum_of(obj) { - return (obj.parentNode.parentNode.sectionRowIndex); - } - - function <% $prefix %>possiblyAddRow(obj) { - if ( <% $prefix %>rownum == rownum_of(obj) ) { - <% $prefix %>addRow(); - } - } - - function <% $prefix %>addRow() { - var row = <% $prefix %>table.insertRow(-1); - var cells = <% $prefix %>_blank.cells; - for (i=0; i<cells.length; i++) { - row.appendChild(cells[i].cloneNode(true)); - } - <% $prefix %>rownum++; - } - - function deleteRow(obj) { - if(<% $prefix %>rownum == rownum_of(obj)) { - <% $prefix %>addRow(); - } - <% $prefix %>table.deleteRow(rownum_of(obj)); - <% $prefix %>rownum--; - return(false); - } - -</SCRIPT> - -<%init> -my %opt = @_; - -my @header = @{ $opt{'header'} }; -my @fields = @{ $opt{'fields'} }; -my @data = (); -if($opt{'data'}) { - @data = @{ $opt{'data'} }; -} -elsif($opt{'records'}) { - foreach my $rec (@{ $opt{'records'} }) { - push @data, [ map { $rec->getfield($_) } @fields ]; - } -} -# else @data = (); -push @data, [ map {''} @fields ]; # make a blank row - -my $prefix = $opt{'prefix'}; -my @size = $opt{'size'} ? @{ $opt{'size'} } : (map {16} @fields); -my @maxl = $opt{'maxl'} ? @{ $opt{'maxl'} } : @size; -my @align = $opt{'align'} ? @{ $opt{'align'} } : (map {'right'} @fields); -my @select = @{ $opt{'select'} || [] }; -foreach (0..scalar(@fields)-1) { - $select[$_] ||= []; -} -</%init> diff --git a/httemplate/elements/bill.html b/httemplate/elements/bill.html deleted file mode 100644 index 64a1a6d2c..000000000 --- a/httemplate/elements/bill.html +++ /dev/null @@ -1,55 +0,0 @@ -<%doc> - -Clickable link to bill a customer. - -Example: -<% include( '/elements/bill.html', - ### - # required - ### - custnum => $custnum, - label => 'Bill Now!', - - ### - # recommended - ### - url => $p.'view/cust_main.cgi?'.$custnum, - - ### - # optional, can contain any FS::cust_main::bill_and_collect options - ### - bill_opts => { 'batch_card' => 'yes' }, - formname => 'MyBillNowLink', # if for some reason you want this -) %> - -</%doc> -<FORM NAME="<%$formname%>" STYLE="display:inline"> -<% include('/elements/progress-init.html', - $formname, - [ 'custnum', @opt_keys ], - $p.'misc/bill.cgi', - $url ? { url => $url } : { message => $message }, - $formname, # use it as 'key' -) %> -<A HREF="javascript:void(0);" onclick="javascript:<%$formname%>process();"><%$label%></A> -<INPUT TYPE="hidden" NAME="custnum" VALUE="<%$custnum%>"> -% foreach(@opt_keys) { -<INPUT TYPE="hidden" NAME="<%$_%>" VALUE="<%$bill_opts->{$_}%>"> -% } -</FORM> -<%init> - -my %opt = @_; -my $custnum = $opt{'custnum'}; -my $label = $opt{'label'}; -# formname no longer needs to be passed from outside, but we still -# need one and it needs to be unique -my $formname = $opt{'formname'} || - 'bill'.sprintf('%04d',int(rand(10000))).$custnum; -my $url = $opt{'url'} || ''; -my $message = $opt{'message'} || 'Finished!'; -my $bill_opts = $opt{'bill_opts'} || {}; -my @opt_keys = keys(%$bill_opts); -my @opt_vals = values(%$bill_opts); - -</%init> diff --git a/httemplate/elements/communigate_pro-accessmodes.html b/httemplate/elements/communigate_pro-accessmodes.html index b5fa53c37..6ce9ca587 100644 --- a/httemplate/elements/communigate_pro-accessmodes.html +++ b/httemplate/elements/communigate_pro-accessmodes.html @@ -11,11 +11,8 @@ my @names = (qw( Mail Relay Signal Mobile TLS POP IMAP MAPI AirSync SIP XMPP WebMail XIMSS FTP ACAP PWD LDAP RADIUS S/MIME WebCAL WebSite PBX HTTP - MobilePBX YMedia )); -#GIPS Media? - </%once> <%init> diff --git a/httemplate/elements/file-upload.html b/httemplate/elements/file-upload.html index 034eaec38..7e2eeefcd 100644 --- a/httemplate/elements/file-upload.html +++ b/httemplate/elements/file-upload.html @@ -54,15 +54,10 @@ <INPUT TYPE="hidden" NAME="upload_fields" VALUE="<% join(',', @field) %>" /> % foreach (@field) { -% if($param{'no_table'}) { - <% shift @label %> <INPUT TYPE="file" NAME="<% $_ %>" /> -% } -% else { <TR> <TH ALIGN="<% $param{'label_align'} || 'right' %>"><% shift @label %></TH> <TD><INPUT TYPE="file" NAME="<% $_ %>" /></TD> </TR> -% } % } <DIV STYLE="display:<% $param{debug} ? 'visible' : 'none' %>"> diff --git a/httemplate/elements/freeside.css b/httemplate/elements/freeside.css index dfb56e959..3816f9878 100644 --- a/httemplate/elements/freeside.css +++ b/httemplate/elements/freeside.css @@ -109,8 +109,6 @@ a.fstab { font-weight:bold; text-decoration:none; overflow:visible; - margin-left:6px; - margin-right:6px; } a.fstab:hover { text-decoration:none; @@ -121,12 +119,13 @@ a.fstab:hover { a:visited:hover.fsblackbutton */ a.fstabselected { - background-color:#ffffff; + background-color:#f8f8f8; color: #000000; - border-top:1px solid #7e0079; - border-left:1px solid #7e0079; - border-right:1px solid #7e0079; - border-bottom:1px solid #ffffff; + border:1px solid; + border-top-color:#7e0079; + border-left-color:#7e0079; + border-right-color:#7e0079; + border-bottom-color:#ffffff; -moz-border-radius-topleft:8px; -moz-border-radius-topright:8px; -webkit-border-radius-topleft:8px; @@ -142,37 +141,12 @@ a.fstabselected { font-weight:bold; text-decoration:none; overflow:visible; - margin-left:6px; - margin-right:6px; } a.fstabselected:hover { text-decoration:none; color: #000000; } -div.fstabs { - padding-left:8px; - border-bottom:1px solid #7e0079; -} - -div.fstabcontainer { - background-color:#ffffff; - padding:8px; - border-left:1px solid #7e0079; - border-right:1px solid #7e0079; - border-bottom:1px solid #7e0079; - -moz-border-radius-bottomleft:8px; - -moz-border-radius-bottomright:8px; - -webkit-border-radius-bottomleft:8px; - -webkit-border-radius-bottomright:8px; - border-radius-bottomleft:8px; - border-radius-bottomright:8px; - -moz-box-shadow: #666666 1px 1px 2px; - -webkit-box-shadow: #666666 1px 1px 2px; - box-shadow: #666666 1px 1px 2px; - filter: progid:DXImageTransform.Microsoft.Shadow(color='#666666', Direction=135, Strength=2); -} - .background { background-color:#f8f8f8; } diff --git a/httemplate/elements/header-popup.html b/httemplate/elements/header-popup.html index 2bd4a96e8..cd8da5657 100644 --- a/httemplate/elements/header-popup.html +++ b/httemplate/elements/header-popup.html @@ -1,21 +1,3 @@ -<%doc> - -Example: - - include( '/elements/header-popup.html', - { - 'title' => 'Title', - 'menubar' => \@menubar, - 'etc' => '', #included in <BODY> tag, for things like onLoad= - 'head' => '', #included before closing </HEAD> tag - 'nobr' => 0, #1 for no <BR><BR> after the title - } - ); - - #old-style - include( '/elements/header.html', 'Title', $menubar, $etc, $head); - -</%doc> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML> <HEAD> diff --git a/httemplate/elements/htmlarea.html b/httemplate/elements/htmlarea.html index f00c77360..dca4328ab 100644 --- a/httemplate/elements/htmlarea.html +++ b/httemplate/elements/htmlarea.html @@ -22,9 +22,6 @@ Example: oFCKeditor.BasePath = '<% $p %>elements/fckeditor/'; oFCKeditor.Config['SkinPath'] = '<% $p %>elements/fckeditor/editor/skins/silver/'; -% if ( $opt{'width'} ) { - oFCKeditor.Width = '<% $opt{'width'} %>'; -% } oFCKeditor.Height = '<% $opt{'height'} || 420 %>'; oFCKeditor.Config['StartupFocus'] = true; oFCKeditor.Config['EnterMode'] = 'br'; diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html index a5bcdeb19..2d28e49d4 100644 --- a/httemplate/elements/menu.html +++ b/httemplate/elements/menu.html @@ -215,7 +215,7 @@ $report_packages{'Advanced package reports'} = [ $fsurl.'search/report_cust_pkg tie my %report_inventory, 'Tie::IxHash', 'Inventory by agent' => [ $fsurl.'search/report_agent_inventory.html', '' ], - 'Inventory activity' => [ $fsurl.'search/report_h_inventory_item.html', '' ], + #'Inventory activity' => [ $fsurl.'search/report_h_inventory_item.html', '' ], ; tie my %report_rating, 'Tie::IxHash', @@ -357,8 +357,6 @@ $tools_menu{'Quick payment entry'} = [ $fsurl.'misc/batch-cust_pay.html', 'Ente $tools_menu{'Process payment batches'} = [ $fsurl.'search/pay_batch.cgi?magic=_date;open=1;intransit=1', 'Process credit card and electronic check batches' ] if ( $conf->exists('batch-enable') || $conf->config('batch-enable_payby') ) && $curuser->access_right('Process batches'); -$tools_menu{'Process invoice batches'} = [ $fsurl.'search/bill_batch.cgi' ] - if ( $conf->exists('invoice_print_pdf') ); $tools_menu{'Job Queue'} = [ $fsurl.'search/queue.html', 'View pending job queue' ] if $curuser->access_right('Job queue'); $tools_menu{'Ticketing'} = [ \%tools_ticketing, 'Ticketing tools' ] @@ -421,7 +419,6 @@ tie my %config_billing_rates, 'Tie::IxHash', 'Rate plans' => [ $fsurl.'browse/rate.cgi', 'Manage rate plans' ], 'Regions and prefixes' => [ $fsurl.'browse/rate_region.html', 'Manage regions and prefixes' ], 'Usage classes' => [ $fsurl.'browse/usage_class.html', 'Usage classes define groups of usage for taxation.' ], - 'Time periods' => [ $fsurl.'browse/rate_time.html', 'Time periods define days and hours for rate plans' ], 'Edit rates with Excel' => [ $fsurl.'misc/rate_edit_excel.html', 'Download and edit rates with Excel, then upload changes.' ], #"Edit with Excel" ? ; @@ -473,18 +470,12 @@ tie my %config_phone, 'Tie::IxHash', ; tie my %config_misc, 'Tie::IxHash'; -$config_misc{'Message templates'} = [ $fsurl.'browse/msg_template.html', 'Templates for customer notices' ] - if $curuser->access_right('Edit templates') - || $curuser->access_right('Edit global templates') - || $curuser->access_right('Configuration'); -$config_misc{'Tags'} = [ $fsurl.'browse/part_tag.html', '' ] - if $curuser->access_right('Configuration'); $config_misc{'Advertising sources'} = [ $fsurl.'browse/part_referral.html', 'Where a customer heard about your service.' ] if $curuser->access_right('Edit advertising sources') || $curuser->access_right('Edit global advertising sources'); if ( $curuser->access_right('Configuration') ) { $config_misc{'Virtual fields'} = [ $fsurl.'browse/part_virtual_field.cgi', 'Locally defined fields', ]; - $config_misc{'Error catalog'} = [ $fsurl.'browse/msgcat.cgi', 'Change error messages and other customizable labels' ]; + $config_misc{'Message catalog'} = [ $fsurl.'browse/msgcat.cgi', 'Change error messages and other customizable labels' ]; } $config_misc{'Inventory classes and inventory'} = [ $fsurl.'browse/inventory_class.html', 'Setup inventory classes and stock inventory' ] if $curuser->access_right('Edit inventory') @@ -522,8 +513,7 @@ $config_menu{'Broadband'} = [ \%config_broadband, '' ] $config_menu{'Phone'} = [ \%config_phone, '' ] if ( $curuser->access_right('Configuration') ); $config_menu{'Miscellaneous'} = [ \%config_misc, '' ] - if $curuser->access_right('Configuration' ) - || $curuser->access_right('Edit advertising sources') + if $curuser->access_right('Edit advertising sources') || $curuser->access_right('Edit global advertising sources'); diff --git a/httemplate/elements/menubar.html b/httemplate/elements/menubar.html index c14904337..fe49f7b2e 100644 --- a/httemplate/elements/menubar.html +++ b/httemplate/elements/menubar.html @@ -19,10 +19,10 @@ Example: </%doc> %if ( $opt->{'newstyle'} ) { +% my $s = '<FONT STYLE="border-bottom:1px solid #7e0079">'; - <DIV CLASS="fstabs"> - <% join('', @html ) %> - </DIV> + <% join("$s </FONT>", ( '', @html, '' ) ) %> + <BR> %} else { diff --git a/httemplate/elements/pickcolor.html b/httemplate/elements/pickcolor.html deleted file mode 100644 index d410ebfc7..000000000 --- a/httemplate/elements/pickcolor.html +++ /dev/null @@ -1,60 +0,0 @@ -<INPUT TYPE="hidden" NAME="<% $opt{'field'} %>" ID="<%$id%>" VALUE="<%$value%>"> -<TABLE BGCOLOR="#FFFFFF" ID="showcolor<%$unum%>"> -<TR> - <TD STYLE="border:1px solid blue;background-color:#<%$value%>" WIDTH=16 HEIGHT=16 ID="currcolor<%$unum%>"></TD> - <TD> <A HREF="javascript:void(0);" onClick="change_clicked<%$unum%>()">change</A></TD> -</TR> -</TABLE> -<TABLE BGCOLOR="#FFFFFF" ID="pickcolor<%$unum%>" STYLE="display:none"> -% for (1..$rows) { - <TR> -% for (1..$cols) { -% last unless @colors; -% my $color = shift(@colors); - <TD STYLE="border:1px solid blue;cursor:pointer;cursor:hand" BGCOLOR="#<% $color %>" WIDTH=16 HEIGHT=16 onClick="color_clicked<%$unum%>('<%$color%>')"></TD> -% } - </TR> -% } -</TABLE> -<SCRIPT TYPE="text/javascript"> - - function change_clicked<%$unum%>() { - document.getElementById('showcolor<%$unum%>').style.display = 'none'; - document.getElementById('pickcolor<%$unum%>').style.display = ''; - } - - function color_clicked<%$unum%>(color) { - document.getElementById('<%$id%>').value = color; //update hidden - if ( color == '' ) { color = 'ffffff'; } - document.getElementById('currcolor<%$unum%>').style.backgroundColor = '#' + color; - document.getElementById('showcolor<%$unum%>').style.display = ''; - document.getElementById('pickcolor<%$unum%>').style.display = 'none'; - } - -</SCRIPT> -<%init> - -my %opt = @_; - -my $value = length($opt{curr_value}) ? $opt{curr_value} : $opt{value}; - -my $unum = int(rand(100000)); - -my $id = $opt{'id'} || $opt{'field'}.$unum; - -my @colors = ( - '', #none/white - 'FF6666', #red - 'FF9966', #orange - 'FFFF66', #yellow - '66FF66', #green - '66FFFF', #cyan? - '6666FF', #blue - 'CC66FF', #purple? FF66FF looks more like pink. -); - -my $rows = 2; - -my $cols = int(.5+scalar(@colors)/$rows); - -</%init> diff --git a/httemplate/elements/progress-init.html b/httemplate/elements/progress-init.html index 8b8da66c8..194fc7480 100644 --- a/httemplate/elements/progress-init.html +++ b/httemplate/elements/progress-init.html @@ -1,45 +1,3 @@ -<%doc> -Example: -In misc/something.html: - - <FORM NAME="MyForm"> - <INPUT TYPE="hidden" NAME="recordnum" VALUE="42"> - <INPUT TYPE="hidden" NAME="what_to_do" VALUE="delete"> - <% include( '/elements/progress-init.html', - 'MyForm', - [ 'recordnum', 'what_to_do' ], - $p.'misc/process_something.html', - { url => $p.'where_to_go_next.html' }, - #or { message => 'Finished!' }, - ) %> - </FORM> - <SCRIPT TYPE="text/javascript>process();</SCRIPT> - -In misc/process_something.html: - -<%init> -my $server = FS::UI::Web::JSRPC->new('FS::something::process_whatever', $cgi); -</%init> -<% $server->process %> - -In FS/something.pm: - -sub process_whatever { #class method - my $job = shift; - my $param = thaw(base64_decode(shift)); - # param = { 'recordnum' => 42, 'what_to_do' => delete } - # make use of this as you like - do_phase1; - $job->update_statustext(20); - do_phase2; - $job->update_statustext(40); - do_phase3; - $job->update_statustext(60); - # etc. - return 'this value will be ignored'; -} - -</%doc> <% include('/elements/xmlhttp.html', 'method' => 'POST', 'url' => $action, diff --git a/httemplate/elements/progress-popup.html b/httemplate/elements/progress-popup.html index a29210201..8a55efb4a 100644 --- a/httemplate/elements/progress-popup.html +++ b/httemplate/elements/progress-popup.html @@ -69,14 +69,6 @@ function updateStatus( status_statustext ) { alert('job done but no url or message specified'); % } - } else if ( status.indexOf('done') > -1 ) { - - document.getElementById("progress_message").innerHTML = "Loading report"; - document.getElementById("progress_bar").innerHTML = ''; - document.getElementById("progress_percent").innerHTML = ''; - document.getElementById("progress_jobnum").innerHTML = ''; - window.top.location.href = statustext.substr(8, statustext.length-18); - } else if ( status.indexOf('error') > -1 ) { document.getElementById("progress_message").innerHTML = '<FONT SIZE="+1" COLOR="#FF0000">Error: ' + statustext + '</FONT>'; document.getElementById("progress_bar").innerHTML = ''; diff --git a/httemplate/elements/select-cgp_rule_condition.html b/httemplate/elements/select-cgp_rule_condition.html index bc96ab487..622cbe86d 100644 --- a/httemplate/elements/select-cgp_rule_condition.html +++ b/httemplate/elements/select-cgp_rule_condition.html @@ -3,10 +3,10 @@ <INPUT TYPE="hidden" NAME="<%$name%>" ID="<%$id%>" VALUE="<% $curr_value %>"> <% include( 'select.html', - 'field' => $name.'_conditionname', - 'id' => $id.'_conditionname', + 'field' => $name.'_condition', + 'id' => $id.'_condition', 'options' => \@conditions, - 'curr_value' => $conditionname, + 'curr_value' => $condition, 'labels' => { '' => 'Select Condition' }, 'onchange' => $name.'_changed', ) @@ -189,10 +189,10 @@ if ( $curr_value ) { $cgp_rule_condition = new FS::cgp_rule_condition {}; } -my $conditionname = scalar($cgi->param($name.'_conditionname')) - || $cgp_rule_condition->conditionname; +my $condition = scalar($cgi->param($name.'_condition')) + || $cgp_rule_condition->condition; -my @op = &$cond2op($conditionname); +my @op = &$cond2op($condition); my $disabled = scalar(@op) ? '' : 1; my $style = $disabled ? 'visibility:hidden' : ''; diff --git a/httemplate/elements/select-cust_tag.html b/httemplate/elements/select-cust_tag.html deleted file mode 100644 index 61d4dca3b..000000000 --- a/httemplate/elements/select-cust_tag.html +++ /dev/null @@ -1,20 +0,0 @@ -<% include( '/elements/select-table.html', - 'table' => 'part_tag', - 'name_col' => 'tagname', #tagname - tagdesc?? - 'multiple' => 1, - #'value' => $agentnum || '', - #'agent_virt' => 1, - 'hashref' => { 'disabled' => '' }, - 'order_by' => ' ORDER BY tagname', - %opt, - ) -%> -<%init> - -my %opt = @_; -#my $agentnum = $opt{'curr_value'} || $opt{'value'}; - -$opt{'records'} = delete $opt{'part_tag'} - if $opt{'part_tag'}; - -</%init> diff --git a/httemplate/elements/tr-htmlarea.html b/httemplate/elements/tr-htmlarea.html deleted file mode 100644 index 1a4e25080..000000000 --- a/httemplate/elements/tr-htmlarea.html +++ /dev/null @@ -1,25 +0,0 @@ -<% include('tr-td-label.html', @_ ) %> - - <TD <% $cell_style %>> - - <% include('htmlarea.html', @_ ) %> - - </TD> - -</TR> - -<%init> - -my %opt = @_; - -my $onchange = $opt{'onchange'} - ? 'onChange="'. $opt{'onchange'}. '(this)"' - : ''; - -#my $rows = $opt{'rows'} ? 'ROWS="'.$opt{'rows'}.'"' : ''; -#my $cols = $opt{'cols'} ? 'COLS="'.$opt{'cols'}.'"' : ''; - -my $cell_style = $opt{'cell_style'} ? 'STYLE="'. $opt{'cell_style'}. '"' : ''; -#my $curr_value = $opt{'curr_value'}; - -</%init> diff --git a/httemplate/elements/tr-pickcolor.html b/httemplate/elements/tr-pickcolor.html deleted file mode 100644 index 2b6cc23ca..000000000 --- a/httemplate/elements/tr-pickcolor.html +++ /dev/null @@ -1,11 +0,0 @@ -<% include('tr-td-label.html', @_ ) %> - <TD <% $colspan %> <% $cell_style %> ID="<% $opt{input_id} || $opt{id}.'_input0' %>"><% include('pickcolor.html', @_ ) %></TD> -<%init> - -my %opt = @_; - -my $cell_style = $opt{'cell_style'} ? 'STYLE="'. $opt{'cell_style'}. '"' : ''; - -my $colspan = $opt{'colspan'} ? 'COLSPAN="'.$opt{'colspan'}.'"' : ''; - -</%init> diff --git a/httemplate/elements/tr-select-agent.html b/httemplate/elements/tr-select-agent.html index 9f2f76a6c..fcfa9f300 100644 --- a/httemplate/elements/tr-select-agent.html +++ b/httemplate/elements/tr-select-agent.html @@ -1,27 +1,3 @@ -<%doc> - -Example: - - include( '/elements/tr-select-agent.html', - - #recommended to keep things "sticky" on errors - 'curr_value' => $curr_value, - - ## - # optional - ## - - 'label' => 'Agent for this thing', - 'empty_label' => 'Select agent', #override default - 'disable_empty' => 1, - - #set to 'None' or something to override default of showing all agents - #for employees w/ 'View customers of all agents' right - viewall_right => 'None', - - ); - -</%doc> % if ( scalar(@agents) == 1 ) { <INPUT TYPE="hidden" NAME="<% $opt{'field'} || 'agentnum' %>" VALUE="<% $agents[0]->agentnum %>"> @@ -50,11 +26,8 @@ Example: my %opt = @_; my $agentnum = $opt{'curr_value'} || $opt{'value'}; -my @agents = - $opt{'agents'} - ? @{ $opt{'agents'} } - : $FS::CurrentUser::CurrentUser->agents( - 'viewall_right' => $opt{'viewall_right'}, - ); +my @agents = $opt{'agents'} + ? @{ $opt{'agents'} } + : $FS::CurrentUser::CurrentUser->agents; </%init> diff --git a/httemplate/elements/tr-select-cust_tag.html b/httemplate/elements/tr-select-cust_tag.html deleted file mode 100644 index d88f3a894..000000000 --- a/httemplate/elements/tr-select-cust_tag.html +++ /dev/null @@ -1,46 +0,0 @@ -% if ( $curuser->access_right('Edit customer tags') && @part_tag ) { - - <TR> - <TD ALIGN="right"><% $opt{'label'} || 'Tags' %></TD> - <TD> - <% include( '/elements/select-cust_tag.html', - 'curr_value' => \@curr_tagnum, - 'part_tag' => \@part_tag, - %opt, - ) - %> - </TD> - </TR> - -% } else { - -% foreach my $tagnum (@curr_tagnum) { - <INPUT TYPE="hidden" NAME="tagnum" VALUE="<% $tagnum %>"> -% } - -% } -<%init> - -my $curuser = $FS::CurrentUser::CurrentUser; - -my %opt = @_; -my $cgi = $opt{'cgi'}; - -my @curr_tagnum = (); -if ( $cgi->param('error') ) { - @curr_tagnum = $cgi->param('tagnum'); -} elsif ( $opt{'custnum'} ) { - @curr_tagnum = map $_->tagnum, - qsearch('cust_tag', { 'custnum' => $opt{'custnum'} } ); -} - -my $extra_sql = "WHERE disabled IS NULL OR disabled = '' "; -$extra_sql .= ' OR tagnum IN ('. join(',', @curr_tagnum). ')' if @curr_tagnum; - -my @part_tag = qsearch({ - 'table' => 'part_tag', - 'hashref' => {}, - 'extra_sql' => $extra_sql, -}); - -</%init> diff --git a/httemplate/graph/cust_bill_pkg.cgi b/httemplate/graph/cust_bill_pkg.cgi index 03e29b901..1fad5e1cd 100644 --- a/httemplate/graph/cust_bill_pkg.cgi +++ b/httemplate/graph/cust_bill_pkg.cgi @@ -19,7 +19,7 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Financial reports'); -my $link = "${p}search/cust_bill_pkg.cgi?nottax=1"; +my $link = "${p}search/cust_bill_pkg.cgi?nottax=1;include_comp_cust=1"; my $bottom_link = "$link;"; my $use_override = $cgi->param('use_override') ? 1 : 0; diff --git a/httemplate/images/square.png b/httemplate/images/square.png Binary files differdeleted file mode 100644 index 4998e349e..000000000 --- a/httemplate/images/square.png +++ /dev/null diff --git a/httemplate/images/square_add.png b/httemplate/images/square_add.png Binary files differdeleted file mode 100644 index d1da175fd..000000000 --- a/httemplate/images/square_add.png +++ /dev/null diff --git a/httemplate/index.html b/httemplate/index.html index 5b550dba7..c813991f9 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -2,8 +2,6 @@ <% include('/elements/header.html', 'Billing Main' ) %> -<% include('/elements/dashboard-install_welcome.html') %> - <% include('/elements/dashboard-toplist.html') %> % my $sth = dbh->prepare( diff --git a/httemplate/misc/bill.cgi b/httemplate/misc/bill.cgi index 2bc43d7b3..6151dce51 100755 --- a/httemplate/misc/bill.cgi +++ b/httemplate/misc/bill.cgi @@ -1,8 +1,38 @@ -<% $server->process %> +%if ( $error ) { +% errorpage($error); +%} else { +<% $cgi->redirect(popurl(2). "view/cust_main.cgi?$custnum") %> +%} <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Bill customer now'); -my $server = FS::UI::Web::JSRPC->new('FS::cust_main::process_bill_and_collect', $cgi); -</%init> +#untaint custnum +my($query) = $cgi->keywords; +$query =~ /^(\d*)$/; +my $custnum = $1; +my $cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); +die "Can't find customer!\n" unless $cust_main; + +my $conf = new FS::Conf; + +my $error = $cust_main->bill_and_collect( 'fatal' => 'return', + 'retry' => 'yes', + ); + + #'invoice-time'=>$time, + #'batch_card'=> 'yes', + #'batch_card'=> 'no', + #'report_badcard'=> 'yes', + #'retry_card' => 'yes', + + #this is used only by cust_main::batch_card + #need to pick & create an actual config + #value if we're going to turn this on + #("realtime-backend" doesn't exist, + # "backend-realtime" is for something + # entirely different) + #'realtime' => $conf->exists('realtime-backend'), + +</%init> diff --git a/httemplate/misc/cdr-post.cgi b/httemplate/misc/cdr-post.cgi deleted file mode 100644 index 541dac3e3..000000000 --- a/httemplate/misc/cdr-post.cgi +++ /dev/null @@ -1,58 +0,0 @@ -% if ( $error ) { -0,"<% $error %>",, -% } else { -1,"CDR import successful",<% $cdr_batch->cdrbatchnum %>,"<% $cdrbatch %>" -% } -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Import'); - -my $error = ''; -my $cdr_batch; -my $cdrbatch = ''; - -{ - - my $filename = $cgi->param('cdr_file'); - unless ( $filename ) { - $error = "No cdr_file filename"; - last; - } - - my $fh = $cgi->upload('cdr_file'); - unless ( defined($fh) ) { - $error = 'No cdr_file file'; - last; - } - - #i should probably be transactionalized. - - my $csv = new Text::CSV_XS or die Text::CSV->error_diag; - - $cdrbatch = time2str('post-%Y/%m/%d-%T'. "-$$-". rand() * 2**32, time); - $cdr_batch = new FS::cdr_batch { 'cdrbatch' => $cdrbatch }; - $error = $cdr_batch->insert and last; - - chomp(my $hline = scalar(<$fh>)); - $csv->parse($hline); - my @header = $csv->fields; - - #while ( my $row = $csv->getline($fh) ) { - while (<$fh>) { - - $csv->parse($_); - my @row = $csv->fields; - - my $cdr = new FS::cdr { 'cdrbatchnum' => $cdr_batch->cdrbatchnum }; - $cdr->set( lc($_) => shift(@row) ) foreach @header; - - $error = $cdr->insert and last; - - } - -} - -$error =~ s/"/""/g; #CSV - -</%init> diff --git a/httemplate/misc/cdr-post.html b/httemplate/misc/cdr-post.html deleted file mode 100644 index 5d34272f7..000000000 --- a/httemplate/misc/cdr-post.html +++ /dev/null @@ -1,11 +0,0 @@ -<% include("/elements/header.html",'Call Detail Record - POST Import') %> - -<FORM METHOD="POST" ACTION="cdr-post.cgi" enctype="multipart/form-data"> - - cdr_file: <INPUT TYPE="file" NAME="cdr_file"><BR><BR> - - <INPUT TYPE="submit" VALUE="upload"> - -</FORM> - -<% include("/elements/footer.html") %> diff --git a/httemplate/misc/clone-cgp_rule.html b/httemplate/misc/clone-cgp_rule.html deleted file mode 100644 index d821a2dff..000000000 --- a/httemplate/misc/clone-cgp_rule.html +++ /dev/null @@ -1,27 +0,0 @@ -% if ( $error ) { -% errorpage($error); -% } else { -<% $cgi->redirect($p. "browse/cgp_rule.html?svcnum=". $svcnum) %> -% } -<%init> - -# :/ needs agent-virt so you can't futz with arbitrary rules - -#die "access denied" -# unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); - -#untaint svcnum and clone -$cgi->param('svcnum') =~ /^(\d+)$/ || die "Illegal svcnum"; -my $svcnum = $1; -$cgi->param('clone') =~ /^(\d+)$/ || die "Illegal clone"; -my $clone = $1; - -my @cgp_rule = qsearch('cgp_rule', { 'svcnum' => $clone } ); - -my $error = ''; -foreach my $cgp_rule ( @cgp_rule ) { - $error = $cgp_rule->clone( $svcnum ); - last if $error; -} - -</%init> diff --git a/httemplate/misc/delete-cgp_rule.html b/httemplate/misc/delete-cgp_rule.html index 0415bc9dd..a2ba2dbc9 100644 --- a/httemplate/misc/delete-cgp_rule.html +++ b/httemplate/misc/delete-cgp_rule.html @@ -10,7 +10,7 @@ #die "access denied" # unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); -#untaint rulenum +#untaint devicenum my($query) = $cgi->keywords; $query =~ /^(\d+)$/ || die "Illegal rulenum"; my $rulenum = $1; diff --git a/httemplate/misc/delete-rate_detail.html b/httemplate/misc/delete-rate_detail.html deleted file mode 100755 index 30856a73a..000000000 --- a/httemplate/misc/delete-rate_detail.html +++ /dev/null @@ -1,20 +0,0 @@ -% if ( $error ) { -% errorpage($error); -% } else { -<% header('Rate deleted') %> - <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); - </SCRIPT> - </BODY></HTML> -% } -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); - -my ($query) = $cgi->keywords; -$query =~ /^(\d+)$/ or die "Illegal ratedetailnum"; -my $rate_detail = FS::rate_detail->by_key($1); -my $error = $rate_detail->delete; - -</%init> diff --git a/httemplate/misc/inventory_item-import.html b/httemplate/misc/inventory_item-import.html index d264bafc5..990c14ffc 100644 --- a/httemplate/misc/inventory_item-import.html +++ b/httemplate/misc/inventory_item-import.html @@ -24,10 +24,7 @@ Import a file containing <% PL($inventory_class->classname) %>, one per line. %# <INPUT TYPE="hidden" NAME="itembatch" VALUE="<% $itembatch %>"> - <% include('/elements/tr-select-agent.html', - 'viewall_right' => 'None', - ) - %> + <% include('/elements/tr-select-agent.html') %> <% include( '/elements/file-upload.html', 'field' => 'file', diff --git a/httemplate/misc/maestro-customer_status-test.html b/httemplate/misc/maestro-customer_status-test.html deleted file mode 100644 index 006492919..000000000 --- a/httemplate/misc/maestro-customer_status-test.html +++ /dev/null @@ -1,34 +0,0 @@ -<% include('/elements/header.html', { - 'title' => "Customer $custnum status", - }) %> - -<% include('/elements/small_custview.html', $custnum, '', 1) %> -<BR> - -<table style="border:1px solid #000000"> -% foreach my $key (keys %$return) { -% my $value = $return->{$key}; -% $value = join(', ', @$value) if ref($value) eq 'ARRAY'; - <TR> - <TD ALIGN="right"><% $key %>:</TD> - <TD><B><% $value %></B></TD> - </TR> -% } -</table> - -<% include('/elements/footer.html') %> -<%init> - -my $return; - -my($custnum, $svcnum) = $cgi->keywords; -if ( $custnum =~ /^(\d+)$/ ) { - - use FS::Maestro; - $return = FS::Maestro::customer_status($1, $svcnum); - -} else { - $return = { 'error' => 'No custnum' }; -} - -</%init> diff --git a/httemplate/misc/maestro-customer_status.cgi b/httemplate/misc/maestro-customer_status.cgi deleted file mode 100644 index ffeb53c91..000000000 --- a/httemplate/misc/maestro-customer_status.cgi +++ /dev/null @@ -1,16 +0,0 @@ -<% $uri->query %> -<%init> - -my $uri = new URI; - -my($custnum, $svcnum) = $cgi->keywords; -if ( $custnum =~ /^(\d+)$/ ) { - - use FS::Maestro; - $uri->query_form( FS::Maestro::customer_status($1) ); - -} else { - $uri->query_form( { 'error' => 'No custnum' } ); -} - -</%init> diff --git a/httemplate/misc/maestro-customer_status.html b/httemplate/misc/maestro-customer_status.html deleted file mode 100644 index 8acae2b2a..000000000 --- a/httemplate/misc/maestro-customer_status.html +++ /dev/null @@ -1,16 +0,0 @@ -<% objToJson( $return ) %> -<%init> - -my $return; - -my($custnum, $svcnum) = $cgi->keywords; -if ( $custnum =~ /^(\d+)$/ ) { - - use FS::Maestro; - $return = FS::Maestro::customer_status($1, $svcnum); - -} else { - $return = { 'error' => 'No custnum' }; -} - -</%init> diff --git a/httemplate/misc/process/bill_batch-print.html b/httemplate/misc/process/bill_batch-print.html deleted file mode 100644 index 54d639eeb..000000000 --- a/httemplate/misc/process/bill_batch-print.html +++ /dev/null @@ -1,5 +0,0 @@ -% die "access denied" -% unless $FS::CurrentUser::CurrentUser->access_right('View invoices'); -% my $server = FS::UI::Web::JSRPC->new('FS::bill_batch::process_print_pdf', $cgi); -<% $server->process %> -<%init></%init> diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi index 665001ea9..906c99663 100644 --- a/httemplate/misc/process/payment.cgi +++ b/httemplate/misc/process/payment.cgi @@ -96,10 +96,8 @@ if ( $payby eq 'CHEK' ) { $payinfo = $1; validate($payinfo) or errorpage(gettext('invalid_card')); # . ": ". $self->payinfo; - errorpage(gettext('unknown_card_type')) - if $payinfo !~ /^99\d{14}$/ #token - && cardtype($payinfo) eq "Unknown"; + if $payinfo !~ /^99\d{14}$/ && cardtype($payinfo) eq "Unknown"; if ( defined $cust_main->dbdef_table->column('paycvv') ) { if ( length($cgi->param('paycvv') ) ) { diff --git a/httemplate/misc/process/recharge_svc.html b/httemplate/misc/process/recharge_svc.html index b56f8a282..5f68bf151 100755 --- a/httemplate/misc/process/recharge_svc.html +++ b/httemplate/misc/process/recharge_svc.html @@ -62,7 +62,6 @@ unless ($error) { $error = $cust_main->charge($amount, "Recharge " . $svc_acct->label, $description, $part_pkg->taxclass); - $error ||= "invalid $_" foreach grep { $rhash{$_} !~ /^\d*$/ } keys %rhash; if ($part_pkg->option('recharge_reset', 1)) { $error ||= $svc_acct->set_usage(\%rhash, 'null' => 1); }else{ diff --git a/httemplate/misc/upload-batch.cgi b/httemplate/misc/upload-batch.cgi index be80b1ff7..d1a84fd02 100644 --- a/httemplate/misc/upload-batch.cgi +++ b/httemplate/misc/upload-batch.cgi @@ -1,10 +1,36 @@ -<% $server->process %> +% if ( $error ) { +% errorpage($error); +% } else { + <% include('/elements/header.html','Batch results upload successful') %> + <% include('/elements/footer.html') %> +% } <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Process batches'); -my $server = - new FS::UI::Web::JSRPC 'FS::pay_batch::process_import_results', $cgi; +my $error; + +my $fh = $cgi->upload('batch_results'); +$error = 'No file uploaded' unless defined($fh); + +unless ( $error ) { + + $cgi->param('batchnum') =~ /^(\d+)$/; + my $batchnum = $1; + + my $pay_batch = qsearchs( 'pay_batch', { 'batchnum' => $batchnum } ); + if ( ! $pay_batch ) { + $error = "batchnum $batchnum not found"; + } elsif ( $pay_batch->status ne 'I' ) { + $error = "batch $batchnum is not in transit"; + } else { + $error = $pay_batch->import_results( + 'filehandle' => $fh, + 'format' => $cgi->param('format'), + ); + } + +} </%init> diff --git a/httemplate/misc/xmlrpc.cgi b/httemplate/misc/xmlrpc.cgi index 14bf9ef92..1d0383f2a 100644 --- a/httemplate/misc/xmlrpc.cgi +++ b/httemplate/misc/xmlrpc.cgi @@ -1,16 +1,18 @@ -<% $response_xml %>\ -<%init> +% +% +% my $request_xml = $cgi->param('POSTDATA'); +% +% #$r->log_error($request_xml); +% +% my $fsxmlrpc = new FS::XMLRPC; +% my ($error, $response_xml) = $fsxmlrpc->serve($request_xml); +% +% #$r->log_error($error) if $error; +% +% http_header('Content-Type' => 'text/xml', +% 'Content-Length' => length($response_xml)); +% +% print $response_xml; +% +% -my $request_xml = $cgi->param('POSTDATA'); - -#warn $request_xml; - -my $fsxmlrpc = new FS::XMLRPC; -my ($error, $response_xml) = $fsxmlrpc->serve($request_xml); - -#warn $error; - -http_header('Content-Type' => 'text/xml', - 'Content-Length' => length($response_xml)); - -</%init> diff --git a/httemplate/pref/pref-process.html b/httemplate/pref/pref-process.html index a340b7fc9..47f80afd0 100644 --- a/httemplate/pref/pref-process.html +++ b/httemplate/pref/pref-process.html @@ -7,11 +7,6 @@ % } <%init> -if ( FS::Conf->new->exists('disable_acl_changes') ) { - errorpage("Preference changes disabled in public demo"); - die "shouldn't be reached"; -} - my $error = ''; my $access_user = ''; diff --git a/httemplate/search/477.html b/httemplate/search/477.html index 63eab7ac8..bd7fb2d8b 100755 --- a/httemplate/search/477.html +++ b/httemplate/search/477.html @@ -43,7 +43,7 @@ % if ( $part eq 'IA' ) { % for ( my $tech = 0; $tech < scalar(@technology_option); $tech++ ) { % next unless $technology_option[$tech]; -% my $url = &{$url_mangler}($part); +% my $url = &{$url_mangler}($cgi->self_url, $part); % if ( $type eq 'xml' ) { <<% 'Part_IA_'. chr(65 + $tech) %>> % } @@ -57,7 +57,7 @@ % if ( $type eq 'xml' ) { <<% 'Part_'. uc($part) %>> % } -% my $url = &{$url_mangler}($part); +% my $url = &{$url_mangler}($cgi->self_url, $part); <% include( "477part${part}.html", 'url' => $url ) %> % if ( $type eq 'xml' ) { </<% 'Part_'. uc($part) %>> @@ -83,8 +83,7 @@ my $type = $cgi->param('_type') || 'html'; my $xlsname = '477report'; my @technology_option = &FS::Report::FCC_477::parse_technology_option($cgi); my $url_mangler = sub { - my $part = shift; - my $url = $cgi->url('-path_info' => 1, '-full' => 1); + my ($url, $part) = (shift, shift); $url =~ s/477\./477part$part./; $url; }; diff --git a/httemplate/search/477partV.html b/httemplate/search/477partV.html index 885294d28..c6ceac4db 100755 --- a/httemplate/search/477partV.html +++ b/httemplate/search/477partV.html @@ -9,7 +9,7 @@ 'xml_elements' => [ 'zip codes' ], 'no_field_elements' => 1, 'fields' => [ 'zip' ], - 'url' => $opt{url} || '', + 'url' => $opt{url} || $cgi->self_url, ) %> diff --git a/httemplate/search/477partVI.html b/httemplate/search/477partVI.html index db572bcde..dbd17032c 100755 --- a/httemplate/search/477partVI.html +++ b/httemplate/search/477partVI.html @@ -47,7 +47,7 @@ [ $link, $link_suffix ], [ $link, $link_suffix ], ], - 'url' => $opt{url} || '', + 'url' => $opt{url} || $cgi->self_url, 'xml_row_element' => 'Datarow', ) %> diff --git a/httemplate/search/bill_batch.cgi b/httemplate/search/bill_batch.cgi deleted file mode 100755 index e5abc8955..000000000 --- a/httemplate/search/bill_batch.cgi +++ /dev/null @@ -1,65 +0,0 @@ -<% include( 'elements/search.html', - 'title' => 'Invoice Batches', - 'name_singular' => 'batch', - 'query' => { 'table' => 'bill_batch', - 'hashref' => $hashref, - 'extra_sql' => $extra_sql. - 'ORDER BY batchnum DESC', - }, - 'count_query' => "$count_query $extra_sql", - 'header' => [ 'Batch', - 'Item Count', - 'Status', - '', - ], - 'align' => 'rrcc', - 'fields' => [ 'batchnum', - sub { - my $st = "SELECT COUNT(*) from cust_bill_batch WHERE batchnum=" . shift->batchnum; - my $sth = dbh->prepare($st) - or die dbh->errstr. "doing $st"; - $sth->execute - or die "Error executing \"$st\": ". $sth->errstr; - $sth->fetchrow_arrayref->[0]; - }, - sub { - $statusmap{shift->status}; - }, - sub { shift->status eq 'O' ? - 'Download and close' : 'Download' - }, - ], - 'links' => [ - $link, - $link, - $link, - $dlink, - ], - 'style' => [ - '', - '', - '', - sub { shift->status eq 'O' ? "b" : '' }, - ], - 'really_disable_download' => 1, - ) - -%> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('View invoices'); - -my %statusmap = ('O'=>'Open', 'R'=>'Closed'); -my $hashref = {}; -my $count_query = 'SELECT COUNT(*) FROM bill_batch'; - -my $extra_sql = ''; # may add something here later -my $link = [ "${p}view/bill_batch.cgi?batchnum=", 'batchnum' ]; -my $dlink = sub { - [ "${p}view/bill_batch.cgi?magic=print;". - (shift->status eq 'O' ? 'close=1;' : ''). - 'batchnum=', - 'batchnum'] -}; -</%init> diff --git a/httemplate/search/cdr.html b/httemplate/search/cdr.html index a5575967c..6b38d3ba7 100644 --- a/httemplate/search/cdr.html +++ b/httemplate/search/cdr.html @@ -126,7 +126,7 @@ foreach my $param ( grep /^termpart\d+status$/, $cgi->param ) { $search = "NOT EXISTS ( SELECT 1 FROM cdr_termination WHERE $where_term )"; - } elsif ( $status =~ /^([\w ]+)$/ ) { + } elsif ( $cgi->param('freesidestatus') =~ /^([\w ]+)$/ ) { #false lazienss w/cdr_termination.pm (i should be a part_termination method) my $where_term = diff --git a/httemplate/search/cust_bill_pkg.cgi b/httemplate/search/cust_bill_pkg.cgi index 98a1da9d9..77901de87 100644 --- a/httemplate/search/cust_bill_pkg.cgi +++ b/httemplate/search/cust_bill_pkg.cgi @@ -139,6 +139,9 @@ my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi); push @where, "_date >= $beginning", "_date <= $ending"; +push @where , " payby != 'COMP' " + unless $cgi->param('include_comp_cust'); + if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) { push @where, "cust_main.agentnum = $1"; } diff --git a/httemplate/search/cust_credit_bill_pkg.html b/httemplate/search/cust_credit_bill_pkg.html index 0f7834446..52e0ac6fe 100644 --- a/httemplate/search/cust_credit_bill_pkg.html +++ b/httemplate/search/cust_credit_bill_pkg.html @@ -92,6 +92,9 @@ my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi); push @where, "cust_bill._date >= $beginning", "cust_bill._date <= $ending"; +push @where , " payby != 'COMP' " + unless $cgi->param('include_comp_cust'); + if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) { push @where, "cust_main.agentnum = $1"; } diff --git a/httemplate/search/cust_pay_batch.cgi b/httemplate/search/cust_pay_batch.cgi index 825d21c8a..7376e9dcb 100755 --- a/httemplate/search/cust_pay_batch.cgi +++ b/httemplate/search/cust_pay_batch.cgi @@ -124,7 +124,7 @@ $sql_query = "SELECT paybatchnum,invnum,custnum,cpb.last,cpb.first," . 'LEFT JOIN pay_batch USING ( batchnum ) ' . "$search ORDER BY $orderby"; -my $html_init = '<TABLE>'; +my $html_init = ''; if ( $pay_batch ) { my $fixed = $conf->config('batch-fixed_format-'. $pay_batch->payby); if ( @@ -136,12 +136,11 @@ if ( $pay_batch ) { && $FS::CurrentUser::CurrentUser->access_right('Redownload resolved batches') ) ) { - $html_init .= qq!<TR><FORM ACTION="$p/misc/download-batch.cgi" METHOD="POST">!; + $html_init .= qq!<FORM ACTION="$p/misc/download-batch.cgi" METHOD="POST">!; if ( $fixed ) { $html_init .= qq!<INPUT TYPE="hidden" NAME="format" VALUE="$fixed">!; } else { - $html_init .= qq!Download batch in format !. - qq!<SELECT NAME="format">!. + $html_init .= qq!Download batch in format <SELECT NAME="format">!. qq!<OPTION VALUE="">Default batch mode</OPTION>!. qq!<OPTION VALUE="csv-td_canada_trust-merchant_pc_batch">CSV file for TD Canada Trust Merchant PC Batch</OPTION>!. qq!<OPTION VALUE="csv-chase_canada-E-xactBatch">CSV file for Chase Canada E-xactBatch</OPTION>!. @@ -152,7 +151,7 @@ if ( $pay_batch ) { qq!<OPTION VALUE="RBC">Royal Bank of Canada PDS</OPTION>!. qq!</SELECT>!; } - $html_init .= qq!<INPUT TYPE="hidden" NAME="batchnum" VALUE="$batchnum"><INPUT TYPE="submit" VALUE="Download"></FORM><BR><BR></TR>!; + $html_init .= qq!<INPUT TYPE="hidden" NAME="batchnum" VALUE="$batchnum"><INPUT TYPE="submit" VALUE="Download"></FORM><BR>!; } if ( @@ -161,28 +160,13 @@ if ( $pay_batch ) { && $FS::CurrentUser::CurrentUser->access_right('Reprocess batches') ) ) { - $html_init .= '<TR>'. - include('/elements/form-file_upload.html', - 'name' => 'FileUpload', - 'action' => "$p/misc/upload-batch.cgi", - 'num_files' => 1, - 'fields' => [ 'batchnum', 'format' ], - 'message' => 'Batch results uploaded.', - ) . - 'Upload results<BR></TR><TR>'. - include('/elements/file-upload.html', - 'field' => 'file', - 'label' => 'Filename', - 'no_table'=> 1 - ). - '<BR></TR>' - ; + $html_init .= qq!<FORM ACTION="$p/misc/upload-batch.cgi" METHOD="POST" ENCTYPE="multipart/form-data">!. + qq!Upload results<BR>!. + qq!Filename <INPUT TYPE="file" NAME="batch_results"><BR>!; if ( $fixed ) { $html_init .= qq!<INPUT TYPE="hidden" NAME="format" VALUE="$fixed">!; } else { - # should pull this from %import_info - $html_init .= qq!<TR>Format !. - qq!<SELECT NAME="format">!. + $html_init .= qq!Format <SELECT NAME="format">!. qq!<OPTION VALUE="">Default batch mode</OPTION>!. qq!<OPTION VALUE="csv-td_canada_trust-merchant_pc_batch">CSV results from TD Canada Trust Merchant PC Batch</OPTION>!. qq!<OPTION VALUE="csv-chase_canada-E-xactBatch">CSV file for Chase Canada E-xactBatch</OPTION>!. @@ -191,12 +175,12 @@ if ( $pay_batch ) { qq!<OPTION VALUE="ach-spiritone">Spiritone ACH batch</OPTION>!. qq!<OPTION VALUE="paymentech">Chase Paymentech XML</OPTION>!. qq!<OPTION VALUE="RBC">Royal Bank of Canada PDS</OPTION>!. - qq!</SELECT><BR></TR>!; + qq!</SELECT><BR>!; } $html_init .= qq!<INPUT TYPE="hidden" NAME="batchnum" VALUE="$batchnum">!; - $html_init .= '<TR> <INPUT TYPE="submit" VALUE="Upload"></FORM><BR> </TR>'; + $html_init .= '<INPUT TYPE="submit" VALUE="Upload"></FORM><BR>'; } - $html_init .= '</TABLE>' + } if ($pay_batch) { diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index 74a3a6d1e..adbec7a74 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -80,18 +80,6 @@ # '</table>'; # }, sub { - my $cust_pkg = shift; - my $type = $cgi->param('_type') || ''; - if ($type =~ /xls|csv/) { - my $cust_svc = $cust_pkg->primary_cust_svc; - if($cust_svc) { - return join ": ",($cust_svc->label)[0,1]; - } - else { - return ''; - } - } - else { [ map { [ { 'data' => $_->[0]. ':', @@ -103,10 +91,9 @@ $_->[2]. '.cgi?'. $_->[3], }, ]; - } $cust_pkg->labels + } shift->labels ]; - } - } + }, ], 'color' => [ '', diff --git a/httemplate/search/elements/cust_main_dayranges.html b/httemplate/search/elements/cust_main_dayranges.html index 9b8b08f47..c53e68016 100644 --- a/httemplate/search/elements/cust_main_dayranges.html +++ b/httemplate/search/elements/cust_main_dayranges.html @@ -11,7 +11,6 @@ Example: my( $start, $end ) = @_; "SQL EXPRESSION BASED ON $start AND $end"; - # where $start and $end are unix timestamps }; </%doc> @@ -146,7 +145,7 @@ unless ( $cgi->param('all_customers') ) { } push @where, - call_range_sub($range_sub, $days, 0, 'offset' => $offset, 'no_as'=>1). ' > 0'; # != 0'; + call_range_sub($range_sub, $days + $offset, 0, 'no_as'=>1). ' > 0'; # != 0'; } if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) { @@ -249,25 +248,11 @@ my $money_char = $conf->config('money_char') || '$'; # ) sub call_range_sub { - my($range_sub, $startdays, $enddays, %opt) = @_; + my($range_sub, $start, $end, %opt) = @_; - my $as = $opt{'no_as'} ? '' : " AS rangecol_${startdays}_$enddays"; + my $as = $opt{'no_as'} ? '' : " AS rangecol_${start}_$end"; - my $offset = $opt{'offset'} || 0; - # Always use $offset - 1day + 1sec = the last second of that day - my $cutoff = DateTime->now->set(hour => 23, minute => 59, second => 59); - $cutoff->subtract(days => $offset); - - my $start = $cutoff->clone; - $start->subtract(days => $startdays); - - my $end = $cutoff->clone; - $end->subtract(days => $enddays); - - #warn "offset $offset (".$cutoff->epoch."), range $startdays-$enddays (".$start->epoch . '-' . ($enddays ? $end->epoch : '').")\n"; - my $sql = &{$range_sub}( $start->epoch, - $enddays ? $end->epoch : '', - $cutoff->epoch ); #%opt? + my $sql = &{$range_sub}( $start, $end, $opt{'offset'} ); #%opt? $sql = "SUM($sql)" if $opt{'sum'}; diff --git a/httemplate/search/elements/search-html.html b/httemplate/search/elements/search-html.html index 98f9c4476..e5e6ca954 100644 --- a/httemplate/search/elements/search-html.html +++ b/httemplate/search/elements/search-html.html @@ -1,3 +1,4 @@ +% % if ( exists($opt{'redirect'}) && $opt{'redirect'} % && scalar(@$rows) == 1 && $total == 1 % && $type ne 'html-print' @@ -102,7 +103,7 @@ % $cgi->delete('maxrecords'); % $cgi->param('_dummy', 1); - ( show <SELECT NAME="maxrecords" onChange="window.location = '<% "$self_url?". $cgi->query_string %>;maxrecords=' + this.options[this.selectedIndex].value;"> + ( show <SELECT NAME="maxrecords" onChange="window.location = '<% $self_url %>;maxrecords=' + this.options[this.selectedIndex].value;"> % foreach my $max ( map { $_ * $confmax } qw( 1 5 10 25 ) ) { <OPTION VALUE="<% $max %>" <% ( $maxrecords == $max ) ? 'SELECTED' : '' %>><% $max %></OPTION> @@ -143,18 +144,18 @@ Download full results<BR> % $cgi->param('_type', "$xlsname.xls" ); - as <A HREF="<% "$self_url?". $cgi->query_string %>">Excel spreadsheet</A><BR> + as <A HREF="<% $self_url %>">Excel spreadsheet</A><BR> % $cgi->param('_type', 'csv'); - as <A HREF="<% "$self_url?". $cgi->query_string %>">CSV file</A><BR> + as <A HREF="<% $self_url %>">CSV file</A><BR> % if ( defined($opt{xml_elements}) ) { % $cgi->param('_type', 'xml'); - as <A HREF="<% "$self_url?". $cgi->query_string %>">XML file</A><BR> + as <A HREF="<% $self_url %>">XML file</A><BR> % } % $cgi->param('_type', 'html-print'); - as <A HREF="<% "$self_url?". $cgi->query_string %>">printable copy</A> + as <A HREF="<% $self_url %>">printable copy</A> </TD> % $cgi->param('_type', "html" ); @@ -464,7 +465,7 @@ my $confmax = $args{'confmax'}; my $maxrecords = $args{'maxrecords'}; my $offset = $args{'offset'}; my %opt = %{ $args{'opt'} }; -my $self_url = $opt{'url'} || $cgi->url('-path_info' => 1, '-full' =>1); +my $self_url = $opt{'url'} || $cgi->self_url; my $count_sth = dbh->prepare($opt{'count_query'}) or die "Error preparing $opt{'count_query'}: ". dbh->errstr; diff --git a/httemplate/search/elements/search.html b/httemplate/search/elements/search.html index 218816938..a258f1721 100644 --- a/httemplate/search/elements/search.html +++ b/httemplate/search/elements/search.html @@ -335,7 +335,7 @@ if ( $opt{'disableable'} ) { my $limit = ''; my($confmax, $maxrecords, $offset ); -unless ( $type =~ /^(csv|\w*.xls)$/) { +if ( !$type =~ /^(csv|\w*.xls)$/) { # html mode unless (exists($opt{count_query}) && length($opt{count_query})) { ( $opt{count_query} = $opt{query} ) =~ diff --git a/httemplate/search/h_inventory_item.html b/httemplate/search/h_inventory_item.html deleted file mode 100644 index b0f9b8aa8..000000000 --- a/httemplate/search/h_inventory_item.html +++ /dev/null @@ -1,135 +0,0 @@ -<% include('/elements/header.html', "$classname Inventory Activity Report") %> -<% include('/elements/table-grid.html') %> - <TR> -% my $TH = 'TH CLASS="grid" BGCOLOR="#cccccc" ROWSPAN=1'; - <<%$TH%> WIDTH="10%" ALIGN="left">Day (<% time2str("%B %Y", $sdate) %>)</TH> -% foreach my $day (0..$numdays-1) { - <<%$TH%> WIDTH="2%" ALIGN="right"><% $day+1 %></TH> -% } - </TR> -% for (my $r=0; $r < scalar(@rows); $r++) { - <TR> -% my $TD = 'TD CLASS="grid" BGCOLOR="'.($r % 2 ? '#ffffff' : '#eeeeee').'"'; - <<%$TD%>><% $labels[$r] %></TD> -% for my $day (0..$numdays-1) { - <<%$TD%> ALIGN="right"><% $rows[$r][$day] %></TD> -% } - </TR> -% } -</TABLE> - -<%init> -use Date::Parse 'str2time'; -use Date::Format 'time2str'; -use Data::Dumper 'Dumper'; - -my ($agentnum, $classnum, $month, $year, $sdate, $edate); -$classnum = $cgi->param('classnum'); # may be empty -$agentnum = $cgi->param('agentnum'); # may also be empty -my $classname = ''; -if($classnum) { - my $class = qsearchs('inventory_class', { classnum => $classnum }); - die "classnum $classnum not found!" if !$class; - $classname = $class->classname . ' '; -} - -$month = $cgi->param('_month') || time2str('%m', time); -$year = $cgi->param('_year') || time2str('%Y', time); - -$sdate = str2time("$year-$month-01"); -$edate = str2time($year + ($month == 12 ? 1 : 0) . - '-' . - (($month + 1) % 12 || 12) . - '-01'); -my $numdays = sprintf("%.0f",($edate-$sdate)/86400); -my @days = (0..$numdays - 1); -# Initialize each row with zeroes. -my @labels = ( - 'Opening Balance', - 'Quantity Received', - 'Quantity Sold', - 'Quantity Returned', -); - -if($agentnum) { - push @labels, 'Transfer In', 'Transfer Out'; -} -push @labels, 'Closing Balance'; - -my %agent = ('agentnum' => $agentnum) if $agentnum; -my %class = ('classnum' => $classnum) if $classnum; - -my @rows = ( map {[ (0) x $numdays ]} @labels); -my $opening_balance = scalar( - qsearch('h_inventory_item', - { 'svcnum' => '', - %agent, - %class }, - FS::h_inventory_item->sql_h_search($sdate) ) - ) || 0; - -foreach my $day (0..$numdays-1) { - $rows[0][$day] = ($day == 0) ? - $opening_balance : - $rows[-1][$day-1]; - - my %history; - foreach my $action (qw(insert replace_new replace_old)) { - $history{$action} = [ - qsearch({ - 'table' => 'h_inventory_item', - 'hashref' => { 'history_action' => $action, - %class }, - 'order_by' => 'ORDER BY itemnum, history_date', - 'extra_sql' => - ' AND history_date >= '.($sdate + 86400*$day). - ' AND history_date < ' .($sdate + 86400*($day+1)), - } ) - ]; - } - # Incoming items: simple, just count the inserts - $rows[1][$day] = scalar(grep {!$agentnum or $_->agentnum == $agentnum} - @{ $history{'insert'} }); - - # Other item changes: trickier. - # Notice the order_by parameter above. - # Both lists are sorted by itemnum, then by date, so unless some villain has - # been rapidly replacing the same record several times per second, the - # replace_old and replace_new from the same operation will be in the same - # position. - while(my $h_new = shift @{ $history{'replace_new'} }) { - my $h_old = shift @{ $history{'replace_old'} }; - die "history error" if !defined($h_old) - or $h_old->itemnum != $h_new->itemnum; - if(!$agentnum or $h_new->agentnum == $agentnum) { - if(!$h_old->svcnum and $h_new->svcnum) { - # item was put into service. - $rows[2][$day]++; - } - elsif($h_old->svcnum and !$h_new->svcnum) { - # item was taken out of service. - $rows[3][$day]++; - } - } - if($agentnum and $h_old->agentnum != $agentnum and $h_new->agentnum == $agentnum) { - # item was transferred from another agent - $rows[4][$day]++; - } - elsif($agentnum and $h_old->agentnum == $agentnum and $h_new->agentnum != $agentnum) { - # item was transferred to another agent - $rows[5][$day]++; - } - # Add other cases here. - } - # Closing balance - $rows[-1][$day] = $rows[0][$day] - + $rows[1][$day] - - $rows[2][$day] - + $rows[3][$day]; - if($agentnum) { - $rows[-1][$day] += $rows[4][$day] - $rows[5][$day]; - } -} - -</%init> - diff --git a/httemplate/search/report_h_inventory_item.html b/httemplate/search/report_h_inventory_item.html deleted file mode 100644 index d0b3667c8..000000000 --- a/httemplate/search/report_h_inventory_item.html +++ /dev/null @@ -1,26 +0,0 @@ -<% include('/elements/header.html', 'Inventory Activity Report') %> - -<FORM ACTION="h_inventory_item.html" METHOD="GET"> -<TABLE BGCOLOR="#cccccc" CELLSPACING="0"> - <TR> - <TD ALIGN="right">Inventory class: </TD> - <TD><% include('/elements/select-table.html', - 'element_name' => 'classnum', - 'table' => 'inventory_class', - 'name_col' => 'classname', - 'value' => '', - 'empty_label' => '(all)') %></TD> - </TR> - <TR> - <TD ALIGN="right">Time period: </TD> - <TD><% include('/elements/select-month_year.html') %></TD> - </TR> - <% include('/elements/tr-select-agent.html') %> -</TABLE> - -<BR> -<INPUT TYPE="submit" VALUE="Get Report"> -</FORM> - -<%init> -</%init> diff --git a/httemplate/search/report_newtax.html b/httemplate/search/report_newtax.html index 739652675..2588b48d3 100755 --- a/httemplate/search/report_newtax.html +++ b/httemplate/search/report_newtax.html @@ -1,6 +1,6 @@ <% include('/elements/header.html', 'Tax Report' ) %> -<FORM NAME="newtax"> +<FORM ACTION="report_queued_newtax.cgi" METHOD="GET"> <TABLE> @@ -10,17 +10,10 @@ </TABLE> -<BR><INPUT TYPE="button" NAME='fetch' VALUE="Get Report" onClick="document.newtax.fetch.disabled=true; process();"> +<BR><INPUT TYPE="submit" VALUE="Get Report"> </FORM> -<% include( '/elements/progress-init.html', - 'newtax', - [ qw( agentnum beginning ending ) ], - 'report_queued_newtax.cgi', - ) -%> - <% include('/elements/footer.html') %> <%init> diff --git a/httemplate/search/report_prepaid_income.cgi b/httemplate/search/report_prepaid_income.cgi index 2fe5b6f10..bfb699b54 100644 --- a/httemplate/search/report_prepaid_income.cgi +++ b/httemplate/search/report_prepaid_income.cgi @@ -108,6 +108,10 @@ my @where = (); #here is the agent virtualization push @where, $curuser->agentnums_sql( 'table'=>'cust_main' ); +#well, because cust_bill_pkg.cgi has it and without it the numbers don't match.. +push @where , " payby != 'COMP' " + unless $cgi->param('include_comp_cust'); + my %total = (); my %total_legacy = (); foreach my $agentnum (@agentnums) { diff --git a/httemplate/search/report_queued_newtax.cgi b/httemplate/search/report_queued_newtax.cgi index a375fce62..1d5813ece 100755 --- a/httemplate/search/report_queued_newtax.cgi +++ b/httemplate/search/report_queued_newtax.cgi @@ -1,10 +1,16 @@ -<% $server->process %> +<% include("/elements/header.html", "Queue Tax Report") %> +<% include("/elements/error.html") %> +% unless ($error) { + <CENTER> + Report queued. Check the job queue for status. + </CENTER> +% } +<% include("/elements/footer.html") %> <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Financial reports'); -my $server = - new FS::UI::Web::JSRPC 'FS::tax_rate::queue_liability_report', $cgi; +my $error = FS::tax_rate::queue_liability_report($cgi); </%init> diff --git a/httemplate/search/report_receivables.cgi b/httemplate/search/report_receivables.cgi index 57228a501..3696ed40d 100755 --- a/httemplate/search/report_receivables.cgi +++ b/httemplate/search/report_receivables.cgi @@ -29,12 +29,24 @@ die "access denied" # ) sub balance { - my($start, $end, $cutoff) = @_; #, %opt ? + my($start, $end, $offset) = @_; #, %opt ? + #handle start and end ranges (86400 = 24h * 60m * 60s) + my $str2time = str2time_sql; + my $closing = str2time_sql_closing; + + # $end == 0 means "+infinity", while $start == 0 really means 0 + # so we should always include a start condition + $start = "( $str2time now() $closing - ". ($start + $offset) * 86400 . ' )'; + # but only include an end condition if $end != 0 + $end = $end ? + "( $str2time now() $closing - ". ($end + $offset) * 86400 . ' )' + : ''; + + #$opt{'unapplied_date'} = 1; + + FS::cust_main->balance_date_sql( $start, $end, 'unapplied_date'=>1, + 'cutoff' => "( $str2time now() $closing - ".$offset * 86400 . ')' ); - FS::cust_main->balance_date_sql( $start, $end, - 'cutoff' => $cutoff, - 'unapplied_date'=>1, - ); } </%once> diff --git a/httemplate/search/report_rt_transaction.html b/httemplate/search/report_rt_transaction.html index 61445bd1e..9b7b7cbbb 100644 --- a/httemplate/search/report_rt_transaction.html +++ b/httemplate/search/report_rt_transaction.html @@ -8,24 +8,6 @@ <% include ( '/elements/tr-select-otaker.html' ) %> - <% include ( '/elements/tr-input-text.html', - 'label' => 'Ticket #', - 'field' => 'ticketid', - ) - %> - - <TR> - <TD>Account</TD> - <TD> - <SELECT NAME="svcnum"> - <OPTION VALUE="">(all) -% foreach my $svc_acct (@svc_acct) { - <OPTION VALUE="<% $svc_acct->svcnum %>"><% $svc_acct->username %></OPTION> -% } - </SELECT> - </TD> - </TR> - </TABLE> <BR> @@ -39,18 +21,4 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('List rating data'); -my $conf = new FS::Conf; - -my @pkgparts = $conf->config('support_packages'); - -my @svc_acct = (); -if ( @pkgparts ) { - @svc_acct = qsearch({ - 'table' => 'svc_acct', - 'addl_from' => ' LEFT JOIN cust_svc USING ( svcnum ) '. - ' LEFT JOIN cust_pkg USING ( pkgnum ) ', - 'extra_sql' => 'WHERE pkgpart IN ('. join(',', @pkgparts). ')', - }); -} - </%init> diff --git a/httemplate/search/rt_transaction.html b/httemplate/search/rt_transaction.html index 8dda4baea..651f2896d 100644 --- a/httemplate/search/rt_transaction.html +++ b/httemplate/search/rt_transaction.html @@ -3,12 +3,11 @@ 'name_singular' => 'transaction', 'query' => $query, 'count_query' => $count_query, - 'count_addl' => [ $format_seconds_sub, $format_seconds_sub, ], + 'count_addl' => [ $format_seconds_sub, ], 'header' => [ 'Ticket #', 'Ticket', 'Date', 'Time', - 'Applied', ], 'fields' => [ 'ticketid', sub { encode_entities(shift->get('subject')) }, @@ -16,16 +15,12 @@ sub { my $seconds = shift->get('transaction_time'); &{ $format_seconds_sub }( $seconds ); }, - sub { my $seconds = shift->get('support'); - &{ $format_seconds_sub }( $seconds ); - }, ], 'links' => [ $link, $link, '', '', - '', ], ) %> @@ -33,9 +28,7 @@ my $format_seconds_sub = sub { my $seconds = shift; - #(($seconds < 0) ? '-' : '') . concise(duration($seconds)); - (($seconds < 0) ? '-' : '' ). int(abs($seconds)/3600)."h".sprintf("%02d",(abs( -$seconds)%3600)/60)."m"; + (($seconds < 0) ? '-' : '') . concise(duration($seconds)); }; </%once> @@ -54,9 +47,8 @@ my $transactiontime = " "; my $join = 'JOIN Tickets ON Transactions.ObjectId = Tickets.Id '. - 'JOIN Users ON Transactions.Creator = Users.Id '. - 'LEFT JOIN acct_rt_transaction '. - ' ON Transactions.Id = acct_rt_transaction.transaction_id'; + 'JOIN Users ON Transactions.Creator = Users.Id '; + my $where = " WHERE objecttype='RT::Ticket' AND ( ( Transactions.Type = 'Set' @@ -85,26 +77,20 @@ if ( $cgi->param('otaker') && $cgi->param('otaker') =~ /^([\w\.\-]+)$/ ) { $where .= " AND Users.name = '$1' "; } -if ( $cgi->param('ticketid') =~ /^\s*(\d+)\s*$/ ) { - $where .= " AND Tickets.ID = $1"; -} - -if ( $cgi->param('svcnum') =~ /^\s*(\d+)\s*$/ ) { - $where .= " AND acct_rt_transaction.svcnum = $1"; -} - my $query = { - 'select' => "Transactions.*, Tickets.Id AS ticketid, Tickets.Subject, Users.name as otaker, $transactiontime AS transaction_time, acct_rt_transaction.support", + 'select' => "Transactions.*, Tickets.Id AS ticketid, Tickets.Subject, Users.name as otaker, $transactiontime AS transaction_time", #'table' => 'Transactions', 'table' => 'transactions', - 'addl_from' => $join, + 'addl_from' => $join. + 'LEFT JOIN acct_rt_transaction '. + ' ON Transactions.Id = acct_rt_transaction.transaction_id', 'extra_sql' => $where, 'order by' => 'ORDER BY Created', }; my $count_query = - "SELECT COUNT(*), SUM($transactiontime), SUM(acct_rt_transaction.support) FROM Transactions $join $where"; + "SELECT COUNT(*), SUM($transactiontime) FROM Transactions $join $where"; -my $link = [ "${p}rt/Ticket/Display.html?id=", sub { shift->get('ticketid'); } ]; +my $link = [ "${p}rt/Ticket/Display.html?id=", sub { shift->get('id'); } ]; </%init> diff --git a/httemplate/search/sql.html b/httemplate/search/sql.html index bf5446975..df9b8cddb 100644 --- a/httemplate/search/sql.html +++ b/httemplate/search/sql.html @@ -1,15 +1,13 @@ <% include( 'elements/search.html', 'title' => 'Query Results', 'name' => 'rows', - 'query' => "SELECT $sql", - ) + 'query' => 'SELECT '. ( $cgi->param('sql') + || errorpage('Empty query') ), + ) %> <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Raw SQL'); -my $sql = $cgi->param('sql') or errorpage('Empty query'); -$sql =~ s/;+\s*$//; #remove trailing ; - </%init> diff --git a/httemplate/search/unapplied_cust_pay.html b/httemplate/search/unapplied_cust_pay.html index e232291fe..73361c00b 100755 --- a/httemplate/search/unapplied_cust_pay.html +++ b/httemplate/search/unapplied_cust_pay.html @@ -13,11 +13,18 @@ die "access denied" <%once> sub unapplied_payments { - my($start, $end, $cutoff) = @_; + my($start, $end, $offset) = @_; + + #handle start and end ranges (86400 = 24h * 60m * 60s) + my $str2time = str2time_sql; + my $closing = str2time_sql_closing; + $start = "( $str2time now() $closing - ".($start + $offset) * 86400 . ' )'; + $end = $end ? + "( $str2time now() $closing - ".($end + $offset) * 86400 . ' )' + : ''; + + FS::cust_main->unapplied_payments_date_sql( $start, $end ); - FS::cust_main->unapplied_payments_date_sql( $start, $end, - 'cutoff' => $cutoff, - ); } </%once> diff --git a/httemplate/view/bill_batch.cgi b/httemplate/view/bill_batch.cgi deleted file mode 100644 index 3fca6ebbe..000000000 --- a/httemplate/view/bill_batch.cgi +++ /dev/null @@ -1,99 +0,0 @@ -% if($magic eq 'print') { -<% include('/elements/header.html', "Download Batch") %> -<FORM NAME="OneTrueForm"> -<INPUT TYPE="hidden" NAME="batchnum" VALUE="<% $batchnum %>"> -% $cgi->delete('magic'); -<% include('/elements/progress-init.html', - 'OneTrueForm', - [ 'batchnum' ], - $p.'misc/process/bill_batch-print.html', - {'url' => $cgi->self_url . ';magic=download'}, - '', -) %></FORM> -<SCRIPT TYPE="text/javascript">process();</SCRIPT> -<% include('/elements/footer.html') %> -% } -% -% elsif($magic eq 'download') { -% $m->clear_buffer; -% $r->content_type('application/pdf'); -% $r->headers_out->add('Content-Disposition' => 'attachment;filename="invoice_batch_'.$batchnum.'.pdf"'); -<% $batch->pdf %> -% $batch->pdf(''); -% my $error = $batch->replace; -% warn "error deleting cached PDF: '$error'\n" if $error; -% } -% else { -<% include('/search/elements/search.html', - 'title' => $close ? - "Batch $batchnum closed." : - "Invoice Batch $batchnum", - 'name' => 'invoices', - 'query' => { 'table' => 'cust_bill_batch', - 'select' => join(', ', - 'cust_bill.*', - FS::UI::Web::cust_sql_fields(), - 'cust_main.custnum AS cust_main_custnum', - ), - 'hashref' => { }, - 'addl_from' => - 'LEFT JOIN cust_bill USING ( invnum ) '. - 'LEFT JOIN cust_main USING ( custnum )', - 'extra_sql' => '', - " WHERE batchnum = $batchnum", - }, - 'count_query' => "SELECT COUNT(*) FROM cust_bill_batch WHERE batchnum = $batchnum", - 'html_init' => $html_init, - 'header' => [ 'Invoice #', - 'Amount', - 'Date', - 'Customer', - ], - 'fields' => [ sub { shift->cust_bill->display_invnum }, - sub { sprintf($money_char.'%.2f', - shift->cust_bill->charged ) }, - sub { time2str('%b %d %Y', - shift->cust_bill->_date ) }, - sub { shift->cust_bill->cust_main->name }, - ], - 'align' => 'rrll', - 'links' => [ ($link) x 3, $clink, - ], - 'really_disable_download' => 1, -) %> -% } -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('View invoices'); - -my $conf = new FS::Conf; -my $batch; -my $batchnum = $cgi->param('batchnum'); - -$batch = FS::bill_batch->by_key($batchnum); -die "Batch '$batchnum' not found!\n" if !$batch; - -my $magic = $cgi->param('magic'); -my $html_init = ''; - -my $close = $cgi->param('close'); -$batch->close if $close; - -if(!$magic) { - $cgi->param('magic' => 'print'); - $cgi->delete('close'); - $html_init = '<A HREF="'.$cgi->self_url.'">Download this batch</A><BR>'; - if($batch->status eq 'O') { - $cgi->param('close' => 1); - $cgi->delete('magic'); - $html_init .= '<A HREF="'.$cgi->self_url.'">Close this batch</A><BR>'; - } - $html_init .= '<BR>'; -} - -my $link = [ "$p/view/cust_bill.cgi?", 'invnum' ]; -my $clink = [ "$p/view/cust_main.cgi?", 'custnum' ]; -my $money_char = $conf->config('money_char') || '$'; - -</%init> diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index f6bef43ba..ca8bf5442 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -4,22 +4,6 @@ }) %> <BR> -% my @part_tag = $cust_main->part_tag; -% if ( $conf->config('cust_tag-location') eq 'top' && @part_tag ) { -<TABLE STYLE="margin-bottom:8px" CELLSPACING=2> -% foreach my $part_tag ( @part_tag ) { -<TR> - <TD> - <FONT SIZE="+1" - <% length($part_tag->tagcolor) - ? 'STYLE="background-color:#'.$part_tag->tagcolor.'"' - : '' - %>><% $part_tag->tagname.': '. $part_tag->tagdesc |h %></FONT> - </TD> -</TR> -% } -</TABLE> -% } <% include('/elements/menubar.html', { 'newstyle' => 1, @@ -29,7 +13,7 @@ %views, ) %> -<DIV CLASS="fstabcontainer"> +<BR> <% include('/elements/init_overlib.html') %> @@ -90,9 +74,6 @@ function areyousure(href, message) { This customer's signup URL: <A HREF="<% $signupurl %>?ref=<% $custnum %>"><% $signupurl %>?ref=<% $custnum %></A><BR><BR> % } -%if ( $conf->exists('maestro-status_test') ) { - <A HREF="<% $p %>misc/maestro-customer_status-test.html?<% $custnum %>">Test maestro status</A><BR><BR> -% } <A NAME="cust_main"></A> <TABLE BORDER=0> @@ -233,7 +214,6 @@ Comments <% include('cust_main/change_history.html', $cust_main ) %> % } -</DIV> <% include('/elements/footer.html') %> <%init> diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html index 54c180bdd..c8d0c47cd 100644 --- a/httemplate/view/cust_main/billing.html +++ b/httemplate/view/cust_main/billing.html @@ -5,12 +5,7 @@ Billing information %if ( $FS::CurrentUser::CurrentUser->access_right('Bill customer now') % && ! $cust_main->is_encrypted($cust_main->payinfo) % ) { -%# (<A HREF="<% $p %>misc/bill.cgi?<% $cust_main->custnum %>">Bill now</A>) - (<% include('/elements/bill.html', - custnum => $cust_main->custnum, - label => 'Bill now', - url => $p.'view/cust_main.cgi?'.$cust_main->custnum, - ) %>) + (<A HREF="<% $p %>misc/bill.cgi?<% $cust_main->custnum %>">Bill now</A>) % } <% ntable("#cccccc") %><TR><TD><% ntable("#cccccc",2) %> diff --git a/httemplate/view/cust_main/misc.html b/httemplate/view/cust_main/misc.html index 6e90a0b4c..2cfe0263f 100644 --- a/httemplate/view/cust_main/misc.html +++ b/httemplate/view/cust_main/misc.html @@ -10,25 +10,12 @@ <TD BGCOLOR="#ffffff"><FONT COLOR="#<% $cust_main->statuscolor %>"><B><% ucfirst($cust_main->status) %></B></FONT></TD> </TR> -% my @part_tag = $cust_main->part_tag; -% if ( $conf->config('cust_tag-location') =~ /^(cust_misc|)$/ && @part_tag ) { -<TR> - <TD ALIGN="right">Tags</TD> - <TD BGCOLOR="#ffffff"> -% foreach my $part_tag ( @part_tag ) { - <FONT <% length($part_tag->tagcolor) - ? 'STYLE="background-color:#'.$part_tag->tagcolor.'"' - : '' %> - ><% $part_tag->tagname.': '. $part_tag->tagdesc |h %></FONT> - <BR> -% } - </TD> -</TR> -% } - -%unless ( scalar(@agentnums) == 1 -% && !$curuser->access_right('View customers of all agents') ) { -% my $agent = qsearchs('agent',{ 'agentnum' => $cust_main->agentnum } ); +%my $agent; +%if ( $num_agents == 1 ) { +% my @agents = qsearchs( 'agent', {} ); +% $agent = $agents[0]; +%} else { +% $agent = qsearchs('agent',{ 'agentnum' => $cust_main->agentnum } ); <TR> <TD ALIGN="right">Agent</TD> <TD BGCOLOR="#ffffff"><% $agent->agentnum %>: <% $agent->agent %></TD> @@ -132,8 +119,8 @@ my( $cust_main ) = @_; my $conf = new FS::Conf; my $date_format = ($conf->config('date_format') || "%m/%d/%Y"); -my $curuser = $FS::CurrentUser::CurrentUser; - -my @agentnums = $curuser->agentnums; +my $sth = dbh->prepare('SELECT COUNT(*) FROM agent') or die dbh->errstr; +$sth->execute or die $sth->errstr; +my $num_agents = $sth->fetchrow_arrayref->[0]; </%init> diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 811ac3c98..3ac4861c3 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -159,8 +159,7 @@ my %conf_opt = ( #for services.html 'svc_external-skip_manual' => $conf->exists('svc_external-skip_manual'), 'legacy_link' => $conf->exists('legacy_link'), - 'svc_broadband-manage_link' => scalar($conf->config('svc_broadband-manage_link')), - 'maestro-status_test' => $conf->exists('maestro-status_test'), + 'svc_broadband-manage_link' => $conf->config('svc_broadband-manage_link'), ); #subroutines diff --git a/httemplate/view/cust_main/packages/services.html b/httemplate/view/cust_main/packages/services.html index 6e30922c5..0fe7931d8 100644 --- a/httemplate/view/cust_main/packages/services.html +++ b/httemplate/view/cust_main/packages/services.html @@ -58,11 +58,6 @@ % if ( $curuser->access_right('Unprovision customer service') ) { <FONT SIZE="-2">( <%svc_unprovision_link($cust_svc)%> )</FONT> % } - -% if ( $part_svc->svcdb eq 'svc_pbx' && $opt{'maestro-status_test'} ){ - <FONT SIZE="-2">( <A HREF="<% $p %>misc/maestro-customer_status-test.html?<% $cust_pkg->custnum.'+'.$cust_svc->svcnum %>">Test maestro status</A> )</FONT> -% } - </TD> </TR> % } diff --git a/httemplate/view/cust_main/tickets.html b/httemplate/view/cust_main/tickets.html index e90ae5276..e1f9a131e 100644 --- a/httemplate/view/cust_main/tickets.html +++ b/httemplate/view/cust_main/tickets.html @@ -1,31 +1,17 @@ -<FORM METHOD="GET" NAME="CreateTicketForm" STYLE="display:inline"> -<SCRIPT TYPE="text/javascript"> -function updateTicketLink() { - var link = document.getElementById('CreateTicketLink'); - var selector = document.getElementById('Queue') - link.href = "<% $new_base.'?'. - join(';', map( - { ($_ eq 'Queue') ? () : "$_=$new_param{$_}"} - keys %new_param),'Queue=') %>" + selector.options[selector.selectedIndex].value; -} -</SCRIPT> -<A id="CreateTicketLink" HREF="<% $new_link %>">Create new ticket</A> - in queue +<FORM METHOD="GET" ACTION="<% $new_base %>" NAME="CreateTicketForm"> +<INPUT TYPE="submit" VALUE="Create new ticket"> +in queue +<SELECT NAME="Queue"> % my %queues = FS::TicketSystem->queues(); -% if( $conf->exists('ticket_system-force_default_queueid') ) { -<B><% $queues{$new_param{'Queue'}} %></B> -<INPUT TYPE="hidden" NAME="Queue" VALUE="<% $new_param{'Queue'} %>"> -% } -% else { -<SELECT NAME="Queue" id="Queue" onchange="updateTicketLink()"> -% foreach my $queueid ( sort { $queues{$a} cmp $queues{$b} } keys %queues ) { +% foreach my $queueid ( keys %queues ) { % #should consider whether the user has ACL to create ticket in each queue <OPTION VALUE="<% $queueid %>" <% $queueid == $new_param{'Queue'} ? 'SELECTED' : '' %> ><% $queues{$queueid} |h %> % } </SELECT> -<SCRIPT DEFER TYPE="text/javascript">updateTicketLink();</SCRIPT> +% foreach my $param ( grep { $_ ne 'Queue' } keys %new_param ) { + <INPUT TYPE="hidden" NAME="<% $param %>" VALUE="<% $new_param{$param} |h %>"> % } </FORM> <BR> @@ -93,7 +79,6 @@ function updateTicketLink() { <%init> -my( $conf ) = new FS::Conf; my( $cust_main ) = @_; my( @tickets ) = $cust_main->tickets; diff --git a/httemplate/view/prospect_main.html b/httemplate/view/prospect_main.html index 9517e3920..9883e6766 100644 --- a/httemplate/view/prospect_main.html +++ b/httemplate/view/prospect_main.html @@ -14,8 +14,7 @@ <TD BGCOLOR="#FFFFFF"><B><% $prospectnum %></B></TD> </TR> -%unless ( scalar(@agentnums) == 1 -% && !$curuser->access_right('View customers of all agents') ) { +%unless ( scalar(@agentnums) == 1 ) { % my $agent = qsearchs('agent',{ 'agentnum' => $prospect_main->agentnum } ); <TR> <TD ALIGN="right">Agent</TD> diff --git a/httemplate/view/svc_acct/communigate.html b/httemplate/view/svc_acct/communigate.html index 0f090fdb9..9d6680750 100644 --- a/httemplate/view/svc_acct/communigate.html +++ b/httemplate/view/svc_acct/communigate.html @@ -53,45 +53,7 @@ <% include('/view/elements/tr.html', label=>'Send read receipts', value=>$svc_acct->cgp_sendmdnmode ) %> -%# vacation message -%#XXX finish me... do we need to search for specific rules -%# (and hide them?) need to see what CGP gives back after we've added a rule - <% include('/elements/init_overlib.html') %> - - <TR> - <TD ALIGN="right">Vacation message</TD> - <TD BGCOLOR="#FFFFFF"> - <% include('/elements/popup_link.html', - 'action' => $p.'edit/cgp_rule-vacation.html?'. - 'svcnum='. $svc_acct->svcnum, - 'label' => '(add)', #XXX (edit) - 'actionlabel' => 'Vacation message', - 'width' => 600, - 'height' => 300, - #'color' - ) - %> - </TD> - </TR> - -%# redirect all mail -%#XXX finish me... - - <TR> - <TD ALIGN="right">Redirect all mail</TD> - <TD BGCOLOR="#FFFFFF"> - <% include('/elements/popup_link.html', - 'action' => $p.'edit/cgp_rule-redirect_all.html?'. - 'svcnum='. $svc_acct->svcnum, - 'label' => '(add)', #XXX (edit) - 'actionlabel' => 'Redirect all mail', - 'width' => 763, - #'height' - #'color' - ) - %> - </TD> - </TR> +%#XXX vacation message, redirect all mail %# mail rules diff --git a/httemplate/view/svc_domain/acct_defaults.html b/httemplate/view/svc_domain/acct_defaults.html index 3a4e187be..b6d03e2df 100644 --- a/httemplate/view/svc_domain/acct_defaults.html +++ b/httemplate/view/svc_domain/acct_defaults.html @@ -36,7 +36,7 @@ %> <% include('/view/elements/tr.html', - label=>'Files limit', + label=>'Files limt', value=>$svc_domain->acct_def_file_maxnum, ) %> diff --git a/httemplate/view/svc_domain/dns.html b/httemplate/view/svc_domain/dns.html index 88a9bda95..f6f8c71c7 100644 --- a/httemplate/view/svc_domain/dns.html +++ b/httemplate/view/svc_domain/dns.html @@ -71,11 +71,10 @@ DNS records <FORM NAME="SlaveForm" METHOD="POST" ACTION="<%$p%>edit/process/domain_record.cgi"> <INPUT TYPE="hidden" NAME="svcnum" VALUE="<%$svcnum%>"> - Or % if ( @records ) { - delete all records and + Delete all records and % } - slave from nameserver IP + Or slave from nameserver IP <INPUT TYPE="hidden" NAME="svcnum" VALUE="<%$svcnum%>"> <INPUT TYPE="hidden" NAME="reczone" VALUE="@"> <INPUT TYPE="hidden" NAME="recaf" VALUE="IN"> diff --git a/httemplate/view/svc_forward.cgi b/httemplate/view/svc_forward.cgi index 15b5ae56f..43d8a4e8b 100755 --- a/httemplate/view/svc_forward.cgi +++ b/httemplate/view/svc_forward.cgi @@ -50,9 +50,6 @@ </TABLE> <BR> - -<% include('elements/svc_export_settings.html', $svc_forward) %> - <% joblisting({'svcnum'=>$svcnum}, 1) %> <% include('/elements/footer.html') %> |