1 <script type="text/javascript" src="<%$fsurl%>elements/cssexpr.js"></script>
2 <script type="text/javascript" src="<%$fsurl%>elements/xmenu.js"></script>
3 <link href="<%$fsurl%>elements/xmenu.css" type="text/css" rel="stylesheet">
4 <link href="<%$fsurl%>elements/freeside.css" type="text/css" rel="stylesheet">
6 <SCRIPT TYPE="text/javascript">
8 webfxMenuImagePath = "<%$fsurl%>images/";
10 webfxMenuShowTime = 300;
11 webfxMenuHideTime = 500;
13 var myBar = new WebFXMenuBar;
15 % foreach my $item ( keys %menu ) {
17 % my( $url_or_submenu, $tooltip ) = @{ $menu{$item} };
19 % if ( ref($url_or_submenu) ) {
23 % my( $subhtml, $submenuname ) = submenu($url_or_submenu, $item);
26 myBar.add(new WebFXMenuButton("<% $item %>", null, "<% $tooltip %>", <% $submenuname %> ));
30 myBar.add(new WebFXMenuButton("<% $item %>", "<% $url_or_submenu %>", "<% $tooltip %>" ));
36 myBar.show( null, 'vertical' );
43 my $conf = new FS::Conf;
44 my $fsurl = $opt{'freeside_baseurl'};
46 my $curuser = $FS::CurrentUser::CurrentUser;
48 #Active tickets not assigned to a customer
50 tie my %report_customers_lists, 'Tie::IxHash',
51 'by customer number' => [ $fsurl. 'search/cust_main.cgi?browse=custnum', '' ],
52 'by last name' => [ $fsurl. 'search/cust_main.cgi?browse=last', '' ],
53 'by company name' => [ $fsurl. 'search/cust_main.cgi?browse=company', '' ],
55 $report_customers_lists{'by active trouble tickets'} = [ $fsurl. 'search/cust_main.cgi?browse=tickets', '' ]
56 if $conf->config('ticket_system');
58 tie my %report_customers_search, 'Tie::IxHash',
59 'by ordering employee' => [ $fsurl. 'search/cust_main-otaker.cgi' ],
62 tie my %report_customers, 'Tie::IxHash',
63 'List customers' => [ \%report_customers_lists, 'List customers' ],
64 'Search customers' => [ \%report_customers_search, 'Search customers' ],
65 'Zip code distribution' => [ $fsurl.'search/report_cust_main-zip.html', 'Zip codes by number of customers' ],
68 tie my %report_invoices_open, 'Tie::IxHash',
69 'All open invoices' => [ $fsurl.'search/cust_bill.html?OPEN_date', 'All invoices with an unpaid balance' ],
70 '15 day open invoices' => [ $fsurl.'search/cust_bill.html?OPEN15_date', 'Invoices 15 days or older with an unpaid balance' ],
71 '30 day open invoices' => [ $fsurl.'search/cust_bill.html?OPEN30_date', 'Invoices 30 days or older with an unpaid balance' ],
72 '60 day open invoices' => [ $fsurl.'search/cust_bill.html?OPEN60_date', 'Invoices 60 days or older with an unpaid balance' ],
73 '90 day open invoices' => [ $fsurl.'search/cust_bill.html?OPEN90_date', 'Invoices 90 days or older with an unpaid balance' ],
74 '120 day open invoices' => [ $fsurl.'search/cust_bill.html?OPEN120_date', 'Invoices 120 days or older with an unpaid balance' ],
77 tie my %report_invoices, 'Tie::IxHash',
78 'Open invoices' => [ \%report_invoices_open, 'Open invoices' ],
79 'All invoices' => [ $fsurl. 'search/cust_bill.html?date', 'List all invoices' ],
80 'Advanced invoice reports' => [ $fsurl.'search/report_cust_bill.html', 'by agent, date range, etc.' ],
83 tie my %report_services, 'Tie::IxHash';
84 if ( $curuser->access_right('Configuration') ) {
85 $report_services{'Service definitions'} = [ $fsurl.'browse/part_svc.cgi?orderby=active', 'Service definitions by number of active packages' ];
86 $report_services{'separator'} = '';
88 foreach my $svcdb ( FS::part_svc->svc_tables() ) {
90 my $name = "FS::$svcdb"->table_info->{'name_plural'}
91 || PL( "FS::$svcdb"->table_info->{'name'} );
92 my $lcname = lc($name);
93 my $longname = "FS::$svcdb"->table_info->{'longname_plural'} || $name;
94 my $lclongname = lc($longname);
95 my $sorts = "FS::$svcdb"->table_info->{'sorts'} || [ 'svcnum' ];
96 $sorts = [ $sorts ] unless ref($sorts);
97 my %svc_url = ( 'm' => $m,
102 tie my %report_svc, 'Tie::IxHash';
104 foreach my $sort ( @$sorts ) {
106 my $title = "All $lcname";
107 $title .= " by ". FS::part_svc->svc_table_fields($svcdb)->{$sort}->{'label'}
108 if scalar(@$sorts) > 1;
110 $report_svc{$title} =
111 [ FS::UI::Web::svc_url( %svc_url, 'query' => "magic=all;sortby=$sort" ),
116 if ( $curuser->access_right('View/link unlinked services') ) {
117 $report_svc{"Unlinked $lcname"} =
118 [ FS::UI::Web::svc_url( %svc_url, 'query' => "magic=unlinked;sortby=". $sorts->[0] ),
119 "Pre-Freeside $lcname without a customer record",
123 $report_services{$name} = [ \%report_svc, $longname ];
127 tie my %report_packages, 'Tie::IxHash';
128 if ( $curuser->access_right('Configuration') ) {
129 $report_packages{'Package definitions'} = [ $fsurl.'browse/part_pkg.cgi?active=1', 'Package definitions by number of active packages' ];
130 $report_packages{'separator'} = '';
132 $report_packages{'All customer packages'} = [ $fsurl.'search/cust_pkg.cgi?pkgnum', 'List all customer packages', ];
133 $report_packages{'Suspended customer packages'} = [ $fsurl.'search/cust_pkg.cgi?magic=suspended', 'List suspended packages' ];
134 $report_packages{'Customer packages with unconfigured services'} = [ $fsurl.'search/cust_pkg.cgi?APKG_pkgnum', 'List packages which have provisionable services' ];
135 $report_packages{'Advanced package reports'} = [ $fsurl.'search/report_cust_pkg.html', 'by agent, date range, status, package definition' ];
137 tie my %report_rating, 'Tie::IxHash',
138 'RADIUS sessions' => [ $fsurl.'search/sqlradius.html', '' ],
139 'Call Detail Records (CDRs)' => [ $fsurl.'search/report_cdr.html', '' ],
142 tie my %report_bill_event, 'Tie::IxHash',
143 'All billing events' => [ $fsurl.'search/cust_bill_event.html', 'All billing events for a date range' ],
144 'Invoice event errors' => [ $fsurl.'search/cust_bill_event.html?failed=1', 'failed credit cards, processor or printer problems, etc.' ],
147 tie my %report_financial, 'Tie::IxHash',
148 'Sales, Credits and Receipts' => [ $fsurl.'graph/report_money_time.html', 'Sales, credits and receipts summary graph' ],
149 'Sales Report' => [ $fsurl.'graph/report_cust_bill_pkg.html', 'Sales report and graph (by agent, package class and/or date range)' ],
150 'Credit Report' => [ $fsurl.'search/report_cust_credit.html', 'Credit report (by employee and/or date range)' ],
151 'Payment Report' => [ $fsurl.'search/report_cust_pay.html', 'Payment report (by type and/or date range)' ],
153 $report_financial{'Payment Batch Report'} = [ $fsurl.'search/pay_batch.html', 'Payment batches (by status and/or date range)' ]
154 if $conf->exists('batch-enable');
155 $report_financial{'A/R Aging'} = [ $fsurl.'search/report_receivables.html', 'Accounts Receivable Aging report' ];
156 $report_financial{'Prepaid Income'} = [ $fsurl.'search/report_prepaid_income.html', 'Prepaid income (unearned revenue) report' ];
157 $report_financial{'Sales Tax Liability'} = [ $fsurl.'search/report_tax.html', 'Sales tax liability report' ];
160 tie my %report_menu, 'Tie::IxHash';
161 $report_menu{'Customers'} = [ \%report_customers, 'Customer reports' ]
162 if $curuser->access_right('List customers');
163 $report_menu{'Invoices'} = [ \%report_invoices, 'Invoice reports' ]
164 if $curuser->access_right('List invoices');
165 $report_menu{'Packages'} = [ \%report_packages, 'Package reports' ]
166 if $curuser->access_right('List packages');
167 $report_menu{'Services'} = [ \%report_services, 'Services reports' ]
168 if $curuser->access_right('List services');
169 $report_menu{'Usage'} = [ \%report_rating, 'Usage reports' ]
170 if $curuser->access_right('List rating data');
171 $report_menu{'Billing events'} = [ \%report_bill_event, 'Billing events' ]
172 if $curuser->access_right('Billing event reports');
173 $report_menu{'Financial'} = [ \%report_financial, 'Financial reports' ]
174 if $curuser->access_right('Financial reports');
176 tie my %tools_importing, 'Tie::IxHash',
177 'Import customers from CSV file' => [ $fsurl.'misc/cust_main-import.cgi', '' ],
178 'Import one-time charges from CSV file' => [ $fsurl.'misc/cust_main-import_charges.cgi', '' ],
179 'Import Call Detail Records (CDRs) from CSV file' => [ $fsurl.'misc/cdr-import.html', '' ],
182 tie my %tools_exporting, 'Tie::IxHash',
183 'Download database dump' => [ $fsurl. 'misc/dump.cgi', '' ],
186 # <!-- <BR>View active NAS ports:
187 # <A HREF="browse/nas.cgi">session server</A> -->
188 # <!-- or <A HREF="browse/nas-sqlradius.cgi">RADIUS</A>
191 tie my %tools_menu, 'Tie::IxHash', ();
192 $tools_menu{'Quick payment entry'} = [ $fsurl.'misc/batch-cust_pay.html', 'Enter multiple payments in a batch' ]
193 if $curuser->access_right('Post payment batch');
194 $tools_menu{'Process payment batches'} = [ $fsurl.'search/pay_batch.cgi?magic=_date;open=1;intransit=1', 'Process credit card and electronic check batches' ]
195 if $conf->exists('batch-enable') && $curuser->access_right('Process batches');
196 $tools_menu{'Job Queue'} = [ $fsurl.'search/queue.html', 'View pending job queue' ]
197 if $curuser->access_right('Job queue');
198 $tools_menu{'Importing'} = [ \%tools_importing, 'Import tools' ]
199 if $curuser->access_right('Import');
200 $tools_menu{'Exporting'} = [ \%tools_exporting, 'Export tools' ]
201 if $curuser->access_right('Export');
203 tie my %config_employees, 'Tie::IxHash',
204 'View/Edit employees' => [ $fsurl.'browse/access_user.html', 'Setup internal users' ],
205 'View/Edit employee groups' => [ $fsurl.'browse/access_group.html', 'Employee groups allow you to control access to the backend' ],
208 tie my %config_export_svc_pkg, 'Tie::IxHash',
209 'View/Edit exports' => [ $fsurl.'browse/part_export.cgi', 'Provisioning services to external machines, databases and APIs' ],
210 'View/Edit service definitions' => [ $fsurl.'browse/part_svc.cgi', 'Services are items you offer to your customers' ],
211 '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' ],
212 'View/Edit package classes' => [ $fsurl.'browse/pkg_class.html', 'Package classes define groups of packages, for reporting and convenience purposes.' ],
213 'View/Edit cancel reason types' => [ $fsurl.'browse/reason_type.html?class=C', 'Cancel reason types define groups of reasons, for reporting and convenience purposes.' ],
214 'View/Edit cancel reasons' => [ $fsurl.'browse/reason.html?class=C', 'Cancel reasons explain why a service was cancelled.' ],
215 'View/Edit suspend reason types' => [ $fsurl.'browse/reason_type.html?class=S', 'Suspend reason types define groups of reasons, for reporting and convenience purposes.' ],
216 'View/Edit suspend reasons' => [ $fsurl.'browse/reason.html?class=S', 'Suspend reasons explain why a service was suspended.' ],
219 tie my %config_agent, 'Tie::IxHash',
220 'View/Edit agent types' => [ $fsurl.'browse/agent_type.cgi', 'Agent types define groups of package definitions that you can then assign to particular agents' ],
221 '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)' ],
224 tie my %config_billing, 'Tie::IxHash',
225 'View/Edit payment gateways' => [ $fsurl.'browse/payment_gateway.html', 'Credit card and electronic check processors' ],
226 'View/Edit invoice events' => [ $fsurl.'browse/part_bill_event.cgi', 'Actions for overdue invoices' ],
227 'View/Edit prepaid cards' => [ $fsurl.'search/prepay_credit.html', 'View outstanding cards, generate new cards' ],
228 'View/Edit call rates and regions' => [ $fsurl.'browse/rate.cgi', 'Manage rate plans, regions and prefixes for VoIP and call billing' ],
229 'View/Edit locales and tax rates' => [ $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' ],
232 tie my %config_dialup, 'Tie::IxHash',
233 'View/Edit access numbers' => [ $fsurl.'browse/svc_acct_pop.cgi', 'Points of Presence' ],
236 tie my %config_broadband, 'Tie::IxHash',
237 'View/Edit routers' => [ $fsurl.'browse/router.cgi', 'Broadband access routers' ],
238 'View/Edit address blocks' => [ $fsurl.'browse/addr_block.cgi', 'Manage address blocks and block assignments to broadband routers' ],
241 tie my %config_misc, 'Tie::IxHash';
242 $config_misc{'View/Edit advertising sources'} = [ $fsurl.'browse/part_referral.html', 'Where a customer heard about your service. Tracked for informational purposes' ]
243 if $curuser->access_right('Configuration')
244 || $curuser->access_right('Edit advertising sources')
245 || $curuser->access_right('Edit global advertising sources');
246 if ( $curuser->access_right('Configuration') ) {
247 $config_misc{'View/Edit virtual fields'} = [ $fsurl.'browse/part_virtual_field.cgi', 'Locally defined fields', ];
248 $config_misc{'View/Edit message catalog'} = [ $fsurl.'browse/msgcat.cgi', 'Change error messages and other customizable labels' ];
249 $config_misc{'View/Edit inventory classes and inventory'} = [ $fsurl.'browse/inventory_class.html', 'Setup inventory classes and stock inventory' ];
252 tie my %config_menu, 'Tie::IxHash';
253 if ( $curuser->access_right('Configuration' ) ) {
255 'Settings' => [ $fsurl.'config/config-view.cgi', '' ],
256 'separator' => '', #its a separator!
257 'Employees' => [ \%config_employees, '' ],
258 'Provisioning, services and packages'
259 => [ \%config_export_svc_pkg, '' ],
260 'Resellers' => [ \%config_agent, '' ],
261 'Billing' => [ \%config_billing, '' ],
262 'Dialup' => [ \%config_dialup, '' ],
263 'Fixed (username-less) broadband'
264 => [ \%config_broadband, '' ],
267 $config_menu{'Miscellaneous'} = [ \%config_misc, '' ]
268 if $curuser->access_right('Configuration')
269 || $curuser->access_right('Edit advertising sources')
270 || $curuser->access_right('Edit global advertising sources');
272 tie my %menu, 'Tie::IxHash',
273 'Billing Main' => [ $fsurl, 'Billing start page', ],
275 if ( $conf->config('ticket_system') ) {
276 $menu{'Ticketing Main'} =
278 ( $conf->config('ticket_system') eq 'RT_External'
279 ? FS::TicketSystem->baseurl()
282 'Ticketing start page',
285 $menu{'Reports'} = [ \%report_menu, 'Lists, reporting and graphing' ]
286 if keys %report_menu;
287 $menu{'Tools'} = [ \%tools_menu, 'Tools' ]
289 $menu{'Configuration'} = [ \%config_menu, 'Configuraiton and setup' ]
290 if $curuser->access_right('Configuration')
291 || $curuser->access_right('Edit advertising sources')
292 || $curuser->access_right('Edit global advertising sources');
294 use vars qw($gmenunum);
298 my($submenu, $title) = @_;
299 my $menunum = $gmenunum++;
301 #return two args: html, menuname
303 "var myMenu$menunum = new WebFXMenu;\n".
304 #"myMenu$menunum.useAutoPosition = true;\n".
305 "myMenu$menunum.emptyText = '$title';\n".
310 if ( !ref( $submenu->{$_} ) ) {
312 "myMenu$menunum.add(new WebFXMenuSeparator());";
316 my($url_or_submenu, $tooltip ) = @{ $submenu->{$_} };
317 if ( ref($url_or_submenu) ) {
319 my($subhtml, $submenuname ) = submenu($url_or_submenu, $_); #mmm, recursion
322 "myMenu$menunum.add(new WebFXMenuItem(\"$_\", null, \"$tooltip\", $submenuname ));";
326 "myMenu$menunum.add(new WebFXMenuItem(\"$_\", \"$url_or_submenu\", \"$tooltip\" ));";
334 "myMenu$menunum.width = 280;\n",