Description | manuals and libraries |
Kernel::System::Service - service lib
All service functions.
create an object
my $ServiceObject = $Kernel::OM->Get('Kernel::System::Service');
return a hash list of services
my %ServiceList = $ServiceObject->ServiceList(
Valid => 0, # (optional) default 1 (0|1)
UserID => 1,
);
return a list of services with the complete list of attributes for each service
my $ServiceList = $ServiceObject->ServiceListGet(
Valid => 0, # (optional) default 1 (0|1)
UserID => 1,
);
returns
$ServiceList = [
{
ServiceID => 1,
ParentID => 0,
Name => 'MyService',
NameShort => 'MyService',
ValidID => 1,
Comment => 'Some Comment'
CreateTime => '2011-02-08 15:08:00',
ChangeTime => '2011-06-11 17:22:00',
CreateBy => 1,
ChangeBy => 1,
},
{
ServiceID => 2,
ParentID => 1,
Name => 'MyService::MySubService',
NameShort => 'MySubService',
ValidID => 1,
Comment => 'Some Comment'
CreateTime => '2011-02-08 15:08:00',
ChangeTime => '2011-06-11 17:22:00',
CreateBy => 1,
ChangeBy => 1,
},
# ...
];
return a service as hash
Return $ServiceData{ServiceID} $ServiceData{ParentID} $ServiceData{Name} $ServiceData{NameShort} $ServiceData{ValidID} $ServiceData{Comment} $ServiceData{CreateTime} $ServiceData{CreateBy} $ServiceData{ChangeTime} $ServiceData{ChangeBy}
my %ServiceData = $ServiceObject->ServiceGet(
ServiceID => 123,
UserID => 1,
);
my %ServiceData = $ServiceObject->ServiceGet(
Name => 'Service::SubService',
UserID => 1,
);
return a service name and id
my $ServiceName = $ServiceObject->ServiceLookup(
ServiceID => 123,
);
or
my $ServiceID = $ServiceObject->ServiceLookup(
Name => 'Service::SubService',
);
add a service
my $ServiceID = $ServiceObject->ServiceAdd(
Name => 'Service Name',
ParentID => 1, # (optional)
ValidID => 1,
Comment => 'Comment', # (optional)
UserID => 1,
);
update an existing service
my $True = $ServiceObject->ServiceUpdate(
ServiceID => 123,
ParentID => 1, # (optional)
Name => 'Service Name',
ValidID => 1,
Comment => 'Comment', # (optional)
UserID => 1,
);
return service ids as an array
my @ServiceList = $ServiceObject->ServiceSearch(
Name => 'Service Name', # (optional)
Limit => 122, # (optional) default 1000
UserID => 1,
);
returns a list of customeruser/service members
ServiceID: service id
CustomerUserLogin: customer user login
DefaultServices: activate or deactivate default services
Result: HASH -> returns a hash of key => service id, value => service name
Name -> returns an array of user names
ID -> returns an array of user ids
Example (get services of customer user):
$ServiceObject->CustomerUserServiceMemberList(
CustomerUserLogin => 'Test',
Result => 'HASH',
DefaultServices => 0,
);
Example (get customer user of service):
$ServiceObject->CustomerUserServiceMemberList(
ServiceID => $ID,
Result => 'HASH',
);
to add a member to a service
if 'Active' is 0, the customer is removed from the service
$ServiceObject->CustomerUserServiceMemberAdd(
CustomerUserLogin => 'Test1',
ServiceID => 6,
Active => 1,
UserID => 123,
);
set service preferences
$ServiceObject->ServicePreferencesSet(
ServiceID => 123,
Key => 'UserComment',
Value => 'some comment',
UserID => 123,
);
get service preferences
my %Preferences = $ServiceObject->ServicePreferencesGet(
ServiceID => 123,
UserID => 123,
);
return an ordered list all parent service IDs for the given service from the root parent to the current service parent
my $ServiceParentsList = $ServiceObject->ServiceParentsGet(
ServiceID => 123,
UserID => 1,
);
returns
$ServiceParentsList = [ 1, 2, ...];
get all custom services of one user
my @Services = $ServiceObject->GetAllCustomServices( UserID => 123 );
This software is part of the OTRS project (https://otrs.org/).
This software comes with ABSOLUTELY NO WARRANTY. For details, see the enclosed file COPYING for license information (GPL). If you did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.