Removed deprecated files
This commit is contained in:
parent
fb2e7c063e
commit
33301cdd8e
@ -1,39 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
# Copyright (C) 2002 Rodolphe Quiedeville
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#
|
||||
# Remember to : export DBI_DSN="dbi:mysql:dbname=dolibarr"
|
||||
#
|
||||
use DBI;
|
||||
|
||||
my $dbh = DBI->connect($ARGV[2]) || die $DBI::errstr ;
|
||||
|
||||
my $sql = 'SELECT sum(amount) FROM llx_don';
|
||||
$sql .= ' WHERE fk_statut in (' .$ARGV[1].') AND fk_don_projet = '.$ARGV[0];
|
||||
|
||||
my $sth = $dbh->prepare("$sql") || die $dbh->errstr ;
|
||||
$sth->execute;
|
||||
|
||||
while (my @row = $sth->fetchrow_array )
|
||||
{
|
||||
print int($row[0]);
|
||||
}
|
||||
|
||||
|
||||
$dbh->disconnect();
|
||||
|
||||
@ -1,45 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
# Copyright (C) 2002 Rodolphe Quiedeville
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# Write a file with the 3 values
|
||||
# Remember to : export DBI_DSN="dbi:mysql:dbname=dolibarr"
|
||||
#
|
||||
# Usage : file-dons.pl PROJECTID FILE_TO_WRITE [DBI_DSN]
|
||||
#
|
||||
use DBI;
|
||||
|
||||
my $dbh = DBI->connect($ARGV[2]) || die $DBI::errstr ;
|
||||
|
||||
my $sql = 'SELECT sum(amount),fk_statut FROM llx_don';
|
||||
$sql .= ' WHERE fk_statut in (1,2,3) AND fk_don_projet = '.$ARGV[0];
|
||||
$sql .= ' GROUP BY fk_statut ASC ;';
|
||||
|
||||
my $sth = $dbh->prepare("$sql") || die $dbh->errstr ;
|
||||
$sth->execute;
|
||||
|
||||
open (FH, ">$ARGV[1]") || die "can't open $ARGV[1]: $!";
|
||||
|
||||
while (my @row = $sth->fetchrow_array )
|
||||
{
|
||||
print FH int($row[0]) . "\n";
|
||||
}
|
||||
|
||||
close (FH);
|
||||
|
||||
$dbh->disconnect();
|
||||
|
||||
@ -1,73 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
#----------------------------------------------------------------------------
|
||||
# Copyright (C) 2003 Jean-Louis BERGAMO <jlb@j1b.org>
|
||||
# Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#---------------------------------------------------------------------------
|
||||
# This script build a file with format
|
||||
# login:password
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
use DBI;
|
||||
use strict;
|
||||
# get the command line option
|
||||
use Getopt::Long;
|
||||
|
||||
# command line option hash table
|
||||
my %optctl=();
|
||||
# get command line options
|
||||
GetOptions(\%optctl,"help!","host=s","db=s","user=s","pass=s","type=s","cotis!","crypt!");
|
||||
if (defined $optctl{'help'}){
|
||||
&usage();
|
||||
}
|
||||
my $host=$optctl{'host'}||'localhost';
|
||||
my $dbname=$optctl{'db'}||&usage();
|
||||
my $user=$optctl{'user'}||&usage();
|
||||
my $pass=$optctl{'pass'}||'';
|
||||
my $type=$optctl{'type'}||'mysql';
|
||||
#my $ml=$optctl{'ml'}||&usage();
|
||||
my @adh=();
|
||||
my @ml_adh=();
|
||||
|
||||
my $dbh = DBI->connect("dbi:$type:dbname=$dbname;host=$host",$user,$pass) || die $DBI::errstr ;
|
||||
|
||||
my $sql = 'SELECT login,pass FROM llx_adherent WHERE statut=1';
|
||||
|
||||
if (defined $optctl{'cotis'}){
|
||||
$sql.=" AND datefin > now()";
|
||||
}
|
||||
|
||||
my $sth = $dbh->prepare("$sql") || die $dbh->errstr ;
|
||||
$sth->execute;
|
||||
|
||||
# get login,pass of each adherents
|
||||
while (my @row = $sth->fetchrow_array ){
|
||||
if (defined $optctl{'crypt'}){
|
||||
print "$row[0]:",crypt($row[1],join '', ('.', '/', 0..9,'A'..'Z', 'a'..'z')[rand 64, rand 64]),"\n";
|
||||
}else{
|
||||
print "$row[0]:$row[1]\n";
|
||||
}
|
||||
}
|
||||
|
||||
$dbh->disconnect();
|
||||
|
||||
sub usage{
|
||||
print "Usage: $0 --db=database --user=user --pass=password [--help] [--host=host] [--cotis] [--crypt]\n";
|
||||
print " --cotis : select only adherents with cotisations up-to-date\n";
|
||||
print " --crypt : password is encrypted\n";
|
||||
print "\n";
|
||||
exit (1);
|
||||
}
|
||||
@ -1,97 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
# Copyright (C) 2003 Jean-Louis BERGAMO <jlb@j1b.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# ce script prend l'intergralite des adherents valide et les mets dans
|
||||
# une mailing-liste. ce script est utilie si l'on souhaite avoir une
|
||||
# mailing-liste avec uniquement les adherents valides.
|
||||
|
||||
use DBI;
|
||||
use strict;
|
||||
# get the command line option
|
||||
use Getopt::Long;
|
||||
|
||||
# command line option hash table
|
||||
my %optctl=();
|
||||
# get command line options
|
||||
GetOptions(\%optctl,"help!","host=s","db=s","user=s","pass=s","ml=s","type=s","cotis!");
|
||||
if (defined $optctl{'help'}){
|
||||
&usage();
|
||||
}
|
||||
my $host=$optctl{'host'}||'localhost';
|
||||
my $dbname=$optctl{'db'}||'dolibarr';
|
||||
my $user=$optctl{'user'}||'dolibarr';
|
||||
my $pass=$optctl{'pass'}||'';
|
||||
my $type=$optctl{'type'}||'mysql';
|
||||
my $ml=$optctl{'ml'}||&usage();
|
||||
my @adh=();
|
||||
my @ml_adh=();
|
||||
|
||||
my $dbh = DBI->connect("dbi:$type:dbname=$dbname;host=$host",$user,$pass) || die $DBI::errstr ;
|
||||
|
||||
my $sql = 'SELECT email FROM llx_adherent WHERE statut=1';
|
||||
|
||||
if (defined $optctl{'cotis'}){
|
||||
$sql.=" AND datefin > now()";
|
||||
}
|
||||
|
||||
my $sth = $dbh->prepare("$sql") || die $dbh->errstr ;
|
||||
$sth->execute;
|
||||
|
||||
# get emails of adherents
|
||||
while (my @row = $sth->fetchrow_array ){
|
||||
# print "$row[0]\n";
|
||||
push (@adh,$row[0]);
|
||||
}
|
||||
|
||||
# get emails of mailing-list suscribers
|
||||
@ml_adh=`/usr/sbin/list_members $ml`;
|
||||
chomp(@ml_adh);
|
||||
#foreach (@ml_adh){
|
||||
# print $_;
|
||||
#}
|
||||
# do the diff
|
||||
foreach my $adh (@adh){
|
||||
if (!grep(/^$adh$/i,@ml_adh)){
|
||||
# user not subscribed
|
||||
print "register $adh : echo $adh | /usr/sbin/add_members -n - $ml\n";
|
||||
if (system("echo $adh | /usr/sbin/add_members -n - $ml")){
|
||||
die "can't execute echo $adh | /usr/sbin/add_members -n - $ml : $!";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# unsubcribe user not adherent
|
||||
foreach my $subs (@ml_adh){
|
||||
if (!grep(/^$subs$/i,@adh)){
|
||||
# unsubscrib user
|
||||
print "unsubscribe $subs : /usr/sbin/remove_members $ml $subs\n";
|
||||
if (system("/usr/sbin/remove_members $ml $subs")){
|
||||
die "can't execute /usr/sbin/remove_members $ml $subs : $!";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$dbh->disconnect();
|
||||
|
||||
sub usage{
|
||||
print "$0 [--help] [--host] [--db] [--user] [--pass] [--cotis] --ml=mailinglist\n";
|
||||
print " ml is for mailing-list. others options are for database\n";
|
||||
print " cotis : select only adherents with cotisations up-to-date\n";
|
||||
print "\n";
|
||||
exit (1);
|
||||
}
|
||||
@ -1,86 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
# Copyright (C) 2003 Jean-Louis BERGAMO <jlb@j1b.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# Ce script va lire les adresse contenu dans le repertoire donne en
|
||||
# argument, et va rajouter ou supprimer ces adresses des listes qu'on
|
||||
# lui a donne en argument (ou qu'il recupere dans la table des
|
||||
# constantes)
|
||||
|
||||
use DBI;
|
||||
use strict;
|
||||
# get the command line option
|
||||
use Getopt::Long;
|
||||
|
||||
# command line option hash table
|
||||
my %optctl=();
|
||||
# get command line options
|
||||
GetOptions(\%optctl,"help!","dir=s");
|
||||
if (defined $optctl{'help'}){
|
||||
&usage();
|
||||
}
|
||||
my $dir=$optctl{'dir'}||&usage();
|
||||
my @lists=();
|
||||
my @emails=();
|
||||
|
||||
opendir(DIR, $dir) || die "can't opendir $dir: $!";
|
||||
@lists=grep { /^[^.]/ && -d "$dir/$_" } readdir(DIR);
|
||||
closedir DIR;
|
||||
print join(',',@lists),"\n";
|
||||
|
||||
foreach my $list (@lists){
|
||||
my $subdir='subscribe';
|
||||
if(opendir(DIR, "$dir/$list/$subdir")){
|
||||
@emails=grep { /^[^.].+\@/ && -f "$dir/$list/$subdir/$_" } readdir(DIR);
|
||||
closedir DIR;
|
||||
}
|
||||
if (@emails){
|
||||
foreach my $mail(@emails){
|
||||
print "register $mail: echo $mail | /usr/sbin/add_members -n - $list\n";
|
||||
if (system("echo $mail | /usr/sbin/add_members -n - $list")){
|
||||
warn "can't execute echo $mail | /usr/sbin/add_members -n - $list : $!\n";
|
||||
}else{
|
||||
unlink("$dir/$list/$subdir/$mail");
|
||||
}
|
||||
}
|
||||
}
|
||||
@emails=();
|
||||
$subdir='unsubscribe';
|
||||
if(opendir(DIR, "$dir/$list/$subdir")){
|
||||
@emails=grep { /^[^.].+\@/ && -f "$dir/$list/$subdir/$_" } readdir(DIR);
|
||||
closedir DIR;
|
||||
}
|
||||
if (@emails){
|
||||
foreach my $mail(@emails){
|
||||
print "unsubscribe $mail : /usr/sbin/remove_members $list $mail\n";
|
||||
if (system("/usr/sbin/remove_members $list $mail")){
|
||||
warn "can't execute /usr/sbin/remove_members $list $mail : $!\n";
|
||||
}else{
|
||||
unlink("$dir/$list/$subdir/$mail");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
exit;
|
||||
|
||||
sub usage{
|
||||
print "$0 [--help] --dir=directory \n";
|
||||
print " directory is the directory where email are stored.";
|
||||
print "";
|
||||
exit (1);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user