Archived
1
0

Fix arguments order in subject hook

This commit is contained in:
Mercier Pierre-Olivier 2013-09-12 15:35:30 +02:00
parent 8fdb420f85
commit ca5d061fce

View File

@ -89,27 +89,32 @@ sub tag_project
{
my $creation = shift;
# From here, we have:
# 1: "project"
# 2: $id
# 3: $year
my $project_id = repository_name();
if ($_[1]) {
if ($_[2]) {
# Check on ID/flavour_id
if ($_[1] =~ /^\d+$/) {
if ($_[2] =~ /^\d+$/) {
log ERROR, "project:* tag can't take version. Tag format: project:id:year";
}
$project_id .= "-" . $_[1];
$project_id .= "-" . $_[2];
}
$project_id = lc $project_id;
$project_id =~ s/[^a-z0-9-_]/_/g;
my $year;
if ($_[2]) {
if ($_[3]) {
# Check on year
if ($_[2] !~ /^\d+$/) {
if ($_[3] !~ /^\d+$/) {
log ERROR, "project:*:* second argument is the year. Tag format: project:id:year";
}
$year = $_[2];
$year = $_[3];
}
else {
$year = LDAP::get_year;
@ -142,12 +147,10 @@ sub tag_project
if (Process::Client::launch("intradata_get", { action => "update", type => "project", id => $project_id, "year" => $year }, { "butler.xml" => $content }));
# Call API
my $err = API::Projects::add($project_id, $year);
log ERROR, $err if ($err);
log ERROR, $_ if(API::Projects::add($project_id, $year));
# FIXME: Remove next line after 2016 piscine: ça ne devrait pas être fait à ce moment là
$err = API::Projects::gen_groups($project_id, $year);
log ERROR, $err if ($err);
log ERROR, $_ if(API::Projects::gen_groups($project_id, $year));
}
else
{