Prima importazione
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<otrs_config version="2.0" init="Config">
|
||||
<Setting Name="GenericInterface::Operation::Module###CustomerUser::CustomerUserSearch" Required="0" Valid="1">
|
||||
<Description Translatable="1">Registration for CustomerUserSearch operation.</Description>
|
||||
<Navigation>GenericInterface::Operation::ModuleRegistration</Navigation>
|
||||
<Value>
|
||||
<Hash>
|
||||
<Item Key="Name">CustomerUserSearch</Item>
|
||||
<Item Key="Controller">CustomerUser</Item>
|
||||
<Item Key="ConfigDialog">AdminGenericInterfaceOperationDefault</Item>
|
||||
</Hash>
|
||||
</Value>
|
||||
</Setting>
|
||||
<Setting Name="GenericInterface::Operation::Module###CustomerUser::CustomerUserGet" Required="0" Valid="1">
|
||||
<Description Translatable="1">Registration for CustomerUserGet operation.</Description>
|
||||
<Navigation>GenericInterface::Operation::ModuleRegistration</Navigation>
|
||||
<Value>
|
||||
<Hash>
|
||||
<Item Key="Name">CustomerUserGet</Item>
|
||||
<Item Key="Controller">CustomerUser</Item>
|
||||
<Item Key="ConfigDialog">AdminGenericInterfaceOperationDefault</Item>
|
||||
</Hash>
|
||||
</Value>
|
||||
</Setting>
|
||||
</otrs_config>
|
||||
@@ -0,0 +1,53 @@
|
||||
package Kernel::GenericInterface::Operation::CustomerUser::CustomerUserGet;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Kernel::System::ObjectManager;
|
||||
|
||||
sub new {
|
||||
my ( $Type, %Param ) = @_;
|
||||
my $Self = {%Param};
|
||||
bless( $Self, $Type );
|
||||
return $Self;
|
||||
}
|
||||
|
||||
sub Run {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
if ( !$Param{Data} || !$Param{Data}->{UserLogin} ) {
|
||||
return {
|
||||
Success => 0,
|
||||
ErrorMessage => "UserLogin is required",
|
||||
};
|
||||
}
|
||||
|
||||
my $UserLogin = $Param{Data}->{UserLogin};
|
||||
my $CustomerUserObject = $Kernel::OM->Get('Kernel::System::CustomerUser');
|
||||
|
||||
my %User = $CustomerUserObject->CustomerUserDataGet(
|
||||
User => $UserLogin,
|
||||
);
|
||||
|
||||
if ( !%User ) {
|
||||
return {
|
||||
Success => 0,
|
||||
ErrorMessage => "Customer user not found: $UserLogin",
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
Success => 1,
|
||||
Data => {
|
||||
CustomerUser => {
|
||||
UserLogin => $User{UserLogin},
|
||||
UserFirstname => $User{UserFirstname},
|
||||
UserLastname => $User{UserLastname},
|
||||
UserEmail => $User{UserEmail},
|
||||
UserCustomerID=> $User{UserCustomerID},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
@@ -0,0 +1,48 @@
|
||||
package Kernel::GenericInterface::Operation::CustomerUser::CustomerUserSearch;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Kernel::System::ObjectManager;
|
||||
|
||||
sub new {
|
||||
my ( $Type, %Param ) = @_;
|
||||
my $Self = {%Param};
|
||||
bless( $Self, $Type );
|
||||
return $Self;
|
||||
}
|
||||
|
||||
sub Run {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
if ( !$Param{Data} ) {
|
||||
return {
|
||||
Success => 0,
|
||||
ErrorMessage => "No Data provided",
|
||||
};
|
||||
}
|
||||
|
||||
my $Search = $Param{Data}->{Search} || '';
|
||||
my $CustomerID = $Param{Data}->{CustomerID} || '';
|
||||
my $Valid = defined $Param{Data}->{Valid} ? $Param{Data}->{Valid} : 1;
|
||||
|
||||
my $CustomerUserObject = $Kernel::OM->Get('Kernel::System::CustomerUser');
|
||||
|
||||
# Search customer users
|
||||
my %Users = $CustomerUserObject->CustomerSearch(
|
||||
Search => $Search,
|
||||
CustomerID => $CustomerID,
|
||||
Valid => $Valid,
|
||||
);
|
||||
|
||||
my @CustomerUserIDs = keys %Users;
|
||||
|
||||
return {
|
||||
Success => 1,
|
||||
Data => {
|
||||
CustomerUserID => \@CustomerUserIDs,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
Reference in New Issue
Block a user