summaryrefslogtreecommitdiff
path: root/httemplate/edit
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2013-12-10 20:59:42 -0800
committerIvan Kohler <ivan@freeside.biz>2013-12-10 20:59:42 -0800
commit430b2c784d2ee9ea5be00b821d2dbd27279ef132 (patch)
treec8a224219c1425bd3fa03b1a54487bf1f3de7449 /httemplate/edit
parent6ced51db0e73603461591e54b7f606467e7c7af0 (diff)
parente1157f37c618a7b9cdb2793d61999458076dc51b (diff)
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Conflicts: FS/FS/Mason.pm FS/MANIFEST
Diffstat (limited to 'httemplate/edit')
-rw-r--r--httemplate/edit/addr_range.html27
-rw-r--r--httemplate/edit/cust_main/billing.html4
-rw-r--r--httemplate/edit/elements/edit.html21
-rw-r--r--httemplate/edit/process/addr_range.html22
4 files changed, 72 insertions, 2 deletions
diff --git a/httemplate/edit/addr_range.html b/httemplate/edit/addr_range.html
new file mode 100644
index 000000000..68efa5d79
--- /dev/null
+++ b/httemplate/edit/addr_range.html
@@ -0,0 +1,27 @@
+<& elements/edit.html,
+ 'name_singular' => 'address range',
+ 'popup' => 1,
+ 'table' => 'addr_range',
+ 'labels' => { 'start' => 'From',
+ 'end' => 'To',
+ 'status' => 'Status',
+ 'rangenum'=> 'Range',
+ },
+ 'fields' => [ 'start',
+ 'end',
+ { field => 'status',
+ type => 'select',
+ labels => \%FS::addr_range::status_desc,
+ options => [ sort { $a cmp $b }
+ keys(%FS::addr_range::status_desc) ],
+ disable_empty => 1,
+ },
+ ],
+ 'delete_url' => $p.'misc/delete-addr_range.html',
+&>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Broadband global configuration');
+
+</%init>
diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html
index da5f0f27f..1088cf5fd 100644
--- a/httemplate/edit/cust_main/billing.html
+++ b/httemplate/edit/cust_main/billing.html
@@ -679,8 +679,8 @@ my $conf = new FS::Conf;
my $payby_default = $conf->config('payby-default');
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 ))
+#@payby = (qw( CARD DCRD CHEK DCHK BILL CASH WEST COMP ))
+@payby = (qw( CARD DCRD CHEK DCHK BILL CASH COMP ))
unless @payby;
my $show_term = '';
diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html
index 9e27f2a4c..16d0817eb 100644
--- a/httemplate/edit/elements/edit.html
+++ b/httemplate/edit/elements/edit.html
@@ -108,6 +108,9 @@ Example:
# overrides default popurl(1)."process/$table.html"
'post_url' => popurl(1).'process/something',
+ # optional link to delete this object; primary key will be appended
+ 'delete_url' => $p.'misc/delete-something.html?',
+
#we're in a popup (no title/menu/searchboxes)
'popup' => 1,
@@ -211,6 +214,7 @@ Example:
% );
% }
+
<% include('/elements/header'. ( $opt{popup} ? '-popup' : '' ). '.html',
$title,
include( '/elements/menubar.html', @menubar ),
@@ -773,6 +777,23 @@ Example:
: "Add ". ($opt{'name'} || $opt{'name_singular'})
%>"
>
+% if ( $opt{'delete_url'} and $object->get($pkey) ) {
+% my $delete_msg = 'Delete this '.
+% ($opt{'name_singular'} || $opt{'name'});
+% my $delete_url = $opt{'delete_url'};
+% $delete_url .= '?' unless $delete_url =~ /\?/;
+% $delete_url .= $object->get($pkey);
+ <SCRIPT TYPE="text/javascript">
+ function confirm_delete() {
+ if(confirm(<% $delete_msg . '?' |js_string %>)) {
+ window.location.href = <% $delete_url |js_string %>;
+ }
+ }
+ </SCRIPT>
+ <INPUT TYPE = "button"
+ VALUE = "<% $delete_msg |h %>"
+ onclick = "confirm_delete()">
+% }
% }
</FORM>
diff --git a/httemplate/edit/process/addr_range.html b/httemplate/edit/process/addr_range.html
new file mode 100644
index 000000000..6b05d23a5
--- /dev/null
+++ b/httemplate/edit/process/addr_range.html
@@ -0,0 +1,22 @@
+<& elements/process.html,
+ 'table' => 'addr_range',
+ 'popup_reload' => 'Address range changed',
+ 'precheck_callback' => sub {
+ my ($cgi) = @_;
+ my $start = NetAddr::IP->new($cgi->param('start'), 0)
+ or return 'Illegal or empty (IP address) start: '.$cgi->param('start');
+ if ( length($cgi->param('end')) ) {
+ my $end = NetAddr::IP->new($cgi->param('end'), 0)
+ or return 'Illegal or empty (IP address) end: '.$cgi->param('end');
+ if ( $end < $start ) {
+ ($start, $end) = ($end, $start);
+ $cgi->param('end', $end->addr);
+ $cgi->param('start', $start->addr);
+ }
+ $cgi->param('length', $end - $start + 1);
+ } else {
+ $cgi->param('length', 1);
+ }
+ '';
+ },
+&>