summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/Record.pm10
-rw-r--r--FS/FS/deploy_zone.pm51
-rw-r--r--FS/FS/part_export/voip_ms.pm2
-rw-r--r--FS/FS/pay_batch/eft_canada.pm2
4 files changed, 58 insertions, 7 deletions
diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm
index 43b9ca1..765880e 100644
--- a/FS/FS/Record.pm
+++ b/FS/FS/Record.pm
@@ -1711,7 +1711,7 @@ Table name (required).
=item params
-Listref of field names for static fields. They will be given values from the
+Arrayref of field names for static fields. They will be given values from the
PARAMS hashref and passed as a "params" hashref to batch_import.
=item formats
@@ -1760,10 +1760,10 @@ format_types).
=back
-PARAMS is a base64-encoded Storable string containing the POSTed data as
-a hash ref. It normally contains at least one field, "uploaded files",
-generated by /elements/file-upload.html and containing the list of uploaded
-files. Currently only supports a single file named "file".
+PARAMS is a hashref (or base64-encoded Storable hashref) containing the
+POSTed data. It must contain the field "uploaded files", generated by
+/elements/file-upload.html and containing the list of uploaded files.
+Currently only supports a single file named "file".
=cut
diff --git a/FS/FS/deploy_zone.pm b/FS/FS/deploy_zone.pm
index 6142b91..38dd7dc 100644
--- a/FS/FS/deploy_zone.pm
+++ b/FS/FS/deploy_zone.pm
@@ -3,6 +3,8 @@ package FS::deploy_zone;
use strict;
use base qw( FS::o2m_Common FS::Record );
use FS::Record qw( qsearch qsearchs dbh );
+use Storable qw(thaw);
+use MIME::Base64;
=head1 NAME
@@ -265,6 +267,55 @@ sub deploy_zone_vertex {
});
}
+=back
+
+=head2 SUBROUTINES
+
+=over 4
+
+=item process_batch_import JOB, PARAMS
+
+=cut
+
+sub process_batch_import {
+ eval {
+ use FS::deploy_zone_block;
+ use FS::deploy_zone_vertex;
+ };
+ my $job = shift;
+ my $param = shift;
+ if (!ref($param)) {
+ $param = thaw(decode_base64($param));
+ }
+
+ # even if creating a new zone, the deploy_zone object should already
+ # be inserted by this point
+ my $zonenum = $param->{zonenum}
+ or die "zonenum required";
+ my $zone = FS::deploy_zone->by_key($zonenum)
+ or die "deploy_zone #$zonenum not found";
+ my $opt;
+ if ( $zone->zonetype eq 'B' ) {
+ $opt = { 'table' => 'deploy_zone_block',
+ 'params' => [ 'zonenum', 'censusyear' ],
+ 'formats' => { 'plain' => [ 'censusblock' ] },
+ 'default_csv' => 1,
+ };
+ $job->update_statustext('1,Inserting census blocks');
+ } elsif ( $zone->zonetype eq 'P' ) {
+ $opt = { 'table' => 'deploy_zone_vertex',
+ 'params' => [ 'zonenum' ],
+ 'formats' => { 'plain' => [ 'latitude', 'longitude' ] },
+ 'default_csv' => 1,
+ };
+ } else {
+ die "don't know how to import to zonetype ".$zone->zonetype;
+ }
+
+ FS::Record::process_batch_import( $job, $opt, $param );
+
+}
+
=head1 BUGS
=head1 SEE ALSO
diff --git a/FS/FS/part_export/voip_ms.pm b/FS/FS/part_export/voip_ms.pm
index 44ce908..53a4926 100644
--- a/FS/FS/part_export/voip_ms.pm
+++ b/FS/FS/part_export/voip_ms.pm
@@ -503,7 +503,7 @@ sub cache {
my $province = shift;
$CACHE ||= Cache::FileCache->new({
- 'cache_root' => $FS::UID::cache_dir.'/cache'.$FS::UID::datasrc,
+ 'cache_root' => $FS::UID::cache_dir.'/cache.'.$FS::UID::datasrc,
'namespace' => __PACKAGE__,
'default_expires_in' => $cache_timeout,
});
diff --git a/FS/FS/pay_batch/eft_canada.pm b/FS/FS/pay_batch/eft_canada.pm
index ab9e6a3..b7a9e19 100644
--- a/FS/FS/pay_batch/eft_canada.pm
+++ b/FS/FS/pay_batch/eft_canada.pm
@@ -149,7 +149,7 @@ sub process_date {
@config = $conf->config('batchconfig-eft_canada');
}
- my $process_delay = $config[3] || 1;
+ my $process_delay = $config[4] || 1;
if ( (localtime(time))[2] >= 10 and $process_delay == 1 ) {
# If downloading the batch after 10:00 local time, it likely won't make