From: Ivan Kohler Date: Sun, 18 Aug 2013 05:34:45 +0000 (-0700) Subject: continue sales person work: customer and package selection, commissions, reporting... X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=34411d71bd3d03966408a9747b542a7d3df08c5d continue sales person work: customer and package selection, commissions, reporting. RT#23402 --- diff --git a/FS/FS.pm b/FS/FS.pm index a318a2018..9ba5ba152 100644 --- a/FS/FS.pm +++ b/FS/FS.pm @@ -97,8 +97,6 @@ L - Employee group membership L - Group reseller access -L - Group sales access - L - Access rights L - POP (Point of Presence, not Post diff --git a/FS/FS/access_groupsales.pm b/FS/FS/access_groupsales.pm deleted file mode 100644 index 31b07d9f8..000000000 --- a/FS/FS/access_groupsales.pm +++ /dev/null @@ -1,153 +0,0 @@ -package FS::access_groupsales; - -use strict; -use base qw( FS::Record ); -use FS::Record qw( qsearch qsearchs ); - -=head1 NAME - -FS::access_groupsales - Object methods for access_groupsales records - -=head1 SYNOPSIS - - use FS::access_groupsales; - - $record = new FS::access_groupsales \%hash; - $record = new FS::access_groupsales { 'column' => 'value' }; - - $error = $record->insert; - - $error = $new_record->replace($old_record); - - $error = $record->delete; - - $error = $record->check; - -=head1 DESCRIPTION - -An FS::access_groupsales object represents an example. FS::access_groupsales inherits from -FS::Record. The following fields are currently supported: - -=over 4 - -=item groupsalesnum - -primary key - -=item groupnum - -groupnum - -=item salesnum - -salesnum - - -=back - -=head1 METHODS - -=over 4 - -=item new HASHREF - -Creates a new example. To add the example to the database, see L<"insert">. - -Note that this stores the hash reference, not a distinct copy of the hash it -points to. You can ask the object for a copy with the I method. - -=cut - -# the new method can be inherited from FS::Record, if a table method is defined - -sub table { 'access_groupsales'; } - -=item insert - -Adds this record to the database. If there is an error, returns the error, -otherwise returns false. - -=cut - -# the insert method can be inherited from FS::Record - -=item delete - -Delete this record from the database. - -=cut - -# the delete method can be inherited from FS::Record - -=item replace OLD_RECORD - -Replaces the OLD_RECORD with this one in the database. If there is an error, -returns the error, otherwise returns false. - -=cut - -# the replace method can be inherited from FS::Record - -=item check - -Checks all fields to make sure this is a valid example. If there is -an error, returns the error, otherwise returns false. Called by the insert -and replace methods. - -=cut - -# the check method should currently be supplied - FS::Record contains some -# data checking routines - -sub check { - my $self = shift; - - my $error = - $self->ut_numbern('groupsalesnum') - || $self->ut_number('groupnum') - || $self->ut_number('salesnum') - ; - return $error if $error; - - $self->SUPER::check; -} - -=back - -=item sales - -Returns the associated FS::agent object. - -=cut - -sub sales { - my $self = shift; - qsearchs('sales', { 'salesnum' => $self->salesnum } ); -} - -=item access_group - -Returns the associated FS::access_group object. - -=cut - -sub access_group { - my $self = shift; - qsearchs('access_group', { 'groupnum' => $self->groupnum } ); -} - -=back - - -=head1 BUGS - -The author forgot to customize this manpage. - -=head1 SEE ALSO - -L, schema.html from the base documentation. - -=cut - -1; - diff --git a/FS/t/access_groupsales.t b/FS/t/access_groupsales.t deleted file mode 100644 index 50993cf26..000000000 --- a/FS/t/access_groupsales.t +++ /dev/null @@ -1,5 +0,0 @@ -BEGIN { $| = 1; print "1..1\n" } -END {print "not ok 1\n" unless $loaded;} -use FS::access_groupsales; -$loaded=1; -print "ok 1\n"; diff --git a/httemplate/browse/sales.cgi b/httemplate/browse/sales.cgi deleted file mode 100755 index af098121d..000000000 --- a/httemplate/browse/sales.cgi +++ /dev/null @@ -1,100 +0,0 @@ -<% include("/elements/header.html",'Sales Listing', menubar( - 'Add new sales person' => '../edit/sales.cgi' -)) %> -Sales people bring in business.

