Fix: minor bugs
Qual: Remove deprecated file
This commit is contained in:
parent
9a601dd546
commit
9f01a861dd
@ -1,122 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
#
|
|
||||||
# Glasnost
|
|
||||||
# By: Odile Bénassy <obenassy@entrouvert.com>
|
|
||||||
# Thierry Dulieu <tdulieu@easter-eggs.com>
|
|
||||||
# Frédéric Péters <fpeters@theridion.com>
|
|
||||||
# Benjamin Poussin <poussin@codelutin.com>
|
|
||||||
# Emmanuel Raviart <eraviart@entrouvert.com>
|
|
||||||
# Emmanuel Saracco <esaracco@easter-eggs.com>
|
|
||||||
#
|
|
||||||
# Copyright (C) 2000, 2001 Easter-eggs & Emmanuel Raviart
|
|
||||||
# Copyright (C) 2002 Odile Bénassy, Code Lutin, Thierry Dulieu, Easter-eggs,
|
|
||||||
# Entr'ouvert, Frédéric Péters, Benjamin Poussin, Emmanuel Raviart,
|
|
||||||
# Emmanuel Saracco & Théridion
|
|
||||||
# Copyright (C) 2003 Odile Bénassy, Code Lutin, Thierry Dulieu, Easter-eggs,
|
|
||||||
# Entr'ouvert, Ouvaton, Frédéric Péters, Benjamin Poussin, Rodolphe
|
|
||||||
# Quiédeville, Emmanuel Raviart, Emmanuel Saracco, Théridion & Vecam
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
|
|
||||||
__doc__ = """Sample showing how to handle people with XML-RPC"""
|
|
||||||
|
|
||||||
__version__ = '$Revision$'[11:-2]
|
|
||||||
|
|
||||||
|
|
||||||
import xmlrpclib # Requires Python >= 2.2.
|
|
||||||
|
|
||||||
|
|
||||||
# Every calls to a Glasnost server is handled by a Glasnost XML-RPC gateway.
|
|
||||||
glasnostServerName = 'localhost' ### YOU MAY NEED TO CHANGE THIS!!!
|
|
||||||
glasnostGatewayPort = 8001
|
|
||||||
|
|
||||||
# The login & password of a Glasnost user who has the rights to add people to
|
|
||||||
# the server.
|
|
||||||
login = 'login' ### CHANGE THIS!!!
|
|
||||||
password = 'password' ### CHANGE THIS!!!
|
|
||||||
|
|
||||||
# Each Glasnost server is uniquely identified by its server id.
|
|
||||||
authenticationServerId = 'glasnost://%s/authentication' % glasnostServerName
|
|
||||||
peopleServerId = 'glasnost://%s/people' % glasnostServerName
|
|
||||||
|
|
||||||
# This sample application doesn't need an application token.
|
|
||||||
applicationToken = ''
|
|
||||||
|
|
||||||
# First, establish a connection to the gateway.
|
|
||||||
gateway = xmlrpclib.ServerProxy('http://%s:%d' % (
|
|
||||||
glasnostServerName, glasnostGatewayPort))
|
|
||||||
|
|
||||||
# Call the authentication server to give him your login & password and to
|
|
||||||
# receive a user id and token.
|
|
||||||
userId, userToken = gateway.callGateway(
|
|
||||||
authenticationServerId,
|
|
||||||
'getUserIdAndToken',
|
|
||||||
[authenticationServerId, applicationToken, login, password])
|
|
||||||
print 'Login = %s' % login
|
|
||||||
print 'User ID = %s' % userId
|
|
||||||
print 'User Token = %s' % userToken
|
|
||||||
|
|
||||||
# Create a new person.
|
|
||||||
# Note: The attributes of people are described in shared/common/PeopleCommon.py
|
|
||||||
person = {
|
|
||||||
# Don't touch the next two lines.
|
|
||||||
'__thingCategory__': 'object',
|
|
||||||
'__thingName__': 'Person',
|
|
||||||
|
|
||||||
'firstName': 'John',
|
|
||||||
'lastName': 'Doe',
|
|
||||||
'login': 'jdoe',
|
|
||||||
'email': 'root@localhost', ### CHANGE THIS!!!
|
|
||||||
}
|
|
||||||
|
|
||||||
# Call the method addObject of the people server.
|
|
||||||
# Note: The available functions of the people server are defined in the class
|
|
||||||
# PeopleServer, which is defined in servers/PeopleServer/PeopleServer.py.
|
|
||||||
# The class PeopleServer inherits from the class ObjectsServer, which is
|
|
||||||
# defined in shared/server/ObjectsServer.py
|
|
||||||
personId = gateway.callGateway(
|
|
||||||
peopleServerId,
|
|
||||||
'addObject' ,
|
|
||||||
[peopleServerId, applicationToken, userToken, person])
|
|
||||||
print 'Person created with id = %s' % personId
|
|
||||||
|
|
||||||
# Give a person id and get its infos.
|
|
||||||
person = gateway.callGateway(
|
|
||||||
peopleServerId,
|
|
||||||
'getObject' ,
|
|
||||||
[peopleServerId, applicationToken, userToken, personId])
|
|
||||||
print 'Got a new person = %s' % person
|
|
||||||
|
|
||||||
# Change the nickname of that person.
|
|
||||||
person['nickname'] = 'jd'
|
|
||||||
gateway.callGateway(
|
|
||||||
peopleServerId,
|
|
||||||
'modifyObject' ,
|
|
||||||
[peopleServerId, applicationToken, userToken, person])
|
|
||||||
|
|
||||||
# Get the new infos of the person.
|
|
||||||
person = gateway.callGateway(
|
|
||||||
peopleServerId,
|
|
||||||
'getObject' ,
|
|
||||||
[peopleServerId, applicationToken, userToken, personId])
|
|
||||||
print 'Got a modified person = %s' % person
|
|
||||||
|
|
||||||
# Remove the person.
|
|
||||||
gateway.callGateway(
|
|
||||||
peopleServerId,
|
|
||||||
'deleteObject' ,
|
|
||||||
[peopleServerId, applicationToken, userToken, personId])
|
|
||||||
print 'Person deleted'
|
|
||||||
@ -18,10 +18,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file scripts/adherents/sync_member_dolibarr2ldap.php
|
* \file scripts/adherents/sync_member_dolibarr2ldap.php
|
||||||
\ingroup ldap adherent
|
* \ingroup ldap adherent
|
||||||
\brief Script de mise a jour des adherents dans LDAP depuis base Dolibarr
|
* \brief Script de mise a jour des adherents dans LDAP depuis base Dolibarr
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Test si mode batch
|
// Test si mode batch
|
||||||
$sapi_type = php_sapi_name();
|
$sapi_type = php_sapi_name();
|
||||||
@ -63,6 +63,7 @@ print "type=".$conf->db->type."\n";
|
|||||||
print "host=".$conf->db->host."\n";
|
print "host=".$conf->db->host."\n";
|
||||||
print "port=".$conf->db->port."\n";
|
print "port=".$conf->db->port."\n";
|
||||||
print "login=".$conf->db->user."\n";
|
print "login=".$conf->db->user."\n";
|
||||||
|
//print "pass=".eregi_replace('.','*',$conf->db->password)."\n"; // Not defined for security reasons
|
||||||
print "database=".$conf->db->name."\n";
|
print "database=".$conf->db->name."\n";
|
||||||
print "\n";
|
print "\n";
|
||||||
print "----- To LDAP database:\n";
|
print "----- To LDAP database:\n";
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?PHP
|
<?PHP
|
||||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -20,10 +20,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file scripts/adherents/sync_member_ldap2dolibarr.php
|
* \file scripts/adherents/sync_member_ldap2dolibarr.php
|
||||||
\ingroup ldap adherent
|
* \ingroup ldap adherent
|
||||||
\brief Script de mise a jour des adherents dans Dolibarr depuis LDAP
|
* \brief Script de mise a jour des adherents dans Dolibarr depuis LDAP
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Test si mode batch
|
// Test si mode batch
|
||||||
$sapi_type = php_sapi_name();
|
$sapi_type = php_sapi_name();
|
||||||
@ -40,6 +40,7 @@ $version='$Revision$';
|
|||||||
$path=eregi_replace($script_file,'',$_SERVER["PHP_SELF"]);
|
$path=eregi_replace($script_file,'',$_SERVER["PHP_SELF"]);
|
||||||
@set_time_limit(0);
|
@set_time_limit(0);
|
||||||
$error=0;
|
$error=0;
|
||||||
|
$forcecommit=1;
|
||||||
|
|
||||||
|
|
||||||
require_once($path."../../htdocs/master.inc.php");
|
require_once($path."../../htdocs/master.inc.php");
|
||||||
@ -175,7 +176,7 @@ if ($result >= 0)
|
|||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
// Warning $ldapuser a une cl<63> en minuscule
|
// Warning $ldapuser has a key in lowercase
|
||||||
foreach ($ldaprecords as $key => $ldapuser)
|
foreach ($ldaprecords as $key => $ldapuser)
|
||||||
{
|
{
|
||||||
$member = new Adherent($db);
|
$member = new Adherent($db);
|
||||||
@ -221,9 +222,9 @@ if ($result >= 0)
|
|||||||
$member->typeid=$typeid;
|
$member->typeid=$typeid;
|
||||||
|
|
||||||
// Creation membre
|
// Creation membre
|
||||||
print $langs->trans("MemberCreate").' # '.$key.': fullname='.$member->fullname;
|
print $langs->transnoentities("MemberCreate").' # '.$key.': login='.$member->login.', fullname='.$member->fullname;
|
||||||
print ', datec='.$member->datec;
|
print ', datec='.$member->datec;
|
||||||
$member_id=$member->create();
|
$member_id=$member->create($user);
|
||||||
if ($member_id > 0)
|
if ($member_id > 0)
|
||||||
{
|
{
|
||||||
print ' --> Created member id='.$member_id.' login='.$member->login;
|
print ' --> Created member id='.$member_id.' login='.$member->login;
|
||||||
@ -265,7 +266,7 @@ if ($result >= 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Insertion premi<6D>re adh<64>sion
|
// Insert first subscription
|
||||||
if ($datefirst)
|
if ($datefirst)
|
||||||
{
|
{
|
||||||
// Cree premiere cotisation et met a jour datefin dans adherent
|
// Cree premiere cotisation et met a jour datefin dans adherent
|
||||||
@ -273,7 +274,7 @@ if ($result >= 0)
|
|||||||
$crowid=$member->cotisation($datefirst, $pricefirst, 0);
|
$crowid=$member->cotisation($datefirst, $pricefirst, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insertion derni<6E>re adh<64>sion
|
// Insert last subscription
|
||||||
if ($datelast)
|
if ($datelast)
|
||||||
{
|
{
|
||||||
// Cree derniere cotisation et met a jour datefin dans adherent
|
// Cree derniere cotisation et met a jour datefin dans adherent
|
||||||
@ -283,9 +284,10 @@ if ($result >= 0)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error || $forcecommit)
|
||||||
{
|
{
|
||||||
print $langs->transnoentities("NoErrorCommitIsDone")."\n";
|
if (! $error) print $langs->transnoentities("NoErrorCommitIsDone")."\n";
|
||||||
|
else print $langs->transnoentities("ErrorButCommitIsDone")."\n";
|
||||||
$db->commit();
|
$db->commit();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user