ajout script nouvean_membre.php
This commit is contained in:
parent
13768f55e0
commit
2ec3217eae
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
-<?php
|
||||
require_once("session_init.php");
|
||||
require_once("config.inc.php");
|
||||
require_once('fonctions.php');
|
||||
|
@ -12,14 +12,14 @@ while($a = $db->result->fetch_array())
|
|||
$query = "SELECT EXISTS(SELECT 1 FROM llx_socpeople WHERE ref_ext='" . $a['rowid'] . "')";
|
||||
$db_contacts->query($query);
|
||||
$r= $db_contacts->result->fetch_array();
|
||||
|
||||
|
||||
if( $r[0] == 0)
|
||||
{
|
||||
$query = 'INSERT INTO llx_socpeople(datec, entity, civility, lastname, firstname, address, zip, town,fk_departement, fk_pays, phone, phone_perso, phone_mobile, email, fk_user_creat, fk_user_modif, statut, ref_ext)
|
||||
VALUES ("' .
|
||||
$a['datec'] . '", "' .
|
||||
$a['entity'] . '", "' .
|
||||
$a['civility'] . '", "' .
|
||||
VALUES ("' .
|
||||
$a['datec'] . '", "' .
|
||||
$a['entity'] . '", "' .
|
||||
$a['civility'] . '", "' .
|
||||
$a['lastname'] . '", "' .
|
||||
$a['firstname'] . '", "' .
|
||||
$a['address'] . '", "' .
|
||||
|
@ -31,7 +31,7 @@ while($a = $db->result->fetch_array())
|
|||
}else
|
||||
{
|
||||
$query .= '"' . $a['state_id'] . '", ';
|
||||
}
|
||||
}
|
||||
if (empty($a['country']))
|
||||
{
|
||||
$query .= 'NULL, "';
|
||||
|
@ -39,7 +39,7 @@ while($a = $db->result->fetch_array())
|
|||
{
|
||||
$query .= '"' . $a['country'] . '", "';
|
||||
}
|
||||
$query .=
|
||||
$query .=
|
||||
$a['phone'] . '", "' .
|
||||
$a['phone_perso'] . '", "' .
|
||||
$a['phone_mobile'] . '", "' .
|
||||
|
@ -54,15 +54,15 @@ while($a = $db->result->fetch_array())
|
|||
echo $a['login'] . "\t-> ajouté aux contacts\n";
|
||||
}else
|
||||
{
|
||||
$query = 'UPDATE llx_socpeople SET
|
||||
datec="' . $a['datec'] . '",
|
||||
entity="' . $a['entity'] . '",
|
||||
civility="' . $a['civility'] . '",
|
||||
lastname="' . $a['lastname'] . '",
|
||||
firstname="' . $a['firstname'] . '",
|
||||
address="' . $a['address'] . '",
|
||||
zip="' . $a['zip'] . '",
|
||||
town="' . $a['town'] . '",
|
||||
$query = 'UPDATE llx_socpeople SET
|
||||
datec="' . $a['datec'] . '",
|
||||
entity="' . $a['entity'] . '",
|
||||
civility="' . $a['civility'] . '",
|
||||
lastname="' . $a['lastname'] . '",
|
||||
firstname="' . $a['firstname'] . '",
|
||||
address="' . $a['address'] . '",
|
||||
zip="' . $a['zip'] . '",
|
||||
town="' . $a['town'] . '",
|
||||
fk_departement=';
|
||||
if (empty($a['state_id']))
|
||||
{
|
||||
|
@ -70,7 +70,7 @@ while($a = $db->result->fetch_array())
|
|||
}else
|
||||
{
|
||||
$query .= '"' . $a['state_id'] . '", ';
|
||||
}
|
||||
}
|
||||
$query .= 'fk_pays=';
|
||||
if (empty($a['country']))
|
||||
{
|
||||
|
@ -80,19 +80,19 @@ while($a = $db->result->fetch_array())
|
|||
$query .= '"' . $a['country'] . '", ';
|
||||
}
|
||||
$query .= '
|
||||
phone="' . $a['phone'] . '",
|
||||
phone_perso="' . $a['phone_perso'] . '",
|
||||
phone_mobile="' . $a['phone_mobile'] . '",
|
||||
email="' . $a['email'] . '",
|
||||
fk_user_creat="' . $a['fk_user_author'] . '",
|
||||
fk_user_modif="' . $a['fk_user_mod'] . '",
|
||||
statut="' . $a['statut'] . '"
|
||||
phone="' . $a['phone'] . '",
|
||||
phone_perso="' . $a['phone_perso'] . '",
|
||||
phone_mobile="' . $a['phone_mobile'] . '",
|
||||
email="' . $a['email'] . '",
|
||||
fk_user_creat="' . $a['fk_user_author'] . '",
|
||||
fk_user_modif="' . $a['fk_user_mod'] . '",
|
||||
statut="' . $a['statut'] . '"
|
||||
WHERE ref_ext="' . $a['rowid'] . '"';
|
||||
//echo $query . "<br>\n";
|
||||
$db_contacts->query($query);
|
||||
//echo $a['login'] . "\t-> existe déja dans les contacts\n";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -53,8 +53,10 @@ function date_reservation( $date, $heure )
|
|||
}
|
||||
|
||||
$date_time["debut"] = DateTime::createFromFormat("Y-m-d H:i:s", $date_time["mysql"]);
|
||||
$jour_semaine = date( "w", $date_time["debut"]);
|
||||
$heure = date("H", $date_time["debut"]);
|
||||
print_r($date_time[debut]);
|
||||
$jour_semaine = $date_time["debut"]->format("w");
|
||||
$heure = $date_time["debut"]->format("H");
|
||||
echo $heure . " jour : " . $jour_semaine . "\n";
|
||||
switch ($heure)
|
||||
{
|
||||
case 10:
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
|
||||
require_once "session_init.php";
|
||||
require_once "config.inc.php";
|
||||
require_once "log.php";
|
||||
require_once "db.class.php";
|
||||
include_once "entete_dolibarr.php";
|
||||
|
||||
// ajout du membre dans nextcloud
|
||||
|
||||
$data = array("displayname"=>array("value"=>"","scope"=>"contacts","verified"=>"0"), "address"=>array("value"=>"[adresse]", "scope"=>"private", "verified"=>"0"), "website"=>array("value"=>"", "scope"=>"private","verified"=>"0"), "email"=>array("value"=>"", "scope"=>"contacts","verified"=>"1") ,"avatar"=>array("scope"=>"contacts", "verified"=>"0"), "phone"=>array("value"=>"", "scope"=>"private","verified"=>"0"), "twitter"=>array("value"=>"", "scope"=>"private", "verified"=>"0"));
|
||||
|
||||
$doldb = new db("dolibarr");
|
||||
$ncdb = new db("nextcloud");
|
||||
if ( empty($user["phone_mobile"]) )
|
||||
{
|
||||
$data["phone"]["value"] = $user["phone_perso"];
|
||||
}else
|
||||
{
|
||||
$data["phone"]["value"] = $user["phone_mobile"];
|
||||
}
|
||||
|
||||
$data["displayname"]["value"] = addslashes(concat(utf8_encode($user["firstname"]), utf8_encode($user["lastname"])));
|
||||
$address = concat(utf8_encode($user['address']), $user["zip"]);
|
||||
$data["address"]["value"] = (concat ($address, utf8_encode($user["town"])));
|
||||
$data["email"]["value"] = "'" . $user["email"] . "'";
|
||||
//print_r($data);
|
||||
if ( ($account_data = json_encode($data)) == false )
|
||||
{
|
||||
echo json_last_error() . EOL;
|
||||
exit (0);
|
||||
}
|
||||
|
||||
$oc_account_query = 'INSERT INTO oc_accounts (uid, data) VALUES ("' . $user["login"] . '","' . addslashes($account_data) .'")';
|
||||
$oc_users_query = 'INSERT INTO oc_users (uid, displayname, password, uid_lower) VALUES ("' . $user["login"] . '","' . $user["firstname"] . ' ' . $user["lastname"] . '","1|' . $user["pass_crypted"] . '","' . strtolower($user["login"]) . '")';
|
||||
|
||||
if ($user["fk_adherent_type"] == 2)
|
||||
{
|
||||
$gid="membres";
|
||||
}else if ($user["fk_adherent_type"] == 3)
|
||||
{
|
||||
$gid="contributeurs";
|
||||
}
|
||||
|
||||
$oc_group_user_query = "INSERT INTO oc_group_user(uid, gid) VALUES ('" . $user["login"] . "','" . $gid . "')";
|
||||
|
||||
$oc_preferences_query_quota = "INSERT INTO oc_preferences(userid, appid, configkey, configvalue) VALUES ('" . $user["login"] . "', 'files', 'quota', '10 GB')";
|
||||
$oc_preferences_query_email = "INSERT INTO oc_preferences(userid, appid, configkey, configvalue) VALUES ('" . $user["login"] . "', 'settings', 'email', '" . $user["email"] . "')";
|
||||
//echo $account_data . EOL . $oc_account_query . EOL . $oc_users_query .EOL . $oc_group_user_query . EOL . $oc_preferences_query_quota . EOL . $oc_preferences_query_email . EOL;
|
||||
|
||||
$ncdb->query($oc_account_query);
|
||||
$ncdb->query($oc_users_query);
|
||||
$ncdb->query($oc_group_user_query);
|
||||
$ncdb->query($oc_preferences_query_quota);
|
||||
$ncdb->query($oc_preferences_query_email);
|
||||
|
||||
$ncdb->close();
|
||||
$doldb->close();
|
||||
llxFooter();
|
||||
|
||||
// ajout du membre aux contacts
|
||||
|
|
@ -90,7 +90,7 @@ recap();
|
|||
// Draft MyObject
|
||||
if (! empty($conf->outilslalis->enabled) && $user->rights->outilslalis->read)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
END MODULEBUILDER DRAFT MYOBJECT */
|
||||
|
||||
|
|
Reference in New Issue