import package definitions, RT#32639
[freeside.git] / FS / FS / part_pkg / Import.pm
1 package FS::part_pkg::Import;
2
3 use strict;
4 use FS::Record;
5 use FS::part_pkg;
6
7 =head1 NAME
8
9 FS::part_pkg::Import - Batch customer importing
10
11 =head1 SYNOPSIS
12
13   use FS::part_pkg::Import;
14
15   #ajax helper
16   use FS::UI::Web::JSRPC;
17   my $server =
18     new FS::UI::Web::JSRPC 'FS::part_pkg::Import::process_batch_import', $cgi;
19   print $server->process;
20
21 =head1 DESCRIPTION
22
23 Batch package definition importing.
24
25 =head1 SUBROUTINES
26
27 =item process_batch_import
28
29 Load a batch import as a queued JSRPC job
30
31 =cut
32
33 sub process_batch_import {
34   my $job = shift;
35
36   my $opt = { 'table'       => 'part_pkg',
37               'params'      => [qw( agentnum pkgpartbatch )],
38               'formats'     => { 'default' => [
39                                    'agent_pkgpartid',
40                                    'pkg',
41                                    'comment',
42                                    'freq',
43                                    'plan',
44                                    'setup_fee',
45                                    'recur_fee',
46                                    'setup_cost',
47                                    'recur_cost',
48                                    'classnum',
49                                    'taxclass',
50                                  ],
51                                },
52               'insert_args_callback' => sub {
53                 my $part_pkg = shift;
54                 ( 'options' => { 'setup_fee' => $part_pkg->get('setup_fee'),
55                                  'recur_fee' => $part_pkg->get('recur_fee'),
56                                },
57                 );
58               },
59               #'default_csv' => 1,
60             };
61
62   FS::Record::process_batch_import( $job, $opt, @_ );
63
64 }
65
66 =head1 BUGS
67
68 Not enough documentation.
69
70 =head1 SEE ALSO
71
72 L<FS::cust_main>, L<FS::part_pkg>
73
74 =cut
75
76 1;