I'm new in OTRS developing.
I need to find the WarrantyExpirationDate of CIs, and check if it's nearly approaching, to decide if it's need to alert the user.
But I stocked in getting WarrantyExpirationDate of CIs.
I think there are 2 ways to get it, one is by web service, Kernel::GenericInterface::Operation::ConfigItem::ConfigItemGet.
Code: Select all
my ( $Self, %Param ) = @_;
my $User='soap_user';
my $Pw='soap_pass';
my $dbh = DBI->connect("DBI:mysql:otrs:16.187.42.143", 'root', 'ddc@dxc', { RaiseError => 1 });
my $sth = $dbh->prepare("SELECT * FROM configitem");
$sth->execute();
while ( my @row = $sth->fetchrow_array() )
{
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => join('\t', $row[0])."\n",
);
my $RPC = new SOAP::Lite(proxy => 'http://16.187.42.143/otrs/itsmrpc.pl',uri => 'http://16.187.42.143/Core');
my $res = $RPC->Dispatch($User,$Pw,'ITSMConfigItem','ConfigItemGet',ConfigItemID => $row[0]);
die $res->fault->{faultstring} if $res->fault;
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => $res."\n",
);
}
$sth->finish();
$dbh->disconnect();
# Get the DBObject from the central object manager
# my $DBObject = $Kernel::OM->Get('Kernel::System::DB');
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => 'retrieve completed',
);
I also searched it from DB by DBI, but only find it in configitem_history.
If it's not changed, it will not be stored in this table.
So, can anyone give me some advice on how to get it?
Any suggestions are highly appreciated.
Thanks,
lglg