summaryrefslogtreecommitdiff
path: root/httemplate/edit/saved_search.html
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2016-09-08 11:26:12 -0700
committerMark Wells <mark@freeside.biz>2016-09-08 11:31:24 -0700
commitf2bc3af56683f64e44fbbb97b543e6d58e99ce28 (patch)
treeb64e5703809d64226f8d7a84447d76c5cd1aba3a /httemplate/edit/saved_search.html
parent9cb01b1aed97bcbe897e779dc268800a2b1538ae (diff)
fix UI links and CSS in searches delivered by email, #72101
Diffstat (limited to 'httemplate/edit/saved_search.html')
-rw-r--r--httemplate/edit/saved_search.html22
1 files changed, 22 insertions, 0 deletions
diff --git a/httemplate/edit/saved_search.html b/httemplate/edit/saved_search.html
index 3039aed35..cb6aa45d1 100644
--- a/httemplate/edit/saved_search.html
+++ b/httemplate/edit/saved_search.html
@@ -61,6 +61,28 @@
<%init>
my $curuser = $FS::CurrentUser::CurrentUser;
+# remember the user's rooturl() when accessing the UI. this will be the
+# base URL for sending email reports to that user so that links work.
+my $rooturl_pref = qsearchs('access_user_pref', {
+ usernum => $curuser->usernum,
+ prefname => 'rooturl',
+});
+my $error;
+if ($rooturl_pref) {
+ if ($rooturl_pref->prefvalue ne rooturl()) {
+ $rooturl_pref->set('prefvalue', rooturl());
+ $error = $rooturl_pref->replace;
+ } # else don't update it
+} else {
+ $rooturl_pref = FS::access_user_pref->new({
+ usernum => $curuser->usernum,
+ prefname => 'rooturl',
+ prefvalue => rooturl(),
+ });
+ $error = $rooturl_pref->insert;
+}
+
+warn "error updating rooturl pref: $error" if $error;
# prefix to the freeside document root (usually '/freeside/')
my $root = URI->new($fsurl)->path;