From 7118f8f027744b31c87444da0a47de3b1daa5da2 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Thu, 10 Nov 2016 22:45:36 -0800 Subject: [PATCH] clean up package list UI: put actions in a dropdown --- httemplate/view/cust_main/packages/contact.html | 22 ---------- httemplate/view/cust_main/packages/location.html | 42 +------------------ httemplate/view/cust_main/packages/package.html | 51 ++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 63 deletions(-) diff --git a/httemplate/view/cust_main/packages/contact.html b/httemplate/view/cust_main/packages/contact.html index 88f8afb4c..8c5961552 100644 --- a/httemplate/view/cust_main/packages/contact.html +++ b/httemplate/view/cust_main/packages/contact.html @@ -11,11 +11,6 @@ % }
-% } elsif ( $show_contact_link && ! $opt{no_links} ) { - - ( <%pkg_add_contact_link($cust_pkg)%> ) - -
% } <%init> @@ -31,10 +26,6 @@ my $show_detach_link = ! $cust_pkg->get('cancel') && $FS::CurrentUser::CurrentUser->access_right('Detach customer package'); -my $show_contact_link = - ! $cust_pkg->get('cancel') - ; #&& $FS::CurrentUser::CurrentUser->access_right('Add package contact'); #or something like that - my $contact = $cust_pkg->contact_obj; sub pkg_change_contact_link { @@ -50,19 +41,6 @@ sub pkg_change_contact_link { ); } -sub pkg_add_contact_link { - my $cust_pkg = shift; - #my $pkgpart = $cust_pkg->pkgpart; - include( '/elements/popup_link-cust_pkg.html', - 'action' => $p. "misc/change_pkg_contact.html", - 'label' => emt('Add contact'), - 'actionlabel' => emt('Add contact'), - 'cust_pkg' => $cust_pkg, - 'width' => 616, - 'height' => 192, - ); -} - sub pkg_detach_link { my $cust_pkg = shift; #my $pkgpart = $cust_pkg->pkgpart; diff --git a/httemplate/view/cust_main/packages/location.html b/httemplate/view/cust_main/packages/location.html index 595d6b3b1..b855e6a74 100644 --- a/httemplate/view/cust_main/packages/location.html +++ b/httemplate/view/cust_main/packages/location.html @@ -19,7 +19,7 @@ % if ( $loc->latitude && $loc->longitude ) {
- <% $loc->latitude %>, <% $loc->longitude %> + <& /elements/coord-links.html, { 'latitude' => $loc->latitude, 'longitude' => $loc->longitude, @@ -50,20 +50,6 @@ % } # all of this is hidden if packages are grouped by location, because % # it's in the top banner -% if ( ! $cust_pkg->get('cancel') -% && $FS::CurrentUser::CurrentUser->access_right('Change customer package') -% ) -% { -
- -% unless ( $opt{no_links} or $opt{'change_from'} ) { - ( <%pkg_change_location_link($cust_pkg)%> ) -% } -% if ( $cust_pkg->locationnum && ! $opt{no_links} ) { - ( <%pkg_edit_location_link($cust_pkg->locationnum)%> ) -% } - -% } % } # if the package is a scheduled future package change without location % # change, then don't show any of this at all. It's all implied by the % # preceding package. @@ -80,30 +66,4 @@ my $loc = $cust_pkg->cust_location_or_main('_cache'=>$opt{cust_location_cache}); # dubious--they should all have a location now my $default = $cust_pkg->locationnum == $opt{'cust_main'}->ship_locationnum; -sub pkg_change_location_link { - my $cust_pkg = shift; - my $pkgpart = $cust_pkg->pkgpart; - include( '/elements/popup_link-cust_pkg.html', - 'action' => $p. "misc/change_pkg.cgi?locationnum=-1;pkgpart=$pkgpart;". - "address1=;address2=;city=;county=;state=$statedefault;". - "zip=;country=$countrydefault", - 'label' => emt('Change location'), - 'actionlabel' => emt('Change'), - 'cust_pkg' => $cust_pkg, - 'width' => 960, - 'height' => 530, - ); -} - -sub pkg_edit_location_link { - my $locationnum = shift; - include( '/elements/popup_link.html', - 'action' => $p. "edit/cust_location.cgi?locationnum=$locationnum", - 'label' => emt('Edit location'), - 'actionlabel' => emt('Edit'), - 'width' => 700, - 'height' => 355, - ); -} - diff --git a/httemplate/view/cust_main/packages/package.html b/httemplate/view/cust_main/packages/package.html index 9fed5b581..14f7fb006 100644 --- a/httemplate/view/cust_main/packages/package.html +++ b/httemplate/view/cust_main/packages/package.html @@ -280,6 +280,10 @@ ';clone='. $part_pkg->pkgpart, }, + { label => '-', + content => '-', + }, + { label => 'View package events', acl => [ 'Billing event reports', 'View customer billing events', ], @@ -287,6 +291,11 @@ url => "search/cust_event.html?$plink", }, + { label => '-', + condition => sub { $cust_pkg->exists_cust_event }, + content => '-', + }, + { label => 'Change quantity', acl => 'Change customer package', condition => sub { $part_pkg->freq ne '0' @@ -314,6 +323,10 @@ height => 220, }, + { label => '-', + content => '-', + }, + { label => (@invoice_detail ? 'Edit' : 'Add'). ' invoice details', acl => 'Edit customer package invoice details', @@ -551,6 +564,44 @@ }, + { label => '-', + condition => sub { $part_pkg->freq ne '0' + && ! $change_from + && ! $cust_pkg->get('cancel') + }, + content => '-', + }, + + { label => 'Add contact', + #acl => 'Add package contact',#or something like that + condition => sub { ! $cust_pkg->get('cancel') }, + popup => "misc/change_pkg-contact.html?$plink", + actionlabel => emt('Add contact'), + width => 616, + height => 192, + }, + + { label => 'Change location', + acl => 'Change customer package', + condition => sub { ! $change_from }, + popup => "misc/change_pkg.cgi?locationnum=-1;$plink;". + "address1=;address2=;city=;county=;state=$statedefault;". + "zip=;country=$countrydefault", + actionlabel => emt('Change location'), + width => 960, + height => 530, + }, + + { label => 'Edit location', + acl => 'Change customer package', + condition => sub { ! $change_from && $cust_pkg->locationnum != $cust_pkg->cust_main->ship_locationnum }, + popup => 'misc/cust_location.cgi?locationnum='. + $cust_pkg->locationnum, + actionlabel => emt('Edit location'), + width => 700, + height => 355, + }, + ], ], &> -- 2.11.0