Ticket::NumberGenerator

Moderator: crythias

Post Reply
jafumega27
Znuny newbie
Posts: 28
Joined: 09 Mar 2015, 14:41
Znuny Version: 4.0.5
Real Name: Tiago Rocha

Ticket::NumberGenerator

Post by jafumega27 »

Hi,

I'm creating a new Ticket::NumberGenerator, and I want my NumberGenerator have the CustomerID, is it possible?

Cumps
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Ticket::NumberGenerator

Post by crythias »

yes
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
jafumega27
Znuny newbie
Posts: 28
Joined: 09 Mar 2015, 14:41
Znuny Version: 4.0.5
Real Name: Tiago Rocha

Re: Ticket::NumberGenerator

Post by jafumega27 »

crythias wrote:yes
can you tell me how?
jafumega27
Znuny newbie
Posts: 28
Joined: 09 Mar 2015, 14:41
Znuny Version: 4.0.5
Real Name: Tiago Rocha

Re: Ticket::NumberGenerator

Post by jafumega27 »

crythias wrote:yes
can you tell me how can i get the TicketID?

this is my code:

Code: Select all


 # check needed stuff
    for (qw(TicketID UserID)) {
        if ( !$Param{$_} ) {
            $Kernel::OM->Get('Kernel::System::Log')->Log(
                Priority => 'error',
                Message  => "Need $_!"
            );
            return;
        }
    }


    # get ticket data
    my %Ticket = $Kernel::OM->Get('Kernel::System::Ticket')->TicketGet(
        TicketID      => $Param{TicketID},
    );
    # get customer user object
    my $CustomerUserObject = $Kernel::OM->Get('Kernel::System::CustomerUser');

    # check customer id
    my %CustomerData = $CustomerUserObject->CustomerUserDataGet( User => $Param{UserID} );

    # get customer ids
    my @CustomerIDs = $CustomerUserObject->CustomerIDs( User => $Param{UserID} );

    # add own customer id
    if ( $CustomerData{UserCustomerID} ) {
        push @CustomerIDs, $CustomerData{UserCustomerID};
    }

    # check customer ids, return access if customer id is the same
    CUSTOMERID:
    for my $CustomerID (@CustomerIDs) 
	{
		$CustomerIDFinal = $Ticket{CustomerID} if ( lc $Ticket{CustomerID} eq lc $CustomerID );
        next CUSTOMERID if !$Ticket{CustomerID};
    }
	
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Ticket::NumberGenerator

Post by crythias »

Read the code for a comparable ticket number generator.

It might be helpful to have some background, what you've done, what you're capable of handling, what exactly is blocking your forward progress, etc.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
jafumega27
Znuny newbie
Posts: 28
Joined: 09 Mar 2015, 14:41
Znuny Version: 4.0.5
Real Name: Tiago Rocha

Re: Ticket::NumberGenerator

Post by jafumega27 »

crythias wrote:Read the code for a comparable ticket number generator.

It might be helpful to have some background, what you've done, what you're capable of handling, what exactly is blocking your forward progress, etc.
I read, but I continued blocked in with TicketId, any suggestions?
The rest I could already develop (I think)

Cumps
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Ticket::NumberGenerator

Post by crythias »

jafumega27 wrote:but I continued blocked in with TicketId, any suggestions?
I don't know what this means in a context that is reparable.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Post Reply