From ivan at wavetail.420.am Fri Jun 2 06:20:26 2006 From: ivan at wavetail.420.am (Ivan,,,) Date: Fri Jun 2 06:20:32 2006 Subject: [freeside-commits] freeside/httemplate/search svc_Smart.html, NONE, 1.1 Message-ID: <20060602132026.3E708FC872C@wavetail.420.am> Update of /home/cvs/cvsroot/freeside/httemplate/search In directory wavetail:/tmp/cvs-serv15334/httemplate/search Added Files: svc_Smart.html Log Message: add a service search --- NEW FILE: svc_Smart.html --- <% if ( $cgi->param('search_svc') =~ /\.[a-z]{2,8}$/i ) { # looks (enough) like a domain %><%= $cgi->redirect('svc_domain.cgi?domain='. uri_escape( $cgi->param('search_svc') ) ) %><% } elsif ( $cgi->param('search_svc') =~ /\w/ ) { #looks (enough) like a username %><%= $cgi->redirect('svc_acct.cgi?username_type=Exact;username='. uri_escape( $cgi->param('search_svc') ) ) %><% } else { %><%= include('/elements/header.html', 'Unrecognized service string') %> <%= include('/elements/footer.html') %><% } %> From ivan at wavetail.420.am Fri Jun 2 06:20:26 2006 From: ivan at wavetail.420.am (Ivan,,,) Date: Fri Jun 2 06:20:32 2006 Subject: [freeside-commits] freeside/rt/html/Elements Tabs, 1.7, 1.8 FreesideSvcSearch, NONE, 1.1 PageLayout, 1.7, 1.8 Message-ID: <20060602132026.41CF6FC8A23@wavetail.420.am> Update of /home/cvs/cvsroot/freeside/rt/html/Elements In directory wavetail:/tmp/cvs-serv15334/rt/html/Elements Modified Files: Tabs PageLayout Added Files: FreesideSvcSearch Log Message: add a service search Index: Tabs =================================================================== RCS file: /home/cvs/cvsroot/freeside/rt/html/Elements/Tabs,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- Tabs 15 May 2006 11:05:04 -0000 1.7 +++ Tabs 2 Jun 2006 13:20:24 -0000 1.8 @@ -63,7 +63,9 @@ }, B => { html => $m->scomp('/Elements/FreesideSearch') }, - C => { html => $m->scomp('/Elements/SimpleSearch') + C => { html => $m->scomp('/Elements/FreesideSvcSearch') + }, + D => { html => $m->scomp('/Elements/SimpleSearch') } }; my $basetabs = { Index: PageLayout =================================================================== RCS file: /home/cvs/cvsroot/freeside/rt/html/Elements/PageLayout,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- PageLayout 15 May 2006 11:05:04 -0000 1.7 +++ PageLayout 2 Jun 2006 13:20:24 -0000 1.8 @@ -45,14 +45,14 @@ %# END BPS TAGGED BLOCK }}} - + - +%# -% foreach my $action (sort keys %{$topactions}) { - % } --- NEW FILE: FreesideSvcSearch ---   From ivan at wavetail.420.am Fri Jun 2 06:20:25 2006 From: ivan at wavetail.420.am (Ivan,,,) Date: Fri Jun 2 06:22:36 2006 Subject: [freeside-commits] freeside/httemplate/elements header.html, 1.6, 1.7 Message-ID: <20060602132025.3E7C1FC8A20@wavetail.420.am> Update of /home/cvs/cvsroot/freeside/httemplate/elements In directory wavetail:/tmp/cvs-serv15334/httemplate/elements Modified Files: header.html Log Message: add a service search Index: header.html =================================================================== RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/header.html,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- header.html 15 May 2006 13:57:15 -0000 1.6 +++ header.html 2 Jun 2006 13:20:23 -0000 1.7 @@ -21,9 +21,12 @@ if ( what.value = '(cust #, name or company)' ) what.value = ''; } - - @@ -60,37 +67,36 @@ -<% if ( $cust_main->ncancelled_pkgs ) { %> +<% if ( $curuser->access_right('Cancel customer') + && $cust_main->ncancelled_pkgs + ) { +%> + Cancel this customer | +<% } %> - | Cancel this customer +<% if ( $conf->exists('deletecustomers') + && $curuser->access_right('Delete customer') + ) { +%> + Delete this customer | <% } %> -<% -print qq! | !. - 'Delete this customer' - if $conf->exists('deletecustomers'); +<% unless ( $conf->exists('disable_customer_referrals') ) { %> + Refer a new customer | + View this customer's referrals +<% } %> -unless ( $conf->exists('disable_customer_referrals') ) { - print qq! | !, - qq!Refer a new customer!; - print qq! | !, - qq!View this customer's referrals!; -} - -print '

'; +

+<% my $signupurl = $conf->config('signupurl'); if ( $signupurl ) { -print "This customer's signup URL: ". - "$signupurl?ref=$custnum

"; -} - %> + This customer's signup URL: <%= $signupurl %>?ref=<%= $custnum %>

+<% } %>
<%$AppName%> - <%$AppName%> +%# +% my $notfirst = 0; foreach my $action (sort keys %{$topactions}) { + > <%$topactions->{"$action"}->{'html'} |n %>
@@ -135,5 +141,4 @@ <%= include('cust_main/payment_history.html', $cust_main ) %> <% } %> - - +<%= include('/elements/footer.html') %> From ivan at wavetail.420.am Mon Jun 19 04:25:15 2006 From: ivan at wavetail.420.am (Ivan,,,) Date: Mon Jun 19 04:25:24 2006 Subject: [freeside-commits] freeside/FS/FS AccessRight.pm, 1.2, 1.3 access_user.pm, 1.2, 1.3 cust_main.pm, 1.216, 1.217 Message-ID: <20060619112515.1A80EFC827A@wavetail.420.am> Update of /home/cvs/cvsroot/freeside/FS/FS In directory wavetail:/tmp/cvs-serv15649/FS/FS Modified Files: AccessRight.pm access_user.pm cust_main.pm Log Message: ACLs, take three or four or something Index: access_user.pm =================================================================== RCS file: /home/cvs/cvsroot/freeside/FS/FS/access_user.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- access_user.pm 19 Jun 2006 02:33:52 -0000 1.2 +++ access_user.pm 19 Jun 2006 11:25:13 -0000 1.3 @@ -192,6 +192,29 @@ ' )'; } +=item access_right + +Given a right name, returns true if this user has this right (currently via +group membership, eventually also via user overrides). + +=cut + +sub access_right { + my( $self, $rightname ) = @_; + my $sth = dbh->prepare(" + SELECT groupnum FROM access_usergroup + LEFT JOIN access_group USING ( groupnum ) + LEFT JOIN access_right + ON ( access_group.groupnum = access_right.rightobjnum ) + WHERE usernum = ? + AND righttype = 'FS::access_group' + AND rightname = ? + ") or die dbh->errstr; + $sth->execute($self->usernum, $rightname) or die $sth->errstr; + my $row = $sth->fetchrow_arrayref; + $row ? $row->[0] : ''; +} + =back =head1 BUGS Index: AccessRight.pm =================================================================== RCS file: /home/cvs/cvsroot/freeside/FS/FS/AccessRight.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- AccessRight.pm 18 Jun 2006 12:54:48 -0000 1.2 +++ AccessRight.pm 19 Jun 2006 11:25:13 -0000 1.3 @@ -84,10 +84,13 @@ #'View Customer | View tickets', 'Edit customer', 'Cancel customer', - 'Delete customer', + 'Complimentary customer', #aka users-allow_comp + 'Delete customer', #aka. deletecustomers #Enable customer deletions. Be very careful! Deleting a customer will remove all traces that this customer ever existed! It should probably only be used when auditing a legacy database. Normally, you cancel all of a customers' packages if they cancel service. 'Order customer package', + 'One-time charge', 'Change customer package', + 'Bulk change customer packages', 'Edit customer package dates', 'Customize customer package', 'Suspend customer package', @@ -95,14 +98,43 @@ 'Cancel customer package immediately', 'Cancel customer package later', - 'Provision service', - 'Unprovision service', - #legacy link stuff + 'Provision customer service', + 'Unprovision customer service', + + 'View/link unlinked services', #not agent-virtualizable without more work + + 'View invoices', 'Post payment', + 'Post payment batch', + 'Unapply payment', #aka. unapplypayments Enable "unapplication" of unclosed payments. 'Process payment', + 'Refund payment', + + 'Delete payment', #aka. deletepayments - Enable deletion of unclosed payments. Be very careful! Only delete payments that were data-entry errors, not adjustments. Optionally specify one or more comma-separated email addresses to be notified when a payment is deleted. + 'Post credit', - #more financial stuff + #'Apply credit', + 'Unapply credit', #aka unapplycredits Enable "unapplication" of unclosed credits. + 'Delete credit', #aka. deletecredits Enable deletion of unclosed credits. Be very careful! Only delete credits that were data-entry errors, not adjustments. Optionally specify one or more comma-separated email addresses to be notified when a credit is deleted. + + 'Credit card void', #aka. cc-void #Enable local-only voiding of echeck payments in addition to refunds against the payment gateway + 'Echeck void', #aka. echeck-void #Enable local-only voiding of echeck payments in addition to refunds against the payment gateway + 'Unvoid', #aka. unvoid #Enable unvoiding of voided payments + + 'List customers', + #'List zip codes', + 'List invoices', + 'List packages', + 'List services', + + 'Financial reports', + + 'Job queue', # these are not currently agent-virtualized + 'Import', # + 'Export', # + + 'Configuration', #none of the configuraiton is agent-virtualized either ); Index: cust_main.pm =================================================================== RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main.pm,v retrieving revision 1.216 retrieving revision 1.217 diff -u -d -r1.216 -r1.217 --- cust_main.pm 19 Jun 2006 02:33:52 -0000 1.216 +++ cust_main.pm 19 Jun 2006 11:25:13 -0000 1.217 @@ -944,10 +944,13 @@ $old = qsearchs( 'cust_main', { 'custnum' => $self->custnum } ); } - if ( $self->payby eq 'COMP' && $self->payby ne $old->payby - && $conf->config('users-allow_comp') ) { - return "You are not permitted to create complimentary accounts." - unless grep { $_ eq getotaker } $conf->config('users-allow_comp'); + my $curuser = $FS::CurrentUser::CurrentUser; + if ( $self->payby eq 'COMP' + && $self->payby ne $old->payby + && ! $curuser->access_right('Complimentary customer') + ) + { + return "You are not permitted to create complimentary accounts."; } local($ignore_expired_card) = 1 @@ -1302,9 +1305,12 @@ } elsif ( $self->payby eq 'COMP' ) { - if ( !$self->custnum && $conf->config('users-allow_comp') ) { + my $curuser = $FS::CurrentUser::CurrentUser; + if ( ! $self->custnum + && ! $curuser->access_right('Complimentary customer') + ) + { return "You are not permitted to create complimentary accounts." - unless grep { $_ eq getotaker } $conf->config('users-allow_comp'); } $error = $self->ut_textn('payinfo'); From ivan at wavetail.420.am Mon Jun 19 04:25:15 2006 From: ivan at wavetail.420.am (Ivan,,,) Date: Mon Jun 19 04:28:40 2006 Subject: [freeside-commits] freeside/httemplate/elements menu.html,1.4,1.5 Message-ID: <20060619112515.1AA4AFC85D9@wavetail.420.am> Update of /home/cvs/cvsroot/freeside/httemplate/elements In directory wavetail:/tmp/cvs-serv15649/httemplate/elements Modified Files: menu.html Log Message: ACLs, take three or four or something Index: menu.html =================================================================== RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/menu.html,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- menu.html 19 Jun 2006 08:05:28 -0000 1.4 +++ menu.html 19 Jun 2006 11:25:13 -0000 1.5 @@ -3,6 +3,8 @@ my $conf = new FS::Conf; my $fsurl = $opt{'freeside_baseurl'}; + my $curuser = $FS::CurrentUser::CurrentUser; + #Active tickets not assigned to a customer tie my %report_customers_lists, 'Tie::IxHash', @@ -40,23 +42,27 @@ tie my %report_services_acct, 'Tie::IxHash', 'All accounts by username' => [ $fsurl.'search/svc_acct.cgi?username', '' ], 'All accounts by UID' => [ $fsurl.'search/svc_acct.cgi?uid', '' ], - 'Unlinked accounts' => [ $fsurl.'search/svc_acct.cgi?UN_uid', 'Pre-Freeside accounts without a customer record' ], ; + $report_services_acct{'Unlinked accounts'} = [ $fsurl.'search/svc_acct.cgi?UN_uid', 'Pre-Freeside accounts without a customer record' ] + if $curuser->access_right('View/link unlinked services'); tie my %report_services_domain, 'Tie::IxHash', 'All domains' => [ $fsurl.'search/svc_domain.cgi?domain', '' ], - 'Unlinked domains' => [ $fsurl.'search/svc_domain.cgi?UN_domain', 'Pre-Freeside domains without a customer record' ], ; + $report_services_domain{'Unlinked domains'} = [ $fsurl.'search/svc_domain.cgi?UN_domain', 'Pre-Freeside domains without a customer record' ] + if $curuser->access_right('View/link unlinked services'); tie my %report_services_forward, 'Tie::IxHash', 'All mail forwards' => [ $fsurl.'search/svc_forward.cgi?svcnum', '' ], - 'Unlinked mail forwards' => [ $fsurl.'search/svc_forward.cgi?UN_svcnum', 'Pre-Freeside mail forwards without a customer record' ], ; + $report_services_forward{'Unlinked mail forwards'} = [ $fsurl.'search/svc_forward.cgi?UN_svcnum', 'Pre-Freeside mail forwards without a customer record' ] + if $curuser->access_right('View/link unlinked services'); tie my %report_services_www, 'Tie::IxHash', 'All virtual hosts' => [ $fsurl.'search/svc_www.cgi?svcnum', '' ], - 'Unlinked virtual hosts' => [ $fsurl.'search/svc_www.cgi?UN_svcnum', 'Pre-Freeside virtual hosts without a customer record' ], ; + $report_services_www{'Unlinked virtual hosts'} = [ $fsurl.'search/svc_www.cgi?UN_svcnum', 'Pre-Freeside virtual hosts without a customer record' ] + if $curuser->access_right('View/link unlinked services'); tie my %report_services_broadband, 'Tie::IxHash', 'All broadband services' => [ $fsurl.'search/svc_broadband.cgi?svcnum', '' ], @@ -65,28 +71,31 @@ tie my %report_services_external, 'Tie::IxHash', 'All external services' => [ $fsurl.'search/svc_external.cgi?id', '' ], - 'Unlinked external services' => [ $fsurl.'search/svc_external.cgi?UN_id', 'Pre-Freeside domains without a customer record' ], ; + $report_services_external{'Unlinked external services'} = [ $fsurl.'search/svc_external.cgi?UN_id', 'Pre-Freeside domains without a customer record' ] + if $curuser->access_right('View/link unlinked services'); - tie my %report_services, 'Tie::IxHash', - 'Service definitions' => [ $fsurl.'browse/part_svc.cgi?orderby=active', 'Service definitions by number of active packages' ], - 'separator' => '', - 'Accounts' => [ \%report_services_acct, 'Access accounts and mailboxes' ], - 'Domains' => [ \%report_services_domain, 'Domains', ], - 'Mail forwards' => [ \%report_services_forward, 'Mail forwards', ], - 'Virtual hosts' => [ \%report_services_www, 'Virtual hosting', ], - 'Broadband services' => [ \%report_services_broadband, 'Fixed (username-less) broadband services', ], - 'External services' => [ \%report_services_external, 'External services', ], - ; + tie my %report_services, 'Tie::IxHash'; + if ( $curuser->access_right('Configuration') ) { + $report_services{'Service definitions'} = [ $fsurl.'browse/part_svc.cgi?orderby=active', 'Service definitions by number of active packages' ]; + $report_services{'separator'} = ''; + } + $report_services{'Accounts'} = [ \%report_services_acct, 'Access accounts and mailboxes' ]; + $report_services{'Domains'} = [ \%report_services_domain, 'Domains', ]; + $report_services{'Mail forwards'} = [ \%report_services_forward, 'Mail forwards', ]; + $report_services{'Virtual hosts'} = [ \%report_services_www, 'Virtual hosting', ]; + $report_services{'Broadband services'} = [ \%report_services_broadband, 'Fixed (username-less) broadband services', ]; + $report_services{'External services'} = [ \%report_services_external, 'External services', ]; - tie my %report_packages, 'Tie::IxHash', - 'Package definitions' => [ $fsurl.'browse/part_pkg.cgi?active=1', 'Package definitions by number of active packages' ], - 'separator' => '', - 'All customer packages' => [ $fsurl.'search/cust_pkg.cgi?pkgnum', 'List all customer packages', ], - 'Suspended customer packages' => [ $fsurl.'search/cust_pkg.cgi?magic=suspended', 'List suspended packages' ], - 'Customer packages with unconfigured services' => [ $fsurl.'search/cust_pkg.cgi?APKG_pkgnum', 'List packages which have provisionable services' ], - 'Advanced package reports' => [ $fsurl.'search/report_cust_pkg.html', 'by agent, date range, status, package definition' ], - ; + tie my %report_packages, 'Tie::IxHash'; + if ( $curuser->access_right('Configuration') ) { + $report_packages{'Package definitions'} = [ $fsurl.'browse/part_pkg.cgi?active=1', 'Package definitions by number of active packages' ]; + $report_packages{'separator'} = ''; + } + $report_packages{'All customer packages'} = [ $fsurl.'search/cust_pkg.cgi?pkgnum', 'List all customer packages', ]; + $report_packages{'Suspended customer packages'} = [ $fsurl.'search/cust_pkg.cgi?magic=suspended', 'List suspended packages' ]; + $report_packages{'Customer packages with unconfigured services'} = [ $fsurl.'search/cust_pkg.cgi?APKG_pkgnum', 'List packages which have provisionable services' ]; + $report_packages{'Advanced package reports'} = [ $fsurl.'search/report_cust_pkg.html', 'by agent, date range, status, package definition' ]; tie my %report_financial, 'Tie::IxHash', 'Sales, Credits and Receipts' => [ $fsurl.'graph/report_money_time.html', 'Sales, credits and receipts summary graph' ], @@ -98,13 +107,17 @@ 'Sales Tax Liability' => [ $fsurl.'search/report_tax.html', 'Sales tax liability report' ], ; - tie my %report_menu, 'Tie::IxHash', - 'Customers' => [ \%report_customers, 'Customer reports' ], - 'Invoices' => [ \%report_invoices, 'Invoice reports' ], - 'Packages' => [ \%report_packages, 'Package reports' ], - 'Services' => [ \%report_services, 'Services reports' ], - 'Financial' => [ \%report_financial, 'Financial reports' ], - ; + tie my %report_menu, 'Tie::IxHash'; + $report_menu{'Customers'} = [ \%report_customers, 'Customer reports' ] + if $curuser->access_right('List customers'); + $report_menu{'Invoices'} = [ \%report_invoices, 'Invoice reports' ] + if $curuser->access_right('List invoices'); + $report_menu{'Packages'} = [ \%report_packages, 'Package reports' ] + if $curuser->access_right('List packages'); + $report_menu{'Services'} = [ \%report_services, 'Services reports' ] + if $curuser->access_right('List services'); + $report_menu{'Financial'} = [ \%report_financial, 'Financial reports' ] + if $curuser->access_right('Financial reports'); tie my %tools_importing, 'Tie::IxHash', 'Import customers from CSV file' => [ $fsurl.'misc/cust_main-import.cgi', '' ], @@ -120,12 +133,15 @@ # - tie my %tools_menu, 'Tie::IxHash', - 'Quick payment entry' => [ $fsurl.'misc/batch-cust_pay.html', 'Enter multiple payments in a batch' ], - 'Job Queue' => [ $fsurl.'search/queue.html', 'View pending job queue' ], - 'Importing' => [ \%tools_importing, 'Import tools' ], - 'Exporting' => [ \%tools_exporting, 'Export tools' ], - ; + 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'); + $tools_menu{'Job Queue'} = [ $fsurl.'search/queue.html', 'View pending job queue' ] + if $curuser->access_right('Job queue'); + $tools_menu{'Importing'} = [ \%tools_importing, 'Import tools' ] + if $curuser->access_right('Import'); + $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' ], @@ -191,10 +207,13 @@ ), 'Ticketing start page', ], - 'Reports' => [ \%report_menu, 'Lists, reporting and graphing' ], - 'Tools' => [ \%tools_menu, 'Tools' ], - 'Configuration' => [ \%config_menu, 'Configuraiton and setup' ], ; + $menu{'Reports'} = [ \%report_menu, 'Lists, reporting and graphing' ] + if keys %report_menu; + $menu{'Tools'} = [ \%tools_menu, 'Tools' ] + if keys %tools_menu; + $menu{'Configuration'} = [ \%config_menu, 'Configuraiton and setup' ] + if $curuser->access_right('Configuration'); use vars qw($gmenunum); $gmenunum = 0; From ivan at wavetail.420.am Mon Jun 19 04:25:16 2006 From: ivan at wavetail.420.am (Ivan,,,) Date: Mon Jun 19 04:47:32 2006 Subject: [freeside-commits] freeside/httemplate/view/cust_main packages.html, 1.4, 1.5 payment_history.html, 1.9, 1.10 Message-ID: <20060619112516.37524FC875F@wavetail.420.am> Update of /home/cvs/cvsroot/freeside/httemplate/view/cust_main In directory wavetail:/tmp/cvs-serv15649/httemplate/view/cust_main Modified Files: packages.html payment_history.html Log Message: ACLs, take three or four or something Index: payment_history.html =================================================================== RCS file: /home/cvs/cvsroot/freeside/httemplate/view/cust_main/payment_history.html,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- payment_history.html 14 May 2006 16:47:31 -0000 1.9 +++ payment_history.html 19 Jun 2006 11:25:14 -0000 1.10 @@ -4,6 +4,8 @@ my $conf = new FS::Conf; + my $curuser = $FS::CurrentUser::CurrentUser; + my @payby = grep /\w/, $conf->config('payby'); #@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP )) @payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP )) @@ -16,42 +18,48 @@

