Filter#
NAME#
Kernel::System::PostMaster::Filter
DESCRIPTION#
All postmaster database filters
PUBLIC INTERFACE#
new()#
Don’t use the constructor directly, use the ObjectManager instead:
my $PMFilterObject = $Kernel::OM->Get('Kernel::System::PostMaster::Filter');
FilterList()#
get all filter
my %FilterList = $PMFilterObject->FilterList();
FilterAdd()#
add a filter
$PMFilterObject->FilterAdd(
Name => 'some name',
StopAfterMatch => 0,
Match = [
{
Key => 'Subject',
Value => '^ADV: 123',
},
# ...
],
Not = [
{
Key => 'Subject',
Value => '1',
},
# ...
],
Set = [
{
Key => 'X-OTRS-Queue',
Value => 'Some::Queue',
},
# ...
],
);
FilterDelete()#
delete a filter
$PMFilterObject->FilterDelete(
Name => '123',
);
FilterGet()#
get filter properties, returns HASH ref Match and Set
my %Data = $PMFilterObject->FilterGet(
Name => '132',
);
FilterLookup()#
lookup for PostMaster filter id or name
my $ID = $PMFilterObject->FilterLookup(
Name => 'postmaster_filter',
);
# OR
my $Name = $PMFilterObject->FilterLookup(
ID => 10,
);
FilterExport()#
export a PostMaster filter
my $ExportData = $PostMasterObject->FilterExport(
# required either ID or ExportAll
Name => 'postmaster1' # required
# or
ID => $PostMasterID, # required
# or
ExportAll => 0, # required, possible: 0, 1
UserID => 1, # required
}
returns PostMaster filters hashes in an array with data:
my $ExportData =
[
{
'Name' => 'postmaster1',
'StopAfterMatch' => 0,
'Set' => [{
'Value' => '2',
'Key' => 'X-OTRS-AttachmentExists'
}],
'Match' => [{
'Value' => '2',
'Key' => 'Message-ID'
}],
'Not' => [{
'Value' => undef,
'Key' => 'Message-ID'
}]
}, {
'Match' => [{
'Value' => '3',
'Key' => 'Precedence'
}],
'Not' => [{
'Key' => 'Precedence',
'Value' => undef
}],
'Name' => 'postmaster2',
'Set' => [{
'Value' => '3',
'Key' => 'X-OTRS-AttachmentExists'
}],
'StopAfterMatch' => 0
}
]
FilterExportDataGet()#
get data to export PostMaster filter
my %PostMasterData = $PostMasterObject->FilterExportDataGet(
Name => 'postmaster1', # mandatory
);
Returns:
my %PostMasterData = (
'Name' => 'postmaster1',
'StopAfterMatch' => 0,
'Set' => [{
'Value' => '2',
'Key' => 'X-OTRS-AttachmentExists'
}],
'Match' => [{
'Value' => '2',
'Key' => 'Message-ID'
}],
'Not' => [{
'Value' => undef,
'Key' => 'Message-ID'
}]
)