From: ivan Date: Tue, 4 Sep 2001 14:44:07 +0000 (+0000) Subject: new admin documentation, quick one-pkg order X-Git-Tag: freeside_1_4_0pre11~369 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=1e4aa8069f25e1b4101da20bb9e0d3f60357ea52 new admin documentation, quick one-pkg order --- diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index 9705827e7..147a760d9 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -428,7 +428,7 @@ sub labels { =over 4 -=item order CUSTNUM, PKGPARTS_ARYREF, [ REMOVE_PKGNUMS_ARYREF ] +=item order CUSTNUM, PKGPARTS_ARYREF, [ REMOVE_PKGNUMS_ARYREF [ RETURN_CUST_PKG_ARRAYREF ] ] CUSTNUM is a customer (see L) @@ -439,12 +439,17 @@ permitted. REMOVE_PKGNUMS is an optional list of pkgnums specifying the billing items to remove for this customer. The services (see L) are moved to the new billing items. An error is returned if this is not possible (see -L). +L). An empty arrayref is equivalent to not specifying this +parameter. + +RETURN_CUST_PKG_ARRAYREF, if specified, will be filled in with the +newly-created cust_pkg objects. =cut sub order { - my($custnum,$pkgparts,$remove_pkgnums)=@_; + my($custnum, $pkgparts, $remove_pkgnums, $return_cust_pkg) = @_; + $remove_pkgnums = [] unless defined($remove_pkgnums); my $oldAutoCommit = $FS::UID::AutoCommit; local $FS::UID::AutoCommit = 0; @@ -511,7 +516,7 @@ sub order { my($old) = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); unless ( $old ) { $dbh->rollback if $oldAutoCommit; - die "Package $pkgnum not found to remove!"; + return "Package $pkgnum not found to remove!"; } my(%hash) = $old->hash; $hash{'cancel'}=time; @@ -519,7 +524,7 @@ sub order { my($error)=$new->replace($old); if ( $error ) { $dbh->rollback if $oldAutoCommit; - die "Couldn't update package $pkgnum: $error"; + return "Couldn't update package $pkgnum: $error"; } } @@ -527,26 +532,26 @@ sub order { # my($pkgpart); while ($pkgpart=shift @{$pkgparts} ) { - my($new) = new FS::cust_pkg ( { - 'custnum' => $custnum, - 'pkgpart' => $pkgpart, - } ); - my($error) = $new->insert; - if ( $error ) { + my $new = new FS::cust_pkg { + 'custnum' => $custnum, + 'pkgpart' => $pkgpart, + }; + my $error = $new->insert; + if ( $error ) { $dbh->rollback if $oldAutoCommit; - die "Couldn't insert new cust_pkg record: $error"; + return "Couldn't insert new cust_pkg record: $error"; } - my($pkgnum)=$new->getfield('pkgnum'); + push @{$return_cust_pkg}, $new if $return_cust_pkg; + my $pkgnum = $new->pkgnum; - my($cust_svc); - foreach $cust_svc ( @{ shift @cust_svc } ) { + foreach my $cust_svc ( @{ shift @cust_svc } ) { my(%hash) = $cust_svc->hash; $hash{'pkgnum'}=$pkgnum; my($new) = new FS::cust_svc ( \%hash ); my($error)=$new->replace($cust_svc); - if ( $error ) { + if ( $error ) { $dbh->rollback if $oldAutoCommit; - die "Couldn't link old service to new package: $error"; + return "Couldn't link old service to new package: $error"; } } } @@ -560,7 +565,7 @@ sub order { =head1 VERSION -$Id: cust_pkg.pm,v 1.5 2001-04-09 23:05:15 ivan Exp $ +$Id: cust_pkg.pm,v 1.6 2001-09-04 14:44:06 ivan Exp $ =head1 BUGS diff --git a/httemplate/browse/agent.cgi b/httemplate/browse/agent.cgi index 138b61365..bb0ee2402 100755 --- a/httemplate/browse/agent.cgi +++ b/httemplate/browse/agent.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $ui $cgi $p $agent ); @@ -70,8 +70,8 @@ END print < - Add new agent - Add new agent type + Add a new agent + Add a new agent type diff --git a/httemplate/browse/agent_type.cgi b/httemplate/browse/agent_type.cgi index 4917e77a2..30b80000c 100755 --- a/httemplate/browse/agent_type.cgi +++ b/httemplate/browse/agent_type.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $p $agent_type ); @@ -63,7 +63,7 @@ END } print <Add new agent type + Add a new agent type diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index b6e47b171..1538a7127 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $p $part_pkg ); @@ -18,7 +18,7 @@ $cgi = new CGI; $p = popurl(2); -print $cgi->header( '-expires' => 'now' ), header("Package Part Listing",menubar( +print $cgi->header( '-expires' => 'now' ), header("Package Definition Listing",menubar( 'Main Menu' => $p, )), "One or more services are grouped together into a package and given", " pricing information. Customers purchase packages, not services.

", @@ -69,7 +69,7 @@ END } print <Add new package + Add a new package definition diff --git a/httemplate/browse/part_referral.cgi b/httemplate/browse/part_referral.cgi index ed3b7a0e4..f283ad419 100755 --- a/httemplate/browse/part_referral.cgi +++ b/httemplate/browse/part_referral.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $p $part_referral ); @@ -42,7 +42,7 @@ END print < - Add new referral + Add a new referral diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi index 145874774..1306ac057 100755 --- a/httemplate/browse/part_svc.cgi +++ b/httemplate/browse/part_svc.cgi @@ -1,5 +1,5 @@ - -<%= header('Service Part Listing', menubar( 'Main Menu' => $p) ) %> + +<%= header('Service Definition Listing', menubar( 'Main Menu' => $p) ) %> Services are items you offer to your customers.

@@ -53,7 +53,7 @@ <% } %> - +
Add new serviceAdd a new service definition
diff --git a/httemplate/docs/admin.html b/httemplate/docs/admin.html index be53c0950..7f053ed2f 100755 --- a/httemplate/docs/admin.html +++ b/httemplate/docs/admin.html @@ -8,52 +8,70 @@
  • Open up the root of the Freeside document tree in your web browser. For example, if you created the Freeside document tree in /home/httpd/html/freeside, and your web browser's DocumentRoot is - /home/httpd/html, open http://your_host/freeside/. Replace + /home/httpd/html, open https://your_host/freeside/. Replace "your_host" with the name or network address of your web server.
  • Once in the Freeside web interface, you must first create a - service. An example of a service would be a dial-up account or a - hosted virtual domain. - -
  • After you create your first service or services, you must then - create a package of that service or services which you will sell to - your customer. To allow flexibility in changing your service - offerings, Freeside requires that you bundle your services into a - package before customers may purchase them. For instance, you could - create a leased line package which would consist of a one-time - charge for the customer premise equipment, the monthly service fee - for the leased line, a backup dial-up account, and a support - contract. You could also create a leased line package which omits - the support contract simply by adding a new package that does not - include the support contract. - + service definition. An example of a service definition would be a dial-up + account or a domain. For starters, it is necessary to create a domain + definition. Click on View/Edit service definitions and + Add a new service definition with Table svc_domain + (and no modifiers). + +
  • Now that you have created your first service, you must create a package + including this service which you can sell to customers. Zero, one, or many + services are bundled into a package. Click on View/Edit package + definitions and Add a new package definition which includes + quantity 1 of the svc_domain service you created above. +
  • After you create your first package, then you must define who is able to sell that package by creating an agent type. An example of an agent type would be an internal sales representitive which sells regular and promotional packages, as opposed to an external sales - representitive which would only sell regular packages of services. - -
  • After creating a new agent type, you must create an agent, and - assign the the agent type you just created to it. - -
  • If the service you created was of type svc_acct, you may have to - create a POP from the main menu before you can create your first new - customer. - -
  • If you are using Freeside to keep track of sales taxes, you must - define tax information for your locale by clicking on the "View/Edit - locales and tax rates" link on the Freeside main menu. - -
  • Finally, set up at least one referral by clicking on the - "View/Edit referrals" link in the Freeside main menu. Referrals - will help you keep track of how effective your advertising is, by - helping you keep track of where customers heard of your service - offerings. You must create at least one referral. If you do not wish to - use the referral functionality, simply create a single referral only. - -
  • You should now be ready to sign up your first customer by - clicking on the "New Customer" link at the top of the Freeside main - menu. + representitive which would only sell regular packages of services. Click on + View/Edit agent types and Add a new agent type. Allow this + agent type to sell the package you created above. + +
  • After creating a new agent type, you must create an agent. Click on + View/Edit agents and Add a new agent. + +
  • Set up at least one referral. Referrals will help you keep track of how + effective your advertising is, by helping you keep track of where customers + heard of your service offerings. You must create at least one referral. If + you do not wish to use the referral functionality, simply create a single + referral only. Click on View/Edit referrals and Add a new + referral. + +
  • Click on New Customer and create a new customer for your system + accounts with billing type Complimentary. + +
  • From the Customer View screen of the newly created customer, order the + package you defined above. + +
  • From the Package View screen of the newly cretaed package, choose + (Add) to add the customer's service for this new package. + +
  • Add your own domain, and note down the assigned Service #. + +
  • Go back to View/Edit service definitions on the main menu, and + Add a new service definition with Table svc_acct. Put + the Service # for your domain in the domsvc Modifier. Set + Fixed to define a service locked-in to this domain, or Default + to define a service which may select from among this domain and the + customer's domains. + +
  • + + + +
    Create at least POP (Point of Presence) by selecting + View/Edit POPs from the main menu. OR If you are not doing dialup, set slipip to fixed and blank for all your + Service Definitions which have Table svc_acct.
    + +
  • If you are using Freeside to keep track of sales taxes, define tax + information for your locales by clicking on the View/Edit locales and tax + rates on the main menu. + diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index 5696e43f8..01574e992 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -1,4 +1,4 @@ - + <% my $part_svc; if ( $cgi->param('error') ) { #error @@ -31,7 +31,7 @@ function visualize(what) { <%= header("$action Service Definition", menubar( 'Main Menu' => $p, - 'View all services' => "${p}browse/part_svc.cgi" + 'View all service definitions' => "${p}browse/part_svc.cgi" ), " onLoad=\"visualize()\"" ) @@ -50,8 +50,8 @@ Service Services are items you offer to your customers.
    • svc_acct - Shell accounts, POP mailboxes, SLIP/PPP and ISDN accounts -
    • svc_domain - Virtual domains -
    • svc_acct_sm - Virtual domain mail aliasing (*depreciated*) +
    • svc_domain - Domains +
    • svc_acct_sm - depreciated (use svc_forward for new installations) Virtual domain mail aliasing.
    • svc_forward - mail forwarding
    • svc_www - Virtual domain website + +use strict; +use vars qw( $cgi $custnum $pkgpart $error ); #@remove_pkgnums @pkgparts +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(popurl); +use FS::cust_pkg; + +$cgi = new CGI; # create form object +&cgisuidsetup($cgi); +$error = ''; + +#untaint custnum +$cgi->param('custnum') =~ /^(\d+)$/ + or die 'illegal custnum '. $cgi->param('custnum'); +$custnum = $1; +$cgi->param('pkgpart') =~ /^(\d+)$/ + or die 'illegal pkgpart '. $cgi->param('pkgpart'); +$pkgpart = $1; + +my @cust_pkg = (); +$error ||= FS::cust_pkg::order($custnum, [ $pkgpart ], [], \@cust_pkg, ); + +if ($error) { + eidiot($error); +} else { + print $cgi->redirect(popurl(3). "view/cust_pkg.cgi?". $cust_pkg[0]->pkgnum ); +} + +%> + diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index 2154bf22c..8a2cb802e 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $conf $cgi @shells $action $svcnum $svc_acct $pkgnum $svcpart @@ -118,10 +118,20 @@ END #domain $domsvc = $svc_acct->domsvc || 0; -if ( $part_svc->svc_acct__domsvc_flag eq "F" ) { +if ( $part_svc->svc_acct__domsvc_flag eq 'F' ) { print qq!!; } else { my @svc_domain = (); + if ( $part_svc->svc_acct__domsvc_flag eq 'D' ) { + my $svc_domain = + qsearchs('svc_domain', { 'svcnum' => $part_svc->svc_acct__domsvc } ); + if ( $svc_domain ) { + push @svc_domain, $svc_domain; + } else { + warn "unknown svc_domain.svcnum for part_svc.svc_acct__domsvc: ". + $part_svc->svc_acct__domsvc; + } + } my $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $pkgnum } ); if ($cust_pkg) { my @cust_svc = diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index a32abc0e1..b3ea336e9 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral @@ -153,11 +153,11 @@ print ''; @agents = qsearch( 'agent', {} ); unless ( scalar(@agents) == 1 ) { - $agent = qsearchs('agent',{ - 'agentnum' => $cust_main->agentnum - } ); + $agent = qsearchs('agent',{ 'agentnum' => $cust_main->agentnum } ); print 'Agent', $agent->agentnum, ": ", $agent->agent, ''; + } else { + $agent = $agents[0]; } @referrals = qsearch( 'part_referral', {} ); unless ( scalar(@referrals) == 1 ) { @@ -249,6 +249,21 @@ if ( defined $cust_main->dbdef_table->column('comments') print ''; +print '
      '. + '
      '. + qq!!. + '
      '; + print qq!
      Packages !, # qq!
      Click on package number to view/edit package.!, qq!( Order and cancel packages (preserves services) )!,