diff options
| author | ivan <ivan> | 2009-10-29 01:08:33 +0000 | 
|---|---|---|
| committer | ivan <ivan> | 2009-10-29 01:08:33 +0000 | 
| commit | 9d77a21db3642ca66d9a0e545b804b7e6b4090ee (patch) | |
| tree | 8323e01c8e25420222c97b4e0ea87f89b73203fd /httemplate | |
| parent | f274814c7cde3681578ca594a2b00475370e4c92 (diff) | |
customer classification, RT#6376
Diffstat (limited to 'httemplate')
| -rw-r--r-- | httemplate/browse/cust_category.html | 32 | ||||
| -rw-r--r-- | httemplate/browse/cust_class.html | 45 | ||||
| -rw-r--r-- | httemplate/browse/part_pkg_report_option.html | 2 | ||||
| -rw-r--r-- | httemplate/browse/pkg_category.html | 3 | ||||
| -rw-r--r-- | httemplate/browse/pkg_class.html | 4 | ||||
| -rw-r--r-- | httemplate/edit/cust_category.html | 5 | ||||
| -rw-r--r-- | httemplate/edit/cust_class.html | 5 | ||||
| -rw-r--r-- | httemplate/edit/elements/category_Common.html | 24 | ||||
| -rw-r--r-- | httemplate/edit/elements/class_Common.html | 32 | ||||
| -rw-r--r-- | httemplate/edit/pkg_category.html | 23 | ||||
| -rw-r--r-- | httemplate/edit/pkg_class.html | 27 | ||||
| -rw-r--r-- | httemplate/edit/process/cust_category.html | 11 | ||||
| -rw-r--r-- | httemplate/edit/process/cust_class.html | 11 | ||||
| -rw-r--r-- | httemplate/elements/menu.html | 29 | 
14 files changed, 191 insertions, 62 deletions
diff --git a/httemplate/browse/cust_category.html b/httemplate/browse/cust_category.html new file mode 100644 index 000000000..4468d2f09 --- /dev/null +++ b/httemplate/browse/cust_category.html @@ -0,0 +1,32 @@ +<% include( 'elements/browse.html', +                 'title'       => 'Customer categories', +                 'html_init'   => $html_init, +                 'name'        => 'customer categories', +                 'disableable' => 1, +                 'disabled_statuspos' => 2, +                 'query'       => { 'table'     => 'cust_category', +                                    'hashref'   => {}, +                                    'extra_sql' => 'ORDER BY categorynum', +                                  }, +                 'count_query' => $count_query, +                 'header'      => [ '#', 'Category' ], +                 'fields'      => [ 'categorynum', 'categoryname' ], +                 'links'       => [ $link, $link ], +             ) +%> + +<%init> + +die "access denied" +  unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +my $html_init =  +  qq!<A HREF="${p}browse/cust_class.html">Customer classes</A><BR><BR>!. +  'Customer categories define groups of customer classes.<BR><BR>'. +  qq!<A HREF="${p}edit/cust_category.html"><I>Add a customer category</I></A><BR><BR>!; + +my $count_query = 'SELECT COUNT(*) FROM cust_category'; + +my $link = [ $p.'edit/cust_category.html?', 'categorynum' ]; + +</%init> diff --git a/httemplate/browse/cust_class.html b/httemplate/browse/cust_class.html new file mode 100644 index 000000000..da303cf72 --- /dev/null +++ b/httemplate/browse/cust_class.html @@ -0,0 +1,45 @@ +<% include( 'elements/browse.html', +                 'title'       => 'Customer classes', +                 'html_init'   => $html_init, +                 'name'        => 'customer classes', +                 'disableable' => 1, +                 'disabled_statuspos' => 2, +                 'query'       => { 'table'     => 'cust_class', +                                    'hashref'   => {}, +                                    'extra_sql' => 'ORDER BY classnum', +                                  }, +                 'count_query' => $count_query, +                 'header'      => $header, +                 'fields'      => $fields, +                 'links'       => $links, +             ) +%> +<%init> + +die "access denied" +  unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +my $html_init =  +  'Customer classes define groups of customer for reporting.<BR><BR>'. +  qq!<A HREF="${p}edit/cust_class.html"><I>Add a customer class</I></A><BR><BR>!; + +my $count_query = 'SELECT COUNT(*) FROM cust_class'; + +my $link = [ $p.'edit/cust_class.html?', 'classnum' ]; + +my $header = [ '#', 'Class' ]; +my $fields = [ 'classnum', 'classname' ]; +my $links  = [ $link, $link ]; + +my $cat_query = 'SELECT COUNT(*) FROM cust_class where categorynum IS NOT NULL'; +my $sth = dbh->prepare($cat_query) +  or die "Error preparing $cat_query: ". dbh->errstr; +$sth->execute +  or die "Error executing $cat_query: ". $sth->errstr; +if ($sth->fetchrow_arrayref->[0]) { +  push @$header, 'Category'; +  push @$fields, 'categoryname'; +  push @$links,  $link; +} + +</%init> diff --git a/httemplate/browse/part_pkg_report_option.html b/httemplate/browse/part_pkg_report_option.html index 90540bca2..9745b13d2 100644 --- a/httemplate/browse/part_pkg_report_option.html +++ b/httemplate/browse/part_pkg_report_option.html @@ -20,7 +20,7 @@ die "access denied"    unless $FS::CurrentUser::CurrentUser->access_right('Configuration');  my $html_init =  -  'Package optional report classes define groups of packages, for reporting purposes.'. +  'Package optional report classes define optional groups of packages for reporting only.'.    qq!<BR><BR><A HREF="${p}edit/part_pkg_report_option.html"><I>Add a class</I></A><BR><BR>!;  my $link = [ $p.'edit/part_pkg_report_option.html?', 'num' ]; diff --git a/httemplate/browse/pkg_category.html b/httemplate/browse/pkg_category.html index e85c0dd9c..2223445e1 100644 --- a/httemplate/browse/pkg_category.html +++ b/httemplate/browse/pkg_category.html @@ -22,8 +22,7 @@ die "access denied"  my $html_init =     qq!<A HREF="${p}browse/pkg_class.html">Package classes</A><BR><BR>!. -  'Package categories define groups of package classes, for reporting and '. -  'convenience purposes.<BR><BR>'. +  'Package categories define groups of package classes.<BR><BR>'.    qq!<A HREF="${p}edit/pkg_category.html"><I>Add a package category</I></A><BR><BR>!;  my $count_query = 'SELECT COUNT(*) FROM pkg_category'; diff --git a/httemplate/browse/pkg_class.html b/httemplate/browse/pkg_class.html index 75969dbe8..7097c8617 100644 --- a/httemplate/browse/pkg_class.html +++ b/httemplate/browse/pkg_class.html @@ -20,8 +20,8 @@ die "access denied"    unless $FS::CurrentUser::CurrentUser->access_right('Configuration');  my $html_init =  -  'Package classes define groups of packages, for reporting and '. -  'convenience purposes.<BR><BR>'. +  'Package classes define groups of packages, for taxation, ordering '. +  'convenience and reporting.<BR><BR>'.    qq!<A HREF="${p}edit/pkg_class.html"><I>Add a package class</I></A><BR><BR>!;  my $count_query = 'SELECT COUNT(*) FROM pkg_class'; diff --git a/httemplate/edit/cust_category.html b/httemplate/edit/cust_category.html new file mode 100644 index 000000000..18a6189bc --- /dev/null +++ b/httemplate/edit/cust_category.html @@ -0,0 +1,5 @@ +<% include( 'elements/category_Common.html', +              'name'   => 'Customer Category', +              'table'  => 'cust_category', +          ) +%> diff --git a/httemplate/edit/cust_class.html b/httemplate/edit/cust_class.html new file mode 100644 index 000000000..fdb58e687 --- /dev/null +++ b/httemplate/edit/cust_class.html @@ -0,0 +1,5 @@ +<% include( 'elements/class_Common.html', +              'name'   => 'Customer Class', +              'table'  => 'cust_class', +          ) +%> diff --git a/httemplate/edit/elements/category_Common.html b/httemplate/edit/elements/category_Common.html new file mode 100644 index 000000000..8bbdcd15b --- /dev/null +++ b/httemplate/edit/elements/category_Common.html @@ -0,0 +1,24 @@ +<% include( 'edit.html', +              'fields' => [ +                            'categoryname', +                            'weight', +                            { field=>'disabled', type=>'checkbox', value=>'Y', }, +                          ], +              'labels' => {  +                            'categorynum'  => 'Category number', +                            'categoryname' => 'Category name', +                            'weight'       => 'Weight', +                            'disabled'     => 'Disable category', +                          }, +              'viewall_dir' => 'browse', +              %opt, +           ) +%> +<%init> + +die "access denied" +  unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +my %opt = @_; + +</%init> diff --git a/httemplate/edit/elements/class_Common.html b/httemplate/edit/elements/class_Common.html new file mode 100644 index 000000000..b5f493991 --- /dev/null +++ b/httemplate/edit/elements/class_Common.html @@ -0,0 +1,32 @@ +<% include( 'edit.html', +              'fields' => [ +                            'classname', +                            (scalar(@category) +                              ? { field=>'categorynum', type=>'select-table', 'empty_label'=>'(none)', 'table'=>'pkg_category', 'name_col'=>'categoryname' } +                              : { field=>'categorynum', type=>'hidden' } +                            ), +                            { field=>'disabled', type=>'checkbox', value=>'Y', }, +                          ], +              'labels' => {  +                            'classnum'    => 'Class number', +                            'classname'   => 'Class name', +                            'categorynum' => 'Category', +                            'disabled'    => 'Disable class', +                          }, +              'viewall_dir' => 'browse', +              %opt, +           ) +           +%> +<%init> + +die "access denied" +  unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +my %opt = @_; + +my $table = $opt{'table'}; +( my $category_table = $table ) =~ s/class/category/ or die; + +my @category = qsearch($category_table, { 'disabled' => '' }); +</%init> diff --git a/httemplate/edit/pkg_category.html b/httemplate/edit/pkg_category.html index a07dc5842..a244bd53a 100644 --- a/httemplate/edit/pkg_category.html +++ b/httemplate/edit/pkg_category.html @@ -1,24 +1,5 @@ -<% include( 'elements/edit.html', +<% include( 'elements/category_Common.html',                'name'   => 'Package Category',                'table'  => 'pkg_category', -              'fields' => [ -                            'categoryname', -                            'weight', -                            { field=>'disabled', type=>'checkbox', value=>'Y', }, -                          ], -              'labels' => {  -                            'categorynum'  => 'Category number', -                            'categoryname' => 'Category name', -                            'weight'       => 'Weight', -                            'disabled'  => 'Disable category', -                          }, -              'viewall_dir' => 'browse', -           ) -           +          )  %> -<%init> - -die "access denied" -  unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); - -</%init> diff --git a/httemplate/edit/pkg_class.html b/httemplate/edit/pkg_class.html index 26bc8baa5..4f7a729bd 100644 --- a/httemplate/edit/pkg_class.html +++ b/httemplate/edit/pkg_class.html @@ -1,28 +1,5 @@ -<% include( 'elements/edit.html', +<% include( 'elements/class_Common.html',                'name'   => 'Package Class',                'table'  => 'pkg_class', -              'fields' => [ -                            'classname', -                            (scalar(@category) -                              ? { field=>'categorynum', type=>'select-table', 'empty_label'=>'(none)', 'table'=>'pkg_category', 'name_col'=>'categoryname' } -                              : { field=>'categorynum', type=>'hidden' } -                            ), -                            { field=>'disabled', type=>'checkbox', value=>'Y', }, -                          ], -              'labels' => {  -                            'classnum'    => 'Class number', -                            'classname'   => 'Class name', -                            'categorynum' => 'Category', -                            'disabled'    => 'Disable class', -                          }, -              'viewall_dir' => 'browse', -           ) -           +          )  %> -<%init> - -die "access denied" -  unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); - -my @category = qsearch('pkg_category', { 'disabled' => '' }); -</%init> diff --git a/httemplate/edit/process/cust_category.html b/httemplate/edit/process/cust_category.html new file mode 100644 index 000000000..c3a880944 --- /dev/null +++ b/httemplate/edit/process/cust_category.html @@ -0,0 +1,11 @@ +<% include( 'elements/process.html', +               'table'       => 'cust_category', +               'viewall_dir' => 'browse', +           ) +%> +<%init> + +die "access denied" +  unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +</%init> diff --git a/httemplate/edit/process/cust_class.html b/httemplate/edit/process/cust_class.html new file mode 100644 index 000000000..3f63ea4b3 --- /dev/null +++ b/httemplate/edit/process/cust_class.html @@ -0,0 +1,11 @@ +<% include( 'elements/process.html', +               'table'       => 'cust_class', +               'viewall_dir' => 'browse', +           ) +%> +<%init> + +die "access denied" +  unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +</%init> diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html index c54ed0715..cd546618b 100644 --- a/httemplate/elements/menu.html +++ b/httemplate/elements/menu.html @@ -342,15 +342,20 @@ $config_pkg{'Package definitions'} = [ $fsurl.'browse/part_pkg.cgi', 'One or mor    if    $curuser->access_right('Edit package definitions')       || $curuser->access_right('Edit global package definitions');  if ( $curuser->access_right('Configuration') ) { -  $config_pkg{'Package categories'} =  [ $fsurl.'browse/pkg_category.html', 'Package categories define groups of package classes, for reporting and convenience purposes.' ]; -  $config_pkg{'Package tax classes'} =  [ $fsurl.'browse/pkg_class.html', 'Package classes define groups of packages, for reporting and convenience purposes.' ]; -  $config_pkg{'Package report classes'} =  [ $fsurl.'browse/part_pkg_report_option.html', 'Package classes define optional groups of packages for reporting purposes.' ]; -  $config_pkg{'Cancel reason types'} = [ $fsurl.'browse/reason_type.html?class=C', 'Cancel reason types define groups of reasons, for reporting and convenience purposes.' ]; +  $config_pkg{'Package classes'} =  [ $fsurl.'browse/pkg_class.html', 'Package classes define groups of packages, for taxation, ordering convenience and reporting.' ]; +  $config_pkg{'Package categories'} =  [ $fsurl.'browse/pkg_category.html', 'Package categories define groups of package classes.' ]; +  $config_pkg{'Package report classes'} =  [ $fsurl.'browse/part_pkg_report_option.html', 'Package classes define optional groups of packages for reporting only.' ];    $config_pkg{'Cancel reasons'} = [ $fsurl.'browse/reason.html?class=C', 'Cancel reasons explain why a service was cancelled.' ]; -  $config_pkg{'Suspend reason types'} = [ $fsurl.'browse/reason_type.html?class=S', 'Suspend reason types define groups of reasons, for reporting and convenience purposes.' ]; +  $config_pkg{'Cancel reason types'} = [ $fsurl.'browse/reason_type.html?class=C', 'Cancel reason types define groups of reasons.' ];    $config_pkg{'Suspend reasons'} = [ $fsurl.'browse/reason.html?class=S', 'Suspend reasons explain why a service was suspended.' ]; +  $config_pkg{'Suspend reason types'} = [ $fsurl.'browse/reason_type.html?class=S', 'Suspend reason types define groups of reasons.' ];  } +tie my %config_cust, 'Tie::IxHash', +  'Customer classes'    =>  [ $fsurl.'browse/cust_class.html', 'Customer classes define groups of customers for reporting.' ], +  'Customer categories' =>  [ $fsurl.'browse/cust_category.html', 'Customer categories define groups of customer classes.' ], +; +  tie my %config_agent, 'Tie::IxHash',    'Agent types' => [ $fsurl.'browse/agent_type.cgi', 'Agent types define groups of package definitions that you can then assign to particular agents' ],    'Agents'      => [ $fsurl.'browse/agent.cgi', 'Agents are resellers of your service. Agents may be limited to a subset of your full offerings (via their type)' ], @@ -360,7 +365,7 @@ tie my %config_agent, 'Tie::IxHash',  tie my %config_billing_rates, 'Tie::IxHash',    'Rate plans' => [ $fsurl.'browse/rate.cgi', 'Manage rate plans' ],    'Regions and prefixes' => [ $fsurl.'browse/rate_region.html', 'Manage regions and prefixes' ], -  'Usage classes'  => [ $fsurl.'browse/usage_class.html', 'Usage classes define groups of usage for taxation purposes.' ], +  'Usage classes'  => [ $fsurl.'browse/usage_class.html', 'Usage classes define groups of usage for taxation.' ],    'Edit rates with Excel' => [ $fsurl.'misc/rate_edit_excel.html', 'Download and edit rates with Excel, then upload changes.' ], #"Edit with Excel" ?  ; @@ -385,8 +390,8 @@ if ( $curuser->access_right('Configuration') ) {       if $conf->exists('enable_taxproducts');    $config_billing{'Tax classes'} = [ $fsurl. 'browse/part_pkg_taxclass.html', 'Tax classes' ]; -  $config_billing{'Credit reason types'}  = [ $fsurl.'browse/reason_type.html?class=R', 'Credit reason types define groups of reasons, for reporting and convenience purposes.' ];    $config_billing{'Credit reasons'}  = [ $fsurl.'browse/reason.html?class=R', 'Credit reasons explain why a credit was issued.' ]; +  $config_billing{'Credit reason types'}  = [ $fsurl.'browse/reason_type.html?class=R', 'Credit reason types define groups of reasons.' ];  }  tie my %config_ticketing, 'Tie::IxHash', @@ -412,7 +417,7 @@ tie my %config_phone, 'Tie::IxHash',  ;  tie my %config_misc, 'Tie::IxHash'; -$config_misc{'Advertising sources'} = [ $fsurl.'browse/part_referral.html', 'Where a customer heard about your service.  Tracked for informational purposes' ] +$config_misc{'Advertising sources'} = [ $fsurl.'browse/part_referral.html', 'Where a customer heard about your service.' ]    if $curuser->access_right('Edit advertising sources')    || $curuser->access_right('Edit global advertising sources');  if ( $curuser->access_right('Configuration') ) { @@ -435,9 +440,11 @@ $config_menu{'Packages'} = [ \%config_pkg, '' ]    if    $curuser->access_right('Configuration' )       || $curuser->access_right('Edit package definitions')       || $curuser->access_right('Edit global package definitions'); -$config_menu{'Resellers'} = [ \%config_agent, ''    ] +$config_menu{'Customers'} = [ \%config_cust, '' ] +  if $curuser->access_right('Configuration'); +$config_menu{'Resellers'} = [ \%config_agent, '' ]    if $curuser->access_right('Configuration'); -$config_menu{'Billing'} = [ \%config_billing, ''    ] +$config_menu{'Billing'} = [ \%config_billing, '' ]    if $curuser->access_right('Edit billing events')    || $curuser->access_right('Edit global billing events');  $config_menu{'Ticketing'} = [ \%config_ticketing, '' ] @@ -445,7 +452,7 @@ $config_menu{'Ticketing'} = [ \%config_ticketing, '' ]    && FS::TicketSystem->access_right(\%session, 'ShowConfigTab');  $config_menu{'Dialup'}  = [ \%config_dialup, ''    ]    if ( $curuser->access_right('Dialup configuration') ); -$config_menu{'Fixed (username-less) broadband'} = [ \%config_broadband, ''    ] +$config_menu{'Broadband'} = [ \%config_broadband, ''    ]    if ( $curuser->access_right('Broadband configuration') );  $config_menu{'Phone'}  = [ \%config_phone, ''    ]    if ( $curuser->access_right('Configuration') );  | 
