diff options
Diffstat (limited to 'httemplate/elements')
-rw-r--r-- | httemplate/elements/create_uri_query | 21 | ||||
-rw-r--r-- | httemplate/elements/handle_uri_query | 12 | ||||
-rw-r--r-- | httemplate/elements/pager.html | 17 | ||||
-rw-r--r-- | httemplate/elements/searchbar-cust_main.html | 2 | ||||
-rw-r--r-- | httemplate/elements/tr-censustract.html | 23 | ||||
-rw-r--r-- | httemplate/elements/tr-cust_main-phones.html | 45 | ||||
-rw-r--r-- | httemplate/elements/tr-select-cust_location.html | 9 |
7 files changed, 119 insertions, 10 deletions
diff --git a/httemplate/elements/create_uri_query b/httemplate/elements/create_uri_query index 32d8e2f87..ce6249e0e 100644 --- a/httemplate/elements/create_uri_query +++ b/httemplate/elements/create_uri_query @@ -1,17 +1,34 @@ <% $query %>\ <%init> +my %opt = @_; + +if ( $opt{secure} ) { + + foreach my $param (grep /pay(info\d?|cvv)$/, $cgi->param) { + my $value = $cgi->param($param); + next unless length($value); + my $encrypted = FS::Record->encrypt( $value ); + $cgi->param($param, $encrypted); + } + +} + my $query = $cgi->query_string; -if ( length($query) > 1920 ) { #stupid IE 2083 URL limit +if ( length($query) > 1920 || $opt{secure} ) { #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' => $query, - 'expiration' => time + 3600, #1h? 1m? + 'expiration' => time + ( $opt{secure} ? 120 #2m? + : 3600 #1h? + ), }); + local($FS::Record::no_history) = 1; + my $pref_error = $pref->insert; if ( $pref_error ) { die "FATAL: couldn't even set redirect cookie: $pref_error". diff --git a/httemplate/elements/handle_uri_query b/httemplate/elements/handle_uri_query index eb7ea1ae1..2dea96a6d 100644 --- a/httemplate/elements/handle_uri_query +++ b/httemplate/elements/handle_uri_query @@ -1,8 +1,20 @@ <%init> + +my %opt = @_; + if ( $cgi->param('redirect') ) { my $session = $cgi->param('redirect'); + my $pref = $FS::CurrentUser::CurrentUser->option("redirect$session"); die "unknown redirect session $session\n" unless length($pref); $cgi = new CGI($pref); + + foreach my $param (grep /pay(info\d?|cvv)$/, $cgi->param) { + my $value = $cgi->param($param); + next unless length($value); + my $decrypted = FS::Record->decrypt( $value ); + $cgi->param($param, $decrypted); + } + } </%init> diff --git a/httemplate/elements/pager.html b/httemplate/elements/pager.html index a53300f53..d360e6478 100644 --- a/httemplate/elements/pager.html +++ b/httemplate/elements/pager.html @@ -1,13 +1,8 @@ -% my %opt = @_; -% my $pager = ''; -% % if ( $opt{'total'} != $opt{'num_rows'} && $opt{'maxrecords'} ) { % % unless ( $opt{'offset'} == 0 ) { % $cgi->param('offset', $opt{'offset'} - $opt{'maxrecords'}); - <A HREF="<% $cgi->self_url %>"><B><FONT SIZE="+1">Previous</FONT></B></A> - % } % % my $page = 0; @@ -47,9 +42,17 @@ % % unless ( $opt{'offset'} + $opt{'maxrecords'} > $opt{'total'} ) { % $cgi->param('offset', $opt{'offset'} + $opt{'maxrecords'}); - <A HREF="<% $cgi->self_url %>"><B><FONT SIZE="+1">Next</FONT></B></A> -% % } % +% $cgi->param('offset', $orig_offset); #so future $self_url invocations don't advance a page +% % } +<%init> + +my %opt = @_; + +my $orig_offset = $opt{'offset'}; + +</%init> + diff --git a/httemplate/elements/searchbar-cust_main.html b/httemplate/elements/searchbar-cust_main.html index 9a98417c8..5bfef484a 100644 --- a/httemplate/elements/searchbar-cust_main.html +++ b/httemplate/elements/searchbar-cust_main.html @@ -1,6 +1,6 @@ % if ( $curuser->access_right('List customers') ) { - <FORM ACTION="<%$fsurl%>search/cust_main.cgi" METHOD="GET" STYLE="margin:0"> + <FORM ACTION="<%$fsurl%>search/cust_main.cgi" METHOD="POST" STYLE="margin:0"> <INPUT NAME="search_cust" TYPE="text" VALUE="<% $cust_label |n %>" STYLE="width:<%$width%>" onFocus="clearhint_search_cust(this);" onClick="clearhint_search_cust(this);" CLASS="fstext"><BR> <A HREF="<%$fsurl%>search/report_cust_main.html" CLASS="fslink" STYLE="font-size: 11px"><% mt('Advanced') |h %></A> <INPUT TYPE="submit" VALUE="<% mt('Search customers') |h %>" CLASS="fsblackbutton" onMouseOver="this.className='fsblackbuttonselected'; return true;" onMouseOut="this.className='fsblackbutton'; return true;" STYLE="font-size:11px"> diff --git a/httemplate/elements/tr-censustract.html b/httemplate/elements/tr-censustract.html new file mode 100644 index 000000000..bd014f11b --- /dev/null +++ b/httemplate/elements/tr-censustract.html @@ -0,0 +1,23 @@ +% if ($censustract) { +<TR> + <TD ALIGN="right"><% mt('Census tract') |h %></TD> + <TD COLSPAN=5> + <SPAN STYLE="background-color: #ffffff; border: 1px solid #ffffff"><% $censustract |h %></SPAN> + <% $censusyear |h %> + </TD> +</TR> +% } +<%init> + +my $location = shift; +my $conf = FS::Conf->new; +my ($censustract, $censusyear); +if ($location->censustract) { + $censustract = $location->censustract; + $censusyear = '('. ($location->censusyear || mt('unknown year')) . ')'; +} elsif ($conf->exists('cust_main-require_censustract')) { + $censustract = mt('unknown'); + $censusyear = ''; +} + +</%init> diff --git a/httemplate/elements/tr-cust_main-phones.html b/httemplate/elements/tr-cust_main-phones.html new file mode 100644 index 000000000..accf8ac64 --- /dev/null +++ b/httemplate/elements/tr-cust_main-phones.html @@ -0,0 +1,45 @@ + <TR> + <TD ALIGN="right" VALIGN="top"><% mt('Phones') %></TD> + <TD COLSPAN=6> + + <TABLE CELLSPACING=0 CELLPADDING=0> + <TR> + <TD> + <INPUT TYPE="text" NAME="<%$pre%>daytime" VALUE="<% $cust_main->get($pre.'daytime') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>> + <BR><FONT SIZE=-1><% $daytime_label %></FONT> + </TD> + <TD> </TD> + <TD> + <INPUT TYPE="text" NAME="<%$pre%>night" VALUE="<% $cust_main->get($pre.'night') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>> + <BR><FONT SIZE=-1><% $night_label %></FONT> + </TD> + <TD> </TD> + <TD> + <INPUT TYPE="text" NAME="<%$pre%>mobile" VALUE="<% $cust_main->get($pre.'mobile') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>> + <BR><FONT SIZE=-1><% $mobile_label %></FONT> + </TD> + </TR> + </TABLE> + </TD> + </TR> +<%init> + +my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/ + ? 'Day' + : FS::Msgcat::_gettext('daytime'); +my $night_label = FS::Msgcat::_gettext('night') =~/^(night)?$/ + ? 'Night' + : FS::Msgcat::_gettext('night') || 'Night'; +my $mobile_label = FS::Msgcat::_gettext('mobile') =~/^(mobile)?$/ + ? 'Mobile' + : FS::Msgcat::_gettext('mobile') || 'Mobile'; + +my %opt = @_; + +my $pre = $opt{'prefix'}; +my $cust_main = $opt{'cust_main'}; +my $onchange = $opt{'onchange'}; +my $disabled = $opt{'disabled'}; +my $style = $opt{'style'}; + +</%init> diff --git a/httemplate/elements/tr-select-cust_location.html b/httemplate/elements/tr-select-cust_location.html index e1fa825c1..4ed9cd48e 100644 --- a/httemplate/elements/tr-select-cust_location.html +++ b/httemplate/elements/tr-select-cust_location.html @@ -31,6 +31,9 @@ Example: else what.form.<%$_%>.value = ''; if( ftype != 'SELECT') what.form.<%$_%>.style.backgroundColor = '#dddddd'; % } + if(what.form.enter_censustract) { + what.form.enter_censustract.disabled = true; + } } function location_clear(what) { @@ -38,6 +41,9 @@ Example: var ftype = what.form.<%$_%>.tagName; if( ftype == 'INPUT' ) what.form.<%$_%>.value = ''; % } + if(what.form.enter_censustract) { + what.form.enter_censustract.value = ''; + } % if ( $opt{'alt_format'} ) { changeSelect(what.form.location_kind, ''); changeSelect(what.form.location_type, ''); @@ -51,6 +57,9 @@ Example: var ftype = what.form.<%$_%>.tagName; if( ftype != 'SELECT') what.form.<%$_%>.style.backgroundColor = '#ffffff'; % } + if(what.form.enter_censustract) { + what.form.enter_censustract.disabled = false; + } % if ( $opt{'alt_format'} ) { if ( what.form.location_type && what.form.location_type.options[what.form.location_type.selectedIndex].value ) { |