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_acct, 'Tie::IxHash',
84 'All accounts by username' => [ $fsurl.'search/svc_acct.cgi?username', '' ],
85 'All accounts by UID' => [ $fsurl.'search/svc_acct.cgi?uid', '' ],
87 $report_services_acct{'Unlinked accounts'} = [ $fsurl.'search/svc_acct.cgi?UN_username', 'Pre-Freeside accounts without a customer record' ]
88 if $curuser->access_right('View/link unlinked services');
90 tie my %report_services_domain, 'Tie::IxHash',
91 'All domains' => [ $fsurl.'search/svc_domain.cgi?domain', '' ],
93 $report_services_domain{'Unlinked domains'} = [ $fsurl.'search/svc_domain.cgi?UN_domain', 'Pre-Freeside domains without a customer record' ]
94 if $curuser->access_right('View/link unlinked services');
96 tie my %report_services_forward, 'Tie::IxHash',
97 'All mail forwards' => [ $fsurl.'search/svc_forward.cgi?svcnum', '' ],
99 $report_services_forward{'Unlinked mail forwards'} = [ $fsurl.'search/svc_forward.cgi?UN_svcnum', 'Pre-Freeside mail forwards without a customer record' ]
100 if $curuser->access_right('View/link unlinked services');
102 tie my %report_services_www, 'Tie::IxHash',
103 'All virtual hosts' => [ $fsurl.'search/svc_www.cgi?svcnum', '' ],
105 $report_services_www{'Unlinked virtual hosts'} = [ $fsurl.'search/svc_www.cgi?UN_svcnum', 'Pre-Freeside virtual hosts without a customer record' ]
106 if $curuser->access_right('View/link unlinked services');
108 tie my %report_services_broadband, 'Tie::IxHash',
109 'All broadband services' => [ $fsurl.'search/svc_broadband.cgi?svcnum', '' ],
110 #'Unlinked domain' => [ $fsurl.'search/svc_acct.cgi?UN_uid', 'Pre-Freeside broadband services without a customer record' ],
113 tie my %report_services_phone, 'Tie::IxHash',
114 'All phone numbers' => [ $fsurl.'search/svc_phone.cgi?svcnum', '' ],
117 tie my %report_services_external, 'Tie::IxHash',
118 'All external services' => [ $fsurl.'search/svc_external.cgi?id', '' ],
120 $report_services_external{'Unlinked external services'} = [ $fsurl.'search/svc_external.cgi?UN_id', 'Pre-Freeside external services without a customer record' ]
121 if $curuser->access_right('View/link unlinked services');
123 tie my %report_services, 'Tie::IxHash';
124 if ( $curuser->access_right('Configuration') ) {
125 $report_services{'Service definitions'} = [ $fsurl.'browse/part_svc.cgi?orderby=active', 'Service definitions by number of active packages' ];
126 $report_services{'separator'} = '';
128 $report_services{'Accounts'} = [ \%report_services_acct, 'Access accounts and mailboxes' ];
129 $report_services{'Domains'} = [ \%report_services_domain, 'Domains', ];
130 $report_services{'Mail forwards'} = [ \%report_services_forward, 'Mail forwards', ];
131 $report_services{'Virtual hosts'} = [ \%report_services_www, 'Virtual hosting', ];
132 $report_services{'Broadband services'} = [ \%report_services_broadband, 'Fixed (username-less) broadband services', ];
133 $report_services{'Phone numbers'} = [ \%report_services_phone, 'Telephone numbers', ];
134 $report_services{'External services'} = [ \%report_services_external, 'External services', ];
136 tie my %report_packages, 'Tie::IxHash';
137 if ( $curuser->access_right('Configuration') ) {
138 $report_packages{'Package definitions'} = [ $fsurl.'browse/part_pkg.cgi?active=1', 'Package definitions by number of active packages' ];
139 $report_packages{'separator'} = '';
141 $report_packages{'All customer packages'} = [ $fsurl.'search/cust_pkg.cgi?pkgnum', 'List all customer packages', ];
142 $report_packages{'Suspended customer packages'} = [ $fsurl.'search/cust_pkg.cgi?magic=suspended', 'List suspended packages' ];
143 $report_packages{'Customer packages with unconfigured services'} = [ $fsurl.'search/cust_pkg.cgi?APKG_pkgnum', 'List packages which have provisionable services' ];
144 $report_packages{'Advanced package reports'} = [ $fsurl.'search/report_cust_pkg.html', 'by agent, date range, status, package definition' ];
146 tie my %report_rating, 'Tie::IxHash',
147 'RADIUS sessions' => [ $fsurl.'search/sqlradius.html', '' ],
148 'Call Detail Records (CDRs)' => [ $fsurl.'search/report_cdr.html', '' ],
151 tie my %report_bill_event, 'Tie::IxHash',
152 'All billing events' => [ $fsurl.'search/cust_bill_event.html', 'All billing events for a date range' ],
153 'Invoice event errors' => [ $fsurl.'search/cust_bill_event.html?failed=1', 'failed credit cards, processor or printer problems, etc.' ],
156 tie my %report_financial, 'Tie::IxHash',
157 'Sales, Credits and Receipts' => [ $fsurl.'graph/report_money_time.html', 'Sales, credits and receipts summary graph' ],
158 'Sales Report' => [ $fsurl.'graph/report_cust_bill_pkg.html', 'Sales report and graph (by agent, package class and/or date range)' ],
159 'Credit Report' => [ $fsurl.'search/report_cust_credit.html', 'Credit report (by employee and/or date range)' ],
160 'Payment Report' => [ $fsurl.'search/report_cust_pay.html', 'Payment report (by type and/or date range)' ],
162 $report_financial{'Payment Batch Report'} = [ $fsurl.'search/pay_batch.html', 'Payment batches (by status and/or date range)' ]
163 if $conf->exists('batch-enable');
164 $report_financial{'A/R Aging'} = [ $fsurl.'search/report_receivables.html', 'Accounts Receivable Aging report' ];
165 $report_financial{'Prepaid Income'} = [ $fsurl.'search/report_prepaid_income.html', 'Prepaid income (unearned revenue) report' ];
166 $report_financial{'Sales Tax Liability'} = [ $fsurl.'search/report_tax.html', 'Sales tax liability report' ];
169 tie my %report_menu, 'Tie::IxHash';
170 $report_menu{'Customers'} = [ \%report_customers, 'Customer reports' ]
171 if $curuser->access_right('List customers');
172 $report_menu{'Invoices'} = [ \%report_invoices, 'Invoice reports' ]
173 if $curuser->access_right('List invoices');
174 $report_menu{'Packages'} = [ \%report_packages, 'Package reports' ]
175 if $curuser->access_right('List packages');
176 $report_menu{'Services'} = [ \%report_services, 'Services reports' ]
177 if $curuser->access_right('List services');
178 $report_menu{'Usage'} = [ \%report_rating, 'Usage reports' ]
179 if $curuser->access_right('List rating data');
180 $report_menu{'Billing events'} = [ \%report_bill_event, 'Billing events' ]
181 if $curuser->access_right('Billing event reports');
182 $report_menu{'Financial'} = [ \%report_financial, 'Financial reports' ]
183 if $curuser->access_right('Financial reports');
185 tie my %tools_importing, 'Tie::IxHash',
186 'Import customers from CSV file' => [ $fsurl.'misc/cust_main-import.cgi', '' ],
187 'Import one-time charges from CSV file' => [ $fsurl.'misc/cust_main-import_charges.cgi', '' ],
188 'Import Call Detail Records (CDRs) from CSV file' => [ $fsurl.'misc/cdr-import.html', '' ],
191 tie my %tools_exporting, 'Tie::IxHash',
192 'Download database dump' => [ $fsurl. 'misc/dump.cgi', '' ],
195 # <!-- <BR>View active NAS ports:
196 # <A HREF="browse/nas.cgi">session server</A> -->
197 # <!-- or <A HREF="browse/nas-sqlradius.cgi">RADIUS</A>
200 tie my %tools_menu, 'Tie::IxHash', ();
201 $tools_menu{'Quick payment entry'} = [ $fsurl.'misc/batch-cust_pay.html', 'Enter multiple payments in a batch' ]
202 if $curuser->access_right('Post payment batch');
203 $tools_menu{'Process payment batches'} = [ $fsurl.'search/pay_batch.cgi?magic=_date;open=1;intransit=1', 'Process credit card and electronic check batches' ]
204 if $conf->exists('batch-enable') && $curuser->access_right('Process batches');
205 $tools_menu{'Job Queue'} = [ $fsurl.'search/queue.html', 'View pending job queue' ]
206 if $curuser->access_right('Job queue');
207 $tools_menu{'Importing'} = [ \%tools_importing, 'Import tools' ]
208 if $curuser->access_right('Import');
209 $tools_menu{'Exporting'} = [ \%tools_exporting, 'Export tools' ]
210 if $curuser->access_right('Export');
212 tie my %config_employees, 'Tie::IxHash',
213 'View/Edit employees' => [ $fsurl.'browse/access_user.html', 'Setup internal users' ],
214 'View/Edit employee groups' => [ $fsurl.'browse/access_group.html', 'Employee groups allow you to control access to the backend' ],
217 tie my %config_export_svc_pkg, 'Tie::IxHash',
218 'View/Edit exports' => [ $fsurl.'browse/part_export.cgi', 'Provisioning services to external machines, databases and APIs' ],
219 'View/Edit service definitions' => [ $fsurl.'browse/part_svc.cgi', 'Services are items you offer to your customers' ],
220 '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' ],
221 'View/Edit package classes' => [ $fsurl.'browse/pkg_class.html', 'Package classes define groups of packages, for reporting and convenience purposes.' ],
222 'View/Edit cancel reason types' => [ $fsurl.'browse/reason_type.html?class=C', 'Cancel reason types define groups of reasons, for reporting and convenience purposes.' ],
223 'View/Edit cancel reasons' => [ $fsurl.'browse/reason.html?class=C', 'Cancel reasons explain why a service was cancelled.' ],
224 'View/Edit suspend reason types' => [ $fsurl.'browse/reason_type.html?class=S', 'Suspend reason types define groups of reasons, for reporting and convenience purposes.' ],
225 'View/Edit suspend reasons' => [ $fsurl.'browse/reason.html?class=S', 'Suspend reasons explain why a service was suspended.' ],
228 tie my %config_agent, 'Tie::IxHash',
229 'View/Edit agent types' => [ $fsurl.'browse/agent_type.cgi', 'Agent types define groups of package definitions that you can then assign to particular agents' ],
230 '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)' ],
233 tie my %config_billing, 'Tie::IxHash',
234 'View/Edit payment gateways' => [ $fsurl.'browse/payment_gateway.html', 'Credit card and electronic check processors' ],
235 'View/Edit invoice events' => [ $fsurl.'browse/part_bill_event.cgi', 'Actions for overdue invoices' ],
236 'View/Edit prepaid cards' => [ $fsurl.'search/prepay_credit.html', 'View outstanding cards, generate new cards' ],
237 'View/Edit call rates and regions' => [ $fsurl.'browse/rate.cgi', 'Manage rate plans, regions and prefixes for VoIP and call billing' ],
238 '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' ],
241 tie my %config_dialup, 'Tie::IxHash',
242 'View/Edit access numbers' => [ $fsurl.'browse/svc_acct_pop.cgi', 'Points of Presence' ],
245 tie my %config_broadband, 'Tie::IxHash',
246 'View/Edit routers' => [ $fsurl.'browse/router.cgi', 'Broadband access routers' ],
247 'View/Edit address blocks' => [ $fsurl.'browse/addr_block.cgi', 'Manage address blocks and block assignments to broadband routers' ],
250 tie my %config_misc, 'Tie::IxHash';
251 $config_misc{'View/Edit advertising sources'} = [ $fsurl.'browse/part_referral.html', 'Where a customer heard about your service. Tracked for informational purposes' ]
252 if $curuser->access_right('Configuration')
253 || $curuser->access_right('Edit advertising sources')
254 || $curuser->access_right('Edit global advertising sources');
255 if ( $curuser->access_right('Configuration') ) {
256 $config_misc{'View/Edit virtual fields'} = [ $fsurl.'browse/part_virtual_field.cgi', 'Locally defined fields', ];
257 $config_misc{'View/Edit message catalog'} = [ $fsurl.'browse/msgcat.cgi', 'Change error messages and other customizable labels' ];
258 $config_misc{'View/Edit inventory classes and inventory'} = [ $fsurl.'browse/inventory_class.html', 'Setup inventory classes and stock inventory' ];
261 tie my %config_menu, 'Tie::IxHash';
262 if ( $curuser->access_right('Configuration' ) ) {
264 'Settings' => [ $fsurl.'config/config-view.cgi', '' ],
265 'separator' => '', #its a separator!
266 'Employees' => [ \%config_employees, '' ],
267 'Provisioning, services and packages'
268 => [ \%config_export_svc_pkg, '' ],
269 'Resellers' => [ \%config_agent, '' ],
270 'Billing' => [ \%config_billing, '' ],
271 'Dialup' => [ \%config_dialup, '' ],
272 'Fixed (username-less) broadband'
273 => [ \%config_broadband, '' ],
276 $config_menu{'Miscellaneous'} = [ \%config_misc, '' ]
277 if $curuser->access_right('Configuration')
278 || $curuser->access_right('Edit advertising sources')
279 || $curuser->access_right('Edit global advertising sources');
281 tie my %menu, 'Tie::IxHash',
282 'Billing Main' => [ $fsurl, 'Billing start page', ],
284 if ( $conf->config('ticket_system') ) {
285 $menu{'Ticketing Main'} =
287 ( $conf->config('ticket_system') eq 'RT_External'
288 ? FS::TicketSystem->baseurl()
291 'Ticketing start page',
294 $menu{'Reports'} = [ \%report_menu, 'Lists, reporting and graphing' ]
295 if keys %report_menu;
296 $menu{'Tools'} = [ \%tools_menu, 'Tools' ]
298 $menu{'Configuration'} = [ \%config_menu, 'Configuraiton and setup' ]
299 if $curuser->access_right('Configuration')
300 || $curuser->access_right('Edit advertising sources')
301 || $curuser->access_right('Edit global advertising sources');
303 use vars qw($gmenunum);
307 my($submenu, $title) = @_;
308 my $menunum = $gmenunum++;
310 #return two args: html, menuname
312 "var myMenu$menunum = new WebFXMenu;\n".
313 #"myMenu$menunum.useAutoPosition = true;\n".
314 "myMenu$menunum.emptyText = '$title';\n".
319 if ( !ref( $submenu->{$_} ) ) {
321 "myMenu$menunum.add(new WebFXMenuSeparator());";
325 my($url_or_submenu, $tooltip ) = @{ $submenu->{$_} };
326 if ( ref($url_or_submenu) ) {
328 my($subhtml, $submenuname ) = submenu($url_or_submenu, $_); #mmm, recursion
331 "myMenu$menunum.add(new WebFXMenuItem(\"$_\", null, \"$tooltip\", $submenuname ));";
335 "myMenu$menunum.add(new WebFXMenuItem(\"$_\", \"$url_or_submenu\", \"$tooltip\" ));";
343 "myMenu$menunum.width = 224\n",