I would like to know how I could add an additional field in the "Add Note to Ticket" screen, and include that field in a new column of the table time_accounting.
I've created a dynamic field - date type - "Data do registo de horas:", and placed it exactly where i need it (as the image below shows it).
But now I need it to fill the time_accounting table. I realize that would require some programming/development, and I’m ok with it (despite the low knowledge in Perl) and I’ve already looked in "..\Kernel\System\Ticket.pm"
Code: Select all
sub TicketAccountTime {
my ( $Self, %Param ) = @_;
# check needed stuff
for my $Needed (qw(TicketID ArticleID TimeUnit UserID)) {
if ( !$Param{$Needed} ) {
$Self->{LogObject}->Log( Priority => 'error', Message => "Need $Needed!" );
return;
}
}
# check some wrong formats
$Param{TimeUnit} =~ s/,/\./g;
$Param{TimeUnit} =~ s/ //g;
$Param{TimeUnit} =~ s/^(\d{1,10}\.\d\d).+?$/$1/g;
chomp $Param{TimeUnit};
# db quote
$Param{TimeUnit} = $Self->{DBObject}->Quote( $Param{TimeUnit}, 'Number' );
# db update
return if !$Self->{DBObject}->Do(
SQL => "INSERT INTO time_accounting "
. " (ticket_id, article_id, time_unit, create_time, create_by, change_time, change_by) "
. " VALUES (?, ?, $Param{TimeUnit}, current_timestamp, ?, current_timestamp, ?)",
Bind => [
\$Param{TicketID}, \$Param{ArticleID}, \$Param{UserID}, \$Param{UserID},
],
);
Am I on the right track? Should i forget the Dynamic Field and try to "copy" other field in code? What other files/places are relevant for this change?
Any help?
Regards,
Flávio Rocha.