make customer location columns available in various reports, #940
[freeside.git] / FS / FS / part_export / phone_shellcommands.pm
index fbb7a0b..9ace213 100644 (file)
@@ -27,7 +27,7 @@ tie my %options, 'Tie::IxHash',
   'options' => \%options,
   'notes'   => <<'END'
 Run remote commands via SSH, for phone numbers.  You will need to
-<a href="../docs/ssh.html">setup SSH for unattended operation</a>.
+<a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.9:Documentation:Administration:SSH_Keys">setup SSH for unattended operation</a>.
 <BR><BR>Use these buttons for some useful presets:
 <UL>
   <LI>
@@ -49,6 +49,7 @@ old_ for replace operations):
   <LI><code>$sip_password</code> - SIP secret (quoted for the shell)
   <LI><code>$pin</code> - Personal identification number
   <LI><code>$cust_name</code> - Customer name (quoted for the shell)
+  <LI><code>$pkgnum</code> - Internal package number
 </UL>
 END
 );
@@ -87,6 +88,7 @@ sub _export_command {
     ${$_} = $svc_phone->getfield($_) foreach $svc_phone->fields;
   }
   my $cust_pkg = $svc_phone->cust_svc->cust_pkg;
+  my $pkgnum = $cust_pkg ? $cust_pkg->pkgnum : '';
   my $cust_name = $cust_pkg ? $cust_pkg->cust_main->name : '';
   $cust_name = shell_quote $cust_name;
   my $sip_password = shell_quote $svc_phone->sip_password;
@@ -111,7 +113,10 @@ sub _export_replace {
     ${"new_$_"} = $new->getfield($_) foreach $new->fields;
   }
 
+  my $old_cust_pkg = $old->cust_svc->cust_pkg;
+  my $old_pkgnum = $old_cust_pkg ? $old_cust_pkg->pkgnum : '';
   my $cust_pkg = $new->cust_svc->cust_pkg;
+  my $new_pkgnum = $cust_pkg ? $cust_pkg->pkgnum : '';
   my $new_cust_name = $cust_pkg ? $cust_pkg->cust_main->name : '';
   $new_cust_name = shell_quote $new_cust_name;
   #done setting variables for the command
@@ -138,3 +143,4 @@ sub ssh_cmd { #subroutine, not method
   &Net::SSH::ssh_cmd( { @_ } );
 }
 
+1;