New command to send bonus and malus
This commit is contained in:
parent
9fe8a83c2e
commit
664617171e
48
commands/grades/send_bonusmalus.pl
Normal file
48
commands/grades/send_bonusmalus.pl
Normal file
@ -0,0 +1,48 @@
|
||||
#! /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 ...]";
|
||||
}
|
Reference in New Issue
Block a user