summaryrefslogtreecommitdiff
path: root/httemplate/edit
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2013-03-06 16:32:44 -0800
committerIvan Kohler <ivan@freeside.biz>2013-03-06 16:32:44 -0800
commit978862f11a10e6a0a8b6010d22be3f15bf7ea8f5 (patch)
treef5989189d632f4fcab4084b22bfa0448944792fa /httemplate/edit
parent0704f3f641deb525399521368f1e6ba9ff5b71cd (diff)
cleanup phone devices, RT#21623
Diffstat (limited to 'httemplate/edit')
-rw-r--r--httemplate/edit/phone_device.html17
1 files changed, 8 insertions, 9 deletions
diff --git a/httemplate/edit/phone_device.html b/httemplate/edit/phone_device.html
index 4aec63e5a..7bc88a8c7 100644
--- a/httemplate/edit/phone_device.html
+++ b/httemplate/edit/phone_device.html
@@ -32,12 +32,11 @@
%>
<%init>
-my @deviceparts_with_inventory;
-my @part_device = qsearch('part_device', {} );
-foreach my $part_device ( @part_device ) {
- push @deviceparts_with_inventory, $part_device->devicepart
- if $part_device->inventory_classnum;
-}
+my @deviceparts_with_inventory =
+ map $_->devicepart,
+ qsearch({ 'table' => 'part_device',
+ 'extra_sql' => 'WHERE inventory_classnum IS NOT NULL',
+ });
my $html_foot = sub {
my $js = "
@@ -72,9 +71,9 @@ my $html_foot = sub {
var devicepart = what.options[what.selectedIndex].value;
- var deviceparts_with_inventory = new Array(\"";
-$js .= join("\",\"",@deviceparts_with_inventory);
-$js .= "\");
+ var deviceparts_with_inventory = new Array(";
+$js .= join(',', map qq("$_"), @deviceparts_with_inventory);
+$js .= ");
var hasInventory = false;
for ( i = 0; i < deviceparts_with_inventory.length; i++ ) {