summaryrefslogtreecommitdiff
path: root/httemplate/browse
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/browse')
-rw-r--r--httemplate/browse/acct_snarf.html78
-rw-r--r--httemplate/browse/cgp_rule.html3
-rw-r--r--httemplate/browse/msg_template.html2
-rw-r--r--httemplate/browse/part_event.html2
-rwxr-xr-xhttemplate/browse/part_pkg.cgi59
5 files changed, 137 insertions, 7 deletions
diff --git a/httemplate/browse/acct_snarf.html b/httemplate/browse/acct_snarf.html
new file mode 100644
index 0000000..f610994
--- /dev/null
+++ b/httemplate/browse/acct_snarf.html
@@ -0,0 +1,78 @@
+<% include('elements/browse.html',
+ 'title' => "Remote POP accounts for $svc_label: $svc_value",
+ 'name_singular' => 'Remote POP account',
+ 'html_init' => $html_init,
+ 'query' => { 'table' => 'acct_snarf',
+ 'hashref' => { 'svcnum' => $svcnum },
+ #'order_by' => 'ORDER BY priority DESC',
+ },
+ 'count_query' => $count_query,
+ 'header' => [ 'Name',
+ 'Mail server',
+ 'Username',
+ #'Password',
+ 'Poll every',
+ #'Options',
+ 'Leave',
+ 'APOP',
+ 'TLS',
+ 'Mailbox',
+ '', #delete
+ ],
+ 'fields' => [ 'snarfname',
+ 'machine',
+ 'username',
+ sub { FS::acct_snarf->check_freq_labels->{shift->check_freq} },
+ 'leave',
+ 'apop',
+ 'tls',
+ 'mailbox',
+ ],
+ #'align'
+ 'links' => [ $edit_sub, $edit_sub, $edit_sub, '',
+ '', '', '', '', $del_sub ],
+ )
+%>
+<%init>
+
+$cgi->param('svcnum') =~ /^(\d+)$/ or die 'no svcnum';
+my $svcnum = $1;
+
+#agent virt so you can't do cross-agent snarfing
+my $cust_svc = qsearchs('cust_svc', { 'svcnum' => $svcnum })
+ or die 'unknown svcnum';
+my $part_svc = $cust_svc->part_svc;
+
+my $count_query = "SELECT COUNT(*) FROM acct_snarf WHERE svcnum = $svcnum";
+
+my($svc_label, $svc_value, $svcdb) = $cust_svc->label;
+
+my $view = FS::UI::Web::svc_url( 'm' => $m,
+ 'action' => 'view',
+ 'part_svc' => $part_svc,
+ 'svc' => $cust_svc,
+ );
+
+my $html_init =
+ qq(<A HREF="$view">View this $svc_label</A><BR><BR>).
+ qq!<A HREF="${p}edit/acct_snarf.html?svcnum=$svcnum">Add new remote POP account</A><BR>!.
+ '<BR>'.
+ qq!
+ <SCRIPT>
+ function areyousure_delete(href) {
+ areyousure(href,"Are you sure you want to delete this remote POP account?");
+ }
+ function areyousure(href,message) {
+ if (confirm(message) == true)
+ window.location.href = href;
+ }
+ </SCRIPT>
+!;
+
+my $edit_sub = [ $p.'edit/acct_snarf.html?', 'snarfnum' ];
+my $del_sub = sub {
+ my $snarfnum = shift->snarfnum;
+ [ "javascript:areyousure_delete('${p}misc/delete-acct_snarf.html?$snarfnum')", '' ];
+};
+
+</%init>
diff --git a/httemplate/browse/cgp_rule.html b/httemplate/browse/cgp_rule.html
index 8a427b8..8ea7571 100644
--- a/httemplate/browse/cgp_rule.html
+++ b/httemplate/browse/cgp_rule.html
@@ -44,11 +44,12 @@ my $html_init =
if ( $part_svc->svcdb eq 'svc_domain' ) {
- #areyousure for adding these?
+ #XXX add areyousure javscript confirmation for adding these
foreach my $line ( FS::Conf->new->config('cgp_rule-domain_templates') ) {
$line =~ /^\s*(\d+)\s+(.+)\s*$/ or next;
my($t_svcnum, $t_name) = ( $1, $2 );
+ next if $t_svcnum == $svcnum;
$html_init .=
qq!<A HREF="${p}misc/clone-cgp_rule.html?clone=$t_svcnum;svcnum=$svcnum">!
."Add $t_name rule</A><BR>";
diff --git a/httemplate/browse/msg_template.html b/httemplate/browse/msg_template.html
index 0cd33c7..252ee1f 100644
--- a/httemplate/browse/msg_template.html
+++ b/httemplate/browse/msg_template.html
@@ -9,7 +9,7 @@
'disableable' => 1,
'disabled_statuspos' => 2,
'agent_virt' => 1,
- 'agent_null_right' => 'Edit global templates',
+ 'agent_null_right' => ['Edit global templates','Configuration'],
'agent_pos' => 3,
'header' => [ 'Name' ],
'fields' => [ 'msgname' ],
diff --git a/httemplate/browse/part_event.html b/httemplate/browse/part_event.html
index 3d7c245..f68f06b 100644
--- a/httemplate/browse/part_event.html
+++ b/httemplate/browse/part_event.html
@@ -150,7 +150,7 @@ my $html_init =
foreach my $part_event ( qsearch('part_event', {'diabled'=>''}) ) {
$html_init .= '<OPTION VALUE="'. $part_event->eventpart. '">'.
- $part_event->event. '</OPTION>';
+ $part_event->eventpart. ': '. $part_event->event. '</OPTION>';
}
$html_init .= '</SELECT><INPUT TYPE="submit" VALUE="Clone existing event">'.
diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi
index 42eb5df..26e0170 100755
--- a/httemplate/browse/part_pkg.cgi
+++ b/httemplate/browse/part_pkg.cgi
@@ -32,6 +32,7 @@ my $acl_edit = $curuser->access_right($edit);
my $acl_edit_global = $curuser->access_right($edit_global);
my $acl_config = $curuser->access_right('Configuration'); #to edit services
#and agent types
+ #and bulk change
die "access denied"
unless $acl_edit || $acl_edit_global;
@@ -96,6 +97,13 @@ $select = "
*,
( $count_cust_pkg
+ AND ( setup IS NULL OR setup = 0 )
+ AND ( cancel IS NULL OR cancel = 0 )
+ AND ( susp IS NULL OR susp = 0 )
+ ) AS num_not_yet_billed,
+
+ ( $count_cust_pkg
+ AND setup IS NOT NULL AND setup != 0
AND ( cancel IS NULL OR cancel = 0 )
AND ( susp IS NULL OR susp = 0 )
) AS num_active,
@@ -195,6 +203,9 @@ push @fields, sub {
my $part_pkg = shift;
(my $plan = $plan_labels{$part_pkg->plan} ) =~ s/ /&nbsp;/g;
my $is_recur = ( $part_pkg->freq ne '0' );
+ my @discounts = sort { $a->months <=> $b->months }
+ map { $_->discount }
+ $part_pkg->part_pkg_discount;
[
[
@@ -238,6 +249,28 @@ push @fields, sub {
}
$part_pkg->bill_part_pkg_link
),
+ ( scalar(@discounts)
+ ? [
+ { data => '<b>Discounts</b>',
+ align=>'center', #?
+ colspan=>2,
+ }
+ ]
+ : ()
+ ),
+ ( scalar(@discounts)
+ ? map {
+ [
+ { data => $_->months. ':',
+ align => 'right',
+ },
+ { data => $_->amount ? '$'. $_->amount : $_->percent. '%'
+ }
+ ]
+ }
+ @discounts
+ : ()
+ ),
];
# $plan_labels{$part_pkg->plan}.'<BR>'.
@@ -284,6 +317,7 @@ if ( $acl_edit_global ) {
#if ( $cgi->param('active') ) {
push @header, 'Customer<BR>packages';
my %col = (
+ 'not yet billed' => '009999', #teal? cyan?
'active' => '00CC00',
'suspended' => 'FF9900',
'cancelled' => 'FF0000',
@@ -292,8 +326,8 @@ if ( $acl_edit_global ) {
);
my $cust_pkg_link = $p. 'search/cust_pkg.cgi?pkgpart=';
push @fields, sub { my $part_pkg = shift;
- [
- map {
+ [
+ map( {
my $magic = $_;
my $label = $_;
if ( $magic eq 'active' && $part_pkg->freq == 0 ) {
@@ -301,6 +335,7 @@ if ( $acl_edit_global ) {
#$label = 'one-time charge',
$label = 'charge',
}
+ $label= 'not yet billed' if $magic eq 'not_yet_billed';
[
{
@@ -325,8 +360,24 @@ if ( $acl_edit_global ) {
),
},
],
- } (qw( active suspended cancelled ))
- ]; };
+ } (qw( not_yet_billed active suspended cancelled ))
+ ),
+ ($acl_config ?
+ [ {},
+ { 'data' => '<FONT SIZE="-1">[ '.
+ include('/elements/popup_link.html',
+ 'label' => 'change',
+ 'action' => "${p}edit/bulk-cust_pkg.html?".
+ 'pkgpart='.$part_pkg->pkgpart,
+ 'actionlabel' => 'Change Packages',
+ 'width' => 569,
+ 'height' => 210,
+ ).' ]</FONT>',
+ 'align' => 'left',
+ }
+ ] : () ),
+ ];
+ };
$align .= 'r';
#}