Hi,

my script doesn't work due to

http://bugs.otrs.org/show_bug.cgi?id=2261

After applying the patch, it works.



Alexander Scholler schrieb:
Hi,

I want to migrate to v2.2.

Previously, the affected IT-service was stored in
* TicketFreeKey10=Service
* TicketFreeText10= e.g. Mail or FS or ...

Now I want to move these Services from TicketFreeText10 to the new Service-propery of v2.2

Therefore, I generated...

(((a))) a new generic-agent-file&job

package Kernel::Config::GenericAgentServiceInit;

use strict;
use vars qw($VERSION @ISA @EXPORT %Jobs);
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(%Jobs);

$VERSION = '$Revision: 1.9 $';
$VERSION =~ s/^\$.*:\W(.*)\W.+?$/$1/;

# -----------------------------------------------------------------------
# config options
# -----------------------------------------------------------------------
%Jobs = (
  # --
  # [name of job] -> send escalation notifications
  # --
##_
  'ServiceInit' => {
         TicketNumber => '2007*', # only tickets generated in 2007
         TicketFreeKey10 => '*Service*',
      # new ticket properties
      New => {
          Module => 'Kernel::System::GenericAgent::ServiceInit',
      },
  },
);
# -----------------------------------------------------------------------
# end of config options
# -----------------------------------------------------------------------
1;

(((b))) a new generic-agent-module

package Kernel::System::GenericAgent::ServiceInit;

use strict;

use vars qw(@ISA $VERSION);
$VERSION = '$Revision: 1.2 $';
$VERSION =~ s/^\$.*:\W(.*)\W.+?$/$1/;

# --
sub new {
   my $Type = shift;
   my %Param = @_;

   # allocate new hash for object
   my $Self = {};
   bless ($Self, $Type);

   # check needed objects
foreach (qw(DBObject ConfigObject LogObject TicketObject TimeObject)) {
       $Self->{$_} = $Param{$_} || die "Got no $_!";
   }

   # 0=off; 1=on;
   $Self->{Debug} = $Param{Debug} || 0;

   return $Self;
}
# --
sub Run {
   my $Self = shift;
   my %Param = @_;
     # get ticket data
my %Ticket = $Self->{TicketObject}->TicketGet(TicketID => $Param{"TicketID"}, UserID => 1);
     return 1 if ($Ticket{"TicketFreeKey10"} !~ 'Service');
     my $t = $Ticket{"TicketFreeText10"};
   my $s;
     $s = 'Mail' if ($t =~ 'Mail');
   $s = 'FS' if ($t eq 'FS');
   $s = 'PC' if ($t eq 'PC');
   # ...
     $Self->{TicketObject}->TicketServiceSet(
       Service => $s,
       TicketID => $Ticket{"TicketID"},
       #CustomerUserID => $Ticket{"CustomerUserID"},
CustomerUserID must be used as param, so delete "#"!
       UserID => 1,
   ) if ($s);
     return 1;
}
# --
1;

=======

If I execute bin/GenericAgent.pl -c Kernel::Config::GenericAgentServiceInit
I get (here I parsed only the output for 1 ticket)

- Use module (Kernel::System::GenericAgent::ServiceInit) for Ticket (200610208
6000085/2310).
ERROR: OTRS-GenericAgent-80 Perl: 5.8.6 OS: linux Time: Wed Sep 5 15:07:16 2007

Message: Need ServiceID or Name!

Traceback (17914):
  Module: Kernel::System::Service::ServiceLookup (v1.16) Line: 240
  Module: Kernel::System::Ticket::TicketServiceSet (v1.269) Line: 1649
  Module: Kernel::System::GenericAgent::ServiceInit::Run (v1.2) Line: 57
  Module: Kernel::System::GenericAgent::_JobRunTicket (v1.29 ) Line: 636
  Module: Kernel::System::GenericAgent::JobRun (v1.29 ) Line: 383
  Module: /opt/otrst/bin/GenericAgent.pl (v1.41) Line: 199

ERROR: OTRS-GenericAgent-80 Perl: 5.8.6 OS: linux Time: Wed Sep 5 15:07:16 2007

Message: Need ServiceID!

Traceback (17914):
  Module: Kernel::System::Ticket::TicketServiceSet (v1.269) Line: 1655
  Module: Kernel::System::GenericAgent::ServiceInit::Run (v1.2) Line: 57
  Module: Kernel::System::GenericAgent::_JobRunTicket (v1.29 ) Line: 636
  Module: Kernel::System::GenericAgent::JobRun (v1.29 ) Line: 383
  Module: /opt/otrst/bin/GenericAgent.pl (v1.41) Line: 199

Why?
If I use ServiceID instead of Service, CustomerUserID is displayed to be missing. If I also add this, HistroyTypeID is missing, ...
Why?

Bye, Alex

_______________________________________________
OTRS mailing list: otrs - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/otrs
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs
Support or consulting for your OTRS system?
=> http://www.otrs.com/



_______________________________________________
OTRS mailing list: otrs - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/otrs
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs
Support or consulting for your OTRS system?
=> http://www.otrs.com/

Reply via email to