% include( '/elements/header.html', 'Developer Documentation' ) %> <& /elements/menubar.html, 'Freeside Perl Modules' => $fsurl.'docs/library/FS.html', 'Complete Index' => $fsurl.'docs/library/index.html', &>
FS::Misc::FixIPFormat - Functions to repair bad IP address input
Provides functions for freeside_upgrade to check IP address storage for user-entered leading 0's in IP addresses. When read from database, NetAddr::IP would treat the number as octal isntead of decimal. If a user entered 10.0.0.052, this may get invisibly translated to 10.0.0.42 when exported. Base8:52 = Base0:42
Tied to freeside_upgrade with journal name TABLE__fixipformat
see: RT# 80555
Usage:
# require, not use - this module is only run once
require FS::Misc::FixIPFormat;
my $error = FS::Misc::FixIPFormat::fix_bad_addresses_in_table(
'svc_broadband', 'svcnum', 'ip_addr'
);
die "oh no!" if $error;
$error = fix_bad_addresses_in_table( 'svc_broadband', 'svcnum', 'ip_addr' );
@id = find_bad_addresses_in_table( 'svc_broadband', 'svcnum', 'ip_addr' );
Attempt to strip the leading 0 from a stored IP address record. If the corrected IP address would be a duplicate of another record in the same table, thow an exception.
$error = fix_ip_for_record( 1001, 'svc_broadband', 'svcnum', 'ip_addr', );