summaryrefslogtreecommitdiff
path: root/httemplate/edit
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/edit')
-rw-r--r--httemplate/edit/cust_category.html5
-rw-r--r--httemplate/edit/cust_class.html5
-rw-r--r--httemplate/edit/elements/category_Common.html24
-rw-r--r--httemplate/edit/elements/class_Common.html32
-rw-r--r--httemplate/edit/pkg_category.html23
-rw-r--r--httemplate/edit/pkg_class.html27
-rw-r--r--httemplate/edit/process/cust_category.html11
-rw-r--r--httemplate/edit/process/cust_class.html11
8 files changed, 92 insertions, 46 deletions
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>