[freeside-commits] freeside/eg part_event-Action-template.pm, NONE, 1.1 part_event-Condition-template.pm, NONE, 1.1

Ivan,,, ivan at wavetail.420.am
Wed Aug 1 15:24:56 PDT 2007


Update of /home/cvs/cvsroot/freeside/eg
In directory wavetail:/tmp/cvs-serv23435/eg

Added Files:
	part_event-Action-template.pm part_event-Condition-template.pm 
Log Message:
event refactor, landing on HEAD!

--- NEW FILE: part_event-Condition-template.pm ---
package FS::part_event::Condition::mycondition;

use strict;

use base qw( FS::part_event::Condition );

# see the FS::part_event::Condition manpage for full documentation on each
# of the required and optional methods.

sub description {
  'New condition (the author forgot to change this description)';
}

#sub eventtable_hashref {
#    { 'cust_main'      => 1,
#      'cust_bill'      => 1,
#      'cust_pkg'       => 1,
#      'cust_pay_batch' => 1,
#    };
#}

#sub option_fields {
#  (
#    'field'         => 'description',
#
#    'another_field' => { 'label'=>'Amount', 'type'=>'money', },
#
#    'third_field'   => { 'label'         => 'Types',
#                         'type'          => 'checkbox-multiple',
#                         'options'       => [ 'h', 's' ],
#                         'option_labels' => { 'h' => 'Happy',
#                                              's' => 'Sad',
#                                            },
#  );
#}

sub condition {
  my($self, $object, %opt) = @_;

  my $cust_main = $self->cust_main($object);

  my $value_of_field = $self->option('field');

  my $time = $opt{'time'}; #use this instead of time or $^T

  #test your condition
  1;

}

#sub condition_sql {
#  my( $class, $table ) = @_;
#  #...
#  'true';
#}

1;

--- NEW FILE: part_event-Action-template.pm ---
package FS::part_event::Action::myaction;

use strict;

use base qw( FS::part_event::Action );

# see the FS::part_event::Action manpage for full documentation on each
# of the required and optional methods.

sub description {
  'New action (the author forgot to change this description)';
}

#sub eventtable_hashref {
#    { 'cust_main' => 1,
#      'cust_bill' => 1,
#      'cust_pkg'  => 1,
#    };
#}

#sub option_fields {
#  (
#    'field'         => 'description',
#
#    'another_field' => { 'label'=>'Amount', 'type'=>'money', },
#
#    'third_field'   => { 'label'         => 'Types',
#                         'type'          => 'select',
#                         'options'       => [ 'h', 's' ],
#                         'option_labels' => { 'h' => 'Happy',
#                                              's' => 'Sad',
#                                            },
#  );
#}

#sub default_weight {
#  100;
#}


sub do_action {
  my( $self, $object ) = @_;

  my $cust_main = $self->cust_main($object);

  my $value_of_field = $self->option('field');

  #do your action
  
  #die "Error: $error";
  return 'Null example action completed sucessfully.';

}

1;



More information about the freeside-commits mailing list