127 lines
3.9 KiB
Perl
Executable File
127 lines
3.9 KiB
Perl
Executable File
#!/usr/bin/perl
|
|
|
|
use CGI;
|
|
use POSIX qw(strftime);
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# List of full names
|
|
# -----------------------------------------------------------------------------
|
|
|
|
my %names = (
|
|
"coughlan" => "Shane Coughlan",
|
|
"greve" => "Georg Greve",
|
|
"harmuth" => "Stefan Harmuth",
|
|
"jensch" => "Thomas Jensch",
|
|
"kersten" => "Rainer Kersten",
|
|
"kirschner" => "Matthias Kirschner",
|
|
"machon" => "Pablo Machón",
|
|
"mueller" => "Reinhard Müller",
|
|
"oberg" => "Jonas Öberg",
|
|
"ohnewein" => "Patrick Ohnewein",
|
|
"oriordan" => "Ciarán O'Riordan",
|
|
"reiter" => "Bernhard Reiter",
|
|
"sandklef" => "Henrik Sandklef",
|
|
"morant" => "Benjamin Morant",
|
|
"west" => "Graeme West",
|
|
);
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# List of people responsible for the projects
|
|
# -----------------------------------------------------------------------------
|
|
|
|
my %responsible = (
|
|
"ADMIN-DUS" => "council",
|
|
"ADMIN-TECH" => "council",
|
|
"ADMIN-GA" => "council",
|
|
"PA-MATERIAL" => "council",
|
|
"PA-TRAVEL" => "council",
|
|
"PA-GNUVOX" => "ohnewein",
|
|
"FELLOWSHIP-MATERIAL" => "kirschner",
|
|
"FELLOWSHIP-CONF" => "kirschner",
|
|
"FELLOWSHIP-LOCAL" => "kirschner",
|
|
"FTF-ZRH" => "coughlan",
|
|
"FTF-TRAVEL" => "coughlan",
|
|
"FTF-CONF" => "coughlan",
|
|
"FTF-TRANS" => "coughlan",
|
|
"FTF-ECONOMIC" => "coughlan",
|
|
"POLICY-TRAVEL" => "greve",
|
|
"MERCHANDISE" => "council",
|
|
);
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Get parameters
|
|
# -----------------------------------------------------------------------------
|
|
|
|
my $query = new CGI;
|
|
|
|
my $who = $query->param("who");
|
|
my $what = $query->param("what");
|
|
my $when = $query->param("when");
|
|
my $why = $query->param("why");
|
|
my $estimate = $query->param("estimate");
|
|
my $budget = $query->param("budget");
|
|
my $refund = $query->param("refund");
|
|
|
|
my $date = strftime "%Y-%m-%d", localtime;
|
|
my $time = strftime "%s", localtime;
|
|
my $reference = "$who.$date." . substr $time, -3;
|
|
|
|
my $to = $responsible{$budget};
|
|
# if ($to eq $who) {
|
|
# $to = "council";
|
|
# }
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Generate mail to responsible person
|
|
# -----------------------------------------------------------------------------
|
|
|
|
my $boundary = "NextPart$reference";
|
|
|
|
my $replyto = "dus\@office.fsfeurope.org, $who\@fsfeurope.org, $to\@fsfeurope.org";
|
|
if ($to ne "council") {
|
|
$replyto .= ", council\@fsfeurope.org";
|
|
}
|
|
|
|
open(MAIL, "|/usr/lib/sendmail -t -f $to\@fsfeurope.org");
|
|
print MAIL "From: $who\@fsfeurope.org\n";
|
|
print MAIL "Reply-To: $replyto\n";
|
|
print MAIL "Mail-Followup-To: $replyto\n";
|
|
print MAIL "To: $to\@fsfeurope.org\n";
|
|
print MAIL "Subject: Expense Request\n";
|
|
print MAIL "Mime-Version: 1.0\n";
|
|
print MAIL "Content-Type: multipart/mixed; boundary=$boundary\n";
|
|
print MAIL "Content-Transfer-Encoding: 8bit\n\n\n";
|
|
|
|
print MAIL "--$boundary\n";
|
|
print MAIL "Content-Type: text/plain; charset=utf-8\n";
|
|
print MAIL "Content-Transfer-Encoding: 8bit\n\n";
|
|
|
|
print MAIL "This expense request was sent via web interface\n\n";
|
|
|
|
print MAIL "--$boundary\n";
|
|
print MAIL "Content-Type: text/plain; charset=utf-8\n";
|
|
print MAIL "Content-Disposition: attachment; filename=$reference.txt\n";
|
|
print MAIL "Content-Description: Expense Request\n";
|
|
print MAIL "Content-Transfer-Encoding: 8bit\n\n";
|
|
|
|
print MAIL "WHO: $names{$who}\n\n";
|
|
print MAIL "WHAT: $what\n\n";
|
|
print MAIL "WHEN: $when\n\n";
|
|
print MAIL "WHY: $why\n\n";
|
|
print MAIL "ESTIMATE: $estimate\n\n";
|
|
print MAIL "BUDGET: $budget\n\n";
|
|
print MAIL "REFUND CONTACT: $refund\n\n";
|
|
print MAIL "AUTHORISED:\n\n";
|
|
print MAIL "BY:\n\n";
|
|
|
|
print MAIL "--$boundary--\n";
|
|
|
|
close MAIL;
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Inform user that everything was ok
|
|
# -----------------------------------------------------------------------------
|
|
|
|
print "Content-type: text/html\n\n";
|
|
print "Your request was sent. Thank you.";
|