so Search.tsf and Search.rdf work
[freeside.git] / FS / FS / part_pkg.pm
1 package FS::part_pkg;
2
3 use strict;
4 use vars qw( @ISA %freq %plans $DEBUG );
5 use Carp qw(carp cluck);
6 use Tie::IxHash;
7 use FS::Conf;
8 use FS::Record qw( qsearch qsearchs dbh dbdef );
9 use FS::pkg_svc;
10 use FS::part_svc;
11 use FS::cust_pkg;
12 use FS::agent_type;
13 use FS::type_pkgs;
14 use FS::part_pkg_option;
15
16 @ISA = qw( FS::Record );
17
18 $DEBUG = 0;
19
20 =head1 NAME
21
22 FS::part_pkg - Object methods for part_pkg objects
23
24 =head1 SYNOPSIS
25
26   use FS::part_pkg;
27
28   $record = new FS::part_pkg \%hash
29   $record = new FS::part_pkg { 'column' => 'value' };
30
31   $custom_record = $template_record->clone;
32
33   $error = $record->insert;
34
35   $error = $new_record->replace($old_record);
36
37   $error = $record->delete;
38
39   $error = $record->check;
40
41   @pkg_svc = $record->pkg_svc;
42
43   $svcnum = $record->svcpart;
44   $svcnum = $record->svcpart( 'svc_acct' );
45
46 =head1 DESCRIPTION
47
48 An FS::part_pkg object represents a package definition.  FS::part_pkg
49 inherits from FS::Record.  The following fields are currently supported:
50
51 =over 4
52
53 =item pkgpart - primary key (assigned automatically for new package definitions)
54
55 =item pkg - Text name of this package definition (customer-viewable)
56
57 =item comment - Text name of this package definition (non-customer-viewable)
58
59 =item promo_code - Promotional code
60
61 =item setup - Setup fee expression (deprecated)
62
63 =item freq - Frequency of recurring fee
64
65 =item recur - Recurring fee expression (deprecated)
66
67 =item setuptax - Setup fee tax exempt flag, empty or `Y'
68
69 =item recurtax - Recurring fee tax exempt flag, empty or `Y'
70
71 =item taxclass - Tax class 
72
73 =item plan - Price plan
74
75 =item plandata - Price plan data (deprecated - see L<FS::part_pkg_option> instead)
76
77 =item disabled - Disabled flag, empty or `Y'
78
79 =back
80
81 =head1 METHODS
82
83 =over 4 
84
85 =item new HASHREF
86
87 Creates a new package definition.  To add the package definition to
88 the database, see L<"insert">.
89
90 =cut
91
92 sub table { 'part_pkg'; }
93
94 =item clone
95
96 An alternate constructor.  Creates a new package definition by duplicating
97 an existing definition.  A new pkgpart is assigned and `(CUSTOM) ' is prepended
98 to the comment field.  To add the package definition to the database, see
99 L<"insert">.
100
101 =cut
102
103 sub clone {
104   my $self = shift;
105   my $class = ref($self);
106   my %hash = $self->hash;
107   $hash{'pkgpart'} = '';
108   $hash{'comment'} = "(CUSTOM) ". $hash{'comment'}
109     unless $hash{'comment'} =~ /^\(CUSTOM\) /;
110   #new FS::part_pkg ( \%hash ); # ?
111   new $class ( \%hash ); # ?
112 }
113
114 =item insert [ , OPTION => VALUE ... ]
115
116 Adds this package definition to the database.  If there is an error,
117 returns the error, otherwise returns false.
118
119 Currently available options are: I<pkg_svc>, I<primary_svc>, I<cust_pkg>, 
120 I<custnum_ref> and I<options>.
121
122 If I<pkg_svc> is set to a hashref with svcparts as keys and quantities as
123 values, appropriate FS::pkg_svc records will be inserted.
124
125 If I<primary_svc> is set to the svcpart of the primary service, the appropriate
126 FS::pkg_svc record will be updated.
127
128 If I<cust_pkg> is set to a pkgnum of a FS::cust_pkg record (or the FS::cust_pkg
129 record itself), the object will be updated to point to this package definition.
130
131 In conjunction with I<cust_pkg>, if I<custnum_ref> is set to a scalar reference,
132 the scalar will be updated with the custnum value from the cust_pkg record.
133
134 If I<options> is set to a hashref of options, appropriate FS::part_pkg_option
135 records will be inserted.
136
137 =cut
138
139 sub insert {
140   my $self = shift;
141   my %options = @_;
142   warn "FS::part_pkg::insert called on $self with options ".
143        join(', ', map "$_=>$options{$_}", keys %options)
144     if $DEBUG;
145
146   local $SIG{HUP} = 'IGNORE';
147   local $SIG{INT} = 'IGNORE';
148   local $SIG{QUIT} = 'IGNORE';
149   local $SIG{TERM} = 'IGNORE';
150   local $SIG{TSTP} = 'IGNORE';
151   local $SIG{PIPE} = 'IGNORE';
152
153   my $oldAutoCommit = $FS::UID::AutoCommit;
154   local $FS::UID::AutoCommit = 0;
155   my $dbh = dbh;
156
157   warn "  saving legacy plandata" if $DEBUG;
158   my $plandata = $self->get('plandata');
159   $self->set('plandata', '');
160
161   warn "  inserting part_pkg record" if $DEBUG;
162   my $error = $self->SUPER::insert;
163   if ( $error ) {
164     $dbh->rollback if $oldAutoCommit;
165     return $error;
166   }
167
168   if ( $plandata ) {
169
170     warn "  inserting part_pkg_option records for plandata" if $DEBUG;
171     foreach my $part_pkg_option ( 
172       map { /^(\w+)=(.*)$/ or do { $dbh->rollback if $oldAutoCommit;
173                                    return "illegal plandata: $plandata";
174                                  };
175             new FS::part_pkg_option {
176               'pkgpart'     => $self->pkgpart,
177               'optionname'  => $1,
178               'optionvalue' => $2,
179             };
180           }
181       split("\n", $plandata)
182     ) {
183       my $error = $part_pkg_option->insert;
184       if ( $error ) {
185         $dbh->rollback if $oldAutoCommit;
186         return $error;
187       }
188     }
189
190   } elsif ( $options{'options'} ) {
191
192     warn "  inserting part_pkg_option records for options hashref" if $DEBUG;
193     foreach my $optionname ( keys %{$options{'options'}} ) {
194
195       my $part_pkg_option =
196         new FS::part_pkg_option {
197           'pkgpart'     => $self->pkgpart,
198           'optionname'  => $optionname,
199           'optionvalue' => $options{'options'}->{$optionname},
200         };
201
202       my $error = $part_pkg_option->insert;
203       if ( $error ) {
204         $dbh->rollback if $oldAutoCommit;
205         return $error;
206       }
207
208     }
209
210   }
211
212   my $conf = new FS::Conf;
213   if ( $conf->exists('agent_defaultpkg') ) {
214     warn "  agent_defaultpkg set; allowing all agents to purchase package"
215       if $DEBUG;
216     foreach my $agent_type ( qsearch('agent_type', {} ) ) {
217       my $type_pkgs = new FS::type_pkgs({
218         'typenum' => $agent_type->typenum,
219         'pkgpart' => $self->pkgpart,
220       });
221       my $error = $type_pkgs->insert;
222       if ( $error ) {
223         $dbh->rollback if $oldAutoCommit;
224         return $error;
225       }
226     }
227   }
228
229   warn "  inserting pkg_svc records" if $DEBUG;
230   my $pkg_svc = $options{'pkg_svc'} || {};
231   foreach my $part_svc ( qsearch('part_svc', {} ) ) {
232     my $quantity = $pkg_svc->{$part_svc->svcpart} || 0;
233     my $primary_svc =
234       ( $options{'primary_svc'} && $options{'primary_svc'}==$part_svc->svcpart )
235         ? 'Y'
236         : '';
237
238     my $pkg_svc = new FS::pkg_svc( {
239       'pkgpart'     => $self->pkgpart,
240       'svcpart'     => $part_svc->svcpart,
241       'quantity'    => $quantity, 
242       'primary_svc' => $primary_svc,
243     } );
244     my $error = $pkg_svc->insert;
245     if ( $error ) {
246       $dbh->rollback if $oldAutoCommit;
247       return $error;
248     }
249   }
250
251   if ( $options{'cust_pkg'} ) {
252     warn "  updating cust_pkg record " if $DEBUG;
253     my $old_cust_pkg =
254       ref($options{'cust_pkg'})
255         ? $options{'cust_pkg'}
256         : qsearchs('cust_pkg', { pkgnum => $options{'cust_pkg'} } );
257     ${ $options{'custnum_ref'} } = $old_cust_pkg->custnum
258       if $options{'custnum_ref'};
259     my %hash = $old_cust_pkg->hash;
260     $hash{'pkgpart'} = $self->pkgpart,
261     my $new_cust_pkg = new FS::cust_pkg \%hash;
262     local($FS::cust_pkg::disable_agentcheck) = 1;
263     my $error = $new_cust_pkg->replace($old_cust_pkg);
264     if ( $error ) {
265       $dbh->rollback if $oldAutoCommit;
266       return "Error modifying cust_pkg record: $error";
267     }
268   }
269
270   warn "  commiting transaction" if $DEBUG;
271   $dbh->commit or die $dbh->errstr if $oldAutoCommit;
272
273   '';
274 }
275
276 =item delete
277
278 Currently unimplemented.
279
280 =cut
281
282 sub delete {
283   return "Can't (yet?) delete package definitions.";
284 # check & make sure the pkgpart isn't in cust_pkg or type_pkgs?
285 }
286
287 =item replace OLD_RECORD [ , OPTION => VALUE ... ]
288
289 Replaces OLD_RECORD with this one in the database.  If there is an error,
290 returns the error, otherwise returns false.
291
292 Currently available options are: I<pkg_svc> and I<primary_svc>
293
294 If I<pkg_svc> is set to a hashref with svcparts as keys and quantities as
295 values, the appropriate FS::pkg_svc records will be replace.
296
297 If I<primary_svc> is set to the svcpart of the primary service, the appropriate
298 FS::pkg_svc record will be updated.
299
300 =cut
301
302 sub replace {
303   my( $new, $old ) = ( shift, shift );
304   my %options = @_;
305   warn "FS::part_pkg::replace called on $new to replace $old ".
306        "with options %options"
307     if $DEBUG;
308
309   local $SIG{HUP} = 'IGNORE';
310   local $SIG{INT} = 'IGNORE';
311   local $SIG{QUIT} = 'IGNORE';
312   local $SIG{TERM} = 'IGNORE';
313   local $SIG{TSTP} = 'IGNORE';
314   local $SIG{PIPE} = 'IGNORE';
315
316   my $oldAutoCommit = $FS::UID::AutoCommit;
317   local $FS::UID::AutoCommit = 0;
318   my $dbh = dbh;
319
320   warn "  saving legacy plandata" if $DEBUG;
321   my $plandata = $new->get('plandata');
322   $new->set('plandata', '');
323
324   warn "  deleting old part_pkg_option records" if $DEBUG;
325   foreach my $part_pkg_option ( $old->part_pkg_option ) {
326     my $error = $part_pkg_option->delete;
327     if ( $error ) {
328       $dbh->rollback if $oldAutoCommit;
329       return $error;
330     }
331   }
332
333   warn "  replacing part_pkg record" if $DEBUG;
334   my $error = $new->SUPER::replace($old);
335   if ( $error ) {
336     $dbh->rollback if $oldAutoCommit;
337     return $error;
338   }
339
340   warn "  inserting part_pkg_option records for plandata" if $DEBUG;
341   foreach my $part_pkg_option ( 
342     map { /^(\w+)=(.*)$/ or do { $dbh->rollback if $oldAutoCommit;
343                                  return "illegal plandata: $plandata";
344                                };
345           new FS::part_pkg_option {
346             'pkgpart'     => $new->pkgpart,
347             'optionname'  => $1,
348             'optionvalue' => $2,
349           };
350         }
351     split("\n", $plandata)
352   ) {
353     my $error = $part_pkg_option->insert;
354     if ( $error ) {
355       $dbh->rollback if $oldAutoCommit;
356       return $error;
357     }
358   }
359
360   warn "  replacing pkg_svc records" if $DEBUG;
361   my $pkg_svc = $options{'pkg_svc'} || {};
362   foreach my $part_svc ( qsearch('part_svc', {} ) ) {
363     my $quantity = $pkg_svc->{$part_svc->svcpart} || 0;
364     my $primary_svc = $options{'primary_svc'} == $part_svc->svcpart ? 'Y' : '';
365
366     my $old_pkg_svc = qsearchs('pkg_svc', {
367       'pkgpart' => $old->pkgpart,
368       'svcpart' => $part_svc->svcpart,
369     } );
370     my $old_quantity = $old_pkg_svc ? $old_pkg_svc->quantity : 0;
371     my $old_primary_svc =
372       ( $old_pkg_svc && $old_pkg_svc->dbdef_table->column('primary_svc') )
373         ? $old_pkg_svc->primary_svc
374         : '';
375     next unless $old_quantity != $quantity || $old_primary_svc ne $primary_svc;
376   
377     my $new_pkg_svc = new FS::pkg_svc( {
378       'pkgsvcnum'   => ( $old_pkg_svc ? $old_pkg_svc->pkgsvcnum : '' ),
379       'pkgpart'     => $new->pkgpart,
380       'svcpart'     => $part_svc->svcpart,
381       'quantity'    => $quantity, 
382       'primary_svc' => $primary_svc,
383     } );
384     my $error = $old_pkg_svc
385                   ? $new_pkg_svc->replace($old_pkg_svc)
386                   : $new_pkg_svc->insert;
387     if ( $error ) {
388       $dbh->rollback if $oldAutoCommit;
389       return $error;
390     }
391   }
392
393   warn "  commiting transaction" if $DEBUG;
394   $dbh->commit or die $dbh->errstr if $oldAutoCommit;
395   '';
396 }
397
398 =item check
399
400 Checks all fields to make sure this is a valid package definition.  If
401 there is an error, returns the error, otherwise returns false.  Called by the
402 insert and replace methods.
403
404 =cut
405
406 sub check {
407   my $self = shift;
408   warn "FS::part_pkg::check called on $self" if $DEBUG;
409
410   for (qw(setup recur plandata)) {
411     #$self->set($_=>0) if $self->get($_) =~ /^\s*$/; }
412     return "Use of $_ field is deprecated; set a plan and options"
413       if length($self->get($_));
414     $self->set($_, '');
415   }
416
417   if ( $self->dbdef_table->column('freq')->type =~ /(int)/i ) {
418     my $error = $self->ut_number('freq');
419     return $error if $error;
420   } else {
421     $self->freq =~ /^(\d+[dw]?)$/
422       or return "Illegal or empty freq: ". $self->freq;
423     $self->freq($1);
424   }
425
426   my $error = $self->ut_numbern('pkgpart')
427     || $self->ut_text('pkg')
428     || $self->ut_text('comment')
429     || $self->ut_textn('promo_code')
430     || $self->ut_alphan('plan')
431     || $self->ut_enum('setuptax', [ '', 'Y' ] )
432     || $self->ut_enum('recurtax', [ '', 'Y' ] )
433     || $self->ut_textn('taxclass')
434     || $self->ut_enum('disabled', [ '', 'Y' ] )
435     || $self->SUPER::check
436   ;
437   return $error if $error;
438
439   return 'Unknown plan '. $self->plan
440     unless exists($plans{$self->plan});
441
442   '';
443 }
444
445 =item pkg_svc
446
447 Returns all FS::pkg_svc objects (see L<FS::pkg_svc>) for this package
448 definition (with non-zero quantity).
449
450 =cut
451
452 sub pkg_svc {
453   my $self = shift;
454   #sort { $b->primary cmp $a->primary } 
455     grep { $_->quantity }
456       qsearch( 'pkg_svc', { 'pkgpart' => $self->pkgpart } );
457 }
458
459 =item svcpart [ SVCDB ]
460
461 Returns the svcpart of the primary service definition (see L<FS::part_svc>)
462 associated with this package definition (see L<FS::pkg_svc>).  Returns
463 false if there not a primary service definition or exactly one service
464 definition with quantity 1, or if SVCDB is specified and does not match the
465 svcdb of the service definition, 
466
467 =cut
468
469 sub svcpart {
470   my $self = shift;
471   my $svcdb = scalar(@_) ? shift : '';
472   my @svcdb_pkg_svc =
473     grep { ( $svcdb eq $_->part_svc->svcdb || !$svcdb ) } $self->pkg_svc;
474   my @pkg_svc = ();
475   @pkg_svc = grep { $_->primary_svc =~ /^Y/i } @svcdb_pkg_svc
476     if dbdef->table('pkg_svc')->column('primary_svc');
477   @pkg_svc = grep {$_->quantity == 1 } @svcdb_pkg_svc
478     unless @pkg_svc;
479   return '' if scalar(@pkg_svc) != 1;
480   $pkg_svc[0]->svcpart;
481 }
482
483 =item payby
484
485 Returns a list of the acceptable payment types for this package.  Eventually
486 this should come out of a database table and be editable, but currently has the
487 following logic instead:
488
489 If the package is free, the single item B<BILL> is
490 returned, otherwise, the single item B<CARD> is returned.
491
492 (CHEK?  LEC?  Probably shouldn't accept those by default, prone to abuse)
493
494 =cut
495
496 sub payby {
497   my $self = shift;
498   if ( $self->is_free ) {
499     ( 'BILL' );
500   } else {
501     ( 'CARD' );
502   }
503 }
504
505 =item is_free
506
507 Returns true if this package is free.  
508
509 =cut
510
511 sub is_free {
512   my $self = shift;
513   unless ( $self->plan ) {
514     $self->setup =~ /^\s*0+(\.0*)?\s*$/
515       && $self->recur =~ /^\s*0+(\.0*)?\s*$/;
516   } elsif ( $self->can('is_free_options') ) {
517     not grep { $_ !~ /^\s*0*(\.0*)?\s*$/ }
518          map { $self->option($_) } 
519              $self->is_free_options;
520   } else {
521     warn "FS::part_pkg::is_free: FS::part_pkg::". $self->plan. " subclass ".
522          "provides neither is_free_options nor is_free method; returning false";
523     0;
524   }
525 }
526
527 =item freq_pretty
528
529 Returns an english representation of the I<freq> field, such as "monthly",
530 "weekly", "semi-annually", etc.
531
532 =cut
533
534 tie %freq, 'Tie::IxHash', 
535   '0'  => '(no recurring fee)',
536   '1d' => 'daily',
537   '1w' => 'weekly',
538   '2w' => 'biweekly (every 2 weeks)',
539   '1'  => 'monthly',
540   '2'  => 'bimonthly (every 2 months)',
541   '3'  => 'quarterly (every 3 months)',
542   '6'  => 'semiannually (every 6 months)',
543   '12' => 'annually',
544   '24' => 'biannually (every 2 years)',
545   '36' => 'triannually (every 3 years)',
546   '48' => '(every 4 years)',
547   '60' => '(every 5 years)',
548   '120' => '(every 10 years)',
549 ;
550
551 sub freq_pretty {
552   my $self = shift;
553   my $freq = $self->freq;
554   if ( exists($freq{$freq}) ) {
555     $freq{$freq};
556   } else {
557     my $interval = 'month';
558     if ( $freq =~ /^(\d+)([dw])$/ ) {
559       my %interval = ( 'd'=>'day', 'w'=>'week' );
560       $interval = $interval{$2};
561     }
562     if ( $1 == 1 ) {
563       "every $interval";
564     } else {
565       "every $freq ${interval}s";
566     }
567   }
568 }
569
570 =item plandata
571
572 For backwards compatibility, returns the plandata field as well as all options
573 from FS::part_pkg_option.
574
575 =cut
576
577 sub plandata {
578   my $self = shift;
579   carp "plandata is deprecated";
580   if ( @_ ) {
581     $self->SUPER::plandata(@_);
582   } else {
583     my $plandata = $self->get('plandata');
584     my %options = $self->options;
585     $plandata .= join('', map { "$_=$options{$_}\n" } keys %options );
586     $plandata;
587   }
588 }
589
590 =item part_pkg_option
591
592 Returns all options as FS::part_pkg_option objects (see
593 L<FS::part_pkg_option>).
594
595 =cut
596
597 sub part_pkg_option {
598   my $self = shift;
599   qsearch('part_pkg_option', { 'pkgpart' => $self->pkgpart } );
600 }
601
602 =item options 
603
604 Returns a list of option names and values suitable for assigning to a hash.
605
606 =cut
607
608 sub options {
609   my $self = shift;
610   map { $_->optionname => $_->optionvalue } $self->part_pkg_option;
611 }
612
613 =item option OPTIONNAME
614
615 Returns the option value for the given name, or the empty string.
616
617 =cut
618
619 sub option {
620   my( $self, $opt, $ornull ) = @_;
621   my $part_pkg_option =
622     qsearchs('part_pkg_option', {
623       pkgpart    => $self->pkgpart,
624       optionname => $opt,
625   } );
626   return $part_pkg_option->optionvalue if $part_pkg_option;
627   my %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); }
628                      split("\n", $self->get('plandata') );
629   return $plandata{$opt} if exists $plandata{$opt};
630   cluck "Package definition option $opt not found in options or plandata!\n"
631     unless $ornull;
632   '';
633 }
634
635 =item _rebless
636
637 Reblesses the object into the FS::part_pkg::PLAN class (if available), where
638 PLAN is the object's I<plan> field.  There should be better docs
639 on how to create new price plans, but until then, see L</NEW PLAN CLASSES>.
640
641 =cut
642
643 sub _rebless {
644   my $self = shift;
645   my $plan = $self->plan;
646   my $class = ref($self). "::$plan";
647   eval "use $class;";
648   #die $@ if $@;
649   bless($self, $class) unless $@;
650   $self;
651 }
652
653 #fallbacks that eval the setup and recur fields, for backwards compat
654
655 sub calc_setup {
656   my $self = shift;
657   warn 'no price plan class for '. $self->plan. ", eval-ing setup\n";
658   $self->_calc_eval('setup', @_);
659 }
660
661 sub calc_recur {
662   my $self = shift;
663   warn 'no price plan class for '. $self->plan. ", eval-ing recur\n";
664   $self->_calc_eval('recur', @_);
665 }
666
667 use vars qw( $sdate @details );
668 sub _calc_eval {
669   #my( $self, $field, $cust_pkg ) = @_;
670   my( $self, $field, $cust_pkg, $sdateref, $detailsref ) = @_;
671   *sdate = $sdateref;
672   *details = $detailsref;
673   $self->$field() =~ /^(.*)$/
674     or die "Illegal $field (pkgpart ". $self->pkgpart. '): '.
675             $self->$field(). "\n";
676   my $prog = $1;
677   return 0 if $prog =~ /^\s*$/;
678   my $value = eval $prog;
679   die $@ if $@;
680   $value;
681 }
682
683 #fallback that return 0 for old legacy packages with no plan
684
685 sub calc_remain { 0; }
686 sub calc_cancel { 0; }
687
688 =back
689
690 =head1 SUBROUTINES
691
692 =over 4
693
694 =item plan_info
695
696 =cut
697
698 my %info;
699 foreach my $INC ( @INC ) {
700   foreach my $file ( glob("$INC/FS/part_pkg/*.pm") ) {
701     warn "attempting to load plan info from $file\n" if $DEBUG;
702     $file =~ /\/(\w+)\.pm$/ or do {
703       warn "unrecognized file in $INC/FS/part_pkg/: $file\n";
704       next;
705     };
706     my $mod = $1;
707     my $info = eval "use FS::part_pkg::$mod; ".
708                     "\\%FS::part_pkg::$mod\::info;";
709     if ( $@ ) {
710       die "error using FS::part_pkg::$mod (skipping): $@\n" if $@;
711       next;
712     }
713     unless ( keys %$info ) {
714       warn "no %info hash found in FS::part_pkg::$mod, skipping\n"
715         unless $mod =~ /^(passwdfile|null)$/; #hack but what the heck
716       next;
717     }
718     warn "got plan info from FS::part_pkg::$mod: $info\n" if $DEBUG;
719     if ( exists($info->{'disabled'}) && $info->{'disabled'} ) {
720       warn "skipping disabled plan FS::part_pkg::$mod" if $DEBUG;
721       next;
722     }
723     $info{$mod} = $info;
724   }
725 }
726
727 tie %plans, 'Tie::IxHash',
728   map { $_ => $info{$_} }
729   sort { $info{$a}->{'weight'} <=> $info{$b}->{'weight'} }
730   keys %info;
731
732 sub plan_info {
733   \%plans;
734 }
735
736 =back
737
738 =head1 NEW PLAN CLASSES
739
740 A module should be added in FS/FS/part_pkg/ (an example may be found in
741 eg/plan_template.pm)
742
743 =head1 BUGS
744
745 The delete method is unimplemented.
746
747 setup and recur semantics are not yet defined (and are implemented in
748 FS::cust_bill.  hmm.).
749
750 =head1 SEE ALSO
751
752 L<FS::Record>, L<FS::cust_pkg>, L<FS::type_pkgs>, L<FS::pkg_svc>, L<Safe>.
753 schema.html from the base documentation.
754
755 =cut
756
757 1;
758