summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FS/FS/Conf.pm17
-rw-r--r--FS/FS/access_user.pm28
-rwxr-xr-xhttemplate/edit/process/REAL_cust_pkg.cgi10
-rwxr-xr-xhttemplate/edit/process/part_pkg.cgi8
-rw-r--r--httemplate/edit/process/quick-cust_pkg.cgi9
-rw-r--r--httemplate/elements/menubar.html4
-rwxr-xr-xhttemplate/misc/process/link.cgi10
-rw-r--r--httemplate/pref/pref.html2
-rw-r--r--httemplate/search/cust_event.html7
-rwxr-xr-xhttemplate/search/cust_main.cgi10
-rwxr-xr-xhttemplate/search/cust_pkg.cgi15
-rwxr-xr-xhttemplate/view/cust_main.cgi7
12 files changed, 104 insertions, 23 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 0664c1444..8065f3b47 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -2827,6 +2827,23 @@ worry that config_items is freeside-specific and icky.
'type' => 'textarea',
},
+ {
+ 'key' => 'cust_main-default_view',
+ 'section' => 'UI',
+ 'description' => 'Default customer view, for users who have not selected a default view in their preferences.',
+ 'type' => 'select',
+ 'select_hash' => [
+ #false laziness w/view/cust_main.cgi and pref/pref.html
+ 'basics' => 'Basics',
+ 'notes' => 'Notes',
+ 'tickets' => 'Tickets',
+ 'packages' => 'Packages',
+ 'payment_history' => 'Payment History',
+ #'' => 'Change History',
+ 'jumbo' => 'Jumbo',
+ ],
+ },
+
);
1;
diff --git a/FS/FS/access_user.pm b/FS/FS/access_user.pm
index cf56fd8e3..e605c9035 100644
--- a/FS/FS/access_user.pm
+++ b/FS/FS/access_user.pm
@@ -1,7 +1,7 @@
package FS::access_user;
use strict;
-use vars qw( @ISA $DEBUG $me $htpasswd_file );
+use vars qw( @ISA $DEBUG $me $conf $htpasswd_file );
use FS::UID;
use FS::Conf;
use FS::Record qw( qsearch qsearchs dbh );
@@ -19,7 +19,7 @@ $me = '[FS::access_user]';
#kludge htpasswd for now (i hope this bootstraps okay)
FS::UID->install_callback( sub {
- my $conf = new FS::Conf;
+ $conf = new FS::Conf;
$htpasswd_file = $conf->base_dir. '/htpasswd';
} );
@@ -44,8 +44,8 @@ FS::access_user - Object methods for access_user records
=head1 DESCRIPTION
-An FS::access_user object represents an internal access user. FS::access_user inherits from
-FS::Record. The following fields are currently supported:
+An FS::access_user object represents an internal access user. FS::access_user
+inherits from FS::Record. The following fields are currently supported:
=over 4
@@ -274,6 +274,9 @@ sub name {
=item access_usergroup
+Returns links to the the groups this user is a part of, as FS::access_usergroup
+objects (see L<FS::access_usergroup).
+
=cut
sub access_usergroup {
@@ -467,6 +470,23 @@ sub access_right {
}
+=item default_customer_view
+
+Returns the default customer view for this user, from the
+"default_customer_view" user preference, the "cust_main-default_view" config,
+or the hardcoded default, "jumbo" (may change to "basics" in the near future).
+
+=cut
+
+sub default_customer_view {
+ my $self = shift;
+
+ $self->option('default_customer_view')
+ || $conf->config('cust_main-default_view')
+ || 'jumbo'; #'basics' in 1.9.1?
+
+}
+
=back
=head1 BUGS
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') %>
<SCRIPT TYPE="text/javascript">
// XXX fancy ajax rebuild table at some point, but a page reload will do for now
// XXX chop off trailing #target and replace... ?
- window.top.location = '<% popurl(3). "view/cust_main.cgi?keywords=$custnum;fragment=$frag#$frag" %>';
+ window.top.location = '<% popurl(3). "view/cust_main.cgi?custnum=$custnum$show;fragment=$frag#$frag" %>';
</SCRIPT>
@@ -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 <a href="https://secure.click2callu.com/">Click2Call</a>
<% 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;
</%init>