projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
This commit was generated by cvs2svn to compensate for changes in r4407,
[freeside.git]
/
FS
/
FS
/
part_pkg.pm
diff --git
a/FS/FS/part_pkg.pm
b/FS/FS/part_pkg.pm
index
182be87
..
73f3bae
100644
(file)
--- a/
FS/FS/part_pkg.pm
+++ b/
FS/FS/part_pkg.pm
@@
-2,7
+2,7
@@
package FS::part_pkg;
use strict;
use vars qw( @ISA %freq %plans $DEBUG );
use strict;
use vars qw( @ISA %freq %plans $DEBUG );
-use Carp qw(carp cluck);
+use Carp qw(carp cluck
confess
);
use Tie::IxHash;
use FS::Conf;
use FS::Record qw( qsearch qsearchs dbh dbdef );
use Tie::IxHash;
use FS::Conf;
use FS::Record qw( qsearch qsearchs dbh dbdef );
@@
-13,7
+13,9
@@
use FS::agent_type;
use FS::type_pkgs;
use FS::part_pkg_option;
use FS::type_pkgs;
use FS::part_pkg_option;
-@ISA = qw( FS::Record );
+@ISA = qw( FS::Record ); # FS::option_Common ); # this can use option_Common
+ # when all the plandata bs is
+ # gone
$DEBUG = 0;
$DEBUG = 0;
@@
-375,6
+377,7
@@
sub replace {
next unless $old_quantity != $quantity || $old_primary_svc ne $primary_svc;
my $new_pkg_svc = new FS::pkg_svc( {
next unless $old_quantity != $quantity || $old_primary_svc ne $primary_svc;
my $new_pkg_svc = new FS::pkg_svc( {
+ 'pkgsvcnum' => ( $old_pkg_svc ? $old_pkg_svc->pkgsvcnum : '' ),
'pkgpart' => $new->pkgpart,
'svcpart' => $part_svc->svcpart,
'quantity' => $quantity,
'pkgpart' => $new->pkgpart,
'svcpart' => $part_svc->svcpart,
'quantity' => $quantity,
@@
-417,7
+420,7
@@
sub check {
my $error = $self->ut_number('freq');
return $error if $error;
} else {
my $error = $self->ut_number('freq');
return $error if $error;
} else {
- $self->freq =~ /^(\d+[dw]?)$/
+ $self->freq =~ /^(\d+[
h
dw]?)$/
or return "Illegal or empty freq: ". $self->freq;
$self->freq($1);
}
or return "Illegal or empty freq: ". $self->freq;
$self->freq($1);
}
@@
-438,6
+441,10
@@
sub check {
return 'Unknown plan '. $self->plan
unless exists($plans{$self->plan});
return 'Unknown plan '. $self->plan
unless exists($plans{$self->plan});
+ my $conf = new FS::Conf;
+ return 'Taxclass is required'
+ if ! $self->taxclass && $conf->exists('require_taxclasses');
+
'';
}
'';
}
@@
-532,6
+539,7
@@
Returns an english representation of the I<freq> field, such as "monthly",
tie %freq, 'Tie::IxHash',
'0' => '(no recurring fee)',
tie %freq, 'Tie::IxHash',
'0' => '(no recurring fee)',
+ '1h' => 'hourly',
'1d' => 'daily',
'1w' => 'weekly',
'2w' => 'biweekly (every 2 weeks)',
'1d' => 'daily',
'1w' => 'weekly',
'2w' => 'biweekly (every 2 weeks)',
@@
-554,8
+562,8
@@
sub freq_pretty {
$freq{$freq};
} else {
my $interval = 'month';
$freq{$freq};
} else {
my $interval = 'month';
- if ( $freq =~ /^(\d+)([dw])$/ ) {
- my %interval = ( 'd'=>'day', 'w'=>'week' );
+ if ( $freq =~ /^(\d+)([
h
dw])$/ ) {
+ my %interval = ( '
h' => 'hour', '
d'=>'day', 'w'=>'week' );
$interval = $interval{$2};
}
if ( $1 == 1 ) {
$interval = $interval{$2};
}
if ( $1 == 1 ) {
@@
-642,9
+650,16
@@
on how to create new price plans, but until then, see L</NEW PLAN CLASSES>.
sub _rebless {
my $self = shift;
my $plan = $self->plan;
sub _rebless {
my $self = shift;
my $plan = $self->plan;
+ unless ( $plan ) {
+ confess "no price plan found for pkgpart ". $self->pkgpart. "\n"
+ if $DEBUG;
+ return $self;
+ }
+ return $self if ref($self) =~ /::$plan$/; #already blessed into plan subclass
my $class = ref($self). "::$plan";
my $class = ref($self). "::$plan";
+ warn "reblessing $self into $class" if $DEBUG;
eval "use $class;";
eval "use $class;";
-
#
die $@ if $@;
+ die $@ if $@;
bless($self, $class) unless $@;
$self;
}
bless($self, $class) unless $@;
$self;
}
@@
-696,6
+711,7
@@
sub calc_cancel { 0; }
my %info;
foreach my $INC ( @INC ) {
my %info;
foreach my $INC ( @INC ) {
+ warn "globbing $INC/FS/part_pkg/*.pm\n" if $DEBUG;
foreach my $file ( glob("$INC/FS/part_pkg/*.pm") ) {
warn "attempting to load plan info from $file\n" if $DEBUG;
$file =~ /\/(\w+)\.pm$/ or do {
foreach my $file ( glob("$INC/FS/part_pkg/*.pm") ) {
warn "attempting to load plan info from $file\n" if $DEBUG;
$file =~ /\/(\w+)\.pm$/ or do {
@@
-746,6
+762,8
@@
The delete method is unimplemented.
setup and recur semantics are not yet defined (and are implemented in
FS::cust_bill. hmm.).
setup and recur semantics are not yet defined (and are implemented in
FS::cust_bill. hmm.).
+plandata should go
+
=head1 SEE ALSO
L<FS::Record>, L<FS::cust_pkg>, L<FS::type_pkgs>, L<FS::pkg_svc>, L<Safe>.
=head1 SEE ALSO
L<FS::Record>, L<FS::cust_pkg>, L<FS::type_pkgs>, L<FS::pkg_svc>, L<Safe>.