Archived
1
0
Fork 0
This repository has been archived on 2021-10-08. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
ACU/commands/grades/send_bonusmalus.pl
2013-10-02 19:45:48 +02:00

50 lines
965 B
Perl

#! /usr/bin/env perl
use v5.10.1;
use strict;
use warnings;
use File::Basename;
use lib "../../";
use ACU::LDAP;
use ACU::Log;
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;
$files{ 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 [-d] <project_id> [project_year] <file> [files ...]";
say "\t-d: delete bonus for listed logins (matching value if given)"
}