I found a reference from Luis Fernando to do this.
The original sent reminders to the user who put the event in the calendar.
This one also puts in a ticket via email.
This is my altered version.  I am using cron to run this daily.
[EMAIL PROTECTED] is added as it is the email address of my ticket system.

-----------------------------
#!/usr/bin/perl

use DBI;
########## START CONFIG ##########
#maybe the MySQL information could be read from Kernel/Config.pm, but I don't 
know how to do it
$mysqluser = 'aaa';
$mysqlpass = 'bbb';
$mysqldb = 'otrs';
$mailprog = "/usr/sbin/sendmail";
########### END CONFIG ###########

$time=time();
$dia=(localtime($time))[3];
$mes=(localtime($time))[4]+1;
$ano=(localtime($time))[5]+1900;
$db_handle = DBI->connect("dbi:mysql:database=$mysqldb;host=localhost:port 
number;user=$mysqluser;password=$mysqlpass") or die 
"Couldn't connect to database: $DBI::errstr\n";
$sql = "SELECT ce.start_time,up.preferences_value,ce.title,ce.content FROM 
calendar_event ce, calendar_event_involved cei, 
user_preferences up WHERE ce.id=cei.event_id AND cei.user_id=up.user_id AND 
up.preferences_key LIKE 'UserEmail'";
$statement = $db_handle->prepare($sql) or die "Couldn't prepare query '$sql': 
$DBI::errstr\n";
$statement->execute() or die "Couldn't execute query '$sql': $DBI::errstr\n";
$reminders=0;

while (@Row = $statement->fetchrow()) {
        if ((substr($Row[0], 0, 4) == $ano) && (substr($Row[0], 5, 2) == $mes) 
&& (substr($Row[0], 8, 2) == $dia)) {
                $reminders++;

                $subject= "$Row[2]";
                $body = "Reminder for $Row[0]\n\n";
                #$body .= "Title: $Row[2]\n\n";
                $body .= "$Row[3]";

                open(MAIL,"|$mailprog -t") || die("Error opening $mailprog");
                print MAIL "X-OTRS-CustomerUser: $Row[1]\n";
                print MAIL "X-OTRS-Loop: True\n";
                print MAIL "From: $Row[1]\n";
                print MAIL "To: $Row[1],[EMAIL PROTECTED]";
                print MAIL "Subject: $subject\n\n";
                print MAIL "$body\n";
                close(MAIL);
        }
}
-----------------------------

-- 
-- 
Steven

http://www.glimasoutheast.org



"Alexander Scholler" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> Hi Steven,
>
> Steven schrieb:
>> Can I use the Calendar to create tickets in the future?
>>
>> I see this as a nice feature, because I can schedule PMs or Lease returns 
>> etc. with it.
>>
>> I think this would be cleaner than having a bunch of open tickets that 
>> should not be worked on for 6 months.
>
> You could generate a new state-type (within the DB) e.g. "longtime-pendings" 
> and 2 new states (within webgui) e.g. "PM" and 
> "Lease" of state-type "lingtime-pendings".
>
> This long-time-tickets can be set to one of these states.
> Tickets of these states are not shown within the queues (This can be 
> configured - but you don't want to see these pending 
> tickets. ), but can be found with searching them.
>
> You then have to configure the whole system in a way, that overtime tickets 
> of a state-type "longtime-pendings" get an automatic 
> state-change to e.g. "open". Thus, the ticket pops up again within the 
> queue-view.
>
>>
>> I guess another option would be a separate database that stores and send 
>> email tickets when scheduled.
>
> No good idea in my opinion.
>>
>> Is this possible, or has anyone else used something to accomplish this?
>
> 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 orr 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 orr consulting for your OTRS system?
=> http://www.otrs.com/

Reply via email to