From 32db3ad86bcf04e4f34705a396b718061d333f20 Mon Sep 17 00:00:00 2001 From: jeff Date: Tue, 10 Mar 2009 16:14:11 +0000 Subject: merge webpay support in with autoselection of old realtime_bop and realtime_refund_bop --- httemplate/browse/payment_gateway.html | 4 + httemplate/edit/payment_gateway.html | 232 +++++++++++++-------------- httemplate/edit/process/payment_gateway.html | 39 ++--- httemplate/elements/tr-textarea.html | 25 +++ 4 files changed, 153 insertions(+), 147 deletions(-) create mode 100644 httemplate/elements/tr-textarea.html (limited to 'httemplate') diff --git a/httemplate/browse/payment_gateway.html b/httemplate/browse/payment_gateway.html index 848c58a82..a06e5cf7c 100644 --- a/httemplate/browse/payment_gateway.html +++ b/httemplate/browse/payment_gateway.html @@ -10,17 +10,21 @@ }, 'count_query' => $count_query, 'header' => [ '#', + 'Type', 'Gateway', 'Username', 'Password', 'Action', + 'URL', 'Options', ], 'fields' => [ 'gatewaynum', + 'namespace_description', $gateway_sub, 'gateway_username', sub { ' - '; }, 'gateway_action', + 'gateway_callback_url', $options_sub, ], ) diff --git a/httemplate/edit/payment_gateway.html b/httemplate/edit/payment_gateway.html index e3893cf49..2b108f857 100644 --- a/httemplate/edit/payment_gateway.html +++ b/httemplate/edit/payment_gateway.html @@ -1,132 +1,122 @@ -<% include("/elements/header.html","$action Payment gateway", menubar( - 'View all payment gateways' => $p. 'browse/payment_gateway.html', -)) %> - -<% include('/elements/error.html') %> - -
- -Gateway #<% $payment_gateway->gatewaynum || "(NEW)" %> - -<% ntable('#cccccc', 2, '') %> - - - Gateway: - -% if ( $payment_gateway->gatewaynum ) { - - - <% $payment_gateway->gateway_module %> - -% } else { - - - +<% include( 'elements/edit.html', + 'table' => 'payment_gateway', + 'name_singular' => 'Payment gateway', + 'viewall_dir' => 'browse', + 'fields' => $fields, + 'field_callback' => $field_callback, + 'labels' => { + 'gatewaynum' => 'Gateway #', + 'gateway_module' => 'Gateway', + 'gateway_username' => 'Username', + 'gateway_password' => 'Password', + 'gateway_action' => 'Action', + 'gateway_options' => 'Options: (Name/Value pairs, one element per line)', + 'gateway_callback_url' => 'Callback URL', + }, + ) +%> + + + <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); -my $payment_gateway; -if ( $cgi->param('error') ) { - $payment_gateway = new FS::payment_gateway ( { - map { $_, scalar($cgi->param($_)) } fields('payment_gateway') - } ); -} elsif ( $cgi->keywords ) { - my($query) = $cgi->keywords; - $query =~ /^(\d+)$/; - $payment_gateway = qsearchs( 'payment_gateway', { 'gatewaynum' => $1 } ); -} else { #adding - $payment_gateway = new FS::payment_gateway {}; -} -my $action = $payment_gateway->gatewaynum ? 'Edit' : 'Add'; -#my $hashref = $payment_gateway->hashref; +my %modules = ( + '2CheckOut' => 'Business::OnlinePayment', + 'AuthorizeNet' => 'Business::OnlinePayment', + 'BankOfAmerica' => 'Business::OnlinePayment', + 'Beanstream' => 'Business::OnlinePayment', + 'Capstone' => 'Business::OnlinePayment', + 'Cardstream' => 'Business::OnlinePayment', + 'CashCow' => 'Business::OnlinePayment', + 'CyberSource' => 'Business::OnlinePayment', + 'eSec' => 'Business::OnlinePayment', + 'eSelectPlus' => 'Business::OnlinePayment', + 'Exact' => 'Business::OnlinePayment', + 'iAuthorizer' => 'Business::OnlinePayment', + 'Interswitchng' => 'Business::OnlineThirdPartyPayment', + 'IPaymentTPG' => 'Business::OnlinePayment', + 'Jettis' => 'Business::OnlinePayment', + 'LinkPoint' => 'Business::OnlinePayment', + 'MerchantCommerce' => 'Business::OnlinePayment', + 'Network1Financial' => 'Business::OnlinePayment', + 'OCV' => 'Business::OnlinePayment', + 'OpenECHO' => 'Business::OnlinePayment', + 'PayConnect' => 'Business::OnlinePayment', + 'PayflowPro' => 'Business::OnlinePayment', + 'PaymentsGateway' => 'Business::OnlinePayment', + 'PXPost' => 'Business::OnlinePayment', + 'SecureHostingUPG' => 'Business::OnlinePayment', + 'Skipjack' => 'Business::OnlinePayment', + 'StGeorge' => 'Business::OnlinePayment', + 'SurePay' => 'Business::OnlinePayment', + 'TCLink' => 'Business::OnlinePayment', + 'TransactionCentral' => 'Business::OnlinePayment', + 'TransFirsteLink' => 'Business::OnlinePayment', + 'VirtualNet' => 'Business::OnlinePayment', +); + +my @actions = ( + 'Normal Authorization', + 'Authorization Only', + 'Authorization Only, Post Authorization', + ); + +my $fields = [ + { + field => 'gateway_namespace', + type => 'hidden', + curr_value_callback => sub { my($cgi, $object, $fref) = @_; + $modules{$object->gateway_module} + || 'Business::OnlinePayment' + }, + }, + { + field => 'gateway_module', + type => 'select', + options => [ sort { lc($a) cmp lc ($b) } keys %modules ], + onchange => 'setNamespace', + }, + 'gateway_username', + 'gateway_password', + { + field => 'gateway_action', + type => 'select', + options => \@actions, + }, + 'gateway_callback_url', + { + field => 'gateway_options', + type => 'textarea', + curr_value_callback => sub { my($cgi, $object, $fref) = @_; + join("\r", $object->options ); + }, + }, + ]; + +my $field_callback = sub { + my ($cgi, $object, $field_hashref ) = @_; + if ($object->gatewaynum) { + if ( $field_hashref->{field} eq 'gateway_module' ) { + $field_hashref->{type} = 'fixed'; + } + } +}; diff --git a/httemplate/edit/process/payment_gateway.html b/httemplate/edit/process/payment_gateway.html index b16bc3d27..812c988c5 100644 --- a/httemplate/edit/process/payment_gateway.html +++ b/httemplate/edit/process/payment_gateway.html @@ -1,35 +1,22 @@ -%if ( $error ) { -% $cgi->param('error', $error); -<% $cgi->redirect(popurl(2). "payment_gateway.html?". $cgi->query_string ) %> -%} else { -<% $cgi->redirect(popurl(3). "browse/payment_gateway.html") %> -%} +<% include( 'elements/process.html', + 'table' => 'payment_gateway', + 'viewall_dir' => 'browse', + 'args_callback' => $args_callback, + ) +%> <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); -my $gatewaynum = $cgi->param('gatewaynum'); +my $args_callback = sub { + my ( $cgi, $new ) = @_; -my $old = qsearchs('payment_gateway',{'gatewaynum'=>$gatewaynum}) if $gatewaynum; + my @options = split(/\r?\n/, $cgi->param('gateway_options') ); + pop @options + if scalar(@options) % 2 && $options[-1] =~ /^\s*$/; + (@options) +}; -my $new = new FS::payment_gateway ( { - map { - $_, scalar($cgi->param($_)); - } fields('payment_gateway') -} ); - -my @options = split(/\r?\n/, $cgi->param('gateway_options') ); -pop @options - if scalar(@options) % 2 && $options[-1] =~ /^\s*$/; -my %options = @options; - -my $error; -if ( $gatewaynum ) { - $error=$new->replace($old, \%options); -} else { - $error=$new->insert(\%options); - $gatewaynum=$new->getfield('gatewaynum'); -} diff --git a/httemplate/elements/tr-textarea.html b/httemplate/elements/tr-textarea.html new file mode 100644 index 000000000..fb41ac38f --- /dev/null +++ b/httemplate/elements/tr-textarea.html @@ -0,0 +1,25 @@ +<% include('tr-td-label.html', @_ ) %> + + > + + + + + + + +<%init> + +my %opt = @_; + +my $onchange = $opt{'onchange'} + ? 'onChange="'. $opt{'onchange'}. '(this)"' + : ''; + +my $cell_style = $opt{'cell_style'} ? 'STYLE="'. $opt{'cell_style'}. '"' : ''; +my $curr_value = $opt{'curr_value'}; + + -- cgit v1.2.1 From dc24b4b7e2e41dbb3039e9ce367b018fef299ade Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 15 Mar 2009 10:30:26 +0000 Subject: we're not a disk drive manufacturer, don't use halfass base-10 megs/gigs --- httemplate/edit/prepay_credit.cgi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/prepay_credit.cgi b/httemplate/edit/prepay_credit.cgi index 9e1c30ba6..ed404b7cd 100644 --- a/httemplate/edit/prepay_credit.cgi +++ b/httemplate/edit/prepay_credit.cgi @@ -97,14 +97,14 @@ tie my %multiplier, 'Tie::IxHash', tie my %bytemultiplier, 'Tie::IxHash', 1 => 'bytes', - 1000 => 'Kbytes', - 1000000 => 'Mbytes', - 1000000000 => 'Gbytes', + 1024 => 'Kbytes', + 1048576 => 'Mbytes', + 1073741824 => 'Gbytes', ; $cgi->param('multiplier', '60') unless $cgi->param('multiplier'); -$cgi->param('upmultiplier', '1000000') unless $cgi->param('upmultiplier'); -$cgi->param('downmultiplier', '1000000') unless $cgi->param('downmultiplier'); -$cgi->param('totalmultiplier','1000000') unless $cgi->param('totalmultiplier'); +$cgi->param('upmultiplier', '1048576') unless $cgi->param('upmultiplier'); +$cgi->param('downmultiplier', '1048576') unless $cgi->param('downmultiplier'); +$cgi->param('totalmultiplier','1048576') unless $cgi->param('totalmultiplier'); -- cgit v1.2.1 From a53dc991aa0c04c5b9a5d06256100af5e93943e1 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 15 Mar 2009 10:34:30 +0000 Subject: apply byte values from prepaid cards as well as time value, RT#4995 --- httemplate/misc/process/recharge_svc.html | 103 +++++++++++++++--------------- 1 file changed, 51 insertions(+), 52 deletions(-) (limited to 'httemplate') diff --git a/httemplate/misc/process/recharge_svc.html b/httemplate/misc/process/recharge_svc.html index 147b9533a..8c4d13e63 100755 --- a/httemplate/misc/process/recharge_svc.html +++ b/httemplate/misc/process/recharge_svc.html @@ -1,62 +1,13 @@ -%unless ($error) { -% -% my ($amount, $seconds, $up, $down, $total) = (0, 0, 0, 0, 0); -% #should probably use payby.pm but whatever -% if ($payby eq 'PREP') { -% $error = $cust_main->get_prepay($prepaid, \$amount, \$seconds, \$up, \$down, \$total) -% || $svc_acct->increment_seconds($seconds) -% || $svc_acct->increment_upbytes($up) -% || $svc_acct->increment_downbytes($down) -% || $svc_acct->increment_totalbytes($total) -% || $cust_main->insert_cust_pay_prepay( $amount, $prepaid ); -% } elsif ( $payby =~ /^(CARD|DCRD|CHEK|DCHK|LECB|BILL|COMP)$/ ) { -% my $part_pkg = $svc_acct->cust_svc->cust_pkg->part_pkg; -% $amount = $part_pkg->option('recharge_amount', 1); -% my %rhash = map { $_ =~ /^recharge_(.*)$/; $1, $part_pkg->option($_) } -% grep { $part_pkg->option($_, 1) } -% qw ( recharge_seconds recharge_upbytes recharge_downbytes -% recharge_totalbytes ); -% -% my $description = "Recharge"; -% $description .= " $rhash{seconds}s" if $rhash{seconds}; -% $description .= " $rhash{upbytes} up" if $rhash{upbytes}; -% $description .= " $rhash{downbytes} down" if $rhash{downbytes}; -% $description .= " $rhash{totalbytes} total" if $rhash{totalbytes}; -% -% $error = $cust_main->charge($amount, "Recharge " . $svc_acct->label, -% $description, $part_pkg->taxclass); -% -% if ($part_pkg->option('recharge_reset', 1)) { -% $error ||= $svc_acct->set_usage(\%rhash); -% }else{ -% $error ||= $svc_acct->recharge(\%rhash); -% } -% -% my $old_balance = $cust_main->balance; -% $error ||= $cust_main->bill; -% $error ||= $cust_main->apply_payments_and_credits; -% my $bill_error = $cust_main->collect('realtime' => 1) unless $error; -% $error ||= "Failed to collect - $bill_error" -% if $cust_main->balance > $old_balance && $cust_main->balance > 0 -% && $payby ne 'BILL'; -% -% } else { -% $error = "fatal error - unknown payby: $payby"; -% } -%} -% %if ($error) { % $cgi->param('error', $error); -% $dbh->rollback if $oldAutoCommit; -% print $cgi->redirect(popurl(2). "recharge_svc.html?". $cgi->query_string ); -%} -%$dbh->commit or die $dbh->errstr if $oldAutoCommit; -% +<% cgi->redirect(popurl(2). "recharge_svc.html?". $cgi->query_string ) %> +%} else { <% header("Package recharged") %> +%} <%init> my $conf = new FS::Conf; @@ -89,4 +40,52 @@ my $oldAutoCommit = $FS::UID::AutoCommit; local $FS::UID::AutoCommit = 0; my $dbh = dbh; +unless ($error) { + + #should probably use payby.pm but whatever + if ($payby eq 'PREP') { + $error = $cust_main->recharge_prepay( $prepaid ); + } elsif ( $payby =~ /^(CARD|DCRD|CHEK|DCHK|LECB|BILL|COMP)$/ ) { + my $part_pkg = $svc_acct->cust_svc->cust_pkg->part_pkg; + $amount = $part_pkg->option('recharge_amount', 1); + my %rhash = map { $_ =~ /^recharge_(.*)$/; $1, $part_pkg->option($_) } + grep { $part_pkg->option($_, 1) } + qw ( recharge_seconds recharge_upbytes recharge_downbytes + recharge_totalbytes ); + + my $description = "Recharge"; + $description .= " $rhash{seconds}s" if $rhash{seconds}; + $description .= " $rhash{upbytes} up" if $rhash{upbytes}; + $description .= " $rhash{downbytes} down" if $rhash{downbytes}; + $description .= " $rhash{totalbytes} total" if $rhash{totalbytes}; + + $error = $cust_main->charge($amount, "Recharge " . $svc_acct->label, + $description, $part_pkg->taxclass); + + if ($part_pkg->option('recharge_reset', 1)) { + $error ||= $svc_acct->set_usage(\%rhash); + }else{ + $error ||= $svc_acct->recharge(\%rhash); + } + + my $old_balance = $cust_main->balance; + $error ||= $cust_main->bill; + $error ||= $cust_main->apply_payments_and_credits; + my $bill_error = $cust_main->collect('realtime' => 1) unless $error; + $error ||= "Failed to collect - $bill_error" + if $cust_main->balance > $old_balance && $cust_main->balance > 0 + && $payby ne 'BILL'; + + } else { + $error = "fatal error - unknown payby: $payby"; + } + +} + +if ($error) { + $dbh->rollback if $oldAutoCommit; +} else { + $dbh->commit or die $dbh->errstr if $oldAutoCommit; +} + -- cgit v1.2.1 From b6971314b234feb121153158fc05eb0f8865ba74 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 16 Mar 2009 05:54:34 +0000 Subject: fix custnum display on domain view --- httemplate/view/svc_domain.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/svc_domain.cgi b/httemplate/view/svc_domain.cgi index 8c1f4cecd..36577d39c 100755 --- a/httemplate/view/svc_domain.cgi +++ b/httemplate/view/svc_domain.cgi @@ -138,9 +138,9 @@ my $cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); my $pkgnum = $cust_svc->getfield('pkgnum'); my($cust_pkg, $custnum, $display_custnum); if ($pkgnum) { - $cust_pkg =qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); + $cust_pkg = qsearchs('cust_pkg', {'pkgnum'=>$pkgnum} ); $custnum = $cust_pkg->custnum; - $custnum = $cust_pkg->cust_main->display_custnum; + $display_custnum = $cust_pkg->cust_main->display_custnum; } else { $cust_pkg = ''; $custnum = ''; -- cgit v1.2.1 From 26119738eaf2b519d91c855c23986f873303887f Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 16 Mar 2009 07:14:29 +0000 Subject: allow country selection on credit card entry, RT#4997 --- httemplate/elements/location.html | 19 ++++++------ httemplate/misc/payment.cgi | 59 ++++++++----------------------------- httemplate/misc/process/payment.cgi | 2 +- 3 files changed, 24 insertions(+), 56 deletions(-) (limited to 'httemplate') diff --git a/httemplate/elements/location.html b/httemplate/elements/location.html index d7b73a220..6691bc84e 100644 --- a/httemplate/elements/location.html +++ b/httemplate/elements/location.html @@ -3,20 +3,21 @@ Example: include( '/elements/location.html', - 'object' => $cust_main, # or $cust_location - 'prefix' => $pre, #only for cust_main objects - 'onchange' => $javascript, - 'disabled' => $disabled, - 'same_checked' => $same_checked, - 'geocode' => $geocode, #passed through - 'no_asterisks' => 0, #set true to disable the red asterisks next - #to required fields + 'object' => $cust_main, # or $cust_location + 'prefix' => $pre, #only for cust_main objects + 'onchange' => $javascript, + 'disabled' => $disabled, + 'same_checked' => $same_checked, + 'geocode' => $geocode, #passed through + 'no_asterisks' => 0, #set true to disable the red asterisks next + #to required fields + 'address1_label' => 'Address', #label for address ) - <%$r%>Address + <%$r%><% $opt{'address1_label'} || 'Address' %> - Payment amount + Payment amount - - + -% my %part_pkg = (); +% local($FS::cust_pkg::DEBUG) = 2; % foreach my $cust_pkg (@$packages) { % % if ( $bgcolor eq $bgcolor1 ) { @@ -85,18 +85,15 @@ Current packages % $bgcolor = $bgcolor1; % } % -% $part_pkg{$cust_pkg->pkgpart} ||= $cust_pkg->part_pkg; -% $cust_pkg->{'_pkgpart'} ||= $part_pkg{$cust_pkg->pkgpart}; #XXX cache kludge +% $cust_pkg->{'_pkgpart'} = new FS::part_pkg { $cust_pkg->hash }; #quelle klud % % my %iopt = ( % 'bgcolor' => $bgcolor, % 'cust_pkg' => $cust_pkg, -% 'part_pkg' => $part_pkg{$cust_pkg->pkgpart}, +% 'part_pkg' => $cust_pkg->part_pkg, % %conf_opt, % ); % -% my $oldDEBUG = $FS::cust_pkg::DEBUG; -% $FS::cust_pkg::DEBUG = 2; @@ -108,8 +105,6 @@ Current packages <% include('packages/services.html', %iopt) %> -% $FS::cust_pkg::DEBUG = $oldDEBUG; - % }
$"> @@ -24,11 +24,6 @@ % % my( $payinfo, $paycvv, $month, $year ) = ( '', '', '', '' ); % my $payname = $cust_main->first. ' '. $cust_main->getfield('last'); -% my $address1 = $cust_main->address1; -% my $address2 = $cust_main->address2; -% my $city = $cust_main->city; -% my $state = $cust_main->state; -% my $zip = $cust_main->zip; % if ( $cust_main->payby =~ /^(CARD|DCRD)$/ ) { % $payinfo = $cust_main->paymask; % $paycvv = $cust_main->paycvv; @@ -37,13 +32,13 @@ % }
Card number + Card number - + - + - + - - - - - - - - - + <% include( '/elements/location.html', + 'object' => $cust_main, #XXX errors??? + 'no_asterisks' => 1, + 'address1_label' => 'Card billing address', + ) + %> + % } elsif ( $payby eq 'CHEK' ) { % % my( $payinfo1, $payinfo2, $payname, $ss, $paytype, $paystate, diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi index 2baca1e39..ea0c7946d 100644 --- a/httemplate/misc/process/payment.cgi +++ b/httemplate/misc/process/payment.cgi @@ -44,7 +44,7 @@ $cgi->param('payby') =~ /^(CARD|CHEK)$/ or errorpage("illegal payby ". $cgi->param('payby')); my $payby = $1; my %payby2fields = ( - 'CARD' => [ qw( address1 address2 city state zip ) ], + 'CARD' => [ qw( address1 address2 city county state zip country ) ], 'CHEK' => [ qw( ss paytype paystate stateid stateid_state ) ], ); my %type = ( 'CARD' => 'credit card', -- cgit v1.2.1 From d3784b40552e9f00c9d803ac0833e09828c73d96 Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 16 Mar 2009 17:06:40 +0000 Subject: have prizm use service data rather than package data to select a profile RT#4853 --- httemplate/edit/svc_broadband.cgi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/svc_broadband.cgi b/httemplate/edit/svc_broadband.cgi index e60c76c90..01e58cdc4 100644 --- a/httemplate/edit/svc_broadband.cgi +++ b/httemplate/edit/svc_broadband.cgi @@ -14,6 +14,7 @@ 'longitude' => 'Longitude', 'altitude' => 'Altitude', 'vlan_profile' => 'VLAN profile', + 'performance_profile' => 'Performance profile', 'authkey' => 'Authentication key', }, 'fields' => \@fields, @@ -34,7 +35,7 @@ my $conf = new FS::Conf; my @fields = ( qw( description ip_addr speed_down speed_up blocknum ), { field=>'block_label', type=>'fixed' }, - qw( mac_addr latitude longitude altitude vlan_profile authkey ) + qw( mac_addr latitude longitude altitude vlan_profile performance_profile authkey ) ); my $fixedblock = ''; -- cgit v1.2.1 From 2755d4a4810600f4392eaf73f362b4f358adeec6 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 17 Mar 2009 09:58:17 +0000 Subject: add eps preview to config, for RT#5025 --- httemplate/config/config-image.cgi | 5 ++++- httemplate/config/config-view.cgi | 32 +++++++++++++++++++++----------- httemplate/docs/credits.html | 11 ++++++++--- httemplate/docs/license.html | 4 ++++ 4 files changed, 37 insertions(+), 15 deletions(-) (limited to 'httemplate') diff --git a/httemplate/config/config-image.cgi b/httemplate/config/config-image.cgi index 892f7c65b..0de9d4278 100644 --- a/httemplate/config/config-image.cgi +++ b/httemplate/config/config-image.cgi @@ -1,4 +1,4 @@ -<% $conf->config_binary($name, $agentnum) %> +<% $logo %> <%init> die "access denied" @@ -16,4 +16,7 @@ if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) { $agentnum = $1; } +my $logo = $conf->config_binary($name, $agentnum); +$logo = eps2png($logo) if $name =~ /\.eps$/i; + diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi index 0f5fd6213..f2ae892a6 100644 --- a/httemplate/config/config-view.cgi +++ b/httemplate/config/config-view.cgi @@ -69,22 +69,32 @@ Click on a configuration value to change it. % } elsif ( $type eq 'image' ) { - - <% $conf->exists($i->key, $agentnum) - ? '' - : 'empty' - %> + + + + % } elsif ( $type eq 'binary' ) { - - <% $conf->exists($i->key, $agentnum) - ? qq!download! - : 'empty' - %> + % } elsif ( $type eq 'textarea' diff --git a/httemplate/docs/credits.html b/httemplate/docs/credits.html index 3c5564da3..38d384bcf 100644 --- a/httemplate/docs/credits.html +++ b/httemplate/docs/credits.html @@ -33,7 +33,7 @@
-

Core team

+

Core Team

Peter Bowen
Jeff Finucane
Jason Hall
@@ -42,6 +42,11 @@ Ivan Kohler
Richard Siddall

+

Core Emeritus

+Brian McCane
+Matt Simerson
+
+

Contributors

Stephen Amadei
Eric Arvidsson
@@ -57,6 +62,7 @@ Rebecca Cardennis
Shane Chrisp
Luke Crawford
Brad Dameron
+Jeremy Davis
Dave Denney
Serge Dolgov
Scott Edwards
@@ -74,19 +80,18 @@ Greg Kuhnert
Randall Lucas
Foteos Macrides
Roger Mangraviti
-Brian McCane
mimooh
Mack Nagashima
Matt Peterson
Luke Pfeifer
Ricardo Signes
-Matt Simerson
Steve Simitzis
Jason Spence
James Switzer
Audrey Tang
Jason Thomas
Jesse Vincent
+Johan Vromans
Mark Wells
Peter Wemm
Mark Williamson
diff --git a/httemplate/docs/license.html b/httemplate/docs/license.html index 54537307e..a673bc9dd 100644 --- a/httemplate/docs/license.html +++ b/httemplate/docs/license.html @@ -100,6 +100,10 @@ terms of the BSD license.
© 2005 modernmethod, inc
Perl backend version © 2005 Nathan Schmidt +

+Contains code derived from eps2png by Johan Vromans, licensed under the same +terms as Perl (GPL/Artistic). +

-- cgit v1.2.1 From 037c3acd250f637182019d0a74361d5420f29c52 Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 18 Mar 2009 00:30:43 +0000 Subject: hide unused usage columns --- httemplate/edit/part_svc.cgi | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index e0fb615b1..deb3c80f9 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -131,7 +131,14 @@ that field. % % #yucky kludge % my @fields = defined( dbdef->table($layer) ) -% ? grep { $_ ne 'svcnum' } fields($layer) +% ? grep { +% $_ ne 'svcnum' && +% ( !FS::part_svc->svc_table_fields($layer) +% ->{$_}->{disable_part_svc_column} || +% $part_svc->part_svc_column($_)->columnflag +% ) +% } +% fields($layer) % : (); % push @fields, 'usergroup' if $layer eq 'svc_acct'; #kludge % $part_svc->svcpart($clone) if $clone; #haha, undone below -- cgit v1.2.1 From 1613980c5c93d0bdf8699d44ff22ecf828abf122 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 22 Mar 2009 02:47:36 +0000 Subject: fix usps address standardization when the zip returned has no zip+4, RT#4882 --- httemplate/misc/xmlhttp-cust_main-address_standardize.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/misc/xmlhttp-cust_main-address_standardize.html b/httemplate/misc/xmlhttp-cust_main-address_standardize.html index 72fa4a464..3b9e142f5 100644 --- a/httemplate/misc/xmlhttp-cust_main-address_standardize.html +++ b/httemplate/misc/xmlhttp-cust_main-address_standardize.html @@ -50,6 +50,9 @@ if ( $sub eq 'address_standardize' ) { unless ( $verifier->is_error ) { + my $zip = $hash->{Zip5}; + $zip .= '-'. $hash->{Zip4} if $hash->{Zip4} =~ /\d/; + $return = { %$return, "new_$pre".'company' => $hash->{FirmName}, @@ -57,7 +60,7 @@ if ( $sub eq 'address_standardize' ) { "new_$pre".'address2' => $hash->{Address1}, "new_$pre".'city' => $hash->{City}, "new_$pre".'state' => $hash->{State}, - "new_$pre".'zip' => $hash->{Zip5}. '-'. $hash->{Zip4}, + "new_$pre".'zip' => $zip, }; my @fields = (qw( company address1 address2 city state zip )); #hmm -- cgit v1.2.1 From ad57c5c8513d0980165e3088518ddddeba0db633 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 23 Mar 2009 22:45:42 +0000 Subject: change label for svc_acct.finger from GECOS to "Real Name", RT#3519 --- httemplate/edit/svc_acct.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index 58283ef54..b9a587d2a 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -168,7 +168,7 @@ Service # <% $svcnum ? "$svcnum" : " (NEW)" %>

- + -- cgit v1.2.1 From 42682206b4ba30de01c82743042f5fb9d48a93ed Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 23 Mar 2009 23:33:04 +0000 Subject: more DTRT with usage on service transfer between packages and recharges RT #2884, #5040 + #4995 fallout --- httemplate/misc/process/recharge_svc.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/misc/process/recharge_svc.html b/httemplate/misc/process/recharge_svc.html index 8c4d13e63..5f68bf151 100755 --- a/httemplate/misc/process/recharge_svc.html +++ b/httemplate/misc/process/recharge_svc.html @@ -1,6 +1,6 @@ %if ($error) { % $cgi->param('error', $error); -<% cgi->redirect(popurl(2). "recharge_svc.html?". $cgi->query_string ) %> +<% $cgi->redirect(popurl(2). "recharge_svc.html?". $cgi->query_string ) %> %} else { <% header("Package recharged") %> + + + + + + +%} + + + + + + +<%init> + +my $conf = new FS::Conf; + +my %opt = @_; + +my $pre_label = $opt{'pre_label'} || ''; +$pre_label .= ' ' if length($pre_label) && $pre_label =~ /\S$/; + +my $cust_main = $opt{'cust_main'} + or die "cust_main not specified"; + +#my @pkg_class = sort { $a->classname cmp $b->classname } +# qsearch( 'pkg_class', { 'disabled' => '' } ); + +#"normal" part_pkg agent virtualization (agentnum or type) +my @part_pkg = qsearch({ + 'select' => 'DISTINCT classnum', + 'table' => 'part_pkg', + 'hashref' => { 'disabled' => '' }, + 'extra_sql' => + ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql( 'null'=>1 ). + ' AND '. FS::part_pkg->agent_pkgs_sql( $opt{'cust_main'}->agent ), +}); + +my @pkg_class = + sort { $a->classname cmp $b->classname } #should get a sort order in config + map { $_->pkg_class || new FS::pkg_class { 'classnum' => '', + 'classname' => '(none)' } + } + @part_pkg; + + diff --git a/httemplate/elements/tr-selectmultiple-part_pkg.html b/httemplate/elements/tr-selectmultiple-part_pkg.html index 455038da9..d959a5bae 100644 --- a/httemplate/elements/tr-selectmultiple-part_pkg.html +++ b/httemplate/elements/tr-selectmultiple-part_pkg.html @@ -2,11 +2,10 @@ - - - - - + + <% include('/elements/tr-select-cust-part_pkg.html', + 'pre_label' => 'New', + 'curr_value' => scalar($cgi->param('pkgpart')), + 'classnum' => $part_pkg->classnum, + 'cust_main' => $cust_main, + #'extra_sql' => ' AND pkgpart != '. $cust_pkg->pkgpart, + ) + %> <% include('/elements/tr-select-cust_location.html', 'cgi' => $cgi, diff --git a/httemplate/misc/cust-part_pkg.cgi b/httemplate/misc/cust-part_pkg.cgi new file mode 100644 index 000000000..a249f033f --- /dev/null +++ b/httemplate/misc/cust-part_pkg.cgi @@ -0,0 +1,29 @@ +<% objToJson( \@return ) %> +<%init> + +my( $custnum, $classnum ) = $cgi->param('arg'); + +#XXX i guess i should be agent-virtualized. cause "packages a customer can +#order" is such a huge deal +my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ); + +my %hash = ( 'disabled' => '' ); +if ( $classnum > 0 ) { + $hash{'classnum'} = $classnum; +} elsif ( $classnum eq '' || $classnum == 0 ) { + $hash{'classnum'} = ''; +} #else -1, all classes, so don't set classnum + +my @part_pkg = qsearch({ + 'table' => 'part_pkg', + 'hashref' => \%hash, + 'extra_sql' => + ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql( 'null'=>1 ). + ' AND '. FS::part_pkg->agent_pkgs_sql( $cust_main->agent ), +}); + +my @return = map { $_->pkgpart => $_->pkg_comment } + sort { $a->pkg_comment cmp $b->pkg_comment } + @part_pkg; + + diff --git a/httemplate/misc/order_pkg.html b/httemplate/misc/order_pkg.html index 2c8335154..9caa57a69 100644 --- a/httemplate/misc/order_pkg.html +++ b/httemplate/misc/order_pkg.html @@ -19,17 +19,13 @@ <% ntable("#cccccc", 2) %> - - - - +<% include('/elements/tr-select-cust-part_pkg.html', + 'curr_value' => $pkgpart, + 'classnum' => -1, + 'cust_main' => $cust_main, + 'onchange' => 'enable_order_pkg', + ) +%> % if ( $conf->exists('pkg_referral') ) { <% include('/elements/tr-select-part_referral.html', -- cgit v1.2.1 From 320bcf3afbae18935ab954d1a738e9502d53955f Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 29 Mar 2009 09:38:30 +0000 Subject: optimize customer view when there's lots of packages; *really* avoid looking up any config inside the package loop, RT#5083 --- .../view/cust_main/one_time_charge_link.html | 82 ++++++++++++ httemplate/view/cust_main/packages.html | 142 +++++---------------- httemplate/view/cust_main/packages/status.html | 4 +- 3 files changed, 116 insertions(+), 112 deletions(-) create mode 100644 httemplate/view/cust_main/one_time_charge_link.html (limited to 'httemplate') diff --git a/httemplate/view/cust_main/one_time_charge_link.html b/httemplate/view/cust_main/one_time_charge_link.html new file mode 100644 index 000000000..6ed70ee4c --- /dev/null +++ b/httemplate/view/cust_main/one_time_charge_link.html @@ -0,0 +1,82 @@ + + + + + + + + + + +<% include('/elements/popup_link.html', { + 'action' => $p.'edit/quick-charge.html?custnum='. $cust_main->custnum, + 'label' => 'One-time charge', + 'actionlabel' => 'One-time charge', + 'color' => '#333399', + 'width' => 763, + 'height' => 408, + }) +%> + +<%init> + +my($cust_main) = @_; + + diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 2c258881a..72846b8ec 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -1,94 +1,25 @@ Packages
-% if ( $curuser->access_right('One-time charge') ) { - - -
- - - - - -% } - % my $s = 0; % if ( $curuser->access_right('Order customer package') ) { <% $s++ ? ' | ' : '' %> - <% order_pkg_link($cust_main) %> + <% include( '/elements/popup_link-cust_main.html', + 'action' => $p. 'misc/order_pkg.html', + 'label' => 'Order new package', + 'actionlabel' => 'Order new package', + 'color' => '#333399', + 'cust_main' => $cust_main, + 'closetext' => 'Close', + 'width' => 763, + ) + %> % } % if ( $curuser->access_right('One-time charge') % && $conf->config('payby-default') ne 'HIDE' % ) { -% <% $s++ ? ' | ' : '' %> - <% include('/elements/popup_link.html', - { - 'action' => $p. 'edit/quick-charge.html?custnum='. $cust_main->custnum, - 'label' => 'One-time charge', - 'actionlabel' => 'One-time charge', - 'color' => '#333399', - 'width' => 763, - 'height' => 408, - }) - %> + <% include('one_time_charge_link.html', $cust_main) %> % } % if ( $curuser->access_right('Bulk change customer packages') ) { @@ -146,24 +77,11 @@ Current packages % $bgcolor = $bgcolor1; % } % -% my $countrydefault = scalar($conf->config('countrydefault')) || 'US'; % my %iopt = ( -% 'bgcolor' => $bgcolor, -% 'cust_pkg' => $cust_pkg, -% 'part_pkg' => $cust_pkg->part_pkg, -% -% #for services.html and status.html -% 'cust_pkg-display_times' => $conf->exists('cust_pkg-display_times'), -% -% #for location.html -% 'countrydefault' => $countrydefault, -% 'statedefault' => ( scalar($conf->config('statedefault')) -% || ($countrydefault eq 'US' ? 'CA' : '') ), -% -% #for services.html -% 'svc_external-skip_manual' => $conf->exists('svc_external-skip_manual'), -% 'legacy_link' => $conf->exists('legacy_link'), -% +% 'bgcolor' => $bgcolor, +% 'cust_pkg' => $cust_pkg, +% 'part_pkg' => $cust_pkg->part_pkg, +% %conf_opt, % ); @@ -193,6 +111,7 @@ Current packages if ( el ) el.scrollIntoView(true); % } + <%init> my( $cust_main ) = @_; @@ -205,6 +124,23 @@ my $packages = get_packages($cust_main, $conf); my $show_location = $conf->exists('cust_pkg-always_show_location') || ( grep $_->locationnum, @$packages ); # ? '1' : '0'; +my $countrydefault = scalar($conf->config('countrydefault')) || 'US'; +my %conf_opt = ( + #for services.html and status.html + 'cust_pkg-display_times' => $conf->exists('cust_pkg-display_times'), + + #for status.html + 'cust_pkg-show_autosuspend' => $conf->exists('cust_pkg-show_autosuspend'), + + #for location.html + 'countrydefault' => $countrydefault, + 'statedefault' => ( scalar($conf->config('statedefault')) + || ($countrydefault eq 'US' ? 'CA' : '') ), + #for services.html + 'svc_external-skip_manual' => $conf->exists('svc_external-skip_manual'), + 'legacy_link' => $conf->exists('legacy_link'), +); + #subroutines sub get_packages { @@ -226,16 +162,4 @@ sub get_packages { [ $cust_main->$method() ]; } -sub order_pkg_link { - include( '/elements/popup_link-cust_main.html', - 'action' => $p. 'misc/order_pkg.html', - 'label' => 'Order new package', - 'actionlabel' => 'Order new package', - 'color' => '#333399', - 'cust_main' => shift, - 'closetext' => 'Close', - 'width' => 763, - ) -} - diff --git a/httemplate/view/cust_main/packages/status.html b/httemplate/view/cust_main/packages/status.html index 106137ba9..af407b0df 100644 --- a/httemplate/view/cust_main/packages/status.html +++ b/httemplate/view/cust_main/packages/status.html @@ -122,7 +122,7 @@ % % } % -% if ( $conf->exists('cust_pkg-show_autosuspend') ) { +% if ( $opt{'cust_pkg-show_autosuspend'} ) { % my $autosuspend = pkg_autosuspend_time( $cust_pkg ); % $cust_pkg->set('autosuspend', $autosuspend) if $autosuspend; % } @@ -170,8 +170,6 @@ my %opt = @_; -my $conf = new FS::Conf; - my $bgcolor = $opt{'bgcolor'}; my $cust_pkg = $opt{'cust_pkg'}; my $part_pkg = $opt{'part_pkg'}; -- cgit v1.2.1 From 3a1f501e679daa106fa4fe826ad70608bb033f54 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 29 Mar 2009 10:34:20 +0000 Subject: avoid looking up package details redundantly in the pkg loop, RT#5083 --- httemplate/view/cust_main/packages/package.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main/packages/package.html b/httemplate/view/cust_main/packages/package.html index b07e1af94..c56fa0bdc 100644 --- a/httemplate/view/cust_main/packages/package.html +++ b/httemplate/view/cust_main/packages/package.html @@ -58,18 +58,18 @@ % my $editi = $curuser->access_right('Edit customer package invoice details'); % my $editc = $curuser->access_right('Edit customer package comments'); +% my @cust_pkg_detail = $cust_pkg->cust_pkg_detail; +% my @invoice_detail = grep { $_->detailtype eq 'I' } @cust_pkg_detail; +% my @comments = grep { $_->detailtype eq 'C' } @cust_pkg_detail; % -% if ( $cust_pkg->cust_pkg_detail('I') -% || $cust_pkg->cust_pkg_detail('C') -% || $editi -% || $editc ) { +% if ( scalar(@invoice_detail) || scalar(@comments) || $editi || $editc ) { % % my $editlink = $p. 'edit/cust_pkg_detail?pkgnum='. $cust_pkg->pkgnum. % ';detailtype=';
-% if ( $cust_pkg->cust_pkg_detail('I') ) { +% if ( @invoice_detail ) { @@ -89,7 +89,7 @@ -% foreach my $cust_pkg_detail ( $cust_pkg->cust_pkg_detail('I') ) { +% foreach my $cust_pkg_detail ( @invoice_detail ) { @@ -113,7 +113,7 @@ % } -% if ( $cust_pkg->cust_pkg_detail('C') ) { +% if ( @comments ) { @@ -133,7 +133,7 @@ -% foreach my $cust_pkg_detail ( $cust_pkg->cust_pkg_detail('C') ) { +% foreach my $cust_pkg_detail ( @comments ) { -- cgit v1.2.1 From 77d3d252f8e577de62f0bd5d6d267bc2fd2e5278 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 29 Mar 2009 10:39:57 +0000 Subject: avoid looking up part_pkg redundantly in the pkg loop, RT#5083 --- httemplate/view/cust_main/packages/package.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main/packages/package.html b/httemplate/view/cust_main/packages/package.html index c56fa0bdc..5edbb4d59 100644 --- a/httemplate/view/cust_main/packages/package.html +++ b/httemplate/view/cust_main/packages/package.html @@ -38,7 +38,7 @@ % % if ( $curuser->access_right('Customize customer package') ) { % $br=1; - ( <%pkg_customize_link($cust_pkg,$cust_pkg->custnum)%> ) + ( <%pkg_customize_link($cust_pkg,$part_pkg)%> ) % } % <% $br ? '
' : '' %> @@ -198,9 +198,10 @@ sub pkg_dates_link { pkg_link('edit/REAL_cust_pkg', 'Edit dates', @_ ); } sub pkg_customize_link { my $cust_pkg = shift or return ''; + my $part_pkg = shift; my $custnum = $cust_pkg->custnum; qq!Customize!; } -- cgit v1.2.1 From 75989a32bd20f0ab3d38d2cd2c05795ea9b7590d Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 29 Mar 2009 23:44:12 +0000 Subject: hide over 2 (or configured) cancelled and one-time charge packages, RT#5083 --- httemplate/view/cust_main/packages.html | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 72846b8ec..7643e3efd 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -53,6 +53,13 @@ Current packages cancelled packages ) % } +% if ( $num_old_packages ) { +% $cgi->param('showoldpackages', 1); + ( show old packages ) +% } elsif ( $cgi->param('showoldpackages') ) { +% $cgi->param('showoldpackages', 0); + ( hide old packages ) +% } % if ( @$packages ) { <% include('/elements/table-grid.html') %> @@ -119,7 +126,7 @@ my $conf = new FS::Conf; my $curuser = $FS::CurrentUser::CurrentUser; -my $packages = get_packages($cust_main, $conf); +my( $packages, $num_old_packages ) = get_packages($cust_main, $conf); my $show_location = $conf->exists('cust_pkg-always_show_location') || ( grep $_->locationnum, @$packages ); # ? '1' : '0'; @@ -146,8 +153,7 @@ my %conf_opt = ( sub get_packages { my $cust_main = shift or return undef; my $conf = shift; - - my @packages = (); + my $method; if ( $cgi->param('showcancelledpackages') eq '0' #see if it was set by me || ( $conf->exists('hidecancelledpackages') @@ -159,7 +165,26 @@ sub get_packages { $method = 'all_pkgs'; } - [ $cust_main->$method() ]; + my @packages = $cust_main->$method(); + my $num_old_packages = scalar(@packages); + + unless ( $cgi->param('showoldpackages') ) { + my $years = $conf->config('cust_main-packages-years') || 2; + my $seconds = 31556926; #60*60*24*365.2422 is close enough + my $then = time - $seconds; + + my %hide = ( 'cancelled' => 'cancel', + 'one-time charge' => 'setup', + ); + + @packages = + grep { !exists($hide{$_->status}) or $_->get($hide{$_->status}) > $then } + @packages; + } + + $num_old_packages -= scalar(@packages); + + ( \@packages, $num_old_packages ); } -- cgit v1.2.1 From 3b5ccffae54e59c012eb1ebb348207510ca1d5ce Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 30 Mar 2009 00:32:03 +0000 Subject: part_pkg caching should speedup display of lots of packages, RT#5083 --- httemplate/view/cust_main/packages.html | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 7643e3efd..9b1d5b317 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -76,6 +76,7 @@ Current packages
+% my %part_pkg = (); % foreach my $cust_pkg (@$packages) { % % if ( $bgcolor eq $bgcolor1 ) { @@ -84,12 +85,18 @@ Current packages % $bgcolor = $bgcolor1; % } % +% $part_pkg{$cust_pkg->pkgpart} ||= $cust_pkg->part_pkg; +% $cust_pkg->{'_pkgpart'} ||= $part_pkg{$cust_pkg->pkgpart}; #XXX cache kludge +% % my %iopt = ( % 'bgcolor' => $bgcolor, % 'cust_pkg' => $cust_pkg, -% 'part_pkg' => $cust_pkg->part_pkg, +% 'part_pkg' => $part_pkg{$cust_pkg->pkgpart}, % %conf_opt, % ); +% +% my $oldDEBUG = $FS::cust_pkg::DEBUG; +% $FS::cust_pkg::DEBUG = 2; @@ -101,6 +108,8 @@ Current packages <% include('packages/services.html', %iopt) %> +% $FS::cust_pkg::DEBUG = $oldDEBUG; + % }
Exp.Exp.
CVV2CVV2 (help)
Exact name on cardExact name on card
Card billing address - -
Address line 2 - -
City - - - - - - - - -
- - State - - Zip - -
-
+ <% $conf->exists($i->key, $agentnum) + ? '' + : 'empty' + %> +
+ <% $conf->exists($i->key, $agentnum) + ? qq!download! + : '' + %> +
+ <% $conf->exists($i->key, $agentnum) + ? qq!download! + : 'empty' + %> +
GECOSReal Name
Package Class + <% include('/elements/select-cust-pkg_class.html', + 'curr_value' => $opt{'classnum'}, + 'pkg_class' => \@pkg_class, + 'onchange' => 'classnum_changed', + ) + %> +
Package + <% include('/elements/select-cust-part_pkg.html', + 'curr_value' => $opt{'curr_value'}, #$pkgpart + 'classnum' => $opt{'classnum'}, + 'cust_main' => $opt{'cust_main'}, #$cust_main + 'onchange' => 'enable_order_pkg', + ) + %> +
<% $opt{'label'} || 'Packages' %> <% include( '/elements/select-table.html', - 'table' => 'part_pkg', - 'name_col' => 'pkg', - 'value' => '', - 'empty_label' => '(none)', - 'element_etc' => 'multiple', + 'table' => 'part_pkg', + 'name_col' => 'pkg', + 'disable_empty' => 1, + 'element_etc' => 'multiple', %opt, ) %> diff --git a/httemplate/misc/change_pkg.cgi b/httemplate/misc/change_pkg.cgi index c4dfca200..16b707121 100755 --- a/httemplate/misc/change_pkg.cgi +++ b/httemplate/misc/change_pkg.cgi @@ -13,19 +13,15 @@ <% $curuser->option('show_pkgnum') ? $cust_pkg->pkgnum.': ' : '' %><% $part_pkg->pkg |h %> - <% $part_pkg->comment |h %>
New package - <% include('/elements/select-cust-part_pkg.html', - 'cust_main' => $cust_main, - 'element_name' => 'pkgpart', - #'extra_sql' => ' AND pkgpart != '. $cust_pkg->pkgpart, - 'curr_value' => scalar($cgi->param('pkgpart')), - ) - %> -
Package - <% include('/elements/select-cust-part_pkg.html', - 'curr_value' => $pkgpart, - 'cust_main' => $cust_main, - 'onchange' => 'enable_order_pkg', - ) - %> -
<% include('/elements/table-grid.html') %>
 - <% $cust_pkg_detail->detail |h %>
<% include('/elements/table-grid.html') %>
 - <% $cust_pkg_detail->detail |h %>
Services
-- cgit v1.2.1 From 4a525836ffb9fa8a941c11247637543d931733b8 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 30 Mar 2009 01:05:04 +0000 Subject: forget caching, instead scoop up cust_pkg and part_pkg in one query, RT#5083 --- httemplate/view/cust_main/packages.html | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 9b1d5b317..56bc63fd0 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -76,7 +76,7 @@ Current packages
Services
@@ -174,7 +169,10 @@ sub get_packages { $method = 'all_pkgs'; } - my @packages = $cust_main->$method(); + my @packages = $cust_main->$method( { + 'select' => 'cust_pkg.*, part_pkg.*', + 'addl_from' => 'LEFT JOIN part_pkg USING ( pkgpart )' + } ); my $num_old_packages = scalar(@packages); unless ( $cgi->param('showoldpackages') ) { -- cgit v1.2.1 From a852ab2648b1496a0010276c2e3b516211190671 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 30 Mar 2009 01:09:01 +0000 Subject: forget caching, instead scoop up cust_pkg and part_pkg in one query, RT#5083 --- httemplate/view/cust_main/packages.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 56bc63fd0..07601dd54 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -76,7 +76,7 @@ Current packages Services -% local($FS::cust_pkg::DEBUG) = 2; +% $FS::cust_pkg::DEBUG = 2; % foreach my $cust_pkg (@$packages) { % % if ( $bgcolor eq $bgcolor1 ) { -- cgit v1.2.1 From c9ac50fa78dcf1f9ac3dda747448ee8ef703d69c Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 30 Mar 2009 01:28:40 +0000 Subject: fix setup date display, RT#5083 --- httemplate/view/cust_main/packages.html | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 07601dd54..8ff2269ab 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -85,6 +85,9 @@ Current packages % $bgcolor = $bgcolor1; % } % +% my %hash = $cust_pkg->hash; +% my %part_pkg = map { /^part_pkg_(.+)$/ or die; $1 => $hash{$_}; } +% grep { /^part_pkg_/ } keys %hash; % $cust_pkg->{'_pkgpart'} = new FS::part_pkg { $cust_pkg->hash }; #quelle klud % % my %iopt = ( @@ -169,8 +172,12 @@ sub get_packages { $method = 'all_pkgs'; } + my $part_pkg_fields = join(', ', map { "part_pkg.$_ AS part_pkg_$_" } + fields('part_pkg') + ); + my @packages = $cust_main->$method( { - 'select' => 'cust_pkg.*, part_pkg.*', + 'select' => "cust_pkg.*, $part_pkg_fields", 'addl_from' => 'LEFT JOIN part_pkg USING ( pkgpart )' } ); my $num_old_packages = scalar(@packages); -- cgit v1.2.1 From ff2ad3e74efe8173d362003e1efdce5953388acf Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 30 Mar 2009 01:39:26 +0000 Subject: doh, fix pkg display, RT#5083 --- httemplate/view/cust_main/packages.html | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 8ff2269ab..9b13a8f97 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -86,9 +86,9 @@ Current packages % } % % my %hash = $cust_pkg->hash; -% my %part_pkg = map { /^part_pkg_(.+)$/ or die; $1 => $hash{$_}; } +% my %part_pkg = map { /^part_pkg_(.+)$/ or die; ( $1 => $hash{$_} ); } % grep { /^part_pkg_/ } keys %hash; -% $cust_pkg->{'_pkgpart'} = new FS::part_pkg { $cust_pkg->hash }; #quelle klud +% $cust_pkg->{'_pkgpart'} = new FS::part_pkg \%part_pkg; % % my %iopt = ( % 'bgcolor' => $bgcolor, @@ -172,12 +172,14 @@ sub get_packages { $method = 'all_pkgs'; } - my $part_pkg_fields = join(', ', map { "part_pkg.$_ AS part_pkg_$_" } - fields('part_pkg') - ); + my $cust_pkg_fields = + join(', ', map { "cust_pkg.$_ AS $_" } fields('cust_pkg') ); + + my $part_pkg_fields = + join(', ', map { "part_pkg.$_ AS part_pkg_$_" } fields('part_pkg') ); my @packages = $cust_main->$method( { - 'select' => "cust_pkg.*, $part_pkg_fields", + 'select' => "$cust_pkg_fields, $part_pkg_fields", 'addl_from' => 'LEFT JOIN part_pkg USING ( pkgpart )' } ); my $num_old_packages = scalar(@packages); -- cgit v1.2.1 From 77df77ea5cc49c10d8768d25d54332dc0833466e Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 30 Mar 2009 03:12:25 +0000 Subject: really prevent separate part_pkg query, RT#5083 --- httemplate/view/cust_main/packages.html | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 9b13a8f97..001e6ec82 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -85,11 +85,6 @@ Current packages % $bgcolor = $bgcolor1; % } % -% my %hash = $cust_pkg->hash; -% my %part_pkg = map { /^part_pkg_(.+)$/ or die; ( $1 => $hash{$_} ); } -% grep { /^part_pkg_/ } keys %hash; -% $cust_pkg->{'_pkgpart'} = new FS::part_pkg \%part_pkg; -% % my %iopt = ( % 'bgcolor' => $bgcolor, % 'cust_pkg' => $cust_pkg, @@ -184,6 +179,13 @@ sub get_packages { } ); my $num_old_packages = scalar(@packages); + foreach my $cust_pkg ( @packages ) { + my %hash = $cust_pkg->hash; + my %part_pkg = map { /^part_pkg_(.+)$/ or die; ( $1 => $hash{$_} ); } + grep { /^part_pkg_/ } keys %hash; + $cust_pkg->{'_pkgpart'} = new FS::part_pkg \%part_pkg; + } + unless ( $cgi->param('showoldpackages') ) { my $years = $conf->config('cust_main-packages-years') || 2; my $seconds = 31556926; #60*60*24*365.2422 is close enough -- cgit v1.2.1 From 613f320ae076de8612ff80fc99c516b544ff3897 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 30 Mar 2009 04:15:56 +0000 Subject: try not to search for nothing in cust_svc so much, RT#5083 --- httemplate/view/cust_main/packages.html | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 001e6ec82..d98de8e63 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -173,9 +173,17 @@ sub get_packages { my $part_pkg_fields = join(', ', map { "part_pkg.$_ AS part_pkg_$_" } fields('part_pkg') ); + my $group_by = + join(', ', map "cust_pkg.$_", fields('cust_pkg') ). ', '. + join(', ', map "part_pkg.$_", fields('part_pkg') ); + + my $num_cust_svc = + '( SELECT COUNT(*) FROM cust_svc WHERE cust_pkg.pkgnum = cust_svc.svcnum )'; + my @packages = $cust_main->$method( { - 'select' => "$cust_pkg_fields, $part_pkg_fields", - 'addl_from' => 'LEFT JOIN part_pkg USING ( pkgpart )' + 'select' => " $cust_pkg_fields, $part_pkg_fields, ". + " $num_cust_svc AS num_cust_svc ", + 'addl_from' => ' LEFT JOIN part_pkg USING ( pkgpart ) ', } ); my $num_old_packages = scalar(@packages); -- cgit v1.2.1 From 5ef6e82fad107523eae428d3fea51e2302c99cb6 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 30 Mar 2009 04:31:47 +0000 Subject: try not to search for nothing in cust_svc so much, RT#5083 --- httemplate/view/cust_main/packages.html | 1 + 1 file changed, 1 insertion(+) (limited to 'httemplate') diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index d98de8e63..20d42a48e 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -192,6 +192,7 @@ sub get_packages { my %part_pkg = map { /^part_pkg_(.+)$/ or die; ( $1 => $hash{$_} ); } grep { /^part_pkg_/ } keys %hash; $cust_pkg->{'_pkgpart'} = new FS::part_pkg \%part_pkg; + $cust_pkg->{'_num_cust_svc'} = $cust_pkg->get('_num_cust_svc'); } unless ( $cgi->param('showoldpackages') ) { -- cgit v1.2.1 From dbd43e72a0cc7510f344b133c8f0b6ac8dd07c51 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 30 Mar 2009 04:35:39 +0000 Subject: doh! underscore, RT#5083 --- httemplate/view/cust_main/packages.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 20d42a48e..aa1d7e721 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -192,7 +192,7 @@ sub get_packages { my %part_pkg = map { /^part_pkg_(.+)$/ or die; ( $1 => $hash{$_} ); } grep { /^part_pkg_/ } keys %hash; $cust_pkg->{'_pkgpart'} = new FS::part_pkg \%part_pkg; - $cust_pkg->{'_num_cust_svc'} = $cust_pkg->get('_num_cust_svc'); + $cust_pkg->{'_num_cust_svc'} = $cust_pkg->get('num_cust_svc'); } unless ( $cgi->param('showoldpackages') ) { -- cgit v1.2.1 From 631063078b0e9ac6d53616f42c32eec30a76d24b Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 30 Mar 2009 04:41:33 +0000 Subject: double doh! RT#5083 --- httemplate/view/cust_main/packages.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index aa1d7e721..53ed6bf2b 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -178,7 +178,7 @@ sub get_packages { join(', ', map "part_pkg.$_", fields('part_pkg') ); my $num_cust_svc = - '( SELECT COUNT(*) FROM cust_svc WHERE cust_pkg.pkgnum = cust_svc.svcnum )'; + '( SELECT COUNT(*) FROM cust_svc WHERE cust_pkg.pkgnum = cust_svc.pkgnum )'; my @packages = $cust_main->$method( { 'select' => " $cust_pkg_fields, $part_pkg_fields, ". -- cgit v1.2.1 From cec41a47c4cbb9eda007713e376970addc9ac626 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 30 Mar 2009 06:10:18 +0000 Subject: okay. counts are needed for the package sort, so push the embedded counting into cust_main.pm. sure hope this does it. RT#5083 --- httemplate/view/cust_main/packages.html | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 53ed6bf2b..d55560f34 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -177,13 +177,9 @@ sub get_packages { join(', ', map "cust_pkg.$_", fields('cust_pkg') ). ', '. join(', ', map "part_pkg.$_", fields('part_pkg') ); - my $num_cust_svc = - '( SELECT COUNT(*) FROM cust_svc WHERE cust_pkg.pkgnum = cust_svc.pkgnum )'; - my @packages = $cust_main->$method( { - 'select' => " $cust_pkg_fields, $part_pkg_fields, ". - " $num_cust_svc AS num_cust_svc ", - 'addl_from' => ' LEFT JOIN part_pkg USING ( pkgpart ) ', + 'select' => "$cust_pkg_fields, $part_pkg_fields", + 'addl_from' => 'LEFT JOIN part_pkg USING ( pkgpart )', } ); my $num_old_packages = scalar(@packages); @@ -192,7 +188,6 @@ sub get_packages { my %part_pkg = map { /^part_pkg_(.+)$/ or die; ( $1 => $hash{$_} ); } grep { /^part_pkg_/ } keys %hash; $cust_pkg->{'_pkgpart'} = new FS::part_pkg \%part_pkg; - $cust_pkg->{'_num_cust_svc'} = $cust_pkg->get('num_cust_svc'); } unless ( $cgi->param('showoldpackages') ) { -- cgit v1.2.1 From d983a08166ca2bfcc16062a4e6820f8985569394 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 2 Apr 2009 00:14:30 +0000 Subject: add some (undocumented/unaccessable to web UI yet) options to package browse to track down packages missing recurring fees --- httemplate/browse/part_pkg.cgi | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index 801c09f8f..26028b6ad 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -10,7 +10,7 @@ 'agent_pos' => 5, 'query' => { 'select' => $select, 'table' => 'part_pkg', - 'hashref' => {}, + 'hashref' => \%hash, 'extra_sql' => $extra_sql, 'order_by' => "ORDER BY $orderby" }, @@ -41,14 +41,37 @@ my $money_char = $conf->config('money_char') || '$'; my $select = '*'; my $orderby = 'pkgpart'; +my %hash = (); +my $extra_count = ''; + if ( $cgi->param('active') ) { $orderby = 'num_active DESC'; } my $extra_sql = ''; +#if ( $cgi->param('activeONLY') ) { +# $extra_sql = ' WHERE num_active > 0 '; #XXX doesn't affect count... +#} + +if ( $cgi->param('recurring') ) { + $hash{'freq'} = { op=>'!=', value=>'0' }; + $extra_count = ' freq != 0 '; +} + +if ( $cgi->param('missing_recur_fee') ) { + my $missing = "0 = ( SELECT COUNT(*) FROM part_pkg_option + WHERE optionname = 'recur_fee' + AND part_pkg_option.pkgpart = part_pkg.pkgpart + AND CAST ( optionvalue AS NUMERIC ) > 0 + )"; + $extra_sql .= ( ( scalar(keys %hash) || $extra_sql ) ? ' AND ' : ' WHERE ' ). + $missing; +} + unless ( $acl_edit_global ) { - $extra_sql .= ' WHERE '. FS::part_pkg->curuser_pkgs_sql; + $extra_sql .= ( ( scalar(keys %hash) || $extra_sql ) ? ' AND ' : ' WHERE ' ). + FS::part_pkg->curuser_pkgs_sql; } my $agentnums = join(',', $curuser->agentnums); @@ -188,9 +211,7 @@ if ( $acl_edit_global ) { my $typelink = $p. 'edit/agent_type.cgi?'; push @fields, sub { my $part_pkg = shift; [ - map { warn $_; - my $agent_type = $_->agent_type; - warn $agent_type; + map { my $agent_type = $_->agent_type; [ { 'data' => $agent_type->atype, #escape? 'align' => 'left', @@ -362,6 +383,10 @@ $align .= 'lrl'; #rr'; # -------- -my $count_query = "SELECT COUNT(*) FROM part_pkg $extra_sql"; +my $count_extra_sql = $extra_sql; +$count_extra_sql =~ s/^\s*AND /WHERE /i; +$extra_count = ( $count_extra_sql ? ' AND ' : ' WHERE ' ). $extra_count + if $extra_count; +my $count_query = "SELECT COUNT(*) FROM part_pkg $count_extra_sql $extra_count"; -- cgit v1.2.1 From 00bb047761ea320fb7f1a2b8e45820d6c539b3e0 Mon Sep 17 00:00:00 2001 From: jeff Date: Thu, 2 Apr 2009 14:56:30 +0000 Subject: obey tax-ship_address in 'manual' geocoding --- httemplate/edit/cust_main.cgi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index d3004f1c6..098de848e 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -363,12 +363,12 @@ function update_address(arg) { if ( <% $taxpre %>error ) { - if ( document.bottomform.elements['country'].value == 'CA' || - document.bottomform.elements['country'].value == 'US' + if ( document.bottomform.elements['<% $taxpre %>country'].value == 'CA' || + document.bottomform.elements['<% $taxpre %>country'].value == 'US' ) { - var url = "cust_main/choose_tax_location.html?data_vendor=cch-zip;city="+document.bottomform.elements['city'].value+";state="+document.bottomform.elements['state'].value+";zip="+document.bottomform.elements['zip'].value+";country="+document.bottomform.elements['country'].value+";"; + var url = "cust_main/choose_tax_location.html?data_vendor=cch-zip;city="+document.bottomform.elements['<% $taxpre %>city'].value+";state="+document.bottomform.elements['<% $taxpre %>state'].value+";zip="+document.bottomform.elements['<% $taxpre %>zip'].value+";country="+document.bottomform.elements['<% $taxpre %>country'].value+";"; // popup a chooser OLgetAJAX( url, update_geocode, 300 ); @@ -483,9 +483,9 @@ function update_geocode() { //alert(what.options[what.selectedIndex].value); var argsHash = eval('(' + what.options[what.selectedIndex].value + ')'); - document.bottomform.elements['city'].value = argsHash['city']; - document.bottomform.elements['state'].value = argsHash['state']; - document.bottomform.elements['zip'].value = argsHash['zip']; + document.bottomform.elements['<% $taxpre %>city'].value = argsHash['city']; + document.bottomform.elements['<% $taxpre %>state'].value = argsHash['state']; + document.bottomform.elements['<% $taxpre %>zip'].value = argsHash['zip']; document.bottomform.elements['geocode'].value = argsHash['geocode']; } -- cgit v1.2.1 From 8e9fad68fed8b7821fd7736b7947fb45983ff9c0 Mon Sep 17 00:00:00 2001 From: jeff Date: Thu, 2 Apr 2009 20:22:32 +0000 Subject: Net 20 as well --- httemplate/edit/cust_main/billing.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html index 8724db9dc..e175e21cc 100644 --- a/httemplate/edit/cust_main/billing.html +++ b/httemplate/edit/cust_main/billing.html @@ -429,7 +429,7 @@ % if ( $custnum ) { @@ -19,101 +23,16 @@

% } -<% &ntable("#cccccc") %> - -%# agent -<% include('/elements/tr-select-agent.html', - 'curr_value' => $cust_main->agentnum, - 'label' => "${r}Agent", - 'empty_label' => 'Select agent', - 'disable_empty' => ( $cust_main->agentnum ? 1 : 0 ), - ) -%> - -%# agent_custid -% if ( $conf->exists('cust_main-edit_agent_custid') ) { - - - Customer identifier - - - -% } else { - - - -% } - -%# referral (advertising source) -%my $refnum = $cust_main->refnum || $conf->config('referraldefault') || 0; -%if ( $custnum && ! $conf->exists('editreferrals') ) { - - - -% } else { - - <% include('/elements/tr-select-part_referral.html', - 'curr_value' => $refnum - ) - %> -% } - - -%# referring customer -%my $referring_cust_main = ''; -%if ( $cust_main->referral_custnum -% and $referring_cust_main = -% qsearchs('cust_main', { custnum => $cust_main->referral_custnum } ) -%) { - - - Referring customer - - <% $cust_main->referral_custnum %>: <% $referring_cust_main->name %> - - - -% } elsif ( ! $conf->exists('disable_customer_referrals') ) { - - - - Referring customer - - - <% include('/elements/search-cust_main.html', - 'field_name' => 'referral_custnum', - ) - %> - - -% } else { - - - -% } - - - - - +%# agent, agent_custid, refnum (advertising source), referral_custnum +<% include('cust_main/top_misc.html', $cust_main, 'custnum' => $custnum ) %> +%# birthdate % if ( $conf->exists('cust_main-enable_birthdate') ) { -
- <% 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('cust_main/birthdate.html', $cust_main) %> % } - +%# contact info % my $same_checked = ''; % my $ship_disabled = ''; @@ -129,7 +48,8 @@ % }

-Billing address +Billing address + <% include('cust_main/contact.html', 'cust_main' => $cust_main, 'pre' => '', @@ -199,7 +119,8 @@ function samechanged(what) {
-Service address +Service address + (>same as billing address) <% include('cust_main/contact.html', 'cust_main' => $cust_main, @@ -209,473 +130,69 @@ Service address ) %> - - - +%# billing info <% include( 'cust_main/billing.html', $cust_main, 'payinfo' => $payinfo, 'invoicing_list' => \@invoicing_list, ) %> -<% include( '/elements/xmlhttp.html', - 'url' => $p.'misc/xmlhttp-cust_main-address_standardize.html', - 'subs' => [ 'address_standardize' ], - #'method' => 'POST', #could get too long? - ) -%> - - + -
% foreach my $hidden ( -% 'birthdate', -% -% 'custnum', 'agentnum', 'agent_custid', 'refnum', 'referral_custnum', -% 'last', 'first', 'ss', 'company', -% 'address1', 'address2', 'city', -% 'county', 'state', 'zip', 'country', -% 'daytime', 'night', 'fax', -% 'stateid', 'stateid_state', -% -% 'same', -% -% 'ship_last', 'ship_first', 'ship_company', -% 'ship_address1', 'ship_address2', 'ship_city', -% 'ship_county', 'ship_state', 'ship_zip', 'ship_country', -% 'ship_daytime','ship_night', 'ship_fax', -% -% 'geocode', -% -% 'select', #XXX key -% -% 'payauto', -% 'payinfo', 'payinfo1', 'payinfo2', 'paytype', -% 'payname', 'paystate', 'exp_month', 'exp_year', 'paycvv', -% 'paystart_month', 'paystart_year', 'payissue', -% 'payip', -% 'paid', -% -% 'tax', -% 'invoicing_list', 'invoicing_list_POST', 'invoicing_list_FAX', -% 'invoice_terms', -% 'spool_cdr', -% 'squelch_cdr' -% ) { -% - - -% } -% -% my $ro_comments = $conf->exists('cust_main-use_comments')?'':'readonly'; -% if (!$ro_comments || $cust_main->comments) { - -
Comments -<% &ntable("#cccccc") %> - - - - - - -% -% } -% -%unless ( $custnum ) { -% # pry the wrong place for this logic. also pretty expensive -% #use FS::part_pkg; -% -% #false laziness, copied from FS::cust_pkg::order -% my $pkgpart; -% my $agentnum = ''; -% my @agents = $FS::CurrentUser::CurrentUser->agents; -% if ( scalar(@agents) == 1 ) { -% # $pkgpart->{PKGPART} is true iff $custnum may purchase PKGPART -% $pkgpart = $agents[0]->pkgpart_hashref; -% $agentnum = $agents[0]->agentnum; -% } else { -% #can't know (agent not chosen), so, allow all -% $agentnum = 'all'; -% my %typenum; -% foreach my $agent ( @agents ) { -% next if $typenum{$agent->typenum}++; -% $pkgpart->{$_}++ foreach keys %{ $agent->pkgpart_hashref } -% } -% } -% #eslaf -% -% my @part_pkg = grep { $_->svcpart('svc_acct') -% && ( $pkgpart->{ $_->pkgpart } -% || $agentnum eq 'all' -% || ( $agentnum ne 'all' -% && $agentnum -% && $_->agentnum -% && $_->agentnum == $agentnum -% ) -% ) -% } -% qsearch( 'part_pkg', { 'disabled' => '' }, '', 'ORDER BY pkg' ); # case? -% -% if ( @part_pkg ) { -% -% # print "

First package", &itable("#cccccc", "0 ALIGN=LEFT"), -% #apiabuse & undesirable wrapping -% -% - -
First package - <% ntable("#cccccc") %> - - - - <% include('cust_main/select-domain.html', - 'pkgparts' => \@part_pkg, - 'saved_pkgpart' => $saved_pkgpart, - 'saved_domsvc' => $saved_domsvc, - ) - %> - - -% -% #false laziness: (mostly) copied from edit/svc_acct.cgi -% #$ulen = $svc_acct->dbdef_table->column('username')->length; -% my $ulen = dbdef->table('svc_acct')->column('username')->length; -% my $ulen2 = $ulen+2; -% my $passwordmax = $conf->config('passwordmax') || 8; -% my $pmax2 = $passwordmax + 2; -% - - - - Username - - MAXLENGTH=<% $ulen %>> - - - - - Domain - - - - - - - Password - - MAXLENGTH=<% $passwordmax %>> - (blank to generate) - - - - - Access number - <% FS::svc_acct_pop::popselector($popnum) %> - - -% } +% 'payauto', +% 'payinfo', 'payinfo1', 'payinfo2', 'paytype', +% 'payname', 'paystate', 'exp_month', 'exp_year', 'paycvv', +% 'paystart_month', 'paystart_year', 'payissue', +% 'payip', +% 'paid', +% ) { + % } +<% include('cust_main/bottomfixup.html') %> - -
-" onClick="document.bottomform.submitButton.disabled=true; bottomfixup(this.form);">
+" + onClick = "this.disabled=true; bottomfixup(this.form);" +>
<% include('/elements/footer.html') %> @@ -685,52 +202,49 @@ function copyelement(from, to) { die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Edit customer'); -#for misplaced logic below -#use FS::part_pkg; - -#for false laziness below (now more properly lazy) -#use FS::svc_acct_pop; - -#for (other) false laziness below -#use FS::agent; -#use FS::type_pkgs; - my $conf = new FS::Conf; -my $taxpre = $conf->exists('tax-ship_address') ? 'ship_' : ''; #get record -my($custnum, $username, $password, $popnum, $cust_main, $saved_pkgpart, $saved_domsvc); -my(@invoicing_list); -my ($ss,$stateid,$payinfo); +my($custnum, $cust_main, $ss, $stateid, $payinfo, @invoicing_list); my $same = ''; +my $pkgpart_svcpart = ''; #first_pkg +my($username, $password, $popnum, $saved_domsvc) = ( '', '', 0, 0 ); #svc_acct +my %svc_phone = (); + if ( $cgi->param('error') ) { + $cust_main = new FS::cust_main ( { map { $_, scalar($cgi->param($_)) } fields('cust_main') } ); + $custnum = $cust_main->custnum; - $saved_domsvc = $cgi->param('domsvc') || ''; - if ( $saved_domsvc =~ /^(\d+)$/ ) { - $saved_domsvc = $1; - } else { - $saved_domsvc = ''; - } - $saved_pkgpart = $cgi->param('pkgpart_svcpart') || ''; - if ( $saved_pkgpart =~ /^(\d+)_/ ) { - $saved_pkgpart = $1; - } else { - $saved_pkgpart = ''; - } - $username = $cgi->param('username'); - $password = $cgi->param('_password'); - $popnum = $cgi->param('popnum'); @invoicing_list = split( /\s*,\s*/, $cgi->param('invoicing_list') ); $same = $cgi->param('same'); $cust_main->setfield('paid' => $cgi->param('paid')) if $cgi->param('paid'); $ss = $cust_main->ss; # don't mask an entered value on errors $stateid = $cust_main->stateid; # don't mask an entered value on errors $payinfo = $cust_main->payinfo; # don't mask an entered value on errors + + $pkgpart_svcpart = $cgi->param('pkgpart_svcpart') || ''; + + #svc_acct + $username = $cgi->param('username'); + $password = $cgi->param('_password'); + $popnum = $cgi->param('popnum'); + $saved_domsvc = $cgi->param('domsvc') || ''; + if ( $saved_domsvc =~ /^(\d+)$/ ) { + $saved_domsvc = $1; + } else { + $saved_domsvc = ''; + } + + #svc_phone + $svc_phone{$_} = $cgi->param($_) + foreach qw( countrycode phonenum sip_password pin phone_name ); + } elsif ( $cgi->keywords ) { #editing + my( $query ) = $cgi->keywords; $query =~ /^(\d+)$/; $custnum=$1; @@ -741,31 +255,24 @@ if ( $cgi->param('error') ) { $paycvv =~ s/./*/g; $cust_main->paycvv($paycvv); } - $saved_pkgpart = 0; - $saved_domsvc = 0; - $username = ''; - $password = ''; - $popnum = 0; @invoicing_list = $cust_main->invoicing_list; $ss = $cust_main->masked('ss'); $stateid = $cust_main->masked('stateid'); $payinfo = $cust_main->paymask; -} else { + +} else { #new customer + $custnum=''; $cust_main = new FS::cust_main ( {} ); $cust_main->otaker( &getotaker ); $cust_main->referral_custnum( $cgi->param('referral_custnum') ); - $saved_pkgpart = 0; - $saved_domsvc = 0; - $username = ''; - $password = ''; - $popnum = 0; @invoicing_list = (); push @invoicing_list, 'POST' unless $conf->exists('disablepostalinvoicedefault'); $ss = ''; $stateid = ''; $payinfo = ''; + } my $error = $cgi->param('error'); diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html index e175e21cc..353f2b9a0 100644 --- a/httemplate/edit/cust_main/billing.html +++ b/httemplate/edit/cust_main/billing.html @@ -1,18 +1,15 @@ %if ( $payby_default eq 'HIDE' ) { % % $cust_main->payby('BILL') unless $cust_main->payby; +% my $payby = $cust_main->payby; - - - - -
+ - + % foreach my $field (qw( payname paycvv paystart_month paystart_year payissue payip paytype paystate )) { - + % } @@ -27,24 +24,18 @@ % die "unrecognized expiration date format: $date"; % } - - - -
- -
+ + -
- % } else { % % my $r = qq!* !; -
Billing information +
Billing information <% &ntable("#cccccc") %> @@ -128,13 +119,13 @@ % ''. % % qq!!. -% qq!!. +% qq!!. % % qq!!. % '!. -% '!. % '!. +% '!. % % qq!!. -% qq!!. +% qq!!. % -% qq!'. +% qq!'. % % '
${r}Card number
${r}Expiration '. % % include('/elements/select-month_year.html', -% 'prefix' => 'exp', +% 'prefix' => 'CARD_exp', % 'selected_date' => % ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->paydate : '' ), % ). @@ -145,14 +136,14 @@ % % qq!(help)!. % qq!'. +% ''. % % % qq!
Start date '. % % include('/elements/select-month_year.html', -% 'prefix' => 'paystart', +% 'prefix' => 'CARD_paystart', % 'disabled' => $disabled, % 'empty_option' => 1, % 'start_year' => 2000, @@ -167,12 +158,12 @@ % ). % % qq! or Issue number !. -% '
${r}Exact name on card
Charge future payments to this card automatically
Charge future payments to this card automatically
', % @@ -181,21 +172,21 @@ % ''. % % qq!!. -% qq!'. -% qq!'. +% qq!!. % % qq!!. -% qq!!. % -% qq!!. -% qq!!. +% qq!!. +% qq!!. % % qq!!. -% qq!!. +% qq!!. % ( $conf->exists('show_bankstate') ? % qq!!. % qq!" -% : '' % ). % % -% qq!'. +% qq!'. % % ''. % ''. @@ -223,11 +214,11 @@ % '
${r}Account number TypeType
${r}ABA/Routing number !. +% qq! !. % qq!(help)!. % qq!
${r}Bank name
$paystate_label!. @@ -203,14 +194,14 @@ % 'empty' => '(choose)', % 'state' => $cust_main->paystate, % 'country' => $cust_main->country, -% 'prefix' => 'pay', +% 'prefix' => 'CHEK_pay', % ). "
Charge future payments to this electronic check automatically
Charge future payments to this electronic check automatically
 
 
'. % % qq!!. -% qq!!. +% qq!!. % -% qq!!. -% qq!!. -% qq!!. +% qq!!. +% qq!!. +% qq!!. % % ''. % ''. @@ -243,13 +234,13 @@ % '
${r}Phone number
 
 
'. % % qq!!. -% qq!!. +% qq!!. % -% qq!!. -% qq!!. +% qq!!. +% qq!!. % % qq!!. -% qq!!. +% qq!!. % % ''. % ''. @@ -264,13 +255,13 @@ % '
P.O.
Attention
 
 
'. % % qq!!. -% qq!!. +% qq!!. % % qq!!. % '
${r}Approved by
${r}Expiration '. % % include('/elements/select-month_year.html', -% 'prefix' => 'exp', +% 'prefix' => 'COMP_exp', % 'selected_date' => % ( $payby eq 'COMP' ? $cust_main->paydate : '' ), % ). @@ -290,7 +281,7 @@ % ''. % % qq!!. -% qq!!. +% qq!!. % % ''. % ''. @@ -306,7 +297,7 @@ % '
${r}Amount
 
 
'. % % qq!!. -% qq!!. +% qq!!. % % ''. % ''. @@ -322,7 +313,7 @@ % '
${r}Amount
 
 
'. % % qq!!. -% qq!!. +% qq!!. % % ''. % ''. @@ -336,48 +327,33 @@ % ); % % #this should use FS::payby -% my %allopt = ( -% 'CARD' => 'Credit card', -% 'CHEK' => 'Electronic check', -% 'LECB' => 'Phone bill billing', -% 'BILL' => 'Billing', -% 'CASH' => 'Cash', # initial payment, then billing', -% 'WEST' => 'Western Union', # initial payment, then billing', -% 'MCRD' => 'Manual credit card', # initial payment, then billing', -% 'COMP' => 'Complimentary', -% ); -% if ( $cust_main->custnum ) { #don't offer CASH/WEST/MCRD initial payment types -% # when editing customer +% my @allopt = qw( CARD CHEK LECB BILL CASH WEST MCRD COMP ); +% +% my %allopt = map { $_ => FS::payby->shortname($_) } @allopt; +% +% if ( $cust_main->custnum ) { +% #don't offer CASH/WEST/MCRD initial payment types when editing customer % delete $allopt{$_} for qw(CASH WEST MCRD); % } % -% tie my %options, 'Tie::IxHash', -% map { $_ => $allopt{$_} } -% grep { exists $allopt{$_} } -% @payby; +% my @options = grep exists( $allopt{$_} ), @payby; % % my %payby2option = ( -% ( map { $_ => $_ } keys %options ), +% ( map { $_ => $_ } @options ), % 'DCRD' => 'CARD', % 'DCHK' => 'CHEK', % ); -% -% my $widget = new HTML::Widgets::SelectLayers( -% 'options' => \%options, -% #'form_name' => 'dummy', -% #'form_action' => 'nothingyet', -% #chops bottom of page in IE# 'under_position' => 'absolute', -% 'html_between' => '
${r}Amount
 
 
', -% 'selected_layer' => $payby2option{$payby || $payby_default || $payby[0] }, -% 'layer_callback' => sub { my $layer = shift; $payby{$layer}; }, -% ); -% -% - -
<% $widget->html %> - -
+
+ <% include( '/elements/selectlayers.html', + 'field' => 'payby', + 'curr_value' => $payby2option{$payby || $payby_default || $payby[0] }, + 'options' => \@options, + 'labels' => \%allopt, + 'html_between' => '
', + 'layer_callback' => sub { my $layer = shift; $payby{$layer}; }, + ) + %> <% &ntable("#cccccc") %> @@ -457,8 +433,6 @@ - - <% $r %> required fields % } diff --git a/httemplate/edit/cust_main/birthdate.html b/httemplate/edit/cust_main/birthdate.html new file mode 100644 index 000000000..415aba3c4 --- /dev/null +++ b/httemplate/edit/cust_main/birthdate.html @@ -0,0 +1,15 @@ +<% 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) + %> + +<%init> + +my( $cust_main, %opt ) = @_; +my $conf = new FS::Conf; + + diff --git a/httemplate/edit/cust_main/bottomfixup.html b/httemplate/edit/cust_main/bottomfixup.html new file mode 100644 index 000000000..3eb43e0e5 --- /dev/null +++ b/httemplate/edit/cust_main/bottomfixup.html @@ -0,0 +1,12 @@ +<% include('/elements/init_overlib.html') %> + +<% include( '/elements/xmlhttp.html', + 'url' => $p.'misc/xmlhttp-cust_main-address_standardize.html', + 'subs' => [ 'address_standardize' ], + #'method' => 'POST', #could get too long? + ) +%> + + diff --git a/httemplate/edit/cust_main/bottomfixup.js b/httemplate/edit/cust_main/bottomfixup.js new file mode 100644 index 000000000..efe2215c8 --- /dev/null +++ b/httemplate/edit/cust_main/bottomfixup.js @@ -0,0 +1,278 @@ +function bottomfixup(what) { + + var layervars = new Array( + 'payauto', + 'payinfo', 'payinfo1', 'payinfo2', 'paytype', + 'payname', 'paystate', 'exp_month', 'exp_year', 'paycvv', + 'paystart_month', 'paystart_year', 'payissue', + 'payip', + 'paid' + ); + + var cf = document.CustomerForm; + var payby = cf.payby.options[cf.payby.selectedIndex].value; + for ( f=0; f < layervars.length; f++ ) { + var field = layervars[f]; + copyelement( cf.elements[payby + '_' + field], + cf.elements[field] + ); + } + + //this part does USPS address correction + + // XXX should this be first and should we update the form fields that are + // displayed??? + + var cf = document.CustomerForm; + + var state_el = cf.elements['state']; + var ship_state_el = cf.elements['ship_state']; + + //address_standardize( + var cust_main = new Array( + 'company', cf.elements['company'].value, + 'address1', cf.elements['address1'].value, + 'address2', cf.elements['address2'].value, + 'city', cf.elements['city'].value, + 'state', state_el.options[ state_el.selectedIndex ].value, + 'zip', cf.elements['zip'].value, + + 'ship_company', cf.elements['ship_company'].value, + 'ship_address1', cf.elements['ship_address1'].value, + 'ship_address2', cf.elements['ship_address2'].value, + 'ship_city', cf.elements['ship_city'].value, + 'ship_state', ship_state_el.options[ ship_state_el.selectedIndex ].value, + 'ship_zip', cf.elements['ship_zip'].value + ); + + address_standardize( cust_main, update_address ); + +} + +var standardize_address; + +function update_address(arg) { + + var argsHash = eval('(' + arg + ')'); + + var changed = argsHash['address_standardized']; + var ship_changed = argsHash['ship_address_standardized']; + var error = argsHash['error']; + var ship_error = argsHash['ship_error']; + + //yay closures + standardize_address = function () { + + var cf = document.CustomerForm; + var state_el = cf.elements['state']; + var ship_state_el = cf.elements['ship_state']; + + if ( changed ) { + cf.elements['company'].value = argsHash['new_company']; + cf.elements['address1'].value = argsHash['new_address1']; + cf.elements['address2'].value = argsHash['new_address2']; + cf.elements['city'].value = argsHash['new_city']; + setselect(cf.elements['state'], argsHash['new_state']); + cf.elements['zip'].value = argsHash['new_zip']; + } + + if ( ship_changed ) { + cf.elements['ship_company'].value = argsHash['new_ship_company']; + cf.elements['ship_address1'].value = argsHash['new_ship_address1']; + cf.elements['ship_address2'].value = argsHash['new_ship_address2']; + cf.elements['ship_city'].value = argsHash['new_ship_city']; + setselect(cf.elements['ship_state'], argsHash['new_ship_state']); + cf.elements['ship_zip'].value = argsHash['new_ship_zip']; + } + + } + + var cf = document.CustomerForm; + +% if ( $conf->exists('enable_taxproducts') ) { + + if ( <% $taxpre %>error ) { + + var country_el = cf.elements['<% $taxpre %>country']; + var country = country_el.options[ country_el.selectedIndex ].value; + + if ( country == 'CA' || country == 'US' ) { + + var state_el = cf.elements['<% $taxpre %>state']; + var state = state_el.options[ state_el.selectedIndex ].value; + + var url = "cust_main/choose_tax_location.html" + + "?data_vendor=cch-zip" + + ";city=" + cf.elements['<% $taxpre %>city'].value + + ";state=" + state + + ";zip=" + cf.elements['<% $taxpre %>zip'].value + + ";country=" + country + + ";"; + + // popup a chooser + OLgetAJAX( url, update_geocode, 300 ); + + } else { + + cf.elements['geocode'].value = 'DEFAULT'; + cf.submit(); + + } + + } else + +% } + + if ( changed || ship_changed ) { + +% if ( $conf->exists('cust_main-auto_standardize_address') ) { + + standardize_address(); + cf.submit(); + +% } else { + + // popup a confirmation popup + + var confirm_change = + '

Confirm address standardization

' + + ''; + + if ( changed ) { + + confirm_change = confirm_change + + '' + + ''; + // + ''; + + if ( argsHash['company'] || argsHash['new_company'] ) { + confirm_change = confirm_change + + ''; + } + + confirm_change = confirm_change + + '' + + '' + + '' + + ''; + + } + + if ( ship_changed ) { + + confirm_change = confirm_change + + '' + + ''; + // + ''; + + if ( argsHash['ship_company'] || argsHash['new_ship_company'] ) { + confirm_change = confirm_change + + ''; + } + + confirm_change = confirm_change + + '' + + '' + + '' + + ''; + + } + + var addresses = 'address'; + var height = 268; + if ( changed && ship_changed ) { + addresses = 'addresses'; + height = 396; // #what + } + + confirm_change = confirm_change + + '' + + '' + + + '
Entered billing addressStandardized billing address
  
' + argsHash['company'] + + '' + argsHash['new_company'] + '
' + argsHash['address1'] + + '' + argsHash['new_address1'] + '
' + argsHash['address2'] + + '' + argsHash['new_address2'] + '
' + argsHash['city'] + ', ' + argsHash['state'] + ' ' + argsHash['zip'] + + '' + argsHash['new_city'] + ', ' + argsHash['new_state'] + ' ' + argsHash['new_zip'] + '
  
Entered service addressStandardized service address
  
' + argsHash['ship_company'] + + '' + argsHash['new_ship_company'] + '
' + argsHash['ship_address1'] + + '' + argsHash['new_ship_address1'] + '
' + argsHash['ship_address2'] + + '' + argsHash['new_ship_address2'] + '
' + argsHash['ship_city'] + ', ' + argsHash['ship_state'] + ' ' + argsHash['ship_zip'] + + '' + argsHash['new_ship_city'] + ', ' + argsHash['new_ship_state'] + ' ' + argsHash['new_ship_zip'] + '
  
' + + '' + + '' + + '' + + '
' + + '
'; + + overlib( confirm_change, CAPTION, 'Confirm address standardization', STICKY, AUTOSTATUSCAP, CLOSETEXT, '', MIDX, 0, MIDY, 0, DRAGGABLE, WIDTH, 576, HEIGHT, height, BGCOLOR, '#333399', CGCOLOR, '#333399', TEXTSIZE, 3 ); + +% } + + } else { + + cf.submit(); + + } + +} + +function update_geocode() { + + //yay closures + set_geocode = function (what) { + + var cf = document.CustomerForm; + + //alert(what.options[what.selectedIndex].value); + var argsHash = eval('(' + what.options[what.selectedIndex].value + ')'); + cf.elements['<% $taxpre %>city'].value = argsHash['city']; + setselect(cf.elements['<% $taxpre %>state'], argsHash['state']); + cf.elements['<% $taxpre %>zip'].value = argsHash['zip']; + cf.elements['geocode'].value = argsHash['geocode']; + + } + + // popup a chooser + + overlib( OLresponseAJAX, CAPTION, 'Select tax location', STICKY, AUTOSTATUSCAP, CLOSETEXT, '', MIDX, 0, MIDY, 0, DRAGGABLE, WIDTH, 576, HEIGHT, 268, BGCOLOR, '#333399', CGCOLOR, '#333399', TEXTSIZE, 3 ); + +} + +function copyelement(from, to) { + if ( from == undefined ) { + to.value = ''; + } else if ( from.type == 'select-one' ) { + to.value = from.options[from.selectedIndex].value; + //alert(from + " (" + from.type + "): " + to.name + " => (" + from.selectedIndex + ") " + to.value); + } else if ( from.type == 'checkbox' ) { + if ( from.checked ) { + to.value = from.value; + } else { + to.value = ''; + } + } else { + if ( from.value == undefined ) { + to.value = ''; + } else { + to.value = from.value; + } + } + //alert(from + " (" + from.type + "): " + to.name + " => " + to.value); +} + +function setselect(el, value) { + + for ( var s = 0; s < el.options.length; s++ ) { + if ( el.options[s].value == value ) { + el.selectedIndex = s; + } + } + +} +<%init> + +my $conf = new FS::Conf; + +my $taxpre = $conf->exists('tax-ship_address') ? 'ship_' : ''; + + diff --git a/httemplate/edit/cust_main/choose_tax_location.html b/httemplate/edit/cust_main/choose_tax_location.html index bd8b95cb6..2a4192632 100644 --- a/httemplate/edit/cust_main/choose_tax_location.html +++ b/httemplate/edit/cust_main/choose_tax_location.html @@ -26,8 +26,8 @@

- - + +
diff --git a/httemplate/edit/cust_main/first_pkg.html b/httemplate/edit/cust_main/first_pkg.html new file mode 100644 index 000000000..0de33c025 --- /dev/null +++ b/httemplate/edit/cust_main/first_pkg.html @@ -0,0 +1,55 @@ +% if ( @part_pkg ) { + +

+ First package + <% ntable("#cccccc") %> + + + + <% include('first_pkg/select-part_pkg.html', + 'part_pkg' => \@part_pkg, + %opt, + # map { $_ => $opt{$_} } qw( pkgpart_svcpart saved_domsvc ) + ) + %> + +% } +<%init> + +my( $cust_main, %opt ) = @_; + +# pry the wrong place for this logic. also pretty expensive + +#false laziness, copied from FS::cust_pkg::order +my $pkgpart; +my $agentnum = ''; +my @agents = $FS::CurrentUser::CurrentUser->agents; +if ( scalar(@agents) == 1 ) { + # $pkgpart->{PKGPART} is true iff $custnum may purchase PKGPART + $pkgpart = $agents[0]->pkgpart_hashref; + $agentnum = $agents[0]->agentnum; +} else { + #can't know (agent not chosen), so, allow all + $agentnum = 'all'; + my %typenum; + foreach my $agent ( @agents ) { + next if $typenum{$agent->typenum}++; + $pkgpart->{$_}++ foreach keys %{ $agent->pkgpart_hashref } + } +} +#eslaf + +my @first_svc = ( 'svc_acct', 'svc_phone' ); + +my @part_pkg = + grep { $_->svcpart(\@first_svc) + && ( $pkgpart->{ $_->pkgpart } + || $agentnum eq 'all' + || ( $agentnum ne 'all' && $agentnum && $_->agentnum + && $_->agentnum == $agentnum + ) + ) + } + qsearch( 'part_pkg', { 'disabled' => '' }, '', 'ORDER BY pkg' ); # case? + + diff --git a/httemplate/edit/cust_main/first_pkg/select-part_pkg.html b/httemplate/edit/cust_main/first_pkg/select-part_pkg.html new file mode 100644 index 000000000..1b62035b2 --- /dev/null +++ b/httemplate/edit/cust_main/first_pkg/select-part_pkg.html @@ -0,0 +1,164 @@ +<% include('/elements/xmlhttp.html', + 'url' => $p.'misc/svc_acct-domains.cgi', + 'subs' => [ $opt{'prefix'}. 'get_domains' ], + ) +%> + +<% include('/elements/xmlhttp.html', + 'url' => $p.'misc/part_svc-columns.cgi', + 'subs' => [ $opt{'prefix'}. 'get_part_svc' ], + ) +%> + + + +<% include( '/elements/selectlayers.html', + 'field' => $opt{'prefix'}. 'pkgpart_svcpart', + 'curr_value' => $opt{pkgpart_svcpart}, + 'options' => \@options, + 'labels' => \%labels, + 'html_between' => '', + #'onchange' => $opt{'prefix'}. 'pkgpart_svcpart_changed(this,0);', + 'onchange' => $opt{'prefix'}. 'pkgpart_svcpart_changed_too(what,0)', + + 'layer_callback' => $layer_callback, + 'layermap' => \%layermap, + ) +%> + + + +<%init> + +my %opt = @_; + +foreach my $opt (qw( svc_part pkgparts saved_pkgpart saved_domsvc prefix)) { + $opt{$_} = '' unless exists($opt{$_}) && defined($opt{$_}); +} +$opt{saved_domsvc} = 0 unless $opt{saved_domsvc}; + +my @part_pkg = @{$opt{'part_pkg'}}; + +my @first_svc = ( 'svc_acct', 'svc_phone' ); + +my %pkgpart_svcpart = (); +my %svcdb = (); +my %layermap = (); +foreach my $part_pkg ( @part_pkg ) { + my $pkgpart = $part_pkg->pkgpart; + my $pkgpart_svcpart = $pkgpart. "_". $part_pkg->svcpart(\@first_svc); + $pkgpart_svcpart{$pkgpart} = $pkgpart_svcpart; + $svcdb{$pkgpart} = $part_pkg->part_svc(\@first_svc)->svcdb; + $layermap{$pkgpart_svcpart} = $svcdb{$pkgpart}; +} + +my @options = ( '', map $pkgpart_svcpart{ $_->pkgpart }, @part_pkg ); +my %labels = ( '' => '(none)', + map { $pkgpart_svcpart{ $_->pkgpart } + => $_->pkg. " - ". $_->comment + } + @part_pkg + ); + +my $layer_callback = sub { + my $layer = shift; + #$layer_fields, $layer_values, $layer_prefix + +# my( $pkgpart, $svcpart ) = split('_', $layer); +# my $svcdb = $svcdb{$pkgpart}; + my $svcdb = $layer; + + return '' unless $svcdb; #'




' + + #full path cause we're being slung around as a coderef (mason closures?) + include("/edit/cust_main/first_pkg/$svcdb.html", %opt, ); +}; + + diff --git a/httemplate/edit/cust_main/first_pkg/svc_acct.html b/httemplate/edit/cust_main/first_pkg/svc_acct.html new file mode 100644 index 000000000..91ee7a56c --- /dev/null +++ b/httemplate/edit/cust_main/first_pkg/svc_acct.html @@ -0,0 +1,58 @@ +<% ntable("#cccccc") %> + + + Username + + + MAXLENGTH = <% $ulen %> + > + + + + + Domain + + + + + + + Password + + + MAXLENGTH = <% $passwordmax %>> + (blank to generate) + + + + + Access number + <% FS::svc_acct_pop::popselector($opt{'popnum'}) %> + + + + +<%init> + +#use FS::svc_acct_pop; + +my( %opt ) = @_; + +my $conf = new FS::Conf; + +#false laziness: (mostly) copied from edit/svc_acct.cgi +#$ulen = $svc_acct->dbdef_table->column('username')->length; +my $ulen = dbdef->table('svc_acct')->column('username')->length; +my $ulen2 = $ulen+2; +my $passwordmax = $conf->config('passwordmax') || 8; +my $pmax2 = $passwordmax + 2; + + diff --git a/httemplate/edit/cust_main/first_pkg/svc_phone.html b/httemplate/edit/cust_main/first_pkg/svc_phone.html new file mode 100644 index 000000000..70e013ece --- /dev/null +++ b/httemplate/edit/cust_main/first_pkg/svc_phone.html @@ -0,0 +1,82 @@ +<% ntable("#cccccc") %> + +%#XXX this should be hidden or something in most/all cases + + Country code + + + + + +%#we don't know the svcpart until the dropdown is changed :/ +%#<% include('/elements/tr-select-did.html', +%# 'label' => 'Phone number', +%# 'curr_value' => $opt{'phonenum'}, +%# ) +%#%> + + Phone Number + + + + + + + SIP password + + + + + + + Voicemail PIN + + + + + +%#XXX this should be hidden or something in most/all cases + + Name + + + + + + + +<%init> + +my( %opt ) = @_; + +#my $conf = new FS::Conf; + + diff --git a/httemplate/edit/cust_main/select-domain.html b/httemplate/edit/cust_main/select-domain.html deleted file mode 100644 index bec1e834c..000000000 --- a/httemplate/edit/cust_main/select-domain.html +++ /dev/null @@ -1,67 +0,0 @@ - -<% include('/elements/xmlhttp.html', - 'url' => $p.'misc/svc_acct-domains.cgi', - 'subs' => [ $opt{'prefix'}. 'get_domains' ], - ) -%> - - - - - - -<%init> -my %opt = @_; -foreach my $opt (qw( svc_part pkgparts saved_pkgpart saved_domsvc prefix)) { - $opt{$_} = '' unless exists($opt{$_}) && defined($opt{$_}); -} -$opt{saved_domsvc} = 0 unless $opt{saved_domsvc}; -my @part_pkg = @{$opt{'pkgparts'}}; - - - diff --git a/httemplate/edit/cust_main/top_misc.html b/httemplate/edit/cust_main/top_misc.html new file mode 100644 index 000000000..5aaa0b0cc --- /dev/null +++ b/httemplate/edit/cust_main/top_misc.html @@ -0,0 +1,87 @@ +<% &ntable("#cccccc") %> + +%# agent +<% include('/elements/tr-select-agent.html', + 'curr_value' => $cust_main->agentnum, + 'label' => "${r}Agent", + 'empty_label' => 'Select agent', + 'disable_empty' => ( $cust_main->agentnum ? 1 : 0 ), + ) +%> + +%# agent_custid +% if ( $conf->exists('cust_main-edit_agent_custid') ) { + + + Customer identifier + + + +% } else { + + + +% } + +%# referral (advertising source) +%my $refnum = $cust_main->refnum || $conf->config('referraldefault') || 0; +%if ( $custnum && ! $conf->exists('editreferrals') ) { + + + +% } else { + + <% include('/elements/tr-select-part_referral.html', + 'curr_value' => $refnum + ) + %> +% } + + +%# referring customer +%my $referring_cust_main = ''; +%if ( $cust_main->referral_custnum +% and $referring_cust_main = +% qsearchs('cust_main', { custnum => $cust_main->referral_custnum } ) +%) { + + + Referring customer + + <% $cust_main->referral_custnum %>: <% $referring_cust_main->name %> + + + +% } elsif ( ! $conf->exists('disable_customer_referrals') ) { + + + + Referring customer + + + <% include('/elements/search-cust_main.html', + 'field_name' => 'referral_custnum', + ) + %> + + +% } else { + + + +% } + + + + +<%init> + +my( $cust_main, %opt ) = @_; + +my $custnum = $opt{'custnum'}; + +my $conf = new FS::Conf; + +my $r = qq!* !; + + diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index 097d38204..2e58315d4 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -27,8 +27,7 @@ $cgi->param('tax','') unless defined $cgi->param('tax'); $cgi->param('refnum', (split(/:/, ($cgi->param('refnum'))[0] ))[0] ); -#my $payby = $cgi->param('payby'); -my $payby = $cgi->param('select'); # XXX key +my $payby = $cgi->param('payby'); my %noauto = ( 'CARD' => 'DCRD', @@ -37,8 +36,6 @@ my %noauto = ( $payby = $noauto{$payby} if ! $cgi->param('payauto') && exists $noauto{$payby}; -$cgi->param('payby', $payby); - if ( $payby ) { if ( $payby eq 'CHEK' || $payby eq 'DCHK' ) { $cgi->param('payinfo', @@ -93,34 +90,39 @@ $new->setfield('paid', $cgi->param('paid') ) if $cgi->param('paid'); #perhaps this stuff should go to cust_main.pm -my $cust_pkg = ''; -my $svc_acct = ''; if ( $new->custnum eq '' ) { + my $cust_pkg = ''; + my $svc; + if ( $cgi->param('pkgpart_svcpart') ) { + my $x = $cgi->param('pkgpart_svcpart'); $x =~ /^(\d+)_(\d+)$/ or die "illegal pkgpart_svcpart $x\n"; my($pkgpart, $svcpart) = ($1, $2); + my $part_pkg = qsearchs('part_pkg', { 'pkgpart' => $pkgpart } ); #false laziness: copied from FS::cust_pkg::order (which should become a #FS::cust_main method) my(%part_pkg); # generate %part_pkg # $part_pkg{$pkgpart} is true iff $custnum may purchase $pkgpart my $agent = qsearchs('agent',{'agentnum'=> $new->agentnum }); - #my($type_pkgs); - #foreach $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) { - # my($pkgpart)=$type_pkgs->pkgpart; - # $part_pkg{$pkgpart}++; - #} - # $pkgpart_href->{PKGPART} is true iff $custnum may purchase $pkgpart - my $pkgpart_href = $agent->pkgpart_hashref; - #eslaf - - # this should wind up in FS::cust_pkg! - $error ||= "Agent ". $new->agentnum. " (type ". $agent->typenum. ") can't ". - "purchase pkgpart ". $pkgpart - #unless $part_pkg{ $pkgpart }; - unless $pkgpart_href->{ $pkgpart }; + + if ( $agent ) { + # $pkgpart_href->{PKGPART} is true iff $custnum may purchase $pkgpart + my $pkgpart_href = $agent->pkgpart_hashref + if $agent; + #eslaf + + # this should wind up in FS::cust_pkg! + $error ||= "Agent ". $new->agentnum. " (type ". $agent->typenum. + ") can't purchase pkgpart ". $pkgpart + #unless $part_pkg{ $pkgpart }; + unless $pkgpart_href->{ $pkgpart } + || $agent->agentnum == $part_pkg->agentnum; + } else { + $error = 'Select agent'; + } $cust_pkg = new FS::cust_pkg ( { #later 'custnum' => $custnum, @@ -132,32 +134,49 @@ if ( $new->custnum eq '' ) { #$error ||= $cust_svc->check; - my %svc_acct = ( - 'svcpart' => $svcpart, - 'username' => $cgi->param('username'), - '_password' => $cgi->param('_password'), - 'popnum' => $cgi->param('popnum'), - ); - $svc_acct{'domsvc'} = $cgi->param('domsvc') - if $cgi->param('domsvc'); + my $part_svc = qsearchs('part_svc', { 'svcpart' => $svcpart } ); + my $svcdb = $part_svc->svcdb; + + if ( $svcdb eq 'svc_acct' ) { + + my %svc_acct = ( + 'svcpart' => $svcpart, + 'username' => scalar($cgi->param('username')), + '_password' => scalar($cgi->param('_password')), + 'popnum' => scalar($cgi->param('popnum')), + ); + $svc_acct{'domsvc'} = $cgi->param('domsvc') + if $cgi->param('domsvc'); + + $svc = new FS::svc_acct \%svc_acct; + + #and just in case you were silly + $svc->svcpart($svcpart); + $svc->username($cgi->param('username')); + $svc->_password($cgi->param('_password')); + $svc->popnum($cgi->param('popnum')); + + } elsif ( $svcdb eq 'svc_phone' ) { + + my %svc_phone = ( + 'svcpart' => $svcpart, + map { $_ => scalar($cgi->param($_)) } + qw( countrycode phonenum sip_password pin phone_name ) + ); - $svc_acct = new FS::svc_acct \%svc_acct; + $svc = new FS::svc_phone \%svc_phone; - #and just in case you were silly - $svc_acct->svcpart($svcpart); - $svc_acct->username($cgi->param('username')); - $svc_acct->_password($cgi->param('_password')); - $svc_acct->popnum($cgi->param('popnum')); + } else { + die "$svcdb not handled on new customer yet"; + } #$error ||= $svc_acct->check; - } elsif ( $cgi->param('username') ) { #good thing to catch - $error = "Can't assign username without a package!"; } use Tie::RefHash; tie my %hash, 'Tie::RefHash'; - %hash = ( $cust_pkg => [ $svc_acct ] ) if $cust_pkg; + %hash = ( $cust_pkg => [ $svc ] ) if $cust_pkg; $error ||= $new->insert( \%hash, \@invoicing_list ); my $conf = new FS::Conf; diff --git a/httemplate/elements/select-domain.html b/httemplate/elements/select-domain.html index a9998da06..3372e068f 100644 --- a/httemplate/elements/select-domain.html +++ b/httemplate/elements/select-domain.html @@ -7,7 +7,7 @@ ' LEFT JOIN cust_pkg USING ( pkgnum ) '. ' LEFT JOIN cust_main USING ( custnum ) ', 'agent_virt' => 1, - 'agent_null-right' => 'View/link unlinked services', + 'agent_null_right' => 'View/link unlinked services', @_, ) %> diff --git a/httemplate/elements/select-svc_acct-domain.html b/httemplate/elements/select-svc_acct-domain.html new file mode 100644 index 000000000..c9a920636 --- /dev/null +++ b/httemplate/elements/select-svc_acct-domain.html @@ -0,0 +1,46 @@ + +<%init> + +my %opt = @_; + +my $domsvc = $opt{'curr_value'}; +my $part_svc = $opt{'part_svc'} + || qsearchs('part_svc', { 'svcpart' => $opt{'svcpart'} }); + +#optional +my $cust_pkg = $opt{'cust_pkg'}; +$cust_pkg ||= qsearchs('cust_pkg', { 'pkgnum' => $opt{'pkgnum'} }) + if $opt{'pkgnum'}; + +my $pkgnum = $cust_pkg ? $cust_pkg->pkgnum : ''; + +my %svc_domain = (); + +if ( $domsvc ) { + my $svc_domain = qsearchs('svc_domain', { 'svcnum' => $domsvc } ); + if ( $svc_domain ) { + $svc_domain{$svc_domain->svcnum} = $svc_domain; + } else { + warn "unknown svc_domain.svcnum for svc_acct.domsvc: $domsvc"; + } +} + +%svc_domain = ( + %svc_domain, + FS::svc_acct->domain_select_hash( 'svcpart' => $part_svc->svcpart, + 'pkgnum' => $pkgnum, + ) +); + diff --git a/httemplate/elements/selectlayers.html b/httemplate/elements/selectlayers.html index 82f5dd1a7..a85cea193 100644 --- a/httemplate/elements/selectlayers.html +++ b/httemplate/elements/selectlayers.html @@ -63,18 +63,29 @@ Example: @@ -124,10 +134,16 @@ Example: % % unless ( grep $opt{$_}, qw(js_only select_only) ) { -% foreach my $layer ( keys %$options ) { +% foreach my $layer ( @layers ) { +% my $selected_layer; +% if ( $opt{layermap} ) { +% $selected_layer = $opt{layermap}->{$selected}; +% } else { +% $selected_layer = $selected; +% }
" @@ -162,6 +178,14 @@ tie my %options, 'Tie::IxHash', my $between = exists($opt{html_between}) ? $opt{html_between} : ''; my $options = \%options; +my @layers = (); +if ( $opt{layermap} ) { + my %layers = map { $opt{layermap}->{$_} => 1 } keys %options; + @layers = keys %layers; +} else { + @layers = keys %options; +} + my $selected = exists($opt{curr_value}) ? $opt{curr_value} : ''; #XXX eek. also eek $layer_fields in the layer_callback() call... diff --git a/httemplate/misc/part_svc-columns.cgi b/httemplate/misc/part_svc-columns.cgi new file mode 100644 index 000000000..060256154 --- /dev/null +++ b/httemplate/misc/part_svc-columns.cgi @@ -0,0 +1,13 @@ +<% objToJson(\@output) %> +<%init> + +my $conf = new FS::Conf; + +my $pkgpart_svcpart = $cgi->param('arg'); +$pkgpart_svcpart =~ /^\d+_(\d+)$/; +my $part_svc = qsearchs('part_svc', { 'svcpart' => $1 }) if $1; + +my @output = map { ( $_->columnname, $_->columnflag, $_->columnvalue ) } + $part_svc->all_part_svc_column; + + -- cgit v1.2.1 From 90fecad861bd6817b55e9391431430e0d86d9084 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 12 Apr 2009 06:24:45 +0000 Subject: adding --- httemplate/elements/tr-select-svc_acct-domain.html | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 httemplate/elements/tr-select-svc_acct-domain.html (limited to 'httemplate') diff --git a/httemplate/elements/tr-select-svc_acct-domain.html b/httemplate/elements/tr-select-svc_acct-domain.html new file mode 100644 index 000000000..9d1a4b678 --- /dev/null +++ b/httemplate/elements/tr-select-svc_acct-domain.html @@ -0,0 +1,34 @@ +%if ( $columnflag eq 'F' ) { + +% } else { + + + <% $opt{'label'} || 'Domain' %> + + <% include('/elements/select-svc_acct-domain.html', + 'curr_value' => $domsvc, + 'part_svc' => $part_svc, + 'cust_pkg' => $cust_pkg, + ) + %> + + +% } +<%init> + +my %opt = @_; + +my $domsvc = $opt{'curr_value'}; + +#required +my $part_svc = $opt{'part_svc'} + || qsearchs('part_svc', { 'svcpart' => $opt{'svcpart'} }); + +my $columnflag = $part_svc->part_svc_column('domsvc')->columnflag; + +#optional +my $cust_pkg = $opt{'cust_pkg'}; +$cust_pkg ||= qsearchs('cust_pkg', { 'pkgnum' => $opt{'pkgnum'} }) + if $opt{'pkgnum'}; + + -- cgit v1.2.1 From 1442c00818afaf86855090126c5f9bfbf8242d77 Mon Sep 17 00:00:00 2001 From: jeff Date: Tue, 14 Apr 2009 16:12:54 +0000 Subject: better at least --- httemplate/misc/process/tax-import.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/misc/process/tax-import.cgi b/httemplate/misc/process/tax-import.cgi index 016d4b60c..537af490f 100644 --- a/httemplate/misc/process/tax-import.cgi +++ b/httemplate/misc/process/tax-import.cgi @@ -2,7 +2,7 @@ <%init> die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Resend invoices'); + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); my $server = new FS::UI::Web::JSRPC 'FS::tax_rate::process_batch_import', $cgi; -- cgit v1.2.1 From 437f7374ed17088113c4067df42201295b6d6c43 Mon Sep 17 00:00:00 2001 From: jeff Date: Tue, 14 Apr 2009 16:14:48 +0000 Subject: hmmm --- httemplate/misc/process/tax-import.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/misc/process/tax-import.cgi b/httemplate/misc/process/tax-import.cgi index 537af490f..f800dbd5b 100644 --- a/httemplate/misc/process/tax-import.cgi +++ b/httemplate/misc/process/tax-import.cgi @@ -2,7 +2,7 @@ <%init> die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + unless $FS::CurrentUser::CurrentUser->access_right('Import'); my $server = new FS::UI::Web::JSRPC 'FS::tax_rate::process_batch_import', $cgi; -- cgit v1.2.1 From a5bf104f1fb29ea6e3fa6993dd60069e3d2cfca7 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 14 Apr 2009 20:27:50 +0000 Subject: don't hide old packages that have services, RT#5179 --- httemplate/view/cust_main/packages.html | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index d55560f34..0da82500a 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -177,8 +177,11 @@ sub get_packages { join(', ', map "cust_pkg.$_", fields('cust_pkg') ). ', '. join(', ', map "part_pkg.$_", fields('part_pkg') ); + my $num_svcs = '( SELECT COUNT(*) FROM cust_svc '. + ' WHERE cust_svc.pkgnum = cust_pkg.pkgnum ) AS num_svcs'; + my @packages = $cust_main->$method( { - 'select' => "$cust_pkg_fields, $part_pkg_fields", + 'select' => "$cust_pkg_fields, $part_pkg_fields, $num_svcs", 'addl_from' => 'LEFT JOIN part_pkg USING ( pkgpart )', } ); my $num_old_packages = scalar(@packages); @@ -200,7 +203,9 @@ sub get_packages { ); @packages = - grep { !exists($hide{$_->status}) or $_->get($hide{$_->status}) > $then } + grep { !exists($hide{$_->status}) or $_->get($hide{$_->status}) > $then + or $_->num_svcs #don't hide packages w/services + } @packages; } -- cgit v1.2.1 From 554a8168de9871b6085fe36ce5d86f3681421c64 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 14 Apr 2009 21:01:40 +0000 Subject: remove debugging --- httemplate/view/cust_main/packages.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 0da82500a..ed98ba903 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -76,7 +76,7 @@ Current packages Services -% $FS::cust_pkg::DEBUG = 2; +% #$FS::cust_pkg::DEBUG = 2; % foreach my $cust_pkg (@$packages) { % % if ( $bgcolor eq $bgcolor1 ) { -- cgit v1.2.1 From ba176b6005c1c09cfd00c57befe72ba9561b77f8 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 15 Apr 2009 05:52:09 +0000 Subject: s/GECOS/Real Name/ RT#3519 --- httemplate/view/svc_acct.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index e87a8ee9a..6a47ec767 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -214,7 +214,7 @@ Service #<% $svcnum %> % if ($svc_acct->finger ne '') { - GECOS + Real Name <% $svc_acct->finger %> % } -- cgit v1.2.1 From 9f5e5a6ef0aa20bafb200c0bfa9678bbccda127b Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 15 Apr 2009 07:14:11 +0000 Subject: should fix view of unlinked phone numbers, RT#5171 --- httemplate/view/elements/svc_Common.html | 55 ++++++++++++++++++-------------- httemplate/view/svc_Common.html | 12 +++---- 2 files changed, 37 insertions(+), 30 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/elements/svc_Common.html b/httemplate/view/elements/svc_Common.html index a0b4e37b2..125fcd0b8 100644 --- a/httemplate/view/elements/svc_Common.html +++ b/httemplate/view/elements/svc_Common.html @@ -1,30 +1,40 @@ -% # options example... -% # -% # 'table' => 'svc_something' -% # -% # 'labels' => { -% # 'column' => 'Label', -% # }, -% # -% # listref - each item is a literal column name (or method) or (notyet) coderef -% # if not specified all columns (except for the primary key) will be viewable -% # 'fields' => [ -% # ] -% # -% # # defaults to "edit/$table.cgi?", will have svcnum appended -% # 'edit_url' => -% -% -% if ( $custnum ) { +<%doc> + +#Example: + + include( 'elements/svc_Common.html, + 'table' => 'svc_something' + + 'labels' => { + 'column' => 'Label', + }, + + #listref - each item is a literal column name (or method) or + # (notyet) coderef. if not specified all columns (except for the + #primary key) will be viewable + 'fields' => [ + ] + + # defaults to "edit/$table.cgi?", will have svcnum appended + 'edit_url' => + ) + + +% if ( $custnum ) { <% include("/elements/header.html","View $label: $value") %> <% include( '/elements/small_custview.html', $custnum, '', 1, "${p}view/cust_main.cgi") %>
+ % } else { + <% include("/elements/header.html","View $label: $value", menubar( + "Cancel this (unaudited) $label" => + "javascript:areyousure(\'${p}misc/cancel-unaudited.cgi?$svcnum\')" + )) %> - <% include("/elements/header.html","View $label: $value", menubar( - "Cancel this (unaudited) $label" => - "javascript:areyousure(\'${p}misc/cancel-unaudited.cgi?$svcnum\')" - )) %> % } - Service #<% $svcnum %> % my $url = $opt{'edit_url'} || $p. 'edit/'. $opt{'table'}. '.cgi?'; | Edit this <% $label %> @@ -130,7 +135,9 @@ my $svc_x = qsearchs({ ' LEFT JOIN cust_pkg USING ( pkgnum ) '. ' LEFT JOIN cust_main USING ( custnum ) ', 'hashref' => { 'svcnum' => $svcnum }, - 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, + 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql( + 'null_right' => 'View/link unlinked services' + ), }) or die "Unknown svcnum $svcnum in ". $opt{'table'}. " table\n"; my $cust_svc = $svc_x->cust_svc; diff --git a/httemplate/view/svc_Common.html b/httemplate/view/svc_Common.html index bb3a6dd33..defbee974 100644 --- a/httemplate/view/svc_Common.html +++ b/httemplate/view/svc_Common.html @@ -1,3 +1,9 @@ +<% include('elements/svc_Common.html', + 'table' => $table, + 'edit_url' => $p."edit/svc_Common.html?svcdb=$table;svcnum=", + %opt, + ) +%> <%init> # false laziness w/edit/svc_Common.html @@ -21,9 +27,3 @@ if ( UNIVERSAL::can("FS::$table", 'table_info') ) { } -<% include('elements/svc_Common.html', - 'table' => $table, - 'edit_url' => $p."edit/svc_Common.html?svcdb=$table;svcnum=", - %opt, - ) -%> -- cgit v1.2.1 From caa6c563bd570fc53f333589bc95bc7a570626d0 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 17 Apr 2009 01:17:40 +0000 Subject: add customer status to receivables report selection, hopefully help enet, RT#5187 --- httemplate/search/report_receivables.cgi | 9 +++++++++ httemplate/search/report_receivables.html | 5 +++++ 2 files changed, 14 insertions(+) (limited to 'httemplate') diff --git a/httemplate/search/report_receivables.cgi b/httemplate/search/report_receivables.cgi index 58d87fa53..c5ca45338 100755 --- a/httemplate/search/report_receivables.cgi +++ b/httemplate/search/report_receivables.cgi @@ -116,6 +116,15 @@ if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) { push @where, "agentnum = $agentnum"; } +#status (false laziness w/cust_main::search_sql + +#prospect active inactive suspended cancelled +if ( grep { $cgi->param('status') eq $_ } FS::cust_main->statuses() ) { + my $method = $cgi->param('status'). '_sql'; + #push @where, $class->$method(); + push @where, FS::cust_main->$method(); +} + #here is the agent virtualization push @where, $FS::CurrentUser::CurrentUser->agentnums_sql; diff --git a/httemplate/search/report_receivables.html b/httemplate/search/report_receivables.html index 19b1ee7cc..1ebe08cb8 100755 --- a/httemplate/search/report_receivables.html +++ b/httemplate/search/report_receivables.html @@ -11,6 +11,11 @@ <% include( '/elements/tr-select-agent.html', 'disable_empty'=>0 ) %> + + <% include( '/elements/tr-select-cust_main-status.html', + 'label' => 'Customer Status' + ) + %> Customers -- cgit v1.2.1 From 465e3d31929f6002146367e1950e3d2b70190846 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 17 Apr 2009 07:03:02 +0000 Subject: hide service search unless user has "View customer services" ACL, RT#3478 --- httemplate/elements/header.html | 2 ++ 1 file changed, 2 insertions(+) (limited to 'httemplate') diff --git a/httemplate/elements/header.html b/httemplate/elements/header.html index 8e902f038..058756745 100644 --- a/httemplate/elements/header.html +++ b/httemplate/elements/header.html @@ -202,11 +202,13 @@ input.fsblackbuttonselected { +% if ( $curuser->access_right('View customer services') ) {

Advanced
+% } -- cgit v1.2.1 From 6a1d3fe46f65b0a24ec025c22afcdb75af3c9e9a Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 17 Apr 2009 08:02:29 +0000 Subject: show labels for select(select_hash) config options, RT#3997 --- httemplate/config/config-process.cgi | 9 +++++++++ httemplate/config/config-view.cgi | 26 +++++++++++++++++++++++--- httemplate/config/config.cgi | 6 ++---- 3 files changed, 34 insertions(+), 7 deletions(-) (limited to 'httemplate') diff --git a/httemplate/config/config-process.cgi b/httemplate/config/config-process.cgi index 84bfdefcb..894dc41b2 100644 --- a/httemplate/config/config-process.cgi +++ b/httemplate/config/config-process.cgi @@ -87,6 +87,15 @@ $conf->delete($_, $agentnum) foreach @delete; configCell.style.backgroundColor = '#ff0000'; configCell.innerHTML = 'NO'; % } +% } elsif ( $type eq 'select' && $i->select_hash ) { +% my %hash; +% if ( ref($i->select_hash) eq 'ARRAY' ) { +% tie %hash, 'Tie::IxHash', '' => '', @{ $i->select_hash }; +% } else { +% tie %hash, 'Tie::IxHash', '' => '', %{ $i->select_hash }; +% } + configCell.innerHTML = <% $conf->exists($i->key, $agentnum) ? $hash{ $conf->config($i->key, $agentnum) } : '' |js_string %>; + % } elsif ( $type eq 'text' || $type eq 'select' ) { configCell.innerHTML = <% $conf->exists($i->key, $agentnum) ? $conf->config($i->key, $agentnum) : '' |js_string %>; % } elsif ( $type eq 'select-sub' ) { diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi index f2ae892a6..41ecfd268 100644 --- a/httemplate/config/config-view.cgi +++ b/httemplate/config/config-view.cgi @@ -66,7 +66,7 @@ Click on a configuration value to change it. no type -% } elsif ( $type eq 'image' ) { +% } elsif ( $type eq 'image' ) { @@ -86,7 +86,7 @@ Click on a configuration value to change it. -% } elsif ( $type eq 'binary' ) { +% } elsif ( $type eq 'binary' ) { @@ -112,17 +112,36 @@ Click on a configuration value to change it. + % } elsif ( $type eq 'checkbox' ) { YES' : 'ff0000">NO' %> + +% } elsif ( $type eq 'select' && $i->select_hash ) { +% +% my %hash; +% if ( ref($i->select_hash) eq 'ARRAY' ) { +% tie %hash, 'Tie::IxHash', '' => '', @{ $i->select_hash }; +% } else { +% tie %hash, 'Tie::IxHash', '' => '', %{ $i->select_hash }; +% } + + + + <% $conf->exists($i->key, $agentnum) ? $hash{ $conf->config($i->key, $agentnum) } : '' %> + + + % } elsif ( $type eq 'text' || $type eq 'select' ) { <% $conf->exists($i->key, $agentnum) ? $conf->config($i->key, $agentnum) : '' %> - + + + % } elsif ( $type eq 'select-sub' ) { @@ -131,6 +150,7 @@ Click on a configuration value to change it. <% &{ $i->option_sub }( $conf->config($i->key, $agentnum) ) %> + % } else { diff --git a/httemplate/config/config.cgi b/httemplate/config/config.cgi index f390c64a3..7f2e6670d 100644 --- a/httemplate/config/config.cgi +++ b/httemplate/config/config.cgi @@ -84,11 +84,9 @@ Setting <% $key %> % '' => '', map { $_ => $_ } @{ $config_item->select_enum }; % } elsif ( $config_item->select_hash ) { % if ( ref($config_item->select_hash) eq 'ARRAY' ) { -% tie %hash, 'Tie::IxHash', -% '' => '', @{ $config_item->select_hash }; +% tie %hash, 'Tie::IxHash', '' => '', @{ $config_item->select_hash }; % } else { -% tie %hash, 'Tie::IxHash', -% '' => '', %{ $config_item->select_hash }; +% tie %hash, 'Tie::IxHash', '' => '', %{ $config_item->select_hash }; % } % } else { % %hash = ( '' => 'WARNING: neither select_enum nor select_hash specified in Conf.pm for configuration option "'. $key. '"' ); -- cgit v1.2.1 From 77bb2b57581149a3b21f871a6db7f272d3b5ae2b Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 17 Apr 2009 08:16:17 +0000 Subject: what time is now --- httemplate/docs/about.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/docs/about.html b/httemplate/docs/about.html index dee424776..d0c08ec75 100644 --- a/httemplate/docs/about.html +++ b/httemplate/docs/about.html @@ -8,7 +8,7 @@
-© 2008 Freeside Internet Services, Inc.
+© 2009 Freeside Internet Services, Inc.
All rights reserved.
Licensed under the terms of the
GNU Affero General Public License.
-- cgit v1.2.1 From cf4ffd334502af562e924c24376333200073ccb8 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 17 Apr 2009 08:25:00 +0000 Subject: AFFERO BITCHES --- httemplate/docs/about.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/docs/about.html b/httemplate/docs/about.html index d0c08ec75..fbf0a66f5 100644 --- a/httemplate/docs/about.html +++ b/httemplate/docs/about.html @@ -11,7 +11,7 @@ © 2009 Freeside Internet Services, Inc.
All rights reserved.
Licensed under the terms of the
-GNU Affero General Public License.
+GNU Affero General Public License.

-- cgit v1.2.1 From 8f548b7139b1bd093c2e23eafcd1e29e64f8e8b7 Mon Sep 17 00:00:00 2001 From: jeff Date: Tue, 21 Apr 2009 02:23:13 +0000 Subject: more descriptive progress popups --- httemplate/elements/progress-popup.html | 2 ++ 1 file changed, 2 insertions(+) (limited to 'httemplate') diff --git a/httemplate/elements/progress-popup.html b/httemplate/elements/progress-popup.html index 0bd71ff4a..8a55efb4a 100644 --- a/httemplate/elements/progress-popup.html +++ b/httemplate/elements/progress-popup.html @@ -31,10 +31,12 @@ function updateStatus( status_statustext ) { var statusArray = eval('(' + status_statustext + ')'); var status = statusArray[0]; var statustext = statusArray[1]; + var actiontext = statusArray[2]; //if ( status == 'progress' ) { //IE workaround, no i have no idea why if ( status.indexOf('progress') > -1 ) { + document.getElementById("progress_message").innerHTML = actiontext + '...'; document.getElementById("progress_percent").innerHTML = statustext + '%'; bar1.set(statustext); bar1.update; -- cgit v1.2.1 From d8a9cc7f94af67cfde06e9a5cf38d3d34868856f Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 21 Apr 2009 20:28:06 +0000 Subject: rate download/edit/upload, RT#5108 --- httemplate/browse/rate_region.html | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/rate_region.html b/httemplate/browse/rate_region.html index b454a9e74..953bbf17a 100644 --- a/httemplate/browse/rate_region.html +++ b/httemplate/browse/rate_region.html @@ -12,9 +12,9 @@ 'order_by' => 'ORDER BY LOWER(regionname)', }, 'count_query' => $count_query, - 'header' => [ '#', 'Region', 'Country code', 'Prefixes' ], - 'fields' => [ 'regionnum', 'regionname', 'ccode', 'prefixes' ], - 'links' => [ $link, $link, $link, $link ], + 'header' => \@header, + 'fields' => \@fields, + 'links' => \@links, ) %> <%once> @@ -58,6 +58,10 @@ my $base_count_sql = 'SELECT COUNT(*) FROM rate_region'; die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); +my @header = ( '#', 'Region', 'Country code', 'Prefixes' ); +my @fields = ( 'regionnum', 'regionname', 'ccode', 'prefixes' ); +my @links = ( $link, $link, $link, $link ); + $cgi->param('dummy', 1); my $countrycode_filter_change = "window.location = '". -- cgit v1.2.1 From ce022f46d74bc76ef228eafa094251e31dafaf97 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 21 Apr 2009 20:59:43 +0000 Subject: rate download/edit/upload, RT#5108 --- httemplate/browse/rate_region.html | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/browse/rate_region.html b/httemplate/browse/rate_region.html index 953bbf17a..456ba3452 100644 --- a/httemplate/browse/rate_region.html +++ b/httemplate/browse/rate_region.html @@ -40,7 +40,7 @@ if ( driver_name =~ /^Pg/ ) { " END"; my $prefixes_sql = "SELECT $prefix_sql $fromwhere AND npa IS NOT NULL"; $select .= "( SELECT countrycode $fromwhere LIMIT 1 ) AS ccode, - ARRAY_TO_STRING( ARRAY($prefixes_sql), ',' ) AS prefixes"; + ARRAY_TO_STRING( ARRAY($prefixes_sql), ', ' ) AS prefixes"; } elsif ( driver_name =~ /^mysql/i ) { $join = 'LEFT JOIN rate_prefix USING ( regionnum )'; $select .= "GROUP_CONCAT( DISTINCT countrycode ) AS ccode, @@ -52,6 +52,8 @@ if ( driver_name =~ /^Pg/ ) { my $base_count_sql = 'SELECT COUNT(*) FROM rate_region'; +tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities(); + <%init> @@ -80,6 +82,40 @@ if ( $cgi->param('countrycode') =~ /^(\d+)$/ ) { $count_query .= " WHERE $ccode_sql = '$1'"; } +sub _rate_detail_factory { + my( $rate, $field ) = @_; + return sub { + my $rate_detail = $rate->dest_detail(shift) + || new FS::rate_region { 'min_included' => 0, + 'min_charge' => 0, + 'sec_granularity' => 0, + }; + my $value = $rate_detail->$field(); + $field eq 'sec_granularity' ? $granularity{$value} : $value; + }; +} + +if ( $cgi->param('show_rates') ) { + foreach my $rate ( qsearch('rate', {}) ) { + + my $label = $rate->ratenum.': '. $rate->ratename; + push @header, "$label: Included minutes/calls", + "$label: Charge per minute/call", + "$label: Granularity", + "$label: Usage class"; + + #closure me harder + push @fields, _rate_detail_factory($rate, 'min_included'), + _rate_detail_factory($rate, 'min_charge'), + _rate_detail_factory($rate, 'sec_granularity'), + _rate_detail_factory($rate, 'classnum'); + + push @links, '', '', '', ''; + + } + +} + my $html_posttotal = '(show country code: '. qq( +
!; if ( $fixed ) { -- cgit v1.2.1 From b9ec1f7c51efb5122b7dc88ccadb34e9e99a3b6f Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 3 May 2009 22:45:40 +0000 Subject: break down search.html into components, RT#5108 --- httemplate/search/elements/search-csv.html | 48 +++ httemplate/search/elements/search-html.html | 453 ++++++++++++++++++++++ httemplate/search/elements/search-xls.html | 81 ++++ httemplate/search/elements/search.html | 569 +--------------------------- 4 files changed, 597 insertions(+), 554 deletions(-) create mode 100644 httemplate/search/elements/search-csv.html create mode 100644 httemplate/search/elements/search-html.html create mode 100644 httemplate/search/elements/search-xls.html (limited to 'httemplate') diff --git a/httemplate/search/elements/search-csv.html b/httemplate/search/elements/search-csv.html new file mode 100644 index 000000000..cd4ea63f5 --- /dev/null +++ b/httemplate/search/elements/search-csv.html @@ -0,0 +1,48 @@ +% $csv->combine(@$header); #or die $csv->status; +% +<% $csv->string %>\ +% +% foreach my $row ( @$rows ) { +% +% if ( $opt{'fields'} ) { +% +% my @line = (); +% +% foreach my $field ( @{$opt{'fields'}} ) { +% if ( ref($field) eq 'CODE' ) { +% push @line, map { +% ref($_) eq 'ARRAY' +% ? '(N/A)' #unimplemented +% : $_; +% } +% &{$field}($row); +% } else { +% push @line, $row->$field(); +% } +% } +% +% $csv->combine(@line); #or die $csv->status; +% +% } else { +% $csv->combine(@$row); #or die $csv->status; +% } +% +% +<% $csv->string %>\ +% +% } +<%init> + +my %args = @_; +my $header = $args{'header'}; +my $rows = $args{'rows'}; +my %opt = %{ $args{'opt'} }; + +#http_header('Content-Type' => 'text/comma-separated-values' ); #IE chokes +http_header('Content-Type' => 'text/plain' ); + +my $csv = new Text::CSV_XS { 'always_quote' => 1, + 'eol' => "\n", #"\015\012", #"\012" + }; + + diff --git a/httemplate/search/elements/search-html.html b/httemplate/search/elements/search-html.html new file mode 100644 index 000000000..60dd65a5c --- /dev/null +++ b/httemplate/search/elements/search-html.html @@ -0,0 +1,453 @@ +% +% if ( exists($opt{'redirect'}) && scalar(@$rows) == 1 && $total == 1 +% && $type ne 'html-print' +% ) { +% my $redirect = $opt{'redirect'}; +% $redirect = &{$redirect}($rows->[0], $cgi) if ref($redirect) eq 'CODE'; +% my( $url, $method ) = @$redirect; +% redirect( $url. $rows->[0]->$method() ); +% } elsif ( exists($opt{'redirect_empty'}) && ! scalar(@$rows) && $total == 0 +% && $type ne 'html-print' +% && $opt{'redirect_empty'} +% && ( ref($opt{'redirect_empty'}) ne 'CODE' +% || &{$opt{'redirect_empty'}}($cgi) ) +% ) { +% my $redirect = $opt{'redirect_empty'}; +% $redirect = &{$redirect}($cgi) if ref($redirect) eq 'CODE'; +% redirect( $redirect ); +% } else { +% if ( $opt{'name_singular'} ) { +% $opt{'name'} = PL($opt{'name_singular'}); +% } +% ( my $xlsname = $opt{'name'} ) =~ s/\W//g; +% if ( $total == 1 ) { +% if ( $opt{'name_singular'} ) { +% $opt{'name'} = $opt{'name_singular'} +% } else { +% #$opt{'name'} =~ s/s$// if $total == 1; +% $opt{'name'} =~ s/((s)e)?s$/$2/ if $total == 1; +% } +% } +% +% if ( $type eq 'html-print' ) { + + <% include( '/elements/header-popup.html', $opt{'title'} ) %> + +% } elsif ( $type eq 'select' ) { + + <% include( '/elements/header-popup.html', $opt{'title'} ) %> + <% defined($opt{'html_init'}) + ? ( ref($opt{'html_init'}) + ? &{$opt{'html_init'}}() + : $opt{'html_init'} + ) + : '' + %> + +% } else { +% +% my @menubar = (); +% if ( $opt{'menubar'} ) { +% @menubar = @{ $opt{'menubar'} }; +% #} else { +% # @menubar = ( 'Main menu' => $p ); +% } + + <% include( '/elements/header.html', $opt{'title'}, + include( '/elements/menubar.html', @menubar ) + ) + %> + + <% defined($opt{'html_init'}) + ? ( ref($opt{'html_init'}) + ? &{$opt{'html_init'}}() + : $opt{'html_init'} + ) + : '' + %> + +% } + +% unless ( $total ) { +% unless ( $opt{'disable_nonefound'} ) { + No matching <% $opt{'name'} %> found.
+% } +% } +% +% if ( $total || $opt{'disableable'} ) { #hmm... and there *are* ones to show?? + + + + + + +% unless ( $opt{'disable_download'} || $type eq 'html-print' ) { + + +% $cgi->param('_type', "html" ); +% } + + + + +% my $h2 = 0; +% foreach my $header ( @{ $opt{header} } ) { +% my $label = ref($header) ? $header->{label} : $header; +% my $rowspan = 1; +% my $style = ''; +% if ( $opt{header2} ) { +% if ( !length($opt{header2}->[$h2]) ) { +% $rowspan = 2; +% splice @{ $opt{header2} }, $h2, 1; +% } else { +% $h2++; +% $style = 'STYLE="border-bottom: none"' +% } +% } + +% } + + +% if ( $opt{header2} ) { + +% foreach my $header ( @{ $opt{header2} } ) { +% my $label = ref($header) ? $header->{label} : $header; + +% } + +% } + +% my $bgcolor1 = '#eeeeee'; +% my $bgcolor2 = '#ffffff'; +% my $bgcolor; +% +% foreach my $row ( @$rows ) { +% +% if ( $bgcolor eq $bgcolor1 ) { +% $bgcolor = $bgcolor2; +% } else { +% $bgcolor = $bgcolor1; +% } + + + +% if ( $opt{'fields'} ) { +% +% my $links = $opt{'links'} ? [ @{$opt{'links'}} ] : ''; +% my $onclicks = $opt{'link_onclicks'} ? [ @{$opt{'link_onclicks'}} ] : []; +% my $aligns = $opt{'align'} ? [ @{$opt{'align'}} ] : ''; +% my $colors = $opt{'color'} ? [ @{$opt{'color'}} ] : []; +% my $sizes = $opt{'size'} ? [ @{$opt{'size'}} ] : []; +% my $styles = $opt{'style'} ? [ @{$opt{'style'}} ] : []; +% my $cstyles = $opt{'cell_style'} ? [ @{$opt{'cell_style'}} ] : []; +% +% foreach my $field ( +% +% map { +% if ( ref($_) eq 'ARRAY' ) { +% +% my $tableref = $_; +% +% '
+ + + +% if (! $opt{'disable_total'}) { + <% $total %> total <% $opt{'name'} %> +% } + +% if ( $confmax && $total > $confmax +% && ! $opt{'disable_maxselect'} +% && $type ne 'html-print' ) +% { +% $cgi->delete('maxrecords'); +% $cgi->param('_dummy', 1); + + ( show per page ) + +% $cgi->param('maxrecords', $maxrecords); +% } + +% if ( defined($opt{'html_posttotal'}) && $type ne 'html-print' ) { + <% ref($opt{'html_posttotal'}) + ? &{$opt{'html_posttotal'}}() + : $opt{'html_posttotal'} + %> +% } +
+ +% if ( $opt{'count_addl'} ) { +% my $n=0; +% foreach my $count ( @{$opt{'count_addl'}} ) { +% my $data = $count_arrayref->[++$n]; +% if ( ref($count) ) { + <% &{ $count }( $data ) %> +% } else { + <% sprintf( $count, $data ) %>
+% } +% } +% } + + +
+ + Download full results
+ +% $cgi->param('_type', "$xlsname.xls" ); + as Excel spreadsheet
+ +% $cgi->param('_type', 'csv'); + as CSV file
+ +% $cgi->param('_type', 'html-print'); + as printable copy + + <% $opt{'extra_choices_callback'} + ? &{$opt{'extra_choices_callback'}}($cgi->query_string) + : '' + %> + +
+ +% my $pager = ''; +% unless ( $type eq 'html_print' ) { + + <% $pager = include( '/elements/pager.html', + 'offset' => $offset, + 'num_rows' => scalar(@$rows), + 'total' => $total, + 'maxrecords' => $maxrecords, + ) + %> + + <% defined($opt{'html_form'}) + ? ( ref($opt{'html_form'}) + ? &{$opt{'html_form'}}() + : $opt{'html_form'} + ) + : '' + %> + +% } + + <% include('/elements/table-grid.html') %> + +
+ + > + <% $label %> +
+ <% $label %> +
'. +% +% join('', map { +% +% my $rowref = $_; +% +% ''. +% +% join('', map { +% +% my $e = $_; +% +% ''; +% +% } @$rowref ). +% +% ''; +% } @$tableref ). +% +% '
{$_}), +% qw( align bgcolor colspan rowspan +% style valign width ) +% ). +% '>'. +% +% ( $e->{'link'} +% ? '' +% : '' +% ). +% ( $e->{'size'} +% ? '' +% : '' +% ). +% ( $e->{'data_style'} +% ? '<'. uc($e->{'data_style'}). '>' +% : '' +% ). +% $e->{'data'}. +% ( $e->{'data_style'} +% ? '{'data_style'}). '>' +% : '' +% ). +% ( $e->{'size'} ? '' : '' ). +% ( $e->{'link'} ? '' : '' ). +% '
'; +% +% } else { +% $_; +% } +% } +% +% map { +% if ( ref($_) eq 'CODE' ) { +% &{$_}($row); +% } else { +% $row->$_(); +% } +% } +% @{$opt{'fields'}} +% +% ) { +% +% my $class = ( $field =~ /^agentnum ) +% || grep { $row->agentnum == $_ } +% @link_agentnums +% ) { +% +% $link = &{$link}($row) +% if ref($link) eq 'CODE'; +% +% $onclick = &{$onclick}($row) +% if ref($onclick) eq 'CODE'; +% $onclick = qq( onClick="$onclick") if $onclick; +% +% if ( $link ) { +% my( $url, $method ) = @{$link}; +% if ( ref($method) eq 'CODE' ) { +% $a = $url. &{$method}($row); +% } else { +% $a = $url. $row->$method(); +% } +% $a = qq(); +% } +% +% } +% +% } +% +% my $font = ''; +% my $color = shift @$colors; +% $color = &{$color}($row) if ref($color) eq 'CODE'; +% my $size = shift @$sizes; +% $size = &{$size}($row) if ref($size) eq 'CODE'; +% if ( $color || $size ) { +% $font = ''; +% } +% +% my($s, $es) = ( '', '' ); +% my $style = shift @$styles; +% $style = &{$style}($row) if ref($style) eq 'CODE'; +% if ( $style ) { +% $s = join( '', map "<$_>", split('', $style) ); +% $es = join( '', map "", split('', $style) ); +% } +% +% my $cstyle = shift @$cstyles; +% $cstyle = &{$cstyle}($row) if ref($cstyle) eq 'CODE'; +% $cstyle = qq(STYLE="$cstyle") +% if $cstyle; + + + +% } +% +% } else { +% +% foreach ( @$row ) { + +% } +% +% } + + + +% } + +% if ( $opt{'footer'} ) { + + + +% foreach my $footer ( @{ $opt{'footer'} } ) { + +% } + + +% } + +
<% $cstyle %>><% $font %><% $a %><% $s %><% $field %><% $es %><% $a ? '' : '' %><% $font ? '' : '' %><% $_ %>
<% $footer %>
+ + <% $pager %> + + + + +% } + +% if ( $type eq 'html-print' ) { + + + +% } else { + + <% defined($opt{'html_foot'}) + ? ( ref($opt{'html_foot'}) + ? &{$opt{'html_foot'}}() + : $opt{'html_foot'} + ) + : '' + %> + + <% include( '/elements/footer.html' ) %> + +% } + +% } +<%init> + +my %args = @_; +my $type = $args{'type'}; +my $header = $args{'header'}; +my $rows = $args{'rows'}; +my @link_agentnums = @{ $args{'link_agentnums'} }; +my $null_link = $args{'null_link'}; +my $confmax = $args{'confmax'}; +my $maxrecords = $args{'maxrecords'}; +my $offset = $args{'offset'}; +my %opt = %{ $args{'opt'} }; + +my $count_sth = dbh->prepare($opt{'count_query'}) + or die "Error preparing $opt{'count_query'}: ". dbh->errstr; +$count_sth->execute + or die "Error executing $opt{'count_query'}: ". $count_sth->errstr; +my $count_arrayref = $count_sth->fetchrow_arrayref; +my $total = $count_arrayref->[0]; + + diff --git a/httemplate/search/elements/search-xls.html b/httemplate/search/elements/search-xls.html new file mode 100644 index 000000000..8a6ad5cac --- /dev/null +++ b/httemplate/search/elements/search-xls.html @@ -0,0 +1,81 @@ +<% $data %> +<%init> + +my %args = @_; +my $type = $args{'type'}; +my $header = $args{'header'}; +my $rows = $args{'rows'}; +my %opt = %{ $args{'opt'} }; + +#http_header('Content-Type' => 'application/excel' ); #eww +#http_header('Content-Type' => 'application/msexcel' ); #alas +#http_header('Content-Type' => 'application/x-msexcel' ); #? + +#http://support.microsoft.com/kb/199841 +http_header('Content-Type' => 'application/vnd.ms-excel' ); + +#http://support.microsoft.com/kb/812935 +#http://support.microsoft.com/kb/323308 +$HTML::Mason::Commands::r->headers_out->{'Cache-control'} = 'max-age=0'; + +my $data = ''; +my $XLS = new IO::Scalar \$data; +my $workbook = Spreadsheet::WriteExcel->new($XLS) + or die "Error opening .xls file: $!"; + +my $worksheet = $workbook->add_worksheet(substr($opt{'title'},0,31)); + +my($r,$c) = (0,0); + +$worksheet->write($r, $c++, $_) foreach @$header; + +foreach my $row ( @$rows ) { + $r++; + $c = 0; + + if ( $opt{'fields'} ) { + + #my $links = $opt{'links'} ? [ @{$opt{'links'}} ] : ''; + #my $aligns = $opt{'align'} ? [ @{$opt{'align'}} ] : ''; + + foreach my $field ( @{$opt{'fields'}} ) { + #my $align = $aligns ? shift @$aligns : ''; + #$align = " ALIGN=$align" if $align; + #my $a = ''; + #if ( $links ) { + # my $link = shift @$links; + # $link = &{$link}($row) if ref($link) eq 'CODE'; + # if ( $link ) { + # my( $url, $method ) = @{$link}; + # if ( ref($method) eq 'CODE' ) { + # $a = $url. &{$method}($row); + # } else { + # $a = $url. $row->$method(); + # } + # $a = qq(); + # } + #} + if ( ref($field) eq 'CODE' ) { + foreach my $value ( &{$field}($row) ) { + if ( ref($value) eq 'ARRAY' ) { + $worksheet->write($r, $c++, '(N/A)' ); #unimplemented + } else { + $worksheet->write($r, $c++, $value ); + } + } + } else { + $worksheet->write($r, $c++, $row->$field() ); + } + } + + } else { + $worksheet->write($r, $c++, $_) foreach @$row; + } + +} + +$workbook->close();# or die "Error creating .xls file: $!"; + +http_header('Content-Length' => length($data) ); + + diff --git a/httemplate/search/elements/search.html b/httemplate/search/elements/search.html index 8835f8cae..59139327f 100644 --- a/httemplate/search/elements/search.html +++ b/httemplate/search/elements/search.html @@ -159,559 +159,27 @@ Example: % if ( $type eq 'csv' ) { % -% #http_header('Content-Type' => 'text/comma-separated-values' ); #IE chokes -% http_header('Content-Type' => 'text/plain' ); -% -% my $csv = new Text::CSV_XS { 'always_quote' => 1, -% 'eol' => "\n", #"\015\012", #"\012" -% }; -% -% $csv->combine(@$header); #or die $csv->status; -% -<% $csv->string %> -% -% -% foreach my $row ( @$rows ) { -% -% if ( $opt{'fields'} ) { -% -% my @line = (); -% -% foreach my $field ( @{$opt{'fields'}} ) { -% if ( ref($field) eq 'CODE' ) { -% push @line, map { -% ref($_) eq 'ARRAY' -% ? '(N/A)' #unimplemented -% : $_; -% } -% &{$field}($row); -% } else { -% push @line, $row->$field(); -% } -% } -% -% $csv->combine(@line); #or die $csv->status; -% -% } else { -% $csv->combine(@$row); #or die $csv->status; -% } -% -% -<% $csv->string %> -% -% -% } +<% include('search-csv.html', header=>$header, rows=>$rows, opt=>\%opt ) %> % % #} elsif ( $type eq 'excel' ) { % } elsif ( $type =~ /\.xls$/ ) { % -% #http_header('Content-Type' => 'application/excel' ); #eww -% #http_header('Content-Type' => 'application/msexcel' ); #alas -% #http_header('Content-Type' => 'application/x-msexcel' ); #? -% -% #http://support.microsoft.com/kb/199841 -% http_header('Content-Type' => 'application/vnd.ms-excel' ); -% -% #http://support.microsoft.com/kb/812935 -% #http://support.microsoft.com/kb/323308 -% $HTML::Mason::Commands::r->headers_out->{'Cache-control'} = 'max-age=0'; -% -% my $data = ''; -% my $XLS = new IO::Scalar \$data; -% my $workbook = Spreadsheet::WriteExcel->new($XLS) -% or die "Error opening .xls file: $!"; -% -% my $worksheet = $workbook->add_worksheet(substr($opt{'title'},0,31)); -% -% my($r,$c) = (0,0); -% -% $worksheet->write($r, $c++, $_) foreach @$header; -% -% foreach my $row ( @$rows ) { -% $r++; -% $c = 0; -% -% if ( $opt{'fields'} ) { -% -% #my $links = $opt{'links'} ? [ @{$opt{'links'}} ] : ''; -% #my $aligns = $opt{'align'} ? [ @{$opt{'align'}} ] : ''; -% -% foreach my $field ( @{$opt{'fields'}} ) { -% #my $align = $aligns ? shift @$aligns : ''; -% #$align = " ALIGN=$align" if $align; -% #my $a = ''; -% #if ( $links ) { -% # my $link = shift @$links; -% # $link = &{$link}($row) if ref($link) eq 'CODE'; -% # if ( $link ) { -% # my( $url, $method ) = @{$link}; -% # if ( ref($method) eq 'CODE' ) { -% # $a = $url. &{$method}($row); -% # } else { -% # $a = $url. $row->$method(); -% # } -% # $a = qq(); -% # } -% #} -% if ( ref($field) eq 'CODE' ) { -% foreach my $value ( &{$field}($row) ) { -% if ( ref($value) eq 'ARRAY' ) { -% $worksheet->write($r, $c++, '(N/A)' ); #unimplemented -% } else { -% $worksheet->write($r, $c++, $value ); -% } -% } -% } else { -% $worksheet->write($r, $c++, $row->$field() ); -% } -% } -% -% } else { -% $worksheet->write($r, $c++, $_) foreach @$row; -% } -% -% } -% -% $workbook->close();# or die "Error creating .xls file: $!"; -% -% http_header('Content-Length' => length($data) ); -% -<% $data %> -% +<% include('search-xls.html', header=>$header, rows=>$rows, opt=>\%opt ) %> % % } else { # regular HTML % -% if ( exists($opt{'redirect'}) && scalar(@$rows) == 1 && $total == 1 -% && $type ne 'html-print' -% ) { -% my $redirect = $opt{'redirect'}; -% $redirect = &{$redirect}($rows->[0], $cgi) if ref($redirect) eq 'CODE'; -% my( $url, $method ) = @$redirect; -% redirect( $url. $rows->[0]->$method() ); -% } elsif ( exists($opt{'redirect_empty'}) && ! scalar(@$rows) && $total == 0 -% && $type ne 'html-print' -% && $opt{'redirect_empty'} -% && ( ref($opt{'redirect_empty'}) ne 'CODE' -% || &{$opt{'redirect_empty'}}($cgi) ) -% ) { -% my $redirect = $opt{'redirect_empty'}; -% $redirect = &{$redirect}($cgi) if ref($redirect) eq 'CODE'; -% redirect( $redirect ); -% } else { -% if ( $opt{'name_singular'} ) { -% $opt{'name'} = PL($opt{'name_singular'}); -% } -% ( my $xlsname = $opt{'name'} ) =~ s/\W//g; -% if ( $total == 1 ) { -% if ( $opt{'name_singular'} ) { -% $opt{'name'} = $opt{'name_singular'} -% } else { -% #$opt{'name'} =~ s/s$// if $total == 1; -% $opt{'name'} =~ s/((s)e)?s$/$2/ if $total == 1; -% } -% } -% -% if ( $type eq 'html-print' ) { - - <% include( '/elements/header-popup.html', $opt{'title'} ) %> - -% } elsif ( $type eq 'select' ) { - - <% include( '/elements/header-popup.html', $opt{'title'} ) %> - <% defined($opt{'html_init'}) - ? ( ref($opt{'html_init'}) - ? &{$opt{'html_init'}}() - : $opt{'html_init'} - ) - : '' - %> - -% } else { -% -% my @menubar = (); -% if ( $opt{'menubar'} ) { -% @menubar = @{ $opt{'menubar'} }; -% #} else { -% # @menubar = ( 'Main menu' => $p ); -% } - - <% include( '/elements/header.html', $opt{'title'}, - include( '/elements/menubar.html', @menubar ) - ) - %> - - <% defined($opt{'html_init'}) - ? ( ref($opt{'html_init'}) - ? &{$opt{'html_init'}}() - : $opt{'html_init'} - ) - : '' - %> - -% } - -% unless ( $total ) { -% unless ( $opt{'disable_nonefound'} ) { - No matching <% $opt{'name'} %> found.
-% } -% } -% -% if ( $total || $opt{'disableable'} ) { #hmm... and there *are* ones to show?? - - - - - - -% unless ( $opt{'disable_download'} || $type eq 'html-print' ) { - - -% $cgi->param('_type', "html" ); -% } - - - - -% my $h2 = 0; -% foreach my $header ( @{ $opt{header} } ) { -% my $label = ref($header) ? $header->{label} : $header; -% my $rowspan = 1; -% my $style = ''; -% if ( $opt{header2} ) { -% if ( !length($opt{header2}->[$h2]) ) { -% $rowspan = 2; -% splice @{ $opt{header2} }, $h2, 1; -% } else { -% $h2++; -% $style = 'STYLE="border-bottom: none"' -% } -% } - -% } - - -% if ( $opt{header2} ) { - -% foreach my $header ( @{ $opt{header2} } ) { -% my $label = ref($header) ? $header->{label} : $header; - -% } - -% } - -% my $bgcolor1 = '#eeeeee'; -% my $bgcolor2 = '#ffffff'; -% my $bgcolor; -% -% foreach my $row ( @$rows ) { -% -% if ( $bgcolor eq $bgcolor1 ) { -% $bgcolor = $bgcolor2; -% } else { -% $bgcolor = $bgcolor1; -% } - - - -% if ( $opt{'fields'} ) { -% -% my $links = $opt{'links'} ? [ @{$opt{'links'}} ] : ''; -% my $onclicks = $opt{'link_onclicks'} ? [ @{$opt{'link_onclicks'}} ] : []; -% my $aligns = $opt{'align'} ? [ @{$opt{'align'}} ] : ''; -% my $colors = $opt{'color'} ? [ @{$opt{'color'}} ] : []; -% my $sizes = $opt{'size'} ? [ @{$opt{'size'}} ] : []; -% my $styles = $opt{'style'} ? [ @{$opt{'style'}} ] : []; -% my $cstyles = $opt{'cell_style'} ? [ @{$opt{'cell_style'}} ] : []; -% -% foreach my $field ( -% -% map { -% if ( ref($_) eq 'ARRAY' ) { -% -% my $tableref = $_; -% -% '
- -
- -% if (! $opt{'disable_total'}) { - <% $total %> total <% $opt{'name'} %> -% } - -% if ( $confmax && $total > $confmax -% && ! $opt{'disable_maxselect'} -% && $type ne 'html-print' ) -% { -% $cgi->delete('maxrecords'); -% $cgi->param('_dummy', 1); - - ( show per page ) - -% $cgi->param('maxrecords', $maxrecords); -% } - -% if ( defined($opt{'html_posttotal'}) && $type ne 'html-print' ) { - <% ref($opt{'html_posttotal'}) - ? &{$opt{'html_posttotal'}}() - : $opt{'html_posttotal'} - %> -% } -
- -% if ( $opt{'count_addl'} ) { -% my $n=0; -% foreach my $count ( @{$opt{'count_addl'}} ) { -% my $data = $count_arrayref->[++$n]; -% if ( ref($count) ) { - <% &{ $count }( $data ) %> -% } else { - <% sprintf( $count, $data ) %>
-% } -% } -% } -
- -
- - Download full results
- -% $cgi->param('_type', "$xlsname.xls" ); - as Excel spreadsheet
- -% $cgi->param('_type', 'csv'); - as CSV file
- -% $cgi->param('_type', 'html-print'); - as printable copy - - <% $opt{'extra_choices_callback'} - ? &{$opt{'extra_choices_callback'}}($cgi->query_string) - : '' - %> - -
- -% my $pager = ''; -% unless ( $type eq 'html_print' ) { - - <% $pager = include( '/elements/pager.html', - 'offset' => $offset, - 'num_rows' => scalar(@$rows), - 'total' => $total, - 'maxrecords' => $maxrecords, - ) - %> - - <% defined($opt{'html_form'}) - ? ( ref($opt{'html_form'}) - ? &{$opt{'html_form'}}() - : $opt{'html_form'} - ) - : '' - %> - -% } - - <% include('/elements/table-grid.html') %> - -
- - > - <% $label %> -
- <% $label %> -
'. -% -% join('', map { -% -% my $rowref = $_; -% -% ''. -% -% join('', map { -% -% my $e = $_; -% -% ''; -% -% } @$rowref ). -% -% ''; -% } @$tableref ). -% -% '
{$_}), -% qw( align bgcolor colspan rowspan -% style valign width ) -% ). -% '>'. -% -% ( $e->{'link'} -% ? '' -% : '' -% ). -% ( $e->{'size'} -% ? '' -% : '' -% ). -% ( $e->{'data_style'} -% ? '<'. uc($e->{'data_style'}). '>' -% : '' -% ). -% $e->{'data'}. -% ( $e->{'data_style'} -% ? '{'data_style'}). '>' -% : '' -% ). -% ( $e->{'size'} ? '' : '' ). -% ( $e->{'link'} ? '' : '' ). -% '
'; -% -% } else { -% $_; -% } -% } -% -% map { -% if ( ref($_) eq 'CODE' ) { -% &{$_}($row); -% } else { -% $row->$_(); -% } -% } -% @{$opt{'fields'}} -% -% ) { -% -% my $class = ( $field =~ /^agentnum ) -% || grep { $row->agentnum == $_ } -% @link_agentnums -% ) { -% -% $link = &{$link}($row) -% if ref($link) eq 'CODE'; -% -% $onclick = &{$onclick}($row) -% if ref($onclick) eq 'CODE'; -% $onclick = qq( onClick="$onclick") if $onclick; -% -% if ( $link ) { -% my( $url, $method ) = @{$link}; -% if ( ref($method) eq 'CODE' ) { -% $a = $url. &{$method}($row); -% } else { -% $a = $url. $row->$method(); -% } -% $a = qq(); -% } -% -% } -% -% } -% -% my $font = ''; -% my $color = shift @$colors; -% $color = &{$color}($row) if ref($color) eq 'CODE'; -% my $size = shift @$sizes; -% $size = &{$size}($row) if ref($size) eq 'CODE'; -% if ( $color || $size ) { -% $font = ''; -% } -% -% my($s, $es) = ( '', '' ); -% my $style = shift @$styles; -% $style = &{$style}($row) if ref($style) eq 'CODE'; -% if ( $style ) { -% $s = join( '', map "<$_>", split('', $style) ); -% $es = join( '', map "", split('', $style) ); -% } -% -% my $cstyle = shift @$cstyles; -% $cstyle = &{$cstyle}($row) if ref($cstyle) eq 'CODE'; -% $cstyle = qq(STYLE="$cstyle") -% if $cstyle; - - - -% } -% -% } else { -% -% foreach ( @$row ) { - -% } -% -% } - - - -% } - -% if ( $opt{'footer'} ) { - - - -% foreach my $footer ( @{ $opt{'footer'} } ) { - -% } - - -% } - -
<% $cstyle %>><% $font %><% $a %><% $s %><% $field %><% $es %><% $a ? '' : '' %><% $font ? '' : '' %><% $_ %>
<% $footer %>
- - <% $pager %> - - - - -% } - -% if ( $type eq 'html-print' ) { - - - -% } else { - - <% defined($opt{'html_foot'}) - ? ( ref($opt{'html_foot'}) - ? &{$opt{'html_foot'}}() - : $opt{'html_foot'} - ) - : '' - %> - - <% include( '/elements/footer.html' ) %> - -% } - -% } +<% include('search-html.html', + type => $type, + header => $header, + rows => $rows, + link_agentnums => \@link_agentnums, + null_link => $null_link, + confmax => $confmax, + maxrecords => $maxrecords, + offset => $offset, + opt => \%opt + ) +%> % % } <%init> @@ -833,7 +301,7 @@ my $type = $cgi->param('_type') =~ /^(csv|\w*\.xls|select|html(-print)?)$/ ? $1 : 'html'; my $limit = ''; -my($confmax, $maxrecords, $total, $offset, $count_arrayref); +my($confmax, $maxrecords, $offset ); unless ( $type =~ /^(csv|\w*\.xls)$/ ) { @@ -867,13 +335,6 @@ unless ( $type =~ /^(csv|\w*\.xls)$/ ) { } - my $count_sth = dbh->prepare($opt{'count_query'}) - or die "Error preparing $opt{'count_query'}: ". dbh->errstr; - $count_sth->execute - or die "Error executing $opt{'count_query'}: ". $count_sth->errstr; - $count_arrayref = $count_sth->fetchrow_arrayref; - $total = $count_arrayref->[0]; - } # run the query -- cgit v1.2.1 From 9f73c5d4c0954b3a03bfcb5e010fc288a7071209 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 4 May 2009 00:22:44 +0000 Subject: add menu item and page for d/ling and edit rates with excel. RT#5108 --- httemplate/browse/rate_region.html | 13 +++++--- httemplate/elements/menu.html | 16 ++++++---- httemplate/misc/rate_edit_excel.html | 51 ++++++++++++++++++++++++++++++ httemplate/search/elements/search-xls.html | 42 ++++++++++++------------ httemplate/search/elements/search.html | 8 +++-- 5 files changed, 97 insertions(+), 33 deletions(-) create mode 100644 httemplate/misc/rate_edit_excel.html (limited to 'httemplate') diff --git a/httemplate/browse/rate_region.html b/httemplate/browse/rate_region.html index 456ba3452..4e4986987 100644 --- a/httemplate/browse/rate_region.html +++ b/httemplate/browse/rate_region.html @@ -15,6 +15,7 @@ 'header' => \@header, 'fields' => \@fields, 'links' => \@links, + 'xls_format' => \@xls_format, ) %> <%once> @@ -40,7 +41,7 @@ if ( driver_name =~ /^Pg/ ) { " END"; my $prefixes_sql = "SELECT $prefix_sql $fromwhere AND npa IS NOT NULL"; $select .= "( SELECT countrycode $fromwhere LIMIT 1 ) AS ccode, - ARRAY_TO_STRING( ARRAY($prefixes_sql), ', ' ) AS prefixes"; + ARRAY_TO_STRING( ARRAY($prefixes_sql), ',' ) AS prefixes"; } elsif ( driver_name =~ /^mysql/i ) { $join = 'LEFT JOIN rate_prefix USING ( regionnum )'; $select .= "GROUP_CONCAT( DISTINCT countrycode ) AS ccode, @@ -60,9 +61,10 @@ tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities(); die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); -my @header = ( '#', 'Region', 'Country code', 'Prefixes' ); -my @fields = ( 'regionnum', 'regionname', 'ccode', 'prefixes' ); -my @links = ( $link, $link, $link, $link ); +my @header = ( '#', 'Region', 'Country code', 'Prefixes' ); +my @fields = ( 'regionnum', 'regionname', 'ccode', 'prefixes' ); +my @links = ( ($link) x 4 ); +my @xls_format = ( ({ locked=>1, bg_color=>22 }) x 4 ); $cgi->param('dummy', 1); my $countrycode_filter_change = @@ -110,7 +112,8 @@ if ( $cgi->param('show_rates') ) { _rate_detail_factory($rate, 'sec_granularity'), _rate_detail_factory($rate, 'classnum'); - push @links, '', '', '', ''; + push @links, ( ('') x 4 ); + push @xls_format, ( ({}) x 4 ); } diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html index 409a1525a..487373710 100644 --- a/httemplate/elements/menu.html +++ b/httemplate/elements/menu.html @@ -227,13 +227,16 @@ tie my %tools_importing, 'Tie::IxHash', 'Import payments from CSV file' => [ $fsurl.'misc/cust_pay-import.cgi', '' ], 'Import phone numbers (DIDs)' => [ $fsurl.'misc/phone_avail-import.html', '' ], 'Import Call Detail Records (CDRs) from CSV file' => [ $fsurl.'misc/cdr-import.html', '' ], +# 'Import call rates and regions' => [ $fsurl.'misc/rate-import.html', '' ], ; -if ( $conf->exists('taxdatadirectdownload') ) { - $tools_importing{'Import tax rates from vendor site'} = - [ $fsurl.'misc/tax-fetch_and_import.cgi', '' ]; -} else { - $tools_importing{'Import tax rates from CSV files'} = - [ $fsurl.'misc/tax-import.cgi', '' ]; +if ( $conf->exists('enable_taxproducts') ) { + if ( $conf->exists('taxdatadirectdownload') ) { + $tools_importing{'Import tax rates from vendor site'} = + [ $fsurl.'misc/tax-fetch_and_import.cgi', '' ]; + } else { + $tools_importing{'Import tax rates from CSV files'} = + [ $fsurl.'misc/tax-import.cgi', '' ]; + } } tie my %tools_exporting, 'Tie::IxHash', @@ -292,6 +295,7 @@ tie my %config_billing_rates, 'Tie::IxHash', 'View/Edit rate plans' => [ $fsurl.'browse/rate.cgi', 'Manage rate plans' ], 'View/Edit regions and prefixes' => [ $fsurl.'browse/rate_region.html', 'Manage regions and prefixes' ], 'View/Edit usage classes' => [ $fsurl.'browse/usage_class.html', 'Usage classes define groups of usage for taxation purposes.' ], + 'Edit rates with Excel' => [ $fsurl.'misc/rate_edit_excel.html', 'Download and edit rates with Excel, then upload changes.' ], ; tie my %config_billing, 'Tie::IxHash'; diff --git a/httemplate/misc/rate_edit_excel.html b/httemplate/misc/rate_edit_excel.html new file mode 100644 index 000000000..7d3255301 --- /dev/null +++ b/httemplate/misc/rate_edit_excel.html @@ -0,0 +1,51 @@ +<% include('/elements/header.html', 'Edit rates with Excel' ) %> + +<% include( '/elements/form-file_upload.html', + 'name' => 'RateImportForm', + 'action' => 'process/rate_edit_excel.html', + 'num_files' => 1, + 'fields' => [ 'format' ], #? + 'message' => 'Rate edit successful', + 'url' => $p."browse/rate_region.html", + ) +%> + +<% &ntable("#cccccc", 2) %> + + + 1. Download current rates: + + Download rate spreadsheet + + + + + 2. Edit rates with Excel (or other .XLS-compatible application) + + + <% include( '/elements/file-upload.html', + 'field' => 'file', + 'label' => '3. Upload edited rate file: '. ( ' 'x4 ), #yuck + ) + %> + + + + + + + + + + +<% include('/elements/footer.html') %> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + + diff --git a/httemplate/search/elements/search-xls.html b/httemplate/search/elements/search-xls.html index 8a6ad5cac..8a05e477c 100644 --- a/httemplate/search/elements/search-xls.html +++ b/httemplate/search/elements/search-xls.html @@ -25,9 +25,18 @@ my $workbook = Spreadsheet::WriteExcel->new($XLS) my $worksheet = $workbook->add_worksheet(substr($opt{'title'},0,31)); +$worksheet->protect(); + my($r,$c) = (0,0); -$worksheet->write($r, $c++, $_) foreach @$header; +my $header_format = $workbook->add_format( + bold => 1, + locked => 1, + bg_color => 55, #22, + bottom => 3, +); + +$worksheet->write($r, $c++, $_, $header_format ) foreach @$header; foreach my $row ( @$rows ) { $r++; @@ -37,39 +46,32 @@ foreach my $row ( @$rows ) { #my $links = $opt{'links'} ? [ @{$opt{'links'}} ] : ''; #my $aligns = $opt{'align'} ? [ @{$opt{'align'}} ] : ''; + #could also translate color, size, style into xls equivalents? + my $formats = $opt{'xls_format'} ? [ @{$opt{'xls_format'}} ] : []; foreach my $field ( @{$opt{'fields'}} ) { - #my $align = $aligns ? shift @$aligns : ''; - #$align = " ALIGN=$align" if $align; - #my $a = ''; - #if ( $links ) { - # my $link = shift @$links; - # $link = &{$link}($row) if ref($link) eq 'CODE'; - # if ( $link ) { - # my( $url, $method ) = @{$link}; - # if ( ref($method) eq 'CODE' ) { - # $a = $url. &{$method}($row); - # } else { - # $a = $url. $row->$method(); - # } - # $a = qq(); - # } - #} + + my $format = shift @$formats; + $format = &{$format}($row) if ref($format) eq 'CODE'; + $format ||= {}; + my $xls_format = $workbook->add_format(locked=>0, %$format); + if ( ref($field) eq 'CODE' ) { foreach my $value ( &{$field}($row) ) { if ( ref($value) eq 'ARRAY' ) { $worksheet->write($r, $c++, '(N/A)' ); #unimplemented } else { - $worksheet->write($r, $c++, $value ); + $worksheet->write($r, $c++, $value, $xls_format ); } } } else { - $worksheet->write($r, $c++, $row->$field() ); + $worksheet->write($r, $c++, $row->$field(), $xls_format ); } } } else { - $worksheet->write($r, $c++, $_) foreach @$row; + my $xls_format = $workbook->add_format(locked=>0); + $worksheet->write($r, $c++, $_, $xls_format ) foreach @$row; } } diff --git a/httemplate/search/elements/search.html b/httemplate/search/elements/search.html index 59139327f..a66176d00 100644 --- a/httemplate/search/elements/search.html +++ b/httemplate/search/elements/search.html @@ -148,11 +148,15 @@ Example: 'align' => 'lrc.', #listrefs of ( scalars or coderefs ) - #currently only HTML, maybe eventually Excel too + # currently only HTML, maybe eventually Excel too 'color' => [], 'size' => [], 'style' => [], # or , etc. 'cell_style' => [], #STYLE= attribute of TR, very HTML-specific... + + # Excel-specific listref of ( hashrefs or coderefs ) + # each hashref: http://search.cpan.org/dist/Spreadsheet-WriteExcel/lib/Spreadsheet/WriteExcel.pm#Format_methods_and_Format_properties + 'xls_format' => => [], ); @@ -227,7 +231,7 @@ if ( $opt{'agent_virt'} ) { #false laziness w/statuspos above my $pos = $opt{'agent_pos'}; - foreach my $att (qw( align style color size )) { + foreach my $att (qw( align color size style cell_style xls_format )) { $opt{$att} ||= [ map '', @{ $opt{'fields'} } ]; } -- cgit v1.2.1 From b528a04c4f4ae1addb1cb22e0489f7c5dc5941b8 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 4 May 2009 02:01:43 +0000 Subject: agent-virt prepaid income report, RT#5311 --- httemplate/search/report_prepaid_income.cgi | 38 ++++++++++++--- httemplate/search/report_prepaid_income.html | 70 +++++++++++++++++----------- 2 files changed, 75 insertions(+), 33 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/report_prepaid_income.cgi b/httemplate/search/report_prepaid_income.cgi index 27dbcbf9f..ce928b81c 100644 --- a/httemplate/search/report_prepaid_income.cgi +++ b/httemplate/search/report_prepaid_income.cgi @@ -38,22 +38,46 @@ my $now = $cgi->param('date') && str2time($cgi->param('date')) || $time; $now =~ /^(\d+)$/ or die "unparsable date?"; $now = $1; +my @where = (); + +if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) { + my $agentnum = $1; + push @where, "agentnum = $agentnum"; +} + +#here is the agent virtualization +push @where, $FS::CurrentUser::CurrentUser->agentnums_sql; + +my $where = join(' AND ', @where); +$where = "AND $where" if $where; + my( $total, $total_legacy ) = ( 0, 0 ); my @cust_bill_pkg = grep { $_->cust_pkg && $_->cust_pkg->part_pkg->freq !~ /^([01]|\d+[dw])$/ } - qsearch( 'cust_bill_pkg', { - 'recur' => { op=>'!=', value=>0 }, - 'edate' => { op=>'>', value=>$now }, - }, ); + qsearch({ + 'select' => 'cust_bill_pkg.*', + 'table' => 'cust_bill_pkg', + 'addl_from' => ' LEFT JOIN cust_bill USING ( invnum ) '. + ' LEFT JOIN cust_main USING ( custnum ) ', + 'hashref' => { + 'recur' => { op=>'!=', value=>0 }, + 'edate' => { op=>'>', value=>$now }, + }, + 'extra_sql' => $where, + }); my @cust_pkg = grep { $_->part_pkg->recur != 0 && $_->part_pkg->freq !~ /^([01]|\d+[dw])$/ } - qsearch ( 'cust_pkg', { - 'bill' => { op=>'>', value=>$now } - } ); + qsearch({ + 'select' => 'cust_pkg.*', + 'table' => 'cust_pkg', + 'addl_from' => ' LEFT JOIN cust_main USING ( custnum ) ', + 'hashref' => { 'bill' => { op=>'>', value=>$now } }, + 'extra_sql' => $where, + }); foreach my $cust_bill_pkg ( @cust_bill_pkg) { my $period = $cust_bill_pkg->edate - $cust_bill_pkg->sdate; diff --git a/httemplate/search/report_prepaid_income.html b/httemplate/search/report_prepaid_income.html index 81adb64ad..d707bd81b 100644 --- a/httemplate/search/report_prepaid_income.html +++ b/httemplate/search/report_prepaid_income.html @@ -1,28 +1,46 @@ -<% include('/elements/header.html', 'Prepaid Income (Unearned Revenue) Report', - '', - '', - ' - - - - ' -) %> - -
- - - - - - - - - -
Prepaid income (unearned revenue) as of - - -
- m/d/y
+<% include('/elements/header.html','Prepaid Income (Unearned Revenue) Report')%> + +<% include('/elements/init_calendar.html') %> + + + + + + + + + + + + + + + + + + + + + + + <% include( '/elements/tr-select-agent.html', 'disable_empty'=>0 ) %> + + + + + + + + + +
+ Search options +
As of + + +
+ m/d/y
 
 
+ - +
<% include('/elements/footer.html') %> <%init> -- cgit v1.2.1 From 791b34f7cb476e7c645d8eb7019dde9fdf5cf663 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 5 May 2009 10:40:15 +0000 Subject: finish the import portion of excel rate edit, RT#5108 --- httemplate/elements/file-upload.html | 2 +- httemplate/misc/process/rate_edit_excel.html | 10 ++++++++++ httemplate/misc/rate_edit_excel.html | 14 ++++++++++++-- 3 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 httemplate/misc/process/rate_edit_excel.html (limited to 'httemplate') diff --git a/httemplate/elements/file-upload.html b/httemplate/elements/file-upload.html index c8b026d04..7e2eeefcd 100644 --- a/httemplate/elements/file-upload.html +++ b/httemplate/elements/file-upload.html @@ -55,7 +55,7 @@ % foreach (@field) { - <% shift @label %> + <% shift @label %> % } diff --git a/httemplate/misc/process/rate_edit_excel.html b/httemplate/misc/process/rate_edit_excel.html new file mode 100644 index 000000000..acd5f4995 --- /dev/null +++ b/httemplate/misc/process/rate_edit_excel.html @@ -0,0 +1,10 @@ +<% $server->process %> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +my $server = new FS::UI::Web::JSRPC 'FS::rate_detail::process_edit_import', $cgi; + + + diff --git a/httemplate/misc/rate_edit_excel.html b/httemplate/misc/rate_edit_excel.html index 7d3255301..e73133c05 100644 --- a/httemplate/misc/rate_edit_excel.html +++ b/httemplate/misc/rate_edit_excel.html @@ -4,7 +4,7 @@ 'name' => 'RateImportForm', 'action' => 'process/rate_edit_excel.html', 'num_files' => 1, - 'fields' => [ 'format' ], #? + 'fields' => [ 'format' ], 'message' => 'Rate edit successful', 'url' => $p."browse/rate_region.html", ) @@ -23,12 +23,22 @@ 2. Edit rates with Excel (or other .XLS-compatible application) + + +     - To add rates, add four columns like an existing rate, with headers starting with "NEW: Rate Name" or "Rate Name".
+     - For rate addition, protection can be turned off in Excel via the Tools->Protection->Unprotect Sheet menu command. Note that only new rates can be added; modified grayed out cells will not be imported. + + + <% include( '/elements/file-upload.html', 'field' => 'file', - 'label' => '3. Upload edited rate file: '. ( ' 'x4 ), #yuck + 'label' => '3. Upload edited rate file: ', + 'label_align' => 'left', ) %> + + Date: Tue, 5 May 2009 22:02:28 +0000 Subject: hide agent.invoice_template edit by default, with a config to turn back on, RT#5218 --- httemplate/edit/agent.cgi | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/agent.cgi b/httemplate/edit/agent.cgi index 215542de3..a0af9fa44 100755 --- a/httemplate/edit/agent.cgi +++ b/httemplate/edit/agent.cgi @@ -46,13 +46,21 @@ Agent #<% $agent->agentnum ? $agent->agentnum : "(NEW)" %> disabled eq 'Y' ? ' CHECKED' : '' %>> +% if ( $conf->exists('agent-invoice_template') ) { + <% include('/elements/tr-select-invoice_template.html', 'label' => 'Invoice template', 'field' => 'invoice_template', 'curr_value' => $agent->invoice_template, ) %> - + +% } else { + + + +% } + % if ( $conf->config('ticket_system') ) { % my $default_queueid = $conf->config('ticket_system-default_queueid'); % my $default_queue = FS::TicketSystem->queue($default_queueid); -- cgit v1.2.1 From 277ef4d5ea367fa4819fde5bed75ede8e53a7d9d Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 8 May 2009 08:41:10 +0000 Subject: fix cloning of custom packages where you've changed '(CUSTOM)', RT#5350 --- httemplate/edit/part_pkg.cgi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index f40469937..a2ec63068 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -209,7 +209,9 @@ my $disabled_type = $acl_edit_either ? 'checkbox' : 'hidden'; my $agent_clone_extra_sql = ' ( '. FS::part_pkg->curuser_pkgs_sql. #kludge to clone custom customer packages you otherwise couldn't see - " OR ( part_pkg.disabled = 'Y' AND part_pkg.comment LIKE '(CUSTOM)%' ) ". + #really need a proper "CUSTOM" flag that's distinct from disabled + #" OR ( part_pkg.disabled = 'Y' AND part_pkg.comment LIKE '(CUSTOM)%' ) ". + " OR ( part_pkg.disabled = 'Y' ) ". ' ) '; my $conf = new FS::Conf; -- cgit v1.2.1 From f920fdb29a19105c9102d29e532f8cbb40dd1171 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 9 May 2009 00:39:13 +0000 Subject: add ability to configure service labels per-package (still need to actually use the labels), RT#4081 --- httemplate/browse/part_svc.cgi | 27 ++++++++++++++++++++------- httemplate/edit/part_svc.cgi | 25 ++++++++++++++++++++----- 2 files changed, 40 insertions(+), 12 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi index f1b283638..94afdef15 100755 --- a/httemplate/browse/part_svc.cgi +++ b/httemplate/browse/part_svc.cgi @@ -55,6 +55,8 @@ function part_export_areyousure(href) { Field + Label + Modifier @@ -65,8 +67,15 @@ function part_export_areyousure(href) { % my @dfields = $svc_x->fields; % push @dfields, 'usergroup' if $svcdb eq 'svc_acct'; #kludge % my @fields = -% grep { $svc_x->pvf($_) -% or $_ ne 'svcnum' && $part_svc->part_svc_column($_)->columnflag } +% grep { my $col = $part_svc->part_svc_column($_); +% my $def = FS::part_svc->svc_table_fields($svcdb)->{$_}; +% $svc_x->pvf($_) +% or $_ ne 'svcnum' && ( +% $col->columnflag || ( $col->columnlabel !~ /^\S*$/ +% && $col->columnlabel ne $def->{'label'} +% ) +% ) +% } % @dfields ; % my $rowspan = scalar(@fields) || 1; % my $url = "${p}edit/part_svc.cgi?". $part_svc->svcpart; @@ -128,21 +137,25 @@ function part_export_areyousure(href) { % unless ( @fields ) { -% for ( 1..3 ) { +% for ( 1..4 ) { % } % } % % my($n1)=''; % foreach my $field ( @fields ) { -% my $formatter = -% FS::part_svc->svc_table_fields($svcdb)->{$field}->{format} -% || sub { shift }; -% my $flag = $part_svc->part_svc_column($field)->columnflag; % +% #a few lines of false laziness w/edit/part_svc.cgi +% my $def = FS::part_svc->svc_table_fields($svcdb)->{$field}; +% my $formatter = $def->{format} || sub { shift }; +% +% my $part_svc_column = $part_svc->part_svc_column($field); +% my $label = $part_svc_column->columnlabel || $def->{'label'}; +% my $flag = $part_svc_column->columnflag; <% $n1 %> <% $field %> + <% $label %> <% $flag{$flag} %> diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index deb3c80f9..79703435c 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -122,6 +122,7 @@ that field. % $html .= include('/elements/table-grid.html', 'cellpadding' => 4 ). % ''. % 'Field'. +% 'Label'. % 'Modifier'. % ''; % @@ -146,13 +147,15 @@ that field. % % foreach my $field (@fields) { % -% #my $def = $defs{$layer}{$field}; +% #a few lines of false laziness w/browse/part_svc.cgi % my $def = FS::part_svc->svc_table_fields($layer)->{$field}; -% my $label = $def->{'def_label'} || $def->{'label'}; +% my $def_info = $def->{'def_info'}; % my $formatter = $def->{'format'} || sub { shift }; +% % my $part_svc_column = $part_svc->part_svc_column($field); +% my $label = $part_svc_column->columnlabel || $def->{'label'}; % my $value = &$formatter($part_svc_column->columnvalue); -% my $flag = $part_svc_column->columnflag; +% my $flag = $part_svc_column->columnflag; % % if ( $bgcolor eq $bgcolor1 ) { % $bgcolor = $bgcolor2; @@ -160,9 +163,12 @@ that field. % $bgcolor = $bgcolor1; % } % -% $html .= qq!!. -% ( $label || $field ). +% $html .= qq!!. +% ( $def->{'label'} || $field ). % ""; +% +% $html .= qq!'; +% % $flag = '' if $def->{type} eq 'disabled'; % % $html .= qq!!; @@ -302,6 +308,15 @@ that field. % } % % $html .= "\n"; + +% $def_info = "($def_info)" if $def_info; +% $html .= +% qq!!. +% qq! !. +% qq! $def_info!. +% qq! !. +% qq!\n!; % % } #foreach my $field (@fields) { % -- cgit v1.2.1 From 39120f69d4372781aba0df58d06736be450009e1 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 9 May 2009 01:44:08 +0000 Subject: use service-def specific labels, at least for service pages that use {view,edit}/elements/svc_Common.html RT#4081 --- httemplate/edit/elements/edit.html | 36 +++++++++++++++++--------------- httemplate/edit/elements/svc_Common.html | 28 ++++++++++++++++++++++--- httemplate/view/elements/svc_Common.html | 8 +++++++ 3 files changed, 52 insertions(+), 20 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html index d18a37d5a..4a6079a85 100644 --- a/httemplate/edit/elements/edit.html +++ b/httemplate/edit/elements/edit.html @@ -132,37 +132,39 @@ Example: # initialization callbacks ### - ###global callbacks + ###global callbacks, always run if provided - #always run if provided, after decoding long CGI "redirect=" responses but + #after decoding long CGI "redirect=" responses but # before object creation/search # (useful if you have a long form that might trigger redirect= and you need # to do things with $cgi params - they're not decoded in the calling # <%init> block yet) 'begin_callback' = sub { my( $cgi, $fields_listref, $opt_hashref ) = @_; }, - #always run, after the mode-specific object creation/search + #after the mode-specific object creation/search 'end_callback' = sub { my( $cgi, $object, $fields_listref, $opt_hashref ) = @_; }, - ###mode-specific callbacks + ###mode-specific callbacks. one (and only one) of these four is called + #run when adding + 'new_callback' => sub { my( $cgi, $object, $fields_listref, $opt_hashref ) = @_; }, + + #run when editing + 'edit_callback' => sub { my( $cgi, $object, $fields_listref, $opt_hashref ) = @_; }, + #run when re-displaying with an error 'error_callback' => sub { my( $cgi, $object, $fields_listref, $opt_hashref ) = @_; }, - #run when editing - 'edit_callback' => sub { my( $cgi, $object, $fields_listref ) = @_; }, - + #run when cloning + 'clone_callback' => sub { my( $cgi, $object, $fields_listref, $opt_hashref ) = @_; }, + + ###callbacks called in new mode only + # returns a hashref for the new object 'new_hashref_callback' # returns the new object iself (otherwise, ->new is called) 'new_object_callback' - - #run when adding - 'new_callback' => sub { my( $cgi, $object, $fields_listref ) = @_; }, - - #run when cloning - 'clone_callback' => sub { my( $cgi, $object, $fields_listref, $opt_hashref ) = @_; }, ###display callbacks @@ -618,7 +620,7 @@ if ( $cgi->param('error') ) { map { $_ => scalar($cgi->param($_)) } fields($table) }); - &{$opt{'error_callback'}}($cgi, $object, $fields, \%opt ) + &{$opt{'error_callback'}}( $cgi, $object, $fields, \%opt ) if $opt{'error_callback'}; } elsif ( $cgi->param('clone') =~ /^(\d+)$/ ) { @@ -632,7 +634,7 @@ if ( $cgi->param('error') ) { $object = qsearchs({ %qsearch, 'hashref' => { $pkey => $clone } }); - &{$opt{'clone_callback'}}($cgi, $object, $fields, \%opt ) + &{$opt{'clone_callback'}}( $cgi, $object, $fields, \%opt ) if $opt{'clone_callback'}; #$object->$pkey(''); @@ -657,7 +659,7 @@ if ( $cgi->param('error') ) { warn "$table $pkey => $1" if $opt{'debug'}; - &{$opt{'edit_callback'}}($cgi, $object, $fields) + &{$opt{'edit_callback'}}( $cgi, $object, $fields, \%opt ) if $opt{'edit_callback'}; } else { #adding @@ -672,7 +674,7 @@ if ( $cgi->param('error') ) { ? &{$opt{'new_object_callback'}}( $cgi, $hashref, $fields, \%opt ) : $class->new( $hashref ); - &{$opt{'new_callback'}}($cgi, $object, $fields) + &{$opt{'new_callback'}}( $cgi, $object, $fields, \%opt ) if $opt{'new_callback'}; } diff --git a/httemplate/edit/elements/svc_Common.html b/httemplate/edit/elements/svc_Common.html index 0b64120fb..ef04bd04a 100644 --- a/httemplate/edit/elements/svc_Common.html +++ b/httemplate/edit/elements/svc_Common.html @@ -3,7 +3,7 @@ 'menubar' => [], 'error_callback' => sub { - my( $cgi, $svc_x ) = @_; + my( $cgi, $svc_x, $fields, $opt ) = @_; #$svcnum = $svc_x->svcnum; $pkgnum = $cgi->param('pkgnum'); $svcpart = $cgi->param('svcpart'); @@ -11,11 +11,13 @@ $part_svc = qsearchs( 'part_svc', { svcpart=>$svcpart }); die "No part_svc entry!" unless $part_svc; + label_fixup($part_svc, $opt); + $svc_x->setfield('svcpart', $svcpart); }, 'edit_callback' => sub { - my( $cgi, $svc_x ) = @_; + my( $cgi, $svc_x, $fields, $opt ) = @_; #$svcnum = $svc_x->svcnum; my $cust_svc = $svc_x->cust_svc or die "Unknown (cust_svc) svcnum!"; @@ -25,6 +27,8 @@ $part_svc = qsearchs ('part_svc', { svcpart=>$svcpart }); die "No part_svc entry!" unless $part_svc; + + label_fixup($part_svc, $opt); }, 'new_hashref_callback' => sub { @@ -35,11 +39,13 @@ }, 'new_callback' => sub { - my( $cgi, $svc_x ) = @_;; + my( $cgi, $svc_x, $fields, $opt ) = @_;; $part_svc = qsearchs( 'part_svc', { svcpart=>$svcpart }); die "No part_svc entry!" unless $part_svc; + label_fixup($part_svc, $opt); + #$svcnum=''; $svc_x->set_default_and_fixed; @@ -100,6 +106,22 @@ %opt #pass through/override params ) %> +<%once> + +sub label_fixup { + my( $part_svc, $opt ) = @_; + + #false laziness w/view/svc_Common.html + #override default labels with service-definition labels if applicable + my $labels = $opt->{labels}; # with -> here + foreach my $field ( keys %$labels ) { + my $col = $part_svc->part_svc_column($field); + $labels->{$field} = $col->columnlabel if $col->columnlabel !~ /^\S*$/; + } + +} + + <%init> my %opt = @_; diff --git a/httemplate/view/elements/svc_Common.html b/httemplate/view/elements/svc_Common.html index 125fcd0b8..852640e0c 100644 --- a/httemplate/view/elements/svc_Common.html +++ b/httemplate/view/elements/svc_Common.html @@ -145,6 +145,14 @@ my($label, $value, $svcdb) = $cust_svc->label; my $part_svc = $cust_svc->part_svc; + #false laziness w/edit/svc_Common.html + #override default labels with service-definition labels if applicable + my $labels = $opt{labels}; #not -> here + foreach my $field ( keys %$labels ) { + my $col = $part_svc->part_svc_column($field); + $labels->{$field} = $col->columnlabel if $col->columnlabel !~ /^\S*$/; + } + my $pkgnum = $cust_svc->pkgnum; my($cust_pkg, $custnum); -- cgit v1.2.1 From 794a4505360fec404e2b9d5c6daf79f750186bfe Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 13 May 2009 22:27:42 +0000 Subject: improved taxproduct tax report RT#4783 --- httemplate/misc/tax-import.cgi | 8 +-- httemplate/search/cust_bill_pkg.cgi | 24 +++++++++ httemplate/search/report_newtax.cgi | 105 ++++++++++++++++++++++-------------- 3 files changed, 94 insertions(+), 43 deletions(-) (limited to 'httemplate') diff --git a/httemplate/misc/tax-import.cgi b/httemplate/misc/tax-import.cgi index a695e9706..5116e5404 100644 --- a/httemplate/misc/tax-import.cgi +++ b/httemplate/misc/tax-import.cgi @@ -6,7 +6,7 @@ Import a CSV file set containing tax rate records. <% include( '/elements/form-file_upload.html', 'name' => 'TaxRateUpload', 'action' => 'process/tax-import.cgi', - 'num_files' => 5, + 'num_files' => 6, 'fields' => [ 'format', ], 'message' => 'Tax rates imported', ) @@ -27,13 +27,15 @@ Import a CSV file set containing tax rate records. <% include( '/elements/file-upload.html', - 'field' => [ 'codefile', + 'field' => [ 'geofile', + 'codefile', 'plus4file', 'zipfile', 'txmatrix', 'detail', ], - 'label' => [ 'code filename', + 'label' => [ 'geocode filename', + 'code filename', 'plus4 filename', 'zip filename', 'txmatrix filename', diff --git a/httemplate/search/cust_bill_pkg.cgi b/httemplate/search/cust_bill_pkg.cgi index 89901ac40..9d4843281 100644 --- a/httemplate/search/cust_bill_pkg.cgi +++ b/httemplate/search/cust_bill_pkg.cgi @@ -189,6 +189,26 @@ if ( $cgi->param('out') ) { } + } elsif ( scalar( grep( /locationtaxid/, $cgi->param ) ) ) { + + # this should really be shoved out to FS::cust_pkg->location_sql or something + # along with the code in report_newtax.cgi + + my %pn = ( + 'county' => 'tax_rate_location.county', + 'state' => 'tax_rate_location.state', + 'city' => 'tax_rate_location.city', + 'locationtaxid' => 'cust_bill_pkg_tax_rate_location.locationtaxid', + ); + + my %ph = map { ( $pn{$_} => dbh->quote( $cgi->param($_) || '' ) ) } + qw( county state city locationtaxid ); + + push @where, + join( ' AND ', map { "( $_ = $ph{$_} OR $ph{$_} = '' AND $_ IS NULL)" } + keys %ph + ); + } if ($cgi->param('itemdesc')) { @@ -295,6 +315,10 @@ if ( $cgi->param('nottax') ) { #quelle kludge, false laziness w/report_tax.cgi $where =~ s/cust_pkg\.locationnum/cust_bill_pkg_tax_location.locationnum/g; + } elsif ( scalar( grep( /locationtaxid/, $cgi->param ) ) ) { + $join_pkg .= + ' LEFT JOIN cust_bill_pkg_tax_rate_location USING ( billpkgnum ) '. + ' LEFT JOIN tax_rate_location USING ( taxratelocationnum ) '; } } else { diff --git a/httemplate/search/report_newtax.cgi b/httemplate/search/report_newtax.cgi index 586fddd25..0fb548352 100755 --- a/httemplate/search/report_newtax.cgi +++ b/httemplate/search/report_newtax.cgi @@ -14,6 +14,7 @@ <% include('/elements/table-grid.html') %> + Tax collected @@ -37,9 +38,11 @@ <% $tax->{'label'} %> + <% $tax->{base} ? qq!! : '' %>
<% $money_char %><% sprintf('%.2f', $tax->{'tax'} ) %> + <% !($tax->{base}) ? qq!! : '' %> % } @@ -61,10 +64,11 @@ my $join_cust = " JOIN cust_bill USING ( invnum ) LEFT JOIN cust_main USING ( custnum ) "; -my $from_join_cust = " - FROM cust_bill_pkg - $join_cust -"; + +my $join_loc = "LEFT JOIN cust_bill_pkg_tax_rate_location USING ( billpkgnum )"; +my $join_tax_loc = "LEFT JOIN tax_rate_location USING ( taxratelocationnum )"; + +my $addl_from = " $join_cust $join_loc $join_tax_loc "; my $where = "WHERE _date >= $beginning AND _date <= $ending "; @@ -76,65 +80,87 @@ if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) { $where .= ' AND cust_main.agentnum = '. $agent->agentnum; } +# my ( $location_sql, @location_param ) = FS::cust_pkg->location_sql; +# $where .= " AND $location_sql"; +#my @taxparam = ( 'itemdesc', @location_param ); +# now something along the lines of geocode matching ? +#$where .= FS::cust_pkg->_location_sql_where('cust_tax_location');; +my @taxparam = ( 'itemdesc', 'tax_rate_location.state', 'tax_rate_location.county', 'tax_rate_location.city', 'cust_bill_pkg_tax_rate_location.locationtaxid' ); + +my $select = 'DISTINCT itemdesc,locationtaxid,tax_rate_location.state,tax_rate_location.county,tax_rate_location.city'; + my $tax = 0; my %taxes = (); +my %basetaxes = (); foreach my $t (qsearch({ table => 'cust_bill_pkg', + select => $select, hashref => { pkgpart => 0 }, - addl_from => $join_cust, + addl_from => $addl_from, extra_sql => $where, }) ) { - #warn $t->itemdesc. "\n"; + my @params = map { my $f = $_; $f =~ s/.*\.//; $f } @taxparam; + my $label = join('~', map { $t->$_ } @params); + $label = 'Tax'. $label if $label =~ /^~/; + unless ( exists( $taxes{$label} ) ) { + my ($baselabel, @trash) = split /~/, $label; - my $label = $t->itemdesc; - $label ||= 'Tax'; - $taxes{$label}->{'label'} = $label; - $taxes{$label}->{'url_param'} = "itemdesc=$label"; + $taxes{$label}->{'label'} = join(', ', split(/~/, $label) ); + $taxes{$label}->{'url_param'} = + join(';', map { "$_=". uri_escape($t->$_) } @params); - # calculate total for this tax - # calculate customer-exemption for this tax - # calculate package-exemption for this tax - # calculate monthly exemption (texas tax) for this tax - # count up all the cust_tax_exempt_pkg records associated with - # the actual line items. -} + my $taxwhere = "FROM cust_bill_pkg $addl_from $where AND payby != 'COMP' ". + "AND ". join( ' AND ', map { "( $_ = ? OR ? = '' AND $_ IS NULL)" } @taxparam ); + my $sql = "SELECT SUM(cust_bill_pkg.setup+cust_bill_pkg.recur) ". + " $taxwhere AND cust_bill_pkg.pkgnum = 0"; -foreach my $t (qsearch({ table => 'cust_bill_pkg', - select => 'DISTINCT itemdesc', - hashref => { pkgpart => 0 }, - addl_from => $join_cust, - extra_sql => $where, - }) - ) -{ + my $x = scalar_sql($t, [ map { $_, $_ } @params ], $sql ); + $tax += $x; + $taxes{$label}->{'tax'} += $x; + + unless ( exists( $taxes{$baselabel} ) ) { - my $label = $t->itemdesc; - $label ||= 'Tax'; - my @taxparam = ( 'itemdesc' ); - my $taxwhere = "$from_join_cust $where AND payby != 'COMP' ". - "AND itemdesc = ?" ; + $basetaxes{$baselabel}->{'label'} = $baselabel; + $basetaxes{$baselabel}->{'url_param'} = "itemdesc=$baselabel"; + $basetaxes{$baselabel}->{'base'} = 1; - my $sql = "SELECT SUM(cust_bill_pkg.setup+cust_bill_pkg.recur) ". - " $taxwhere AND pkgnum = 0"; + } - my $x = scalar_sql($t, \@taxparam, $sql ); - $tax += $x; - $taxes{$label}->{'tax'} += $x; + $basetaxes{$baselabel}->{'tax'} += $x; + + } + # calculate customer-exemption for this tax + # calculate package-exemption for this tax + # calculate monthly exemption (texas tax) for this tax + # count up all the cust_tax_exempt_pkg records associated with + # the actual line items. } + #ordering -my @taxes = - map $taxes{$_}, - sort { ($b cmp $a) } - keys %taxes; +my @taxes = (); + +foreach my $tax ( sort { $a cmp $b } keys %taxes ) { + my ($base, @trash) = split '~', $tax; + my $basetax = delete( $basetaxes{$base} ); + if ($basetax) { + if ( $basetax->{tax} == $taxes{$tax}->{tax} ) { + $taxes{$tax}->{base} = 1; + } else { + push @taxes, $basetax; + } + } + push @taxes, $taxes{$tax}; +} push @taxes, { 'label' => 'Total', 'url_param' => '', 'tax' => $tax, + 'base' => 1, }; #-- @@ -143,7 +169,6 @@ push @taxes, { #to FS::Report or FS::Record or who the fuck knows where) sub scalar_sql { my( $r, $param, $sql ) = @_; - #warn "$sql\n"; my $sth = dbh->prepare($sql) or die dbh->errstr; $sth->execute( map $r->$_(), @$param ) or die "Unexpected error executing statement $sql: ". $sth->errstr; -- cgit v1.2.1 From 7923b92cdd671e1b13c951af33c11b0ac25dd894 Mon Sep 17 00:00:00 2001 From: jeff Date: Thu, 14 May 2009 16:25:21 +0000 Subject: show geocode when taxproducts enabled --- httemplate/view/cust_main/billing.html | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'httemplate') diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html index aea90e8b3..4b2425b33 100644 --- a/httemplate/view/cust_main/billing.html +++ b/httemplate/view/cust_main/billing.html @@ -164,6 +164,12 @@ Billing information Tax exempt <% $cust_main->tax ? 'yes' : 'no' %> +% if ( $conf->exists('enable_taxproducts') ) { + + Tax location + <% $cust_main->geocode('cch') %> + +% } Postal invoices -- cgit v1.2.1 From 5f675c352a10f555de5831bb76ab00b35b6b9bd1 Mon Sep 17 00:00:00 2001 From: jeff Date: Thu, 14 May 2009 16:26:40 +0000 Subject: ask for help assignting geocode more often --- httemplate/edit/cust_main/bottomfixup.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main/bottomfixup.js b/httemplate/edit/cust_main/bottomfixup.js index efe2215c8..ae4aafb70 100644 --- a/httemplate/edit/cust_main/bottomfixup.js +++ b/httemplate/edit/cust_main/bottomfixup.js @@ -59,6 +59,7 @@ function update_address(arg) { var ship_changed = argsHash['ship_address_standardized']; var error = argsHash['error']; var ship_error = argsHash['ship_error']; + //yay closures standardize_address = function () { @@ -91,7 +92,9 @@ function update_address(arg) { % if ( $conf->exists('enable_taxproducts') ) { - if ( <% $taxpre %>error ) { + if ( <% $taxpre %>error || + new String(argsHash['new_<% $taxpre %>zip']).length < 10 ) + { var country_el = cf.elements['<% $taxpre %>country']; var country = country_el.options[ country_el.selectedIndex ].value; -- cgit v1.2.1 From ad84bf7cfdb56aa1fe268ea315b7a2f7dd768db2 Mon Sep 17 00:00:00 2001 From: rsiddall Date: Fri, 15 May 2009 19:41:34 +0000 Subject: Simple domain registration at Tucows OpenSRS using an export based on Net::OpenSRS. When a domain is added and the export runs, it will register the domain or initiate a transfer. You can also choose no action. There's currently no provision for revoking domains or renewing registrations. Depending on the settings at OpenSRS, orders may look like they've succeeded in Freeside but actually be queued pending input by the reseller at OpenSRS. The part_export CGIs were modified to allow a multi-valued select to be used to control which TLDs are enabled for registration. --- httemplate/edit/part_export.cgi | 23 ++++++++++++++---- httemplate/edit/process/part_export.cgi | 3 ++- httemplate/edit/process/svc_domain.cgi | 4 ++-- httemplate/edit/svc_domain.cgi | 42 ++++++++++++++++++++++++++------- 4 files changed, 57 insertions(+), 15 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_export.cgi b/httemplate/edit/part_export.cgi index d57979751..8b697e142 100644 --- a/httemplate/edit/part_export.cgi +++ b/httemplate/edit/part_export.cgi @@ -79,13 +79,28 @@ my $widget = new HTML::Widgets::SelectLayers( ); $html .= qq!$label!; if ( $type eq 'select' ) { - $html .= qq!!; + my @values = split '\s+', $value if $multi; + my @options; + if (defined($optinfo->{option_values})) { + my $valsub = $optinfo->{option_values}; + @options = &$valsub(); + } elsif (defined($optinfo->{options})) { + @options = @{$optinfo->{options}}; + } + foreach my $select_option ( @options ) { #if ( ref($select_option) ) { #} else { - my $selected = $select_option eq $value ? ' SELECTED' : ''; + my $selected = ($multi ? grep {$_ eq $select_option} @values : $select_option eq $value ) ? ' SELECTED' : ''; + my $label = $select_option; + if (defined($optinfo->{option_label})) { + my $labelsub = $optinfo->{option_label}; + $label = &$labelsub($select_option); + } $html .= qq!!; + qq!$label!; #} } $html .= ''; diff --git a/httemplate/edit/process/part_export.cgi b/httemplate/edit/process/part_export.cgi index b5f82e892..209419f0b 100644 --- a/httemplate/edit/process/part_export.cgi +++ b/httemplate/edit/process/part_export.cgi @@ -16,7 +16,8 @@ my $old = qsearchs('part_export', { 'exportnum'=>$exportnum } ) if $exportnum; #fixup options #warn join('-', split(',',$cgi->param('options'))); my %options = map { - my $value = $cgi->param($_); + my @values = $cgi->param($_); + my $value = scalar(@values) > 1 ? join (' ', @values) : $values[0]; $value =~ s/\r\n/\n/g; #browsers? (textarea) $_ => $value; } split(',', $cgi->param('options')); diff --git a/httemplate/edit/process/svc_domain.cgi b/httemplate/edit/process/svc_domain.cgi index 9993a879e..59b518097 100755 --- a/httemplate/edit/process/svc_domain.cgi +++ b/httemplate/edit/process/svc_domain.cgi @@ -18,8 +18,8 @@ my $svcnum = $1; my $new = new FS::svc_domain ( { map { $_, scalar($cgi->param($_)); - #} qw(svcnum pkgnum svcpart domain action purpose) - } ( fields('svc_domain'), qw( pkgnum svcpart action purpose ) ) + #} qw(svcnum pkgnum svcpart domain action) + } ( fields('svc_domain'), qw( pkgnum svcpart action ) ) } ); my $error = ''; diff --git a/httemplate/edit/svc_domain.cgi b/httemplate/edit/svc_domain.cgi index 56ba604bf..10079ce98 100755 --- a/httemplate/edit/svc_domain.cgi +++ b/httemplate/edit/svc_domain.cgi @@ -7,17 +7,31 @@ ->New +<% ntable("#cccccc",2) %> + +

Domain
+% if ($export) { +Available top-level domains: <% $export->option('tlds') %> + ->Transfer + +>Register at <% $registrar->{'name'} %> +
-

Domain +>Transfer to <% $registrar->{'name'} %> +
-
Purpose/Description: +>Registered elsewhere -

+ + +% } + +

+<% &ntable("#cccccc", 2) %> + + + Format + + + + + + Update Password + + + + + + + + + + + + + +
+ +<% include('/elements/footer.html') %> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Import'); + + -- cgit v1.2.1 From 62bd2f8b9ae2c0d3532228074f3c3acc337421e5 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 4 Jun 2009 14:08:04 +0000 Subject: $core->add("jeremyd"); --- httemplate/docs/credits.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/docs/credits.html b/httemplate/docs/credits.html index 38d384bcf..937dfb597 100644 --- a/httemplate/docs/credits.html +++ b/httemplate/docs/credits.html @@ -35,6 +35,7 @@

Core Team

Peter Bowen
+Jeremy Davis
Jeff Finucane
Jason Hall
Kristian Hoffman
@@ -62,7 +63,6 @@ Rebecca Cardennis
Shane Chrisp
Luke Crawford
Brad Dameron
-Jeremy Davis
Dave Denney
Serge Dolgov
Scott Edwards
-- cgit v1.2.1 From 93a56633fe031852ce031ad2663f31c43c0eccd4 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 4 Jun 2009 14:27:13 +0000 Subject: fix scrolling --- httemplate/docs/credits.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/docs/credits.html b/httemplate/docs/credits.html index 937dfb597..a944f48fa 100644 --- a/httemplate/docs/credits.html +++ b/httemplate/docs/credits.html @@ -152,7 +152,7 @@ function myHeight() { return document.body.document.height; else */ - return 1700; // approx height (add more per contributors) + return 1850; // approx height (add more per contributors) } document.body.style.overflow = 'hidden'; -- cgit v1.2.1 From 40a1170d519ad54a029c8306881a06c56cd9506a Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 10 Jun 2009 02:08:58 +0000 Subject: update gateway list in order to add WesternACH, RT#5409 --- httemplate/edit/payment_gateway.html | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/payment_gateway.html b/httemplate/edit/payment_gateway.html index 2b108f857..4c7bae172 100644 --- a/httemplate/edit/payment_gateway.html +++ b/httemplate/edit/payment_gateway.html @@ -40,7 +40,7 @@ die "access denied" my %modules = ( '2CheckOut' => 'Business::OnlinePayment', 'AuthorizeNet' => 'Business::OnlinePayment', - 'BankOfAmerica' => 'Business::OnlinePayment', + 'BankOfAmerica' => 'Business::OnlinePayment', #deprecated? 'Beanstream' => 'Business::OnlinePayment', 'Capstone' => 'Business::OnlinePayment', 'Cardstream' => 'Business::OnlinePayment', @@ -50,8 +50,12 @@ my %modules = ( 'eSelectPlus' => 'Business::OnlinePayment', 'Exact' => 'Business::OnlinePayment', 'iAuthorizer' => 'Business::OnlinePayment', + 'Ingotz' => 'Business::OnlinePayment', + 'InternetSecure' => 'Business::OnlinePayment', 'Interswitchng' => 'Business::OnlineThirdPartyPayment', 'IPaymentTPG' => 'Business::OnlinePayment', + 'IPPay' => 'Business::OnlinePayment', + 'Iridium' => 'Business::OnlinePayment', 'Jettis' => 'Business::OnlinePayment', 'LinkPoint' => 'Business::OnlinePayment', 'MerchantCommerce' => 'Business::OnlinePayment', @@ -60,7 +64,12 @@ my %modules = ( 'OpenECHO' => 'Business::OnlinePayment', 'PayConnect' => 'Business::OnlinePayment', 'PayflowPro' => 'Business::OnlinePayment', + 'PaymenTech' => 'Business::OnlinePayment', 'PaymentsGateway' => 'Business::OnlinePayment', + 'PayPal' => 'Business::OnlinePayment', + 'PlugnPay ' => 'Business::OnlinePayment', + 'PPIPayMover ' => 'Business::OnlinePayment', + 'Protx ' => 'Business::OnlinePayment', 'PXPost' => 'Business::OnlinePayment', 'SecureHostingUPG' => 'Business::OnlinePayment', 'Skipjack' => 'Business::OnlinePayment', @@ -69,7 +78,10 @@ my %modules = ( 'TCLink' => 'Business::OnlinePayment', 'TransactionCentral' => 'Business::OnlinePayment', 'TransFirsteLink' => 'Business::OnlinePayment', + 'Vanco' => 'Business::OnlinePayment', + 'viaKLIX' => 'Business::OnlinePayment', 'VirtualNet' => 'Business::OnlinePayment', + 'WesternACH' => 'Business::OnlinePayment', ); my @actions = ( -- cgit v1.2.1 From 586a2e2c99956f17899e2fbb52b11a0ac0293a17 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 10 Jun 2009 07:58:21 +0000 Subject: this should add the info s1 was looking for, RT#5539 --- httemplate/search/cust_pkg.cgi | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index bd4a9466f..e797e35e9 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -10,6 +10,8 @@ 'Package', 'Class', 'Status', + 'Setup', + 'Base Recur', 'Freq.', 'Setup', 'Last bill', @@ -33,6 +35,14 @@ }, 'classname', sub { ucfirst(shift->status); }, + sub { sprintf( $money_char.'%.2f', + shift->part_pkg->option('setup_fee'), + ); + }, + sub { sprintf( $money_char.'%.2f', + shift->part_pkg->base_recur + ); + }, sub { #shift->part_pkg->freq_pretty; #my $part_pkg = $part_pkg{shift->pkgpart}; @@ -99,13 +109,15 @@ '', '', '', + '', + '', FS::UI::Web::cust_colors(), '', ], - 'style' => [ '', '', '', '', 'b', '', '', '', '', '', '', '', '', '', + 'style' => [ '', '', '', '', 'b', '', '', '', '', '', '', '', '', '', '', '', FS::UI::Web::cust_styles() ], 'size' => [ '', '', '', '', '-1' ], - 'align' => 'rrlcclrrrrrrrl'. FS::UI::Web::cust_aligns(). 'r', + 'align' => 'rrlccrrlrrrrrrrl'. FS::UI::Web::cust_aligns(). 'r', 'links' => [ $link, $link, @@ -121,6 +133,8 @@ '', '', '', + '', + '', ( map { $_ ne 'Cust. Status' ? $clink : '' } FS::UI::Web::cust_header( $cgi->param('cust_fields') @@ -136,6 +150,9 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('List packages'); +my $conf = new FS::Conf; +my $money_char = $conf->config('money_char') || '$'; + # my %part_pkg = map { $_->pkgpart => $_ } qsearch('part_pkg', {}); my %search_hash = (); -- cgit v1.2.1 From 0cbb171da2cf3c7059612c0f2fbcf4a8bb80ab58 Mon Sep 17 00:00:00 2001 From: rsiddall Date: Mon, 15 Jun 2009 19:41:29 +0000 Subject: Add domain registration operations to the View Domain screen, if the domain has an associated export supporting registration. Shows the domain status and allows registration, transfer, revocation, or renewal. Revocation almost never works since the registries impose very short windows after initial registration. Also updated the OpenSRS registration export to support the additional operations. --- httemplate/edit/process/domreg.cgi | 62 ++++++++++++++++++++++++++++++++++++++ httemplate/view/svc_domain.cgi | 62 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 124 insertions(+) create mode 100755 httemplate/edit/process/domreg.cgi (limited to 'httemplate') diff --git a/httemplate/edit/process/domreg.cgi b/httemplate/edit/process/domreg.cgi new file mode 100755 index 000000000..b643638f4 --- /dev/null +++ b/httemplate/edit/process/domreg.cgi @@ -0,0 +1,62 @@ +%if ($error) { +% $cgi->param('error', $error); +<% $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum") %> +%} else { +<% $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum") %> +%} +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific? + +$cgi->param('op') =~ /^(register|transfer|revoke|renew)$/ or die "Illegal operation"; +my $operation = $1; +#my($query) = $cgi->keywords; +#$query =~ /^(\d+)$/; +$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; +my $svcnum = $1; +my $svc_domain = qsearchs({ + 'select' => 'svc_domain.*', + 'table' => 'svc_domain', + 'addl_from' => ' LEFT JOIN cust_svc USING ( svcnum ) '. + ' LEFT JOIN cust_pkg USING ( pkgnum ) '. + ' LEFT JOIN cust_main USING ( custnum ) ', + 'hashref' => {'svcnum'=>$svcnum}, + 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, +}); +die "Unknown svcnum" unless $svc_domain; + +my $cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); +my $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ); +die "Unknown svcpart" unless $part_svc; + +my $error = ''; + +my @exports = $part_svc->part_export(); + +my $registrar; +my $export; + +# Find the first export that does domain registration +foreach (@exports) { + $export = $_ if $_->can('registrar'); +} + +my $period = 1; # Current OpenSRS export can only handle 1 year registrations + +# If we have a domain registration export, get the registrar object +if ($export) { + if ($operation eq 'register') { + $error = $export->register( $svc_domain, $period ); + } elsif ($operation eq 'transfer') { + $error = $export->transfer( $svc_domain ); + } elsif ($operation eq 'revoke') { + $error = $export->revoke( $svc_domain ); + } elsif ($operation eq 'renew') { + $cgi->param('period') =~ /^(\d+)$/ or die "Illegal renewal period!"; + $period = $1; + $error = $export->renew( $svc_domain, $period ); + } +} + + diff --git a/httemplate/view/svc_domain.cgi b/httemplate/view/svc_domain.cgi index 36577d39c..1e93b9461 100755 --- a/httemplate/view/svc_domain.cgi +++ b/httemplate/view/svc_domain.cgi @@ -7,9 +7,38 @@ ) )) %> +<% include('/elements/error.html') %> + Service #<% $svcnum %>
Service: <% $part_svc->svc %>
Domain name: <% $domain %> +% if ($export) { +
Status: <% $status %> +% if ( $FS::CurrentUser::CurrentUser->access_right('Change customer service') ) { +% if ( defined($ops{'register'}) ) { + Register at <% $registrar->{'name'} %>  +% } +% if ( defined($ops{'transfer'}) ) { + Transfer to <% $registrar->{'name'} %>  +% } +% if ( defined($ops{'renew'}) ) { +
+ + + +   +
+% } +% if ( defined($ops{'revoke'}) ) { + Revoke +% } +% } +% } + % if ( $FS::CurrentUser::CurrentUser->access_right('Edit domain catchall') ) {
Catch all email (change): % } else { @@ -158,4 +187,37 @@ if ($svc_domain->catchall) { my $domain = $svc_domain->domain; +my $status = 'Unknown'; +my %ops = (); + +my @exports = $part_svc->part_export(); + +my $registrar; +my $export; + +# Find the first export that does domain registration +foreach (@exports) { + $export = $_ if $_->can('registrar'); +} +# If we have a domain registration export, get the registrar object +if ($export) { + $registrar = $export->registrar; + my $domstat = $export->get_status( $svc_domain ); + if (defined($domstat->{'message'})) { + $status = $domstat->{'message'}; + } elsif (defined($domstat->{'unregistered'})) { + $status = 'Not registered'; + $ops{'register'} = "Register"; + } elsif (defined($domstat->{'status'})) { + $status = $domstat->{'status'} . ' ' . $domstat->{'contact_email'} . ' ' . $domstat->{'last_update_time'}; + } elsif (defined($domstat->{'expdate'})) { + $status = "Expires " . $domstat->{'expdate'}; + $ops{'renew'} = "Renew"; + $ops{'revoke'} = "Revoke"; + } else { + $status = $domstat->{'reason'}; + $ops{'transfer'} = "Transfer"; + } +} + -- cgit v1.2.1 From c7d6edd92281d39e6eb59656a5b79faf8454973d Mon Sep 17 00:00:00 2001 From: rsiddall Date: Mon, 15 Jun 2009 21:41:33 +0000 Subject: Add a new access right for managing domain registration (registering, transferring, revoking, renewing, etc.). --- httemplate/view/svc_domain.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/view/svc_domain.cgi b/httemplate/view/svc_domain.cgi index 1e93b9461..b9a8de752 100755 --- a/httemplate/view/svc_domain.cgi +++ b/httemplate/view/svc_domain.cgi @@ -14,7 +14,7 @@ Service #<% $svcnum %>
Domain name: <% $domain %> % if ($export) {
Status: <% $status %> -% if ( $FS::CurrentUser::CurrentUser->access_right('Change customer service') ) { +% if ( $FS::CurrentUser::CurrentUser->access_right('Manage domain registration') ) { % if ( defined($ops{'register'}) ) { Register at <% $registrar->{'name'} %>  % } -- cgit v1.2.1 From 8588f3c0bfbcbeb58dd25a57b5ea375cec00279a Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 16 Jun 2009 03:29:26 +0000 Subject: basic customer view tabs, RT#5586 --- httemplate/elements/menubar.html | 119 ++++++++++++++++++++++--- httemplate/pref/pref-process.html | 2 +- httemplate/pref/pref.html | 32 ++++++- httemplate/view/cust_main.cgi | 104 +++++++++++++++++---- httemplate/view/cust_main/packages.html | 2 - httemplate/view/cust_main/payment_history.html | 2 - httemplate/view/cust_main/tickets.html | 3 - 7 files changed, 229 insertions(+), 35 deletions(-) (limited to 'httemplate') diff --git a/httemplate/elements/menubar.html b/httemplate/elements/menubar.html index ec6c13fea..4d2700cc5 100644 --- a/httemplate/elements/menubar.html +++ b/httemplate/elements/menubar.html @@ -1,10 +1,109 @@ -% -% my($item, $url, @html); -% while (@_) { -% ($item, $url) = splice(@_,0,2); -% next if $item =~ /^\s*Main\s+Menu\s*$/i; -% push @html, qq!$item!; -% } -% - -<% join(' | ', @html) %> +<%doc> + +Example: + + include( '/elements/menubar.html', + + #options hashref (optional) + { 'newstyle' => 1, #may become the default at some point + }, + + #menubar entries (required) + 'label' => $url, + 'label2' => $url2, + #etc. + + ); + + +%if ( $opt->{'newstyle'} ) { + +% #false laziness w/header.html... shouldn't these just go in freeside.css? + + + + + + + + + +
+    + + <% join(' ', @html ) %> + +    +
+ +%} else { + + <% join(' | ', @html) %> + +%} +<%init> + +my $opt = ref($_[0]) ? shift : {}; + +my $url_base = $opt->{'url_base'}; + +my @html; +while (@_) { + + my ($item, $url) = splice(@_,0,2); + next if $item =~ /^\s*Main\s+Menu\s*$/i; + + my $style = ''; + if ( $opt->{'newstyle'} ) { + + my $dclass = $item eq $opt->{'selected'} + ? 'fsblackbuttonselected' + : 'fsblackbutton'; + + $style = + qq( CLASS="$dclass" ). + qq( onMouseOver="this.className='fsblackbuttonselected'; return true;" ). + qq( onMouseOut="this.className='$dclass'; return true;" ); + } + + push @html, qq!$item!; + +} + + diff --git a/httemplate/pref/pref-process.html b/httemplate/pref/pref-process.html index 368d84f10..378164e7b 100644 --- a/httemplate/pref/pref-process.html +++ b/httemplate/pref/pref-process.html @@ -43,7 +43,7 @@ unless ( $error ) { # if ($access_user) { my %param = $access_user->options; #XXX autogen - my @paramlist = qw( menu_position + my @paramlist = qw( menu_position default_customer_view email_address vonage-fromnumber vonage-username vonage-password show_pkgnum show_db_profile save_db_profile diff --git a/httemplate/pref/pref.html b/httemplate/pref/pref.html index 1f4edf2cb..81800bf26 100644 --- a/httemplate/pref/pref.html +++ b/httemplate/pref/pref.html @@ -31,7 +31,7 @@ Interface <% ntable("#cccccc",2) %> - Menu location: + Menu location: > Left
> Top
@@ -39,6 +39,21 @@ Interface + + Default customer view: + + + + +
@@ -109,6 +124,21 @@ Vonage integration (see Click2Call <% include('/elements/footer.html') %> +<%once> + + #false laziness w/view/cust_main.cgi + + tie my %customer_views, 'Tie::IxHash', + 'Basics' => 'basics', + 'Notes' => 'notes', #notes and files? + 'Tickets' => 'tickets', + 'Packages' => 'packages', + 'Payment History' => 'payment_history', + #'Change History' => '', + 'Jumbo' => 'jumbo', + ; + + <%init> my $curuser = $FS::CurrentUser::CurrentUser; diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 2231d4148..00856a021 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,8 +1,19 @@ -<% include("/elements/header.html","Customer View: ". $cust_main->name ) %> +<% include('/elements/header.html', { + 'title' => "Customer View: ". $cust_main->name, + 'nobr' => 1, + }) +%> +
-% if ( $curuser->access_right('Edit customer') ) { - Edit this customer | -% } +<% include('/elements/menubar.html', + { 'newstyle' => 1, + 'selected' => $viewname{$view}, + 'url_base' => $cgi->url. "?custnum=$custnum;show=", + }, + %views, + ) +%> +
<% include('/elements/init_overlib.html') %> @@ -13,6 +24,12 @@ function areyousure(href, message) { } +% if ( $view eq 'basics' || $view eq 'jumbo' ) { + +% if ( $curuser->access_right('Edit customer') ) { + Edit this customer | +% } + % if ( $curuser->access_right('Cancel customer') % && $cust_main->ncancelled_pkgs % ) { @@ -74,10 +91,12 @@ function areyousure(href, message) { -% -%if ( $cust_main->comments =~ /[^\s\n\r]/ ) { -% +% } + +% if ( $view eq 'notes' || $view eq 'jumbo' ) { + +%if ( $cust_main->comments =~ /[^\s\n\r]/ ) {
Comments <% ntable("#cccccc") %><% ntable("#cccccc",2) %> @@ -87,12 +106,16 @@ Comments -% }

+% } + % my $notecount = scalar($cust_main->notes()); % if ( ! $conf->exists('cust_main-disable_notes') || $notecount) { -Notes
+% unless ( $view eq 'notes' && $cust_main->comments !~ /[^\s\n\r]/ ) { + Notes
+% } + % if ( $curuser->access_right('Add customer note') && % ! $conf->exists('cust_main-disable_notes') % ) { @@ -115,24 +138,47 @@ Comments % } +% } -% if ( $conf->config('ticket_system') ) { +% if ( $view eq 'jumbo' ) { +

+ Tickets
+% } -

+% if ( $view eq 'tickets' || $view eq 'jumbo' ) { + +% if ( $conf->config('ticket_system') ) { <% include('cust_main/tickets.html', $cust_main ) %> % } +

+% } -

+% if ( $view eq 'jumbo' ) { #XXX enable me && $curuser->access_right('View customer packages') { + + Packages
+% } + +% if ( $view eq 'packages' || $view eq 'jumbo' ) { % #XXX enable me# if ( $curuser->access_right('View customer packages') { <% include('cust_main/packages.html', $cust_main ) %> % #} +% } + +% if ( $view eq 'jumbo' ) { +

+ Payment History
+% } + +% if ( $view eq 'payment_history' || $view eq 'jumbo' ) { + % if ( $conf->config('payby-default') ne 'HIDE' ) { <% include('cust_main/payment_history.html', $cust_main ) %> % } +% } <% include('/elements/footer.html') %> <%init> @@ -144,10 +190,16 @@ die "access denied" my $conf = new FS::Conf; -die "No customer specified (bad URL)!" unless $cgi->keywords; -my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array -$query =~ /^(\d+)$/; -my $custnum = $1; +my $custnum; +if ( $cgi->param('custnum') =~ /^(\d+)$/ ) { + $custnum = $1; +} else { + die "No customer specified (bad URL)!" unless $cgi->keywords; + my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array + $query =~ /^(\d+)$/; + $custnum = $1; +} + my $cust_main = qsearchs( { 'table' => 'cust_main', 'hashref' => { 'custnum' => $custnum }, @@ -155,4 +207,24 @@ my $cust_main = qsearchs( { }); die "Customer not found!" unless $cust_main; +#false laziness w/pref/pref.html +tie my %views, 'Tie::IxHash', + 'Basics' => 'basics', + 'Notes' => 'notes', #notes and files? +; +$views{'Tickets'} = 'tickets' + if $conf->config('ticket_system'); +$views{'Packages'} = 'packages'; +$views{'Payment History'} = 'payment_history' + unless $conf->config('payby-default' eq 'HIDE'); +#$views{'Change History'} = ''; +$views{'Jumbo'} = 'jumbo'; + +my %viewname = reverse %views; + + +my $view = $cgi->param('show') + || $curuser->option('default_customer_view') + || 'jumbo'; #'Basics' in 1.9.1? + diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 0c0526d42..428794b7d 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -1,5 +1,3 @@ -Packages
- % my $s = 0; % if ( $curuser->access_right('Order customer package') ) { <% $s++ ? ' | ' : '' %> diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index 335ce2485..f2abe0eac 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -1,5 +1,3 @@ -

Payment History
- %# payment links % my $s = 0; diff --git a/httemplate/view/cust_main/tickets.html b/httemplate/view/cust_main/tickets.html index b5d581d50..167849c76 100644 --- a/httemplate/view/cust_main/tickets.html +++ b/httemplate/view/cust_main/tickets.html @@ -1,6 +1,3 @@ -Tickets -
- (View <% $openlabel %> tickets for this customer) (View resolved tickets for this customer)
-- cgit v1.2.1 From 3a02c437eadd9a39f7e56056ca987a4846650209 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 17 Jun 2009 02:39:09 +0000 Subject: finish up initial work on customer view tabs (ensure links back to customer view call include show=packages if default view isn't jumbo or packages already), RT#5586 --- httemplate/edit/process/REAL_cust_pkg.cgi | 10 ++++++++-- httemplate/edit/process/part_pkg.cgi | 8 +++++++- httemplate/edit/process/quick-cust_pkg.cgi | 9 +++++++-- httemplate/elements/menubar.html | 4 +++- httemplate/misc/process/link.cgi | 10 ++++++++-- httemplate/pref/pref.html | 2 +- httemplate/search/cust_event.html | 7 ++++++- httemplate/search/cust_main.cgi | 10 ++++++++-- httemplate/search/cust_pkg.cgi | 15 +++++++++++++-- httemplate/view/cust_main.cgi | 7 ++----- 10 files changed, 63 insertions(+), 19 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/process/REAL_cust_pkg.cgi b/httemplate/edit/process/REAL_cust_pkg.cgi index ebcb7e4ba..c99ddc288 100755 --- a/httemplate/edit/process/REAL_cust_pkg.cgi +++ b/httemplate/edit/process/REAL_cust_pkg.cgi @@ -3,12 +3,18 @@ <% $cgi->redirect(popurl(2). "REAL_cust_pkg.cgi?". $cgi->query_string ) %> %} else { % my $custnum = $new->custnum; -<% $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum#cust_pkg$pkgnum" ) %> +% my $show = $curuser->default_customer_view =~ /^(jumbo|packages)$/ +% ? '' +% : ';show=packages'; +% my $frag = "cust_pkg$pkgnum"; #hack for IE ignoring real #fragment +<% $cgi->redirect(popurl(3). "view/cust_main.cgi?custnum=$custnum$show;fragment=$frag#$frag" ) %> %} <%init> +my $curuser = $FS::CurrentUser::CurrentUser; + die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Edit customer package dates'); + unless $curuser->access_right('Edit customer package dates'); my $pkgnum = $cgi->param('pkgnum') or die; my $old = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); diff --git a/httemplate/edit/process/part_pkg.cgi b/httemplate/edit/process/part_pkg.cgi index 96c5b36b7..3116b7b28 100755 --- a/httemplate/edit/process/part_pkg.cgi +++ b/httemplate/edit/process/part_pkg.cgi @@ -134,7 +134,13 @@ my $args_callback = sub { my $redirect_callback = sub { #my( $cgi, $new ) = @_; return '' unless $custnum; - popurl(3). "view/cust_main.cgi?keywords=$custnum;dummy="; + my $show = $curuser->default_customer_view =~ /^(jumbo|packages)$/ + ? '' + : ';show=packages'; + #my $frag = "cust_pkg$pkgnum"; #hack for IE ignoring real #fragment + + #can we link back to the specific customized package? it would be nice... + popurl(3). "view/cust_main.cgi?custnum=$custnum$show;dummy="; }; #these should probably move to @args above and be processed by part_pkg.pm... diff --git a/httemplate/edit/process/quick-cust_pkg.cgi b/httemplate/edit/process/quick-cust_pkg.cgi index 9c2474330..57c696e7e 100644 --- a/httemplate/edit/process/quick-cust_pkg.cgi +++ b/httemplate/edit/process/quick-cust_pkg.cgi @@ -3,12 +3,15 @@ <% $cgi->redirect(popurl(3). 'misc/order_pkg.html?'. $cgi->query_string ) %> %} else { % my $frag = "cust_pkg". $cust_pkg->pkgnum; +% my $show = $curuser->default_customer_view =~ /^(jumbo|packages)$/ +% ? '' +% : ';show=packages'; <% header('Package ordered') %> @@ -16,8 +19,10 @@ %} <%init> +my $curuser = $FS::CurrentUser::CurrentUser; + die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Order customer package'); + unless $curuser->access_right('Order customer package'); #untaint custnum (probably not necessary, searching for it is escape enough) $cgi->param('custnum') =~ /^(\d+)$/ diff --git a/httemplate/elements/menubar.html b/httemplate/elements/menubar.html index 4d2700cc5..46f61b3cd 100644 --- a/httemplate/elements/menubar.html +++ b/httemplate/elements/menubar.html @@ -5,7 +5,9 @@ Example: include( '/elements/menubar.html', #options hashref (optional) - { 'newstyle' => 1, #may become the default at some point + { 'newstyle' => 1, #may become the default at some point + 'url_base' => '', #prepended to menubar URLs, for convenience + 'selected' => '', #currently selected label }, #menubar entries (required) diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi index df15dca72..77546f3f7 100755 --- a/httemplate/misc/process/link.cgi +++ b/httemplate/misc/process/link.cgi @@ -1,14 +1,20 @@ %unless ($error) { % #no errors, so let's view this customer. % my $custnum = $new->cust_pkg->custnum; -<% $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum#cust_pkg$pkgnum" ) %> +% my $show = $curuser->default_customer_view =~ /^(jumbo|packages)$/ +% ? '' +% : ';show=packages'; +% my $frag = "cust_pkg$pkgnum"; #hack for IE ignoring real #fragment +<% $cgi->redirect(popurl(3). "view/cust_main.cgi?custnum=$custnum$show;fragment=$frag#$frag" ) %> %} else { % errorpage($error); %} <%init> +my $curuser = $FS::CurrentUser::CurrentUser; + die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('View/link unlinked services'); + unless $curuser->access_right('View/link unlinked services'); my $DEBUG = 0; diff --git a/httemplate/pref/pref.html b/httemplate/pref/pref.html index 81800bf26..8bdf6c09c 100644 --- a/httemplate/pref/pref.html +++ b/httemplate/pref/pref.html @@ -126,7 +126,7 @@ Vonage integration (see Click2Call <% include('/elements/footer.html') %> <%once> - #false laziness w/view/cust_main.cgi + #false laziness w/view/cust_main.cgi and Conf.pm (cust_main-default_view) tie my %customer_views, 'Tie::IxHash', 'Basics' => 'basics', diff --git a/httemplate/search/cust_event.html b/httemplate/search/cust_event.html index d55b5c6d2..e8164c280 100644 --- a/httemplate/search/cust_event.html +++ b/httemplate/search/cust_event.html @@ -124,7 +124,12 @@ my $trigger_link = sub { my $eventtable = $cust_event->eventtable; if ( $eventtable eq 'cust_pkg' ) { my $custnum = $cust_event->cust_main_custnum; - [ "${p}view/cust_main.cgi?$custnum#cust_pkg", 'tablenum' ]; + my $show = $FS::CurrentUser::CurrentUser->default_customer_view =~ /^(jumbo|packages)$/ + ? '' + : ';show=packages'; + my $pkgnum = $cust_event->tablenum; + my $frag = "cust_pkg$pkgnum"; #hack for IE ignoring real #fragment + [ "${p}view/cust_main.cgi?custnum=$custnum$show;fragment=$frag#cust_pkg", 'tablenum' ]; } else { [ "${p}view/$eventtable.cgi?", 'tablenum' ]; } diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index 36e4374ee..658069b08 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -1,5 +1,7 @@ +%my $curuser = $FS::CurrentUser::CurrentUser; +% %die "access denied" -% unless $FS::CurrentUser::CurrentUser->access_right('List customers'); +% unless $curuser->access_right('List customers'); % %my $conf = new FS::Conf; %my $maxrecords = $conf->config('maxsearchrecordsperpage'); @@ -485,7 +487,11 @@ % % my $pkg = $part_pkg->pkg; % my $comment = $part_pkg->comment; -% my $pkgview = "${p}view/cust_main.cgi?$custnum#cust_pkg$pkgnum"; +% my $show = $curuser->default_customer_view =~ /^(jumbo|packages)$/ +% ? '' +% : ';show=packages'; +% my $frag = "cust_pkg$pkgnum"; #hack for IE ignoring real #fragment +% my $pkgview = "${p}view/cust_main.cgi?custnum=$custnum$show;fragment=$frag#$frag"; % my @cust_svc = @{shift @lol_cust_svc}; % #my(@cust_svc) = qsearch( 'cust_svc', { 'pkgnum' => $_->pkgnum } ); % my $rowspan = scalar(@cust_svc) || 1; diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index e797e35e9..2a702801c 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -147,8 +147,10 @@ %> <%init> +my $curuser = $FS::CurrentUser::CurrentUser; + die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('List packages'); + unless $curuser->access_right('List packages'); my $conf = new FS::Conf; my $money_char = $conf->config('money_char') || '$'; @@ -192,8 +194,17 @@ foreach my $field (qw( setup last_bill bill adjourn susp expire cancel )) { my $sql_query = FS::cust_pkg->search_sql(\%search_hash); my $count_query = delete($sql_query->{'count_query'}); +my $show = $curuser->default_customer_view =~ /^(jumbo|packages)$/ + ? '' + : ';show=packages'; + my $link = sub { - [ "${p}view/cust_main.cgi?".shift->custnum.'#cust_pkg', 'pkgnum' ]; + my $self = shift; + my $frag = 'cust_pkg'. $self->pkgnum; #hack for IE ignoring real #fragment + [ "${p}view/cust_main.cgi?custnum=".$self->custnum. + "$show;fragment=$frag#cust_pkg", + 'pkgnum' + ]; }; my $clink = sub { diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 00856a021..88fd03713 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -207,7 +207,7 @@ my $cust_main = qsearchs( { }); die "Customer not found!" unless $cust_main; -#false laziness w/pref/pref.html +#false laziness w/pref/pref.html and Conf.pm (cust_main-default_view) tie my %views, 'Tie::IxHash', 'Basics' => 'basics', 'Notes' => 'notes', #notes and files? @@ -222,9 +222,6 @@ $views{'Jumbo'} = 'jumbo'; my %viewname = reverse %views; - -my $view = $cgi->param('show') - || $curuser->option('default_customer_view') - || 'jumbo'; #'Basics' in 1.9.1? +my $view = $cgi->param('show') || $curuser->default_customer_view; -- cgit v1.2.1 From 94ff0d1fe71494acad3cb252b1054c2768671c4a Mon Sep 17 00:00:00 2001 From: mark Date: Wed, 17 Jun 2009 06:43:08 +0000 Subject: Added separate access right for receivables report --- httemplate/elements/menu.html | 3 ++- httemplate/search/report_receivables.cgi | 2 +- httemplate/search/report_receivables.html | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html index 487373710..5154e1127 100644 --- a/httemplate/elements/menu.html +++ b/httemplate/elements/menu.html @@ -195,7 +195,8 @@ $report_financial{'Pending Payment Report'} = [ $fsurl.'search/cust_pay_pending. if $curuser->access_right('View customer pending payments'); $report_financial{'Payment Batch Report'} = [ $fsurl.'search/pay_batch.html', 'Payment batches (by status and/or date range)' ] if $conf->exists('batch-enable') || $conf->config('batch-enable_payby'); -$report_financial{'A/R Aging'} = [ $fsurl.'search/report_receivables.html', 'Accounts Receivable Aging report' ]; +$report_financial{'A/R Aging'} = [ $fsurl.'search/report_receivables.html', 'Accounts Receivable Aging report' ] + if $curuser->access_right('Receivables report'); $report_financial{'Prepaid Income'} = [ $fsurl.'search/report_prepaid_income.html', 'Prepaid income (unearned revenue) report' ]; $report_financial{'Sales Tax Liability'} = [ $fsurl.'search/report_tax.html', 'Sales tax liability report (old taxclass system)' ]; $report_financial{'Tax Liability'} = [ $fsurl.'search/report_newtax.html', 'Tax liability report (new tax products system)' ] diff --git a/httemplate/search/report_receivables.cgi b/httemplate/search/report_receivables.cgi index c5ca45338..21d7d94c6 100755 --- a/httemplate/search/report_receivables.cgi +++ b/httemplate/search/report_receivables.cgi @@ -71,7 +71,7 @@ <%init> die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Financial reports'); + unless $FS::CurrentUser::CurrentUser->access_right('Receivables report'); my @ranges = ( [ 0, 30 ], diff --git a/httemplate/search/report_receivables.html b/httemplate/search/report_receivables.html index 1ebe08cb8..4f29b063e 100755 --- a/httemplate/search/report_receivables.html +++ b/httemplate/search/report_receivables.html @@ -35,6 +35,6 @@ <%init> die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Financial reports'); + unless $FS::CurrentUser::CurrentUser->access_right('Receivables report'); -- cgit v1.2.1 From b236545e63f3653203baba2785506dbafe88a22a Mon Sep 17 00:00:00 2001 From: mark Date: Thu, 18 Jun 2009 01:17:09 +0000 Subject: Fix receivables report ACL checks and menu --- httemplate/elements/menu.html | 41 +++++++++++++++++-------------- httemplate/search/report_receivables.cgi | 3 ++- httemplate/search/report_receivables.html | 3 ++- 3 files changed, 27 insertions(+), 20 deletions(-) (limited to 'httemplate') diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html index 5154e1127..5789a8a3f 100644 --- a/httemplate/elements/menu.html +++ b/httemplate/elements/menu.html @@ -185,23 +185,27 @@ tie my %report_bill_event, 'Tie::IxHash', 'Invoice event errors' => [ $fsurl.'search/cust_bill_event.html?failed=1', 'Reports on deprecated, old-style events for failed credit cards, processor or printer problems, etc.' ], ; -tie my %report_financial, 'Tie::IxHash', - 'Sales, Credits and Receipts' => [ $fsurl.'graph/report_money_time.html', 'Sales, credits and receipts summary graph' ], - 'Sales Report' => [ $fsurl.'graph/report_cust_bill_pkg.html', 'Sales report and graph (by agent, package class and/or date range)' ], - 'Credit Report' => [ $fsurl.'search/report_cust_credit.html', 'Credit report (by employee and/or date range)' ], - 'Payment Report' => [ $fsurl.'search/report_cust_pay.html', 'Payment report (by type and/or date range)' ], -; -$report_financial{'Pending Payment Report'} = [ $fsurl.'search/cust_pay_pending.html?magic=_date;statusNOT=done', 'Pending real-time payments' ] - if $curuser->access_right('View customer pending payments'); -$report_financial{'Payment Batch Report'} = [ $fsurl.'search/pay_batch.html', 'Payment batches (by status and/or date range)' ] - if $conf->exists('batch-enable') || $conf->config('batch-enable_payby'); -$report_financial{'A/R Aging'} = [ $fsurl.'search/report_receivables.html', 'Accounts Receivable Aging report' ] - if $curuser->access_right('Receivables report'); -$report_financial{'Prepaid Income'} = [ $fsurl.'search/report_prepaid_income.html', 'Prepaid income (unearned revenue) report' ]; -$report_financial{'Sales Tax Liability'} = [ $fsurl.'search/report_tax.html', 'Sales tax liability report (old taxclass system)' ]; -$report_financial{'Tax Liability'} = [ $fsurl.'search/report_newtax.html', 'Tax liability report (new tax products system)' ] - if $conf->exists('enable_taxproducts'); -; +tie my %report_financial, 'Tie::IxHash'; +if($curuser->access_right('Financial reports')) { + %report_financial = ( + 'Sales, Credits and Receipts' => [ $fsurl.'graph/report_money_time.html', 'Sales, credits and receipts summary graph' ], + 'Sales Report' => [ $fsurl.'graph/report_cust_bill_pkg.html', 'Sales report and graph (by agent, package class and/or date range)' ], + 'Credit Report' => [ $fsurl.'search/report_cust_credit.html', 'Credit report (by employee and/or date range)' ], + 'Payment Report' => [ $fsurl.'search/report_cust_pay.html', 'Payment report (by type and/or date range)' ], + ); + $report_financial{'Pending Payment Report'} = [ $fsurl.'search/cust_pay_pending.html?magic=_date;statusNOT=done', 'Pending real-time payments' ] + if $curuser->access_right('View customer pending payments'); + $report_financial{'Payment Batch Report'} = [ $fsurl.'search/pay_batch.html', 'Payment batches (by status and/or date range)' ] + if $conf->exists('batch-enable') || $conf->config('batch-enable_payby'); + $report_financial{'Prepaid Income'} = [ $fsurl.'search/report_prepaid_income.html', 'Prepaid income (unearned revenue) report' ]; + $report_financial{'A/R Aging'} = [ $fsurl.'search/report_receivables.html', 'Accounts Receivable Aging report' ]; + $report_financial{'Sales Tax Liability'} = [ $fsurl.'search/report_tax.html', 'Sales tax liability report (old taxclass system)' ]; + $report_financial{'Tax Liability'} = [ $fsurl.'search/report_newtax.html', 'Tax liability report (new tax products system)' ] + if $conf->exists('enable_taxproducts'); +} +elsif($curuser->access_right('Receivables report')) { + $report_financial{'A/R Aging'} = [ $fsurl.'search/report_receivables.html', 'Accounts Receivable Aging report' ]; +} # else $report_financial contains nothing. tie my %report_menu, 'Tie::IxHash'; $report_menu{'Customers'} = [ \%report_customers, 'Customer reports' ] @@ -217,7 +221,8 @@ $report_menu{'Usage'} = [ \%report_rating, 'Usage reports' ] $report_menu{'Billing events'} = [ \%report_bill_event, 'Billing events' ] if $curuser->access_right('Billing event reports'); $report_menu{'Financial'} = [ \%report_financial, 'Financial reports' ] - if $curuser->access_right('Financial reports'); + if $curuser->access_right('Financial reports') + or $curuser->access_right('Receivables report'); $report_menu{'SQL Query'} = [ $fsurl.'search/report_sql.html', 'SQL Query' ] if $curuser->access_right('Raw SQL'); diff --git a/httemplate/search/report_receivables.cgi b/httemplate/search/report_receivables.cgi index 21d7d94c6..63adba05e 100755 --- a/httemplate/search/report_receivables.cgi +++ b/httemplate/search/report_receivables.cgi @@ -71,7 +71,8 @@ <%init> die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Receivables report'); + unless $FS::CurrentUser::CurrentUser->access_right('Receivables report') + or $FS::CurrentUser::CurrentUser->access_right('Financial reports'); my @ranges = ( [ 0, 30 ], diff --git a/httemplate/search/report_receivables.html b/httemplate/search/report_receivables.html index 4f29b063e..bfb016945 100755 --- a/httemplate/search/report_receivables.html +++ b/httemplate/search/report_receivables.html @@ -35,6 +35,7 @@ <%init> die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Receivables report'); + unless $FS::CurrentUser::CurrentUser->access_right('Receivables report') + or $FS::CurrentUser::CurrentUser->access_right('Financial reports'); -- cgit v1.2.1 From 53e8e54d52fcc170f4e489b65376a135c421d431 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 18 Jun 2009 09:52:49 +0000 Subject: forgot this --- httemplate/images/gray-black-side.png | Bin 0 -> 213 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 httemplate/images/gray-black-side.png (limited to 'httemplate') diff --git a/httemplate/images/gray-black-side.png b/httemplate/images/gray-black-side.png new file mode 100644 index 000000000..b384930cd Binary files /dev/null and b/httemplate/images/gray-black-side.png differ -- cgit v1.2.1 From 287bf810a8ae3528525fff354610afa606468299 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 18 Jun 2009 11:03:34 +0000 Subject: add basic part_pkg cost columns for agent wholsale price plan, RT#4696 --- httemplate/edit/part_pkg.cgi | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index a2ec63068..6391db92a 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -37,6 +37,8 @@ 'taxproduct_select'=> 'Tax products', 'plan' => 'Price plan', 'disabled' => 'Disable new orders', + 'setup_cost' => 'Setup cost', + 'recur_cost' => 'Recur cost', 'pay_weight' => 'Payment weight', 'credit_weight' => 'Credit weight', 'agentnum' => 'Agent', @@ -131,10 +133,10 @@ { field=>'promo_code', type=>'text', size=>15 }, { type => 'tablebreak-tr-title', - value => 'Line-item revenue recogition', #better name? + value => 'Cost tracking', #better name? }, - { field=>'pay_weight', type=>'text', size=>6 }, - { field=>'credit_weight', type=>'text', size=>6 }, + { field=>'setup_cost', type=>'money', }, + { field=>'recur_cost', type=>'money', }, { type => 'columnnext' }, @@ -148,6 +150,13 @@ }, }, + { type => 'tablebreak-tr-title', + value => 'Line-item revenue recogition', #better name? + }, + { field=>'pay_weight', type=>'text', size=>6 }, + { field=>'credit_weight', type=>'text', size=>6 }, + + { type => 'columnend' }, { 'type' => 'tablebreak-tr-title', -- cgit v1.2.1 From 04a69f9d197efee6fa396bd35d04ae553e669978 Mon Sep 17 00:00:00 2001 From: jeff Date: Sun, 21 Jun 2009 15:21:32 +0000 Subject: CUSTOM packages/actual flag for custom packages #3988 --- httemplate/browse/agent_type.cgi | 4 +++- httemplate/browse/part_pkg.cgi | 14 ++++++----- httemplate/edit/REAL_cust_pkg.cgi | 5 ++++ httemplate/edit/agent_type.cgi | 2 +- .../edit/cust_main/first_pkg/select-part_pkg.html | 4 +--- httemplate/edit/cust_pkg.cgi | 4 ++-- httemplate/edit/part_bill_event.cgi | 2 +- httemplate/edit/part_pkg.cgi | 12 ++++------ httemplate/edit/reg_code.cgi | 2 +- httemplate/misc/bulk_change_pkg.cgi | 5 +--- httemplate/misc/cancel_pkg.html | 2 +- httemplate/misc/cust_main-import.cgi | 2 +- httemplate/misc/delay_susp_pkg.html | 2 +- httemplate/misc/meta-import.cgi | 2 +- httemplate/search/cust_main.cgi | 5 ++-- httemplate/search/cust_pkg.cgi | 2 +- httemplate/search/reg_code.html | 2 +- httemplate/search/report_cust_pkg.html | 28 ++++++++++++++++++++++ httemplate/view/cust_main/packages/package.html | 2 +- httemplate/view/cust_main/packages/status.html | 2 +- 20 files changed, 66 insertions(+), 37 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/agent_type.cgi b/httemplate/browse/agent_type.cgi index d64ff186a..f07a6515b 100755 --- a/httemplate/browse/agent_type.cgi +++ b/httemplate/browse/agent_type.cgi @@ -44,7 +44,9 @@ my $agent_type = shift; [ { #'data' => $part_pkg->pkg. ' - '. $part_pkg->comment, - 'data' => $type_pkgs->pkg. ' - '. $type_pkgs->comment, + 'data' => $type_pkgs->pkg. ' - '. + ( $type_pkgs->custom ? '(CUSTOM) ' : '' ). + $type_pkgs->comment, 'align' => 'left', 'link' => $p. 'edit/part_pkg.cgi?'. $type_pkgs->pkgpart, }, diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index 8c961b839..c6cbb81a3 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -4,11 +4,11 @@ 'html_posttotal' => $html_posttotal, 'name' => 'package definitions', 'disableable' => 1, - 'disabled_statuspos' => 3, + 'disabled_statuspos' => 4, 'agent_virt' => 1, 'agent_null_right' => [ $edit, $edit_global ], 'agent_null_right_link' => $edit_global, - 'agent_pos' => 5, + 'agent_pos' => 6, 'query' => { 'select' => $select, 'table' => 'part_pkg', 'hashref' => \%hash, @@ -164,10 +164,12 @@ $cgi->param('recurring', $cgi->param('recurring') ^ 1 ); #put it back my $link = [ $p.'edit/part_pkg.cgi?', 'pkgpart' ]; -my @header = ( '#', 'Package', 'Comment' ); -my @fields = ( 'pkgpart', 'pkg', 'comment' ); -my $align = 'rll'; -my @links = ( $link, $link, '' ); +my @header = ( '#', 'Package', 'Comment', 'Custom' ); +my @fields = ( 'pkgpart', 'pkg', 'comment', + sub{ ''.$_[0]->custom.'' } + ); +my $align = 'rllc'; +my @links = ( $link, $link, '', '' ); unless ( 0 ) { #already showing only one class or something? push @header, 'Class'; diff --git a/httemplate/edit/REAL_cust_pkg.cgi b/httemplate/edit/REAL_cust_pkg.cgi index b2c89c32c..a707aca8d 100755 --- a/httemplate/edit/REAL_cust_pkg.cgi +++ b/httemplate/edit/REAL_cust_pkg.cgi @@ -31,6 +31,11 @@ <% $part_pkg->pkg %> + + Custom + <% $part_pkg->custom %> + + Comment <% $part_pkg->comment %> diff --git a/httemplate/edit/agent_type.cgi b/httemplate/edit/agent_type.cgi index abf4bf89f..8a6fbc255 100755 --- a/httemplate/edit/agent_type.cgi +++ b/httemplate/edit/agent_type.cgi @@ -20,7 +20,7 @@ Select which packages agents of this type may sell to customers
'source_obj' => $agent_type, 'link_table' => 'type_pkgs', 'target_table' => 'part_pkg', - 'name_callback' => sub { $_[0]->pkg. ' - '. $_[0]->comment; }, + 'name_callback' => sub { $_[0]->pkg_comment(nopkgpart => 1); }, 'target_link' => $p.'edit/part_pkg.cgi?', 'disable-able' => 1, diff --git a/httemplate/edit/cust_main/first_pkg/select-part_pkg.html b/httemplate/edit/cust_main/first_pkg/select-part_pkg.html index 1b62035b2..d2d862bea 100644 --- a/httemplate/edit/cust_main/first_pkg/select-part_pkg.html +++ b/httemplate/edit/cust_main/first_pkg/select-part_pkg.html @@ -141,9 +141,7 @@ foreach my $part_pkg ( @part_pkg ) { my @options = ( '', map $pkgpart_svcpart{ $_->pkgpart }, @part_pkg ); my %labels = ( '' => '(none)', - map { $pkgpart_svcpart{ $_->pkgpart } - => $_->pkg. " - ". $_->comment - } + map { $pkgpart_svcpart{ $_->pkgpart } => $_->pkg_comment } @part_pkg ); diff --git a/httemplate/edit/cust_pkg.cgi b/httemplate/edit/cust_pkg.cgi index f927e1042..dd1ed335f 100755 --- a/httemplate/edit/cust_pkg.cgi +++ b/httemplate/edit/cust_pkg.cgi @@ -128,10 +128,10 @@ my %all_comment = (); #} foreach (qsearch('part_pkg', {} )) { $all_pkg{ $_ -> getfield('pkgpart') } = $_->getfield('pkg'); - $all_comment{ $_ -> getfield('pkgpart') } = $_->getfield('comment'); + $all_comment{ $_ -> getfield('pkgpart') } = $_->custom_comment; next if $_->disabled; $pkg{ $_ -> getfield('pkgpart') } = $_->getfield('pkg'); - $comment{ $_ -> getfield('pkgpart') } = $_->getfield('comment'); + $comment{ $_ -> getfield('pkgpart') } = $_->custom_comment; } my($custnum, %remove_pkg); diff --git a/httemplate/edit/part_bill_event.cgi b/httemplate/edit/part_bill_event.cgi index 3b5114122..ffd642bae 100755 --- a/httemplate/edit/part_bill_event.cgi +++ b/httemplate/edit/part_bill_event.cgi @@ -78,7 +78,7 @@ Invoice Event #<% $hashref->{eventpart} ? $hashref->{eventpart} : "(NEW)" %> % join("\n", map { % '

+ + <% include('/elements/footer.html') %> @@ -27,7 +41,7 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific? -my($svcnum, $pkgnum, $svcpart, $kludge_action, $purpose, $part_svc, +my($svcnum, $pkgnum, $svcpart, $kludge_action, $part_svc, $svc_domain); if ( $cgi->param('error') ) { @@ -38,7 +52,6 @@ if ( $cgi->param('error') ) { $pkgnum = $cgi->param('pkgnum'); $svcpart = $cgi->param('svcpart'); $kludge_action = $cgi->param('action'); - $purpose = $cgi->param('purpose'); $part_svc = qsearchs('part_svc', { 'svcpart' => $svcpart } ); die "No part_svc entry!" unless $part_svc; @@ -61,7 +74,6 @@ if ( $cgi->param('error') ) { } else { #editing $kludge_action = ''; - $purpose = ''; my($query) = $cgi->keywords; $query =~ /^(\d+)$/ or die "unparsable svcnum"; $svcnum=$1; @@ -82,6 +94,20 @@ my $action = $svcnum ? 'Edit' : 'Add'; my $svc = $part_svc->getfield('svc'); +my @exports = $part_svc->part_export(); + +my $registrar; +my $export; + +# Find the first export that does domain registration +foreach (@exports) { + $export = $_ if $_->can('registrar'); +} +# If we have a domain registration export, get the registrar object +if ($export) { + $registrar = $export->registrar; +} + my $otaker = getotaker; my $domain = $svc_domain->domain; -- cgit v1.2.1 From 98901e4ef499dfb983bbd0d467eca3a0534bc3e9 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 20 May 2009 15:27:17 +0000 Subject: add "manage device" link & config, RT#5438 --- httemplate/view/cust_main/packages.html | 1 + httemplate/view/cust_main/packages/services.html | 23 +++++++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index ed98ba903..0c0526d42 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -148,6 +148,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' => $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 1e473736b..37cd615eb 100644 --- a/httemplate/view/cust_main/packages/services.html +++ b/httemplate/view/cust_main/packages/services.html @@ -36,15 +36,24 @@ % ) % ) { ( <%svc_recharge_link($cust_svc)%> ) -% } +% } - + -% if ( $curuser->access_right('Unprovision customer service') ) { - ( <%svc_unprovision_link($cust_svc)%> ) -% } - +% my $manage_link = $opt{'svc_broadband-manage_link'}; +% if ( $manage_link && $part_svc->svcdb eq 'svc_broadband' ) { +% my $ip_addr = $cust_svc->svc_x->ip_addr; +% my $svc_manage_link = eval(qq("$manage_link")); + Manage Device ) + +% } + + +% if ( $curuser->access_right('Unprovision customer service') ) { + ( <%svc_unprovision_link($cust_svc)%> ) +% } + % } @@ -75,6 +84,8 @@ my $cust_pkg = $opt{'cust_pkg'}; my $part_pkg = $opt{'part_pkg'}; my $curuser = $FS::CurrentUser::CurrentUser; +my $conf = new FS::Conf; + sub svc_provision_link { my ($cust_pkg, $part_svc, $opt, $curuser) = @_; ( my $svc_nbsp = $part_svc->svc ) =~ s/\s+/ /g; -- cgit v1.2.1 From 0d8c19f122f9f7331aa707192f3bffa473f069a5 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 22 May 2009 03:02:54 +0000 Subject: add ability to report on packages w/status "not yet billed" as well, RT#5409 --- httemplate/search/report_cust_pkg.html | 1 + 1 file changed, 1 insertion(+) (limited to 'httemplate') diff --git a/httemplate/search/report_cust_pkg.html b/httemplate/search/report_cust_pkg.html index aef1c24e5..b5d2d8b79 100755 --- a/httemplate/search/report_cust_pkg.html +++ b/httemplate/search/report_cust_pkg.html @@ -129,6 +129,7 @@ my %label = ( #false laziness w/cust_pkg.cgi my %disable = ( 'all' => {}, + 'not yet billed' => { 'setup'=>1, 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, }, 'one-time charge' => { 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, }, 'active' => { 'susp'=>1, 'cancel'=>1 }, 'suspended' => { 'cancel' => 1 }, -- cgit v1.2.1 From d6b6f81e383f9d876e67e9704914e887a331012e Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 25 May 2009 01:49:34 +0000 Subject: international self-service payments, RT#1592 --- httemplate/elements/location.html | 20 +++++++++----------- httemplate/elements/select-county.html | 6 ++++-- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'httemplate') diff --git a/httemplate/elements/location.html b/httemplate/elements/location.html index 6691bc84e..dbc567d4d 100644 --- a/httemplate/elements/location.html +++ b/httemplate/elements/location.html @@ -23,7 +23,7 @@ Example: NAME = "<%$pre%>address1" ID = "<%$pre%>address1" VALUE = "<% $object->get($pre.'address1') |h %>" - SIZE = 58 + SIZE = 54 onChange = "<% $onchange %>" <% $disabled %> <% $style %> @@ -38,7 +38,7 @@ Example: NAME = "<%$pre%>address2" ID = "<%$pre%>address2" VALUE = "<% $object->get($pre.'address2') |h %>" - SIZE = 58 + SIZE = 54 onChange = "<% $onchange %>" <% $disabled %> <% $style %> @@ -48,7 +48,7 @@ Example: <%$r%>City - + <% $style %> > - - ><%$r%>County - - <% include('/elements/select-county.html', %select_hash ) %> - <%$r%>State - + ><%$r%>County + <% include('/elements/select-county.html', %select_hash ) %> + <%$r%>State + <% include('/elements/select-state.html', %select_hash ) %> <%$r%>Zip @@ -82,7 +80,7 @@ Example: <%$r%>Country - <% include('/elements/select-country.html', %select_hash ) %> + <% include('/elements/select-country.html', %select_hash ) %> % if ( !$pre ) { @@ -126,7 +124,7 @@ my @counties = counties( $object->get($pre.'state'), $object->get($pre.'country'), ); my @county_style = (); -push @county_style, 'visibility:hidden' +push @county_style, 'display:none' # 'visibility:hidden' unless scalar(@counties) > 1; my $style = diff --git a/httemplate/elements/select-county.html b/httemplate/elements/select-county.html index 59f235a23..aa88abe96 100644 --- a/httemplate/elements/select-county.html +++ b/httemplate/elements/select-county.html @@ -58,10 +58,12 @@ Example: if ( countiesArray.length > 1 ) { what.form.<% $pre %>county.style.display = ''; - countyFormLabel.style.visibility = 'visible'; + //countyFormLabel.style.visibility = 'visible'; + countyFormLabel.style.display = ''; } else { what.form.<% $pre %>county.style.display = 'none'; - countyFormLabel.style.visibility = 'hidden'; + //countyFormLabel.style.visibility = 'hidden'; + countyFormLabel.style.display = 'none'; } //run the callback -- cgit v1.2.1 From 208add41d52153ccff338fe0f1eafbc0c462a2ed Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 25 May 2009 22:42:21 +0000 Subject: fix total links on sales graph when a package class is specified, RT#5449 --- httemplate/graph/cust_bill_pkg.cgi | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) (limited to 'httemplate') diff --git a/httemplate/graph/cust_bill_pkg.cgi b/httemplate/graph/cust_bill_pkg.cgi index d7cae8055..a96eed779 100644 --- a/httemplate/graph/cust_bill_pkg.cgi +++ b/httemplate/graph/cust_bill_pkg.cgi @@ -9,7 +9,7 @@ 'links' => \@links, 'remove_empty' => 1, 'bottom_total' => 1, - 'bottom_link' => "$link;", + 'bottom_link' => $bottom_link, 'agentnum' => $agentnum, ) %> @@ -27,21 +27,42 @@ if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) { } my $title = $sel_agent ? $sel_agent->agent.' ' : ''; -#false lazinessish w/search/cust_pkg.cgi +my $link = "${p}search/cust_bill_pkg.cgi?nottax=1;include_comp_cust=1"; +my $bottom_link = "$link;"; + +#classnum (here) +# 0: all classes +# not specified: empty class +# N: classnum +#classnum (link) +# not specified: all classes +# 0: empty class +# N: classnum + +#false lazinessish w/FS::cust_pkg::search_sql (previously search/cust_pkg.cgi) my $classnum = 0; my @pkg_class = (); if ( $cgi->param('classnum') =~ /^(\d*)$/ ) { $classnum = $1; - if ( $classnum ) { + + if ( $classnum ) { #a specific class + @pkg_class = ( qsearchs('pkg_class', { 'classnum' => $classnum } ) ); die "classnum $classnum not found!" unless $pkg_class[0]; $title .= $pkg_class[0]->classname.' '; - } elsif ( $classnum eq '' ) { + $bottom_link .= "classnum=$classnum;"; + + } elsif ( $classnum eq '' ) { #the empty class + $title .= 'Empty class '; @pkg_class = ( '(empty class)' ); - } elsif ( $classnum eq '0' ) { + $bottom_link .= "classnum=0;"; + + } elsif ( $classnum eq '0' ) { #all classes + @pkg_class = qsearch('pkg_class', {} ); # { 'disabled' => '' } ); push @pkg_class, '(empty class)'; + } } #eslaf @@ -57,8 +78,6 @@ my @labels = (); my @colors = (); my @links = (); -my $link = "${p}search/cust_bill_pkg.cgi?nottax=1;include_comp_cust=1"; - foreach my $agent ( $sel_agent || qsearch('agent', { 'disabled' => '' } ) ) { my $col_scheme = Color::Scheme->new -- cgit v1.2.1 From 8d9be02c9965db4c4a48a2221455160685a95462 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 26 May 2009 01:35:16 +0000 Subject: add a config option for some basic tax grouping by name, RT#5446 --- httemplate/search/report_tax.cgi | 57 ++++++++++++++++++++++++++++----------- httemplate/search/report_tax.html | 36 ++++++++++++++++++++----- 2 files changed, 71 insertions(+), 22 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/report_tax.cgi b/httemplate/search/report_tax.cgi index a7630dd2d..643ba52f3 100755 --- a/httemplate/search/report_tax.cgi +++ b/httemplate/search/report_tax.cgi @@ -174,7 +174,7 @@ <<%$td%>>Total <<%$td%> ALIGN="right"> <% &$money_sprintf( $tax ) %> + ><% &$money_sprintf( $tot_tax ) %> @@ -275,8 +275,16 @@ if ( $conf->exists('tax-pkg_address') ) { "WHERE 0 < ( SELECT COUNT(*) FROM cust_main WHERE $gotcust LIMIT 1 )"; } -my($total, $tot_taxable, $owed, $tax) = ( 0, 0, 0, 0 ); +#tax-report_groups filtering +my($group_op, $group_value) = ( '', '' ); +if ( $cgi->param('report_group') =~ /^(=|!=) (.*)$/ ) { + ( $group_op, $group_value ) = ( $1, $2 ); +} +my $skipping_out = $group_op ? 1 : 0; #in case there are other reasons + +my( $total, $tot_taxable, $tot_owed ) = ( 0, 0, 0 ); my( $exempt_cust, $exempt_pkg, $exempt_monthly ) = ( 0, 0, 0 ); + my $out = 'Out of taxable region(s)'; my %regions = (); @@ -326,8 +334,8 @@ foreach my $r ( qsearch({ 'table' => 'cust_main_county', my $t_sql = "SELECT SUM(cust_bill_pkg.setup+cust_bill_pkg.recur) $fromwhere AND $nottax"; my $t = scalar_sql($r, \@param, $t_sql); - $total += $t; $regions{$label}->{'total'} += $t; + $total += $t unless $label eq $out && $skipping_out; #if ( $label eq $out ) {# && $t ) { # warn "adding $t for ". @@ -356,8 +364,8 @@ foreach my $r ( qsearch({ 'table' => 'cust_main_county', $fromwhere AND $nottax AND tax = 'Y' " ); - $exempt_cust += $x_cust; $regions{$label}->{'exempt_cust'} += $x_cust; + $exempt_cust += $x_cust unless $label eq $out && $skipping_out; ## calculate package-exemption for this region @@ -384,8 +392,8 @@ foreach my $r ( qsearch({ 'table' => 'cust_main_county', AND ( tax != 'Y' OR tax IS NULL ) " ); - $exempt_pkg += $x_pkg; $regions{$label}->{'exempt_pkg'} += $x_pkg; + $exempt_pkg += $x_pkg unless $label eq $out && $skipping_out; ## calculate monthly exemption (texas tax) for this region @@ -404,16 +412,17 @@ foreach my $r ( qsearch({ 'table' => 'cust_main_county', # $taxable -= $x_monthly; # } - $exempt_monthly += $x_monthly; $regions{$label}->{'exempt_monthly'} += $x_monthly; + $exempt_monthly += $x_monthly unless $label eq $out && $skipping_out; my $taxable = $t - $x_cust - $x_pkg - $x_monthly; - $tot_taxable += $taxable; $regions{$label}->{'taxable'} += $taxable; + $tot_taxable += $taxable unless $label eq $out && $skipping_out; - $owed += $taxable * ($r->tax/100); - $regions{$label}->{'owed'} += $taxable * ($r->tax/100); + my $owed = $taxable * ($r->tax/100); + $regions{$label}->{'owed'} += $owed; + $tot_owed += $owed unless $label eq $out && $skipping_out; if ( defined($regions{$label}->{'rate'}) && $regions{$label}->{'rate'} != $r->tax.'%' ) { @@ -474,6 +483,7 @@ my $_taxamount_sub = sub { scalar_sql($r, \@taxparam, $sql ); }; +my $tot_tax = 0; #foreach my $label ( keys %regions ) { foreach my $r ( qsearch(\%qsearch) ) { @@ -486,8 +496,8 @@ foreach my $r ( qsearch(\%qsearch) ) { my $x = &{$_taxamount_sub}($r); - $tax += $x unless $cgi->param('show_taxclasses'); $regions{$label}->{'tax'} += $x; + $tot_tax += $x unless $cgi->param('show_taxclasses'); } @@ -508,17 +518,34 @@ if ( $cgi->param('show_taxclasses') ) { ); $base_regions{$base_label}->{'tax'} += $x; - $tax += $x; + $tot_tax += $x; } } +my @regions = keys %regions; + +#tax-report_groups filtering +if ( $group_op ) { + @regions = grep { + if ( $_ eq $out ) { #don't display "out of taxable region" in this case + 0; + } elsif ( $group_op eq '=' ) { + $_ =~ /^$group_value \(/; + } elsif ( $group_op eq '!=' ) { + $_ !~ /^$group_value \(/; + } else { + die "guru meditation #00de: group_op $group_op\n"; + } + } @regions; +} + #ordering -my @regions = +@regions = map $regions{$_}, sort { ( ($a eq $out) cmp ($b eq $out) ) || ($b cmp $a) } - keys %regions; + @regions; my @base_regions = map $base_regions{$_}, @@ -534,8 +561,8 @@ push @regions, { 'exempt_monthly' => $exempt_monthly, 'taxable' => $tot_taxable, 'rate' => '', - 'owed' => $owed, - 'tax' => $tax, + 'owed' => $tot_owed, + 'tax' => $tot_tax, }; #-- diff --git a/httemplate/search/report_tax.html b/httemplate/search/report_tax.html index e5ffa9a17..8640e0ee7 100755 --- a/httemplate/search/report_tax.html +++ b/httemplate/search/report_tax.html @@ -4,29 +4,49 @@ +% if ( $conf->config('tax-report_groups') ) { +% my @lines = $conf->config('tax-report_groups'); + + + + + + +% } + <% include( '/elements/tr-select-agent.html', 'disable_empty'=>0 ) %> <% include( '/elements/tr-input-beginning_ending.html' ) %> -% my $conf = new FS::Conf; -% if ( $conf->exists('enable_taxclasses') ) { -% +% if ( $conf->exists('enable_taxclasses') ) { % } -% my @pkg_class = qsearch('pkg_class', {}); -% if ( @pkg_class ) { -% +% my @pkg_class = qsearch('pkg_class', {}); +% if ( @pkg_class ) { % } -
Tax group + +
Show tax classes
Show package classes

@@ -39,4 +59,6 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Financial reports'); +my $conf = new FS::Conf; + -- cgit v1.2.1 From f8cde7e13b431e0f159906b96b0c4d02382a875d Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 26 May 2009 01:43:30 +0000 Subject: add a config option for some basic tax grouping by name, RT#5446 --- httemplate/search/report_tax.cgi | 2 +- httemplate/search/report_tax.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/report_tax.cgi b/httemplate/search/report_tax.cgi index 643ba52f3..9f0ad990a 100755 --- a/httemplate/search/report_tax.cgi +++ b/httemplate/search/report_tax.cgi @@ -1,4 +1,4 @@ -<% include("/elements/header.html", "$agentname Sales Tax Report - ". +<% include("/elements/header.html", "$agentname Tax Report - ". ( $beginning ? time2str('%h %o %Y ', $beginning ) : '' diff --git a/httemplate/search/report_tax.html b/httemplate/search/report_tax.html index 8640e0ee7..217f48146 100755 --- a/httemplate/search/report_tax.html +++ b/httemplate/search/report_tax.html @@ -8,7 +8,7 @@ % my @lines = $conf->config('tax-report_groups'); - Tax group + Tax group !; }, - fields('cdr'), #XXX fill in some pretty-print + @fields, #XXX fill in some pretty-print #processing, etc. ], @@ -156,4 +156,36 @@ my $qsearch = join(' AND ', @qsearch); $qsearch = ( scalar(keys %$hashref) ? ' AND ' : ' WHERE ' ) . $qsearch if $qsearch; +### +# display fields +### + +#XXX fill in some (more) nice names +my %header = ( + 'calldate' => 'Call Date', + 'clid' => 'Caller ID', + 'charged_party' => 'Charged party', + 'src' => 'Source', + 'dst' => 'Destination', + 'dcontext' => 'Destination Context', + 'channel' => 'Channel', + 'dstchannel' => 'Destination Channel', + 'freesidestatus' => 'Freeside status', +); + +my @first = qw( acctid calldate clid charged_party src dst dcontext ); +my %first = map { $_=>1 } @first; + +my @fields = ( @first, grep !$first{$_}, fields('cdr') ); + +my @header = map { + if ( exists($header{$_}) ) { + $header{$_}; + } else { + my $header = $_; + $header =~ s/\_/ /g; + ucfirst($header); + } + } @fields; + -- cgit v1.2.1 From 9832f4d4086970d7612ff2a6facd797fa85d7814 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 31 May 2009 06:59:37 +0000 Subject: package definition browse/search, filter by package class, RT#5255 --- httemplate/browse/part_pkg.cgi | 61 +++++++++++++++++++++++++++-------- httemplate/elements/select-table.html | 9 ++++-- 2 files changed, 55 insertions(+), 15 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index 26028b6ad..886c6c849 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -1,6 +1,7 @@ <% include( 'elements/browse.html', 'title' => 'Package Definitions', 'html_init' => $html_init, + 'html_posttotal' => $html_posttotal, 'name' => 'package definitions', 'disableable' => 1, 'disabled_statuspos' => 3, @@ -48,10 +49,10 @@ if ( $cgi->param('active') ) { $orderby = 'num_active DESC'; } -my $extra_sql = ''; +my @where = (); #if ( $cgi->param('activeONLY') ) { -# $extra_sql = ' WHERE num_active > 0 '; #XXX doesn't affect count... +# push @where, ' WHERE num_active > 0 '; #XXX doesn't affect count... #} if ( $cgi->param('recurring') ) { @@ -59,21 +60,30 @@ if ( $cgi->param('recurring') ) { $extra_count = ' freq != 0 '; } -if ( $cgi->param('missing_recur_fee') ) { - my $missing = "0 = ( SELECT COUNT(*) FROM part_pkg_option - WHERE optionname = 'recur_fee' - AND part_pkg_option.pkgpart = part_pkg.pkgpart - AND CAST ( optionvalue AS NUMERIC ) > 0 - )"; - $extra_sql .= ( ( scalar(keys %hash) || $extra_sql ) ? ' AND ' : ' WHERE ' ). - $missing; +my $classnum = ''; +if ( $cgi->param('classnum') =~ /^(\d+)$/ ) { + $classnum = $1; + push @where, $classnum ? "classnum = $classnum" + : "classnum IS NULL"; } +$cgi->delete('classnum'); -unless ( $acl_edit_global ) { - $extra_sql .= ( ( scalar(keys %hash) || $extra_sql ) ? ' AND ' : ' WHERE ' ). - FS::part_pkg->curuser_pkgs_sql; +if ( $cgi->param('missing_recur_fee') ) { + push @where, "0 = ( SELECT COUNT(*) FROM part_pkg_option + WHERE optionname = 'recur_fee' + AND part_pkg_option.pkgpart = part_pkg.pkgpart + AND CAST ( optionvalue AS NUMERIC ) > 0 + )"; } +push @where, FS::part_pkg->curuser_pkgs_sql + unless $acl_edit_global; + +my $extra_sql = scalar(@where) + ? ( scalar(keys %hash) ? ' AND ' : ' WHERE ' ). + join( 'AND ', @where) + : ''; + my $agentnums = join(',', $curuser->agentnums); my $count_cust_pkg = " SELECT COUNT(*) FROM cust_pkg LEFT JOIN cust_main USING ( custnum ) @@ -117,6 +127,31 @@ my $html_init; !; #} +$cgi->param('dummy', 1); + +my $filter_change = + qq(\n\n"; + +#restore this so pagination works +$cgi->param('classnum', $classnum) if length($classnum); + +my $html_posttotal = + "$filter_change\n
( show class: ". + include('/elements/select-pkg_class.html', + #'curr_value' => $classnum, + 'value' => $classnum, #insist on 0 :/ + 'onchange' => 'filter_change()', + 'pre_options' => [ '-1' => 'all', + '0' => '(none)', ], + 'disable_empty' => 1, + ). + ' )'; + # ------ my $link = [ $p.'edit/part_pkg.cgi?', 'pkgpart' ]; diff --git a/httemplate/elements/select-table.html b/httemplate/elements/select-table.html index e7baaf53b..1a440f07e 100644 --- a/httemplate/elements/select-table.html +++ b/httemplate/elements/select-table.html @@ -64,8 +64,13 @@ Example: > % while ( @pre_options ) { -

+ @@ -76,4 +76,8 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Financial reports'); +my $void = $cgi->param('void') ? 1 : 0; + +my $title = $void ? 'Voided payment report' : 'Payment report'; + diff --git a/httemplate/view/cust_pay.html b/httemplate/view/cust_pay.html index c36d76904..a5c99ac55 100644 --- a/httemplate/view/cust_pay.html +++ b/httemplate/view/cust_pay.html @@ -1,12 +1,12 @@ % if ( $link eq 'popup' ) { - <% include('/elements/header-popup.html', "Payment Receipt" ) %> + <% include('/elements/header-popup.html', "$thing Receipt" ) %>
Print

% } elsif ( $link eq 'print' ) { - <% include('/elements/header-popup.html', "Payment Receipt" ) %> + <% include('/elements/header-popup.html', "$thing Receipt" ) %> % #it would be nice if the menubar could be hidden for print, but better to % # have it available than not, otherwise the user winds up at a dead end @@ -18,7 +18,7 @@ % } else { - <% include('/elements/header.html', "Payment Receipt", menubar( + <% include('/elements/header.html', "$thing Receipt", menubar( "View this customer (#$display_custnum)" => "${p}view/cust_main.cgi?$custnum", 'Print receipt' => $pr_link, )) @@ -48,6 +48,20 @@ +% if ( $void ) { + + + + + + +%# +%# +%# +%# + +% } + @@ -112,16 +126,20 @@ if ( $cgi->param('link') =~ /^(\w+)$/ ) { $link = $1; } +my $void = $cgi->param('void') ? 1 : 0; +my $thing = $void ? 'Voided Payment' : 'Payment'; +my $table = $void ? 'cust_pay_void' : 'cust_pay'; + my $cust_pay = qsearchs({ - 'select' => 'cust_pay.*', - 'table' => 'cust_pay', + 'select' => "$table.*", + 'table' => $table, 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )', 'hashref' => { 'paynum' => $paynum }, 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, }); -die "Payment #$paynum not found!" unless $cust_pay; +die "$thing #$paynum not found!" unless $cust_pay; -my $pr_link = "${p}view/cust_pay.html?link=print;paynum=$paynum"; +my $pr_link = "${p}view/cust_pay.html?link=print;paynum=$paynum;void=$void"; my $custnum = $cust_pay->custnum; my $display_custnum = $cust_pay->cust_main->display_custnum; diff --git a/httemplate/view/cust_pay_void.html b/httemplate/view/cust_pay_void.html new file mode 100644 index 000000000..8c22170d6 --- /dev/null +++ b/httemplate/view/cust_pay_void.html @@ -0,0 +1 @@ +<% include('cust_pay.html', @_, 'void' => 1 ) %> -- cgit v1.2.1 From 342de0c0922c4fac8d6ace5a38670ace35366571 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 27 Jul 2009 09:59:06 +0000 Subject: searching for voided payments by void date as well, RT#5786 --- httemplate/search/elements/cust_pay_or_refund.html | 8 ++++- httemplate/search/report_cust_pay.html | 35 ++++++++++++++++++++-- 2 files changed, 40 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/elements/cust_pay_or_refund.html b/httemplate/search/elements/cust_pay_or_refund.html index acd57912f..874bd8aa3 100755 --- a/httemplate/search/elements/cust_pay_or_refund.html +++ b/httemplate/search/elements/cust_pay_or_refund.html @@ -117,7 +117,6 @@ if ( $cgi->param('magic') ) { my $orderby; if ( $cgi->param('magic') eq '_date' ) { - if ( $cgi->param('agentnum') && $cgi->param('agentnum') =~ /^(\d+)$/ ) { push @search, "agentnum = $1"; # $search{'agentnum'} = $1; my $agent = qsearchs('agent', { 'agentnum' => $1 } ); @@ -219,6 +218,13 @@ if ( $cgi->param('magic') ) { push @search, "_date >= $beginning ", "_date <= $ending"; + if ( $thing eq 'pay_void' ) { + my($v_beginning, $v_ending) = + FS::UI::Web::parse_beginning_ending($cgi, 'void'); + push @search, "void_date >= $v_beginning ", + "void_date <= $v_ending"; + } + push @search, FS::UI::Web::parse_lt_gt($cgi, $amount_field ); $orderby = '_date'; diff --git a/httemplate/search/report_cust_pay.html b/httemplate/search/report_cust_pay.html index a9695acb7..dd2358ad1 100644 --- a/httemplate/search/report_cust_pay.html +++ b/httemplate/search/report_cust_pay.html @@ -3,7 +3,13 @@ -
<% time2str"%a %b %o, %Y %r", $cust_pay->_date %>
Void Date<% time2str"%a %b %o, %Y %r", $cust_pay->void_date %>
Void reason<% $cust_pay->reason %>
Amount <% $money_char. $cust_pay->paid %>
+
+ + + + @@ -55,7 +61,32 @@ ) %> - <% include( '/elements/tr-input-beginning_ending.html' ) %> + + + + + +% if ( $void ) { + + + + +% } <% include( '/elements/tr-input-lessthan_greaterthan.html', 'label' => 'Amount', -- cgit v1.2.1 From 8d02e9450e5999da1015ac4c74f7a478716554f1 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 27 Jul 2009 19:51:16 +0000 Subject: fix spacing --- httemplate/misc/cancel_pkg.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/misc/cancel_pkg.html b/httemplate/misc/cancel_pkg.html index 1228eb1af..607ce13c4 100755 --- a/httemplate/misc/cancel_pkg.html +++ b/httemplate/misc/cancel_pkg.html @@ -17,7 +17,7 @@

-<% ucfirst($method) . $part_pkg->pkg_comment %> +<% ucfirst($method) %> <% $part_pkg->pkg_comment %> <% ntable("#cccccc", 2) %> % if ($method eq 'expire' || $method eq 'adjourn') { -- cgit v1.2.1 From e1b1693a656964c6db0b8a3fb85494014434dcb1 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 28 Jul 2009 21:17:45 +0000 Subject: adding a basic change history using history tables, RT#1005, RT#4357 --- httemplate/pref/pref.html | 28 ++- httemplate/view/cust_main.cgi | 12 +- httemplate/view/cust_main/change_history.html | 302 ++++++++++++++++++++++++++ 3 files changed, 324 insertions(+), 18 deletions(-) create mode 100644 httemplate/view/cust_main/change_history.html (limited to 'httemplate') diff --git a/httemplate/pref/pref.html b/httemplate/pref/pref.html index 8bdf6c09c..562ef2980 100644 --- a/httemplate/pref/pref.html +++ b/httemplate/pref/pref.html @@ -124,25 +124,23 @@ Vonage integration (see Click2Call <% include('/elements/footer.html') %> -<%once> - - #false laziness w/view/cust_main.cgi and Conf.pm (cust_main-default_view) - - tie my %customer_views, 'Tie::IxHash', - 'Basics' => 'basics', - 'Notes' => 'notes', #notes and files? - 'Tickets' => 'tickets', - 'Packages' => 'packages', - 'Payment History' => 'payment_history', - #'Change History' => '', - 'Jumbo' => 'jumbo', - ; - - <%init> my $curuser = $FS::CurrentUser::CurrentUser; +#false laziness w/view/cust_main.cgi and Conf.pm (cust_main-default_view) + +tie my %customer_views, 'Tie::IxHash', + 'Basics' => 'basics', + 'Notes' => 'notes', #notes and files? + 'Tickets' => 'tickets', + 'Packages' => 'packages', + 'Payment History' => 'payment_history', +; +$customer_views{'Change History'} = 'change_history' + if $curuser->access_right('View customer history'); +$customer_views{'Jumbo'} = 'jumbo'; + # XSS via your own preferences? seems unlikely, but nice try anyway... ( $curuser->option('menu_position') || 'top' ) =~ /^(\w+)$/ or die "illegal menu_position"; diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 88fd03713..78bcb1fc1 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -113,6 +113,7 @@ Comments % if ( ! $conf->exists('cust_main-disable_notes') || $notecount) { % unless ( $view eq 'notes' && $cust_main->comments !~ /[^\s\n\r]/ ) { +
Notes
% } @@ -180,6 +181,10 @@ Comments % } +% if ( $view eq 'change_history' ) { # || $view eq 'jumbo' + <% include('cust_main/change_history.html', $cust_main ) %> +% } + <% include('/elements/footer.html') %> <%init> @@ -213,11 +218,12 @@ tie my %views, 'Tie::IxHash', 'Notes' => 'notes', #notes and files? ; $views{'Tickets'} = 'tickets' - if $conf->config('ticket_system'); + if $conf->config('ticket_system'); $views{'Packages'} = 'packages'; $views{'Payment History'} = 'payment_history' - unless $conf->config('payby-default' eq 'HIDE'); -#$views{'Change History'} = ''; + unless $conf->config('payby-default' eq 'HIDE'); +$views{'Change History'} = 'change_history' + if $curuser->access_right('View customer history'); $views{'Jumbo'} = 'jumbo'; my %viewname = reverse %views; diff --git a/httemplate/view/cust_main/change_history.html b/httemplate/view/cust_main/change_history.html new file mode 100644 index 000000000..1700bc34b --- /dev/null +++ b/httemplate/view/cust_main/change_history.html @@ -0,0 +1,302 @@ +% if ( int( time - (keys %years)[0] * 31556736 ) > $start ) { + Show: +% my $chy = $cgi->param('change_history-years'); +% foreach my $y (keys %years) { +% if ( $y == $years ) { + <% $years{$y} %> +% } else { +% $cgi->param('change_history-years', $y); + <% $years{$y} %> +% } +% last if int( time - $y * 31556736 ) < $start; +% } +% $cgi->param('change_history-years', $chy); +% } + +<% include("/elements/table-grid.html") %> +% my $bgcolor1 = '#eeeeee'; +% my $bgcolor2 = '#ffffff'; +% my $bgcolor = ''; + +
+ + + + + + + + +% foreach my $item ( sort { $a->history_date <=> $b->history_date +% #|| table order +% || $a->historynum <=> $b->historynum +% } +% @history +% ) +% { +% +% my $history_other = ''; +% my $act = $item->history_action; +% if ( $act =~ /^replace/ ) { +% my $pkey = $item->primary_key; +% my $date = $item->history_date; +% $history_other = qsearchs({ +% 'table' => $item->table, +% 'hashref' => { $pkey => $item->$pkey(), +% 'history_action' => $replace_other{$act}, +% 'historynum' => { 'op' => $replace_dir{$act}, +% 'value' => $item->historynum +% }, +% }, +% 'extra_sql' => " +% AND history_date $replace_direq{$act} $date +% AND ($date $replace_op{$act} $fuzz) $replace_direq{$act} history_date +% ORDER BY historynum $replace_ord{$act} LIMIT 1 +% ", +% }); +% } +% +% if ( $bgcolor eq $bgcolor1 ) { +% $bgcolor = $bgcolor2; +% } else { +% $bgcolor = $bgcolor1; +% } + + + + + + + + + + +% } + +
+ Search options +
Payments of type:
Payment + + <% include( '/elements/tr-input-beginning_ending.html', + layout => 'horiz', + ) + %> +
+
Voided + + <% include( '/elements/tr-input-beginning_ending.html', + prefix => 'void', + layout => 'horiz', + ) + %> +
+
UserDateTimeItemActionDescription
+% my $otaker = $item->history_user; +% $otaker = 'auto billing' if $otaker eq 'fs_daily'; +% $otaker = 'customer self-service' if $otaker eq 'fs_selfservice'; +% $otaker = 'job queue' if $otaker eq 'fs_queue'; + <% $otaker %> + +% my $d = time2str('%b %o, %Y', $item->history_date ); +% $d =~ s/ / /g; + <% $d %> + +% my $t = time2str('%r', $item->history_date ); +% $t =~ s/ / /g; + <% $t %> + +% my $label = $h_tables{$item->table}; +% $label = &{ $h_table_labelsub{$item->table} }( $item, $label ) +% if $h_table_labelsub{$item->table}; + <% $label %> + + <% $action{$item->history_action} %> + + <% join(', ', + map { my $value = ( $_ =~ /(^pay(info|cvv)|^ss|_password)$/ ) + ? 'N/A' + : $item->get($_); + $value = substr($value, 0, 77).'...' if length($value) > 80; + $value = encode_entities($value); + "$_:$value"; + } + grep { $history_other + ? ( $item->get($_) ne $history_other->get($_) ) + : ( $item->get($_) =~ /\S/ ) + } + grep { ! /^(history|custnum$)/i } + $item->fields + ) + %> +
+<%once> + +# length-switching + +tie my %years, 'Tie::IxHash', + .5 => '6 months', + 1 => '1 year', + 2 => '2 years', + 5 => '5 years', + 39 => 'all history', +; + +# labeling history rows + +my %action = ( + 'insert' => 'Insert', #'Create', + 'replace_old' => 'Change from', + 'replace_new' => 'Change to', + 'delete' => 'Remove', +); + +# finding the other replace row + +my %replace_other = ( + 'replace_new' => 'replace_old', + 'replace_old' => 'replace_new', +); +my %replace_dir = ( + 'replace_new' => '<', + 'replace_old' => '>', +); +my %replace_direq = ( + 'replace_new' => '<=', + 'replace_old' => '>=', +); +my %replace_op = ( + 'replace_new' => '-', + 'replace_old' => '+', +); +my %replace_ord = ( + 'replace_new' => 'DESC', + 'replace_old' => 'ASC', +); + +my $fuzz = 5; #seems like a lot + +# which tables to search and what to call them + +tie my %tables, 'Tie::IxHash', + 'cust_main' => 'Customer', + 'cust_main_invoice' => 'Invoice destination', + 'cust_pkg' => 'Package', + #? or just svc_* ? 'cust_svc' => + 'svc_acct' => 'Account', + 'radius_usergroup' => 'RADIUS group', + 'svc_domain' => 'Domain', + 'svc_www' => 'Hosting', + 'svc_forward' => 'Mail forward', + 'svc_broadband' => 'Broadband', + 'svc_external' => 'External service', + 'svc_phone' => 'Phone', + 'phone_device' => 'Phone device', + #? it gets provisioned anyway 'phone_avail' => 'Phone', +; + +my $svc_join = 'JOIN cust_svc USING ( svcnum ) JOIN cust_pkg USING ( pkgnum )'; + +my %table_join = ( + 'svc_acct' => $svc_join, + 'radius_usergroup' => $svc_join, + 'svc_domain' => $svc_join, + 'svc_www' => $svc_join, + 'svc_forward' => $svc_join, + 'svc_broadband' => $svc_join, + 'svc_external' => $svc_join, + 'svc_phone' => $svc_join, + 'phone_device' => $svc_join, +); + +my %h_tables = map { ( "h_$_" => $tables{$_} ) } keys %tables; + +my %pkgpart = (); +my $pkg_labelsub = sub { + my($item, $label) = @_; + $pkgpart{$item->pkgpart} ||= $item->part_pkg->pkg; + $label. ': '. encode_entities($pkgpart{$item->pkgpart}). ''; +}; + +my $svc_labelsub = sub { + my($item, $label) = @_; + $label. ': '. encode_entities($item->label). ''; +}; + +my %h_table_labelsub = ( + 'h_cust_pkg' => $pkg_labelsub, + 'h_svc_acct' => $svc_labelsub, + #'h_radius_usergroup' => + 'h_svc_domain' => $svc_labelsub, + 'h_svc_www' => $svc_labelsub, + 'h_svc_forward' => $svc_labelsub, + 'h_svc_broadband' => $svc_labelsub, + 'h_svc_external' => $svc_labelsub, + 'h_svc_phone' => $svc_labelsub, + #'h_phone_device' +); + +# cust_main +# cust_main_invoice + +# cust_pkg +# cust_pkg_option? +# cust_pkg_detail +# cust_pkg_reason? no + +#cust_svc +#cust_svc_option? +#svc_* +# svc_acct +# radius_usergroup +# acct_snarf? is this even used? +# svc_domain +# domain_record +# registrar +# svc_forward +# svc_www +# svc_broadband +# (virtual fields? eh... maybe when they're real) +# svc_external +# svc_phone +# phone_device +# phone_avail + +# future: + +# inventory_item (from services) +# pkg_referral? (changed?) + +#random others: + +# cust_location? +# cust_main-exemption?? (295.ca named tax exemptions) + + +<%init> + +my( $cust_main ) = @_; + +my $conf = new FS::Conf; + +my $curuser = $FS::CurrentUser::CurrentUser; + +die "access deined" + unless $curuser->access_right('View customer history'); + +# find out the beginning of this customer history, if possible +my $h_insert = qsearchs({ + 'table' => 'h_cust_main', + 'hashref' => { 'custnum' => $cust_main->custnum, + 'history_action' => 'insert', + }, + 'extra_sql' => 'ORDER BY historynum LIMIT 1', +}); +my $start = $h_insert ? $h_insert->history_date : 0; + +# retreive the history + +my @history = (); + +my $years = $conf->config('change_history-years') || .5; +if ( $cgi->param('change_history-years') =~ /^([\d\.]+)$/ ) { + $years = $1; +} +my $newer_than = int( time - $years * 31556736 ); #60*60*24*365.24 + +local($FS::Record::nowarn_classload) = 1; + +foreach my $table ( keys %tables ) { + my @items = qsearch({ + 'table' => "h_$table", + 'addl_from' => $table_join{$table}, + 'hashref' => { 'history_date' => { op=>'>=', value=>$newer_than }, }, + 'extra_sql' => ' AND custnum = '. $cust_main->custnum, + }); + push @history, @items; + +} + + -- cgit v1.2.1 From 50f5d60aef5ee82be33c978db6424372bfd7995b Mon Sep 17 00:00:00 2001 From: jeff Date: Tue, 28 Jul 2009 22:21:40 +0000 Subject: feature to email CSV of CDRs with invoices #5727 --- httemplate/edit/cust_main/billing.html | 7 +++++++ httemplate/view/cust_main/billing.html | 7 +++++++ 2 files changed, 14 insertions(+) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html index 3f3d80176..363dd0419 100644 --- a/httemplate/edit/cust_main/billing.html +++ b/httemplate/edit/cust_main/billing.html @@ -438,6 +438,13 @@ % } +% if ( $conf->exists('voip-cust_email_csv_cdr') ) { + + email_csv_cdr eq "Y" ? 'CHECKED' : '' %>> Attach CDRs as CSV to emailed invoices + +% } else { + +% } % if ( $show_term || $cust_main->cdr_termination_percentage ) { diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html index 049461dbd..c8d0c47cd 100644 --- a/httemplate/view/cust_main/billing.html +++ b/httemplate/view/cust_main/billing.html @@ -216,6 +216,13 @@ Billing information % } +% if ( $conf->exists('voip-cust_email_csv_cdr') ) { + + Email CDRs as CSV + <% $cust_main->email_csv_cdr ? 'yes' : 'no' %> + +% } + % if ( $show_term || $cust_main->cdr_termination_percentage ) { CDR termination settlement -- cgit v1.2.1 From 4396080ed2829ae0595f1fd777f39d090c9bcd7c Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 30 Jul 2009 06:42:33 +0000 Subject: experimental package balances, RT#4339 --- httemplate/edit/cust_credit.cgi | 13 +++++++ httemplate/edit/cust_pay.cgi | 14 ++++++- httemplate/edit/process/cust_pay.cgi | 4 +- httemplate/elements/select-cust_pkg-balances.html | 30 +++++++++++++++ .../elements/tr-select-cust_pkg-balances.html | 31 ++++++++++++++++ httemplate/view/cust_bill.cgi | 1 + httemplate/view/cust_main/packages.html | 3 ++ httemplate/view/cust_main/packages/status.html | 43 +++++++++++++++------- httemplate/view/cust_main/payment_history.html | 13 ++++--- .../view/cust_main/payment_history/credit.html | 14 +++++-- .../view/cust_main/payment_history/payment.html | 14 +++++-- .../cust_main/payment_history/voided_payment.html | 5 +++ httemplate/view/cust_pay.html | 9 +++++ 13 files changed, 165 insertions(+), 29 deletions(-) create mode 100644 httemplate/elements/select-cust_pkg-balances.html create mode 100644 httemplate/elements/tr-select-cust_pkg-balances.html (limited to 'httemplate') diff --git a/httemplate/edit/cust_credit.cgi b/httemplate/edit/cust_credit.cgi index c9ca31ff3..c6b2bcbea 100755 --- a/httemplate/edit/cust_credit.cgi +++ b/httemplate/edit/cust_credit.cgi @@ -40,6 +40,16 @@ Credit +% if ( $conf->exists('pkg-balances') ) { + <% include('/elements/tr-select-cust_pkg-balances.html', + 'custnum' => $custnum, + 'cgi' => $cgi + ) + %> +% } else { + +% } +
@@ -65,4 +75,7 @@ my $_date = time; my $otaker = getotaker; my $p1 = popurl(1); +my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) + or die "unknown custnum $custnum\n"; + diff --git a/httemplate/edit/cust_pay.cgi b/httemplate/edit/cust_pay.cgi index 3c2877498..4dff06d88 100755 --- a/httemplate/edit/cust_pay.cgi +++ b/httemplate/edit/cust_pay.cgi @@ -72,6 +72,16 @@ Payment % } +% if ( $conf->exists('pkg-balances') ) { + <% include('/elements/tr-select-cust_pkg-balances.html', + 'custnum' => $custnum, + 'cgi' => $cgi + ) + %> +% } else { + +% } +
@@ -95,7 +105,7 @@ my $money_char = $conf->config('money_char') || '$'; die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Post payment'); -my($link, $linknum, $paid, $payby, $payinfo, $_date); +my($link, $linknum, $paid, $payby, $payinfo, $_date, $pkgnum); if ( $cgi->param('error') ) { $link = $cgi->param('link'); $linknum = $cgi->param('linknum'); @@ -131,7 +141,7 @@ if ( $link eq 'invnum' ) { my $cust_bill = qsearchs('cust_bill', { 'invnum' => $linknum } ) or die "unknown invnum $linknum"; $custnum = $cust_bill->custnum; -} elsif ( $link eq 'custnum' ) { +} elsif ( $link eq 'custnum' || $link eq 'popup' ) { $custnum = $linknum; } diff --git a/httemplate/edit/process/cust_pay.cgi b/httemplate/edit/process/cust_pay.cgi index 647f6fc6c..f8ac8b183 100755 --- a/httemplate/edit/process/cust_pay.cgi +++ b/httemplate/edit/process/cust_pay.cgi @@ -46,7 +46,9 @@ my $new = new FS::cust_pay ( { _date => $_date, map { $_, scalar($cgi->param($_)); - } qw(paid payby payinfo paybatch) + } qw( paid payby payinfo paybatch + pkgnum + ) #} fields('cust_pay') } ); diff --git a/httemplate/elements/select-cust_pkg-balances.html b/httemplate/elements/select-cust_pkg-balances.html new file mode 100644 index 000000000..d41bd033e --- /dev/null +++ b/httemplate/elements/select-cust_pkg-balances.html @@ -0,0 +1,30 @@ + +<%init> + +my %opt = @_; + +my @cust_pkg; +if ( $opt{'cust_pkg'} ) { + + @cust_pkg = @{ $opt{'cust_pkg'} }; + +} else { + + my $custnum = $opt{'custnum'}; + + my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) + or die "unknown custnum $custnum\n"; + + @cust_pkg = + grep { ! $_->get('cancel') || $cust_main->balance_pkgnum($_->pkgnum) } + $cust_main->all_pkgs; + +} + + diff --git a/httemplate/elements/tr-select-cust_pkg-balances.html b/httemplate/elements/tr-select-cust_pkg-balances.html new file mode 100644 index 000000000..89dc5d415 --- /dev/null +++ b/httemplate/elements/tr-select-cust_pkg-balances.html @@ -0,0 +1,31 @@ +% if ( scalar(@cust_pkg) == 0 ) { + +% } elsif ( scalar(@cust_pkg) == 1 ) { + +% } else { + + For package + + <% include('select-cust_pkg-balances.html', + 'cust_pkg' => \@cust_pkg, + 'cgi' => $opt{'cgi'}, + ) + %> + + + +% } + +<%init> +my %opt = @_; + +my $custnum = $opt{'custnum'}; + +my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) + or die "unknown custnum $custnum\n"; + +my @cust_pkg = + grep { ! $_->get('cancel') || $cust_main->balance_pkgnum($_->pkgnum) } + $cust_main->all_pkgs; + + diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi index 450c74e61..2673e8239 100755 --- a/httemplate/view/cust_bill.cgi +++ b/httemplate/view/cust_bill.cgi @@ -6,6 +6,7 @@ % if ( $cust_bill->owed > 0 % && scalar( grep $payby{$_}, qw(BILL CASH WEST MCRD) ) % && $FS::CurrentUser::CurrentUser->access_right('Post payment') +% && ! $conf->exists('pkg-balances') % ) % { % my $s = 0; diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 428794b7d..8fbefae50 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -138,6 +138,9 @@ my %conf_opt = ( #for status.html 'cust_pkg-show_autosuspend' => $conf->exists('cust_pkg-show_autosuspend'), + #for status.html pkg-balances + 'pkg-balances' => $conf->exists('pkg-balances'), + 'money_char' => ( $conf->config('money_char') || '$' ), #for location.html 'countrydefault' => $countrydefault, diff --git a/httemplate/view/cust_main/packages/status.html b/httemplate/view/cust_main/packages/status.html index 6daff5031..f3b2faaf4 100644 --- a/httemplate/view/cust_main/packages/status.html +++ b/httemplate/view/cust_main/packages/status.html @@ -8,15 +8,16 @@ <% pkg_status_row($cust_pkg, 'Cancelled', 'cancel', 'color'=>'FF0000', %opt ) %> - <% pkg_status_row_colspan( + <% pkg_status_row_colspan( $cust_pkg, ( $cpr ? $cpr->reasontext. ' by '. $cpr->otaker : '' ), '', 'align'=>'right', 'color'=>'ff0000', 'size'=>'-2', 'colspan'=>$colspan, + %opt ) %> % unless ( $cust_pkg->get('setup') ) { - <% pkg_status_row_colspan('Never billed', '', 'colspan'=>$colspan, ) %> + <% pkg_status_row_colspan( $cust_pkg, 'Never billed', '', 'colspan'=>$colspan, %opt, ) %> % } else { @@ -34,14 +35,15 @@ <% pkg_status_row( $cust_pkg, 'Suspended', 'susp', 'color'=>'FF9900', %opt ) %> - <% pkg_status_row_colspan( + <% pkg_status_row_colspan( $cust_pkg, ( $cpr ? $cpr->reasontext. ' by '. $cpr->otaker : '' ), '', 'align'=>'right', 'color'=>'FF9900', 'size'=>'-2', 'colspan'=>$colspan, + %opt, ) %> % unless ( $cust_pkg->get('setup') ) { - <% pkg_status_row_colspan('Never billed', '', 'colspan'=>$colspan ) %> + <% pkg_status_row_colspan( $cust_pkg, 'Never billed', '', 'colspan'=>$colspan, %opt ) %> % } else { <% pkg_status_row($cust_pkg, 'Setup', 'setup', %opt ) %> % } @@ -70,7 +72,7 @@ % % unless ( $part_pkg->freq ) { - <% pkg_status_row_colspan('Not yet billed (one-time charge)', '', 'colspan'=>$colspan, ) %> + <% pkg_status_row_colspan( $cust_pkg, 'Not yet billed (one-time charge)', '', 'colspan'=>$colspan, %opt ) %> <% pkg_status_row_if($cust_pkg, 'Start billing', 'start_date', %opt) %> @@ -86,7 +88,7 @@ % } else { - <% pkg_status_row_colspan("Not yet billed ($billed_or_prepaid ". myfreq($part_pkg). ')', '', 'colspan'=>$colspan ) %> + <% pkg_status_row_colspan($cust_pkg, "Not yet billed ($billed_or_prepaid ". myfreq($part_pkg). ')', '', 'colspan'=>$colspan, %opt ) %> <% pkg_status_row_if($cust_pkg, 'Start billing', 'start_date', %opt) %> @@ -96,7 +98,7 @@ % % unless ( $part_pkg->freq ) { - <% pkg_status_row_colspan('One-time charge', '', 'colspan'=>$colspan, ) %> + <% pkg_status_row_colspan($cust_pkg, 'One-time charge', '', 'colspan'=>$colspan, %opt ) %> <% pkg_status_row($cust_pkg, 'Billed', 'setup', %opt) %> @@ -104,18 +106,20 @@ % % if (scalar($cust_pkg->overlimit)) { - <% pkg_status_row_colspan( + <% pkg_status_row_colspan( $cust_pkg, 'Overlimit', $billed_or_prepaid. ' '. myfreq($part_pkg), 'color'=>'FFD000', 'colspan'=>$colspan, + %opt ) %> % } else { - <% pkg_status_row_colspan( + <% pkg_status_row_colspan( $cust_pkg, 'Active', $billed_or_prepaid. ' '. myfreq($part_pkg), 'color'=>'00CC00', 'colspan'=>$colspan, + %opt ) %> % } @@ -169,7 +173,6 @@ - <%init> my %opt = @_; @@ -218,8 +221,15 @@ sub pkg_status_row { $html .= qq() if length($color); $html .= qq($title ); $html .= qq() if length($color); + + if ( $opt{'pkg_balances'} && ! $cust_pkg->{_printed_balance}++ ) { #kludge + $html .= ' (Balance: '. $opt{'money_char'}. + $cust_pkg->cust_main->balance_pkgnum($cust_pkg->pkgnum). + ')'; + } + $html .= qq(); - $html .= pkg_datestr($cust_pkg, $field, %opt).''; + $html .= pkg_datestr($cust_pkg, $field, %opt). ''; $html; } @@ -253,7 +263,7 @@ sub pkg_status_row_changed { my $part_pkg = $old->part_pkg; my $label = 'Changed from '. $cust_pkg->change_pkgnum. ': '. $part_pkg->pkg_comment(nopartpkg => 1); - $html .= pkg_status_row_colspan( $label, '', + $html .= pkg_status_row_colspan( $cust_pkg, $label, '', 'size' => '-1', 'align' => 'right', 'colspan' => $opt{'colspan'}, @@ -264,7 +274,7 @@ sub pkg_status_row_changed { } sub pkg_status_row_colspan { - my($title, $addl, %opt) = @_; + my($cust_pkg, $title, $addl, %opt) = @_; my $colspan = $opt{'colspan'}; @@ -279,6 +289,13 @@ sub pkg_status_row_colspan { $html .= qq() if $color && !$size; $html .= qq(
) if length($color) || $size; $html .= ", $addl" if length($addl); + + if ( $opt{'pkg-balances'} && ! $cust_pkg->{_printed_balance}++ ) { #kludge + $html .= ' (Balance: '. $opt{'money_char'}. + $cust_pkg->cust_main->balance_pkgnum($cust_pkg->pkgnum). + ')'; + } + $html .= qq(); $html; diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index 1711e1449..8adc95426 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -374,13 +374,16 @@ my %status = ( #get payment history my @history = (); -my %opt = +my %opt = ( ( map { $_ => scalar($conf->config($_)) } qw( card_refund-days ) ), ( map { $_ => $conf->exists($_) } - qw( deletepayments deleterefunds ) - ); + qw( deletepayments deleterefunds pkg-balances ) + ) +); + +warn Dumper(\%opt); #invoices foreach my $cust_bill ($cust_main->cust_bill) { @@ -405,7 +408,7 @@ foreach my $cust_pay ($cust_main->cust_pay) { foreach my $cust_pay_void ($cust_main->cust_pay_void) { push @history, { 'date' => $cust_pay_void->_date, - 'desc' => include('payment_history/voided_payment.html', $cust_pay_void), + 'desc' => include('payment_history/voided_payment.html', $cust_pay_void, %opt ), 'void_payment' => $cust_pay_void->paid, }; @@ -415,7 +418,7 @@ foreach my $cust_pay_void ($cust_main->cust_pay_void) { foreach my $cust_credit ($cust_main->cust_credit) { push @history, { 'date' => $cust_credit->_date, - 'desc' => include('payment_history/credit.html', $cust_credit), + 'desc' => include('payment_history/credit.html', $cust_credit, %opt ), 'credit' => $cust_credit->amount, }; diff --git a/httemplate/view/cust_main/payment_history/credit.html b/httemplate/view/cust_main/payment_history/credit.html index 2deb27564..058c6f536 100644 --- a/httemplate/view/cust_main/payment_history/credit.html +++ b/httemplate/view/cust_main/payment_history/credit.html @@ -9,7 +9,13 @@ my $curuser = $FS::CurrentUser::CurrentUser; my @cust_credit_bill = $cust_credit->cust_credit_bill; my @cust_credit_refund = $cust_credit->cust_credit_refund; -my( $pre, $post, $desc, $apply, $ext ) = ( '', '', '', '', '' ); +my $desc = ''; +if ( $opt{'pkg-balances'} && $cust_credit->pkgnum ) { + my $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $cust_credit->pkgnum } ); + $desc .= ' for '. $cust_pkg->pkg_label_long; +} + +my( $pre, $post, $apply, $ext ) = ( '', '', '', '' ); if ( scalar(@cust_credit_bill) == 0 && scalar(@cust_credit_refund) == 0 ) { #completely unapplied @@ -45,15 +51,15 @@ if ( scalar(@cust_credit_bill) == 0 && scalar(@cust_credit_refund) == 0 && $cust_credit->credited == 0 ) { #applied to one invoice, the usual situation - $desc = ' '. $cust_credit_bill[0]->applied_to_invoice; + $desc .= ' '. $cust_credit_bill[0]->applied_to_invoice; } elsif ( scalar(@cust_credit_bill) == 0 && scalar(@cust_credit_refund) == 1 && $cust_credit->credited == 0 ) { #applied to one refund - $desc = ' refunded on '. time2str("%D", $cust_credit_refund[0]->_date); + $desc .= ' refunded on '. time2str("%D", $cust_credit_refund[0]->_date); } else { #complicated - $desc = '
'; + $desc .= '
'; foreach my $app ( sort { $a->_date <=> $b->_date } ( @cust_credit_bill, @cust_credit_refund ) ) { if ( $app->isa('FS::cust_credit_bill') ) { diff --git a/httemplate/view/cust_main/payment_history/payment.html b/httemplate/view/cust_main/payment_history/payment.html index 2e24b1785..a4a349bb8 100644 --- a/httemplate/view/cust_main/payment_history/payment.html +++ b/httemplate/view/cust_main/payment_history/payment.html @@ -32,7 +32,13 @@ $payby =~ s/^MCRD$/Manual credit card/; $payby =~ s/^BILL$//; my $info = $payby ? "($payby$payinfo)" : ''; -my( $pre, $post, $desc, $apply, $ext ) = ( '', '', '', '', '' ); +my $desc = ''; +if ( $opt{'pkg-balances'} && $cust_pay->pkgnum ) { + my $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $cust_pay->pkgnum } ); + $desc .= ' for '. $cust_pkg->pkg_label_long; +} + +my( $pre, $post, $apply, $ext ) = ( '', '', '', '' ); if ( scalar(@cust_bill_pay) == 0 && scalar(@cust_pay_refund) == 0 ) { #completely unapplied @@ -68,15 +74,15 @@ if ( scalar(@cust_bill_pay) == 0 && scalar(@cust_pay_refund) == 0 && $cust_pay->unapplied == 0 ) { #applied to one invoice, the usual situation - $desc = ' '. $cust_bill_pay[0]->applied_to_invoice; + $desc .= ' '. $cust_bill_pay[0]->applied_to_invoice; } elsif ( scalar(@cust_bill_pay) == 0 && scalar(@cust_pay_refund) == 1 && $cust_pay->unapplied == 0 ) { #applied to one refund - $desc = ' refunded on '. time2str("%D", $cust_pay_refund[0]->_date); + $desc .= ' refunded on '. time2str("%D", $cust_pay_refund[0]->_date); } else { #complicated - $desc = '
'; + $desc .= '
'; foreach my $app ( sort { $a->_date <=> $b->_date } ( @cust_bill_pay, @cust_pay_refund ) ) { if ( $app->isa('FS::cust_bill_pay') ) { diff --git a/httemplate/view/cust_main/payment_history/voided_payment.html b/httemplate/view/cust_main/payment_history/voided_payment.html index 9cbc47b66..08469dbe9 100644 --- a/httemplate/view/cust_main/payment_history/voided_payment.html +++ b/httemplate/view/cust_main/payment_history/voided_payment.html @@ -18,6 +18,11 @@ $payby =~ s/^BILL$//; $payby =~ s/^(CARD|COMP)$/$1 /; my $info = $payby ? " ($payby$payinfo)" : ''; +if ( $opt{'pkg-balances'} && $cust_pay_void->pkgnum ) { + my $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $cust_pay_void->pkgnum } ); + $info .= ' for '. $cust_pkg->pkg_label_long; +} + my $unvoid = ''; if ( $cust_pay_void->closed !~ /^Y/i && $curuser->access_right('Unvoid') diff --git a/httemplate/view/cust_pay.html b/httemplate/view/cust_pay.html index a5c99ac55..2f23d9e14 100644 --- a/httemplate/view/cust_pay.html +++ b/httemplate/view/cust_pay.html @@ -93,6 +93,15 @@ % } +% if ( $conf->exists('pkg-balances') && $cust_pay->pkgnum ) { +% my $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $cust_pay->pkgnum } ); + + For package + <% $cust_pkg->pkg_label_long %> + + +% } + % if ( $link eq 'print' ) { -- cgit v1.2.1 From 111fd2db1424182903285e92a957f6f036cb58ce Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 30 Jul 2009 06:48:07 +0000 Subject: fix for stickiness on errors --- httemplate/elements/select-cust_pkg-balances.html | 2 ++ 1 file changed, 2 insertions(+) (limited to 'httemplate') diff --git a/httemplate/elements/select-cust_pkg-balances.html b/httemplate/elements/select-cust_pkg-balances.html index d41bd033e..cd2e1a850 100644 --- a/httemplate/elements/select-cust_pkg-balances.html +++ b/httemplate/elements/select-cust_pkg-balances.html @@ -9,6 +9,8 @@ my %opt = @_; +my $cgi = $opt{'cgi'}; + my @cust_pkg; if ( $opt{'cust_pkg'} ) { -- cgit v1.2.1 From 3bd6725beea327a3ce72cfd13bf79fac87e36665 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 30 Jul 2009 06:49:17 +0000 Subject: don't need to lookup cust_main here --- httemplate/edit/cust_credit.cgi | 3 --- 1 file changed, 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_credit.cgi b/httemplate/edit/cust_credit.cgi index c6b2bcbea..5785a05c0 100755 --- a/httemplate/edit/cust_credit.cgi +++ b/httemplate/edit/cust_credit.cgi @@ -75,7 +75,4 @@ my $_date = time; my $otaker = getotaker; my $p1 = popurl(1); -my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) - or die "unknown custnum $custnum\n"; - -- cgit v1.2.1 From f43362b2ee2e56b238fcae935a31b552b51506ba Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 30 Jul 2009 06:50:29 +0000 Subject: another accidentally (alliterated) vestigial variable --- httemplate/edit/cust_pay.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_pay.cgi b/httemplate/edit/cust_pay.cgi index 4dff06d88..07e51989e 100755 --- a/httemplate/edit/cust_pay.cgi +++ b/httemplate/edit/cust_pay.cgi @@ -105,7 +105,7 @@ my $money_char = $conf->config('money_char') || '$'; die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Post payment'); -my($link, $linknum, $paid, $payby, $payinfo, $_date, $pkgnum); +my($link, $linknum, $paid, $payby, $payinfo, $_date); if ( $cgi->param('error') ) { $link = $cgi->param('link'); $linknum = $cgi->param('linknum'); -- cgit v1.2.1 From da635762c054395a44145362f1ddd2ccdbb87416 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 30 Jul 2009 06:52:16 +0000 Subject: didn't mean to leave a Dump(er) there --- httemplate/view/cust_main/payment_history.html | 2 -- 1 file changed, 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index 8adc95426..24af5c9a5 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -383,8 +383,6 @@ my %opt = ( ) ); -warn Dumper(\%opt); - #invoices foreach my $cust_bill ($cust_main->cust_bill) { push @history, { -- cgit v1.2.1 From 32e1fac180b972b037d36f4496566eaf7c6079c6 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 30 Jul 2009 07:39:17 +0000 Subject: small fix to change history to not error out with svc_acct services, RT#1005 --- httemplate/view/cust_main/change_history.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main/change_history.html b/httemplate/view/cust_main/change_history.html index 1700bc34b..53a79f47f 100644 --- a/httemplate/view/cust_main/change_history.html +++ b/httemplate/view/cust_main/change_history.html @@ -202,7 +202,7 @@ my $pkg_labelsub = sub { my $svc_labelsub = sub { my($item, $label) = @_; - $label. ': '. encode_entities($item->label). ''; + $label. ': '. encode_entities($item->label($item->history_date)). ''; }; my %h_table_labelsub = ( -- cgit v1.2.1 From 6e80cdbaa7fc1f5a8247d19aceeb652844352207 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 3 Aug 2009 19:54:00 +0000 Subject: looks slightly better in default IE hopefully --- httemplate/elements/header.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'httemplate') diff --git a/httemplate/elements/header.html b/httemplate/elements/header.html index 8adfabc93..54383bc27 100644 --- a/httemplate/elements/header.html +++ b/httemplate/elements/header.html @@ -174,7 +174,7 @@ input.fstext { % if ( $curuser->access_right('List customers') ) { -
+
Advanced @@ -201,7 +201,7 @@ input.fstext { Adv % }
- + % } @@ -209,7 +209,7 @@ input.fstext { % if ( $curuser->access_right('View customer services') ) {
-
+
Advanced
@@ -219,7 +219,7 @@ input.fstext { % if ( $conf->config("ticket_system") ) {
-
+
Advanced
-- cgit v1.2.1 From 958afb8d05de67e12df258b57bedcf85028b6253 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 7 Aug 2009 00:39:14 +0000 Subject: don't start recurring billing when a start date hasn't been reached yet either... and since that works, add the start date to new package order, RT#5347 --- httemplate/edit/process/quick-cust_pkg.cgi | 4 +++ httemplate/elements/tr-input-date-field.html | 15 ++++++----- httemplate/misc/order_pkg.html | 37 ++++++++++++++++++++++++++++ httemplate/view/cust_main/packages.html | 1 + 4 files changed, 51 insertions(+), 6 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/process/quick-cust_pkg.cgi b/httemplate/edit/process/quick-cust_pkg.cgi index 57c696e7e..7a0f08280 100644 --- a/httemplate/edit/process/quick-cust_pkg.cgi +++ b/httemplate/edit/process/quick-cust_pkg.cgi @@ -49,6 +49,10 @@ my $locationnum = $1; my $cust_pkg = new FS::cust_pkg { 'custnum' => $custnum, 'pkgpart' => $pkgpart, + 'start_date' => ( scalar($cgi->param('start_date')) + ? str2time($cgi->param('start_date')) + : '' + ), 'refnum' => $refnum, 'locationnum' => $locationnum, }; diff --git a/httemplate/elements/tr-input-date-field.html b/httemplate/elements/tr-input-date-field.html index 11581d5bc..428221a5c 100644 --- a/httemplate/elements/tr-input-date-field.html +++ b/httemplate/elements/tr-input-date-field.html @@ -28,12 +28,15 @@ my($name, $value, $label, $format, $usedatetime) = @_; $format = "%m/%d/%Y" unless $format; $label = $name unless $label; -if ($usedatetime) { - my $dt = DateTime->from_epoch(epoch => $value, time_zone => 'floating'); - $value = $dt->strftime($format) - unless $value eq ''; -}else{ - $value = time2str($format, $value); +if ( $value =~ /\S/ ) { + if ( $usedatetime ) { + my $dt = DateTime->from_epoch(epoch => $value, time_zone => 'floating'); + $value = $dt->strftime($format); + } else { + $value = time2str($format, $value); + } +} else { + $value = ''; } diff --git a/httemplate/misc/order_pkg.html b/httemplate/misc/order_pkg.html index 9caa57a69..a7571ca58 100644 --- a/httemplate/misc/order_pkg.html +++ b/httemplate/misc/order_pkg.html @@ -1,5 +1,10 @@ <% include('/elements/header-popup.html', 'Order new package' ) %> + + + + + + % if ( $conf->exists('pkg_referral') ) { <% include('/elements/tr-select-part_referral.html', 'curr_value' => scalar( $cgi->param('refnum') ), #get rid of empty_label first# || $cust_main->refnum, @@ -68,4 +101,8 @@ my $cust_main = qsearchs({ my $pkgpart = scalar($cgi->param('pkgpart')); +my $format = "%m/%d/%Y %T %z (%Z)"; #false laziness w/REAL_cust_pkg.cgi? +my $start_date = $cust_main->next_bill_date; +$start_date = $start_date ? time2str($format, $start_date) : ''; + diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 8fbefae50..16adc8c5f 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -9,6 +9,7 @@ 'cust_main' => $cust_main, 'closetext' => 'Close', 'width' => 763, + 'height' => 350, ) %> % } -- cgit v1.2.1 From c183de0b7e942672cafdc1c14a203e389ffd2c43 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 7 Aug 2009 23:08:03 +0000 Subject: add ability to edit signup dates (turn on cust_main-edit_signupdate config), RT#4644 --- httemplate/edit/cust_main.cgi | 3 +- httemplate/edit/cust_main/top_misc.html | 10 ++++++ httemplate/edit/process/cust_main.cgi | 47 ++++++++++++++++++++-------- httemplate/elements/tr-input-date-field.html | 14 +++++++-- 4 files changed, 58 insertions(+), 16 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 8b1d2b59c..15c9f45b2 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -56,7 +56,7 @@ % } % } -

+
Billing address <% include('cust_main/contact.html', @@ -182,6 +182,7 @@ function samechanged(what) { +%# cust_main/bottomfixup.js % foreach my $hidden ( % 'payauto', % 'payinfo', 'payinfo1', 'payinfo2', 'paytype', diff --git a/httemplate/edit/cust_main/top_misc.html b/httemplate/edit/cust_main/top_misc.html index 5aaa0b0cc..041050664 100644 --- a/httemplate/edit/cust_main/top_misc.html +++ b/httemplate/edit/cust_main/top_misc.html @@ -71,6 +71,16 @@ % } +%# signup date +% if ( $conf->exists('cust_main-edit_signupdate') ) { + <% include('/elements/tr-input-date-field.html', { + 'name' => 'signupdate', + 'value' => $cust_main->signupdate, + 'label' => 'Signup date', + 'format' => $conf->config('date_format') || "%m/%d/%Y", + }) + %> +% } diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index 1709752fb..f72ca0a81 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -73,20 +73,41 @@ if ( defined($cgi->param('same')) && $cgi->param('same') eq "Y" ) { ); } -if ( $cgi->param('birthdate') && $cgi->param('birthdate') =~ /^([ 0-9\-\/]{0,10})$/) { - my $format = $conf->config('date_format') || "%m/%d/%Y"; - my $parser = DateTime::Format::Strptime->new(pattern => $format, - time_zone => 'floating', - ); - my $dt = $parser->parse_datetime($1); - if ($dt) { - $new->setfield('birthdate', $dt->epoch); - $cgi->param('birthdate', $dt->epoch); - } else { -# $error ||= $cgi->param('birthdate') . " is an invalid birthdate:" . $parser->errmsg; - $error ||= "Invalid birthdate: " . $cgi->param('birthdate') . "."; - $cgi->param('birthdate', ''); +my %usedatetime = ( 'birthdate' => 1 ); + +foreach my $dfield (qw( birthdate signupdate )) { + + if ( $cgi->param($dfield) && $cgi->param($dfield) =~ /^([ 0-9\-\/]{0,10})$/) { + + my $value = $1; + my $parsed = ''; + + if ( exists $usedatetime{$dfield} && $usedatetime{$dfield} ) { + + my $format = $conf->config('date_format') || "%m/%d/%Y"; + my $parser = DateTime::Format::Strptime->new( pattern => $format, + time_zone => 'floating', + ); + my $dt = $parser->parse_datetime($value); + if ( $dt ) { + $parsed = $dt->epoch; + } else { + # $error ||= $cgi->param('birthdate') . " is an invalid birthdate:" . $parser->errmsg; + $error ||= "Invalid $dfield: $value"; + } + + } else { + + $parsed = str2time($value) + or $error ||= "Invalid $dfield: $value"; + + } + + $new->setfield( $dfield, $parsed ); + $cgi->param( $dfield, $parsed ); + } + } $new->setfield('paid', $cgi->param('paid') ) diff --git a/httemplate/elements/tr-input-date-field.html b/httemplate/elements/tr-input-date-field.html index 428221a5c..2a731e1e8 100644 --- a/httemplate/elements/tr-input-date-field.html +++ b/httemplate/elements/tr-input-date-field.html @@ -23,7 +23,17 @@ <%init> -my($name, $value, $label, $format, $usedatetime) = @_; +my($name, $value, $label, $format, $usedatetime); +if ( ref($_[0]) ) { + my $opt = shift; + $name = $opt->{'name'}; + $value = $opt->{'value'}; + $label = $opt->{'label'}; + $format = $opt->{'format'}; + $usedatetime = $opt->{'usedatetime'}; +} else { + ($name, $value, $label, $format, $usedatetime) = @_; +} $format = "%m/%d/%Y" unless $format; $label = $name unless $label; @@ -32,7 +42,7 @@ if ( $value =~ /\S/ ) { if ( $usedatetime ) { my $dt = DateTime->from_epoch(epoch => $value, time_zone => 'floating'); $value = $dt->strftime($format); - } else { + } elsif ( $value =~ /^\d+$/ ) { $value = time2str($format, $value); } } else { -- cgit v1.2.1 From 283ea2b5137ae3ec36882b492e6de024b0ce6027 Mon Sep 17 00:00:00 2001 From: mark Date: Sun, 9 Aug 2009 09:05:38 +0000 Subject: Add cust_attachment stuff --- httemplate/edit/cust_main_attach.cgi | 58 ++++++++++++ httemplate/edit/process/cust_main_attach.cgi | 88 ++++++++++++++++++ httemplate/view/attachment.html | 16 ++++ httemplate/view/cust_main.cgi | 28 ++++-- httemplate/view/cust_main/attachments.html | 133 +++++++++++++++++++++++++++ 5 files changed, 314 insertions(+), 9 deletions(-) create mode 100755 httemplate/edit/cust_main_attach.cgi create mode 100644 httemplate/edit/process/cust_main_attach.cgi create mode 100644 httemplate/view/attachment.html create mode 100755 httemplate/view/cust_main/attachments.html (limited to 'httemplate') diff --git a/httemplate/edit/cust_main_attach.cgi b/httemplate/edit/cust_main_attach.cgi new file mode 100755 index 000000000..7c9e407d9 --- /dev/null +++ b/httemplate/edit/cust_main_attach.cgi @@ -0,0 +1,58 @@ +<% include('/elements/header-popup.html', "$action File Attachment") %> + +<% include('/elements/error.html') %> + +
+ + + +

+ +% if(defined $attach) { +Filename
+MIME type +Size: <% $attach->size %>
+ +% } +% else { # !defined $attach + +Filename
+ +% } + +
+"> + +% if(defined $attach) { +
+ +% } + +
+ + + +<%init> + +my $attachnum = ''; +my $attach; +if ( $cgi->param('error') ) { + #$comment = $cgi->param('comment'); +} elsif ( $cgi->param('attachnum') =~ /^(\d+)$/ ) { + $attachnum = $1; + die "illegal query ". $cgi->keywords unless $attachnum; + $attach = qsearchs('cust_attachment', { 'attachnum' => $attachnum }); + die "no such attachment: ". $attachnum unless $attach; +} + +$cgi->param('custnum') =~ /^(\d+)$/ or die "illegal custnum"; +my $custnum = $1; + +my $action = $attachnum ? 'Edit' : 'Add'; + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right("$action customer note"); + + + diff --git a/httemplate/edit/process/cust_main_attach.cgi b/httemplate/edit/process/cust_main_attach.cgi new file mode 100644 index 000000000..51eead076 --- /dev/null +++ b/httemplate/edit/process/cust_main_attach.cgi @@ -0,0 +1,88 @@ +%if ($error) { +% $cgi->param('error', $error); +<% $cgi->redirect(popurl(2). 'cust_main_attach.cgi?'. $cgi->query_string ) %> +%} else { +% my $act = 'added'; +% $act = 'updated' if ($attachnum); +% $act = 'undeleted' if($attachnum and $undelete); +% $act = 'deleted' if($attachnum and $delete); +<% header('Attachment ' . $act ) %> + + +% } +<%init> + +my $error; +$cgi->param('custnum') =~ /^(\d+)$/ + or die "Illegal custnum: ". $cgi->param('custnum'); +my $custnum = $1; + +$cgi->param('attachnum') =~ /^(\d*)$/ + or die "Illegal attachnum: ". $cgi->param('attachnum'); +my $attachnum = $1; + +my $otaker = $FS::CurrentUser::CurrentUser->name; +$otaker = $FS::CurrentUser::CurrentUser->username + if ($otaker eq "User, Legacy"); + +my $delete = $cgi->param('delete'); +my $undelete = $cgi->param('undelete'); + +my $new = new FS::cust_attachment ( { + attachnum => $attachnum, + custnum => $custnum, + _date => time, + otaker => $otaker, + disabled => '', +}); +my $old; + +if($attachnum) { + $old = qsearchs('cust_attachment', { attachnum => $attachnum }); + if(!$old) { + $error = "Attachnum '$attachnum' not found"; + } + else { + map { $new->$_($old->$_) } + ('_date', 'otaker', 'body', 'disabled'); + $new->filename($cgi->param('filename') || $old->filename); + $new->mime_type($cgi->param('mime_type') || $old->mime_type); + if($delete and not $old->disabled) { + $new->disabled(time); + } + if($undelete and $old->disabled) { + $new->disabled(''); + } + } +} +else { # This is a new attachment, so require a file. + + my $filename = $cgi->param('file'); + if($filename) { + $new->filename($filename); + $new->mime_type($cgi->uploadInfo($filename)->{'Content-Type'}); + + local $/; + my $fh = $cgi->upload('file'); + $new->body(<$fh>); + } + else { + $error = 'No file uploaded'; + } +} +my $user = $FS::CurrentUser::CurrentUser; + +$error = 'access denied' unless $user->access_right(($old ? 'Edit' : 'Add') . ' attachment'); + +if(!$error) { + if($old) { + $error = $new->replace($old); + } + else { + $error = $new->insert; + } +} + + diff --git a/httemplate/view/attachment.html b/httemplate/view/attachment.html new file mode 100644 index 000000000..c85b1375f --- /dev/null +++ b/httemplate/view/attachment.html @@ -0,0 +1,16 @@ +<%init> +my ($query) = $cgi->keywords; +$query =~ /^(\d+)$/; +my $attachnum = $1 or die 'Invalid attachment number'; +$FS::CurrentUser::CurrentUser->access_right('Download attachment') or die 'access denied'; + +my $attach = qsearchs('cust_attachment', { attachnum => $attachnum }) or die 'Attachment not found: $attachnum'; + +$m->clear_buffer; +$r->content_type($attach->mime_type || 'text/plain'); +$r->headers_out->add('Content-Disposition' => 'attachment;filename=' . $attach->filename); + +binmode STDOUT; +print STDOUT $attach->body; + + diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 78bcb1fc1..da1a56a96 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -113,7 +113,6 @@ Comments % if ( ! $conf->exists('cust_main-disable_notes') || $notecount) { % unless ( $view eq 'notes' && $cust_main->comments !~ /[^\s\n\r]/ ) { -
Notes
% } @@ -138,6 +137,22 @@ Comments <% include('cust_main/notes.html', 'custnum' => $cust_main->custnum ) %> % } +
+ +% if(! $conf->config('disable_cust_attachment') +% and $curuser->access_right('Add attachment')) { +<% include( '/elements/popup_link-cust_main.html', + 'label' => 'Attach file', + 'action' => $p.'edit/cust_main_attach.cgi', + 'actionlabel' => 'Upload file', + 'cust_main' => $cust_main, + 'width' => 616, + 'height' => 408, + ) +%> +% } +<% include('cust_main/attachments.html', 'custnum' => $cust_main->custnum ) %> +
% } @@ -181,10 +196,6 @@ Comments % } -% if ( $view eq 'change_history' ) { # || $view eq 'jumbo' - <% include('cust_main/change_history.html', $cust_main ) %> -% } - <% include('/elements/footer.html') %> <%init> @@ -218,12 +229,11 @@ tie my %views, 'Tie::IxHash', 'Notes' => 'notes', #notes and files? ; $views{'Tickets'} = 'tickets' - if $conf->config('ticket_system'); + if $conf->config('ticket_system'); $views{'Packages'} = 'packages'; $views{'Payment History'} = 'payment_history' - unless $conf->config('payby-default' eq 'HIDE'); -$views{'Change History'} = 'change_history' - if $curuser->access_right('View customer history'); + unless $conf->config('payby-default' eq 'HIDE'); +#$views{'Change History'} = ''; $views{'Jumbo'} = 'jumbo'; my %viewname = reverse %views; diff --git a/httemplate/view/cust_main/attachments.html b/httemplate/view/cust_main/attachments.html new file mode 100755 index 000000000..e25814ff5 --- /dev/null +++ b/httemplate/view/cust_main/attachments.html @@ -0,0 +1,133 @@ +% if ( scalar(@attachments) ) { + + <% include('/elements/init_overlib.html') %> + + <% include("/elements/table-grid.html") %> + + + Date +% if ( $conf->exists('cust_main_note-display_times') ) { + Time +% } + Person + Filename + Type + Size + + + +% my $bgcolor1 = '#eeeeee'; +% my $bgcolor2 = '#ffffff'; +% my $bgcolor = ''; +% +% foreach my $attach ((grep { $_->disabled } @attachments), +% (grep { ! $_->disabled } @attachments)) { +% +% if ( $bgcolor eq $bgcolor1 ) { +% $bgcolor = $bgcolor2; +% } else { +% $bgcolor = $bgcolor1; +% } +% +% my $pop = popurl(3); +% my $attachnum = $attach->attachnum; +% my $edit = ''; +% my $download = ''; +% if($attach->disabled) { +% my $onclick = include('/elements/popup_link_onclick.html', +% 'action' => popurl(2). +% 'edit/process/cust_main_attach.cgi'. +% "?custnum=$custnum;". +% "attachnum=$attachnum;". +% "undelete=1", +% 'actionlabel' => 'Undelete attachment', +% 'width' => 616, +% 'height' => 408, +% 'frame' => 'top', +% ); +% my $clickjs = qq!onclick="$onclick"!; +% if($curuser->access_right('Edit attachment')) { +% $edit = qq! (undelete)!; +% } +% } +% else { +% my $onclick = include( '/elements/popup_link_onclick.html', +% 'action' => popurl(2). +% 'edit/cust_main_attach.cgi'. +% "?custnum=$custnum". +% ";attachnum=$attachnum", +% 'actionlabel' => 'Edit customer note', +% 'width' => 616, +% 'height' => 408, +% 'frame' => 'top', +% ); +% my $clickjs = qq!onclick="$onclick"!; +% +% if ($curuser->access_right('Edit attachment') ) { +% $edit = qq! (edit)!; +% } +% if ($curuser->access_right('Download attachment') ) { +% $download = qq! (download)!; +% } +% } + + + <% note_datestr($attach,$conf,$bgcolor) %> + +  <% $attach->otaker%> + + +  <% $attach->filename %> + + +  <% $attach->mime_type %> + + +  <% size_units( $attach->size ) %> + + +  <% $edit %> +  <% $download %> + + <% $attach->disabled ? '' : '' %> + + +% } #end display notes + + + +% } +<%init> + +my $conf = new FS::Conf; +my $curuser = $FS::CurrentUser::CurrentUser; + +my(%opt) = @_; + +my $custnum = $opt{'custnum'}; + +my $cust_main = qsearchs('cust_main', {'custnum' => $custnum} ); +die "Customer not found!" unless $cust_main; + +my (@attachments) = qsearch('cust_attachment', {'custnum' => $custnum}); + +#subroutines + +sub note_datestr { + my($note, $conf, $bgcolor) = @_ or return ''; + my $td = qq{}; + my $format = "$td%b %o, %Y"; + $format .= "$td%l:%M%P" + if $conf->exists('cust_main_note-display_times'); + ( my $strip = time2str($format, $note->_date) ) =~ s/ (\d)/$1/g; + $strip; +} + +sub size_units { + my $bytes = shift; + return $bytes if $bytes < 1024; + return int($bytes / 1024)."K" if $bytes < 1048576; + return int($bytes / 1048576)."M"; +} + + -- cgit v1.2.1 From ae898cc8e6de40fbecb30c973f91cd955434b159 Mon Sep 17 00:00:00 2001 From: mark Date: Mon, 10 Aug 2009 23:04:57 +0000 Subject: Improve handling of deleted attachments --- httemplate/edit/cust_main_attach.cgi | 5 +- httemplate/edit/process/cust_main_attach.cgi | 23 +++++-- httemplate/view/attachment.html | 6 +- httemplate/view/cust_main.cgi | 12 +++- httemplate/view/cust_main/attachments.html | 90 +++++++++++++++++----------- 5 files changed, 88 insertions(+), 48 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main_attach.cgi b/httemplate/edit/cust_main_attach.cgi index 7c9e407d9..dd460fa5e 100755 --- a/httemplate/edit/cust_main_attach.cgi +++ b/httemplate/edit/cust_main_attach.cgi @@ -24,7 +24,7 @@ Filename
"> -% if(defined $attach) { +% if(defined $attach and $curuser->access_right('Delete attachment')) {
% } @@ -35,6 +35,7 @@ Filename
<%init> +my $curuser = $FS::CurrentUser::CurrentUser; my $attachnum = ''; my $attach; if ( $cgi->param('error') ) { @@ -52,7 +53,7 @@ my $custnum = $1; my $action = $attachnum ? 'Edit' : 'Add'; die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right("$action customer note"); + unless $curuser->access_right("$action customer note"); diff --git a/httemplate/edit/process/cust_main_attach.cgi b/httemplate/edit/process/cust_main_attach.cgi index 51eead076..98f4d0912 100644 --- a/httemplate/edit/process/cust_main_attach.cgi +++ b/httemplate/edit/process/cust_main_attach.cgi @@ -4,6 +4,7 @@ %} else { % my $act = 'added'; % $act = 'updated' if ($attachnum); +% $act = 'purged' if($attachnum and $purge); % $act = 'undeleted' if($attachnum and $undelete); % $act = 'deleted' if($attachnum and $delete); <% header('Attachment ' . $act ) %> @@ -23,12 +24,13 @@ $cgi->param('attachnum') =~ /^(\d*)$/ or die "Illegal attachnum: ". $cgi->param('attachnum'); my $attachnum = $1; -my $otaker = $FS::CurrentUser::CurrentUser->name; -$otaker = $FS::CurrentUser::CurrentUser->username - if ($otaker eq "User, Legacy"); +my $curuser = $FS::CurrentUser::CurrentUser; +my $otaker = $curuser->name; +$otaker = $curuser->username if ($otaker eq "User, Legacy"); my $delete = $cgi->param('delete'); my $undelete = $cgi->param('undelete'); +my $purge = $cgi->param('purge'); my $new = new FS::cust_attachment ( { attachnum => $attachnum, @@ -44,6 +46,8 @@ if($attachnum) { if(!$old) { $error = "Attachnum '$attachnum' not found"; } + elsif($purge) { # do nothing + } else { map { $new->$_($old->$_) } ('_date', 'otaker', 'body', 'disabled'); @@ -72,12 +76,19 @@ else { # This is a new attachment, so require a file. $error = 'No file uploaded'; } } -my $user = $FS::CurrentUser::CurrentUser; +my $action = 'Add'; +$action = 'Edit' if $attachnum; +$action = 'Delete' if $attachnum and $delete; +$action = 'Undelete' if $attachnum and $undelete; +$action = 'Purge' if $attachnum and $purge; -$error = 'access denied' unless $user->access_right(($old ? 'Edit' : 'Add') . ' attachment'); +$error = 'access denied' unless $curuser->access_right($action . ' attachment'); if(!$error) { - if($old) { + if($old and $old->disabled and $purge) { + $error = $old->delete; + } + elsif($old) { $error = $new->replace($old); } else { diff --git a/httemplate/view/attachment.html b/httemplate/view/attachment.html index c85b1375f..5fc053967 100644 --- a/httemplate/view/attachment.html +++ b/httemplate/view/attachment.html @@ -1,16 +1,16 @@ +<% $attach->body %> <%init> my ($query) = $cgi->keywords; $query =~ /^(\d+)$/; my $attachnum = $1 or die 'Invalid attachment number'; $FS::CurrentUser::CurrentUser->access_right('Download attachment') or die 'access denied'; -my $attach = qsearchs('cust_attachment', { attachnum => $attachnum }) or die 'Attachment not found: $attachnum'; +my $attach = qsearchs('cust_attachment', { attachnum => $attachnum }) or die "Attachment not found: $attachnum"; +die 'access denied' if $attach->disabled; $m->clear_buffer; $r->content_type($attach->mime_type || 'text/plain'); $r->headers_out->add('Content-Disposition' => 'attachment;filename=' . $attach->filename); -binmode STDOUT; -print STDOUT $attach->body; diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index da1a56a96..bbdfe5166 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -108,7 +108,7 @@ Comments

% } - + % my $notecount = scalar($cust_main->notes()); % if ( ! $conf->exists('cust_main-disable_notes') || $notecount) { @@ -152,6 +152,16 @@ Comments %> % } <% include('cust_main/attachments.html', 'custnum' => $cust_main->custnum ) %> +% if($cgi->param('show_deleted')) { +">(Show active attachments) +% } +% elsif($curuser->access_right('View deleted attachments')) { +">(Show deleted attachments) +% }
% } diff --git a/httemplate/view/cust_main/attachments.html b/httemplate/view/cust_main/attachments.html index e25814ff5..53635fd62 100755 --- a/httemplate/view/cust_main/attachments.html +++ b/httemplate/view/cust_main/attachments.html @@ -19,9 +19,19 @@ % my $bgcolor1 = '#eeeeee'; % my $bgcolor2 = '#ffffff'; % my $bgcolor = ''; +% if($cgi->param('show_deleted')) { +% if ($curuser->access_right('View deleted attachments')) { +% @attachments = grep { $_->disabled } @attachments; +% } +% else { +% @attachments = (); +% } +% } +% else { +% @attachments = grep { not $_->disabled } @attachments; +% } % -% foreach my $attach ((grep { $_->disabled } @attachments), -% (grep { ! $_->disabled } @attachments)) { +% foreach my $attach (@attachments) { % % if ( $bgcolor eq $bgcolor1 ) { % $bgcolor = $bgcolor2; @@ -32,42 +42,38 @@ % my $pop = popurl(3); % my $attachnum = $attach->attachnum; % my $edit = ''; -% my $download = ''; -% if($attach->disabled) { -% my $onclick = include('/elements/popup_link_onclick.html', -% 'action' => popurl(2). -% 'edit/process/cust_main_attach.cgi'. -% "?custnum=$custnum;". -% "attachnum=$attachnum;". -% "undelete=1", -% 'actionlabel' => 'Undelete attachment', -% 'width' => 616, -% 'height' => 408, -% 'frame' => 'top', -% ); -% my $clickjs = qq!onclick="$onclick"!; -% if($curuser->access_right('Edit attachment')) { -% $edit = qq! (undelete)!; +% if($attach->disabled) { # then you can undelete it or purge it. +% if ($curuser->access_right('Undelete attachment')) { +% my $clickjs = popup('edit/process/cust_main_attach.cgi?'. +% "custnum=$custnum;attachnum=$attachnum;". +% "undelete=1", +% 'Undelete attachment'); +% $edit .= qq!  (undelete)!; +% } +% if ($curuser->access_right('Purge attachment')) { +% my $clickjs = popup('edit/process/cust_main_attach.cgi?'. +% "custnum=$custnum;attachnum=$attachnum;". +% "purge=1", +% 'Purge attachment'); +% $edit .= qq!  (purge)!; % } % } -% else { -% my $onclick = include( '/elements/popup_link_onclick.html', -% 'action' => popurl(2). -% 'edit/cust_main_attach.cgi'. -% "?custnum=$custnum". -% ";attachnum=$attachnum", -% 'actionlabel' => 'Edit customer note', -% 'width' => 616, -% 'height' => 408, -% 'frame' => 'top', -% ); -% my $clickjs = qq!onclick="$onclick"!; -% +% else { # you can download or edit it % if ($curuser->access_right('Edit attachment') ) { -% $edit = qq! (edit)!; +% my $clickjs = popup('edit/cust_main_attach.cgi?'. +% "custnum=$custnum;attachnum=$attachnum", +% 'Edit attachment properties'); +% $edit .= qq!  (edit)!; +% } +% if($curuser->access_right('Delete attachment') ) { +% my $clickjs = popup('edit/process/cust_main_attach.cgi?'. +% "custnum=$custnum;attachnum=$attachnum;". +% "delete=1", +% 'Delete attachment'); +% $edit .= qq!  (delete)!; % } % if ($curuser->access_right('Download attachment') ) { -% $download = qq! (download)!; +% $edit .= qq!  (download)!; % } % } @@ -86,10 +92,8 @@  <% size_units( $attach->size ) %> -  <% $edit %> -  <% $download %> + <% $edit %> - <% $attach->disabled ? '' : '' %> % } #end display notes @@ -130,4 +134,18 @@ sub size_units { return int($bytes / 1048576)."M"; } +sub popup { + my ($url, $label) = @_; + my $onclick = + include('/elements/popup_link_onclick.html', + 'action' => popurl(2).$url, + 'actionlabel' => $label, + 'width' => 616, + 'height' => 408, + 'frame' => 'top', + ); + return qq!onclick="$onclick"!; +} + + -- cgit v1.2.1 From d1014a727cefa5d9813153594541f62ec15fc8b9 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 12 Aug 2009 02:36:25 +0000 Subject: fix multiple pkgpart search, RT#5924 --- httemplate/misc/bulk_change_pkg.cgi | 20 +++++++++++++------- httemplate/search/cust_pkg.cgi | 24 ++++++++++++++---------- 2 files changed, 27 insertions(+), 17 deletions(-) (limited to 'httemplate') diff --git a/httemplate/misc/bulk_change_pkg.cgi b/httemplate/misc/bulk_change_pkg.cgi index 3bb677581..7f47a84cf 100755 --- a/httemplate/misc/bulk_change_pkg.cgi +++ b/httemplate/misc/bulk_change_pkg.cgi @@ -7,17 +7,23 @@
- -% for my $param (qw(agentnum magic status classnum pkgpart)) { - +%# some false laziness w/search/cust_pkg.cgi + + +% for my $param (qw(agentnum magic status classnum custom censustract)) { + % } % +% foreach my $pkgpart ($cgi->param('pkgpart')) { + +% } +% % foreach my $field (qw( setup last_bill bill adjourn susp expire cancel )) { % - "> - "> - "> - "> + "> + "> + "> + "> % } <% ntable('#cccccc') %> diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index f6a3620d3..f03bbc26b 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -158,18 +158,22 @@ my $money_char = $conf->config('money_char') || '$'; # my %part_pkg = map { $_->pkgpart => $_ } qsearch('part_pkg', {}); - my %search_hash = (); +my %search_hash = (); + +#some false laziness w/misc/bulk_change_pkg.cgi - $search_hash{'query'} = $cgi->keywords; +$search_hash{'query'} = $cgi->keywords; - for ( qw(agentnum magic status classnum pkgpart custom ) ) { - $search_hash{$_} = $cgi->param($_) if $cgi->param($_); - } - - for my $param ( qw(censustract) ) { - $search_hash{$param} = $cgi->param($param) || '' - if ( grep { /$param/ } $cgi->param ); - } +for (qw( agentnum magic status classnum custom )) { + $search_hash{$_} = $cgi->param($_) if $cgi->param($_); +} + +$search_hash{'pkgpart'} = [ $cgi->param('pkgpart') ]; + +for my $param ( qw(censustract) ) { + $search_hash{$param} = $cgi->param($param) || '' + if ( grep { /$param/ } $cgi->param ); +} my @report_option = $cgi->param('report_option') if $cgi->param('report_option'); -- cgit v1.2.1 From 600a15aa56c212e1206fced9cbcf9de103c2f95b Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 12 Aug 2009 11:58:21 +0000 Subject: slight about/credits UI tweak --- httemplate/docs/about.html | 4 ++-- httemplate/docs/credits.html | 4 +--- httemplate/docs/license.html | 6 +++--- httemplate/elements/header-popup.html | 33 ++++++++++++++++++++++++++------- 4 files changed, 32 insertions(+), 15 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/about.html b/httemplate/docs/about.html index fbf0a66f5..04af73db8 100644 --- a/httemplate/docs/about.html +++ b/httemplate/docs/about.html @@ -1,9 +1,9 @@ -<% include('/elements/header-popup.html', 'Freeside') %> +<% include('/elements/header-popup.html', { title=>'Freeside', nobr=>1 } ) %> <% include('/elements/init_overlib.html') %>
-
+

version <% $FS::VERSION %>

diff --git a/httemplate/docs/credits.html b/httemplate/docs/credits.html index a944f48fa..d927722e0 100644 --- a/httemplate/docs/credits.html +++ b/httemplate/docs/credits.html @@ -24,10 +24,8 @@
Freeside
-
-
-
+

version <% $FS::VERSION %>

diff --git a/httemplate/docs/license.html b/httemplate/docs/license.html index a673bc9dd..fc3da6913 100644 --- a/httemplate/docs/license.html +++ b/httemplate/docs/license.html @@ -1,12 +1,12 @@ -<% include('/elements/header-popup.html', 'Freeside') %> +<% include('/elements/header-popup.html', { title=>'Freeside', nobr=>1 } ) %>
-
+

version <% $FS::VERSION %>

-Copyright © 2005-2008 Freeside Internet Services, Inc.
+Copyright © 2005-2009 Freeside Internet Services, Inc.
Copyright © 2000-2005 Ivan Kohler
Copyright © 1999 Silicon Interactive Software Design
All rights reserved
diff --git a/httemplate/elements/header-popup.html b/httemplate/elements/header-popup.html index 68be108d2..d74581b07 100644 --- a/httemplate/elements/header-popup.html +++ b/httemplate/elements/header-popup.html @@ -1,10 +1,3 @@ -% -% my($title, $menubar) = ( shift, shift ); #$menubar is unused here though -% my $etc = @_ ? shift : ''; #$etc is for things like onLoad= etc. -% my $head = @_ ? shift : ''; #$head is for things that go in the section -% my $conf = new FS::Conf; -% - @@ -21,4 +14,30 @@

<% $title %>
+ +% unless ( $nobr ) {
+% } + +<%init> + +my( $title, $menubar, $etc, $head ) = ( '', '', '', '' ); +#my( $nobr, $nocss ) = ( 0, 0 ); +my $nobr = 0; +if ( ref($_[0]) ) { + my $opt = shift; + $title = $opt->{title}; + $menubar = $opt->{menubar}; + $etc = $opt->{etc}; + $head = $opt->{head}; + $nobr = $opt->{nobr}; +# $nocss = $opt->{nocss}; +} else { + ($title, $menubar) = ( shift, shift ); + $etc = @_ ? shift : ''; #$etc is for things like onLoad= etc. + $head = @_ ? shift : ''; #$head is for things that go in the section +} + +my $conf = new FS::Conf; + + -- cgit v1.2.1 From 56a2965996454a0649d43ecbc062beda61106e21 Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 12 Aug 2009 14:58:50 +0000 Subject: internalize billco-upload and automate the transfer to the provider RT#5902 --- httemplate/config/config-view.cgi | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'httemplate') diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi index 9e9e64eb2..0f6c99232 100644 --- a/httemplate/config/config-view.cgi +++ b/httemplate/config/config-view.cgi @@ -66,7 +66,7 @@ Click on a configuration value to change it. % @agents = ( '' ); % if ( $i->per_agent ) { % foreach my $agent (@all_agents) { -% if ( defined(_config_agentonly($conf, $i->key, $agent->agentnum)) ) { +% if ( defined($conf->conf( $i->key, $agent->agentnum, 1 ) ) ) { % push @agents, $agent; % } else { % push @add_agents, $agent; @@ -99,15 +99,14 @@ Click on a configuration value to change it. ) %>: <% $i->description %> % if ( $agent && $cgi->param('showagent') ) { -% my $confnum = -% _config_agentonly($conf, $i->key, $agent->agentnum)->confnum; +% my $confnum = $conf->conf( $i->key, $agent->agentnum, 1 )->confnum; (delete agent override) % } elsif ( $i->base_key % || ( $deleteable{$i->key} && $conf->exists($i->key) ) ) { % my $confnum = % $agent -% ? _config_agentonly($conf, $i->key, $agent->agentnum)->confnum -% : $conf->_config( $i->key )->confnum; +% ? $conf->conf( $i->key, $agent->agentnum, 1 )->confnum +% : $conf->conf( $i->key )->confnum; % my $showagent = $cgi->param('showagent') ? '_showagent' : ''; (delete configuration item) % } @@ -286,18 +285,6 @@ Click on a configuration value to change it. -<%once> - -#should probably be a Conf method. what else would need to use it? -sub _config_agentonly { - my($self,$name,$agentnum)=@_; - my $hashref = { 'name' => $name }; - $hashref->{agentnum} = $agentnum; - local $FS::Record::conf = undef; # XXX evil hack prevents recursion - FS::Record::qsearchs('conf', $hashref); -} - - <%init> die "access denied" @@ -320,6 +307,7 @@ if ($cgi->param('agentnum') =~ /^(\d+)$/) { my $conf = new FS::Conf; my @config_items = grep { $page_agent ? $_->per_agent : 1 } + grep { $page_agent ? 1 : !$_->agentonly } $conf->config_items; my @deleteable = qw( invoice_latexreturnaddress invoice_htmlreturnaddress ); -- cgit v1.2.1 From 6d406c07de8348a0a0e5ec1e8f2a3d8ffe5309cd Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 13 Aug 2009 09:25:02 +0000 Subject: fix reverted changes. grr. RT#4964 --- httemplate/view/cust_main.cgi | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index bbdfe5166..3e5a8cee3 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -113,6 +113,7 @@ Comments % if ( ! $conf->exists('cust_main-disable_notes') || $notecount) { % unless ( $view eq 'notes' && $cust_main->comments !~ /[^\s\n\r]/ ) { +
Notes
% } @@ -206,6 +207,10 @@ Comments % } +% if ( $view eq 'change_history' ) { # || $view eq 'jumbo' +<% include('cust_main/change_history.html', $cust_main ) %> +% } + <% include('/elements/footer.html') %> <%init> @@ -243,7 +248,8 @@ $views{'Tickets'} = 'tickets' $views{'Packages'} = 'packages'; $views{'Payment History'} = 'payment_history' unless $conf->config('payby-default' eq 'HIDE'); -#$views{'Change History'} = ''; +$views{'Change History'} = 'change_history' + if $curuser->access_right('View customer history'); $views{'Jumbo'} = 'jumbo'; my %viewname = reverse %views; -- cgit v1.2.1 From 84c255838ffdeea5df83556b417bda29d8c71331 Mon Sep 17 00:00:00 2001 From: mark Date: Fri, 14 Aug 2009 17:26:32 +0000 Subject: Fix incorrect access right --- httemplate/edit/cust_main_attach.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main_attach.cgi b/httemplate/edit/cust_main_attach.cgi index dd460fa5e..43d2e2928 100755 --- a/httemplate/edit/cust_main_attach.cgi +++ b/httemplate/edit/cust_main_attach.cgi @@ -53,7 +53,7 @@ my $custnum = $1; my $action = $attachnum ? 'Edit' : 'Add'; die "access denied" - unless $curuser->access_right("$action customer note"); + unless $curuser->access_right("$action attachment"); -- cgit v1.2.1 From 05820654d27caed7679d9e475d6763acaff38806 Mon Sep 17 00:00:00 2001 From: jeff Date: Sun, 16 Aug 2009 22:45:26 +0000 Subject: include a census zipcode link and other minor improvements --- httemplate/edit/cust_main/bottomfixup.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main/bottomfixup.js b/httemplate/edit/cust_main/bottomfixup.js index 06e8b13b6..61d7220c0 100644 --- a/httemplate/edit/cust_main/bottomfixup.js +++ b/httemplate/edit/cust_main/bottomfixup.js @@ -311,26 +311,33 @@ function update_censustract(arg) { if (error || cf.elements['censustract'].value != newcensus) { // popup an entry dialog + if (error) { newcensus = error; } + newcensus.replace(/.*ndefined.*/, 'Not found'); + var choose_censustract = '

Confirm censustract
' + 'Map service module location

' + + '" target="_blank">Map service module location
' + + 'Map zip code center

' + ''; choose_censustract = choose_censustract + - '' + - '' + + '' + + '' + '' + ''; choose_censustract = choose_censustract + - '' + ' --> + + + + +
Entered census tractCalculated census tract
Entered census tractCalculated census tract
' + cf.elements['censustract'].value + '' + newcensus + '
  
' + + '
' + '' + - '' + + '' + '' + '
' + -- cgit v1.2.1 From a8a4c0572d5b0335e06cdb3fd75226db956c007f Mon Sep 17 00:00:00 2001 From: jeff Date: Tue, 18 Aug 2009 12:21:41 +0000 Subject: support 2009 - a better way? --- httemplate/edit/cust_main/bottomfixup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main/bottomfixup.js b/httemplate/edit/cust_main/bottomfixup.js index 61d7220c0..d6706a580 100644 --- a/httemplate/edit/cust_main/bottomfixup.js +++ b/httemplate/edit/cust_main/bottomfixup.js @@ -242,7 +242,7 @@ function post_geocode() { var cf = document.CustomerForm; var state_el = cf.elements['ship_state']; var census_data = new Array( - 'year', <% $conf->config('census_year') || '2008' %>, + 'year', <% $conf->config('census_year') || '2009' %>, 'address', cf.elements['ship_address1'].value, 'city', cf.elements['ship_city'].value, 'state', state_el.options[ state_el.selectedIndex ].value, -- cgit v1.2.1 From 2e1d2a91264e8441bc31583be7352ae1b3c31bb8 Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 19 Aug 2009 06:15:14 +0000 Subject: option to count subpackages outside packages in sales report #5588 --- httemplate/graph/cust_bill_pkg.cgi | 11 ++++++++--- httemplate/graph/report_cust_bill_pkg.html | 5 +++++ httemplate/search/cust_bill_pkg.cgi | 23 ++++++++++++++++++----- 3 files changed, 31 insertions(+), 8 deletions(-) (limited to 'httemplate') diff --git a/httemplate/graph/cust_bill_pkg.cgi b/httemplate/graph/cust_bill_pkg.cgi index b655f1f01..021189abb 100644 --- a/httemplate/graph/cust_bill_pkg.cgi +++ b/httemplate/graph/cust_bill_pkg.cgi @@ -68,6 +68,9 @@ if ( $cgi->param('classnum') =~ /^(\d*)$/ ) { } #eslaf +my $use_override = 0; +$use_override = 1 if ( $cgi->param('use_override') ); + my $hue = 0; #my $hue_increment = 170; #my $hue_increment = 145; @@ -104,11 +107,13 @@ foreach my $agent ( $sel_agent || qsearch('agent', { 'disabled' => '' } ) ) { my $row_classnum = ref($pkg_class) ? $pkg_class->classnum : 0; my $row_agentnum = $agent->agentnum; - push @params, [ 'classnum' => $row_classnum, - 'agentnum' => $row_agentnum, + push @params, [ 'classnum' => $row_classnum, + 'agentnum' => $row_agentnum, + 'use_override' => $use_override, ]; - push @links, "$link;agentnum=$row_agentnum;classnum=$row_classnum;"; + push @links, "$link;agentnum=$row_agentnum;classnum=$row_classnum;". + "use_override=$use_override;"; @recur_colors = ($col_scheme->colors)[0,4,8,1,5,9] unless @recur_colors; diff --git a/httemplate/graph/report_cust_bill_pkg.html b/httemplate/graph/report_cust_bill_pkg.html index 5193bf4a3..073f86773 100644 --- a/httemplate/graph/report_cust_bill_pkg.html +++ b/httemplate/graph/report_cust_bill_pkg.html @@ -25,6 +25,11 @@
Separate sub-packages from parents

diff --git a/httemplate/search/cust_bill_pkg.cgi b/httemplate/search/cust_bill_pkg.cgi index 4a31611cd..8654585b4 100644 --- a/httemplate/search/cust_bill_pkg.cgi +++ b/httemplate/search/cust_bill_pkg.cgi @@ -16,8 +16,8 @@ 'fields' => [ 'billpkgnum', sub { $_[0]->pkgnum > 0 - ? $_[0]->get('pkg') - : $_[0]->get('itemdesc') + ? $_[0]->get('pkg') # possibly use override.pkg + : $_[0]->get('itemdesc') # but i think this correct }, #strikethrough or "N/A ($amount)" or something these when # they're not applicable to pkg_tax search @@ -87,11 +87,22 @@ if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) { # not specified: all classes # 0: empty class # N: classnum +my $use_override = $cgi->param('use_override'); if ( $cgi->param('classnum') =~ /^(\d+)$/ ) { + my $comparison = ''; if ( $1 == 0 ) { - push @where, "classnum IS NULL"; + $comparison = "IS NULL"; } else { - push @where, "classnum = $1"; + $comparison = "= $1"; + } + + if ( $use_override ) { + push @where, "( + part_pkg.classnum $comparison AND pkgpart_override IS NULL OR + override.classnum $comparison AND pkgpart_override IS NOT NULL + )"; + } else { + push @where, "part_pkg.classnum $comparison"; } } @@ -372,7 +383,9 @@ my $join_pkg; if ( $cgi->param('nottax') ) { $join_pkg = ' LEFT JOIN cust_pkg USING ( pkgnum ) - LEFT JOIN part_pkg USING ( pkgpart ) '; + LEFT JOIN part_pkg USING ( pkgpart ) + LEFT JOIN part_pkg AS override + ON pkgpart_override = override.pkgpart '; $join_pkg .= ' LEFT JOIN cust_location USING ( locationnum ) ' if $conf->exists('tax-pkg_address'); -- cgit v1.2.1 From 5c35f5323f1cdcf7eabe6632d0352ea417d3047e Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 20 Aug 2009 04:03:35 +0000 Subject: Emailing statements of accounts, RT#4860 --- httemplate/view/cust_main/payment_history.html | 9 +++ .../view/cust_main/payment_history/statement.html | 34 ++++++++++ httemplate/view/cust_statement.html | 75 ++++++++++++++++++++++ 3 files changed, 118 insertions(+) create mode 100644 httemplate/view/cust_main/payment_history/statement.html create mode 100755 httemplate/view/cust_statement.html (limited to 'httemplate') diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index 24af5c9a5..0050daf9d 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -392,6 +392,15 @@ foreach my $cust_bill ($cust_main->cust_bill) { }; } +#statements +foreach my $cust_statement ($cust_main->cust_statement) { + push @history, { + 'date' => $cust_statement->_date, + 'desc' => include('payment_history/statement.html', $cust_statement, %opt ), + #'charge' => $cust_bill->charged, + }; +} + #payments (some false laziness w/credits) foreach my $cust_pay ($cust_main->cust_pay) { push @history, { diff --git a/httemplate/view/cust_main/payment_history/statement.html b/httemplate/view/cust_main/payment_history/statement.html new file mode 100644 index 000000000..dedec9bda --- /dev/null +++ b/httemplate/view/cust_main/payment_history/statement.html @@ -0,0 +1,34 @@ +<% $link %><% $pre %>Statement #<% $statementnum %> +%# (Balance $ <% $cust_statement->owed %>) +<% $post %><% $link ? '' : '' %><% $events %> +<%init> + +my( $cust_statement, %opt ) = @_; + +my $curuser = $FS::CurrentUser::CurrentUser; + +my($pre, $post) = ('', ''); +#if ( $cust_statement->owed > 0 ) { +# $pre = 'Open '; +# $post = ''; +#} + +my $statementnum = $cust_statement->statementnum; + +my $link = $curuser->access_right('View invoices') + ? qq!! + : ''; + +my $events = ''; + +#if ( $cust_statement->num_cust_event +# && ( $curuser->access_right('Billing event reports') +# || $curuser->access_right('View customer billing events') +# ) +# ) { +# $events = +# qq!
( View statement events )'; +#} + + diff --git a/httemplate/view/cust_statement.html b/httemplate/view/cust_statement.html new file mode 100755 index 000000000..ec4ee9ebd --- /dev/null +++ b/httemplate/view/cust_statement.html @@ -0,0 +1,75 @@ +<% include("/elements/header.html",'Statement View', menubar( + "View this customer (#$display_custnum)" => "${p}view/cust_main.cgi?$custnum", +)) %> + +% if ( $FS::CurrentUser::CurrentUser->access_right('Resend invoices') ) { + + Re-print this statement + +% if ( grep { $_ ne 'POST' } $cust_statement->cust_main->invoicing_list ) { + | Re-email this statement +% } + +% if ( $conf->exists('hylafax') && length($cust_statement->cust_main->fax) ) { + | Re-fax this statement +% } + +

+ +% } + + +% if ( $conf->exists('invoice_latex') ) { + + View typeset statement +

+% } + +% #if ( $cust_statement->num_cust_event ) { +% if ( 0 ) { +( View statement events )

+% } + +% if ( $conf->exists('invoice_html') ) { + + <% join('', $cust_statement->print_html('', $templatename) ) %> +% } else { + +
<% join('', $cust_statement->print_text('', $templatename) ) %>
+% } + +<% include('/elements/footer.html') %> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('View invoices'); + +#untaint statement +my($query) = $cgi->keywords; +$query =~ /^((.+)-)?(\d+)$/; +my $templatename = $2; +my $statementnum = $3; + +my $conf = new FS::Conf; + +my @payby = grep /\w/, $conf->config('payby'); +#@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP )) +@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP )) + unless @payby; +my %payby = map { $_=>1 } @payby; + +my $cust_statement = qsearchs({ + 'select' => 'cust_statement.*', + 'table' => 'cust_statement', + 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )', + 'hashref' => { 'statementnum' => $statementnum }, + 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, +}); +die "Statement #$statementnum not found!" unless $cust_statement; + +my $custnum = $cust_statement->custnum; +my $display_custnum = $cust_statement->cust_main->display_custnum; + +my $link = $templatename ? "$templatename-$statementnum" : $statementnum; + + -- cgit v1.2.1 From 1e34f4a5d142bd58f5918219db0931e81ad0418e Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 20 Aug 2009 09:47:05 +0000 Subject: email statements, RT#4860 --- httemplate/misc/email-statement.cgi | 19 +++++++++++++++++++ httemplate/view/cust_statement-pdf.cgi | 28 ++++++++++++++++++++++++++++ httemplate/view/cust_statement.html | 13 ++++++++----- 3 files changed, 55 insertions(+), 5 deletions(-) create mode 100755 httemplate/misc/email-statement.cgi create mode 100755 httemplate/view/cust_statement-pdf.cgi (limited to 'httemplate') diff --git a/httemplate/misc/email-statement.cgi b/httemplate/misc/email-statement.cgi new file mode 100755 index 000000000..67f654d64 --- /dev/null +++ b/httemplate/misc/email-statement.cgi @@ -0,0 +1,19 @@ +<% $cgi->redirect("${p}view/cust_main.cgi?$custnum") %> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Resend invoices'); + +#untaint statementnum +my($query) = $cgi->keywords; +$query =~ /^((.+)-)?(\d+)$/; +my $template = $2 || 'statement'; #XXX configure... via event?? eh.. +my $statementnum = $3; +my $cust_statement = qsearchs('cust_statement',{'statementnum'=>$statementnum}); +die "Can't find statement!\n" unless $cust_statement; + +$cust_statement->email($template); + +my $custnum = $cust_statement->getfield('custnum'); + + diff --git a/httemplate/view/cust_statement-pdf.cgi b/httemplate/view/cust_statement-pdf.cgi new file mode 100755 index 000000000..a1739e04c --- /dev/null +++ b/httemplate/view/cust_statement-pdf.cgi @@ -0,0 +1,28 @@ +<% $pdf %> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('View invoices'); + +#untaint statementnum +my($query) = $cgi->keywords; +$query =~ /^((.+)-)?(\d+)(.pdf)?$/; +my $templatename = $2 || 'statement'; #XXX configure... via event?? eh.. +my $statementnum = $3; + +my $cust_statement = qsearchs({ + 'select' => 'cust_statement.*', + 'table' => 'cust_statement', + 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )', + 'hashref' => { 'statementnum' => $statementnum }, + 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, +}); +die "Statement #$statementnum not found!" unless $cust_statement; + +my $pdf = $cust_statement->print_pdf( '', $templatename); + +http_header('Content-Type' => 'application/pdf' ); +http_header('Content-Length' => length($pdf) ); +http_header('Cache-control' => 'max-age=60' ); + + diff --git a/httemplate/view/cust_statement.html b/httemplate/view/cust_statement.html index ec4ee9ebd..b078c9d07 100755 --- a/httemplate/view/cust_statement.html +++ b/httemplate/view/cust_statement.html @@ -4,13 +4,15 @@ % if ( $FS::CurrentUser::CurrentUser->access_right('Resend invoices') ) { - Re-print this statement +%# Re-print this statement % if ( grep { $_ ne 'POST' } $cust_statement->cust_main->invoicing_list ) { - | Re-email this statement +%# | + Re-email this statement % } -% if ( $conf->exists('hylafax') && length($cust_statement->cust_main->fax) ) { +% if ( 0 ) { +% #if ( $conf->exists('hylafax') && length($cust_statement->cust_main->fax) ) { | Re-fax this statement % } @@ -19,7 +21,8 @@ % } -% if ( $conf->exists('invoice_latex') ) { +% #if ( $conf->exists('invoice_latex') ) { +% if ( 0 ) { #broken??? View typeset statement

@@ -47,7 +50,7 @@ die "access denied" #untaint statement my($query) = $cgi->keywords; $query =~ /^((.+)-)?(\d+)$/; -my $templatename = $2; +my $templatename = $2 || 'statement'; #XXX configure... via event?? eh.. my $statementnum = $3; my $conf = new FS::Conf; -- cgit v1.2.1 From beb9681db0ee4c0912c82849267a82dd434784b3 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 22 Aug 2009 00:22:08 +0000 Subject: order svc_phone services from self-service too, RT#5085 --- .../edit/cust_main/first_pkg/select-part_pkg.html | 14 ++++++-- httemplate/edit/cust_main/first_pkg/svc_acct.html | 40 +++++++++++++++++++--- 2 files changed, 46 insertions(+), 8 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main/first_pkg/select-part_pkg.html b/httemplate/edit/cust_main/first_pkg/select-part_pkg.html index d2d862bea..871e1cdee 100644 --- a/httemplate/edit/cust_main/first_pkg/select-part_pkg.html +++ b/httemplate/edit/cust_main/first_pkg/select-part_pkg.html @@ -1,15 +1,17 @@ <% include('/elements/xmlhttp.html', - 'url' => $p.'misc/svc_acct-domains.cgi', + 'url' => $url_prefix.'misc/svc_acct-domains.cgi', 'subs' => [ $opt{'prefix'}. 'get_domains' ], ) %> <% include('/elements/xmlhttp.html', - 'url' => $p.'misc/part_svc-columns.cgi', + 'url' => $url_prefix.'misc/part_svc-columns.cgi', 'subs' => [ $opt{'prefix'}. 'get_part_svc' ], ) %> + + + +<%init> + +my($query) = $cgi->keywords; +$query =~ /^([\d\.]+)$/ or die 'Illegal IP'; +my $ip = $1; + + diff --git a/httemplate/misc/xmlhttp-ping.html b/httemplate/misc/xmlhttp-ping.html new file mode 100644 index 000000000..e99303207 --- /dev/null +++ b/httemplate/misc/xmlhttp-ping.html @@ -0,0 +1,20 @@ +<% objToJson($return) %> +<%init> + +my $conf = new FS::Conf; + +my $sub = $cgi->param('sub'); + +die "$sub not supported" unless $sub eq 'ping'; + +my $ip = $cgi->param('arg'); + +my $ping = new Net::Ping('external', 5); +$ping->hires(1); +#my $a=time; warn "pinging\n"; +my ($ret, $duration, $ip2) = $ping->ping($ip); +#warn "done pinging (". int(time-$a). "s)\n"; + +my $return = [ $ret, $duration ]; + + diff --git a/httemplate/view/cust_main/packages/services.html b/httemplate/view/cust_main/packages/services.html index 37cd615eb..0fe7931d8 100644 --- a/httemplate/view/cust_main/packages/services.html +++ b/httemplate/view/cust_main/packages/services.html @@ -41,15 +41,20 @@ +% my $ip_addr = $cust_svc->svc_x->ip_addr; + +% if ( $part_svc->svcdb eq 'svc_broadband' ) { + ( <% include('/elements/popup_link-ping.html', 'ip'=> $ip_addr ) %> ) + +% } + % my $manage_link = $opt{'svc_broadband-manage_link'}; % if ( $manage_link && $part_svc->svcdb eq 'svc_broadband' ) { -% my $ip_addr = $cust_svc->svc_x->ip_addr; % my $svc_manage_link = eval(qq("$manage_link")); Manage Device ) % } - % if ( $curuser->access_right('Unprovision customer service') ) { ( <%svc_unprovision_link($cust_svc)%> ) % } diff --git a/httemplate/view/svc_broadband.cgi b/httemplate/view/svc_broadband.cgi index 0e9656b15..1463925b4 100644 --- a/httemplate/view/svc_broadband.cgi +++ b/httemplate/view/svc_broadband.cgi @@ -8,7 +8,9 @@ )) %> -Edit this information +<% include('/elements/init_overlib.html') %> + +Edit this information
<%ntable("#cccccc")%> @@ -42,7 +44,10 @@ % if ( $ip_addr ) { IP Address - <%$ip_addr%> + + <%$ip_addr%> + (<% include('/elements/popup_link-ping.html', 'ip'=>$ip_addr ) %>) + IP Netmask -- cgit v1.2.1 From cc7fae653653e27325a616a0497d9d59bbb55852 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 15 Sep 2009 20:44:29 +0000 Subject: modernize external search --- httemplate/search/svc_external.cgi | 286 +++++++++++++++++-------------------- 1 file changed, 134 insertions(+), 152 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/svc_external.cgi b/httemplate/search/svc_external.cgi index 2710d75bc..f0617542a 100755 --- a/httemplate/search/svc_external.cgi +++ b/httemplate/search/svc_external.cgi @@ -1,153 +1,135 @@ -%die "access denied" -% unless $FS::CurrentUser::CurrentUser->access_right('List services'); -% -%my $conf = new FS::Conf; -% -%my @svc_external = (); -%my @h_svc_external = (); -%my $sortby=\*svcnum_sort; -%if ( $cgi->param('magic') =~ /^(all|unlinked)$/ ) { -% -% @svc_external=qsearch('svc_external',{}); -% -% if ( $cgi->param('magic') eq 'unlinked' ) { -% @svc_external = grep { qsearchs('cust_svc', { -% 'svcnum' => $_->svcnum, -% 'pkgnum' => '', -% } -% ) -% } -% @svc_external; -% } -% -% if ( $cgi->param('sortby') =~ /^(\w+)$/ ) { -% my $sortby = $1; -% if ( $sortby eq 'id' ) { -% $sortby = \*id_sort; -% } -% } -% -%} elsif ( $cgi->param('svcpart') =~ /^(\d+)$/ ) { -% -% @svc_external = -% qsearch( 'svc_external', {}, '', -% " WHERE $1 = ( SELECT svcpart FROM cust_svc ". -% " WHERE cust_svc.svcnum = svc_external.svcnum ) " -% ); -% -%} elsif ( $cgi->param('title') =~ /^(.*)$/ ) { -% $sortby=\*id_sort; -% @svc_external=qsearch('svc_external',{ title => $1 }); -% if( $cgi->param('history') == 1 ) { -% @h_svc_external=qsearch('h_svc_external',{ title => $1 }); -% } -%} elsif ( $cgi->param('id') =~ /^([\w\-\.]+)$/ ) { -% my $id = $1; -% @svc_external = qsearchs('svc_external',{'id'=>$id}); -%} -% -%if ( scalar(@svc_external) == 1 ) { -% -% -<% $cgi->redirect(popurl(2). "view/svc_external.cgi?". $svc_external[0]->svcnum) %> -% -% -%} elsif ( scalar(@svc_external) == 0 ) { -% -% -<% include('/elements/header.html', 'External Search Results' ) %> - - No matching external services found -% } else { -% -% -<% include('/elements/header.html', 'External Search Results', '') %> - - <% scalar(@svc_external) %> matching external services found - - - - - - -% -% foreach my $svc_external ( -% sort $sortby (@svc_external) -% ) { -% my($svcnum, $id, $title)=( -% $svc_external->svcnum, -% $svc_external->id, -% $svc_external->title, -% ); -% -% my $rowspan = 1; -% -% print < -% -% -% -%END -% -% #print @rows; -% print ""; -% -% } -% if( scalar(@h_svc_external) > 0 ) { -% print < -%
Service #<% FS::Msgcat::_gettext('svc_external-id') || 'External ID' %><% FS::Msgcat::_gettext('svc_external-title') || 'Title' %>
$svcnum$id$title
-% -% -% -% -% -% -%HTML -% -% foreach my $h_svc ( @h_svc_external ) { -% my($svcnum, $id, $title, $user, $date)=( -% $h_svc->svcnum, -% $h_svc->id, -% $h_svc->title, -% $h_svc->history_user, -% $h_svc->history_date, -% ); -% my $rowspan = 1; -% my ($h_cust_svc) = qsearchs( 'h_cust_svc', { -% svcnum => $svcnum, -% }); -% my $cust_pkg = qsearchs( 'cust_pkg', { -% pkgnum => $h_cust_svc->pkgnum, -% }); -% my $custnum = $cust_pkg->custnum; -% -% print < -% -% -% -% -% -%END -% } -% } -% -% print < -% -% -%END -% -%} -% -%sub svcnum_sort { -% $a->getfield('svcnum') <=> $b->getfield('svcnum'); -%} -% -%sub id_sort { -% $a->getfield('id') <=> $b->getfield('id'); -%} -% -% +<% include( 'elements/search.html', + 'title' => 'External service search results', + 'name' => 'external services', + 'query' => $sql_query, + 'count_query' => $count_query, + 'redirect' => $redirect, + 'header' => [ '#', + 'Service', + ( FS::Msgcat::_gettext('svc_external-id') || 'External ID' ), + ( FS::Msgcat::_gettext('svc_external-title') || 'Title' ), + FS::UI::Web::cust_header(), + ], + 'fields' => [ 'svcnum', + 'svc', + 'id', + 'title', + \&FS::UI::Web::cust_fields, + ], + 'links' => [ $link, + $link, + $link, + $link, + ( map { $_ ne 'Cust. Status' ? $link_cust : '' } + FS::UI::Web::cust_header() + ), + ], + 'align' => 'rlrr'. + FS::UI::Web::cust_aligns(), + 'color' => [ + '', + '', + '', + '', + FS::UI::Web::cust_colors(), + ], + 'style' => [ + '', + '', + '', + '', + FS::UI::Web::cust_styles(), + ], + ) +%> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('List services'); + +my $conf = new FS::Conf; + +my %svc_external; +my @extra_sql = (); +my $orderby = 'ORDER BY svcnum'; + +my $link = [ "${p}view/svc_external.cgi?", 'svcnum' ]; +my $redirect = $link; + +if ( $cgi->param('magic') =~ /^(all|unlinked)$/ ) { + + push @extra_sql, 'pkgnum IS NULL' + if $cgi->param('magic') eq 'unlinked'; + + if ( $cgi->param('sortby') =~ /^(\w+)$/ ) { + my $sortby = $1; + $orderby = "ORDER BY $sortby"; + } + +} elsif ( $cgi->param('svcpart') =~ /^(\d+)$/ ) { + + push @extra_sql, "svcpart = $1"; + +} elsif ( $cgi->param('title') =~ /^(.*)$/ ) { + + $svc_external{'title'} = $1; + $orderby = 'ORDER BY id'; + + # is this linked from anywhere??? + # if( $cgi->param('history') == 1 ) { + # @h_svc_external=qsearch('h_svc_external',{ title => $1 }); + # } + +} elsif ( $cgi->param('id') =~ /^([\w\-\.]+)$/ ) { + + $svc_external{'id'} = $1; + +} + +my $addl_from = ' LEFT JOIN cust_svc USING ( svcnum ) '. + ' LEFT JOIN part_svc USING ( svcpart ) '. + ' LEFT JOIN cust_pkg USING ( pkgnum ) '. + ' LEFT JOIN cust_main USING ( custnum ) '; + +#here is the agent virtualization +push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql( + 'null_right' => 'View/link unlinked services' + ); + +my $extra_sql = ''; +if ( @extra_sql ) { + $extra_sql = ( keys(%svc_external) ? ' AND ' : ' WHERE ' ). + join(' AND ', @extra_sql ); +} + +my $count_query = "SELECT COUNT(*) FROM svc_external $addl_from "; +if ( keys %svc_external ) { + $count_query .= ' WHERE '. + join(' AND ', map "$_ = ". dbh->quote($svc_external{$_}), + keys %svc_external + ); +} +$count_query .= $extra_sql; + +my $sql_query = { + 'table' => 'svc_external', + 'hashref' => \%svc_external, + 'select' => join(', ', + 'svc_external.*', + 'part_svc.svc', + 'cust_main.custnum', + FS::UI::Web::cust_sql_fields(), + ), + 'extra_sql' => "$extra_sql $orderby", + 'addl_from' => $addl_from, +}; + +#smaller false laziness w/svc_*.cgi here +my $link_cust = sub { + my $svc_x = shift; + $svc_x->custnum ? [ "${p}view/cust_main.cgi?", 'custnum' ] : ''; +}; + + + -- cgit v1.2.1 From 0681cc7e7224bf00988d7851c233dca6a2b0d5d7 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 15 Sep 2009 20:45:46 +0000 Subject: fix phone# usage search, RT# --- httemplate/search/svc_phone.cgi | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/svc_phone.cgi b/httemplate/search/svc_phone.cgi index 6ee7d1d07..21e1a9233 100644 --- a/httemplate/search/svc_phone.cgi +++ b/httemplate/search/svc_phone.cgi @@ -81,8 +81,8 @@ if ( $cgi->param('magic') =~ /^(all|unlinked)$/ ) { $redirect = ''; - my $and_date = " AND startdate >= $beginning ". - " AND startdate <= $ending "; + #my $and_date = " AND startdate >= $beginning AND startdate <= $ending "; + my $and_date = " AND enddate >= $beginning AND enddate <= $ending "; my $fromwhere = " FROM cdr WHERE cdr.svcnum = svc_phone.svcnum $and_date"; @@ -106,7 +106,7 @@ if ( $cgi->param('magic') =~ /^(all|unlinked)$/ ) { $and_date; push @select, - " ( SELECT SUM(billsec) $f_w ) AS term_billsec ". + " ( SELECT SUM(billsec) $f_w ) AS term_billsec ", " ( SELECT SUM(cdr_termination.rated_price) $f_w ) AS term_rated_price"; push @header, 'Term Min', 'Term Billed'; @@ -157,8 +157,9 @@ my $sql_query = { 'select' => join(', ', 'svc_phone.*', 'part_svc.svc', - 'cust_main.custnum', - FS::UI::Web::cust_sql_fields(), + @select, + 'cust_main.custnum', + FS::UI::Web::cust_sql_fields(), ), 'extra_sql' => "$extra_sql $orderby", 'addl_from' => $addl_from, -- cgit v1.2.1 From 116ae8901c51a8e491de6c69d3e55d65369166d5 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 17 Sep 2009 01:37:36 +0000 Subject: fix sales tax report w/part_pkg overrides, RT#6197 --- httemplate/search/cust_bill_pkg.cgi | 67 +++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 29 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_bill_pkg.cgi b/httemplate/search/cust_bill_pkg.cgi index 62954ea18..52f59de1e 100644 --- a/httemplate/search/cust_bill_pkg.cgi +++ b/httemplate/search/cust_bill_pkg.cgi @@ -119,36 +119,43 @@ if ( $cgi->param('classnum') =~ /^(\d+)$/ ) { } } -my $use_usage = $cgi->param('use_usage'); +if ( $cgi->param('taxclass') + && ! $cgi->param('istax') #no part_pkg.taxclass in this case + #(should we save a taxclass or a link to taxnum + # in cust_bill_pkg or something like + # cust_bill_pkg_tax_location?) + ) +{ + + #override taxclass when use_override is specified? probably + #if ( $use_override ) { + # + # push @where, + # ' ( '. join(' OR ', + # map { + # ' ( part_pkg.taxclass = '. dbh->quote($_). + # ' AND pkgpart_override IS NULL '. + # ' OR '. + # ' override.taxclass = '. dbh->quote($_). + # ' AND pkgpart_override IS NOT NULL '. + # ' ) ' + # } + # $cgi->param('taxclass') + # ). + # ' ) '; + # + #} else { + + push @where, + ' ( '. join(' OR ', + map ' part_pkg.taxclass = '.dbh->quote($_), + $cgi->param('taxclass') + ). + ' ) '; + + #} -push @where, ' ( '. join(' OR ', - map ' taxclass = '.dbh->quote($_), $cgi->param('taxclass') - ). - ' ) ' - if $cgi->param('taxclass') - && ! $cgi->param('istax'); #no part_pkg.taxclass in this case - #(should we save a taxclass or a link to taxnum - # in cust_bill_pkg or something like - # cust_bill_pkg_tax_location?) - -#sub _where { -# my $table = shift; -# my $prefix = @_ ? shift : ''; -# " -# ( cust_main_county.county = $table.${prefix}.county -# OR ( cust_main_county.county IS NULL AND $table.${prefix}.county = '' ) -# OR ( cust_main_county.county = '' AND $table.${prefix}.county IS NULL) -# OR ( cust_main_county.county IS NULL AND $table.${prefix}.county IS NULL) -# ) -# AND ( cust_main_county.state = $table.${prefix}.state -# OR ( cust_main_county.state IS NULL AND $table.${prefix}.state = '' ) -# OR ( cust_main_county.state = '' AND $table.${prefix}.state IS NULL ) -# OR ( cust_main_county.state IS NULL AND $table.${prefix}.state IS NULL ) -# ) -# AND cust_main_county.country = $table.${prefix}.country -# "; -# -#} +} if ( $cgi->param('out') ) { @@ -319,6 +326,8 @@ if ( $cgi->param('cust_tax') ) { push @where, $cust_exempt; } +my $use_usage = $cgi->param('use_usage'); + my $count_query; if ( $cgi->param('pkg_tax') ) { -- cgit v1.2.1 From 3de7395677b966be0bc1d44bc0b912ebb58564ec Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 18 Sep 2009 01:03:05 +0000 Subject: fix one-time charge inadvertantly checking the "tax exempt" checkbox when the tax product popup is swapped in and out, RT#6095 --- httemplate/view/cust_main/one_time_charge_link.html | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main/one_time_charge_link.html b/httemplate/view/cust_main/one_time_charge_link.html index f6bb43490..4ce8a28a3 100644 --- a/httemplate/view/cust_main/one_time_charge_link.html +++ b/httemplate/view/cust_main/one_time_charge_link.html @@ -1,9 +1,11 @@ + +% } + + % if ( $payby eq 'CARD' ) { % % my( $payinfo, $paycvv, $month, $year ) = ( '', '', '', '' ); @@ -237,16 +287,29 @@ my $balance = $cust_main->balance; my $payinfo = ''; -#false laziness w/selfservice make_payment.html shortcut for one-country my $conf = new FS::Conf; + +my $money_char = $conf->config('money_char') || '$'; + +#false laziness w/selfservice make_payment.html shortcut for one-country my %states = map { $_->state => 1 } qsearch('cust_main_county', { 'country' => $conf->config('countrydefault') || 'US' } ); my @states = sort { $a cmp $b } keys %states; -my $payunique = "webui-payment-". time. "-$$-". rand() * 2**32; +my $fee = ''; +my $fee_pkg = ''; +if ( $conf->config('manual_process-pkgpart') ) { + $fee_pkg = + qsearchs('part_pkg', { pkgpart=>$conf->config('manual_process-pkgpart') } ); - + #well ->unit_setup or ->calc_setup both call for a $cust_pkg + # (though ->unit_setup doesn't use it...) + $fee = $fee_pkg->option('setup_fee') + if $fee_pkg; #in case.. better than dying with a perl traceback +} +my $payunique = "webui-payment-". time. "-$$-". rand() * 2**32; + diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi index ea0c7946d..d41bc0f14 100644 --- a/httemplate/misc/process/payment.cgi +++ b/httemplate/misc/process/payment.cgi @@ -32,6 +32,11 @@ $cgi->param('amount') =~ /^\s*(\d*(\.\d\d)?)\s*$/ my $amount = $1; errorpage("amount <= 0") unless $amount > 0; +if ( $cgi->param('fee') =~ /^\s*(\d*(\.\d\d)?)\s*$/ ) { + my $fee = $1; + $amount = sprintf('%.2f', $amount + $fee); +} + $cgi->param('year') =~ /^(\d+)$/ or errorpage("illegal year ". $cgi->param('year')); my $year = $1; @@ -143,6 +148,15 @@ if ( $cgi->param('batch') ) { ); errorpage($error) if $error; + #no error, so order the fee package if applicable... + if ( $cgi->param('fee_pkgpart') =~ /^(\d+)$/ ) { + my $error = $cust_main->order_pkg( + 'cust_pkg' => new FS::cust_pkg { 'pkgpart' => $1 } + ); + errorpage("payment processed successfully, but error ordering fee: $error") + if $error; + } + $cust_main->apply_payments; } -- cgit v1.2.1 From c33e009d50f9af054a5a0195eca5df31c4fb9539 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 29 Sep 2009 22:08:39 +0000 Subject: should fix newsletter sending error when you select a single payby only --- httemplate/misc/email-customers.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/misc/email-customers.html b/httemplate/misc/email-customers.html index 0d3d622c3..f644db9e9 100644 --- a/httemplate/misc/email-customers.html +++ b/httemplate/misc/email-customers.html @@ -126,7 +126,7 @@ die "access denied" my %search = $cgi->Vars; delete $search{$_} for qw( magic from subject html_body text_body ); $search{$_} = [ split(/\0/, $search{$_}) ] - foreach grep $search{$_} =~ /\0/, keys %search; + foreach grep { $_ eq 'payby' || $search{$_} =~ /\0/ } keys %search; my $title = 'Bulk send customer notices'; -- cgit v1.2.1 From be88b21c5e361b05734593d41a651db6faecc5aa Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 1 Oct 2009 22:02:33 +0000 Subject: consistency with un-voided payments wrt display --- .../cust_main/payment_history/voided_payment.html | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main/payment_history/voided_payment.html b/httemplate/view/cust_main/payment_history/voided_payment.html index 08469dbe9..4438613a5 100644 --- a/httemplate/view/cust_main/payment_history/voided_payment.html +++ b/httemplate/view/cust_main/payment_history/voided_payment.html @@ -8,15 +8,27 @@ my( $cust_pay_void, %opt ) = @_; my $curuser = $FS::CurrentUser::CurrentUser; my $payby = $cust_pay_void->payby; -my $payinfo = $payby eq 'CARD' - ? $cust_pay_void->paymask - : $cust_pay_void->payinfo; + +my $payinfo; +if ( $payby eq 'CARD' ) { + $payinfo = $cust_pay->paymask; +} elsif ( $payby eq 'CHEK' ) { + my( $account, $aba ) = split('@', $cust_pay->paymask ); + $payinfo = "ABA $aba, Acct #$account"; +} else { + $payinfo = $cust_pay->payinfo; +} $payby =~ s/^BILL$/Check #/ if $payinfo; $payby =~ s/^CHEK$/Electronic check /; +$payby =~ s/^PREP$/Prepaid card /; +$payby =~ s/^CARD$/Credit card #/; +$payby =~ s/^COMP$/Complimentary by /; +$payby =~ s/^CASH$/Cash/; +$payby =~ s/^WEST$/Western Union/; +$payby =~ s/^MCRD$/Manual credit card/; $payby =~ s/^BILL$//; -$payby =~ s/^(CARD|COMP)$/$1 /; -my $info = $payby ? " ($payby$payinfo)" : ''; +my $info = $payby ? "($payby$payinfo)" : ''; if ( $opt{'pkg-balances'} && $cust_pay_void->pkgnum ) { my $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $cust_pay_void->pkgnum } ); -- cgit v1.2.1 From 1e25a541916c2c46083411ba5304d98fe863dac2 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 3 Oct 2009 22:06:02 +0000 Subject: in old invoice events, chance default weight of cancel event to 90 so you can place it at the same time as a realtime event, RT#5674 --- httemplate/edit/part_bill_event.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_bill_event.cgi b/httemplate/edit/part_bill_event.cgi index ffd642bae..625d83477 100755 --- a/httemplate/edit/part_bill_event.cgi +++ b/httemplate/edit/part_bill_event.cgi @@ -178,7 +178,7 @@ Invoice Event #<% $hashref->{eventpart} ? $hashref->{eventpart} : "(NEW)" %> % 'cancel' => { % 'name' => 'Cancel', % 'code' => '$cust_main->cancel(reason => %%%creason%%%);', -% 'weight' => 10, +% 'weight' => 90, #10, % 'reason' => 'C', % }, % -- cgit v1.2.1 From b71873db073f01923fa12acd6ec4c127a742eaea Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 3 Oct 2009 22:09:34 +0000 Subject: cancel to 80, comp @ 90, RT#5674 --- httemplate/edit/part_bill_event.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_bill_event.cgi b/httemplate/edit/part_bill_event.cgi index 625d83477..c0ff38689 100755 --- a/httemplate/edit/part_bill_event.cgi +++ b/httemplate/edit/part_bill_event.cgi @@ -178,7 +178,7 @@ Invoice Event #<% $hashref->{eventpart} ? $hashref->{eventpart} : "(NEW)" %> % 'cancel' => { % 'name' => 'Cancel', % 'code' => '$cust_main->cancel(reason => %%%creason%%%);', -% 'weight' => 90, #10, +% 'weight' => 80, #10, % 'reason' => 'C', % }, % @@ -191,7 +191,7 @@ Invoice Event #<% $hashref->{eventpart} ? $hashref->{eventpart} : "(NEW)" %> % 'comp' => { % 'name' => 'Pay invoice with a complimentary "payment"', % 'code' => '$cust_bill->comp();', -% 'weight' => 30, +% 'weight' => 90, #30, % }, % % 'credit' => { -- cgit v1.2.1 From 0a9ebd32a067d4a1d49c1184f7ae28bcf209c0e4 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 4 Oct 2009 00:07:49 +0000 Subject: doc --- httemplate/elements/popup_link-cust_main.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/elements/popup_link-cust_main.html b/httemplate/elements/popup_link-cust_main.html index 6d92301b1..454fcc4c8 100644 --- a/httemplate/elements/popup_link-cust_main.html +++ b/httemplate/elements/popup_link-cust_main.html @@ -4,7 +4,7 @@ Example: include('/elements/init_overlib.html') - include( '/elements/cust_popup_link.html', { #hashref or a list, either way + include( '/elements/popup_link-cust_main.html', { #hashref or a list, either way #required 'action' => 'content.html', # uri for content of popup which should -- cgit v1.2.1 From 2c35c432f6cd3be7e40edd360b1d91eb788ed55e Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 4 Oct 2009 00:08:42 +0000 Subject: more room for cancellation reason --- httemplate/view/cust_main.cgi | 1 + 1 file changed, 1 insertion(+) (limited to 'httemplate') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 3e5a8cee3..314207bb0 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -40,6 +40,7 @@ function areyousure(href, message) { 'actionlabel' => 'Confirm Cancellation', 'color' => '#ff0000', 'cust_main' => $cust_main, + 'width' => 616, #make room for reasons } ) %> | -- cgit v1.2.1 From 3a02e398ce013116c6ee97fc18472a6f40e0798d Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 4 Oct 2009 02:09:14 +0000 Subject: delete invoices, RT#4048 --- httemplate/misc/delete-cust_bill.html | 21 ++++++++++++ httemplate/view/cust_bill.cgi | 37 ++++++++++++++++------ httemplate/view/cust_main/payment_history.html | 2 +- .../view/cust_main/payment_history/invoice.html | 19 ++++++++--- 4 files changed, 65 insertions(+), 14 deletions(-) create mode 100644 httemplate/misc/delete-cust_bill.html (limited to 'httemplate') diff --git a/httemplate/misc/delete-cust_bill.html b/httemplate/misc/delete-cust_bill.html new file mode 100644 index 000000000..3a642b0e9 --- /dev/null +++ b/httemplate/misc/delete-cust_bill.html @@ -0,0 +1,21 @@ +% if ( $error ) { +% errorpage($error); +% } else { +<% $cgi->redirect($p. "view/cust_main.cgi?". $custnum) %> +% } +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Delete invoices'); + +#untaint invnum +my($query) = $cgi->keywords; +$query =~ /^(\d+)$/ || die "Illegal crednum"; +my $invnum = $1; + +my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); +my $custnum = $cust_bill->custnum; + +my $error = $cust_bill->delete; + + diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi index 2673e8239..5540221d9 100755 --- a/httemplate/view/cust_bill.cgi +++ b/httemplate/view/cust_bill.cgi @@ -2,10 +2,31 @@ "View this customer (#$display_custnum)" => "${p}view/cust_main.cgi?$custnum", )) %> +% if ( $conf->exists('deleteinvoices') +% && $curuser->access_right('Delete invoices' ) +% ) +% { + + + + Delete this invoice +

+ +% } % if ( $cust_bill->owed > 0 % && scalar( grep $payby{$_}, qw(BILL CASH WEST MCRD) ) -% && $FS::CurrentUser::CurrentUser->access_right('Post payment') +% && $curuser->access_right('Post payment') % && ! $conf->exists('pkg-balances') % ) % { @@ -37,8 +58,7 @@ % } - -% if ( $FS::CurrentUser::CurrentUser->access_right('Resend invoices') ) { +% if ( $curuser->access_right('Resend invoices') ) { Re-print this invoice @@ -54,10 +74,9 @@ % } - % if ( $conf->exists('invoice_latex') ) { - View typeset invoice + View typeset invoice PDF

% } @@ -83,8 +102,10 @@ <% include('/elements/footer.html') %> <%init> +my $curuser = $FS::CurrentUser::CurrentUser; + die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('View invoices'); + unless $curuser->access_right('View invoices'); #untaint invnum my($query) = $cgi->keywords; @@ -105,7 +126,7 @@ my $cust_bill = qsearchs({ 'table' => 'cust_bill', 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )', 'hashref' => { 'invnum' => $invnum }, - 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, + 'extra_sql' => ' AND '. $curuser->agentnums_sql, }); die "Invoice #$invnum not found!" unless $cust_bill; @@ -117,5 +138,3 @@ my $display_custnum = $cust_bill->cust_main->display_custnum; my $link = $templatename ? "$templatename-$invnum" : $invnum; - - diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index 0050daf9d..2ac3f2633 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -379,7 +379,7 @@ my %opt = ( qw( card_refund-days ) ), ( map { $_ => $conf->exists($_) } - qw( deletepayments deleterefunds pkg-balances ) + qw( deleteinvoices deletepayments deleterefunds pkg-balances ) ) ); diff --git a/httemplate/view/cust_main/payment_history/invoice.html b/httemplate/view/cust_main/payment_history/invoice.html index 39c67396e..c0d32df4d 100644 --- a/httemplate/view/cust_main/payment_history/invoice.html +++ b/httemplate/view/cust_main/payment_history/invoice.html @@ -1,9 +1,11 @@ -<% $link %><% $pre %>Invoice #<% $invnum %> -(Balance $ <% $cust_bill->owed %>)<% $post %><% $link ? '' : '' %><% $events %> +<% $link %><% $pre %>Invoice #<% $cust_bill->display_invnum %> +(Balance $ <% $cust_bill->owed %>)<% $post %><% $link ? '' : '' %><% $delete %><% $events %> <%init> my( $cust_bill, %opt ) = @_; +my $conf = new FS::Conf; + my $curuser = $FS::CurrentUser::CurrentUser; my($pre, $post) = ('', ''); @@ -18,6 +20,15 @@ my $link = $curuser->access_right('View invoices') ? qq!! : ''; +my $delete = ''; +if ( $opt{'deleteinvoices'} && $curuser->access_right('Delete invoices') ) { + $delete = qq! (delete)!; +} + my $events = ''; #1.9 if ( $cust_bill->num_cust_event @@ -26,8 +37,8 @@ if ( $cust_bill->num_cust_event ) ) { $events = - qq!
( View invoice events )'; + qq!
( View invoice events )'; } # -- cgit v1.2.1 From 947c1f964f1304242f8a6ffabacccf040f1d505e Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 5 Oct 2009 00:49:34 +0000 Subject: leading summary page invoices #RT5086 --- httemplate/browse/pkg_category.html | 6 +++--- httemplate/edit/pkg_category.html | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/pkg_category.html b/httemplate/browse/pkg_category.html index 20bf1a8df..e85c0dd9c 100644 --- a/httemplate/browse/pkg_category.html +++ b/httemplate/browse/pkg_category.html @@ -9,9 +9,9 @@ 'extra_sql' => 'ORDER BY categorynum', }, 'count_query' => $count_query, - 'header' => [ '#', 'Category' ], - 'fields' => [ 'categorynum', 'categoryname' ], - 'links' => [ $link, $link ], + 'header' => [ '#', 'Category', 'Weight' ], + 'fields' => [ 'categorynum', 'categoryname', 'weight' ], + 'links' => [ $link, $link, $link ], ) %> diff --git a/httemplate/edit/pkg_category.html b/httemplate/edit/pkg_category.html index fdc8da638..a07dc5842 100644 --- a/httemplate/edit/pkg_category.html +++ b/httemplate/edit/pkg_category.html @@ -3,11 +3,13 @@ 'table' => 'pkg_category', 'fields' => [ 'categoryname', + 'weight', { field=>'disabled', type=>'checkbox', value=>'Y', }, ], 'labels' => { 'categorynum' => 'Category number', 'categoryname' => 'Category name', + 'weight' => 'Weight', 'disabled' => 'Disable category', }, 'viewall_dir' => 'browse', -- cgit v1.2.1 From 0c2679eee18b3b073bc91657fcf85c5dd2e5efc0 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 5 Oct 2009 02:16:46 +0000 Subject: add manual_process-display config to subtract fee from amount instead of adding, RT#5889 --- httemplate/misc/payment.cgi | 27 ++++++++++++++++++++------- httemplate/misc/process/payment.cgi | 13 ++++++++++--- 2 files changed, 30 insertions(+), 10 deletions(-) (limited to 'httemplate') diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi index 472763b2d..d35e73f14 100644 --- a/httemplate/misc/payment.cgi +++ b/httemplate/misc/payment.cgi @@ -10,8 +10,6 @@ % #include( '/elements/table.html', '#cccccc' ) -% my $amount = $balance > 0 ? sprintf("%.2f", $balance) : ''; - <% ntable('#cccccc') %>
@@ -32,14 +30,14 @@
Freeside IDService #TitleDate
$custnum$svcnum$title$date
Payment amount % if ( $fee ) { - - + + + <% $fee_op %> <% $money_char . $fee %> <% $fee_pkg->pkg |h %> = - <% length($amount) ? $money_char. sprintf('%.2f', $amount + $fee ) : '' %> TOTAL + <% length($amount) ? $money_char. sprintf('%.2f', ($fee_display eq 'add') ? $amount + $fee : $amount - $fee ) : '' %> <% $fee_display eq 'add' ? 'TOTAL' : 'AVAILABLE' %> % }
@@ -55,13 +53,13 @@ var total = ''; if ( what.value.length ) { - total = parseFloat(what.value) + <% $fee %>; + total = parseFloat(what.value) <% $fee_op %> <% $fee %>; /* total = Math.round(total*100)/100; */ total = '<% $money_char %>' + total.toFixed(2); } var total_cell = document.getElementById('ajax_total_cell'); - total_cell.innerHTML = '' + total + ' TOTAL'; + total_cell.innerHTML = '' + total + ' <% $fee_display eq 'add' ? 'TOTAL' : 'AVAILABLE' %>'; } @@ -300,7 +298,13 @@ my @states = sort { $a cmp $b } keys %states; my $fee = ''; my $fee_pkg = ''; +my $fee_display = ''; +my $fee_op = ''; if ( $conf->config('manual_process-pkgpart') ) { + + $fee_display = $conf->config('manual_process-display') || 'add'; + $fee_op = $fee_display eq 'add' ? '+' : '-'; + $fee_pkg = qsearchs('part_pkg', { pkgpart=>$conf->config('manual_process-pkgpart') } ); @@ -308,6 +312,15 @@ if ( $conf->config('manual_process-pkgpart') ) { # (though ->unit_setup doesn't use it...) $fee = $fee_pkg->option('setup_fee') if $fee_pkg; #in case.. better than dying with a perl traceback + +} + +my $amount = ''; +if ( $balance > 0 ) { + $amount = $balance; + $amount += $fee + if $fee && $fee_display eq 'subtract'; + $amount = sprintf("%.2f", $amount); } my $payunique = "webui-payment-". time. "-$$-". rand() * 2**32; diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi index d41bc0f14..1e9501df8 100644 --- a/httemplate/misc/process/payment.cgi +++ b/httemplate/misc/process/payment.cgi @@ -150,11 +150,18 @@ if ( $cgi->param('batch') ) { #no error, so order the fee package if applicable... if ( $cgi->param('fee_pkgpart') =~ /^(\d+)$/ ) { - my $error = $cust_main->order_pkg( - 'cust_pkg' => new FS::cust_pkg { 'pkgpart' => $1 } - ); + + my $cust_pkg = new FS::cust_pkg { 'pkgpart' => $1 }; + + my $error = $cust_main->order_pkg( 'cust_pkg' => $cust_pkg ); errorpage("payment processed successfully, but error ordering fee: $error") if $error; + + #and generate an invoice for it now too + $error = $cust_main->bill( 'pkg_list' => [ $cust_pkg ] ); + errorpage("payment processed and fee ordered sucessfully, but error billing fee: $error") + if $error; + } $cust_main->apply_payments; -- cgit v1.2.1 From 357b4e26965895666685590d59f72de331fecb08 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 5 Oct 2009 02:36:03 +0000 Subject: add manual_process-skip_first option, RT#5889 --- httemplate/misc/payment.cgi | 2 ++ 1 file changed, 2 insertions(+) (limited to 'httemplate') diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi index d35e73f14..ada925c55 100644 --- a/httemplate/misc/payment.cgi +++ b/httemplate/misc/payment.cgi @@ -302,6 +302,8 @@ my $fee_display = ''; my $fee_op = ''; if ( $conf->config('manual_process-pkgpart') ) { + last if $conf->exists('manual_process-skip_first') && ! $cust_main->cust_pay; + $fee_display = $conf->config('manual_process-display') || 'add'; $fee_op = $fee_display eq 'add' ? '+' : '-'; -- cgit v1.2.1 From 331e3441a2eb49396ed3234da33022ce25244974 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 5 Oct 2009 02:40:28 +0000 Subject: add manual_process-skip_first option, RT#5889 --- httemplate/misc/payment.cgi | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi index ada925c55..8d7baa5da 100644 --- a/httemplate/misc/payment.cgi +++ b/httemplate/misc/payment.cgi @@ -300,9 +300,10 @@ my $fee = ''; my $fee_pkg = ''; my $fee_display = ''; my $fee_op = ''; -if ( $conf->config('manual_process-pkgpart') ) { - - last if $conf->exists('manual_process-skip_first') && ! $cust_main->cust_pay; +if ( $conf->config('manual_process-pkgpart') + and ! $conf->exists('manual_process-skip_first') || $cust_main->cust_pay + ) +{ $fee_display = $conf->config('manual_process-display') || 'add'; $fee_op = $fee_display eq 'add' ? '+' : '-'; -- cgit v1.2.1 From 8941cdf14a441e17e2c61e41beb3e7bdbaa0988e Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 5 Oct 2009 14:01:05 +0000 Subject: low hanging fruit: restore router virtual fields (and svcnum) in 1.9 RT#5960 --- httemplate/edit/router.cgi | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'httemplate') diff --git a/httemplate/edit/router.cgi b/httemplate/edit/router.cgi index 19e63b3e8..d1376780f 100755 --- a/httemplate/edit/router.cgi +++ b/httemplate/edit/router.cgi @@ -10,10 +10,12 @@ 'fields' => [ { 'field'=>'routername', 'type'=>'text', 'size'=>32 }, { 'field'=>'agentnum', 'type'=>'select-agent' }, + { 'field'=>'svcnum', 'type'=>'hidden' }, ], 'error_callback' => $callback, 'edit_callback' => $callback, 'new_callback' => $callback, + 'html_table_bottom' => $html_table_bottom, ) %> <%init> @@ -41,4 +43,11 @@ my $callback = sub { } }; +my $html_table_bottom = sub { + my $router = shift; + foreach my $field ($router->virtual_fields) { + $html .= $router->pvf($field)->widget('HTML', 'edit', $router->get($field)); + } + $html; +}; -- cgit v1.2.1 From cf86f3223d1e30853f52c0f5a7a6331f27aed9cb Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 5 Oct 2009 14:04:10 +0000 Subject: low hanging fruit: improvement in tax location selection RT#6000 --- httemplate/edit/cust_main/bottomfixup.js | 2 ++ httemplate/edit/cust_main/choose_tax_location.html | 6 ++++-- httemplate/edit/cust_main/contact.html | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main/bottomfixup.js b/httemplate/edit/cust_main/bottomfixup.js index d6d4f920f..1a06d9497 100644 --- a/httemplate/edit/cust_main/bottomfixup.js +++ b/httemplate/edit/cust_main/bottomfixup.js @@ -197,6 +197,7 @@ function post_standardization() { var country_el = cf.elements['<% $taxpre %>country']; var country = country_el.options[ country_el.selectedIndex ].value; + var geocode = cf.elements['geocode'].value; if ( country == 'CA' || country == 'US' ) { @@ -209,6 +210,7 @@ function post_standardization() { ";state=" + state + ";zip=" + cf.elements['<% $taxpre %>zip'].value + ";country=" + country + + ";geocode=" + geocode + ";"; // popup a chooser diff --git a/httemplate/edit/cust_main/choose_tax_location.html b/httemplate/edit/cust_main/choose_tax_location.html index be93a5de8..ac475c54b 100644 --- a/httemplate/edit/cust_main/choose_tax_location.html +++ b/httemplate/edit/cust_main/choose_tax_location.html @@ -1,5 +1,6 @@

Choose tax location

+

the geocode is:<% $header %>

<% $header %>

@@ -22,6 +22,6 @@ my %opt = @_; my $classnum = $opt{'curr_value'} || $opt{'value'}; -$opt{'pkg_class'} ||= [ qsearch( 'pkg_class', {} ) ]; # { disabled=>'' } ) +my $count = scalar( qsearch( 'pkg_class', {} ) ); -- cgit v1.2.1 From 7f46c75d39e2c888686f3d438604e7556ea00c26 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 5 Oct 2009 16:57:27 +0000 Subject: doh, fix error viewing voided payments, RT#6382 --- httemplate/view/cust_main/payment_history/voided_payment.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main/payment_history/voided_payment.html b/httemplate/view/cust_main/payment_history/voided_payment.html index 4438613a5..610372721 100644 --- a/httemplate/view/cust_main/payment_history/voided_payment.html +++ b/httemplate/view/cust_main/payment_history/voided_payment.html @@ -11,12 +11,12 @@ my $payby = $cust_pay_void->payby; my $payinfo; if ( $payby eq 'CARD' ) { - $payinfo = $cust_pay->paymask; + $payinfo = $cust_pay_void->paymask; } elsif ( $payby eq 'CHEK' ) { - my( $account, $aba ) = split('@', $cust_pay->paymask ); + my( $account, $aba ) = split('@', $cust_pay_void->paymask ); $payinfo = "ABA $aba, Acct #$account"; } else { - $payinfo = $cust_pay->payinfo; + $payinfo = $cust_pay_void->payinfo; } $payby =~ s/^BILL$/Check #/ if $payinfo; -- cgit v1.2.1 From 2caddb16574bf73c3687b959656b7ee2f851937f Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 5 Oct 2009 18:17:55 +0000 Subject: oops, handle old cust_main.pm properly (should we be bothering?) :/ RT#5889 --- httemplate/misc/payment.cgi | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi index 8d7baa5da..813b560bd 100644 --- a/httemplate/misc/payment.cgi +++ b/httemplate/misc/payment.cgi @@ -300,8 +300,12 @@ my $fee = ''; my $fee_pkg = ''; my $fee_display = ''; my $fee_op = ''; +my $num_payments = scalar($cust_main->cust_pay); +#handle old cust_main.pm (remove...) +$num_payments = scalar( @{ [ $cust_main->cust_pay ] } ) + unless defined $num_payments; if ( $conf->config('manual_process-pkgpart') - and ! $conf->exists('manual_process-skip_first') || $cust_main->cust_pay + and ! $conf->exists('manual_process-skip_first') || $num_payments ) { -- cgit v1.2.1 From 11b9239252db891d434626dacb7b9055d36fe904 Mon Sep 17 00:00:00 2001 From: jeff Date: Tue, 6 Oct 2009 15:49:04 +0000 Subject: replace disappearing line --- httemplate/edit/router.cgi | 1 + 1 file changed, 1 insertion(+) (limited to 'httemplate') diff --git a/httemplate/edit/router.cgi b/httemplate/edit/router.cgi index d1376780f..70eaa4576 100755 --- a/httemplate/edit/router.cgi +++ b/httemplate/edit/router.cgi @@ -45,6 +45,7 @@ my $callback = sub { my $html_table_bottom = sub { my $router = shift; + my $html = ''; foreach my $field ($router->virtual_fields) { $html .= $router->pvf($field)->widget('HTML', 'edit', $router->get($field)); } -- cgit v1.2.1 From 06187016fd78ba41fb82846b9e8d461405f316b6 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 7 Oct 2009 23:44:26 +0000 Subject: naming follow-up notices from the event rather than creting a slew of separate templates, RT#5217 --- httemplate/misc/email-statement.cgi | 19 ------------------- httemplate/misc/send-invoice.cgi | 30 ++++++++++++++++++++++++++++++ httemplate/misc/send-statement.cgi | 28 ++++++++++++++++++++++++++++ httemplate/search/cust_event.html | 23 ++++++++++++++--------- httemplate/view/cust_bill-pdf.cgi | 22 +++++++++++++++++----- httemplate/view/cust_bill-ps.cgi | 21 ++++++++++++++++----- httemplate/view/cust_bill.cgi | 37 ++++++++++++++++++++++++------------- httemplate/view/cust_statement.html | 9 +++++---- 8 files changed, 134 insertions(+), 55 deletions(-) delete mode 100755 httemplate/misc/email-statement.cgi create mode 100644 httemplate/misc/send-invoice.cgi create mode 100755 httemplate/misc/send-statement.cgi (limited to 'httemplate') diff --git a/httemplate/misc/email-statement.cgi b/httemplate/misc/email-statement.cgi deleted file mode 100755 index 67f654d64..000000000 --- a/httemplate/misc/email-statement.cgi +++ /dev/null @@ -1,19 +0,0 @@ -<% $cgi->redirect("${p}view/cust_main.cgi?$custnum") %> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Resend invoices'); - -#untaint statementnum -my($query) = $cgi->keywords; -$query =~ /^((.+)-)?(\d+)$/; -my $template = $2 || 'statement'; #XXX configure... via event?? eh.. -my $statementnum = $3; -my $cust_statement = qsearchs('cust_statement',{'statementnum'=>$statementnum}); -die "Can't find statement!\n" unless $cust_statement; - -$cust_statement->email($template); - -my $custnum = $cust_statement->getfield('custnum'); - - diff --git a/httemplate/misc/send-invoice.cgi b/httemplate/misc/send-invoice.cgi new file mode 100644 index 000000000..32dfe276d --- /dev/null +++ b/httemplate/misc/send-invoice.cgi @@ -0,0 +1,30 @@ +<% $cgi->redirect("${p}view/cust_main.cgi?$custnum") %> +<%once> + +my %method = ( map { $_=>1 } qw( email print fax_invoice ) ); + + +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Resend invoices'); + +my $invnum = $cgi->param('invnum'); +my $template = $cgi->param('template'); +my $notice_name = $cgi->param('notice_name') if $cgi->param('notice_name'); +my $method = $cgi->param('method'); + +$method .= '_invoice' if $method eq 'fax'; #! + +die "unknown method $method" unless $method{$method}; + +my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); +die "Can't find invoice!\n" unless $cust_bill; + +$cust_bill->$method({ 'template' => $template, + 'notice_name' => $notice_name, + }); + +my $custnum = $cust_bill->getfield('custnum'); + + diff --git a/httemplate/misc/send-statement.cgi b/httemplate/misc/send-statement.cgi new file mode 100755 index 000000000..e363fbd09 --- /dev/null +++ b/httemplate/misc/send-statement.cgi @@ -0,0 +1,28 @@ +<% $cgi->redirect("${p}view/cust_main.cgi?$custnum") %> +<%once> + +my %method = map { $_=>1 } qw( email print fax_invoice ); + + +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Resend invoices'); + +my $statementnum = $cgi->param('statementnum'); +my $template = $cgi->param('template') || 'statement'; #XXX configure... via event?? eh.. +my $notice_name = $cgi->param('notice_name') if $cgi->param('notice_name'); +my $method = $cgi->param('method'); + +$method .= '_invoice' if $method eq 'fax'; #! + +die "unknown method $method" unless $method{$method}; + +my $cust_statement = qsearchs('cust_statement',{'statementnum'=>$statementnum}); +die "Can't find statement!\n" unless $cust_statement; + +$cust_statement->$method({ 'template' => $template }); + +my $custnum = $cust_statement->getfield('custnum'); + + diff --git a/httemplate/search/cust_event.html b/httemplate/search/cust_event.html index 715d1ca9a..f8cf6b2a6 100644 --- a/httemplate/search/cust_event.html +++ b/httemplate/search/cust_event.html @@ -75,29 +75,34 @@ my $status_sub = sub { my $part_event = $cust_event->part_event; - if ( $part_event->eventtable eq 'cust_bill' && $part_event->templatename ) { - my $alt_templatename = $part_event->templatename; - my $alt_link = "$alt_templatename-". $cust_event->tablenum; + if ( $part_event->eventtable eq 'cust_bill' + && ( $part_event->templatename || $part_event->option('notice_name') ) + ) + { + my $link = 'invnum='. $cust_event->tablenum; + $link .= ';template='. uri_escape($part_event->templatename) + if $part_event->templatename; + $link .= ';notice_name='. uri_escape($part_event->option('notice_name')) + if $part_event->option('notice_name'); my $conf = new FS::Conf; my $cust_bill = $cust_event->cust_X; $status .= qq{ - ( view - | view - typeset - | re-print + ( view + | view typeset + | re-print }; if ( grep { $_ ne 'POST' } $cust_bill->cust_main->invoicing_list ) { $status .= qq{ - | re-email + | re-email }; } if ( $conf->exists('hylafax') && length($cust_bill->cust_main->fax) ) { $status .= qq{ - | re-fax + | re-fax } } diff --git a/httemplate/view/cust_bill-pdf.cgi b/httemplate/view/cust_bill-pdf.cgi index f09e1b74d..51e47e00d 100755 --- a/httemplate/view/cust_bill-pdf.cgi +++ b/httemplate/view/cust_bill-pdf.cgi @@ -4,11 +4,23 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('View invoices'); -#untaint invnum +my( $invnum, $template, $notice_name ); my($query) = $cgi->keywords; -$query =~ /^((.+)-)?(\d+)(.pdf)?$/; -my $templatename = $2; -my $invnum = $3; +if ( $query =~ /^((.+)-)?(\d+)(.pdf)?$/ ) { + $template = $2; + $invnum = $3; + $notice_name = 'Invoice'; +} else { + $invnum = $cgi->param('invnum'); + $invnum =~ s/\.pdf//i; + $template = $cgi->param('template'); + $notice_name = ( $cgi->param('notice_name') || 'Invoice' ); +} + +my %opt = ( + 'template' => $template, + 'notice_name' => $notice_name, +); my $cust_bill = qsearchs({ 'select' => 'cust_bill.*', @@ -19,7 +31,7 @@ my $cust_bill = qsearchs({ }); die "Invoice #$invnum not found!" unless $cust_bill; -my $pdf = $cust_bill->print_pdf( '', $templatename); +my $pdf = $cust_bill->print_pdf(\%opt); http_header('Content-Type' => 'application/pdf' ); http_header('Content-Length' => length($pdf) ); diff --git a/httemplate/view/cust_bill-ps.cgi b/httemplate/view/cust_bill-ps.cgi index 5313dbf02..881491f69 100755 --- a/httemplate/view/cust_bill-ps.cgi +++ b/httemplate/view/cust_bill-ps.cgi @@ -1,14 +1,25 @@ -<% $cust_bill->print_ps( '', $templatename) %> +<% $cust_bill->print_ps(\%opt) %> <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('View invoices'); -#untaint invnum +my( $invnum, $template, $notice_name ); my($query) = $cgi->keywords; -$query =~ /^((.+)-)?(\d+)$/; -my $templatename = $2; -my $invnum = $3; +if ( $query =~ /^((.+)-)?(\d+)(.pdf)?$/ ) { + $template = $2; + $invnum = $3; + $notice_name = 'Invoice'; +} else { + $invnum = $cgi->param('invnum'); + $template = $cgi->param('template'); + $notice_name = ( $cgi->param('notice_name') || 'Invoice' ); +} + +my %opt = ( + 'template' => $template, + 'notice_name' => $notice_name, +); my $cust_bill = qsearchs({ 'select' => 'cust_bill.*', diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi index 5540221d9..ce8d96a95 100755 --- a/httemplate/view/cust_bill.cgi +++ b/httemplate/view/cust_bill.cgi @@ -60,14 +60,14 @@ % if ( $curuser->access_right('Resend invoices') ) { - Re-print this invoice + Re-print this invoice % if ( grep { $_ ne 'POST' } $cust_bill->cust_main->invoicing_list ) { - | Re-email this invoice + | Re-email this invoice % } % if ( $conf->exists('hylafax') && length($cust_bill->cust_main->fax) ) { - | Re-fax this invoice + | Re-fax this invoice % }

@@ -76,7 +76,7 @@ % if ( $conf->exists('invoice_latex') ) { - View typeset invoice PDF + View typeset invoice PDF

% } @@ -92,11 +92,9 @@ <% $br ? '

' : '' %> % if ( $conf->exists('invoice_html') ) { - - <% join('', $cust_bill->print_html('', $templatename) ) %> + <% join('', $cust_bill->print_html(\%opt) ) %> % } else { - -
<% join('', $cust_bill->print_text('', $templatename) ) %>
+
<% join('', $cust_bill->print_text(\%opt) ) %>
% } <% include('/elements/footer.html') %> @@ -107,11 +105,22 @@ my $curuser = $FS::CurrentUser::CurrentUser; die "access denied" unless $curuser->access_right('View invoices'); -#untaint invnum +my( $invnum, $template, $notice_name ); my($query) = $cgi->keywords; -$query =~ /^((.+)-)?(\d+)$/; -my $templatename = $2; -my $invnum = $3; +if ( $query =~ /^((.+)-)?(\d+)$/ ) { + $template = $2; + $invnum = $3; + $notice_name = 'Invoice'; +} else { + $invnum = $cgi->param('invnum'); + $template = $cgi->param('template'); + $notice_name = $cgi->param('notice_name'); +} + +my %opt = ( + 'template' => $template, + 'notice_name' => $notice_name, +); my $conf = new FS::Conf; @@ -135,6 +144,8 @@ my $display_custnum = $cust_bill->cust_main->display_custnum; #my $printed = $cust_bill->printed; -my $link = $templatename ? "$templatename-$invnum" : $invnum; +my $link = "invnum=$invnum"; +$link .= ';template='. uri_escape($template) if $template; +$link .= ';notice_name='. $notice_name if $notice_name; diff --git a/httemplate/view/cust_statement.html b/httemplate/view/cust_statement.html index b078c9d07..74c80d3bc 100755 --- a/httemplate/view/cust_statement.html +++ b/httemplate/view/cust_statement.html @@ -4,16 +4,16 @@ % if ( $FS::CurrentUser::CurrentUser->access_right('Resend invoices') ) { -%# Re-print this statement +%# Re-print this statement % if ( grep { $_ ne 'POST' } $cust_statement->cust_main->invoicing_list ) { %# | - Re-email this statement + Re-email this statement % } % if ( 0 ) { % #if ( $conf->exists('hylafax') && length($cust_statement->cust_main->fax) ) { - | Re-fax this statement + | Re-fax this statement % }

@@ -73,6 +73,7 @@ die "Statement #$statementnum not found!" unless $cust_statement; my $custnum = $cust_statement->custnum; my $display_custnum = $cust_statement->cust_main->display_custnum; -my $link = $templatename ? "$templatename-$statementnum" : $statementnum; +my $link = "statementnum=$statementnum"; +$link .= ';template='. uri_escape($templatename) if $templatename; -- cgit v1.2.1 From eae101004801019c942e9dfccbea50a8165f5d6d Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 7 Oct 2009 23:51:33 +0000 Subject: naming follow-up notices from the event rather than creting a slew of separate templates, RT#5217 --- httemplate/view/cust_statement.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_statement.html b/httemplate/view/cust_statement.html index 74c80d3bc..3e1345ed5 100755 --- a/httemplate/view/cust_statement.html +++ b/httemplate/view/cust_statement.html @@ -24,7 +24,7 @@ % #if ( $conf->exists('invoice_latex') ) { % if ( 0 ) { #broken??? - View typeset statement + View typeset statement

% } -- cgit v1.2.1 From 3e13bcbded0bf2ce65d8fac4670ee18ecb9e371b Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 8 Oct 2009 08:28:37 +0000 Subject: fix "show old packages" accidentally hiding cancelled packages, RT#5276 --- httemplate/view/cust_main/packages.html | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 16adc8c5f..17a06911a 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -39,15 +39,14 @@ Current packages % ) % ) % { +% my $prev = $cgi->param('showcancelledpackages'); % $cgi->param('showcancelledpackages', 1); -% - ( show +% $cgi->param('showcancelledpackages', $prev); % } else { % $cgi->param('showcancelledpackages', 0); -% - ( hide +% $cgi->param('showcancelledpackages', 1); % } cancelled packages ) -- cgit v1.2.1 From bdf4497fd8d3778e9cc0f8b90dd8a742f3a84158 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 10 Oct 2009 00:00:32 +0000 Subject: change invoice terms for one-time charges (& bill them immediately), RT#5891 --- httemplate/edit/cust_main/billing.html | 12 ++---- httemplate/edit/process/quick-charge.cgi | 2 + httemplate/edit/quick-charge.html | 63 +++++++++++++++++++++++++++++--- httemplate/elements/select-terms.html | 26 +++++++++++++ 4 files changed, 89 insertions(+), 14 deletions(-) create mode 100644 httemplate/elements/select-terms.html (limited to 'httemplate') diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html index 363dd0419..ad83778ca 100644 --- a/httemplate/edit/cust_main/billing.html +++ b/httemplate/edit/cust_main/billing.html @@ -411,14 +411,10 @@ Invoice terms - + <% include('/elements/select-terms.html', + 'curr_value' => $cust_main->invoice_terms, + ) + %> diff --git a/httemplate/edit/process/quick-charge.cgi b/httemplate/edit/process/quick-charge.cgi index 8f0e42471..827530e50 100644 --- a/httemplate/edit/process/quick-charge.cgi +++ b/httemplate/edit/process/quick-charge.cgi @@ -55,6 +55,8 @@ unless ( $error ) { $error ||= $cust_main->charge( { 'amount' => $amount, 'quantity' => $quantity, + 'bill_now' => scalar($cgi->param('bill_now')), + 'invoice_terms' => scalar($cgi->param('invoice_terms')), 'start_date' => ( scalar($cgi->param('start_date')) ? str2time($cgi->param('start_date')) : '' diff --git a/httemplate/edit/quick-charge.html b/httemplate/edit/quick-charge.html index 75e3fee14..c96fa6c81 100644 --- a/httemplate/edit/quick-charge.html +++ b/httemplate/edit/quick-charge.html @@ -3,10 +3,10 @@ ) %> - - - - + + + + <% include('/elements/error.html') %> @@ -58,6 +58,23 @@ function validate_quick_charge () { return false; } +function bill_now_changed (what) { + var form = what.form; + if ( what.checked ) { + form.start_date_text.disabled = true; + form.start_date.style.backgroundColor = '#dddddd'; + form.start_date_button.style.display = 'none'; + form.start_date_button_disabled.style.display = ''; + form.invoice_terms.disabled = false; + } else { + form.start_date_text.disabled = false; + form.start_date.style.backgroundColor = '#ffffff'; + form.start_date_button.style.display = ''; + form.start_date_button_disabled.style.display = 'none'; + form.invoice_terms.disabled = true; + } +} + @@ -84,6 +101,25 @@ function validate_quick_charge () { <% include('/elements/tr-select-pkg_class.html', 'curr_value' => $cgi->param('classnum') ) %> + + Invoice now + + param('bill_now') ? 'CHECKED' : '' %> + onChange = "bill_now_changed(this);" + > + with terms + <% include('/elements/select-terms.html', + 'curr_value' => scalar($cgi->param('invoice_terms')), + 'empty_value' => $default_terms, + 'disabled' => ( $cgi->param('bill_now') ? 0 : 1 ), + ) + %> + + + %# false laziness w/misc/order_pkg.html Charge date @@ -93,11 +129,16 @@ function validate_quick_charge () { SIZE = 32 ID = "start_date_text" VALUE = "<% $start_date %>" + <% $cgi->param('bill_now') ? 'STYLE = "background-color:#dddddd" DISABLED' : '' %> > - + param('bill_now') ? '' : 'STYLE="display:none"' %> > (leave blank to charge immediately) @@ -232,4 +273,14 @@ $cgi->param('pkg') =~ /^([\w \!\@\#\$\%\&\(\)\-\+\;\:\'\"\,\.\?\/\=\[\]]*)$/ or die 'illegal description'; my $pkg = $1; +my $default_terms; +if ( $cust_main->invoice_terms ) { + $default_terms = 'Customer default ('. $cust_main->invoice_terms. ')'; +} else { + $default_terms = + 'Default ('. + ($conf->config('invoice_default_terms') || 'Payable upon receipt'). + ')'; +} + diff --git a/httemplate/elements/select-terms.html b/httemplate/elements/select-terms.html new file mode 100644 index 000000000..629d1e464 --- /dev/null +++ b/httemplate/elements/select-terms.html @@ -0,0 +1,26 @@ + +<%init> + +my %opt = @_; +my $curr_value = $opt{'curr_value'}; +my $conf = new FS::Conf; + +my $empty_label = + $opt{'empty_label'} + || 'Default ('. + ($conf->config('invoice_default_terms') || 'Payable upon receipt'). + ')'; + +my @terms = ( 'Payable upon receipt', + ( map "Net $_", 0, 10, 15, 20, 30, 45, 60 ), + ); + + -- cgit v1.2.1 From 00400cb0d7b4b06f63706b095184182fd7fd6f1e Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 11 Oct 2009 01:43:23 +0000 Subject: cleanup --- httemplate/browse/agent.cgi | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/agent.cgi b/httemplate/browse/agent.cgi index 3319c77b3..1c06f1b15 100755 --- a/httemplate/browse/agent.cgi +++ b/httemplate/browse/agent.cgi @@ -20,8 +20,6 @@ full offerings (via their type).

% my $bgcolor1 = '#eeeeee'; % my $bgcolor2 = '#ffffff'; % my $bgcolor = ''; -% - param('showdisabled') || !dbdef->table('agent')->column('disabled') ) ? 2 : 3 %>>Agent @@ -34,18 +32,17 @@ full offerings (via their type).

Reports Registration
codes
Prepaid cards -% if ( $conf->config('ticket_system') ) { +% if ( $conf->config('ticket_system') ) { Ticketing % } Payment Gateway Overrides Configuration Overrides -% + %# Agent # %# Agent -% %foreach my $agent ( sort { % #$a->getfield('agentnum') <=> $b->getfield('agentnum') % $a->getfield('agent') cmp $b->getfield('agent') @@ -61,9 +58,6 @@ full offerings (via their type).

% } else { % $bgcolor = $bgcolor1; % } -% -% - -- cgit v1.2.1 From b042235d094f39118023c3af8995967ee4fb738f Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 11 Oct 2009 01:43:59 +0000 Subject: doc --- httemplate/elements/selectlayers.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/elements/selectlayers.html b/httemplate/elements/selectlayers.html index a85cea193..89fe41b1b 100644 --- a/httemplate/elements/selectlayers.html +++ b/httemplate/elements/selectlayers.html @@ -14,7 +14,7 @@ Example: #XXX put this handling it its own selectlayers-fields.html element? 'layer_prefix' => 'prefix_', #optional prefix for fieldnames - 'layer_fields' => [ 'layer' => [ 'fieldname', + 'layer_fields' => { 'layer' => [ 'fieldname', { label => 'fieldname2', type => 'text', #implemented: # text, money, fixed, @@ -23,6 +23,7 @@ Example: # select, select-agent, # select-pkg_class, # select-part_referral, + # select-taxclass, # select-table, #XXX tbd: # more? @@ -32,6 +33,7 @@ Example: 'layer2' => [ 'l2fieldname', ... ], + }, #current values for layer fields above 'layer_values' => { 'layer' => { 'fieldname' => 'current_value', -- cgit v1.2.1 From 70e177c0844dea5069124f105294d4f6df88929e Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 11 Oct 2009 01:44:47 +0000 Subject: respect element_name --- httemplate/elements/tr-select-pkg_class.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/elements/tr-select-pkg_class.html b/httemplate/elements/tr-select-pkg_class.html index 1c04314ed..ece4b58c0 100644 --- a/httemplate/elements/tr-select-pkg_class.html +++ b/httemplate/elements/tr-select-pkg_class.html @@ -1,6 +1,6 @@ % if ( $count == 0 ) { - + % } else { -- cgit v1.2.1 From 6dd0391446cc480edad04259b4e2f541c49c8ab8 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 11 Oct 2009 01:45:01 +0000 Subject: new rows and cols options --- httemplate/elements/tr-textarea.html | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'httemplate') diff --git a/httemplate/elements/tr-textarea.html b/httemplate/elements/tr-textarea.html index fb41ac38f..ae2ef81b6 100644 --- a/httemplate/elements/tr-textarea.html +++ b/httemplate/elements/tr-textarea.html @@ -4,6 +4,8 @@ @@ -19,6 +21,9 @@ 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'}; -- cgit v1.2.1 From 3501246417cacd5614a32ac1fe487a230ebb632d Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 11 Oct 2009 01:45:24 +0000 Subject: end form --- httemplate/search/report_cdr.html | 2 ++ 1 file changed, 2 insertions(+) (limited to 'httemplate') diff --git a/httemplate/search/report_cdr.html b/httemplate/search/report_cdr.html index f3ad1e69f..c685198d9 100644 --- a/httemplate/search/report_cdr.html +++ b/httemplate/search/report_cdr.html @@ -115,6 +115,8 @@
+ + <% include('/elements/footer.html') %> <%init> -- cgit v1.2.1 From ed6084d4ccabb81493ffa1ee42c2afd237c05f45 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 11 Oct 2009 01:45:53 +0000 Subject: don't try to follow a blank redirect --- httemplate/search/elements/search-html.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/search/elements/search-html.html b/httemplate/search/elements/search-html.html index 60dd65a5c..297774dfd 100644 --- a/httemplate/search/elements/search-html.html +++ b/httemplate/search/elements/search-html.html @@ -1,5 +1,6 @@ % -% if ( exists($opt{'redirect'}) && scalar(@$rows) == 1 && $total == 1 +% if ( exists($opt{'redirect'}) && $opt{'redirect'} +% && scalar(@$rows) == 1 && $total == 1 % && $type ne 'html-print' % ) { % my $redirect = $opt{'redirect'}; -- cgit v1.2.1