diff options
author | Ivan Kohler <ivan@freeside.biz> | 2015-05-06 19:10:47 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2015-05-06 19:10:47 -0700 |
commit | f921a017cd3dd987bd48e05c7fd462a1ef9cb79d (patch) | |
tree | 4f772a73dc1852860d1d646fb7d8e866eb46d2a3 /httemplate | |
parent | a9129b5b8b7a69d1d0a7fce6dc9d72665eaec568 (diff) | |
parent | 95606bc9db41352511c886773a311f2166cc6cf2 (diff) |
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/edit/elements/edit.html | 1 | ||||
-rw-r--r-- | httemplate/edit/elements/part_svc_column.html | 7 | ||||
-rw-r--r-- | httemplate/edit/elements/svc_Common.html | 3 | ||||
-rwxr-xr-x | httemplate/edit/svc_acct.cgi | 63 | ||||
-rw-r--r-- | httemplate/edit/svc_acct/communigate.html | 5 | ||||
-rw-r--r-- | httemplate/edit/svc_broadband.cgi | 11 | ||||
-rw-r--r-- | httemplate/elements/tr-input-date-field.html | 9 | ||||
-rw-r--r-- | httemplate/elements/tr-select-hardware_type.html | 5 | ||||
-rw-r--r-- | httemplate/elements/tr-select-router_block_ip.html | 6 | ||||
-rw-r--r-- | httemplate/pref/pref-process.html | 1 | ||||
-rw-r--r-- | httemplate/pref/pref.html | 9 | ||||
-rw-r--r-- | httemplate/search/cust_msg.html | 2 | ||||
-rw-r--r-- | httemplate/search/elements/search.html | 9 | ||||
-rwxr-xr-x | httemplate/view/cust_main/notes.html | 11 | ||||
-rw-r--r-- | httemplate/view/cust_main/notes/email.html | 106 |
15 files changed, 197 insertions, 51 deletions
diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html index 76df82064..7b02994d1 100644 --- a/httemplate/edit/elements/edit.html +++ b/httemplate/edit/elements/edit.html @@ -418,6 +418,7 @@ Example: % 'value' => $opt{curr_value}, % 'label' => $label, % 'noinit' => $f->{noinit}, +% 'required' => $f->{'required'}, % } % ); % } diff --git a/httemplate/edit/elements/part_svc_column.html b/httemplate/edit/elements/part_svc_column.html index 23a6deb56..bc679e577 100644 --- a/httemplate/edit/elements/part_svc_column.html +++ b/httemplate/edit/elements/part_svc_column.html @@ -76,7 +76,7 @@ my %communigate_fields = ( <TH BGCOLOR="#cccccc">Field</TH> <TH BGCOLOR="#cccccc">Label</TH> <TH BGCOLOR="#cccccc" COLSPAN=2>Modifier</TH> - <TH BGCOLOR="#cccccc">Required?</TH> + <TH BGCOLOR="#cccccc"><% $manual_require ? 'Required?' : '' %></TH> </TR> % $part_svc->set('svcpart' => $opt{'clone'}) if $opt{'clone'}; # for now % my $i = 0; @@ -211,7 +211,9 @@ my %communigate_fields = ( % } </TD> <TD> -% if (!$def->{'type'} || !(grep {$_ eq $def->{'type'}} ('checkbox','disabled'))) { +% if ($manual_require && +% (!$def->{'type'} || !(grep {$_ eq $def->{'type'}} ('checkbox','disabled'))) +% ) { <INPUT ID="<% $name.'_required' %>" TYPE="checkbox" NAME="<% $svcdb %>__<% $field %>_required" VALUE="Y" <% ($part_svc_column->required || $def->{'required'}) ? 'CHECKED' : '' %> <% $def->{'required'} ? 'DISABLED' : '' %> @@ -309,4 +311,5 @@ if ( $svcdb eq 'svc_acct' } my @defs = map { FS::part_svc->svc_table_fields($svcdb)->{$_} } @fields; +my $manual_require = FS::part_svc->svc_table_info($svcdb)->{'manual_require'}; </%init> diff --git a/httemplate/edit/elements/svc_Common.html b/httemplate/edit/elements/svc_Common.html index 97b630f76..a4e345e40 100644 --- a/httemplate/edit/elements/svc_Common.html +++ b/httemplate/edit/elements/svc_Common.html @@ -102,6 +102,9 @@ my $columndef = $part_svc->part_svc_column($f->{'field'}); my $flag = $columndef->columnflag; + $f->{'required'} = 1 + if $columndef->required; + if ( $flag eq 'F' ) { #fixed $f->{'value'} = $columndef->columnvalue; if (length($columndef->columnvalue)) { diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index 2c694a8fe..31678a991 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -30,8 +30,9 @@ <TD BGCOLOR="#eeeeee"><% $part_svc->svc %></TD> </TR> -<TR> - <TD ALIGN="right"><% mt('Username') |h %></TD> +<% include('/elements/tr-td-label.html', + 'label' => mt('Username'), + 'required' => $part_svc->part_svc_column('username')->required ) %> % if ( $svcnum && $conf->exists('svc_acct-no_edit_username') ) { <TD BGCOLOR="#eeeeee"><% $svc_acct->username() %></TD> <INPUT TYPE="hidden" NAME="username" VALUE="<% $username %>"> @@ -43,9 +44,10 @@ </TR> %if ( $part_svc->part_svc_column('_password')->columnflag ne 'F' ) { -<TR> % #XXX eventually should require "Edit Password" ACL - <TD ALIGN="right"><% mt('Password') |h %></TD> +<% include('/elements/tr-td-label.html', + 'label' => mt('Password'), + 'required' => $part_svc->part_svc_column('_password')->required ) %> <TD> <INPUT TYPE="text" ID="clear_password" NAME="clear_password" VALUE="<% $password %>" SIZE=<% $pmax2 %> MAXLENGTH=<% $pmax %>> <& /elements/random_pass.html, 'clear_password' &> @@ -60,8 +62,9 @@ %if ( $conf->exists('security_phrase') % && $part_svc->part_svc_column('sec_phrase')->columnflag ne 'F' ) { - <TR> - <TD ALIGN="right"><% mt('Security phrase') |h %></TD> +<% include('/elements/tr-td-label.html', + 'label' => mt('Security phrase'), + 'required' => $part_svc->part_svc_column('sec_phrase')->required ) %> <TD> <INPUT TYPE="text" NAME="sec_phrase" VALUE="<% $sec_phrase %>" SIZE=32> (<% mt('for forgotten passwords') |h %>) @@ -97,8 +100,9 @@ % ) % ); - <TR> - <TD ALIGN="right"><% mt('Domain') |h %></TD> +<% include('/elements/tr-td-label.html', + 'label' => mt('Domain'), + 'required' => $part_svc->part_svc_column('domsvc')->required ) %> <TD> <SELECT NAME="domsvc" SIZE=1> % foreach my $svcnum ( @@ -143,8 +147,9 @@ <INPUT TYPE="hidden" NAME="popnum" VALUE="<% $popnum %>"> % } else { - <TR> - <TD ALIGN="right"><% mt('Access number') |h %></TD> +<% include('/elements/tr-td-label.html', + 'label' => mt('Access number'), + 'required' => $part_svc->part_svc_column('popnum')->required ) %> <TD><% FS::svc_acct_pop::popselector($popnum) %></TD> </TR> % } @@ -156,6 +161,7 @@ 'curr_value' => $svc_acct->sectornum, #'part_svc' => $part_svc, #'cust_pkg' => $cust_pkg, + 'required' => $part_svc->part_svc_column('sectornum')->required, &> %} else { <INPUT TYPE="hidden" NAME="sectornum" VALUE="<% $svc_acct->sectornum %>"> @@ -176,6 +182,9 @@ % % if ( length($svc_acct->$xid()) ) { +<% include('/elements/tr-td-label.html', + 'label' => uc($xid), + 'required' => $part_svc->part_svc_column($xid)->required ) %> <TR> <TD ALIGN="right"><% uc($xid) %></TD> <TD BGCOLOR="#eeeeee"><% $svc_acct->$xid() %></TD> @@ -187,8 +196,9 @@ <INPUT TYPE="hidden" NAME="<% $xid %>" VALUE="<% $svc_acct->$xid() %>"> % } else { - <TR> - <TD ALIGN="right"><% uc($xid) %></TD> +<% include('/elements/tr-td-label.html', + 'label' => uc($xid), + 'required' => $part_svc->part_svc_column($xid)->required ) %> <TD> <INPUT TYPE="text" NAME="<% $xid %>" SIZE=8 MAXLENGTH=6 VALUE="<% $svc_acct->$xid() %>"> </TD> @@ -205,8 +215,9 @@ % } else { - <TR> - <TD ALIGN="right"><% mt('Real Name') |h %></TD> +<% include('/elements/tr-td-label.html', + 'label' => mt('Real Name'), + 'required' => $part_svc->part_svc_column('finger')->required ) %> <TD> <INPUT TYPE="text" NAME="finger" VALUE="<% $svc_acct->finger %>"> </TD> @@ -223,8 +234,9 @@ % } else { - <TR> - <TD ALIGN="right"><% mt('Home directory') |h %></TD> +<% include('/elements/tr-td-label.html', + 'label' => mt('Home directory'), + 'required' => $part_svc->part_svc_column('dir')->required ) %> <TD><INPUT TYPE="text" NAME="dir" VALUE="<% $svc_acct->dir %>"></TD> </TR> % } @@ -240,8 +252,9 @@ % } else { - <TR> - <TD ALIGN="right"><% mt('Shell') |h %></TD> +<% include('/elements/tr-td-label.html', + 'label' => mt('Shell'), + 'required' => $part_svc->part_svc_column('shell')->required ) %> <TD> <SELECT NAME="shell" SIZE=1> % @@ -269,7 +282,9 @@ % # (should we show this if slipip is fixed?) <& /elements/tr-select-router_block_ip.html, 'object' => $svc_acct, - 'ip_field' => 'slipip' + 'ip_field' => 'slipip', + 'required' => $part_svc->part_svc_column('routernum')->required, + 'ip_addr_required' => $part_svc->part_svc_column('slipip')->required, &> % } else { % # don't expose these to the user--they're only useful in the other case @@ -278,8 +293,9 @@ % if ( $part_svc->part_svc_column('slipip')->columnflag =~ /^[FA]$/ ) { <INPUT TYPE="hidden" NAME="slipip" VALUE="<% $svc_acct->slipip %>"> % } else { - <TR> - <TD ALIGN="right"><% mt('IP') |h %></TD> +<% include('/elements/tr-td-label.html', + 'label' => mt('IP'), + 'required' => $part_svc->part_svc_column('slipip')->required ) %> <TD><INPUT TYPE="text" NAME="slipip" VALUE="<% $svc_acct->slipip %>"></TD> </TR> % } @@ -324,8 +340,9 @@ % } -<TR> - <TD ALIGN="right"><% mt('RADIUS groups') |h %></TD> +<% include('/elements/tr-td-label.html', + 'label' => mt('RADIUS groups'), + 'required' => $part_svc->part_svc_column('usergroup')->required ) %> % if ( $part_svc_usergroup->columnflag eq 'F' ) { <TD BGCOLOR="#eeeeee"><% join('<BR>', @groupnames) %></TD> % } else { diff --git a/httemplate/edit/svc_acct/communigate.html b/httemplate/edit/svc_acct/communigate.html index 6370a54dc..370bfb0e7 100644 --- a/httemplate/edit/svc_acct/communigate.html +++ b/httemplate/edit/svc_acct/communigate.html @@ -47,8 +47,9 @@ <INPUT TYPE="hidden" NAME="quota" VALUE="<% $svc_acct->quota %>"> % } else { % my $quota_label = $communigate ? 'Mail storage limit' : 'Quota'; - <TR> - <TD ALIGN="right"><% $quota_label %></TD> +<% include('/elements/tr-td-label.html', + 'label' => $quota_label, + 'required' => $part_svc->part_svc_column('quota')->required ) %> <TD><INPUT TYPE="text" NAME="quota" VALUE="<% $svc_acct->quota %>"></TD> </TR> % } diff --git a/httemplate/edit/svc_broadband.cgi b/httemplate/edit/svc_broadband.cgi index 1b85460e6..81c694aa5 100644 --- a/httemplate/edit/svc_broadband.cgi +++ b/httemplate/edit/svc_broadband.cgi @@ -102,7 +102,16 @@ END my @fields = ( qw( description speed_down speed_up ), { field=>'sectornum', type=>'select-tower_sector', }, - { field=>'routernum', type=>'select-router_block_ip' }, + { field=>'routernum', type=>'select-router_block_ip', + include_opt_callback => sub { + my $svc_broadband = shift; + my $part_svc = $svc_broadband->part_svc; + return () unless $part_svc; #sanity check + my $col = $part_svc->part_svc_column('ip_addr'); + return () unless $col; #sanity check + return ('ip_addr_required' => $col->required); + }, + }, { field=>'mac_addr' , type=>'input-mac_addr' }, qw( latitude longitude altitude diff --git a/httemplate/elements/tr-input-date-field.html b/httemplate/elements/tr-input-date-field.html index ff9855184..f2a570b99 100644 --- a/httemplate/elements/tr-input-date-field.html +++ b/httemplate/elements/tr-input-date-field.html @@ -13,6 +13,7 @@ Example: 'usedatetime' => 1, #use DateTime->strftime to format the date # instead of Date::Format->time2str 'noinit' => 1, #first one on the page is enough + 'required' => 1, }, &> @@ -24,8 +25,9 @@ Example: <SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/calendar-setup.js"></SCRIPT> % } -<TR> - <TD ALIGN="right"><% $label %></TD> +<% include('/elements/tr-td-label.html', + 'label' => $label, + 'required' => $required ) %> <TD COLSPAN=<% $colspan %>> <INPUT TYPE="text" NAME="<% $name %>" ID="<% $name %>_text" VALUE="<% $value %>"> <IMG SRC="<%$fsurl%>images/calendar.png" ID="<% $name %>_button" STYLE="cursor: pointer" TITLE="<% mt('Select date') |h %>"> @@ -48,7 +50,7 @@ Example: <%init> -my($name, $value, $label, $format, $usedatetime, $noinit, $colspan); +my($name, $value, $label, $format, $usedatetime, $noinit, $colspan, $required); if ( ref($_[0]) ) { my $opt = shift; $name = $opt->{'name'}; @@ -58,6 +60,7 @@ if ( ref($_[0]) ) { $usedatetime = $opt->{'usedatetime'}; $noinit = $opt->{'noinit'}; $colspan = $opt->{'colspan'} || 1; + $required = $opt->{'required'}; } else { ($name, $value, $label, $format, $usedatetime) = @_; $colspan = 1; diff --git a/httemplate/elements/tr-select-hardware_type.html b/httemplate/elements/tr-select-hardware_type.html index c3066417b..b51afc0a5 100644 --- a/httemplate/elements/tr-select-hardware_type.html +++ b/httemplate/elements/tr-select-hardware_type.html @@ -1,5 +1,6 @@ -<TR> - <TD ALIGN="right"><% $opt{'label'} || 'Device type: ' %></TD> +<% include('/elements/tr-td-label.html', + 'label' => $opt{'label'} || 'Device type: ', + 'required' => $opt{'required'} ) %> <TD><% include('select-hardware_type.html', %opt) %></TD> </TR> diff --git a/httemplate/elements/tr-select-router_block_ip.html b/httemplate/elements/tr-select-router_block_ip.html index 11f7c4831..ee135686c 100644 --- a/httemplate/elements/tr-select-router_block_ip.html +++ b/httemplate/elements/tr-select-router_block_ip.html @@ -30,7 +30,7 @@ function clearhint_ip_addr (what) { what.value = ''; } </script> -<& /elements/tr-td-label.html, label => ($opt{'label'} || 'Router') &> +<& /elements/tr-td-label.html, label => ($opt{'label'} || 'Router'), required => $opt{'required'} &> <td> <& /elements/select-tiered.html, prefix => 'router_', tiers => [ { @@ -56,9 +56,9 @@ function clearhint_ip_addr (what) { ] &> </td></tr> -<& /elements/tr-td-label.html, label => 'IP address' &> +<& /elements/tr-td-label.html, label => 'IP address', required => $opt{'ip_addr_required'} &> <td> -% warn Dumper \%fixed; +% #warn Dumper \%fixed; % if ( exists $fixed{$ip_field} ) { <input type="hidden" id="input_ip_addr" name="<% $ip_field %>" value="<% $opt{'ip_addr'} |h%>"><% $opt{'ip_addr'} || '' %> diff --git a/httemplate/pref/pref-process.html b/httemplate/pref/pref-process.html index cd400ee3f..68f0f6e2f 100644 --- a/httemplate/pref/pref-process.html +++ b/httemplate/pref/pref-process.html @@ -55,6 +55,7 @@ unless ( $error ) { # if ($access_user) { enable_fuzzy_on_exact disable_html_editor disable_enter_submit_onetimecharge enable_mask_clipboard_hack dashboard_customers + customer_view_emails email_address snom-ip snom-username snom-password vonage-fromnumber vonage-username vonage-password diff --git a/httemplate/pref/pref.html b/httemplate/pref/pref.html index 5e722b043..ffc90fde8 100644 --- a/httemplate/pref/pref.html +++ b/httemplate/pref/pref.html @@ -151,6 +151,15 @@ Interface </TD> </TR> + <TR> + <TH ALIGN="right">How many recent outbound emails to show in customer view</TH> + <TD ALIGN="left" COLSPAN=2> + <INPUT TYPE="text" NAME="customer_view_emails" VALUE="<% $curuser->option('customer_view_emails') %>"></TD> + </TD> + </TR> + + + </TABLE> <BR> diff --git a/httemplate/search/cust_msg.html b/httemplate/search/cust_msg.html index d5b865c3b..401f52ebb 100644 --- a/httemplate/search/cust_msg.html +++ b/httemplate/search/cust_msg.html @@ -47,7 +47,7 @@ ], 'html_init' => $html_init, 'really_disable_download' => 1, - @_ #why? + 'order_by' => '_date DESC', &> <%init> #hmm... diff --git a/httemplate/search/elements/search.html b/httemplate/search/elements/search.html index 62a0e4786..64f3a665f 100644 --- a/httemplate/search/elements/search.html +++ b/httemplate/search/elements/search.html @@ -386,10 +386,7 @@ unless ( $type =~ /^(csv|xml|\w*.xls)$/) { } #order by override -my $order_by = ''; -#if ( $cgi->param('order_by') =~ /^([\w\, ]+)$/ ) { -# $order_by = $1; -#} +my $order_by = $opt{order_by} || ''; $order_by = $cgi->param('order_by') if $cgi->param('order_by'); # run the query @@ -415,6 +412,8 @@ if ( ref($opt{query}) ) { } } + $opt{query}->{'order_by'} .= " $limit"; + } elsif (ref($opt{query}) eq 'ARRAY') { @query = @{ $opt{query} }; } else { @@ -434,7 +433,7 @@ if ( ref($opt{query}) ) { } @query ], - 'order_by' => $opt{order_by}. " ". $limit, + #'order_by' => $opt{order_by}. " ". $limit, ) ]; } else { diff --git a/httemplate/view/cust_main/notes.html b/httemplate/view/cust_main/notes.html index 1cd6e0970..deba956ae 100755 --- a/httemplate/view/cust_main/notes.html +++ b/httemplate/view/cust_main/notes.html @@ -77,15 +77,8 @@ % if ( $curuser->access_right('View email logs') % and FS::cust_msg->count("custnum = $custnum")) { <BR> -% if (!$cgi->param('order_by')) { -% my $order_by = '_date'; -% $order_by .= ' DESC' if $curuser->option('history_order') eq 'newest'; -% $cgi->param('order_by', $order_by); -% } -<& /search/cust_msg.html, - nohtmlheader => 1, - html_init => mt('Mail sent to this customer: '), -&> +<& notes/email.html, 'cust_main' => $cust_main &> +<BR> % } <%init> diff --git a/httemplate/view/cust_main/notes/email.html b/httemplate/view/cust_main/notes/email.html new file mode 100644 index 000000000..da2c352b6 --- /dev/null +++ b/httemplate/view/cust_main/notes/email.html @@ -0,0 +1,106 @@ +% if ( scalar(@rows) ) { +<STYLE type="text/css"> +#cust_msg td.grid a:link {text-decoration: none} +#cust_msg td.grid a:visited {text-decoration: none} +#cust_msg td.grid a:hover {text-decoration: underline} +#cust_msg th {background-color: #cccccc} +.row0 {background-color: #eeeeee} +.row1 {background-color: #ffffff} +</STYLE> +<DIV id="cust_msg"> +<FONT SIZE="+1"> <% mt('Email sent to this customer') %> </FONT><BR> +% if ($maxrecords < $total) { +<% mt('Showing [_1] most recent of [quant,_2,total message]', $maxrecords, $total) %> + <A HREF="<%$p%>search/cust_msg.html?custnum=<%$custnum%>"> + <i>(<% mt('view all') %>)</i> + </A> +% } else { +<% mt('[quant,_1,total message]', $total) %> +% } +<BR> +<& /elements/table-grid.html &> + <TR> + <TH CLASS="grid"><% mt('Date') %></TH> + <TH CLASS="grid"><% mt('Type') %></TH> + <TH CLASS="grid"><% mt('Destination') %></TH> + <TH CLASS="grid"><% mt('Subject') %></TH> + <TH CLASS="grid"></TH> + </TR> +% my $i = 0; +% foreach my $row (@rows) { +% my $onclick = $sub_popup_link->($row); +% my $link = qq!<A onclick="$onclick">!; + <TR CLASS="row<%$i%>"> + <TD CLASS="grid"><% $link %> + <% $row->_date ? time2str('%Y-%m-%d %T', $row->_date) : '' %> + </A></TD> + <TD CLASS="grid" STYLE="color: <% $typecolor->($row) %>"><% $link %> + <% ucfirst($row->msgtype) || $row->msgname %> + </A></TD> + <TD CLASS="grid"><% $link %> + <% join('<BR>', split(/,\s*/, $row->env_to)) %> + </A></TD> + <TD CLASS="grid" STYLE="color: <% $statuscolor->($row) %>"> + <% $row->status %> + </TD> + <TD CLASS="grid"> + <% $row->error |h %> + </TD> + </TR> +% $i = 1 - $i; +% } +</TABLE> +</DIV> +% } +<%init> +my %opt = @_; + +my $curuser = $FS::CurrentUser::CurrentUser; +my $cust_main = $opt{'cust_main'} + or die "cust_main required"; +my $custnum = $cust_main->custnum; + +my $where = "WHERE cust_msg.custnum = $custnum"; +my $maxrecords = $curuser->option('customer_view_emails') || 10; + +my $order_by = '_date DESC'; + +my $query = { + 'table' => 'cust_msg', + 'select' => join(', ', + 'cust_msg.*', + 'msg_template.msgname', + ), + 'addl_from' => ' LEFT JOIN msg_template USING ( msgnum ) ', + 'hashref' => {}, + 'extra_sql' => $where, + 'order_by' => "ORDER BY $order_by LIMIT $maxrecords", +}; +my $count_query = "SELECT COUNT(*) FROM cust_msg $where"; + +my @rows = qsearch($query); +my $total = FS::Record->scalar_sql($count_query); + +my $sub_popup_link = sub { + my $custmsgnum = $_[0]->custmsgnum; + include('/elements/popup_link_onclick.html', + 'action' => $p. 'view/cust_msg.html?' . $custmsgnum, + 'actionlabel' => 'Message detail', + 'width' => 680, + 'height' => 550, + ); +}; + +my %color = ( + 'failed' => '#FF0000', + 'sent' => '#000000', + + 'invoice' => '#00CC00', + 'receipt' => '#0000CC', + 'admin' => '#CC0000', + '' => '#000000', +); +my $statuscolor = sub { $color{$_[0]->status} }; +my $typecolor = sub { $color{$_[0]->msgtype} }; + +</%init> |