3 my $conf = new FS::Conf;
4 my $fsurl = $opt{'freeside_baseurl'};
6 my $curuser = $FS::CurrentUser::CurrentUser;
8 #Active tickets not assigned to a customer
10 tie my %report_customers_lists, 'Tie::IxHash',
11 'by customer number' => [ $fsurl. 'search/cust_main.cgi?browse=custnum', '' ],
12 'by last name' => [ $fsurl. 'search/cust_main.cgi?browse=last', '' ],
13 'by company name' => [ $fsurl. 'search/cust_main.cgi?browse=company', '' ],
14 'by active trouble tickets' => [ $fsurl. 'search/cust_main.cgi?browse=tickets', '' ],
17 tie my %report_customers_search, 'Tie::IxHash',
18 'by ordering employee' => [ $fsurl. 'search/cust_main-otaker.cgi' ],
21 tie my %report_customers, 'Tie::IxHash',
22 'List customers' => [ \%report_customers_lists, 'List customers' ],
23 'Search customers' => [ \%report_customers_search, 'Search customers' ],
24 'Zip code distribution' => [ $fsurl.'search/report_cust_main-zip.html', 'Zip codes by number of customers' ],
27 tie my %report_invoices_open, 'Tie::IxHash',
28 'All open invoices' => [ $fsurl.'search/cust_bill.html?OPEN_date', 'All invoices with an unpaid balance' ],
29 '15 day open invoices' => [ $fsurl.'search/cust_bill.html?OPEN15_date', 'Invoices 15 days or older with an unpaid balance' ],
30 '30 day open invoices' => [ $fsurl.'search/cust_bill.html?OPEN30_date', 'Invoices 30 days or older with an unpaid balance' ],
31 '60 day open invoices' => [ $fsurl.'search/cust_bill.html?OPEN60_date', 'Invoices 60 days or older with an unpaid balance' ],
32 '90 day open invoices' => [ $fsurl.'search/cust_bill.html?OPEN90_date', 'Invoices 90 days or older with an unpaid balance' ],
33 '120 day open invoices' => [ $fsurl.'search/cust_bill.html?OPEN120_date', 'Invoices 120 days or older with an unpaid balance' ],
36 tie my %report_invoices, 'Tie::IxHash',
37 'Open invoices' => [ \%report_invoices_open, 'Open invoices' ],
38 'All invoices' => [ $fsurl. 'search/cust_bill.html?date', 'List all invoices' ],
39 'Advanced invoice reports' => [ $fsurl.'search/report_cust_bill.html', 'by agent, date range, etc.' ],
42 tie my %report_services_acct, 'Tie::IxHash',
43 'All accounts by username' => [ $fsurl.'search/svc_acct.cgi?username', '' ],
44 'All accounts by UID' => [ $fsurl.'search/svc_acct.cgi?uid', '' ],
46 $report_services_acct{'Unlinked accounts'} = [ $fsurl.'search/svc_acct.cgi?UN_uid', 'Pre-Freeside accounts without a customer record' ]
47 if $curuser->access_right('View/link unlinked services');
49 tie my %report_services_domain, 'Tie::IxHash',
50 'All domains' => [ $fsurl.'search/svc_domain.cgi?domain', '' ],
52 $report_services_domain{'Unlinked domains'} = [ $fsurl.'search/svc_domain.cgi?UN_domain', 'Pre-Freeside domains without a customer record' ]
53 if $curuser->access_right('View/link unlinked services');
55 tie my %report_services_forward, 'Tie::IxHash',
56 'All mail forwards' => [ $fsurl.'search/svc_forward.cgi?svcnum', '' ],
58 $report_services_forward{'Unlinked mail forwards'} = [ $fsurl.'search/svc_forward.cgi?UN_svcnum', 'Pre-Freeside mail forwards without a customer record' ]
59 if $curuser->access_right('View/link unlinked services');
61 tie my %report_services_www, 'Tie::IxHash',
62 'All virtual hosts' => [ $fsurl.'search/svc_www.cgi?svcnum', '' ],
64 $report_services_www{'Unlinked virtual hosts'} = [ $fsurl.'search/svc_www.cgi?UN_svcnum', 'Pre-Freeside virtual hosts without a customer record' ]
65 if $curuser->access_right('View/link unlinked services');
67 tie my %report_services_broadband, 'Tie::IxHash',
68 'All broadband services' => [ $fsurl.'search/svc_broadband.cgi?svcnum', '' ],
69 #'Unlinked domain' => [ $fsurl.'search/svc_acct.cgi?UN_uid', 'Pre-Freeside domains without a customer record' ],
72 tie my %report_services_phone, 'Tie::IxHash',
73 'All phone numbers' => [ $fsurl.'search/svc_phone.cgi?svcnum', '' ],
76 tie my %report_services_external, 'Tie::IxHash',
77 'All external services' => [ $fsurl.'search/svc_external.cgi?id', '' ],
79 $report_services_external{'Unlinked external services'} = [ $fsurl.'search/svc_external.cgi?UN_id', 'Pre-Freeside domains without a customer record' ]
80 if $curuser->access_right('View/link unlinked services');
82 tie my %report_services, 'Tie::IxHash';
83 if ( $curuser->access_right('Configuration') ) {
84 $report_services{'Service definitions'} = [ $fsurl.'browse/part_svc.cgi?orderby=active', 'Service definitions by number of active packages' ];
85 $report_services{'separator'} = '';
87 $report_services{'Accounts'} = [ \%report_services_acct, 'Access accounts and mailboxes' ];
88 $report_services{'Domains'} = [ \%report_services_domain, 'Domains', ];
89 $report_services{'Mail forwards'} = [ \%report_services_forward, 'Mail forwards', ];
90 $report_services{'Virtual hosts'} = [ \%report_services_www, 'Virtual hosting', ];
91 $report_services{'Broadband services'} = [ \%report_services_broadband, 'Fixed (username-less) broadband services', ];
92 $report_services{'Phone numbers'} = [ \%report_services_phone, 'Telephone numbers', ];
93 $report_services{'External services'} = [ \%report_services_external, 'External services', ];
95 tie my %report_packages, 'Tie::IxHash';
96 if ( $curuser->access_right('Configuration') ) {
97 $report_packages{'Package definitions'} = [ $fsurl.'browse/part_pkg.cgi?active=1', 'Package definitions by number of active packages' ];
98 $report_packages{'separator'} = '';
100 $report_packages{'All customer packages'} = [ $fsurl.'search/cust_pkg.cgi?pkgnum', 'List all customer packages', ];
101 $report_packages{'Suspended customer packages'} = [ $fsurl.'search/cust_pkg.cgi?magic=suspended', 'List suspended packages' ];
102 $report_packages{'Customer packages with unconfigured services'} = [ $fsurl.'search/cust_pkg.cgi?APKG_pkgnum', 'List packages which have provisionable services' ];
103 $report_packages{'Advanced package reports'} = [ $fsurl.'search/report_cust_pkg.html', 'by agent, date range, status, package definition' ];
105 tie my %report_rating, 'Tie::IxHash',
106 'Call Detail Records (CDRs)' => [ $fsurl.'search/report_cdr.html', '' ],
109 tie my %report_financial, 'Tie::IxHash',
110 'Sales, Credits and Receipts' => [ $fsurl.'graph/report_money_time.html', 'Sales, credits and receipts summary graph' ],
111 'Sales Report' => [ $fsurl.'graph/report_cust_bill_pkg.html', 'Sales report and graph (by agent, package class and/or date range)' ],
112 'Credit Report' => [ $fsurl.'search/report_cust_credit.html', 'Credit report (by employee and/or date range)' ],
113 'Payment Report' => [ $fsurl.'search/report_cust_pay.html', 'Credit report (by type and/or date range)' ],
114 'A/R Aging' => [ $fsurl.'search/report_receivables.html', 'Accounts Receivable Aging report' ],
115 'Prepaid Income' => [ $fsurl.'search/report_prepaid_income.html', 'Prepaid income (unearned revenue) report' ],
116 'Sales Tax Liability' => [ $fsurl.'search/report_tax.html', 'Sales tax liability report' ],
119 tie my %report_menu, 'Tie::IxHash';
120 $report_menu{'Customers'} = [ \%report_customers, 'Customer reports' ]
121 if $curuser->access_right('List customers');
122 $report_menu{'Invoices'} = [ \%report_invoices, 'Invoice reports' ]
123 if $curuser->access_right('List invoices');
124 $report_menu{'Packages'} = [ \%report_packages, 'Package reports' ]
125 if $curuser->access_right('List packages');
126 $report_menu{'Services'} = [ \%report_services, 'Services reports' ]
127 if $curuser->access_right('List services');
128 $report_menu{'Rating data'} = [ \%report_rating, 'Rating reports' ]
129 if $curuser->access_right('List rating data');
130 $report_menu{'Financial'} = [ \%report_financial, 'Financial reports' ]
131 if $curuser->access_right('Financial reports');
133 tie my %tools_importing, 'Tie::IxHash',
134 'Import customers from CSV file' => [ $fsurl.'misc/cust_main-import.cgi', '' ],
135 'Import one-time charges from CSV file' => [ $fsurl.'misc/cust_main-import_charges.cgi', '' ],
136 'Import Call Detail Records (CDRs) from CSV file' => [ $fsurl.'misc/cdr-import.html', '' ],
139 tie my %tools_exporting, 'Tie::IxHash',
140 'Download database dump' => [ $fsurl. 'misc/dump.cgi', '' ],
143 # <!-- <BR>View active NAS ports:
144 # <A HREF="browse/nas.cgi">session server</A> -->
145 # <!-- or <A HREF="browse/nas-sqlradius.cgi">RADIUS</A>
148 tie my %tools_menu, 'Tie::IxHash', ();
149 $tools_menu{'Quick payment entry'} = [ $fsurl.'misc/batch-cust_pay.html', 'Enter multiple payments in a batch' ]
150 if $curuser->access_right('Post payment batch');
151 $tools_menu{'Job Queue'} = [ $fsurl.'search/queue.html', 'View pending job queue' ]
152 if $curuser->access_right('Job queue');
153 $tools_menu{'Importing'} = [ \%tools_importing, 'Import tools' ]
154 if $curuser->access_right('Import');
155 $tools_menu{'Exporting'} = [ \%tools_exporting, 'Export tools' ]
156 if $curuser->access_right('Export');
158 tie my %config_employees, 'Tie::IxHash',
159 'View/Edit employees' => [ $fsurl.'browse/access_user.html', 'Setup internal users' ],
160 'View/Edit employee groups' => [ $fsurl.'browse/access_group.html', 'Employee groups allow you to control access to the backend' ],
163 tie my %config_export_svc_pkg, 'Tie::IxHash',
164 'View/Edit exports' => [ $fsurl.'browse/part_export.cgi', 'Provisioning services to external machines, databases and APIs' ],
165 'View/Edit service definitions' => [ $fsurl.'browse/part_svc.cgi', 'Services are items you offer to your customers' ],
166 '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' ],
167 'View/Edit package classes' => [ $fsurl.'browse/pkg_class.html', 'Package classes define groups of packages, for reporting and convenience purposes.' ],
170 tie my %config_agent, 'Tie::IxHash',
171 'View/Edit agent types' => [ $fsurl.'browse/agent_type.cgi', 'Agent types define groups of package definitions that you can then assign to particular agents' ],
172 '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)' ],
175 tie my %config_billing, 'Tie::IxHash',
176 'View/Edit payment gateways' => [ $fsurl.'browse/payment_gateway.html', 'Credit card and electronic check processors' ],
177 'View/Edit invoice events' => [ $fsurl.'browse/part_bill_event.cgi', 'Actions for overdue invoices' ],
178 'View/Edit prepaid cards' => [ $fsurl.'search/prepay_credit.html', 'View outstanding cards, generate new cards' ],
179 'View/Edit call rates and regions' => [ $fsurl.'browse/rate.cgi', 'Manage rate plans, regions and prefixes for VoIP and call billing' ],
180 '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' ],
183 tie my %config_dialup, 'Tie::IxHash',
184 'View/Edit access numbers' => [ $fsurl.'browse/svc_acct_pop.cgi', 'Points of Presence' ],
187 tie my %config_broadband, 'Tie::IxHash',
188 'View/Edit routers' => [ $fsurl.'browse/router.cgi', 'Broadband access routers' ],
189 'View/Edit address blocks' => [ $fsurl.'browse/addr_block.cgi', 'Manage address blocks and block assignments to broadband routers' ],
192 tie my %config_misc, 'Tie::IxHash',
193 'View/Edit advertising sources' => [ $fsurl.'browse/part_referral.cgi', 'Where a customer heard about your service. Tracked for informational purposes' ],
194 'View/Edit virtual fields' => [ $fsurl.'browse/part_virtual_field.cgi', 'Locally defined fields', ],
195 'View/Edit message catalog' => [ $fsurl.'browse/msgcat.cgi', 'Change error messages and other customizable labels' ],
196 'View/Edit inventory classes and inventory' => [ $fsurl.'browse/inventory_class.html', 'Setup inventory classes and stock inventory' ],
199 tie my %config_menu, 'Tie::IxHash',
200 'Settings' => [ $fsurl.'config/config-view.cgi', '' ],
201 'separator' => '', #its a separator!
202 'Employees' => [ \%config_employees, '' ],
203 'Provisioning, services and packages'
204 => [ \%config_export_svc_pkg, '' ],
205 'Resellers' => [ \%config_agent, '' ],
206 'Billing' => [ \%config_billing, '' ],
207 'Dialup' => [ \%config_dialup, '' ],
208 'Fixed (username-less) broadband'
209 => [ \%config_broadband, '' ],
210 'Miscellaneous' => [ \%config_misc, '' ],
213 tie my %menu, 'Tie::IxHash',
214 'Billing Main' => [ $fsurl, 'Billing start page', ],
215 'Ticketing Main' => [
216 ( $conf->config('ticket_system') eq 'RT_External'
217 ? FS::TicketSystem->baseurl()
220 'Ticketing start page',
223 $menu{'Reports'} = [ \%report_menu, 'Lists, reporting and graphing' ]
224 if keys %report_menu;
225 $menu{'Tools'} = [ \%tools_menu, 'Tools' ]
227 $menu{'Configuration'} = [ \%config_menu, 'Configuraiton and setup' ]
228 if $curuser->access_right('Configuration');
230 use vars qw($gmenunum);
234 my($submenu, $title) = @_;
235 my $menunum = $gmenunum++;
237 #return two args: html, menuname
239 "var myMenu$menunum = new WebFXMenu;\n".
240 #"myMenu$menunum.useAutoPosition = true;\n".
241 "myMenu$menunum.emptyText = '$title';\n".
246 if ( !ref( $submenu->{$_} ) ) {
248 "myMenu$menunum.add(new WebFXMenuSeparator());";
252 my($url_or_submenu, $tooltip ) = @{ $submenu->{$_} };
253 if ( ref($url_or_submenu) ) {
255 my($subhtml, $submenuname ) = submenu($url_or_submenu, $_); #mmm, recursion
258 "myMenu$menunum.add(new WebFXMenuItem(\"$_\", null, \"$tooltip\", $submenuname ));";
262 "myMenu$menunum.add(new WebFXMenuItem(\"$_\", \"$url_or_submenu\", \"$tooltip\" ));";
270 "myMenu$menunum.width = 224\n",
278 <script type="text/javascript" src="<%=$fsurl%>elements/cssexpr.js"></script>
279 <script type="text/javascript" src="<%=$fsurl%>elements/xmenu.js"></script>
280 <link href="<%=$fsurl%>elements/xmenu.css" type="text/css" rel="stylesheet">
281 <link href="<%=$fsurl%>elements/freeside.css" type="text/css" rel="stylesheet">
283 <SCRIPT TYPE="text/javascript">
285 webfxMenuImagePath = "<%=$fsurl%>images/";
286 webfxMenuUseHover = 1;
287 webfxMenuShowTime = 300;
288 webfxMenuHideTime = 300;
290 var myBar = new WebFXMenuBar;
292 <% foreach my $item ( keys %menu ) {
294 my( $url_or_submenu, $tooltip ) = @{ $menu{$item} };
296 if ( ref($url_or_submenu) ) {
300 my( $subhtml, $submenuname ) = submenu($url_or_submenu, $item);
305 myBar.add(new WebFXMenuButton("<%= $item %>", null, "<%= $tooltip %>", <%= $submenuname %> ));
309 myBar.add(new WebFXMenuButton("<%= $item %>", "<%= $url_or_submenu %>", "<%= $tooltip %>" ));
316 myBar.show( null, 'vertical' );
317 //myBar.show( null, 'horizontal' );
319 //var myMenu = new WebFXMenu;
320 //myMenu.add(new WebFXMenuItem("Menu Item 1", "http://www.domain.com", "Tool tip to show"));
321 //myMenu.add(new WebFXMenuSeparator());
322 //myMenu.add(new WebFXMenuItem("Menu Item 2", "http://www.domain.com", "Tool tip to show"));
324 //var mySubMenu = new WebFXMenu;
325 //mySubMenu.add(new WebFXMenuItem("Menu Item 3", "http://www.domain.com", "Tool tip to show"));
326 //myMenu.add(new WebFXMenuItem("Menu Item 4 with sub menu", null, "Tool tip to show", mySubMenu));