-% if ( dbdef->table('sales')->column('disabled') ) { - - <% $cgi->param('showdisabled') - ? do { $cgi->param('showdisabled', 0); - '( hide disabled sales people )'; } - : do { $cgi->param('showdisabled', 1); - '( show disabled sales people )'; } - %> -% } - - -<% include('/elements/table-grid.html') %> -% my $bgcolor1 = '#eeeeee'; -% my $bgcolor2 = '#ffffff'; -% my $bgcolor = ''; - - - param('showdisabled') || !dbdef->table('sales')->column('disabled') ) ? 2 : 3 %>>Sales person - Agent - Access Groups - - -%foreach my $sales ( sort { -% $a->getfield('salesnum') cmp $b->getfield('salesnum') -%} qsearch('sales', \%search ) ) { -% -% if ( $bgcolor eq $bgcolor1 ) { -% $bgcolor = $bgcolor2; -% } else { -% $bgcolor = $bgcolor1; -% } - - - - - <% $sales->salesnum %> - - - - <% $sales->salesperson %> - - -% if ( ! $cgi->param('showdisabled') ) { - - <% $sales->disabled ? 'DISABLED' - : 'Active' - %> - -% } - -% my ($agent) = qsearch('agent', { 'agentnum' => $sales->agentnum }); - - - <% $sales->agentnum %> - (<% $agent->agent %>)
- - - -% foreach my $access_group ( -% map $_->access_group, -% qsearch('access_groupsales', { 'salesnum' => $sales->salesnum }) -% ) { -
<% $access_group->groupname |h %>
-% } - - - -% } - - - - - - - -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); - -my %search; -if ( $cgi->param('showdisabled') - || !dbdef->table('agent')->column('disabled') ) { - %search = (); -} else { - %search = ( 'disabled' => '' ); -} - -my $conf = new FS::Conf; - - diff --git a/httemplate/edit/process/sales.cgi b/httemplate/edit/process/sales.cgi deleted file mode 100644 index edef4d65c..000000000 --- a/httemplate/edit/process/sales.cgi +++ /dev/null @@ -1,23 +0,0 @@ -<% include( 'elements/process.html', - 'table' => 'sales', - 'viewall_dir' => 'browse', - 'viewall_ext' => 'cgi', - 'debug' => '1', - 'process_m2m' => { 'link_table' => 'access_groupsales', - 'target_table' => 'access_group', - }, - 'edit_ext' => 'cgi', - ) -%> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); - -if ( FS::Conf->new->exists('disable_acl_changes') ) { - errorpage('ACL changes disabled in public demo.'); - die "shouldn't be reached"; -} - - - diff --git a/httemplate/edit/sales.cgi b/httemplate/edit/sales.cgi deleted file mode 100755 index 3497de505..000000000 --- a/httemplate/edit/sales.cgi +++ /dev/null @@ -1,79 +0,0 @@ -<% include("/elements/header.html","$action Sales Person", menubar( - 'View all sales people' => $p. 'browse/sales.cgi', -)) %> - -<% include('/elements/error.html') %> - -
- - -Sales #<% $sales->salesnum ? $sales->salesnum : "(NEW)" %> - -<% &ntable("#cccccc", 2, '') %> - - - Sales - - - - - <% emt('Agent') %> - - <& /elements/select-agent.html, - 'curr_value' => $sales->salesnum, - 'disable_empty' => 1, - &> - - - - - Disable - disabled eq 'Y' ? ' CHECKED' : '' %>> - - - - Access Groups - <% include('/elements/checkboxes-table.html', - 'source_obj' => $sales, - 'link_table' => 'access_groupsales', - 'target_table' => 'access_group', - 'name_col' => 'groupname', - 'target_link' => $p. 'edit/access_group.html?', - ) - %> - - - - - -
-"> - -
- -<% include('/elements/footer.html') %> - -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); - -my $sales; -if ( $cgi->param('error') ) { - $sales = new FS::sales ( { - map { $_, scalar($cgi->param($_)) } fields('sales') - } ); -} elsif ( $cgi->keywords ) { - my($query) = $cgi->keywords; - $query =~ /^(\d+)$/; - $sales = qsearchs( 'sales', { 'salesnum' => $1 } ); -} else { #adding - $sales = new FS::sales {}; -} -my $action = $sales->salesnum ? 'Edit' : 'Add'; - -my $conf = new FS::Conf; - -