summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/browse/msg_template.html29
-rwxr-xr-xhttemplate/edit/cust_main.cgi2
-rw-r--r--httemplate/edit/cust_main/before_ship_location.html13
-rw-r--r--httemplate/edit/cust_main/contact.html45
-rw-r--r--httemplate/edit/elements/edit.html2
-rwxr-xr-xhttemplate/edit/process/cust_main.cgi4
-rw-r--r--httemplate/edit/process/detach-cust_pkg.html15
-rw-r--r--httemplate/elements/create_uri_query21
-rw-r--r--httemplate/elements/handle_uri_query12
-rw-r--r--httemplate/elements/pager.html17
-rw-r--r--httemplate/elements/searchbar-cust_main.html2
-rw-r--r--httemplate/elements/tr-censustract.html23
-rw-r--r--httemplate/elements/tr-cust_main-phones.html45
-rw-r--r--httemplate/elements/tr-select-cust_location.html9
-rwxr-xr-xhttemplate/misc/detach_pkg.html19
-rw-r--r--httemplate/misc/disable-msg_template.cgi77
-rw-r--r--httemplate/misc/email-customers.html1
-rw-r--r--httemplate/search/cust_bill_pkg.cgi5
-rw-r--r--httemplate/view/cust_main/contacts.html10
-rwxr-xr-xhttemplate/view/cust_main/locations.html49
-rw-r--r--httemplate/view/cust_main/misc.html11
-rw-r--r--httemplate/view/cust_main/packages/location.html72
22 files changed, 365 insertions, 118 deletions
diff --git a/httemplate/browse/msg_template.html b/httemplate/browse/msg_template.html
index bb5ac94a0..ef0b2dafd 100644
--- a/httemplate/browse/msg_template.html
+++ b/httemplate/browse/msg_template.html
@@ -5,14 +5,15 @@
'query' => { 'table' => 'msg_template', },
'count_query' => 'SELECT COUNT(*) FROM msg_template',
'disableable' => 1,
- 'disabled_statuspos' => 2,
+ 'disabled_statuspos' => (scalar(@locales) + 3),
'agent_virt' => 1,
'agent_null_right' => ['View global templates','Edit global templates'],
'agent_pos' => 1,
- 'header' => [ 'Name', '', map '', @locales ],
- 'fields' => [ 'msgname', @locales ],
- 'links' => [ $link, @locale_links ],
- 'cell_style' => [ '', '', map $locale_style, @locales ],
+ 'header' => [ 'Name', '', map ('', @locales), '' ],
+ 'fields' => [ 'msgname', @locales, $disable_link_label ],
+ 'links' => [ $link, @locale_links, '' ],
+ 'link_onclicks' => [ '', map('', @locale_links), $disable_link ],
+ 'cell_style' => [ '', '', map ($locale_style, @locales), $locale_style ],
)
%>
<%init>
@@ -30,7 +31,7 @@ if ( $curuser->access_right(['Edit templates', 'Edit global templates']) ) {
my $link = [ "${p}edit/msg_template.html?msgnum=", 'msgnum' ];
-my $locale_style = 'font-size:0.8em; padding:3px; background-color:';
+my $locale_style = 'font-size:0.8em; padding:3px';
my (@locales, @locale_links);
foreach my $l ( FS::Locales->locales ) {
@@ -44,6 +45,20 @@ foreach my $l ( FS::Locales->locales ) {
[ "${p}edit/msg_template.html?locale=$l;msgnum=", 'msgnum' ];
};
}
-
+
+my $disable_link = sub {
+ my $template = shift;
+ include('/elements/popup_link_onclick.html',
+ action => $p.'misc/disable-msg_template.cgi?msgnum=' .
+ $template->msgnum .
+ ($template->disabled ? ';enable=1' : ''),
+ actionlabel => 'Disable lemplate',
+ );
+};
+
+my $disable_link_label = sub {
+ my $template = shift;
+ $template->disabled ? '(enable)' : '(disable)' ;
+};
</%init>
diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi
index d597d0bc2..480047cae 100755
--- a/httemplate/edit/cust_main.cgi
+++ b/httemplate/edit/cust_main.cgi
@@ -73,6 +73,7 @@
><% mt('same as billing address') |h %>
<DIV CLASS="fsinnerbox">
<TABLE ID="table_ship_location" WIDTH="100%">
+ <& cust_main/before_ship_location.html, $cust_main &>
<& /elements/location.html,
object => $cust_main->ship_location,
prefix => 'ship_',
@@ -202,6 +203,7 @@ my $prospectnum = '';
my $locationnum = '';
my $same = '';
+$m->comp('/elements/handle_uri_query', 'secure'=>1);
if ( $cgi->param('error') ) {
diff --git a/httemplate/edit/cust_main/before_ship_location.html b/httemplate/edit/cust_main/before_ship_location.html
new file mode 100644
index 000000000..badb5e8cd
--- /dev/null
+++ b/httemplate/edit/cust_main/before_ship_location.html
@@ -0,0 +1,13 @@
+% if ( length($cust_main->ship_company) or
+% $conf->exists('show_ship_company') ) {
+ <& /elements/tr-input-text.html,
+ label => mt('Company'),
+ field => 'ship_company',
+ curr_value => $cust_main->ship_company,
+ colspan => 6,
+ &>
+% }
+<%init>
+my $cust_main = shift;
+my $conf = FS::Conf->new;
+</%init>
diff --git a/httemplate/edit/cust_main/contact.html b/httemplate/edit/cust_main/contact.html
index 4140ec1ea..c2ebb093c 100644
--- a/httemplate/edit/cust_main/contact.html
+++ b/httemplate/edit/cust_main/contact.html
@@ -94,30 +94,13 @@
</%def>
<%def phones>
- <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>&nbsp;</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>&nbsp;</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>
+ <& /elements/tr-cust_main-phones.html,
+ 'prefix' => $pre,
+ 'cust_main' => $cust_main,
+ 'onchange' => $onchange,
+ 'disabled' => $disabled,
+ 'style' => $style,
+ &>
</%def>
<%def fax>
@@ -136,9 +119,7 @@ my $r = qq!<font color="#ff0000">*</font>&nbsp;!;
</%once>
<%shared>
-my( %opt, $cust_main, $pre, $onchange, $disabled, @style, $style,
- $daytime_label, $night_label, $mobile_label,
- );
+my( %opt, $cust_main, $pre, $onchange, $disabled, @style, $style );
</%shared>
<%init>
@@ -176,16 +157,6 @@ $opt{geocode} ||= $cust_main->get('geocode');
$opt{censustract} ||= $cust_main->censustract;
-$daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/
- ? 'Day'
- : FS::Msgcat::_gettext('daytime');
-$night_label = FS::Msgcat::_gettext('night') =~/^(night)?$/
- ? 'Night'
- : FS::Msgcat::_gettext('night') || 'Night';
-$mobile_label = FS::Msgcat::_gettext('mobile') =~/^(mobile)?$/
- ? 'Mobile'
- : FS::Msgcat::_gettext('mobile') || 'Mobile';
-
my $stateid_label = FS::Msgcat::_gettext('stateid') =~ /^(stateid)?$/
? 'Driver&rsquo;s License'
: FS::Msgcat::_gettext('stateid') || 'Driver&rsquo;s License';
diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html
index 6c965326b..9e27f2a4c 100644
--- a/httemplate/edit/elements/edit.html
+++ b/httemplate/edit/elements/edit.html
@@ -527,7 +527,7 @@ Example:
% if ( $f->{curr_value_callback} ) {
% $curr_value = &{ $f->{curr_value_callback} }( $cgi, $object, $field ),
% } else {
-% $curr_value = $object->$field();
+% $curr_value = $object->$field() if $field;
% }
% $curr_value = &{ $opt{'value_callback'} }( $f->{'field'}, $curr_value )
% if $opt{'value_callback'} && $mode ne 'error';
diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi
index ff8be1a71..4fb8f622d 100755
--- a/httemplate/edit/process/cust_main.cgi
+++ b/httemplate/edit/process/cust_main.cgi
@@ -1,7 +1,7 @@
% if ( $error ) {
% $cgi->param('error', $error);
-%
-<% $cgi->redirect(popurl(2). "cust_main.cgi?". $cgi->query_string ) %>
+% my $query = $m->scomp('/elements/create_uri_query', 'secure'=>1);
+<% $cgi->redirect(popurl(2). "cust_main.cgi?$query" ) %>
%
% } else {
%
diff --git a/httemplate/edit/process/detach-cust_pkg.html b/httemplate/edit/process/detach-cust_pkg.html
index ab87eb536..782ffa5e0 100644
--- a/httemplate/edit/process/detach-cust_pkg.html
+++ b/httemplate/edit/process/detach-cust_pkg.html
@@ -30,16 +30,23 @@ my $cust_location = new FS::cust_location {
map { $_ => scalar($cgi->param($_)) } FS::cust_main->location_fields
};
+#false laziness w/process/cust_main.cgi
+my @invoicing_list = split( /\s*\,\s*/, $cgi->param('invoicing_list') );
+push @invoicing_list, 'POST' if $cgi->param('invoicing_list_POST');
+push @invoicing_list, 'FAX' if $cgi->param('invoicing_list_FAX');
+$cgi->param('invoicing_list', join(',', @invoicing_list) );
+
my $cust_main = new FS::cust_main {
( map { ( $_, scalar($cgi->param($_)) ) } fields('cust_main') ),
( map { ( "ship_$_", '' ) } FS::cust_main->location_fields ),
- 'bill_location' => $cust_location,
- 'ship_location' => $cust_location,
+ 'bill_location' => $cust_location,
+ 'ship_location' => $cust_location,
};
my $pkg_or_error = $cust_pkg->change( {
- 'keep_dates' => 1,
- 'cust_main' => $cust_main,
+ 'keep_dates' => 1,
+ 'cust_main' => $cust_main,
+ 'cust_main_insert_args' => [ {}, \@invoicing_list ],
} );
my $error = ref($pkg_or_error) ? '' : $pkg_or_error;
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>
+ &nbsp;<% $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>&nbsp;</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>&nbsp;</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 ) {
diff --git a/httemplate/misc/detach_pkg.html b/httemplate/misc/detach_pkg.html
index 64b3e6e3f..366bbac3f 100755
--- a/httemplate/misc/detach_pkg.html
+++ b/httemplate/misc/detach_pkg.html
@@ -50,9 +50,26 @@
</TD>
</TR>
+% if ( $conf->config_bool('cust_main-require_phone') ) {
+% #XXX should be sticky on errors
+% my $ph_cust_main = FS::cust_main->new({});
+% foreach my $contact_phone ( $cust_contact->contact_phone ) {
+% my $t = $contact_phone->typename;
+% #countrycodes? interface doesn't parse/take em yet
+% $ph_cust_main->daytime( $contact_phone->phonenum ) if $t eq 'Work';
+% $ph_cust_main->night( $contact_phone->phonenum ) if $t eq 'Home';
+% $ph_cust_main->mobile( $contact_phone->phonenum ) if $t eq 'Mobile';
+% $ph_cust_main->fax( $contact_phone->phonenum ) if $t eq 'Fax';
+% }
+
+ <& /elements/tr-cust_main-phones.html,
+ 'cust_main' => $ph_cust_main,
+ &>
+% }
+
</TABLE>
-%#XXX payment info
+%#payment info
%#XXX should be sticky on errors...
<& /edit/cust_main/billing.html, FS::cust_main->new({}),
invoicing_list => [],
diff --git a/httemplate/misc/disable-msg_template.cgi b/httemplate/misc/disable-msg_template.cgi
new file mode 100644
index 000000000..1eb4d25e5
--- /dev/null
+++ b/httemplate/misc/disable-msg_template.cgi
@@ -0,0 +1,77 @@
+% if ( @error ) {
+<& /elements/errorpage-popup.html, @error &>
+% } else {
+<& /elements/header-popup.html, "Template ${actioned}" &>
+ <SCRIPT TYPE="text/javascript">
+ window.top.location.reload();
+ </SCRIPT>
+</BODY>
+</HTML>
+% }
+<%init>
+
+my $curuser = $FS::CurrentUser::CurrentUser;
+my $conf = FS::Conf->new;
+my @error;
+my $actioned;
+
+die "access denied"
+ unless $curuser->access_right([ 'Edit templates', 'Edit global templates' ]);
+
+my $msgnum = $cgi->param('msgnum');
+$msgnum =~ /^\d+$/ or die "bad msgnum '$msgnum'";
+my $msg_template = qsearchs({
+ table => 'msg_template',
+ hashref => { msgnum => $msgnum },
+ extra_sql => ' AND '.
+ $curuser->agentnums_sql(null_right => 'Edit global templates'),
+});
+die "unknown msgnum $msgnum" unless $msg_template;
+
+if ( $cgi->param('enable') ) {
+ $actioned = 'enabled';
+ $msg_template->set('disabled' => '');
+} else {
+ $actioned = 'disabled';
+ # make sure it's not in use anywhere
+ my @inuse;
+
+ # notice, letter, notice_to events (if they're enabled)
+ my @events = qsearch({
+ table => 'part_event_option',
+ addl_from => ' JOIN part_event USING (eventpart)',
+ hashref => {
+ optionname => 'msgnum',
+ optionvalue => $msgnum,
+ },
+ extra_sql => ' AND disabled IS NULL',
+ });
+ push @inuse, map {"Billing event #".$_->eventpart} @events;
+
+ # send_email and rt_ticket exports
+ my @exports = qsearch( 'part_export_option', {
+ optionname => { op => 'LIKE', value => '%_template' },
+ optionvalue => $msgnum,
+ });
+ push @inuse, map {"Export #".$_->exportnum} @exports;
+
+ # payment_receipt_msgnum, decline_msgnum, etc.
+ my @confs = qsearch( 'conf', {
+ name => { op => 'LIKE', value => '%_msgnum' },
+ value => $msgnum,
+ });
+ push @inuse, map {"Configuration setting ".$_->name} @confs;
+ # XXX pending queue jobs?
+ if (@inuse) {
+ @error = ("This template is in use. Check the following settings:",
+ @inuse);
+ }
+
+ # good to go
+ $msg_template->set(disabled => 'Y');
+}
+if (!@error) {
+ my $error = $msg_template->replace;
+ push @error, $error if $error;
+}
+</%init>
diff --git a/httemplate/misc/email-customers.html b/httemplate/misc/email-customers.html
index ad67b8d7e..3b2ac3c5f 100644
--- a/httemplate/misc/email-customers.html
+++ b/httemplate/misc/email-customers.html
@@ -98,6 +98,7 @@ Template:
<% include('/elements/select-table.html',
'label' => 'Template:',
'table' => 'msg_template',
+ 'hashref' => { disabled => '' },
'name_col' => 'msgname',
'empty_label' => '(none)',
'onchange' => 'toggle(this)',
diff --git a/httemplate/search/cust_bill_pkg.cgi b/httemplate/search/cust_bill_pkg.cgi
index d86641de3..f87862a3d 100644
--- a/httemplate/search/cust_bill_pkg.cgi
+++ b/httemplate/search/cust_bill_pkg.cgi
@@ -49,8 +49,9 @@
@currency,
'invnum',
'_date',
- #'pay_amount',
- #'credit_amount',
+ '', #'pay_amount',
+ '', #'credit_amount',
+ FS::UI::Web::cust_sort_fields(),
],
'links' => [
@pkgnum_null,
diff --git a/httemplate/view/cust_main/contacts.html b/httemplate/view/cust_main/contacts.html
index d65af669a..294b7babb 100644
--- a/httemplate/view/cust_main/contacts.html
+++ b/httemplate/view/cust_main/contacts.html
@@ -41,7 +41,14 @@
<TD COLSPAN=7 BGCOLOR="#ffffff"><% $cust_main->company |h %></TD>
</TR>
% }
-% } # if $this eq 'bill'
+% } elsif ( $this eq 'ship' ) {
+% if ( $cust_main->ship_company ) { # mostly obsolete these days...
+ <TR>
+ <TD ALIGN="right"><% mt('Company') |h %></TD>
+ <TD COLSPAN=7 BGCOLOR="#ffffff"><% $cust_main->ship_company |h %></TD>
+ </TR>
+% }
+% }
% # now the actual address
<TR>
<TD ALIGN="right"><% mt('Address') |h %></TD>
@@ -84,6 +91,7 @@
$cust_main->agentnum,
&>
% }
+<& /elements/tr-censustract.html, $location &>
% if ( $this eq 'bill' ) {
% # billing contact phone numbers
diff --git a/httemplate/view/cust_main/locations.html b/httemplate/view/cust_main/locations.html
index 7eb52ca46..fdbbc396b 100755
--- a/httemplate/view/cust_main/locations.html
+++ b/httemplate/view/cust_main/locations.html
@@ -1,40 +1,60 @@
<STYLE>
-span.loclabel {
+div.loclabel {
+ display: inline-block;
padding-left: 4px;
padding-right: 4px;
background-color: #cccccc;
- border: 1px solid black
+ border: 1px solid black;
+ border-bottom: 0px;
+ border-radius: 4px 4px 0 0;
+}
+div.disabled {
+ font-style: italic;
+ color: #808080;
}
table.location {
width: 100%;
padding: 1px;
border-spacing: 0px;
}
+.location-head th {
+ padding-bottom: 0px;
+ padding-left: 0px;
+ border-bottom: 1px solid black;
+ vertical-align: bottom;
+ text-align: left;
+ width: 100%;
+}
</STYLE>
% foreach my $locationnum (@sorted) {
% my $packages = $packages_in{$locationnum};
% my $loc = $locations{$locationnum};
% next if $loc->disabled and scalar(@$packages) == 0;
<TABLE CLASS="grid location">
-<TR><TH COLSPAN=3 ALIGN="left" VALIGN="bottom"
-STYLE="padding-bottom: 0px;
- padding-left: 0px;
- border-bottom-style: solid;
- border-bottom-color: black;
- border-bottom-width: 1px;">
-<SPAN CLASS="loclabel">
-% if ( $loc->disabled ) {
-<FONT COLOR="#808080"><I>
+<TR CLASS="location-head">
+<TH COLSPAN=5>
+<DIV CLASS="<% $loc->disabled ? 'loclabel disabled' : 'loclabel' %>">
+<% $loc->location_label %>
+% if ( $loc->censustract ) {
+ <BR>
+ <FONT SIZE=-1>
+ <% $loc->censustract %> (<% $loc->censusyear %> census)
+ </FONT>
+% } elsif ( $conf->exists('cust_main-require_censustract') ) {
+ <BR>
+ <FONT SIZE=-1 COLOR="#ee3300">
+ <% emt('Census tract unknown') %>
+ </FONT>
% }
-<% $loc->location_label %></SPAN>
-<SPAN STYLE="float:right;">
+</DIV>
+<DIV STYLE="display: inline; float:right;">
% if ( $locationnum && !$loc->disabled && ! $opt{no_links} ) {
<% edit_location_link($locationnum) %>
% }
% if ( $locationnum && !$loc->disabled && !$active{$locationnum} && ! $opt{no_links} ) {
&nbsp;<% disable_location_link($locationnum) %>
% }
-</SPAN></TH></TR>
+</DIV></TH></TR>
% if (@$packages) {
<& packages/section.html,
'packages' => $packages,
@@ -48,6 +68,7 @@ STYLE="padding-bottom: 0px;
my %opt = @_;
my $cust_main = $opt{'cust_main'};
my $all_packages = $opt{'packages'};
+my $conf = FS::Conf->new;
my %locations = map { $_->locationnum => $_ } qsearch({
'table' => 'cust_location',
diff --git a/httemplate/view/cust_main/misc.html b/httemplate/view/cust_main/misc.html
index 5311aa5ae..7915195b4 100644
--- a/httemplate/view/cust_main/misc.html
+++ b/httemplate/view/cust_main/misc.html
@@ -171,17 +171,6 @@
% }
-% if ( $conf->exists('cust_main-require_censustract') ) {
-
- <TR>
- <TD ALIGN="right">
- <% mt('Census tract ([_1])', $cust_main->ship_location->censusyear) |h %>
- </TD>
- <TD BGCOLOR="#ffffff"><% $cust_main->ship_location->censustract %></TD>
- </TR>
-
-% }
-
% if ( $cust_main->district ) {
<TR>
diff --git a/httemplate/view/cust_main/packages/location.html b/httemplate/view/cust_main/packages/location.html
index 5ff2b1e1f..db67d45b9 100644
--- a/httemplate/view/cust_main/packages/location.html
+++ b/httemplate/view/cust_main/packages/location.html
@@ -1,35 +1,49 @@
% if ( $cust_pkg->change_from_pkg
-% and $cust_pkg->change_from_pkg->locationnum == $cust_pkg->locationnum )
+% and $cust_pkg->change_from_pkg->locationnum == $cust_pkg->locationnum)
% {
% # don't show the location
% } else {
-% if ( $default ) {
- <DIV STYLE="font-style: italic; font-size: small">
-% }
+% if ( !$conf->exists('cust_pkg-group_by_location') ) {
+% if ( $default ) {
+ <DIV STYLE="font-style: italic; font-size: small">
+% }
- <% $loc->location_label( 'join_string' => '<BR>',
- 'double_space' => ' &nbsp; ',
- 'escape_function' => \&encode_entities,
- 'countrydefault' => $countrydefault,
- )
- %>
+ <% $loc->location_label( 'join_string' => '<BR>',
+ 'double_space' => ' &nbsp; ',
+ 'escape_function' => \&encode_entities,
+ 'countrydefault' => $countrydefault,
+ )
+ %>
-% if ( $loc->latitude && $loc->longitude ) {
- <BR>
- <FONT SIZE=-1>
- <% $loc->latitude %>, <% $loc->longitude %>
- <& /elements/coord-links.html,
- $loc->latitude,
- $loc->longitude,
- $opt{'cust_main'}->name_short. ': '. $opt{'part_pkg'}->pkg,
- $opt{'cust_main'}->agentnum,
- &>
- </FONT>
-% }
+% if ( $loc->latitude && $loc->longitude ) {
+ <BR>
+ <FONT SIZE=-1>
+ <% $loc->latitude %>, <% $loc->longitude %>
+ <& /elements/coord-links.html,
+ $loc->latitude,
+ $loc->longitude,
+ $opt{'cust_main'}->name_short. ': '. $opt{'part_pkg'}->pkg,
+ $opt{'cust_main'}->agentnum,
+ &>
+ </FONT>
+% }
+% if ( $loc->censustract ) {
+ <BR>
+ <FONT SIZE=-1>
+ <% $loc->censustract %> (<% $loc->censusyear %> census)
+ </FONT>
+% } elsif ( $conf->exists('cust_main-require_censustract') ) {
+ <BR>
+ <FONT SIZE=-1 COLOR="#ee3300">
+ <% emt('Census tract unknown') %>
+ </FONT>
+% }
-% if ( $default ) {
- </DIV>
-% }
+% if ( $default ) {
+ </DIV>
+% }
+% } # all of this is hidden if packages are grouped by location, because
+% # it's in the top banner
% if ( ! $cust_pkg->get('cancel')
% && $FS::CurrentUser::CurrentUser->access_right('Change customer package')
@@ -41,11 +55,13 @@
(&nbsp;<%pkg_change_location_link($cust_pkg)%>&nbsp;)
% }
% if ( $cust_pkg->locationnum && ! $opt{no_links} ) {
- (&nbsp;<%edit_location_link($cust_pkg->locationnum)%>&nbsp;)
+ (&nbsp;<%pkg_edit_location_link($cust_pkg->locationnum)%>&nbsp;)
% }
</FONT>
% }
-% }
+% } # if the package is a scheduled future package change without location
+% # change, then don't show any of this at all. It's all implied by the
+% # preceding package.
<%init>
my $conf = new FS::Conf;
@@ -75,7 +91,7 @@ sub pkg_change_location_link {
);
}
-sub edit_location_link {
+sub pkg_edit_location_link {
my $locationnum = shift;
include( '/elements/popup_link.html',
'action' => $p. "edit/cust_location.cgi?locationnum=$locationnum",