From: ivan Date: Wed, 8 Jul 2009 11:12:46 +0000 (+0000) Subject: borg RT menus, RT#1169 X-Git-Tag: root_of_svc_elec_features~1051 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=70569273833d91085c6c562865a78a08ddde49a1 borg RT menus, RT#1169 --- diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 10f5d0449..70dfa6851 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -2881,6 +2881,13 @@ worry that config_items is freeside-specific and icky. 'type' => 'checkbox', }, + { + 'key' => 'rt-crontool', + 'section' => '', + 'description' => 'Enable the RT CronTool extension.', + 'type' => 'checkbox', + }, + ); 1; diff --git a/FS/FS/Mason.pm b/FS/FS/Mason.pm index cce2dbf21..5e77b9893 100644 --- a/FS/FS/Mason.pm +++ b/FS/FS/Mason.pm @@ -384,6 +384,9 @@ sub mason_interps { ${$_[0]} = "'". ${$_[0]}. "'"; } }, + compiler => HTML::Mason::Compiler::ToObject->new( + allow_globals => [qw(%session)], + ), ); my $rt_interp = new HTML::Mason::Interp ( diff --git a/FS/FS/TicketSystem/RT_External.pm b/FS/FS/TicketSystem/RT_External.pm index 3a9c7e82d..c788c03a1 100644 --- a/FS/FS/TicketSystem/RT_External.pm +++ b/FS/FS/TicketSystem/RT_External.pm @@ -349,5 +349,10 @@ sub transaction_status { $self->_retrieve_single_value($sql); } +sub access_right { + warn "WARNING: no access rights available w/ external RT"; + 0; +} + 1; diff --git a/FS/FS/TicketSystem/RT_Internal.pm b/FS/FS/TicketSystem/RT_Internal.pm index d24a96c04..6ac3fc61f 100644 --- a/FS/FS/TicketSystem/RT_Internal.pm +++ b/FS/FS/TicketSystem/RT_Internal.pm @@ -1,13 +1,16 @@ package FS::TicketSystem::RT_Internal; use strict; -use vars qw( @ISA ); +use vars qw( @ISA $DEBUG ); use FS::UID qw(dbh); use FS::CGI qw(popurl); use FS::TicketSystem::RT_Libs; +use RT::CurrentUser; @ISA = qw( FS::TicketSystem::RT_Libs ); +$DEBUG = 1; + sub sql_num_customer_tickets { "( select count(*) from tickets join links on ( tickets.id = links.localbase ) @@ -25,5 +28,111 @@ sub baseurl { } } +#mapping/genericize?? +#ShowConfigTab ModifySelf +sub access_right { + my( $self, $session, $right ) = @_; + + #return '' unless $conf->config('ticket_system'); + return '' unless FS::Conf->new->config('ticket_system'); + + $self->_web_external_auth($session) + unless $session + && $session->{'CurrentUser'}; + + $session->{'CurrentUser'}->HasRight( Right => $right, + Object => $RT::System ); +} + +#shameless false laziness w/rt/html/autohandler to get logged into RT from afar +sub _web_external_auth { + my( $self, $session ) = @_; + + my $user = $FS::CurrentUser::CurrentUser->username; + + $session->{'CurrentUser'} = RT::CurrentUser->new(); + + warn "loading RT user for $user\n" + if $DEBUG; + + $session->{'CurrentUser'}->Load($user); + + if ( ! $session->{'CurrentUser'}->Id() ) { + + # Create users on-the-fly + + warn "can't load RT user for $user; auto-creating\n" + if $DEBUG; + + my $UserObj = RT::User->new( RT::CurrentUser->new('RT_System') ); + + my ( $val, $msg ) = $UserObj->Create( + %{ ref($RT::AutoCreate) ? $RT::AutoCreate : {} }, + Name => $user, + Gecos => $user, + ); + + if ($val) { + + # now get user specific information, to better create our user. + my $new_user_info + = RT::Interface::Web::WebExternalAutoInfo($user); + + # set the attributes that have been defined. + # FIXME: this is a horrible kludge. I'm sure there's something cleaner + foreach my $attribute ( + 'Name', 'Comments', + 'Signature', 'EmailAddress', + 'PagerEmailAddress', 'FreeformContactInfo', + 'Organization', 'Disabled', + 'Privileged', 'RealName', + 'NickName', 'Lang', + 'EmailEncoding', 'WebEncoding', + 'ExternalContactInfoId', 'ContactInfoSystem', + 'ExternalAuthId', 'Gecos', + 'HomePhone', 'WorkPhone', + 'MobilePhone', 'PagerPhone', + 'Address1', 'Address2', + 'City', 'State', + 'Zip', 'Country' + ) + { + #uhh, wrong root + #$m->comp( '/Elements/Callback', %ARGS, + # _CallbackName => 'NewUser' ); + + my $method = "Set$attribute"; + $UserObj->$method( $new_user_info->{$attribute} ) + if ( defined $new_user_info->{$attribute} ); + } + $session->{'CurrentUser'}->Load($user); + } + else { + + # we failed to successfully create the user. abort abort abort. + delete $session->{'CurrentUser'}; + + die "can't auto-create RT user"; #an error message would be nice :/ + #$m->abort() unless $RT::WebFallbackToInternalAuth; + #$m->comp( '/Elements/Login', %ARGS, + # Error => loc( 'Cannot create user: [_1]', $msg ) ); + } + } + + unless ( $session->{'CurrentUser'}->Id() ) { + delete $session->{'CurrentUser'}; + + die "can't auto-create RT user"; + #$user = $orig_user; + # + #if ($RT::WebExternalOnly) { + # $m->comp( '/Elements/Login', %ARGS, + # Error => loc('You are not an authorized user') ); + # $m->abort(); + #} + } + +} + 1; diff --git a/htetc/handler.pl b/htetc/handler.pl index 1dd16ec72..a9431d3a8 100644 --- a/htetc/handler.pl +++ b/htetc/handler.pl @@ -69,6 +69,8 @@ sub handler } else { + RT::Init() if $RT::VERSION; #for lack of something else + $ah->interp($fs_interp); } diff --git a/httemplate/elements/about_freeside.html b/httemplate/elements/about_freeside.html new file mode 100644 index 000000000..8084583da --- /dev/null +++ b/httemplate/elements/about_freeside.html @@ -0,0 +1,19 @@ + + <% include('/elements/popup_link.html', + 'action' => $fsurl.'docs/about.html', + 'label' => 'Freeside', + 'style' => 'color:#999999', + 'actionlabel' => 'About', + 'width' => 300, + 'height' => 360, + 'color' => '#7e0079', + 'scrolling' => 'no', + ) |n + %> v<% $FS::VERSION %>
+ " TARGET="_blank" STYLE="color:#999999">Documentation +
+<%init> + +my $conf = new FS::Conf; + + diff --git a/httemplate/elements/about_rt.html b/httemplate/elements/about_rt.html new file mode 100644 index 000000000..e3ee140c9 --- /dev/null +++ b/httemplate/elements/about_rt.html @@ -0,0 +1,13 @@ +% if ( $conf->config('ticket_system') eq 'RT_Internal' ) { +% eval "use RT;"; + + + RT v<% $RT::VERSION %>
+
Documentation +
+% } +<%init> + +my $conf = new FS::Conf; + + diff --git a/httemplate/elements/header.html b/httemplate/elements/header.html index 058756745..0bbd4fd8c 100644 --- a/httemplate/elements/header.html +++ b/httemplate/elements/header.html @@ -48,49 +48,16 @@ <% $etc |n %> STYLE="margin-top:0; margin-bottom:0; margin-left:0; margin-right:0"> - - + - - - -
freeside + freeside <% $company_name || 'ExampleCo' %> Logged in as <% getotaker %> 
Preferences 
-
- - - - -% if ( $conf->config('ticket_system') eq 'RT_Internal' ) { -% eval "use RT;"; - - - -% } - - - -
- - <% include('/elements/popup_link.html', - 'action' => $fsurl.'docs/about.html', - 'label' => 'Freeside', - 'actionlabel' => 'About', - 'width' => 300, - 'height' => 360, - 'color' => '#7e0079', - 'scrolling' => 'no', - ) |n - %> v<% $FS::VERSION %>
- " TARGET="_blank">Documentation
-
-
- - RT v<% $RT::VERSION %>
-
Documentation
-
-
- +
Logged in as <% getotaker %> 
Preferences +% if ( $conf->config("ticket_system") +% && FS::TicketSystem->access_right(\%session, 'ModifySelf') ) { + | Ticketing preferences +% } +
@@ -136,12 +103,22 @@ input.fsblackbuttonselected { - + + + + + + + + +
<% include('/elements/about_freeside.html') |n %><% include('/elements/about_rt.html') |n %>
+ + @@ -250,6 +227,15 @@ input.fsblackbuttonselected {
+ + + + + + + +
<% include('/elements/about_freeside.html') %>
<% include('/elements/about_rt.html') %>
+ diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html index 1d3d5adf0..38546ca5d 100644 --- a/httemplate/elements/menu.html +++ b/httemplate/elements/menu.html @@ -33,8 +33,8 @@ % % my( $subhtml, $submenuname ) = submenu($url_or_submenu, $item); - <% $subhtml %> - myBar.add(new WebFXMenuButton("<% $item %>", null, "<% $tooltip %>", <% $submenuname %> )); + <% $subhtml |n %> + myBar.add(new WebFXMenuButton("<% $item %>", null, "<% $tooltip %>", <% $submenuname |n %> )); % } else { @@ -56,7 +56,7 @@ my $fsurl = $opt{'freeside_baseurl'}; my $curuser = $FS::CurrentUser::CurrentUser; -#Active tickets not assigned to a customer +#XXX Active tickets not assigned to a customer tie my %report_customers_lists, 'Tie::IxHash', 'by customer number' => [ $fsurl. 'search/cust_main.cgi?browse=custnum', '' ], @@ -180,6 +180,25 @@ tie my %report_rating, 'Tie::IxHash', 'Time worked' => [ $fsurl.'search/report_rt_transaction.html', '' ], ; +tie my %report_ticketing_statistics, 'Tie::IxHash', + 'Tickets per day per Queue' => [ $fsurl.'rt/RTx/Statistics/CallsQueueDay', 'View the number of tickets created, resolved or deleted in a specific Queue, over the requested period of days' ], + 'Ticket status by Queue' => [ $fsurl.'rt/RTx/Statistics/OpenStalled', 'View numbers of new, open and stalled tickets in a selected Queue' ], + 'Tickets per day (multiple Queues)' => [ $fsurl.'rt/RTx/Statistics/CallsMultiQueue', 'View tickets created, resolved or deleted on in one or more Queues over a specified time period' ], + 'Tickets per Day of Week' => [ $fsurl.'rt/RTx/Statistics/DayOfWeek', 'View trends showing when tickets are created, resolved or deleted' ], + 'Time to resolve' => [ $fsurl.'rt/RTx/Statistics/Resolution', 'View how long tickets take to be resolved by Queue' ], + 'Time to resolve (scatter graph)' => [ $fsurl.'rt/RTx/Statistics/TimeToResolve', 'View a detailed scatter graph of time to resolve tickets by Queue' ], +; + +tie my %report_ticketing, 'Tie::IxHash', + 'Resolved by owner' => [ $fsurl.'rt/Tools/Reports/ResolvedByOwner.html', '' ], + 'Resolved in date range' => [ $fsurl.'rt/Tools/Reports/ResolvedByDates.html', '' ], + 'Created in date range' => [ $fsurl.'rt/Tools/Reports/CreatedByDates.html', '' ], + 'separator' => '', + 'Statistics' => [ \%report_ticketing_statistics, '' ], + 'separator2' => '', + 'Advanced ticket reports' => [ $fsurl.'rt/Search/Build.html', 'List tickets by any criteria' ], +; + tie my %report_bill_event, 'Tie::IxHash', 'All billing events' => [ $fsurl.'search/report_cust_event.html', 'All billing events for a date range' ], 'Billing event errors' => [ $fsurl.'search/report_cust_event.html?failed=1', 'Failed credit cards, processor or printer problems, etc.' ], @@ -189,6 +208,7 @@ tie my %report_bill_event, 'Tie::IxHash', 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)' ], @@ -199,14 +219,16 @@ if($curuser->access_right('Financial reports')) { 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)' ] + $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 (internal taxclass system)' ]; + $report_financial{'Tax Liability'} = [ $fsurl.'search/report_newtax.html', 'Tax liability report (vendor data tax products system)' ] if $conf->exists('enable_taxproducts'); -} -elsif($curuser->access_right('Receivables report')) { + +} 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'; @@ -220,6 +242,9 @@ $report_menu{'Services'} = [ \%report_services, 'Services reports' ] if $curuser->access_right('List services'); $report_menu{'Usage'} = [ \%report_rating, 'Usage reports' ] if $curuser->access_right('List rating data'); +$report_menu{'Tickets'} = [ \%report_ticketing, 'Ticket reports' ] + if $conf->config('ticket_system') + ;#&& FS::TicketSystem->access_right(\%session, 'Something'); $report_menu{'Billing events'} = [ \%report_bill_event, 'Billing events' ] if $curuser->access_right('Billing event reports'); $report_menu{'Financial'} = [ \%report_financial, 'Financial reports' ] @@ -229,20 +254,20 @@ $report_menu{'SQL Query'} = [ $fsurl.'search/report_sql.html', 'SQL Query' ] if $curuser->access_right('Raw SQL'); tie my %tools_importing, 'Tie::IxHash', - 'Import customers' => [ $fsurl.'misc/cust_main-import.cgi', '' ], - 'Import customer comments from CSV file' => [ $fsurl.'misc/cust_main_note-import.html', '' ], - 'Import one-time charges from CSV file' => [ $fsurl.'misc/cust_main-import_charges.cgi', '' ], - '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', '' ], + 'Customers' => [ $fsurl.'misc/cust_main-import.cgi', '' ], + 'Customer comments from CSV file' => [ $fsurl.'misc/cust_main_note-import.html', '' ], + 'One-time charges from CSV file' => [ $fsurl.'misc/cust_main-import_charges.cgi', '' ], + 'Payments from CSV file' => [ $fsurl.'misc/cust_pay-import.cgi', '' ], + 'Phone numbers (DIDs)' => [ $fsurl.'misc/phone_avail-import.html', '' ], + 'Call Detail Records (CDRs)' => [ $fsurl.'misc/cdr-import.html', '' ], # 'Import call rates and regions' => [ $fsurl.'misc/rate-import.html', '' ], ; if ( $conf->exists('enable_taxproducts') ) { if ( $conf->exists('taxdatadirectdownload') ) { - $tools_importing{'Import tax rates from vendor site'} = + $tools_importing{'Tax rates from vendor site'} = [ $fsurl.'misc/tax-fetch_and_import.cgi', '' ]; } else { - $tools_importing{'Import tax rates from CSV files'} = + $tools_importing{'Tax rates from CSV files'} = [ $fsurl.'misc/tax-import.cgi', '' ]; } } @@ -256,6 +281,14 @@ tie my %tools_exporting, 'Tie::IxHash', # +tie my %tools_ticketing, 'Tie::IxHash', + 'Offline' => [ $fsurl.'rt/Tools/Offline.html', '' ], + 'My Day' => [ $fsurl.'rt/Tools/MyDay.html', '' ], + 'My Approvals' => [ $fsurl.'rt/Approvals/', '' ], +; +$tools_ticketing{'Cron Tool'} = [ $fsurl.'rt/Developer/CronTool/', '' ] + if $conf->exists('rt-crontool'); + tie my %tools_menu, 'Tie::IxHash', (); $tools_menu{'Quick payment entry'} = [ $fsurl.'misc/batch-cust_pay.html', 'Enter multiple payments in a batch' ] if $curuser->access_right('Post payment batch'); @@ -264,6 +297,8 @@ $tools_menu{'Process payment batches'} = [ $fsurl.'search/pay_batch.cgi?magic=_d && $curuser->access_right('Process batches'); $tools_menu{'Job Queue'} = [ $fsurl.'search/queue.html', 'View pending job queue' ] if $curuser->access_right('Job queue'); +$tools_menu{'Ticketing'} = [ \%tools_ticketing, 'Ticketing tools' ] + if $conf->config('ticket_system'); $tools_menu{'Time Queue'} = [ $fsurl.'search/timeworked.html', 'View pending support time' ] if $curuser->access_right('Time queue'); $tools_menu{'Importing'} = [ \%tools_importing, 'Import tools' ] @@ -272,66 +307,83 @@ $tools_menu{'Exporting'} = [ \%tools_exporting, 'Export tools' ] if $curuser->access_right('Export'); tie my %config_employees, 'Tie::IxHash', - 'View/Edit employees' => [ $fsurl.'browse/access_user.html', 'Setup internal users' ], - 'View/Edit employee groups' => [ $fsurl.'browse/access_group.html', 'Employee groups allow you to control access to the backend' ], + 'Employees' => [ $fsurl.'browse/access_user.html', 'Setup internal users' ], + 'Employee groups' => [ $fsurl.'browse/access_group.html', 'Employee groups allow you to control access to the backend' ], ; -tie my %config_export_svc_pkg, 'Tie::IxHash', (); +tie my %config_export_svc, 'Tie::IxHash', (); if ( $curuser->access_right('Configuration') ) { - $config_export_svc_pkg{'View/Edit exports'} = [ $fsurl.'browse/part_export.cgi', 'Provisioning services to external machines, databases and APIs' ]; - $config_export_svc_pkg{'View/Edit service definitions'} = [ $fsurl.'browse/part_svc.cgi', 'Services are items you offer to your customers' ]; + $config_export_svc{'Exports'} = [ $fsurl.'browse/part_export.cgi', 'Provisioning services to external machines, databases and APIs' ]; + $config_export_svc{'Service definitions'} = [ $fsurl.'browse/part_svc.cgi', 'Services are items you offer to your customers' ]; } -$config_export_svc_pkg{'View/Edit package definitions'} = [ $fsurl.'browse/part_pkg.cgi', 'One or more services are grouped together into a package and given pricing information. Customers purchase packages, not services' ] + +tie my %config_pkg, 'Tie::IxHash', (); +$config_pkg{'Package definitions'} = [ $fsurl.'browse/part_pkg.cgi', 'One or more services are grouped together into a package and given pricing information. Customers purchase packages, not services' ] if $curuser->access_right('Edit package definitions') || $curuser->access_right('Edit global package definitions'); if ( $curuser->access_right('Configuration') ) { - $config_export_svc_pkg{'View/Edit package categories'} = [ $fsurl.'browse/pkg_category.html', 'Package categories define groups of package classes, for reporting and convenience purposes.' ]; - $config_export_svc_pkg{'View/Edit package tax classes'} = [ $fsurl.'browse/pkg_class.html', 'Package classes define groups of packages, for reporting and convenience purposes.' ]; - $config_export_svc_pkg{'View/Edit package report classes'} = [ $fsurl.'browse/part_pkg_report_option.html', 'Package classes define optional groups of packages for reporting purposes.' ]; - $config_export_svc_pkg{'View/Edit cancel reason types'} = [ $fsurl.'browse/reason_type.html?class=C', 'Cancel reason types define groups of reasons, for reporting and convenience purposes.' ]; - $config_export_svc_pkg{'View/Edit cancel reasons'} = [ $fsurl.'browse/reason.html?class=C', 'Cancel reasons explain why a service was cancelled.' ]; - $config_export_svc_pkg{'View/Edit suspend reason types'} = [ $fsurl.'browse/reason_type.html?class=S', 'Suspend reason types define groups of reasons, for reporting and convenience purposes.' ]; - $config_export_svc_pkg{'View/Edit suspend reasons'} = [ $fsurl.'browse/reason.html?class=S', 'Suspend reasons explain why a service was suspended.' ]; + $config_pkg{'Package categories'} = [ $fsurl.'browse/pkg_category.html', 'Package categories define groups of package classes, for reporting and convenience purposes.' ]; + $config_pkg{'Package tax classes'} = [ $fsurl.'browse/pkg_class.html', 'Package classes define groups of packages, for reporting and convenience purposes.' ]; + $config_pkg{'Package report classes'} = [ $fsurl.'browse/part_pkg_report_option.html', 'Package classes define optional groups of packages for reporting purposes.' ]; + $config_pkg{'Cancel reason types'} = [ $fsurl.'browse/reason_type.html?class=C', 'Cancel reason types define groups of reasons, for reporting and convenience purposes.' ]; + $config_pkg{'Cancel reasons'} = [ $fsurl.'browse/reason.html?class=C', 'Cancel reasons explain why a service was cancelled.' ]; + $config_pkg{'Suspend reason types'} = [ $fsurl.'browse/reason_type.html?class=S', 'Suspend reason types define groups of reasons, for reporting and convenience purposes.' ]; + $config_pkg{'Suspend reasons'} = [ $fsurl.'browse/reason.html?class=S', 'Suspend reasons explain why a service was suspended.' ]; } tie my %config_agent, 'Tie::IxHash', - 'View/Edit agent types' => [ $fsurl.'browse/agent_type.cgi', 'Agent types define groups of package definitions that you can then assign to particular agents' ], - 'View/Edit agents' => [ $fsurl.'browse/agent.cgi', 'Agents are resellers of your service. Agents may be limited to a subset of your full offerings (via their type)' ], - 'View/Edit agent payment gateways' => [ $fsurl.'browse/payment_gateway.html', 'Credit card and electronic check processors for agent overrides' ]; + 'Agent types' => [ $fsurl.'browse/agent_type.cgi', 'Agent types define groups of package definitions that you can then assign to particular agents' ], + 'Agents' => [ $fsurl.'browse/agent.cgi', 'Agents are resellers of your service. Agents may be limited to a subset of your full offerings (via their type)' ], + 'Agent payment gateways' => [ $fsurl.'browse/payment_gateway.html', 'Credit card and electronic check processors for agent overrides' ]; ; 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.' ], + 'Rate plans' => [ $fsurl.'browse/rate.cgi', 'Manage rate plans' ], + 'Regions and prefixes' => [ $fsurl.'browse/rate_region.html', 'Manage regions and prefixes' ], + '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.' ], #"Edit with Excel" ? ; tie my %config_billing, 'Tie::IxHash'; -# 'View/Edit payment gateways' => [ $fsurl.'browse/payment_gateway.html', 'Credit card and electronic check processors' ]; -$config_billing{'View/Edit billing events'} = [ $fsurl.'browse/part_event.html', 'Billing actions for customers, invoices and packages' ] +# 'Payment gateways' => [ $fsurl.'browse/payment_gateway.html', 'Credit card and electronic check processors' ]; +$config_billing{'Billing events'} = [ $fsurl.'browse/part_event.html', 'Billing actions for customers, invoices and packages' ] if $curuser->access_right('Edit billing events') || $curuser->access_right('Edit global billing events'); if ( $curuser->access_right('Configuration') ) { - $config_billing{'View/Edit invoice events'} = [ $fsurl.'browse/part_bill_event.cgi', 'Deprecated, old-style actions for overdue invoices' ]; - $config_billing{'View/Edit invoice templates'} = [ $fsurl.'browse/invoice_template.html', 'Edit templates for HTML, plaintext and typeset invoices' ]; - $config_billing{'View/Edit prepaid cards'} = [ $fsurl.'search/prepay_credit.html', 'View outstanding cards, generate new cards' ]; - $config_billing{'View/Edit call rates and regions'} = [ \%config_billing_rates, 'Manage rate plans, regions and prefixes for VoIP and call billing' ]; - $config_billing{'View/Edit locales and tax rates (old tax class system)'} = [ $fsurl.'browse/cust_main_county.cgi', 'Change tax rates, or break down a country into states, or a state into counties and assign different tax rates to each' ]; - $config_billing{'View/Edit tax rates (new tax products system)'} = [ $fsurl.'browse/tax_rate.cgi', 'Edit tax rates for the new tax products system' ]; - $config_billing{'View/Edit tax classes'} = [ $fsurl.'browse/part_pkg_taxclass.html', 'Edit tax classes' ] - if $conf->exists('enable_taxclasses'); - $config_billing{'View/Edit credit reason types'} = [ $fsurl.'browse/reason_type.html?class=R', 'Credit reason types define groups of reasons, for reporting and convenience purposes.' ]; - $config_billing{'View/Edit credit reasons'} = [ $fsurl.'browse/reason.html?class=R', 'Credit reasons explain why a credit was issued.' ]; + #$config_billing{'Invoice events'} = [ $fsurl.'browse/part_bill_event.cgi', 'Deprecated, old-style actions for overdue invoices' ]; + $config_billing{'Invoice templates'} = [ $fsurl.'browse/invoice_template.html', 'Edit templates for HTML, plaintext and typeset invoices' ]; + $config_billing{'Prepaid cards'} = [ $fsurl.'search/prepay_credit.html', 'View outstanding cards, generate new cards' ]; + $config_billing{'Call rates and regions'} = [ \%config_billing_rates, 'Manage rate plans, regions and prefixes for VoIP and call billing' ]; + + my $config_taxes_name = 'Locales and tax rates'. + ( $conf->exists('enable_taxproducts') + ? ' (internal tax class system)' + : '' + ); + $config_billing{$config_taxes_name} = [ $fsurl.'browse/cust_main_county.cgi', 'Change tax rates, or break down a country into states, or a state into counties and assign different tax rates to each' ]; + $config_billing{'Tax rates (vendor data tax products system)'} = [ $fsurl.'browse/tax_rate.cgi', 'Edit tax rates for the vendor data tax products system' ] + if $conf->exists('enable_taxproducts'); + + $config_billing{'Credit reason types'} = [ $fsurl.'browse/reason_type.html?class=R', 'Credit reason types define groups of reasons, for reporting and convenience purposes.' ]; + $config_billing{'Credit reasons'} = [ $fsurl.'browse/reason.html?class=R', 'Credit reasons explain why a credit was issued.' ]; } +tie my %config_ticketing, 'Tie::IxHash', + 'Ticketing Users' => [ $fsurl.'rt/Admin/Users', 'View/Edit ticketing users' ], #XXX to be unified + 'Ticketing Groups' => [ $fsurl.'rt/Admin/Groups', 'View/Edit ticketing groups' ], #XXX to be unified + 'Ticketing Queues' => [ $fsurl.'rt/Admin/Queues', '' ], + 'Ticket Custom Fields' => [ $fsurl.'rt/Admin/CustomFields', '' ], + 'Ticketing Global' => [ $fsurl.'rt/Admin/Global', 'Global ticketing configuration' ], + #'Ticketing Tools' => [ $fsurl.'rt/Admin/Tools', '' ], +; + tie my %config_dialup, 'Tie::IxHash', - 'View/Edit access numbers' => [ $fsurl.'browse/svc_acct_pop.cgi', 'Points of Presence' ], + 'Access numbers' => [ $fsurl.'browse/svc_acct_pop.cgi', 'Points of Presence' ], ; tie my %config_broadband, 'Tie::IxHash', - 'View/Edit routers' => [ $fsurl.'browse/router.cgi', 'Broadband access routers' ], - 'View/Edit address blocks' => [ $fsurl.'browse/addr_block.cgi', 'Manage address blocks and block assignments to broadband routers' ], + 'Routers' => [ $fsurl.'browse/router.cgi', 'Broadband access routers' ], + 'Address blocks' => [ $fsurl.'browse/addr_block.cgi', 'Manage address blocks and block assignments to broadband routers' ], ; tie my %config_phone, 'Tie::IxHash', @@ -339,13 +391,13 @@ tie my %config_phone, 'Tie::IxHash', ; tie my %config_misc, 'Tie::IxHash'; -$config_misc{'View/Edit advertising sources'} = [ $fsurl.'browse/part_referral.html', 'Where a customer heard about your service. Tracked for informational purposes' ] +$config_misc{'Advertising sources'} = [ $fsurl.'browse/part_referral.html', 'Where a customer heard about your service. Tracked for informational purposes' ] if $curuser->access_right('Edit advertising sources') || $curuser->access_right('Edit global advertising sources'); if ( $curuser->access_right('Configuration') ) { - $config_misc{'View/Edit virtual fields'} = [ $fsurl.'browse/part_virtual_field.cgi', 'Locally defined fields', ]; - $config_misc{'View/Edit message catalog'} = [ $fsurl.'browse/msgcat.cgi', 'Change error messages and other customizable labels' ]; - $config_misc{'View/Edit inventory classes and inventory'} = [ $fsurl.'browse/inventory_class.html', 'Setup inventory classes and stock inventory' ]; + $config_misc{'Virtual fields'} = [ $fsurl.'browse/part_virtual_field.cgi', 'Locally defined fields', ]; + $config_misc{'Message catalog'} = [ $fsurl.'browse/msgcat.cgi', 'Change error messages and other customizable labels' ]; + $config_misc{'Inventory classes and inventory'} = [ $fsurl.'browse/inventory_class.html', 'Setup inventory classes and stock inventory' ]; } tie my %config_menu, 'Tie::IxHash'; @@ -356,8 +408,9 @@ if ( $curuser->access_right('Configuration' ) ) { 'Employees' => [ \%config_employees, '' ], ); } -$config_menu{'Provisioning, services and packages'} = - [ \%config_export_svc_pkg, '' ] +$config_menu{'Provisioning and services'} = [ \%config_export_svc, '' ] + if $curuser->access_right('Configuration' ); +$config_menu{'Packages'} = [ \%config_pkg, '' ] if $curuser->access_right('Configuration' ) || $curuser->access_right('Edit package definitions') || $curuser->access_right('Edit global package definitions'); @@ -366,6 +419,9 @@ $config_menu{'Resellers'} = [ \%config_agent, '' ] $config_menu{'Billing'} = [ \%config_billing, '' ] if $curuser->access_right('Edit billing events') || $curuser->access_right('Edit global billing events'); +$config_menu{'Ticketing'} = [ \%config_ticketing, '' ] + if $conf->config('ticket_system') + && FS::TicketSystem->access_right(\%session, 'ShowConfigTab'); $config_menu{'Dialup'} = [ \%config_dialup, '' ] if ( $curuser->access_right('Dialup configuration') ); $config_menu{'Fixed (username-less) broadband'} = [ \%config_broadband, '' ] @@ -445,7 +501,7 @@ sub submenu { } keys %$submenu ) ). "\n". - "myMenu$menunum.width = 280;\n", + "myMenu$menunum.width = 256;\n", "myMenu$menunum"; diff --git a/httemplate/elements/popup_link.html b/httemplate/elements/popup_link.html index 20193873f..49b624c84 100644 --- a/httemplate/elements/popup_link.html +++ b/httemplate/elements/popup_link.html @@ -22,14 +22,16 @@ Example: #uncommon opt 'aname' => "target", # link NAME= value, useful for #targets 'target' => '_parent', + 'style' => 'css-attribute:value', } ) % if ($params->{'action'} && $label) { {'aname'} ? 'NAME="'. $params->{'aname'}. '"' : '' %> - <% $params->{'target'} ? 'TARGET="'. $params->{'target'}. '"' : '' %> + onClick="<% $onclick |n %>" + <% $params->{'aname'} ? 'NAME="'. $params->{'aname'}. '"' : '' |n %> + <% $params->{'target'} ? 'TARGET="'. $params->{'target'}. '"' : '' |n %> + <% $params->{'style'} ? 'STYLE="'. $params->{'style'}. '"' : '' |n %> ><% $label %>\ % } <%init> diff --git a/rt/FREESIDE_MODIFIED b/rt/FREESIDE_MODIFIED index 66917795c..948eeab66 100644 --- a/rt/FREESIDE_MODIFIED +++ b/rt/FREESIDE_MODIFIED @@ -31,4 +31,5 @@ html/Elements/FreesideNewCust html/Elements/FreesideSearch html/Elements/FreesideSvcSearch - + html/User/Prefs.html + html/Prefs/SearchOptions.html diff --git a/rt/html/Elements/Header b/rt/html/Elements/Header index bf6fa46fa..ffe653666 100644 --- a/rt/html/Elements/Header +++ b/rt/html/Elements/Header @@ -45,102 +45,16 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} - +<% include( '/elements/header.html', { + 'title' => $Title, + 'head' => $head, + 'nobr' => 1, + }) |n +%> - - -<%$Title%> - -% if ($Refresh && $Refresh > 0) { - -% } - - - - - -% if ( $RSSAutoDiscovery ) { - -% } - - - - - - -<& /Elements/Callback, _CallbackName => 'Head', %ARGS &> - - - - > - -% if ($ShowBar) { - - - - - - - - - - - - - -
freeside<% &RT::URI::freeside::FreesideGetConfig('company_name') || 'ExampleCo' %> - -
-
- <&|/l&>Skip Menu | -% if ($session{'CurrentUser'}->Name) { - <&|/l, "".$session{'CurrentUser'}->Name."" &>Logged in as [_1] -% if ($session{'CurrentUser'}->HasRight( Right => 'ModifySelf', Object => $RT::System )) { - | <&|/l&>Preferences -% } -% } else { - <&|/l&>Not logged in. -% } - <& /Elements/Callback, %ARGS &> -% unless (!$session{'CurrentUser'}->Name -% or ($RT::WebExternalAuth and !$RT::WebFallbackToInternalAuth)) { - | <&|/l&>Logout -% } -
-% } - -
- - - - - - - -
- - Freeside v<% &RT::URI::freeside::FreesideVersion() %>
- ">Documentation
-
-
- - RT v<% $RT::VERSION %>
- Documentation
-
-
-
+%# if ($session{'CurrentUser'}->HasRight( Right => 'ModifySelf', Object => $RT::System )) { +%# | <&|/l&>Preferences +%# } <%INIT> $r->headers_out->{'Pragma'} = 'no-cache'; @@ -155,6 +69,45 @@ $id =~ s|\.html$||g; $id =~ s|index$||g if $id ne 'index'; $id =~ s|-$||g; + +my $head = ''; + +if ($Refresh && $Refresh > 0) { + $head .= ''; +} + +$head .= < + + +END + +if ( $RSSAutoDiscovery ) { + $head .= qq(); +} + +$head .= < + + +'; + +$head .= $m->scomp( '/Elements/Callback', _CallbackName => 'Head', %ARGS ); + +my $etc = ''; +$etc .= qq[ id="comp-$id"] if $id; + <%ARGS> diff --git a/rt/html/Elements/PageLayout b/rt/html/Elements/PageLayout index b9fd31f71..6a392270c 100644 --- a/rt/html/Elements/PageLayout +++ b/rt/html/Elements/PageLayout @@ -45,44 +45,19 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} - - - - - - - -
-% my $notfirst = 0; foreach my $action (sort keys %{$topactions}) { - -
- -% } - - - -
-% $m->out($topactions->{"$action"}->{'html'}); -
- -%# End of div#quickbar from /Elements/Header - - - - -
-% if ( $show_menu ) { +% if (0) { ##FREESIDE MENUS INSTEAD## if ( $show_menu ) { +%# if ( $show_menu ) { % }