[freeside-commits] freeside/FS/FS cust_pkg.pm,1.191,1.192
Ivan,,,
ivan at wavetail.420.am
Sun Jan 16 14:31:28 PST 2011
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv3071
Modified Files:
cust_pkg.pm
Log Message:
better error on bad pkgpart
Index: cust_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_pkg.pm,v
retrieving revision 1.191
retrieving revision 1.192
diff -u -w -d -r1.191 -r1.192
--- cust_pkg.pm 16 Jan 2011 03:35:26 -0000 1.191
+++ cust_pkg.pm 16 Jan 2011 22:31:25 -0000 1.192
@@ -260,6 +260,9 @@
sub insert {
my( $self, %options ) = @_;
+ my $error = $self->check_pkgpart;
+ return $error if $error;
+
if ( $self->part_pkg->option('start_1st', 1) && !$self->start_date ) {
my ($sec,$min,$hour,$mday,$mon,$year) = (localtime(time) )[0,1,2,3,4,5];
$mon += 1 unless $mday == 1;
@@ -288,7 +291,7 @@
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
- my $error = $self->SUPER::insert($options{options} ? %{$options{options}} : ());
+ $error = $self->SUPER::insert($options{options} ? %{$options{options}} : ());
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
return $error;
@@ -581,6 +584,7 @@
$self->ut_numbern('pkgnum')
|| $self->ut_foreign_key('custnum', 'cust_main', 'custnum')
|| $self->ut_numbern('pkgpart')
+ || $self->check_pkgpart
|| $self->ut_foreign_keyn('locationnum', 'cust_location', 'locationnum')
|| $self->ut_numbern('start_date')
|| $self->ut_numbern('setup')
@@ -593,6 +597,28 @@
;
return $error if $error;
+ $self->usernum($FS::CurrentUser::CurrentUser->usernum) unless $self->usernum;
+
+ if ( $self->dbdef_table->column('manual_flag') ) {
+ $self->manual_flag('') if $self->manual_flag eq ' ';
+ $self->manual_flag =~ /^([01]?)$/
+ or return "Illegal manual_flag ". $self->manual_flag;
+ $self->manual_flag($1);
+ }
+
+ $self->SUPER::check;
+}
+
+=item check_pkgpart
+
+=cut
+
+sub check_pkgpart {
+ my $self = shift;
+
+ my $error = $self->ut_numbern('pkgpart');
+ return $error if $error;
+
if ( $self->reg_code ) {
unless ( grep { $self->pkgpart == $_->pkgpart }
@@ -628,16 +654,8 @@
}
- $self->usernum($FS::CurrentUser::CurrentUser->usernum) unless $self->usernum;
-
- if ( $self->dbdef_table->column('manual_flag') ) {
- $self->manual_flag('') if $self->manual_flag eq ' ';
- $self->manual_flag =~ /^([01]?)$/
- or return "Illegal manual_flag ". $self->manual_flag;
- $self->manual_flag($1);
- }
+ '';
- $self->SUPER::check;
}
=item cancel [ OPTION => VALUE ... ]
More information about the freeside-commits
mailing list