projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
*** empty log message ***
[freeside.git]
/
site_perl
/
pkg_svc.pm
diff --git
a/site_perl/pkg_svc.pm
b/site_perl/pkg_svc.pm
index
517125c
..
ee4ad62
100644
(file)
--- a/
site_perl/pkg_svc.pm
+++ b/
site_perl/pkg_svc.pm
@@
-1,12
+1,10
@@
package FS::pkg_svc;
use strict;
package FS::pkg_svc;
use strict;
-use vars qw(@ISA @EXPORT_OK);
-use Exporter;
-use FS::Record qw(fields hfields qsearchs);
+use vars qw( @ISA );
+use FS::Record qw( qsearchs );
-@ISA = qw(FS::Record Exporter);
-@EXPORT_OK = qw(hfields);
+@ISA = qw( FS::Record );
=head1 NAME
=head1 NAME
@@
-16,8
+14,8
@@
FS::pkg_svc - Object methods for pkg_svc records
use FS::pkg_svc;
use FS::pkg_svc;
- $record =
create
FS::pkg_svc \%hash;
- $record =
create
FS::pkg_svc { 'column' => 'value' };
+ $record =
new
FS::pkg_svc \%hash;
+ $record =
new
FS::pkg_svc { 'column' => 'value' };
$error = $record->insert;
$error = $record->insert;
@@
-48,52
+46,24
@@
definition includes
=over 4
=over 4
-=item
create
HASHREF
+=item
new
HASHREF
Create a new record. To add the record to the database, see L<"insert">.
=cut
Create a new record. To add the record to the database, see L<"insert">.
=cut
-sub create {
- my($proto,$hashref)=@_;
-
- #now in FS::Record::new
- #my($field);
- #foreach $field (fields('pkg_svc')) {
- # $hashref->{$field}='' unless defined $hashref->{$field};
- #}
-
- $proto->new('pkg_svc',$hashref);
-
-}
+sub table { 'pkg_svc'; }
=item insert
Adds this record to the database. If there is an error, returns the error,
otherwise returns false.
=item insert
Adds this record to the database. If there is an error, returns the error,
otherwise returns false.
-=cut
-
-sub insert {
- my($self)=@_;
-
- $self->check or
- $self->add;
-}
-
=item delete
Deletes this record from the database. If there is an error, returns the
error, otherwise returns false.
=item delete
Deletes this record from the database. If there is an error, returns the
error, otherwise returns false.
-=cut
-
-sub delete {
- my($self)=@_;
-
- $self->del;
-}
-
=item replace OLD_RECORD
Replaces OLD_RECORD with this one in the database. If there is an error,
=item replace OLD_RECORD
Replaces OLD_RECORD with this one in the database. If there is an error,
@@
-102,15
+72,12
@@
returns the error, otherwise returns false.
=cut
sub replace {
=cut
sub replace {
- my($new,$old)=@_;
- return "(Old) Not a pkg_svc record!" unless $old->table eq "pkg_svc";
- return "Can't change pkgpart!"
- if $old->getfield('pkgpart') ne $new->getfield('pkgpart');
- return "Can't change svcpart!"
- if $old->getfield('svcpart') ne $new->getfield('svcpart');
-
- $new->check or
- $new->rep($old);
+ my ( $new, $old ) = ( shift, shift );
+
+ return "Can't change pkgpart!" if $old->pkgpart != $new->pkgpart;
+ return "Can't change svcpart!" if $old->svcpart != $new->svcpart;
+
+ $new->SUPER::replace($old);
}
=item check
}
=item check
@@
-122,31
+89,32
@@
methods.
=cut
sub check {
=cut
sub check {
- my($self)=@_;
- return "Not a pkg_svc record!" unless $self->table eq "pkg_svc";
- my($recref) = $self->hashref;
+ my $self = shift;
- my
($error)
;
-
return $error if
$error =
+ my
$error
;
+ $error =
$self->ut_number('pkgpart')
|| $self->ut_number('svcpart')
|| $self->ut_number('quantity')
;
$self->ut_number('pkgpart')
|| $self->ut_number('svcpart')
|| $self->ut_number('quantity')
;
+ return $error if $error;
return "Unknown pkgpart!"
return "Unknown pkgpart!"
- unless qsearchs(
'part_pkg',{'pkgpart'=> $self->getfield('pkgpart')}
);
+ unless qsearchs(
'part_pkg', { 'pkgpart' => $self->pkgpart }
);
return "Unknown svcpart!"
return "Unknown svcpart!"
- unless qsearchs('part_svc',
{'svcpart'=> $self->getfield('svcpart')}
);
+ unless qsearchs('part_svc',
{ 'svcpart' => $self->svcpart }
);
''; #no error
}
=back
''; #no error
}
=back
-=head1
BUGS
+=head1
VERSION
-It doesn't properly override FS::Record yet.
+$Id: pkg_svc.pm,v 1.3 1999-01-18 21:58:08 ivan Exp $
+
+=head1 BUGS
=head1 SEE ALSO
=head1 SEE ALSO
@@
-162,6
+130,14
@@
ivan@sisd.com 97-nov-13
pod ivan@sisd.com 98-sep-22
pod ivan@sisd.com 98-sep-22
+$Log: pkg_svc.pm,v $
+Revision 1.3 1999-01-18 21:58:08 ivan
+esthetic: eq and ne were used in a few places instead of == and !=
+
+Revision 1.2 1998/12/29 11:59:51 ivan
+mostly properly OO, some work still to be done with svc_ stuff
+
+
=cut
1;
=cut
1;