[freeside-commits] freeside/FS/FS/part_event/Condition hasnt_pkgpart.pm, NONE, 1.1 has_pkg_class.pm, NONE, 1.1 has_pkgpart.pm, NONE, 1.1
Ivan,,,
ivan at wavetail.420.am
Thu Aug 20 02:47:07 PDT 2009
Update of /home/cvs/cvsroot/freeside/FS/FS/part_event/Condition
In directory wavetail.420.am:/tmp/cvs-serv25242/FS/FS/part_event/Condition
Added Files:
hasnt_pkgpart.pm has_pkg_class.pm has_pkgpart.pm
Log Message:
email statements, RT#4860
--- NEW FILE: has_pkg_class.pm ---
package FS::part_event::Condition::has_pkg_class;
use strict;
use base qw( FS::part_event::Condition );
use FS::Record qw( qsearch );
use FS::pkg_class;
sub description {
'Customer has uncancelled package with class';
}
sub eventtable_hashref {
{ 'cust_main' => 1,
'cust_bill' => 1,
'cust_pkg' => 1,
};
}
#something like this
sub option_fields {
(
'pkgclass' => { 'label' => 'Package Class',
'type' => 'select-pkg_class',
'multiple' => 1,
},
);
}
sub condition {
my( $self, $object ) = @_;
my $cust_main = $self->cust_main($object);
#XXX test
my $hashref = $self->option('pkgclass') || {};
grep $hashref->{ $_->part_pkg->classnum }, $cust_main->ncancelled_pkgs;
}
1;
--- NEW FILE: has_pkgpart.pm ---
package FS::part_event::Condition::has_pkgpart;
use strict;
use base qw( FS::part_event::Condition );
sub description { 'Customer has uncancelled package of specified definitions'; }
sub eventtable_hashref {
{ 'cust_main' => 1,
'cust_bill' => 1,
'cust_pkg' => 1,
};
}
sub option_fields {
(
'if_pkgpart' => { 'label' => 'Only packages: ',
'type' => 'select-part_pkg',
'multiple' => 1,
},
);
}
sub condition {
my( $self, $object) = @_;
my $cust_main = $self->cust_main($object);
#XXX test
my $if_pkgpart = $self->option('if_pkgpart') || {};
grep $if_pkgpart->{ $_->pkgpart }, $cust_main->ncancelled_pkgs;
}
#XXX
#sub condition_sql {
#
#}
1;
--- NEW FILE: hasnt_pkgpart.pm ---
package FS::part_event::Condition::hasnt_pkgpart;
use strict;
use base qw( FS::part_event::Condition );
sub description { 'Customer does not have uncancelled package of specified definitions'; }
sub eventtable_hashref {
{ 'cust_main' => 1,
'cust_bill' => 1,
'cust_pkg' => 1,
};
}
sub option_fields {
(
'unless_pkgpart' => { 'label' => 'Packages: ',
'type' => 'select-part_pkg',
'multiple' => 1,
},
);
}
sub condition {
my( $self, $object ) = @_;
my $cust_main = $self->cust_main($object);
#XXX test
my $unless_pkgpart = $self->option('unless_pkgpart') || {};
! grep $unless_pkgpart->{ $_->pkgpart }, $cust_main->ncancelled_pkgs;
}
#XXX
#sub condition_sql {
#
#}
1;
More information about the freeside-commits
mailing list