48 lines
868 B
Perl
48 lines
868 B
Perl
#! /usr/bin/env perl
|
|
|
|
use v5.10.1;
|
|
use strict;
|
|
use warnings;
|
|
use File::Basename;
|
|
|
|
use lib "../../";
|
|
|
|
use ACU::LDAP;
|
|
use ACU::Process;
|
|
|
|
|
|
if ($#ARGV >= 1)
|
|
{
|
|
my $project_id = shift;
|
|
my $year = shift;
|
|
|
|
if ($year !~ /^[0-9]{4}$/)
|
|
{
|
|
unshift $year;
|
|
$year = LDAP::get_year();
|
|
}
|
|
|
|
my %files;
|
|
for my $f (@_)
|
|
{
|
|
open my $input, "<", $f or die("$f: $@");
|
|
|
|
my $cnt;
|
|
$cnt .= $_ while (<$input>);
|
|
|
|
close $input unless $input eq *STDIN;
|
|
|
|
$file{ basename($f, ".txt", ".lst", ".list", ".xml") } = $cnt;
|
|
}
|
|
|
|
if (my $err = Process::Client::launch("intradata_get", { action => "new_bonus", type => "grades", id => $project_id, "year" => $year }, \%files))
|
|
{
|
|
if (${ $err } ne "Ok") {
|
|
log ERROR, "Erreur durant le processus de publication : " . ${ $err };
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
say "$0 <project_id> [project_year] <file> [files ...]";
|
|
}
|