bugfix to work for regular aswell as custom pricing
[freeside.git] / site_perl / part_pkg.pm
index d1c12e4..4643b9f 100644 (file)
@@ -19,6 +19,8 @@ FS::part_pkg - Object methods for part_pkg objects
   $record = create FS::part_pkg \%hash
   $record = create FS::part_pkg { 'column' => 'value' };
 
+  $custom_record = $template_record->clone;
+
   $error = $record->insert;
 
   $error = $new_record->replace($old_record);
@@ -74,6 +76,23 @@ sub create {
   $proto->new('part_pkg',$hashref);
 }
 
+=item clone
+
+Creates a new billing item definition by duplicating an existing definition.
+A new pkgpart is assigned and "(CUSTOM) " is prepended to the comment field.
+To add the billing item definition to the database, see L<"insert">.
+
+=cut
+
+sub clone {
+  my $self = shift;
+  my %hash = $self->hash;
+  $hash{'pkgpart'} = '';
+  $hash{'comment'} = "(CUSTOM) ". $hash{'comment'}
+    unless $hash{'comment'} =~ /^\(CUSTOM\) /;
+  create FS::part_pkg ( \%hash ); # ?
+}
+
 =item insert
 
 Adds this billing item definition to the database.  If there is an error,
@@ -142,6 +161,10 @@ sub check {
 
 =back
 
+=head1 VERSION
+
+$Id: part_pkg.pm,v 1.3 1998-11-15 13:00:15 ivan Exp $
+
 =head1 BUGS
 
 It doesn't properly override FS::Record yet.
@@ -162,6 +185,11 @@ ivan@sisd.com 97-dec-5
 
 pod ivan@sisd.com 98-sep-21
 
+$Log: part_pkg.pm,v $
+Revision 1.3  1998-11-15 13:00:15  ivan
+bugfix in clone method, clone method doc clarification
+
+
 =cut
 
 1;