Installation file .sopm
Installation file
The installation process contains a standard OTRS package installation file.
Be careful to correctly replace translation string names in code blocks as they indicate translations array!
If You do not plan include multiple language support You can omit code between <!-- POSSIBLE TO OMIT--> block code.
<?xml version="1.0" encoding="utf-8" ?>
<otrs_package version="1.0">
<Name>Contract Widget</Name>
<Version>1.x.x</Version>
<Framework>6.x.x</Framework>
<Vendor>Company</Vendor>
<URL>https://www.xyz.pl/</URL>
<License>GNU AFFERO GENERAL PUBLIC LICENSE Version 3, November 2007</License>
<Description Lang="en">XYZ Widget for Intalio Customer Panel.</Description>
<IntroInstall Type="post" Lang="en" Title="Thank you!">Thank you for choosing the XYZ Widget for Intalio Customer Panel module.</IntroInstall>
<BuildDate>?</BuildDate>
<BuildHost>?</BuildHost>
<Filelist>
<File Permission="644" Location="Kernel/Config/Files/XML/XYZWidget.xml"></File>
<File Permission="644" Location="Kernel/Modules/XYZWidget.pm"></File>
<File Permission="644" Location="Kernel/Language/pl_XYZ.pm"></File>
<!-- FRONTEND -->
<File Permission="644" Location="var/httpd/htdocs/customer-panel/modules/WIDGET_XYZ.js"></File>
<!-- TRANSLATION STRINGS -->
<File Permission="644" Location="var/intalio-customer-panel/xyz_widget_translation_strings.json"/>
</Filelist>
<!-- POSSIBLE TO OMIT -->
<CodeInstall Type="post"><![CDATA[
###
# Dodanie nowych tłumaczeń tego modułu do globalnej listy fraz modułu otrs-frontend.
###
use JSON::PP;
use Data::Dumper;
my $MainObject = $Kernel::OM->Get('Kernel::System::Main');
my $GlobalTranslationStringsStrRef = $MainObject->FileRead(
Location => '/opt/otrs/var/intalio-customer-panel/translation_strings.json',
);
my $TranslationStrings = ${$GlobalTranslationStringsStrRef};
my $json = JSON::PP->new->pretty->allow_nonref;
$json = $json->allow_blessed;
$json = $json->allow_unknown;
$json = $json->convert_blessed;
my @RequiredStrings = @{$json->decode( $TranslationStrings )};
my $MyTranslationStringsStrRef = $MainObject->FileRead(
Location => '/opt/otrs/var/intalio-customer-panel/xyz_widget_translation_strings.json',
);
my $MyTranslationStrings = ${$MyTranslationStringsStrRef};
my @TranslationStrings = @{$json->decode( $MyTranslationStrings )};
print STDERR "RequiredStrings: ".Dumper(\@RequiredStrings);
print STDERR "TranslationStrings: ".Dumper(\@TranslationStrings);
@RequiredStrings = (@RequiredStrings, @TranslationStrings);
my $TranslationStringsResult = $json->encode( \@RequiredStrings );
print STDERR "Result: $TranslationStringsResult\n";
my $FileLocation = $MainObject->FileWrite(
Directory => '/opt/otrs/var/intalio-customer-panel/',
Filename => "translation_strings.json",
Content => \$TranslationStringsResult,
);
]]></CodeInstall>
<CodeReinstall Type="post"><![CDATA[
###
# Dodanie nowych tłumaczeń tego modułu do globalnej listy fraz modułu otrs-frontend.
###
use JSON::PP;
use Data::Dumper;
my $MainObject = $Kernel::OM->Get('Kernel::System::Main');
my $GlobalTranslationStringsStrRef = $MainObject->FileRead(
Location => '/opt/otrs/var/intalio-customer-panel/translation_strings.json',
);
my $TranslationStrings = ${$GlobalTranslationStringsStrRef};
my $json = JSON::PP->new->pretty->allow_nonref;
$json = $json->allow_blessed;
$json = $json->allow_unknown;
$json = $json->convert_blessed;
my @RequiredStrings = @{$json->decode( $TranslationStrings )};
my $MyTranslationStringsStrRef = $MainObject->FileRead(
Location => '/opt/otrs/var/intalio-customer-panel/xyz_widget_translation_strings.json',
);
my $MyTranslationStrings = ${$MyTranslationStringsStrRef};
my @TranslationStrings = @{$json->decode( $MyTranslationStrings )};
print STDERR "RequiredStrings: ".Dumper(\@RequiredStrings);
print STDERR "TranslationStrings: ".Dumper(\@TranslationStrings);
@RequiredStrings = (@RequiredStrings, @TranslationStrings);
my $TranslationStringsResult = $json->encode( \@RequiredStrings );
print STDERR "Result: $TranslationStringsResult\n";
my $FileLocation = $MainObject->FileWrite(
Directory => '/opt/otrs/var/intalio-customer-panel/',
Filename => "translation_strings.json",
Content => \$TranslationStringsResult,
);
]]></CodeReinstall>
<CodeUpgrade Type="post"><![CDATA[
###
# Dodanie nowych tłumaczeń tego modułu do globalnej listy fraz modułu otrs-frontend.
###
use JSON::PP;
use Data::Dumper;
my $MainObject = $Kernel::OM->Get('Kernel::System::Main');
my $GlobalTranslationStringsStrRef = $MainObject->FileRead(
Location => '/opt/otrs/var/intalio-customer-panel/translation_strings.json',
);
my $TranslationStrings = ${$GlobalTranslationStringsStrRef};
my $json = JSON::PP->new->pretty->allow_nonref;
$json = $json->allow_blessed;
$json = $json->allow_unknown;
$json = $json->convert_blessed;
my @RequiredStrings = @{$json->decode( $TranslationStrings )};
my $MyTranslationStringsStrRef = $MainObject->FileRead(
Location => '/opt/otrs/var/intalio-customer-panel/xyz_widget_translation_strings.json',
);
my $MyTranslationStrings = ${$MyTranslationStringsStrRef};
my @TranslationStrings = @{$json->decode( $MyTranslationStrings )};
print STDERR "RequiredStrings: ".Dumper(\@RequiredStrings);
print STDERR "TranslationStrings: ".Dumper(\@TranslationStrings);
@RequiredStrings = (@RequiredStrings, @TranslationStrings);
my $TranslationStringsResult = $json->encode( \@RequiredStrings );
print STDERR "Result: $TranslationStringsResult\n";
my $FileLocation = $MainObject->FileWrite(
Directory => '/opt/otrs/var/intalio-customer-panel/',
Filename => "translation_strings.json",
Content => \$TranslationStringsResult,
);
]]></CodeUpgrade>
<!-- POSSIBLE TO OMIT -->
</otrs_package>