Paul,
Thanks for your help.
With my limited experience with plugins and I would appreciate some more advice.
I know how to set up the plugin but I am not sure of the contents. As this plugin will basically do what the add_record subroutine does PLUS split my dates up and add eachone seperatly, I assume that I start by copying the add_record contents into my plugin subroutine. I'm thinking that I need to have the plugin run through all the usual steps for each split date and then display the success page after the last date has be inserted (or an error if applicable).
What I can't work out is where to add my loop to have each split date checked for errors and then inserted. I have modified the loop you gave me and have come up with the following (which works on it's own).
my $splitdate;
my @dates = split ',', $IN->param('public_holiday_202');
foreach $splitdate (@dates) {
$DB->table('public_holiday')->insert({ 'public_holiday_owner_id' => $self->{user}->{Username}, 'public_holiday_104' => $self->{cgi}->{public_holiday_104}, 'public_holiday_105' => $self->{cgi}->{public_holiday_105}, 'public_holiday_201' => $self->{cgi}->{public_holiday_201}, 'public_holiday_202' => $splitdate });
#end for
}
How do I incorporate this loop into my copy of the add_record subroutine???
Am I going about this the wrong way? Is there a simpler way to do this?
Thank you.
Simon.
Thanks for your help.
With my limited experience with plugins and I would appreciate some more advice.
I know how to set up the plugin but I am not sure of the contents. As this plugin will basically do what the add_record subroutine does PLUS split my dates up and add eachone seperatly, I assume that I start by copying the add_record contents into my plugin subroutine. I'm thinking that I need to have the plugin run through all the usual steps for each split date and then display the success page after the last date has be inserted (or an error if applicable).
What I can't work out is where to add my loop to have each split date checked for errors and then inserted. I have modified the loop you gave me and have come up with the following (which works on it's own).
my $splitdate;
my @dates = split ',', $IN->param('public_holiday_202');
foreach $splitdate (@dates) {
$DB->table('public_holiday')->insert({ 'public_holiday_owner_id' => $self->{user}->{Username}, 'public_holiday_104' => $self->{cgi}->{public_holiday_104}, 'public_holiday_105' => $self->{cgi}->{public_holiday_105}, 'public_holiday_201' => $self->{cgi}->{public_holiday_201}, 'public_holiday_202' => $splitdate });
#end for
}
How do I incorporate this loop into my copy of the add_record subroutine???
Am I going about this the wrong way? Is there a simpler way to do this?
Thank you.
Simon.