Payment History
-<% if ( $payby{'BILL'} ) { %> +<% if ( $payby{'BILL'} && $curuser->access_right('Post payment') ) { %> <%= $s++ ? ' | ' : '' %> Post check payment <% } %> -<% if ( $payby{'CASH'} ) { %> +<% if ( $payby{'CASH'} && $curuser->access_right('Post payment') ) { %> <%= $s++ ? ' | ' : '' %> Post cash payment <% } %> -<% if ( $payby{'WEST'} ) { %> +<% if ( $payby{'WEST'} && $curuser->access_right('Post payment') ) { %> <%= $s++ ? ' | ' : '' %> Post Western Union payment <% } %> -<% if ( $payby{'CARD'} || $payby{'DCRD'} ) { %> +<% if ( ( $payby{'CARD'} || $payby{'DCRD'} ) + && $curuser->access_right('Process payment') + ) { +%> <%= $s++ ? ' | ' : '' %> Process credit card payment <% } %> -<% if ( $payby{'CHEK'} || $payby{'DCHK'} ) { %> +<% if ( ( $payby{'CHEK'} || $payby{'DCHK'} ) + && $curuser->access_right('Process payment') + ) { +%> <%= $s++ ? ' | ' : '' %> Process electronic check (ACH) payment <% } %> -<% if ( $payby{'MCRD'} ) { %> +<% if ( $payby{'MCRD'} && $curuser->access_right('Post payment') ) { %> <%= $s++ ? ' | ' : '' %> Post manual credit card payment @@ -60,9 +68,13 @@
-Post credit +<% if ( $curuser->access_right('Post credit') ) { %> -
+ Post credit + +
+ +<% } %> <% #get payment history @@ -75,11 +87,14 @@ : ''; my $post = ( $cust_bill->owed > 0 ) ? '' : ''; my $invnum = $cust_bill->invnum; + my $link = $curuser->access_right('View invoices') + ? qq!! + : ''; push @history, { 'date' => $cust_bill->_date, - 'desc' => qq!!. $pre. + 'desc' => $link. $pre. "Invoice #$invnum (Balance \$". $cust_bill->owed. ')'. - $post. '', + $post. ( $link ? '' : '' ), 'charge' => $cust_bill->charged, }; } @@ -169,6 +184,7 @@ && $cust_pay->payby =~ /^(CARD|CHEK)$/ && time-$cust_pay->_date < $refund_days*86400 && $cust_pay->unrefunded > 0 + && $curuser->access_right('Refund payment') ) { $refund = qq! (closed !~ /^Y/i - && ( $cust_pay->payby ne 'CARD' || $conf->exists('cc-void') ) - && ( $cust_pay->payby ne 'CHEK' || $conf->exists('echeck-void') ) - ) { + && ( ( $cust_pay->payby eq 'CARD' + && $conf->exists('cc-void') + && $curuser->acccess_right('Credit card void') + ) + || ( $cust_pay->payby eq 'CHEK' + && $conf->exists('echeck-void') + && $curuser->acccess_right('Echeck void') + ) + ) + ) + { $void = qq! (closed !~ /^Y/i && $conf->exists('deletepayments') ) { + if ( $cust_pay->closed !~ /^Y/i + && $conf->exists('deletepayments') + && $curuser->access_right('Delete payment') + ) + { $delete = qq! (closed !~ /^Y/i && $conf->exists('unapplypayments') - && scalar(@cust_bill_pay) ) { + && scalar(@cust_bill_pay) + && $curuser->access_right('Unapply payment') + ) + { $unapply = qq! (closed !~ /^Y/i && $conf->exists('unvoid') ) { + if ( $cust_pay_void->closed !~ /^Y/i + && $conf->exists('unvoid') + && $curuser->access_right('Unvoid') + ) + { $unvoid = qq! (closed !~ /^Y/i && $conf->exists('deletecredits') ) { + if ( $cust_credit->closed !~ /^Y/i + && $conf->exists('deletecredits') + && $curuser->access_right('Delete credit') + ) + { $delete = qq! (!. @@ -324,7 +363,10 @@ my $unapply = ''; if ( $cust_credit->closed !~ /^Y/i && $conf->exists('unapplycredits') - && scalar(@cust_credit_bill) ) { + && scalar(@cust_credit_bill) + && $curuser->access_right('Unapply credit') + ) + { $unapply = qq! (!. Index: packages.html =================================================================== RCS file: /home/cvs/cvsroot/freeside/httemplate/view/cust_main/packages.html,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- packages.html 14 May 2006 16:47:31 -0000 1.4 +++ packages.html 19 Jun 2006 11:25:14 -0000 1.5 @@ -2,6 +2,8 @@ my( $cust_main ) = @_; my $conf = new FS::Conf; + my $curuser = $FS::CurrentUser::CurrentUser; + my $packages = get_packages($cust_main, $conf); %> @@ -11,13 +13,21 @@ Packages -<%= include('order_pkg.html', $cust_main ) %> +<% if ( $curuser->access_right('Order customer package') ) { %> + <%= include('order_pkg.html', $cust_main ) %> +<% } %> -<% if ( $conf->config('payby-default') ne 'HIDE' ) { %> +<% if ( $curuser->access_right('One-time charge') + && $conf->config('payby-default') ne 'HIDE' + ) { +%> <%= include('quick-charge.html', $cust_main ) %> <% } %> -Bulk order and cancel packages (preserves services) +<% if ( $curuser->access_right('Bulk change customer packages') ) { %> + Bulk order and cancel packages (preserves services) +<% } %> +

<% if ( @$packages ) { %> @@ -70,10 +80,19 @@
> <%=$pkg->{pkgnum}%>: <%=$pkg->{pkg}%> - <%=$pkg->{comment}%>
-<% unless ($pkg->{cancel}) { %> - ( <%=pkg_change_link($pkg)%> ) - ( <%=pkg_dates_link($pkg)%> | <%=pkg_customize_link($pkg,$cust_main->custnum)%> ) -<% } %> + + <% unless ( $pkg->{cancel} ) { %> + <% if ( $curuser->access_right('Change customer package') ) { %> + ( <%=pkg_change_link($pkg)%> ) + <% } %> + <% if ( $curuser->access_right('Edit customer package dates') ) { %> + ( <%=pkg_dates_link($pkg)%> ) + <% } %> + <% if ( $curuser->access_right('Customize customer package') ) { %> + ( <%=pkg_customize_link($pkg,$cust_main->custnum)%> ) + <% } %> + <% } %> +
> @@ -182,7 +201,16 @@ <% } %> - + <% } else { %> @@ -196,7 +224,13 @@ - + <% } else { %> @@ -258,7 +292,19 @@ <% if ( $pkg->{freq} ) { %> - + <% } %> @@ -278,14 +324,20 @@ print '' if ($cnt > 0); %> - + <% $cnt++; } - if ($svcpart->{count} < $svcpart->{quantity}) { + if ( $svcpart->{count} < $svcpart->{quantity} + && $curuser->access_right('Provision customer services') + ) { print qq!\n! if ($cnt > 0); - print qq! \n\n!; + print qq! \n\n!; } } } @@ -393,7 +445,7 @@ } sub svc_provision_link { - my ($pkg, $svcpart, $conf) = @_; + my ($pkg, $svcpart, $conf, $curuser) = @_; ( my $svc_nbsp = $svcpart->{svc} ) =~ s/\s+/ /g; my $num_left = $svcpart->{quantity} - $svcpart->{count}; my $pkgnum_svcpart = "pkgnum$pkg->{pkgnum}-svcpart$svcpart->{svcpart}"; @@ -411,7 +463,10 @@ my $link = qq!!. "Provision $svc_nbsp ($num_left)"; - if ( $conf->exists('legacy_link') ) { + if ( $conf->exists('legacy_link') + && $curuser->access_right('View/link unlinked services') + ) + { $link .= '
'. qq!!. @@ -475,7 +530,11 @@ my $pkg = shift or return ''; qq!!. - qq!Cancel now | !. + qq!Cancel now!; +} + +sub pkg_expire_link { + my $pkg = shift or return ''; qq!Cancel later!; } From ivan at wavetail.420.am Mon Jun 19 04:57:41 2006 From: ivan at wavetail.420.am (Ivan,,,) Date: Mon Jun 19 04:57:44 2006 Subject: [freeside-commits] freeside Changes.1.7.0, 1.1, 1.2 README.1.7.0, 1.5, 1.6 Message-ID: <20060619115741.E18DDFC827A@wavetail.420.am> Update of /home/cvs/cvsroot/freeside In directory wavetail:/tmp/cvs-serv15984 Modified Files: Changes.1.7.0 README.1.7.0 Log Message: ACL bootstrapping/upgrade Index: README.1.7.0 =================================================================== RCS file: /home/cvs/cvsroot/freeside/README.1.7.0,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- README.1.7.0 23 May 2006 15:54:50 -0000 1.5 +++ README.1.7.0 19 Jun 2006 11:57:39 -0000 1.6 @@ -18,6 +18,10 @@ (if freeside-upgrade hangs, try stopping Apache, all Freeside processes, and anything else connected to your database, especially on older Pg versions) +ACL bootstrapping: + - Run "bin/mapsecrets2access_user username" + - You can then add more restrictive groups and move your users into them + If you have any records in the cust_tax_exempt table, you *MUST* migrate them to the new cust_tax_exempt_pkg table. An example script to get you started is in bin/fs-migrate-cust_tax_exempt - it may need to be customized for your Index: Changes.1.7.0 =================================================================== RCS file: /home/cvs/cvsroot/freeside/Changes.1.7.0,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Changes.1.7.0 14 May 2006 16:47:29 -0000 1.1 +++ Changes.1.7.0 19 Jun 2006 11:57:39 -0000 1.2 @@ -9,6 +9,11 @@ - gross sales report/graph broken down by agent and package class - config switch to base tax off shipping address if present (warning: tax reports can take a long time with this switch on) - plesk provisioning +- "inactive" package status +- more options in package report (classes, etc.) +and (now they're finally here)... +- ACLs +- Agent virtualization -------- some of the above, nicely: @@ -33,7 +38,3 @@ - Bookeeping/Collections | Sales report (by agent, package class ... -------- - -and... -- ACLs -- Agent virtualization From ivan at wavetail.420.am Mon Jun 19 04:57:41 2006 From: ivan at wavetail.420.am (Ivan,,,) Date: Mon Jun 19 04:57:44 2006 Subject: [freeside-commits] freeside/bin mapsecrets2access_user,NONE,1.1 Message-ID: <20060619115741.0D72AFC8302@wavetail.420.am> Update of /home/cvs/cvsroot/freeside/bin In directory wavetail:/tmp/cvs-serv15984/bin Added Files: mapsecrets2access_user Log Message: ACL bootstrapping/upgrade --- NEW FILE: mapsecrets2access_user --- #!/usr/bin/perl -w use strict; use File::Copy "cp"; use FS::UID qw(adminsuidsetup); use FS::AccessRight; use FS::Record qw(qsearchs qsearch); use FS::access_group; use FS::access_user; use FS::access_usergroup; use FS::access_right; use FS::access_groupagent; use FS::agent; adminsuidsetup shift; my $supergroup = qsearchs('access_group', { 'groupname' => 'Superuser' } ); unless ( $supergroup ) { $supergroup = new FS::access_group { 'groupname' => 'Superuser' }; my $error = $supergroup->insert; die $error if $error; foreach my $rightname ( FS::AccessRight->rights ) { my $access_right = new FS::access_right { 'righttype' => 'FS::access_group', 'rightobjnum' => $supergroup->groupnum, 'rightname' => $rightname, }; my $ar_error = $access_right->insert; die $ar_error if $ar_error; } foreach my $agent ( qsearch('agent', {} ) ) { my $access_groupagent = new FS::access_groupagent { 'groupnum' => $supergroup->groupnum, 'agentnum' => $agent->agentnum, }; my $aga_error = $access_groupagent->insert; die $aga_error if $aga_error; } } my $supergroupnum = $supergroup->groupnum; my $mapsecrets = '/usr/local/etc/freeside/mapsecrets'; open(MAPSECRETS, "<$mapsecrets"); while () { /([\w]+)\s+secrets\s*$/ or die "unparsable line in mapsecrets: $_"; my $username = $1; next if qsearchs('access_user', { 'username' => $username } ); my $access_user = new FS::access_user { 'username' => $username, '_password' => 'notyet', 'first' => 'Legacy', 'last' => 'User', }; my $au_error = $access_user->insert; die $au_error if $au_error; my $access_usergroup = new FS::access_usergroup { 'usernum' => $access_user->usernum, 'groupnum' => $supergroupnum, }; my $aug_error = $access_usergroup->insert; die $aug_error if $aug_error; } # okay to clobber mapsecrets now i guess cp $mapsecrets, "$mapsecrets.bak$$"; open(MAPSECRETS, ">$mapsecrets"); print MAPSECRETS '* secrets'. "\n"; close MAPSECRETS; From ivan at wavetail.420.am Mon Jun 19 05:09:16 2006 From: ivan at wavetail.420.am (Ivan,,,) Date: Mon Jun 19 05:09:19 2006 Subject: [freeside-commits] freeside/FS/t ConfDefaults.t,NONE,1.1 Message-ID: <20060619120916.B7637FC8302@wavetail.420.am> Update of /home/cvs/cvsroot/freeside/FS/t In directory wavetail:/tmp/cvs-serv16174 Added Files: ConfDefaults.t Log Message: forgot to commit this test --- NEW FILE: ConfDefaults.t --- BEGIN { $| = 1; print "1..1\n" } END {print "not ok 1\n" unless $loaded;} use FS::ConfDefaults; $loaded=1; print "ok 1\n"; From ivan at wavetail.420.am Mon Jun 19 05:15:34 2006 From: ivan at wavetail.420.am (Ivan,,,) Date: Mon Jun 19 05:15:36 2006 Subject: [freeside-commits] freeside/FS/bin freeside-upgrade,1.3,1.4 Message-ID: <20060619121534.43DF6FC84BC@wavetail.420.am> Update of /home/cvs/cvsroot/freeside/FS/bin In directory wavetail:/tmp/cvs-serv16352/bin Modified Files: freeside-upgrade Log Message: ACL bootstrapping Index: freeside-upgrade =================================================================== RCS file: /home/cvs/cvsroot/freeside/FS/bin/freeside-upgrade,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- freeside-upgrade 30 Mar 2006 14:22:38 -0000 1.3 +++ freeside-upgrade 19 Jun 2006 12:15:32 -0000 1.4 @@ -5,6 +5,7 @@ use Term::ReadKey; use DBIx::DBSchema 0.31; use FS::UID qw(adminsuidsetup checkeuid datasrc ); #getsecrets); +use FS::CurrentUser; use FS::Schema qw( dbdef dbdef_dist reload_dbdef ); $DEBUG = 1; @@ -12,6 +13,7 @@ die "Not running uid freeside!" unless checkeuid(); my $user = shift or die &usage; +$FS::CurrentUser::upgrade_hack = 1; my $dbh = adminsuidsetup($user); #needs to match FS::Schema... From ivan at wavetail.420.am Mon Jun 19 05:15:34 2006 From: ivan at wavetail.420.am (Ivan,,,) Date: Mon Jun 19 05:15:39 2006 Subject: [freeside-commits] freeside/FS/FS CurrentUser.pm,1.1,1.2 Message-ID: <20060619121534.2376AFC827A@wavetail.420.am> Update of /home/cvs/cvsroot/freeside/FS/FS In directory wavetail:/tmp/cvs-serv16352/FS Modified Files: CurrentUser.pm Log Message: ACL bootstrapping Index: CurrentUser.pm =================================================================== RCS file: /home/cvs/cvsroot/freeside/FS/FS/CurrentUser.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- CurrentUser.pm 19 Jun 2006 02:33:52 -0000 1.1 +++ CurrentUser.pm 19 Jun 2006 12:15:32 -0000 1.2 @@ -1,11 +1,13 @@ package FS::CurrentUser; -use vars qw($CurrentUser); +use vars qw($CurrentUser $upgrade_hack); #not at compile-time, circular dependancey causes trouble #use FS::Record qw(qsearchs); #use FS::access_user; +$upgrade_hack = 0; + =head1 NAME FS::CurrentUser - Package representing the current user @@ -19,8 +21,9 @@ sub load_user { my( $class, $user ) = @_; #, $pass - #XXX remove me at some point - return "" if $user =~ /^fs_(queue|selfservice)$/; + return "" if $upgrade_hack; + + #return "" if $user =~ /^fs_(queue|selfservice)$/; #not the best thing in the world... eval "use FS::Record qw(qsearchs);"; From ivan at wavetail.420.am Mon Jun 19 05:22:11 2006 From: ivan at wavetail.420.am (Ivan,,,) Date: Mon Jun 19 05:22:13 2006 Subject: [freeside-commits] freeside/bin mapsecrets2access_user,1.1,1.2 Message-ID: <20060619122211.8CD30FC8302@wavetail.420.am> Update of /home/cvs/cvsroot/freeside/bin In directory wavetail:/tmp/cvs-serv16462 Modified Files: mapsecrets2access_user Log Message: ACL bootstrapping Index: mapsecrets2access_user =================================================================== RCS file: /home/cvs/cvsroot/freeside/bin/mapsecrets2access_user,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- mapsecrets2access_user 19 Jun 2006 11:57:39 -0000 1.1 +++ mapsecrets2access_user 19 Jun 2006 12:22:09 -0000 1.2 @@ -3,6 +3,7 @@ use strict; use File::Copy "cp"; use FS::UID qw(adminsuidsetup); +use FS::CurrentUser; use FS::AccessRight; use FS::Record qw(qsearchs qsearch); use FS::access_group; @@ -12,6 +13,7 @@ use FS::access_groupagent; use FS::agent; +$FS::CurrentUser::upgrade_hack = 1; adminsuidsetup shift; my $supergroup = qsearchs('access_group', { 'groupname' => 'Superuser' } ); From ivan at wavetail.420.am Mon Jun 19 05:47:57 2006 From: ivan at wavetail.420.am (Ivan,,,) Date: Mon Jun 19 05:47:59 2006 Subject: [freeside-commits] freeside/bin mapsecrets2access_user,1.2,1.3 Message-ID: <20060619124757.50A55FC85D9@wavetail.420.am> Update of /home/cvs/cvsroot/freeside/bin In directory wavetail:/tmp/cvs-serv16721 Modified Files: mapsecrets2access_user Log Message: better error checking for this thrown-together bootstrapping script Index: mapsecrets2access_user =================================================================== RCS file: /home/cvs/cvsroot/freeside/bin/mapsecrets2access_user,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- mapsecrets2access_user 19 Jun 2006 12:22:09 -0000 1.2 +++ mapsecrets2access_user 19 Jun 2006 12:47:55 -0000 1.3 @@ -46,7 +46,7 @@ my $supergroupnum = $supergroup->groupnum; my $mapsecrets = '/usr/local/etc/freeside/mapsecrets'; -open(MAPSECRETS, "<$mapsecrets"); +open(MAPSECRETS, "<$mapsecrets") or die $!; while () { /([\w]+)\s+secrets\s*$/ or die "unparsable line in mapsecrets: $_"; my $username = $1; @@ -70,9 +70,10 @@ die $aug_error if $aug_error; } +close MAPSECRETS; # okay to clobber mapsecrets now i guess cp $mapsecrets, "$mapsecrets.bak$$"; -open(MAPSECRETS, ">$mapsecrets"); +open(MAPSECRETS, ">$mapsecrets") or die $!; print MAPSECRETS '* secrets'. "\n"; -close MAPSECRETS; +close MAPSECRETS or die $!; From ivan at wavetail.420.am Mon Jun 19 06:09:16 2006 From: ivan at wavetail.420.am (Ivan,,,) Date: Mon Jun 19 06:09:24 2006 Subject: [freeside-commits] freeside/httemplate/view/cust_main packages.html, 1.5, 1.6 Message-ID: <20060619130916.CE44BFC8302@wavetail.420.am> Update of /home/cvs/cvsroot/freeside/httemplate/view/cust_main In directory wavetail:/tmp/cvs-serv17037 Modified Files: packages.html Log Message: fix ACL name for service provisioning and prevent disabled service provisioning from messing up table formatting Index: packages.html =================================================================== RCS file: /home/cvs/cvsroot/freeside/httemplate/view/cust_main/packages.html,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- packages.html 19 Jun 2006 11:25:14 -0000 1.5 +++ packages.html 19 Jun 2006 13:09:14 -0000 1.6 @@ -333,12 +333,18 @@ <% $cnt++; } - if ( $svcpart->{count} < $svcpart->{quantity} - && $curuser->access_right('Provision customer services') - ) { - print qq!\n! if ($cnt > 0); - print qq! \n\n!; + if ( $svcpart->{count} < $svcpart->{quantity} ) { + print '' if ($cnt > 0); + if ( $curuser->access_right('Provision customer service') ) { + print ''; + } else { + #print ''; + print ''; + } } + } } #end display packages From ivan at wavetail.420.am Wed Jun 21 01:42:20 2006 From: ivan at wavetail.420.am (Ivan,,,) Date: Wed Jun 21 01:42:51 2006 Subject: [freeside-commits] freeside/httemplate/browse agent_type.cgi, 1.15, 1.16 Message-ID: <20060621084220.D14F2FC8476@wavetail.420.am> Update of /home/cvs/cvsroot/freeside/httemplate/browse In directory wavetail:/tmp/cvs-serv25961/httemplate/browse Modified Files: agent_type.cgi Log Message: speed up the agent type report when there are lots of package definitions Index: agent_type.cgi =================================================================== RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/agent_type.cgi,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- agent_type.cgi 14 May 2006 16:47:30 -0000 1.15 +++ agent_type.cgi 21 Jun 2006 08:42:18 -0000 1.16 @@ -13,21 +13,18 @@ [ map { my $type_pkgs = $_; - my $part_pkg = $type_pkgs->part_pkg; + #my $part_pkg = $type_pkgs->part_pkg; [ { - 'data' => $part_pkg->pkg. ' - '. $part_pkg->comment, + #'data' => $part_pkg->pkg. ' - '. $part_pkg->comment, + 'data' => $type_pkgs->pkg. ' - '. $type_pkgs->comment, 'align' => 'left', 'link' => $p. 'edit/part_pkg.cgi?'. $type_pkgs->pkgpart, }, ]; } - #sort { - # } - grep { - $_->part_pkg and ! $_->part_pkg->disabled - } - $agent_type->type_pkgs #XXX the method should order itself by something + + $agent_type->type_pkgs_enabled ]; }; From ivan at wavetail.420.am Wed Jun 21 01:42:20 2006 From: ivan at wavetail.420.am (Ivan,,,) Date: Wed Jun 21 01:42:56 2006 Subject: [freeside-commits] freeside/FS/FS agent_type.pm,1.4,1.5 Message-ID: <20060621084220.D143EFC8170@wavetail.420.am> Update of /home/cvs/cvsroot/freeside/FS/FS In directory wavetail:/tmp/cvs-serv25961/FS/FS Modified Files: agent_type.pm Log Message: speed up the agent type report when there are lots of package definitions Index: agent_type.pm =================================================================== RCS file: /home/cvs/cvsroot/freeside/FS/FS/agent_type.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- agent_type.pm 14 May 2006 16:47:31 -0000 1.4 +++ agent_type.pm 21 Jun 2006 08:42:18 -0000 1.5 @@ -136,6 +136,27 @@ qsearch('type_pkgs', { 'typenum' => $self->typenum } ); } +=item type_pkgs_enabled + +Returns all FS::type_pkg objects (see L) that link to enabled +package definitions (see L). + +An additional strange feature is that the returned type_pkg objects also have +all fields of the associated part_pkg object. + +=cut + +sub type_pkgs_enabled { + my $self = shift; + qsearch({ + 'table' => 'type_pkgs', + 'addl_from' => 'JOIN part_pkg USING ( pkgpart )', + 'hashref' => { 'typenum' => $self->typenum }, + 'extra_sql' => " AND ( disabled = '' OR disabled IS NULL )". + " ORDER BY pkg", + }); +} + =item pkgpart Returns the pkgpart of all package definitions (see L) for this @@ -152,6 +173,13 @@ =head1 BUGS +type_pkgs_enabled should order itself by something (pkg?) + +type_pkgs_enabled should populate something that caches for the part_pkg method +rather than add fields to this object, right? In fact we need a "poop" object +framework that does that automatically for any joined search at some point.... +right? + =head1 SEE ALSO L, L, L, L, From ivan at wavetail.420.am Wed Jun 21 05:56:25 2006 From: ivan at wavetail.420.am (Ivan,,,) Date: Wed Jun 21 05:56:57 2006 Subject: [freeside-commits] freeside/httemplate/elements iframecontentmws.js, NONE, 1.1 Message-ID: <20060621125625.D64FBFC895E@wavetail.420.am> Update of /home/cvs/cvsroot/freeside/httemplate/elements In directory wavetail:/tmp/cvs-serv29187 Added Files: iframecontentmws.js Log Message: add overlib iframe function --- NEW FILE: iframecontentmws.js --- /* iframecontentmws.js - Foteos Macrides Initial: October 10, 2004 - Last Revised: May 9, 2005 Simple script for using an HTML file as iframe content in overlibmws popups. Include WRAP and TEXTPADDING,0 in the overlib call to ensure that the width arg is respected (unless the CAPTION plus CLOSETEXT widths add up to more than the width arg, in which case you should increase the width arg). The name arg should be a unique string for each popup with iframe content in the document. The frameborder arg should be 1 (browser default if omitted) or 0. See http://www.macridesweb.com/oltest/IFRAME.html for demonstration. */ function OLiframeContent(src, width, height, name, frameborder) { alert(src); return (''); } From ivan at wavetail.420.am Wed Jun 21 05:57:38 2006 From: ivan at wavetail.420.am (Ivan,,,) Date: Wed Jun 21 05:58:07 2006 Subject: [freeside-commits] freeside/httemplate/elements header-popup.html, NONE, 1.1 Message-ID: <20060621125738.503D1FC86E6@wavetail.420.am> Update of /home/cvs/cvsroot/freeside/httemplate/elements In directory wavetail:/tmp/cvs-serv29316 Added Files: header-popup.html Log Message: adding a header element for popups to replace CGI::header --- NEW FILE: header-popup.html --- <% my($title, $menubar) = ( shift, shift ); #$menubar is unused here though my $etc = @_ ? shift : ''; #$etc is for things like onLoad= etc. my $head = @_ ? shift : ''; #$head is for things that go in the section my $conf = new FS::Conf; %> <%= $title %> <%= $head %> >
<%= $title %>

From ivan at wavetail.420.am Wed Jun 21 05:58:45 2006 From: ivan at wavetail.420.am (Ivan,,,) Date: Wed Jun 21 05:58:47 2006 Subject: [freeside-commits] freeside/httemplate/view cust_main.cgi, 1.101, 1.102 Message-ID: <20060621125845.DF06AFC86E6@wavetail.420.am> Update of /home/cvs/cvsroot/freeside/httemplate/view In directory wavetail:/tmp/cvs-serv29399 Modified Files: cust_main.cgi Log Message: need the OLiframecontent sub Index: cust_main.cgi =================================================================== RCS file: /home/cvs/cvsroot/freeside/httemplate/view/cust_main.cgi,v retrieving revision 1.101 retrieving revision 1.102 diff -u -d -r1.101 -r1.102 --- cust_main.cgi 19 Jun 2006 11:25:13 -0000 1.101 +++ cust_main.cgi 21 Jun 2006 12:58:43 -0000 1.102 @@ -40,6 +40,7 @@ + ', + ); + } - if($vfields{$layer}->{$field}) { - $html .= qq!
Excluded "; + $html .= qq!
\n"; - } + + } #foreach my $field (@fields) { + $part_svc->svcpart('') if $clone; #undone $html .= "
>( <%= pkg_unsuspend_link($pkg) %> | <%= pkg_cancel_link($pkg) %> )> + + <% if ( $curuser->access_right('Unsuspend customer package') ) { %> + ( <%= pkg_unsuspend_link($pkg) %> ) + <% } %> + <% if ( $curuser->access_right('Cancel customer package') ) { %> + ( <%= pkg_cancel_link($pkg) %> ) + <% } %> + +
>( <%= pkg_cancel_link($pkg) %> )> + + <% if ( $curuser->access_right('Cancel customer package immediately') ) { %> + ( <%= pkg_cancel_link($pkg) %> ) + <% } %> + +
>( <%= pkg_suspend_link($pkg) %> | <%= pkg_cancel_link($pkg) %> )> + + <% if ( $curuser->access_right('Suspend customer package') ) { %> + ( <%= pkg_suspend_link($pkg) %> ) + <% } %> + <% if ( $curuser->access_right('Cancel customer package immediately') ) { %> + ( <%= pkg_cancel_link($pkg) %> ) + <% } %> + <% if ( $curuser->access_right('Cancel customer package later') ) { %> + ( <%= pkg_expire_link($pkg) %> ) + <% } %> + +
<%=svc_link($svcpart,$service)%><%=svc_label_link($svcpart,$service)%>
( <%=svc_unprovision_link($service)%> )
<%=svc_label_link($svcpart,$service)%> + <% if ( $curuser->access_right('Unprovision customer service') ) { %> +
( <%=svc_unprovision_link($service)%> ) + <% } %> +
!.svc_provision_link($pkg, $svcpart, $conf).qq!
!.svc_provision_link($pkg, $svcpart, $conf, $curuser).qq!
!.svc_provision_link($pkg, $svcpart, $conf, $curuser).qq!
'. + svc_provision_link($pkg, $svcpart, $conf, $curuser). + '
 
!; + + my $disabled = $flag ? '' + : 'DISABLED STYLE="background-color: #dddddd"'; + + if ( ! ref($def) || $def->{type} eq 'text' ) { + + my $nodisplay = ' STYLE="display:none"'; + my $is_inv = ( $flag =~ /^[MA]$/ ); + + $html .= + qq!'; + + $html .= include('/elements/select-table.html', + 'element_name' => "${layer}__${field}_classnum", + 'element_etc' => ( $is_inv + ? $disabled + : $nodisplay + ), + 'table' => 'inventory_class', + 'name_col' => 'classname', + 'value' => $value, + 'empty_label' => 'Select inventory class', + ); + + } elsif ( $def->{type} eq 'select' ) { + + $html .= qq!'; + + } elsif ( $def->{type} eq 'radius_usergroup_selector' ) { + + #XXX disable the RADIUS usergroup selector? ugh it sure does need + #an overhaul, people have dum group problems because of it + + $html .= FS::svc_acct::radius_usergroup_selector( + [ split(',', $value) ], "${layer}__${field}" ); + + } elsif ( $def->{type} eq 'disabled' ) { + + $html .= + qq!!; + + } else { + + $html .= 'unknown type'. $def->{type}; + } + $html .= "
"; From ivan at wavetail.420.am Sat Jun 24 09:41:46 2006 From: ivan at wavetail.420.am (Ivan,,,) Date: Sat Jun 24 09:43:38 2006 Subject: [freeside-commits] freeside/FS/FS part_svc.pm, 1.26, 1.27 part_svc_column.pm, 1.3, 1.4 Message-ID: <20060624164146.5F567FC89E6@wavetail.420.am> Update of /home/cvs/cvsroot/freeside/FS/FS In directory wavetail:/tmp/cvs-serv19993/FS/FS Modified Files: part_svc.pm part_svc_column.pm Log Message: Add the ability to link customer service definition fields to inventory classes, with an "automatic/manual" flag. Add the ability for the web interface to maintain these links. Start prettying up the service def. edit in preparation for Bigger Changes. Index: part_svc.pm =================================================================== RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_svc.pm,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- part_svc.pm 21 Nov 2005 15:24:39 -0000 1.26 +++ part_svc.pm 24 Jun 2006 16:41:44 -0000 1.27 @@ -11,7 +11,7 @@ @ISA = qw(FS::Record); -$DEBUG = 0; +$DEBUG = 1; =head1 NAME @@ -79,7 +79,7 @@ =item I__I - Default or fixed value for I in I. -=item I__I_flag - defines I__I action: null, `D' for default, or `F' for fixed. For virtual fields, can also be 'X' for excluded. +=item I__I_flag - defines I__I action: null or empty (no default), `D' for default, `F' for fixed (unchangeable), `M' for manual selection from inventory, or `A' for automatic selection from inventory. For virtual fields, can also be 'X' for excluded. =back @@ -142,7 +142,8 @@ } ); my $flag = $self->getfield($svcdb.'__'.$field.'_flag'); - if ( uc($flag) =~ /^([DFX])$/ ) { + #if ( uc($flag) =~ /^([DFMAX])$/ ) { + if ( uc($flag) =~ /^([A-Z])$/ ) { #part_svc_column will test it $part_svc_column->setfield('columnflag', $1); $part_svc_column->setfield('columnvalue', $self->getfield($svcdb.'__'.$field) @@ -260,7 +261,8 @@ } ); my $flag = $new->getfield($svcdb.'__'.$field.'_flag'); - if ( uc($flag) =~ /^([DFX])$/ ) { + #if ( uc($flag) =~ /^([DFMAX])$/ ) { + if ( uc($flag) =~ /^([A-Z])$/ ) { #part_svc_column will test it $part_svc_column->setfield('columnflag', $1); $part_svc_column->setfield('columnvalue', $new->getfield($svcdb.'__'.$field) @@ -536,7 +538,16 @@ map { my $svcdb = $_; my @fields = fields($svcdb); push @fields, 'usergroup' if $svcdb eq 'svc_acct'; #kludge - map { ( $svcdb.'__'.$_, $svcdb.'__'.$_.'_flag' ) } @fields; + + map { + if ( $param->{ $svcdb.'__'.$_.'_flag' } =~ /^[MA]$/ ) { + $param->{ $svcdb.'__'.$_ } = + delete( $param->{ $svcdb.'__'.$_.'_classnum' } ); + } + ( $svcdb.'__'.$_, $svcdb.'__'.$_.'_flag' ); + } + @fields; + } grep defined( dbdef->table($_) ), qw( svc_acct svc_domain svc_forward svc_www svc_broadband ) ) Index: part_svc_column.pm =================================================================== RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_svc_column.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- part_svc_column.pm 26 Nov 2004 09:39:52 -0000 1.3 +++ part_svc_column.pm 24 Jun 2006 16:41:44 -0000 1.4 @@ -41,7 +41,7 @@ =item columnvalue - default or fixed value for the column -=item columnflag - null, D, F, X (virtual fields) +=item columnflag - null or empty (no default), `D' for default, `F' for fixed (unchangeable), `M' for manual selection from inventory, or `A' for automatic selection from inventory. For virtual fields, can also be 'X' for excluded. =back @@ -91,10 +91,16 @@ ; return $error if $error; - $self->columnflag =~ /^([DFX])$/ + $self->columnflag =~ /^([DFMAX])$/ or return "illegal columnflag ". $self->columnflag; $self->columnflag(uc($1)); + if ( $self->columnflag =~ /^[MA]$/ ) { + $error = + $self->ut_foreign_key( 'columnvalue', 'inventory_class', 'classnum' ); + return $error if $error; + } + $self->SUPER::check; } From ivan at wavetail.420.am Tue Jun 27 07:19:19 2006 From: ivan at wavetail.420.am (Ivan,,,) Date: Tue Jun 27 07:19:26 2006 Subject: [freeside-commits] freeside/httemplate/docs index.html,1.12,1.13 Message-ID: <20060627141919.3CCF6FC8170@wavetail.420.am> Update of /home/cvs/cvsroot/freeside/httemplate/docs In directory wavetail:/tmp/cvs-serv5167 Modified Files: index.html Log Message: going to wikiland Index: index.html =================================================================== RCS file: /home/cvs/cvsroot/freeside/httemplate/docs/index.html,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- index.html 8 Feb 2006 03:50:42 -0000 1.12 +++ index.html 27 Jun 2006 14:19:16 -0000 1.13 @@ -6,7 +6,7 @@

Installation and upgrades

    -
  • New Installation +
  • New Installation
  • Installing integrated RT ticketing
  • Upgrading from 1.4.0 to 1.4.1
  • Upgrading from 1.4.1 to 1.4.2 From ivan at wavetail.420.am Thu Jun 29 06:47:46 2006 From: ivan at wavetail.420.am (Ivan,,,) Date: Thu Jun 29 06:47:50 2006 Subject: [freeside-commits] freeside/httemplate/browse inventory_class.html, 1.1, 1.2 Message-ID: <20060629134746.EED00FC8906@wavetail.420.am> Update of /home/cvs/cvsroot/freeside/httemplate/browse In directory wavetail:/tmp/cvs-serv17801/httemplate/browse Modified Files: inventory_class.html Log Message: finish at least the automatic provisioning part Index: inventory_class.html =================================================================== RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/inventory_class.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- inventory_class.html 22 Apr 2006 00:58:38 -0000 1.1 +++ inventory_class.html 29 Jun 2006 13:47:44 -0000 1.2 @@ -8,7 +8,7 @@ my %link = ( 'num_avail' => ';avail=1', - 'num_used' => ';avail=1', + 'num_used' => ';used=1', 'num_total' => '', ); From ivan at wavetail.420.am Thu Jun 29 06:47:46 2006 From: ivan at wavetail.420.am (Ivan,,,) Date: Thu Jun 29 06:47:51 2006 Subject: [freeside-commits] freeside/FS/FS svc_Common.pm, 1.31, 1.32 inventory_class.pm, 1.1, 1.2 Message-ID: <20060629134746.EBE9CFC84EB@wavetail.420.am> Update of /home/cvs/cvsroot/freeside/FS/FS In directory wavetail:/tmp/cvs-serv17801/FS/FS Modified Files: svc_Common.pm inventory_class.pm Log Message: finish at least the automatic provisioning part Index: svc_Common.pm =================================================================== RCS file: /home/cvs/cvsroot/freeside/FS/FS/svc_Common.pm,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- svc_Common.pm 5 Dec 2005 19:01:04 -0000 1.31 +++ svc_Common.pm 29 Jun 2006 13:47:44 -0000 1.32 @@ -9,10 +9,12 @@ use FS::part_svc; use FS::queue; use FS::cust_main; +use FS::inventory_item; +use FS::inventory_class; @ISA = qw( FS::cust_main_Mixin FS::Record ); -$DEBUG = 0; +$DEBUG = 1; =head1 NAME @@ -202,6 +204,12 @@ $self->svcpart($cust_svc->svcpart); } + $error = $self->set_auto_inventory; + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return $error; + } + $error = $self->SUPER::insert; if ( $error ) { $dbh->rollback if $oldAutoCommit; @@ -297,7 +305,7 @@ #new-style exports! unless ( $noexport_hack ) { foreach my $part_export ( $self->cust_svc->part_svc->part_export ) { - my $error = $part_export->export_delete($self); + $error = $part_export->export_delete($self); if ( $error ) { $dbh->rollback if $oldAutoCommit; return "exporting to ". $part_export->exporttype. @@ -306,11 +314,18 @@ } } - return $error if $error; + $error = $self->return_inventory; + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return "error returning inventory: $error"; + } my $cust_svc = $self->cust_svc; $error = $cust_svc->delete; - return $error if $error; + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return $error; + } $dbh->commit or die $dbh->errstr if $oldAutoCommit; @@ -338,7 +353,13 @@ local $FS::UID::AutoCommit = 0; my $dbh = dbh; - my $error = $new->SUPER::replace($old); + my $error = $new->set_auto_inventory; + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return $error; + } + + $error = $new->SUPER::replace($old); if ($error) { $dbh->rollback if $oldAutoCommit; return $error; @@ -409,7 +430,7 @@ sub setfixed { my $self = shift; - $self->setx('F'); + $self->setx('F', @_); } =item setdefault @@ -422,20 +443,68 @@ sub setdefault { my $self = shift; - $self->setx('D'); + $self->setx('D', @_ ); +} + +=item set_default_and_fixed + +=cut + +sub set_default_and_fixed { + my $self = shift; + $self->setx( [ 'D', 'F' ], @_ ); } +=item setx FLAG | FLAG_ARRAYREF , [ CALLBACK_HASHREF ] + +Sets fields according to the passed in flag or arrayref of flags. + +Optionally, a hashref of field names and callback coderefs can be passed. +If a coderef exists for a given field name, instead of setting the field, +the coderef is called with the column value (part_svc_column.columnvalue) +as the single parameter. + +=cut + sub setx { my $self = shift; my $x = shift; + my @x = ref($x) ? @$x : ($x); + my %coderef = @_ ? shift : {}; - my $error; - - $error = + my $error = $self->ut_numbern('svcnum') ; return $error if $error; + my $part_svc = $self->part_svc; + return "Unkonwn svcpart" unless $part_svc; + + #set default/fixed/whatever fields from part_svc + + foreach my $part_svc_column ( + grep { my $f = $_->columnflag; grep { $f eq $_ } @x } #columnflag in @x + $part_svc->all_part_svc_column + ) { + + my $columnname = $part_svc_column->columnname; + my $columnvalue = $part_svc_column->columnvalue; + + if ( exists( $coderef{columnname} ) ) { + &{ $coderef{$columnname} }( $self, $columnvalue); + } else { + $self->setfield( $columnname, $columnvalue ); + } + + } + + $part_svc; + +} + +sub part_svc { + my $self = shift; + #get part_svc my $svcpart; if ( $self->get('svcpart') ) { @@ -445,20 +514,129 @@ return "Unknown svcnum" unless $cust_svc; $svcpart = $cust_svc->svcpart; } - my $part_svc = qsearchs( 'part_svc', { 'svcpart' => $svcpart } ); + + qsearchs( 'part_svc', { 'svcpart' => $svcpart } ); + +} + +=item set_auto_inventory + +Sets any fields which auto-populate from inventory (see L). +If there is an error, returns the error, otherwise returns false. + +=cut + +sub set_auto_inventory { + my $self = shift; + + my $error = + $self->ut_numbern('svcnum') + ; + return $error if $error; + + my $part_svc = $self->part_svc; return "Unkonwn svcpart" unless $part_svc; + local $SIG{HUP} = 'IGNORE'; + local $SIG{INT} = 'IGNORE'; + local $SIG{QUIT} = 'IGNORE'; + local $SIG{TERM} = 'IGNORE'; + local $SIG{TSTP} = 'IGNORE'; + local $SIG{PIPE} = 'IGNORE'; + + my $oldAutoCommit = $FS::UID::AutoCommit; + local $FS::UID::AutoCommit = 0; + my $dbh = dbh; + #set default/fixed/whatever fields from part_svc my $table = $self->table; foreach my $field ( grep { $_ ne 'svcnum' } $self->fields ) { my $part_svc_column = $part_svc->part_svc_column($field); - if ( $part_svc_column->columnflag eq $x ) { - $self->setfield( $field, $part_svc_column->columnvalue ); + if ( $part_svc_column->columnflag eq 'A' && $self->$field() eq '' ) { + + my $classnum = $part_svc_column->columnvalue; + my $inventory_item = qsearchs({ + 'table' => 'inventory_item', + 'hashref' => { 'classnum' => $classnum, + 'svcnum' => '', + }, + 'extra_sql' => 'LIMIT 1 FOR UPDATE', + }); + + unless ( $inventory_item ) { + $dbh->rollback if $oldAutoCommit; + my $inventory_class = + qsearchs('inventory_class', { 'classnum' => $classnum } ); + return "Can't find inventory_class.classnum $classnum" + unless $inventory_class; + return "Out of ". $inventory_class->classname. "s\n"; #Lingua:: BS + #for pluralizing + } + + $inventory_item->svcnum( $self->svcnum ); + my $ierror = $inventory_item->replace(); + if ( $ierror ) { + $dbh->rollback if $oldAutoCommit; + return "Error provisioning inventory: $ierror"; + + } + + $self->setfield( $field, $inventory_item->item ); + } } - $part_svc; + $dbh->commit or die $dbh->errstr if $oldAutoCommit; + + ''; + +} + +=item return_inventory + +=cut + +sub return_inventory { + my $self = shift; + local $SIG{HUP} = 'IGNORE'; + local $SIG{INT} = 'IGNORE'; + local $SIG{QUIT} = 'IGNORE'; + local $SIG{TERM} = 'IGNORE'; + local $SIG{TSTP} = 'IGNORE'; + local $SIG{PIPE} = 'IGNORE'; + + my $oldAutoCommit = $FS::UID::AutoCommit; + local $FS::UID::AutoCommit = 0; + my $dbh = dbh; + + foreach my $inventory_item ( $self->inventory_item ) { + $inventory_item->svcnum(''); + my $error = $inventory_item->replace(); + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return "Error returning inventory: $error"; + } + } + + $dbh->commit or die $dbh->errstr if $oldAutoCommit; + + ''; +} + +=item inventory_item + +Returns the inventory items associated with this svc_ record, as +FS::inventory_item objects (see L. + +=cut + +sub inventory_item { + my $self = shift; + qsearch({ + 'table' => 'inventory_item', + 'hashref' => { 'svcnum' => $self->svcnum, }, + }); } =item cust_svc Index: inventory_class.pm =================================================================== RCS file: /home/cvs/cvsroot/freeside/FS/FS/inventory_class.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- inventory_class.pm 8 Mar 2006 10:05:00 -0000 1.1 +++ inventory_class.pm 29 Jun 2006 13:47:44 -0000 1.2 @@ -120,7 +120,7 @@ sub num_sql { my( $self, $sql ) = @_; - my $sql = "AND $sql" if length($sql); + $sql = "AND $sql" if length($sql); my $statement = "SELECT COUNT(*) FROM inventory_item WHERE classnum = ? $sql"; my $sth = dbh->prepare($statement) or die dbh->errstr. " preparing $statement"; From ivan at wavetail.420.am Thu Jun 29 06:47:47 2006 From: ivan at wavetail.420.am (Ivan,,,) Date: Thu Jun 29 06:51:45 2006 Subject: [freeside-commits] freeside/httemplate/search inventory_item.html, 1.2, 1.3 Message-ID: <20060629134747.870E7FC891C@wavetail.420.am> Update of /home/cvs/cvsroot/freeside/httemplate/search In directory wavetail:/tmp/cvs-serv17801/httemplate/search Modified Files: inventory_item.html Log Message: finish at least the automatic provisioning part Index: inventory_item.html =================================================================== RCS file: /home/cvs/cvsroot/freeside/httemplate/search/inventory_item.html,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- inventory_item.html 8 Mar 2006 12:14:04 -0000 1.2 +++ inventory_item.html 29 Jun 2006 13:47:44 -0000 1.3 @@ -24,7 +24,30 @@ my $count_query = "SELECT COUNT(*) FROM inventory_item WHERE classnum = $classnum $extra_sql"; +my $link = sub { + my $inventory_item = shift; + if ( $inventory_item->svcnum ) { + [ "${p}view/svc_acct.cgi?", 'svcnum' ]; + } else { + ''; + } +}; +my $link_cust = sub { + my $inventory_item = shift; + if ( $inventory_item->custnum ) { + [ "${p}view/cust_main.cgi?", 'custnum' ]; + } else { + ''; + } +}; + +my $addl_from = ' LEFT JOIN cust_svc USING ( svcnum ) '. + ' LEFT JOIN part_svc USING ( svcpart ) '. + ' LEFT JOIN cust_pkg USING ( pkgnum ) '. + ' LEFT JOIN cust_main USING ( custnum ) '; + %><%= include( 'elements/search.html', + 'title' => $title, #less lame to use Lingua:: something to pluralize @@ -33,19 +56,52 @@ 'query' => { 'table' => 'inventory_item', 'hashref' => { 'classnum' => $classnum }, + 'select' => join(', ', + 'inventory_item.*', + 'cust_main.custnum', + FS::UI::Web::cust_sql_fields(), + ), 'extra_sql' => $extra_sql, + 'addl_from' => $addl_from, }, 'count_query' => $count_query, - # XXX proper full service/customer link ala svc_acct - 'header' => [ '#', $inventory_class->classname, 'svcnum' ], + 'header' => [ + '#', + $inventory_class->classname, + 'Service', + FS::UI::Web::cust_header(), + ], 'fields' => [ 'itemnum', 'item', - 'svcnum', #XXX proper full service customer link ala svc_acct + #'svcnum', #XXX proper full service customer link ala svc_acct # "unallocated" ? "available" ? + sub { + #this could be way more efficient with a mixin + # like cust_main_Mixin that let us all all the methods + # on data we already have... + my $inventory_item = shift; + my $cust_svc = $inventory_item->cust_svc; + if ( $cust_svc ) { + my($label, $value) = $cust_svc->label; + "$label: $value"; + } else { + '(available)'; + } + }, + + \&FS::UI::Web::cust_fields, + + ], + + 'links' => [ + '', + '', + $link, + ( map { $link_cust } FS::UI::Web::cust_header() ), ], ) From ivan at wavetail.420.am Thu Jun 29 06:47:46 2006 From: ivan at wavetail.420.am (Ivan,,,) Date: Thu Jun 29 07:11:26 2006 Subject: [freeside-commits] freeside/httemplate/edit part_svc.cgi, 1.49, 1.50 svc_acct.cgi, 1.36, 1.37 svc_broadband.cgi, 1.8, 1.9 svc_domain.cgi, 1.11, 1.12 svc_external.cgi, 1.1, 1.2 svc_forward.cgi, 1.16, 1.17 svc_www.cgi, 1.15, 1.16 Message-ID: <20060629134747.B75C7FC8173@wavetail.420.am> Update of /home/cvs/cvsroot/freeside/httemplate/edit In directory wavetail:/tmp/cvs-serv17801/httemplate/edit Modified Files: part_svc.cgi svc_acct.cgi svc_broadband.cgi svc_domain.cgi svc_external.cgi svc_forward.cgi svc_www.cgi Log Message: finish at least the automatic provisioning part Index: svc_domain.cgi =================================================================== RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/svc_domain.cgi,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- svc_domain.cgi 14 May 2006 16:47:30 -0000 1.11 +++ svc_domain.cgi 29 Jun 2006 13:47:44 -0000 1.12 @@ -44,14 +44,7 @@ $svcnum=''; - #set fixed and default fields from part_svc - foreach my $part_svc_column ( - grep { $_->columnflag } $part_svc->all_part_svc_column - ) { - $svc_domain->setfield( $part_svc_column->columnname, - $part_svc_column->columnvalue, - ); - } + $svc_domain->set_default_and_fixed; } Index: svc_www.cgi =================================================================== RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/svc_www.cgi,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- svc_www.cgi 26 May 2005 19:15:32 -0000 1.15 +++ svc_www.cgi 29 Jun 2006 13:47:44 -0000 1.16 @@ -42,14 +42,7 @@ $svcnum=''; - #set fixed and default fields from part_svc - foreach my $part_svc_column ( - grep { $_->columnflag } $part_svc->all_part_svc_column - ) { - $svc_www->setfield( $part_svc_column->columnname, - $part_svc_column->columnvalue, - ); - } + $svc_www->set_default_and_fixed; } } Index: part_svc.cgi =================================================================== RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/part_svc.cgi,v retrieving revision 1.49 retrieving revision 1.50 diff -u -d -r1.49 -r1.50 --- part_svc.cgi 24 Jun 2006 16:41:44 -0000 1.49 +++ part_svc.cgi 29 Jun 2006 13:47:44 -0000 1.50 @@ -179,9 +179,10 @@ 'condition' => sub { ref($_[0]) && $_[0]->{disable_fixed} }, }, - 'M' => { 'desc' => 'Manual selection from inventory', - 'condition' => $inv_sub, - }, +# need to template-ize httemplate/edit/svc_* first +# 'M' => { 'desc' => 'Manual selection from inventory', +# 'condition' => $inv_sub, +# }, 'A' => { 'desc' => 'Automatically fill in from inventory', 'condition' => $inv_sub, }, Index: svc_acct.cgi =================================================================== RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/svc_acct.cgi,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- svc_acct.cgi 31 Jan 2006 04:26:54 -0000 1.36 +++ svc_acct.cgi 29 Jun 2006 13:47:44 -0000 1.37 @@ -68,18 +68,9 @@ } } - #set fixed and default fields from part_svc - foreach my $part_svc_column ( - grep { $_->columnflag } $part_svc->all_part_svc_column - ) { - if ( $part_svc_column->columnname eq 'usergroup' ) { - @groups = split(',', $part_svc_column->columnvalue); - } else { - $svc_acct->setfield( $part_svc_column->columnname, - $part_svc_column->columnvalue, - ); - } - } + $svc_acct->set_default_and_fixed( { + 'usergroup' => sub { @groups = split(',', shift ); }, + } ); } @@ -274,7 +265,7 @@ <% foreach my $xid (qw( uid gid )) { %> <% - if ( $part_svc->part_svc_column($xid)->columnflag eq 'F' + if ( $part_svc->part_svc_column($xid)->columnflag =~ /^[FA]$/ || ! $conf->exists("svc_acct-edit_$xid") ) { %> @@ -376,7 +367,7 @@ <% } %> -<% if ( $part_svc->part_svc_column('slipip')->columnflag eq 'F' ) { %> +<% if ( $part_svc->part_svc_column('slipip')->columnflag =~ /^[FA]$/ ) { %> @@ -396,7 +387,7 @@ my $a = $2; %> - <% if ( $part_svc->part_svc_column($r)->columnflag eq 'F' ) { %> + <% if ( $part_svc->part_svc_column($r)->columnflag =~ /^[FA]$/ ) { %> Index: svc_external.cgi =================================================================== RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/svc_external.cgi,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- svc_external.cgi 23 Dec 2003 02:36:38 -0000 1.1 +++ svc_external.cgi 29 Jun 2006 13:47:44 -0000 1.2 @@ -40,14 +40,7 @@ $svcnum=''; - #set fixed and default fields from part_svc - foreach my $part_svc_column ( - grep { $_->columnflag } $part_svc->all_part_svc_column - ) { - $svc_external->setfield( $part_svc_column->columnname, - $part_svc_column->columnvalue, - ); - } + $svc_external->set_default_and_fixed; } } Index: svc_broadband.cgi =================================================================== RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/svc_broadband.cgi,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- svc_broadband.cgi 31 Jan 2006 04:26:54 -0000 1.8 +++ svc_broadband.cgi 29 Jun 2006 13:47:44 -0000 1.9 @@ -47,14 +47,7 @@ $svcnum=''; - #set fixed and default fields from part_svc - foreach my $part_svc_column ( - grep { $_->columnflag } $part_svc->all_part_svc_column - ) { - $svc_broadband->setfield( $part_svc_column->columnname, - $part_svc_column->columnvalue, - ); - } + $svc_broadband->set_default_and_fixed; } } Index: svc_forward.cgi =================================================================== RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/svc_forward.cgi,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- svc_forward.cgi 31 Jan 2006 04:26:54 -0000 1.16 +++ svc_forward.cgi 29 Jun 2006 13:47:44 -0000 1.17 @@ -44,14 +44,7 @@ $svcnum=''; - #set fixed and default fields from part_svc - foreach my $part_svc_column ( - grep { $_->columnflag } $part_svc->all_part_svc_column - ) { - $svc_forward->setfield( $part_svc_column->columnname, - $part_svc_column->columnvalue, - ); - } + $svc_forward->set_default_and_fixed; } } From ivan at wavetail.420.am Thu Jun 29 08:20:01 2006 From: ivan at wavetail.420.am (Ivan,,,) Date: Thu Jun 29 08:20:08 2006 Subject: [freeside-commits] freeside/httemplate/edit part_bill_event.cgi, 1.29, 1.30 Message-ID: <20060629152001.800E7FC8926@wavetail.420.am> Update of /home/cvs/cvsroot/freeside/httemplate/edit In directory wavetail:/tmp/cvs-serv19398 Modified Files: part_bill_event.cgi Log Message: percentage late fees too Index: part_bill_event.cgi =================================================================== RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/part_bill_event.cgi,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- part_bill_event.cgi 31 Jan 2006 11:02:54 -0000 1.29 +++ part_bill_event.cgi 29 Jun 2006 15:19:59 -0000 1.30 @@ -139,13 +139,21 @@ tie my %events, 'Tie::IxHash', 'fee' => { - 'name' => 'Late fee', + 'name' => 'Late fee (flat)', 'code' => '$cust_main->charge( %%%charge%%%, \'%%%reason%%%\' );', 'html' => 'Amount '. '
    Reason ', 'weight' => 10, }, + 'fee_percent' => { + 'name' => 'Late fee (percentage)', + 'code' => '$cust_main->charge( sprintf(\'%.2f\', $cust_bill->owed * %%%percent%%% / 100 ), \'%%%reason%%%\' );', + 'html' => + 'Percent %'. + '
    Reason ', + 'weight' => 10, + }, 'suspend' => { 'name' => 'Suspend', 'code' => '$cust_main->suspend();', From ivan at wavetail.420.am Thu Jun 29 08:45:54 2006 From: ivan at wavetail.420.am (Ivan,,,) Date: Thu Jun 29 08:46:01 2006 Subject: [freeside-commits] freeside/FS/FS/part_export shellcommands.pm, 1.39, 1.39.2.1 Message-ID: <20060629154554.8D8DDFC8173@wavetail.420.am> Update of /home/cvs/cvsroot/freeside/FS/FS/part_export In directory wavetail:/tmp/cvs-serv19916 Modified Files: Tag: FREESIDE_1_5_BRANCH shellcommands.pm Log Message: small patch to set $new_finger from Tim Yardley Index: shellcommands.pm =================================================================== RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_export/shellcommands.pm,v retrieving revision 1.39 retrieving revision 1.39.2.1 diff -u -d -r1.39 -r1.39.2.1 --- shellcommands.pm 1 Dec 2005 17:36:48 -0000 1.39 +++ shellcommands.pm 29 Jun 2006 15:45:52 -0000 1.39.2.1 @@ -257,7 +257,7 @@ ${"old_$_"} = $old->getfield($_) foreach $old->fields; ${"new_$_"} = $new->getfield($_) foreach $new->fields; } - $new_finger =~ /^(.*)\s+(\S+)$/ or $finger =~ /^((.*))$/; + $new_finger =~ /^(.*)\s+(\S+)$/ or $new_finger =~ /^((.*))$/; ($new_first, $new_last ) = ( $1, $2 ); $new_first = shell_quote $new_first; $new_last = shell_quote $new_last; From ivan at wavetail.420.am Thu Jun 29 08:45:59 2006 From: ivan at wavetail.420.am (Ivan,,,) Date: Thu Jun 29 08:46:02 2006 Subject: [freeside-commits] freeside/FS/FS/part_export shellcommands.pm, 1.39, 1.40 Message-ID: <20060629154559.DD724FC8173@wavetail.420.am> Update of /home/cvs/cvsroot/freeside/FS/FS/part_export In directory wavetail:/tmp/cvs-serv19924 Modified Files: shellcommands.pm Log Message: small patch to set $new_finger from Tim Yardley Index: shellcommands.pm =================================================================== RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_export/shellcommands.pm,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- shellcommands.pm 1 Dec 2005 17:36:48 -0000 1.39 +++ shellcommands.pm 29 Jun 2006 15:45:57 -0000 1.40 @@ -257,7 +257,7 @@ ${"old_$_"} = $old->getfield($_) foreach $old->fields; ${"new_$_"} = $new->getfield($_) foreach $new->fields; } - $new_finger =~ /^(.*)\s+(\S+)$/ or $finger =~ /^((.*))$/; + $new_finger =~ /^(.*)\s+(\S+)$/ or $new_finger =~ /^((.*))$/; ($new_first, $new_last ) = ( $1, $2 ); $new_first = shell_quote $new_first; $new_last = shell_quote $new_last; From ivan at wavetail.420.am Fri Jun 30 07:30:29 2006 From: ivan at wavetail.420.am (Ivan,,,) Date: Fri Jun 30 07:30:36 2006 Subject: [freeside-commits] freeside/FS/bin freeside-adduser,1.10,1.11 Message-ID: <20060630143029.4B6A6FC82B0@wavetail.420.am> Update of /home/cvs/cvsroot/freeside/FS/bin In directory wavetail:/tmp/cvs-serv12776 Modified Files: freeside-adduser Log Message: checkin freeside-adduser with the -g flag! sheesh Index: freeside-adduser =================================================================== RCS file: /home/cvs/cvsroot/freeside/FS/bin/freeside-adduser,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- freeside-adduser 13 Apr 2006 21:29:01 -0000 1.10 +++ freeside-adduser 30 Jun 2006 14:30:26 -0000 1.11 @@ -3,25 +3,25 @@ # $Id$ use strict; -use vars qw($opt_h $opt_b $opt_c $opt_s); +use vars qw($opt_h $opt_b $opt_c $opt_g); use Fcntl qw(:flock); use Getopt::Std; my $FREESIDE_CONF = "/usr/local/etc/freeside"; -getopts("bch:s:"); +getopts("bch:g:"); die &usage if $opt_c && ! $opt_h; my $user = shift or die &usage; -if ( -e "$FREESIDE_CONF/mapsecrets" ) { - open(MAPSECRETS,"<$FREESIDE_CONF/mapsecrets") - or die "can't open $FREESIDE_CONF/mapsecrets: $!"; - while () { - /^(\S+) / or die "unparsable line in mapsecrets: $_"; - die "user $user already exists\n" if $user eq $1; - } - close MAPSECRETS; -} +#if ( -e "$FREESIDE_CONF/mapsecrets" ) { +# open(MAPSECRETS,"<$FREESIDE_CONF/mapsecrets") +# or die "can't open $FREESIDE_CONF/mapsecrets: $!"; +# while () { +# /^(\S+) / or die "unparsable line in mapsecrets: $_"; +# die "user $user already exists\n" if $user eq $1; +# } +# close MAPSECRETS; +#} if ( $opt_h ) { my @args = ( 'htpasswd' ); @@ -32,16 +32,49 @@ system(@args) == 0 or die "htpasswd failed: $?"; } -my $secretfile = $opt_s || 'secrets'; +#my $secretfile = $opt_s || 'secrets'; +# +#open(MAPSECRETS,">>$FREESIDE_CONF/mapsecrets") +# and flock(MAPSECRETS,LOCK_EX) +# or die "can't open $FREESIDE_CONF/mapsecrets: $!"; +#print MAPSECRETS "$user $secretfile\n"; +#close MAPSECRETS or die "can't close $FREESIDE_CONF/mapsecrets: $!"; -open(MAPSECRETS,">>$FREESIDE_CONF/mapsecrets") - and flock(MAPSECRETS,LOCK_EX) - or die "can't open $FREESIDE_CONF/mapsecrets: $!"; -print MAPSECRETS "$user $secretfile\n"; -close MAPSECRETS or die "can't close $FREESIDE_CONF/mapsecrets: $!"; +### + +use FS::UID qw(adminsuidsetup); +use FS::CurrentUser; +use FS::access_user; +use FS::access_usergroup; + +$FS::CurrentUser::upgrade_hack = 1; +#adminsuidsetup $rootuser; +adminsuidsetup $user; + +my $access_user = new FS::access_user { + 'username' => $user, + '_password' => 'notyet', + 'first' => 'Firstname', # $opt_f || + 'last' => 'Lastname', # $opt_l || +}; +my $au_error = $access_user->insert; +die $au_error if $au_error; + +if ( $opt_g ) { + + my $access_usergroup = new FS::access_usergroup { + 'usernum' => $access_user->usernum, + 'groupnum' => $opt_g, + }; + my $aug_error = $access_usergroup->insert; + die $aug_error if $aug_error; + +} + +### sub usage { - die "Usage:\n\n freeside-adduser [ -h htpasswd_file [ -c ] [ -b ] ] [ -s secretfile ] username" + die "Usage:\n\n freeside-adduser [ -h htpasswd_file [ -c ] [ -b ] ] [ -g groupnum ] username" } =head1 NAME @@ -50,7 +83,7 @@ =head1 SYNOPSIS - freeside-adduser [ -h htpasswd_file [ -c ] ] [ -s secretfile ] username + freeside-adduser [ -h htpasswd_file [ -c ] ] -g 1 username =head1 DESCRIPTION @@ -61,10 +94,10 @@ -c: Passed to htpasswd(1) - -s: Specify an alternate secret file - -b: same as htpasswd(1), probably insecure, not recommended + -g: initial groupnum + =head1 SEE ALSO L(1), base Freeside documentation