From 3eca5f238e3bd9c316766fd0726fae13a0bf26a3 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Mon, 2 Jun 2014 17:19:45 -0700 Subject: [PATCH] add locationnum to shellcommands export and broadband_shellcommands (also custnum and pkgnum to broadband_shellcommands), RT#29035 --- FS/FS/part_export/broadband_shellcommands.pm | 18 ++++++++++++++++-- FS/FS/part_export/shellcommands.pm | 4 ++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/FS/FS/part_export/broadband_shellcommands.pm b/FS/FS/part_export/broadband_shellcommands.pm index b57267ec5..44280a200 100644 --- a/FS/FS/part_export/broadband_shellcommands.pm +++ b/FS/FS/part_export/broadband_shellcommands.pm @@ -37,8 +37,8 @@ tie my %options, 'Tie::IxHash', 'notes' => <<'END' Run remote commands via SSH, for broadband services.

-All fields in svc_broadband are available for interpolation (prefixed with -new_ or old_ for replace operations). +All fields in svc_broadband are available for interpolation, as well as pkgnum, locationnum and custnum (prefixed with new_ or old_ +for replace operations). END ); @@ -80,6 +80,11 @@ sub _export_command { $mac_addr = uc $mac_addr if $self->option('uppercase_mac'); + my $cust_pkg = $svc_broadband->cust_svc->cust_pkg; + $pkgnum = $cust_pkg ? $cust_pkg->pkgnum : ''; + $locationnum = $cust_pkg ? $cust_pkg->locationnum : ''; + $custnum = $cust_pkg ? $cust_pkg->custnum : ''; + #done setting variables for the command $self->shellcommands_queue( $svc_broadband->svcnum, @@ -106,6 +111,15 @@ sub _export_replace { $new_mac_addr = uc $new_mac_addr; } + my $old_cust_pkg = $old->cust_svc->cust_pkg; + my $new_cust_pkg = $new->cust_svc->cust_pkg; + $old_pkgnum = $old_cust_pkg ? $old_cust_pkg->pkgnum : ''; + $old_locationnum = $old_cust_pkg ? $old_cust_pkg->locationnum : ''; + $old_custnum = $old_cust_pkg ? $old_cust_pkg->custnum : ''; + $new_pkgnum = $new_cust_pkg ? $new_cust_pkg->pkgnum : ''; + $new_locationnum = $new_cust_pkg ? $new_cust_pkg->locationnum : ''; + $new_custnum = $new_cust_pkg ? $new_cust_pkg->custnum : ''; + #done setting variables for the command $self->shellcommands_queue( $new->svcnum, diff --git a/FS/FS/part_export/shellcommands.pm b/FS/FS/part_export/shellcommands.pm index f7e86514b..647dc5f4d 100644 --- a/FS/FS/part_export/shellcommands.pm +++ b/FS/FS/part_export/shellcommands.pm @@ -208,6 +208,7 @@ old_ for replace operations):
  • $reasontypenum (when suspending)
  • $reasontypetext (when suspending)
  • $pkgnum +
  • $locationnum
  • $custnum
  • All other fields in svc_acct are also available.
  • The following fields from cust_main are also available (except during replace): company, address1, address2, city, state, zip, county, daytime, night, fax, otaker, agent_custid, locale. When used on the command line (rather than STDIN), they will be quoted for the shell already (do not add additional quotes). @@ -382,6 +383,7 @@ sub _export_command { } $pkgnum = $cust_pkg ? $cust_pkg->pkgnum : ''; + $locationnum = $cust_pkg ? $cust_pkg->locationnum : ''; $custnum = $cust_pkg ? $cust_pkg->custnum : ''; my $stdin_string = eval(qq("$stdin")); @@ -491,8 +493,10 @@ sub _export_replace { $new_agent_custid = $new_cust_main ? $new_cust_main->agent_custid : ''; $new_locale = $new_cust_main ? $new_cust_main->locale : ''; $old_pkgnum = $old_cust_pkg ? $old_cust_pkg->pkgnum : ''; + $old_locationnum = $old_cust_pkg ? $old_cust_pkg->locationnum : ''; $old_custnum = $old_cust_pkg ? $old_cust_pkg->custnum : ''; $new_pkgnum = $new_cust_pkg ? $new_cust_pkg->pkgnum : ''; + $new_locationnum = $new_cust_pkg ? $new_cust_pkg->locationnum : ''; $new_custnum = $new_cust_pkg ? $new_cust_pkg->custnum : ''; my $stdin_string = eval(qq("$stdin")); -- 2.11.0