I espected the user are required to insert the Start day. The system will then calculate the working hours until today.
I had referenced https://otrs.github.io/doc/manual/devel ... -otrs.html to create a Hello World Page.
And i referenced https://otrs.github.io/doc/api/otrs/5.0 ... me.pm.html to calculate the working hour.
The code below is something I trying to add.
AgentHelloWorld.tt
Code: Select all
<p>
[% Data.HelloWorldText | Translate() | html %]
</p>
<form>
start Year:<br>
<input type="text" id="year">
<br>
start Month:<br>
<input type="text" id="month">
<br>
start Day:<br>
<input type="text" id="day">
<br>
</form>
module/AgentHelloWorld.pm
Code: Select all
$Data{HelloWorldText} = $HelloWorldObject->GetHelloWorldText();
Code: Select all
sub GetHelloWorldText {
use Kernel::System::ObjectManager;
local $Kernel::OM = Kernel::System::ObjectManager->new();
my $TimeObject = $Kernel::OM->Get('Kernel::System::Time');
my $test;
my $Created = $TimeObject->Date2SystemTime(
Year => 2016,
Month => 7,
Day => 25,
Hour => 0,
Minute => 0,
Second => 0,
);
my ( $Sec, $Min, $Hour, $Day, $Month, $Year, $WDay ) = localtime $Created; ## no critic
my $xml = XML::Simple->new;
my $WorkingTime = $TimeObject->WorkingTime(
StartTime => $Created,
StopTime => $TimeObject->SystemTime(),
Calendar => 1, # '' is default
);
return $WorkingTime/(60*60);
}
Are there a way to call the perl function in OTRS?
Or can somebody point me out the next step i should do?
My OTRS version is 5.0.10.
Thanks.