From: Ivan Kohler Date: Wed, 7 Aug 2013 19:05:53 +0000 (-0700) Subject: Merge branch 'master' of git.freeside.biz:/home/git/freeside X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=611b71ea70ac43bb52bf6d6b7e23a40694e430df;hp=a9e7226724fb8eba367f8d4781ddec1ac4cf97d6 Merge branch 'master' of git.freeside.biz:/home/git/freeside --- diff --git a/httemplate/edit/payment_gateway.html b/httemplate/edit/payment_gateway.html index 37618d677..0cd93e4a5 100644 --- a/httemplate/edit/payment_gateway.html +++ b/httemplate/edit/payment_gateway.html @@ -111,8 +111,7 @@ my @actions = ( 'Authorization Only,Post Authorization', ); -my $fields = [ - { +my $fields = [ { field => 'gateway_namespace', type => 'select', options => [ qw( @@ -165,8 +164,11 @@ my $fields = [ my $field_callback = sub { my ($cgi, $object, $field_hashref ) = @_; if ($object->gatewaynum) { - if ( $field_hashref->{field} =~ /gateway_(module|namespace)/ ) { + if ( $field_hashref->{field} eq 'gateway_module' ) { + $field_hashref->{type} = 'fixed'; + } elsif ( $field_hashref->{field} eq 'gateway_namespace' ) { $field_hashref->{type} = 'fixed'; + $field_hashref->{formatted_value} = $object->namespace_description; } } }; diff --git a/httemplate/misc/inventory_item-move.cgi b/httemplate/misc/inventory_item-move.cgi index 4d53beb23..6b2ab1413 100644 --- a/httemplate/misc/inventory_item-move.cgi +++ b/httemplate/misc/inventory_item-move.cgi @@ -1,21 +1,37 @@ <% '',$cgi->redirect(popurl(2). "search/inventory_item.html?$browse_opts") %> <%init> +die "access denied" unless $FS::CurrentUser::CurrentUser->access_right( + [ 'Edit inventory', 'Edit global inventory' ] + ); -# Shamelessly copied from misc/cust_attachment.cgi. my $browse_opts = join(';', map { $_.'='.$cgi->param($_) } qw( classnum avail ) ); -my $move_agentnum = $cgi->param('move_agentnum') or - die "No agent selected"; -foreach my $itemnum ( - map { /^itemnum(\d+)$/; $1; } grep /^itemnum\d+$/, $cgi->param ) { - my $item = qsearchs('inventory_item', { 'itemnum' => $itemnum }); + +my $move_agentnum; +if ( $cgi->param('move') ) { + $move_agentnum = $cgi->param('move_agentnum') or + die "No agent selected"; +} elsif ( $cgi->param('delete') ) { + # don't need it in this case +} else { + die "No action selected"; +} + +foreach my $itemnum ( grep /^\d+$/, $cgi->param('itemnum') ) +{ + my $item = FS::inventory_item->by_key($itemnum) or next; +# UI disallows this # die "Can't move assigned inventory item $itemnum" if $item->svcnum; my $error; - $item->agentnum($move_agentnum); - $error = $item->replace; + if ( $cgi->param('move') ) { + $item->agentnum($move_agentnum); + $error = $item->replace; + } elsif ( $cgi->param('delete') ) { + $error = $item->delete; + } die $error if $error; } diff --git a/httemplate/search/elements/checkbox-foot.html b/httemplate/search/elements/checkbox-foot.html index be1caab91..cc4bac69b 100644 --- a/httemplate/search/elements/checkbox-foot.html +++ b/httemplate/search/elements/checkbox-foot.html @@ -26,7 +26,8 @@ array is a hashref of either: of "submit" becomes the "value" property of the button (and thus its label). If "confirm" is specified, the button will have an onclick handler that displays the value of "confirm" in a popup message box and asks the user to -confirm the choice. +confirm the choice. The hashref may also have a "name" property, which +sets the name of the submit button. - "onclick" and "label". Creates a non-submit button that executes the Javascript code in "onclick". "label" is used as the text of the button. diff --git a/httemplate/search/inventory_item.html b/httemplate/search/inventory_item.html index 0e4251f74..d82773415 100644 --- a/httemplate/search/inventory_item.html +++ b/httemplate/search/inventory_item.html @@ -81,12 +81,8 @@ '', FS::UI::Web::cust_styles(), ], - 'html_form' => - qq! -
- -', #' - 'html_foot' => $sub_foot, + 'html_init' => $html_form, + 'html_foot' => $html_foot, &> <%init> @@ -158,41 +154,39 @@ my $addl_from = ' LEFT JOIN cust_svc USING ( svcnum ) '. ' LEFT JOIN part_svc USING ( svcpart ) '. ' LEFT JOIN cust_pkg USING ( pkgnum ) '. FS::UI::Web::join_cust_main('cust_pkg', 'cust_pkg'); -my $areboxes = 0; my $sub_checkbox = sub { my $item = $_[0]; my $itemnum = $item->itemnum; - #return '' if $item->svcnum; - $areboxes = 1; - return qq!!; -}; + return '' if $item->svcnum; -my $sub_foot = sub { - return if !$areboxes; - my $foot = -'
- -
- -'; - $foot; + return qq!!; }; - - +my $html_form = qq! + + +'; +#' + +my $html_foot = include('elements/checkbox-foot.html', + actions => [ + { submit => 'Delete', + confirm => 'Delete the selected items?', + name => 'delete', + }, + { submit => 'Move to', + name => 'move', + }, + ], +); + +$html_foot =~ s[][]; +$html_foot .= + include('/elements/select-agent.html', + 'field' => 'move_agentnum', + 'disable_empty' => 1, + ) . + '
';