This commit is contained in:
David Drapeau 2019-10-08 09:52:23 +02:00
parent d0b01a8f0f
commit ebf4ad4924
14 changed files with 2 additions and 579 deletions

View File

@ -1,12 +1,5 @@
<?php <?php
//require_once('./custom/modules/InterfaceForeignDB.php');
//require_once('./custom/modules/ClassForeignDB.php');
//require_once('./custom/modules/ClassDMKPI.php');
require_once('./custom/modules/ClassUserCustom.php'); require_once('./custom/modules/ClassUserCustom.php');
require_once('./custom/modules/ClassERP.php'); require_once('./custom/modules/ClassERP.php');
require_once('./custom/modules/ClassGlobsiClients.php');
require_once('./custom/modules/ClassGlobsiISP.php');
require_once('./custom/modules/ClassGlobsiProvider.php');
require_once('./custom/modules/ClassXMLRPC.php'); require_once('./custom/modules/ClassXMLRPC.php');
require_once('./custom/modules/ClassPlay.php');
require_once('./custom/modules/ripcord.php'); require_once('./custom/modules/ripcord.php');

View File

@ -1,127 +0,0 @@
<?php
class ClassGlobsiClients extends ClassConfig {
public function __construct(){}
public function __destruct(){}
public function getConfig(){
$oPDOLink = ClassConfig::databaseConnect();
$rowsConfig = array();
$sql="
SELECT *
FROM globsi_clients_config
WHERE is_active=TRUE
";
$execSQL = $oPDOLink->prepare($sql);
$execSQL->execute(array());
$rows = $execSQL->fetchAll(PDO::FETCH_ASSOC);
foreach($rows as $k=>$v){
$erpConfig[$rows[$k]['k']] = $rows[$k]['v'];
}
return $erpConfig;
}
public function createClient($data, $ext_id){
$this->_data = $data;
$this->_extId = $ext_id;
$config = ClassConfig::getConfig();
$oPDOLink = ClassConfig::foreignDatabaseConnect($_SESSION['globsi_clients']['db_server'], $_SESSION['globsi_clients']['db_name'], $_SESSION['globsi_clients']['db_user'], $_SESSION['globsi_clients']['db_password']);
//IF password and confirmPassword are not identical, displaying an error message
if($this->_data['formCreateClientFieldPassword'] != $this->_data['formCreateClientFieldConfirmPassword']){
$message['state']='failed';
$message['css_class']='failed';
$message['translation_code'] = 'checkRegisterForm_notSamePassword';
return $message;
}
else {
$activation_code = rand();
$sql="
INSERT INTO user_user(email, password, activation_code, firstname, lastname,
core_lang_id, core_country_id, core_currency_id, core_theme_id,
is_active, comment
)VALUES(
:email, :password, :activation_code,
:firstname, :lastname,
12, 44, 4, 1,
true, 'user created during installation process')
";
$execSQL = $oPDOLink->prepare($sql);
if($execSQL->execute(array(
':email'=>$this->_data['formCreateClientFieldEmail'],
':password'=>sha1($this->_data['formCreateClientFieldPassword'].'-k3P[8x&'),
':activation_code'=>$activation_code,
':firstname'=>$this->_data['formCreateClientFieldFirstname'],
':lastname'=>$this->_data['formCreateClientFieldLastname']
))){
$newUserId = $oPDOLink->lastInsertId('user_user_id_seq');
//$isVipOfferActive = $this->_checkIfVipOfferActive();
//$isEverythingForFreeActive = $this->_checkIfEverythingForFreeActive();
// core user detail
$sql="
INSERT INTO user_detail(user_id, ext_id)
VALUES (:user_id, :ext_id)
";
$execSQL = $oPDOLink->prepare($sql);
$execSQL->execute(array(':user_id'=>$newUserId, ':ext_id'=>$this->_extId));
// features for user
$sql="
INSERT INTO useruser_corefeature_rel(user_id, core_feature_id)
VALUES (
(SELECT id FROM user_user WHERE email=:email LIMIT 1),
(SELECT id FROM core_feature WHERE code=:core_feature_code LIMIT 1)
);
";
$execSQL = $oPDOLink->prepare($sql);
$execSQL->execute(array(':email'=>$this->_data['formCreateClientFieldEmail'], ':core_feature_code'=>'home'));
$execSQL->execute(array(':email'=>$this->_data['formCreateClientFieldEmail'], ':core_feature_code'=>'list-tasks'));
$execSQL->execute(array(':email'=>$this->_data['formCreateClientFieldEmail'], ':core_feature_code'=>'edit-task'));
$execSQL->execute(array(':email'=>$this->_data['formCreateClientFieldEmail'], ':core_feature_code'=>'create-task'));
$execSQL->execute(array(':email'=>$this->_data['formCreateClientFieldEmail'], ':core_feature_code'=>'list-partners'));
$execSQL->execute(array(':email'=>$this->_data['formCreateClientFieldEmail'], ':core_feature_code'=>'edit-partner'));
$execSQL->execute(array(':email'=>$this->_data['formCreateClientFieldEmail'], ':core_feature_code'=>'create-partner'));
$execSQL->execute(array(':email'=>$this->_data['formCreateClientFieldEmail'], ':core_feature_code'=>'list-projects'));
$execSQL->execute(array(':email'=>$this->_data['formCreateClientFieldEmail'], ':core_feature_code'=>'edit-project'));
$execSQL->execute(array(':email'=>$this->_data['formCreateClientFieldEmail'], ':core_feature_code'=>'create-project'));
$execSQL->execute(array(':email'=>$this->_data['formCreateClientFieldEmail'], ':core_feature_code'=>'my-profile'));
$execSQL->execute(array(':email'=>$this->_data['formCreateClientFieldEmail'], ':core_feature_code'=>'logout'));
$message['user_id'] = $newUserId;
$message['activation_code'] = $activation_code;
$message['status'] = "green";
$message['content'] = 'User created with success';
//TODO change confirmation_registration by register_form_success when registrations will need an activation by clic on link in an email
//$message['translation_code'] = 'register_form_success'; //'confirmation_registration';
//TODO send an email to admin to indicate that there is a new registration
return $message;
} else {
$message['status']='red';
$message['content'] = 'User has not been created';
//$message['translation_code'] = 'register_form_failed';
return $message;
}
}
}
public function getClient($user_id){
$this->_userId = $user_id;
$config = ClassConfig::getConfig();
$oPDOLink = ClassConfig::foreignDatabaseConnect($_SESSION['globsi_clients']['db_server'], $_SESSION['globsi_clients']['db_name'], $_SESSION['globsi_clients']['db_user'], $_SESSION['globsi_clients']['db_password']);
$sql="
SELECT ud.ext_id, uu.*
FROM user_user uu
LEFT JOIN user_detail ud
ON uu.id=ud.user_id
WHERE uu.id=:user_id;
";
$execSQL = $oPDOLink->prepare($sql);
$execSQL->execute(array(':user_id'=>$this->_userId));
$row = $execSQL->fetch(PDO::FETCH_ASSOC);
return $row;
}
}

View File

@ -1,118 +0,0 @@
<?php
class ClassGlobsiISP extends ClassConfig {
public function __construct(){}
public function __destruct(){}
public function getConfig(){
$oPDOLink = ClassConfig::databaseConnect();
$rowsConfig = array();
$sql="
SELECT *
FROM globsi_sales_config
WHERE is_active=TRUE
";
$execSQL = $oPDOLink->prepare($sql);
$execSQL->execute(array());
$rows = $execSQL->fetchAll(PDO::FETCH_ASSOC);
foreach($rows as $k=>$v){
$erpConfig[$rows[$k]['k']] = $rows[$k]['v'];
}
return $erpConfig;
}
public function createISP($data, $ext_id){
$this->_data = $data;
$this->_extId = $ext_id;
$config = ClassConfig::getConfig();
$oPDOLink = ClassConfig::foreignDatabaseConnect($_SESSION['globsi_sales']['db_server'], $_SESSION['globsi_sales']['db_name'], $_SESSION['globsi_sales']['db_user'], $_SESSION['globsi_sales']['db_password']);
//IF password and confirmPassword are not identical, displaying an error message
if($this->_data['formCreateISPFieldPassword'] != $this->_data['formCreateISPFieldConfirmPassword']){
$message['state']='failed';
$message['css_class']='failed';
$message['translation_code'] = 'checkRegisterForm_notSamePassword';
return $message;
}
else {
$activation_code = rand();
$sql="
INSERT INTO user_user(email, password, activation_code, firstname, lastname,
core_lang_id, core_country_id, core_currency_id, core_theme_id,
is_active, comment
)VALUES(
:email, :password, :activation_code,
:firstname, :lastname,
12, 44, 4, 1,
true, 'user created during installation process')
";
$execSQL = $oPDOLink->prepare($sql);
if($execSQL->execute(array(
':email'=>$this->_data['formCreateISPFieldEmail'],
':password'=>sha1($this->_data['formCreateISPFieldPassword'].'-k3P[8x&'),
':activation_code'=>$activation_code,
':firstname'=>$this->_data['formCreateISPFieldFirstname'],
':lastname'=>$this->_data['formCreateISPFieldLastname']
))){
$newUserId = $oPDOLink->lastInsertId('user_user_id_seq');
//$isVipOfferActive = $this->_checkIfVipOfferActive();
//$isEverythingForFreeActive = $this->_checkIfEverythingForFreeActive();
// core user detail
$sql="
INSERT INTO user_detail(user_id, ext_id)
VALUES (:user_id, :ext_id)
";
$execSQL = $oPDOLink->prepare($sql);
$execSQL->execute(array(':user_id'=>$newUserId, ':ext_id'=>$this->_extId));
// features for user
$sql="
INSERT INTO useruser_corefeature_rel(user_id, core_feature_id)
VALUES (
(SELECT id FROM user_user WHERE email=:email LIMIT 1),
(SELECT id FROM core_feature WHERE code=:core_feature_code LIMIT 1)
);
";
$execSQL = $oPDOLink->prepare($sql);
$execSQL->execute(array(':email'=>$this->_data['formCreateISPFieldEmail'], ':core_feature_code'=>'home'));
$execSQL->execute(array(':email'=>$this->_data['formCreateISPFieldEmail'], ':core_feature_code'=>'my-profile'));
$execSQL->execute(array(':email'=>$this->_data['formCreateISPFieldEmail'], ':core_feature_code'=>'logout'));
$message['user_id'] = $newUserId;
$message['activation_code'] = $activation_code;
$message['status'] = "green";
$message['content'] = 'User created with success';
//TODO change confirmation_registration by register_form_success when registrations will need an activation by clic on link in an email
//$message['translation_code'] = 'register_form_success'; //'confirmation_registration';
//TODO send an email to admin to indicate that there is a new registration
return $message;
} else {
$message['status']='red';
$message['content'] = 'User has not been created';
//$message['translation_code'] = 'register_form_failed';
return $message;
}
}
}
public function getISP($user_id){
$this->_userId = $user_id;
$config = ClassConfig::getConfig();
$oPDOLink = ClassConfig::foreignDatabaseConnect($_SESSION['globsi_isp']['db_server'], $_SESSION['globsi_isp']['db_name'], $_SESSION['globsi_isp']['db_user'], $_SESSION['globsi_isp']['db_password']);
$sql="
SELECT ud.ext_id, uu.*
FROM user_user uu
LEFT JOIN user_detail ud
ON uu.id=ud.user_id
WHERE uu.id=:user_id;
";
$execSQL = $oPDOLink->prepare($sql);
$execSQL->execute(array(':user_id'=>$this->_userId));
$row = $execSQL->fetch(PDO::FETCH_ASSOC);
return $row;
}
}

View File

@ -1,118 +0,0 @@
<?php
class ClassGlobsiProvider extends ClassConfig {
public function __construct(){}
public function __destruct(){}
public function getConfig(){
$oPDOLink = ClassConfig::databaseConnect();
$rowsConfig = array();
$sql="
SELECT *
FROM globsi_providers_config
WHERE is_active=TRUE
";
$execSQL = $oPDOLink->prepare($sql);
$execSQL->execute(array());
$rows = $execSQL->fetchAll(PDO::FETCH_ASSOC);
foreach($rows as $k=>$v){
$erpConfig[$rows[$k]['k']] = $rows[$k]['v'];
}
return $erpConfig;
}
public function createProvider($data, $ext_id){
$this->_data = $data;
$this->_extId = $ext_id;
$config = ClassConfig::getConfig();
$oPDOLink = ClassConfig::foreignDatabaseConnect($_SESSION['globsi_providers']['db_server'], $_SESSION['globsi_providers']['db_name'], $_SESSION['globsi_providers']['db_user'], $_SESSION['globsi_providers']['db_password']);
//IF password and confirmPassword are not identical, displaying an error message
if($this->_data['formCreateProviderFieldPassword'] != $this->_data['formCreateProviderFieldConfirmPassword']){
$message['state']='failed';
$message['css_class']='failed';
$message['translation_code'] = 'checkRegisterForm_notSamePassword';
return $message;
}
else {
$activation_code = rand();
$sql="
INSERT INTO user_user(email, password, activation_code, firstname, lastname,
core_lang_id, core_country_id, core_currency_id, core_theme_id,
is_active, comment
)VALUES(
:email, :password, :activation_code,
:firstname, :lastname,
12, 44, 4, 1,
true, 'user created during installation process')
";
$execSQL = $oPDOLink->prepare($sql);
if($execSQL->execute(array(
':email'=>$this->_data['formCreateProviderFieldEmail'],
':password'=>sha1($this->_data['formCreateProviderFieldPassword'].'-k3P[8x&'),
':activation_code'=>$activation_code,
':firstname'=>$this->_data['formCreateProviderFieldFirstname'],
':lastname'=>$this->_data['formCreateProviderFieldLastname']
))){
$newUserId = $oPDOLink->lastInsertId('user_user_id_seq');
//$isVipOfferActive = $this->_checkIfVipOfferActive();
//$isEverythingForFreeActive = $this->_checkIfEverythingForFreeActive();
// core user detail
$sql="
INSERT INTO user_detail(user_id, ext_id)
VALUES (:user_id, :ext_id)
";
$execSQL = $oPDOLink->prepare($sql);
$execSQL->execute(array(':user_id'=>$newUserId, ':ext_id'=>$this->_extId));
// features for user
$sql="
INSERT INTO useruser_corefeature_rel(user_id, core_feature_id)
VALUES (
(SELECT id FROM user_user WHERE email=:email LIMIT 1),
(SELECT id FROM core_feature WHERE code=:core_feature_code LIMIT 1)
);
";
$execSQL = $oPDOLink->prepare($sql);
$execSQL->execute(array(':email'=>$this->_data['formCreateProviderFieldEmail'], ':core_feature_code'=>'home'));
$execSQL->execute(array(':email'=>$this->_data['formCreateProviderFieldEmail'], ':core_feature_code'=>'my-profile'));
$execSQL->execute(array(':email'=>$this->_data['formCreateProviderFieldEmail'], ':core_feature_code'=>'logout'));
$message['user_id'] = $newUserId;
$message['activation_code'] = $activation_code;
$message['status'] = "green";
$message['content'] = 'User created with success';
//TODO change confirmation_registration by register_form_success when registrations will need an activation by clic on link in an email
//$message['translation_code'] = 'register_form_success'; //'confirmation_registration';
//TODO send an email to admin to indicate that there is a new registration
return $message;
} else {
$message['status']='red';
$message['content'] = 'User has not been created';
//$message['translation_code'] = 'register_form_failed';
return $message;
}
}
}
public function getClient($user_id){
$this->_userId = $user_id;
$config = ClassConfig::getConfig();
$oPDOLink = ClassConfig::foreignDatabaseConnect($_SESSION['globsi_providers']['db_server'], $_SESSION['globsi_providers']['db_name'], $_SESSION['globsi_providers']['db_user'], $_SESSION['globsi_providers']['db_password']);
$sql="
SELECT ud.ext_id, uu.*
FROM user_user uu
LEFT JOIN user_detail ud
ON uu.id=ud.user_id
WHERE uu.id=:user_id;
";
$execSQL = $oPDOLink->prepare($sql);
$execSQL->execute(array(':user_id'=>$this->_userId));
$row = $execSQL->fetch(PDO::FETCH_ASSOC);
return $row;
}
}

View File

@ -1,96 +0,0 @@
<?php
class ClassPlay extends ripcord {
public function __construct(){}
public function __destruct(){}
private function _getStageId($models, $db, $uid, $password, $stage){
return $models->execute_kw($db, $uid, $password, 'project.task.type', 'search', array(array(array('name', '=', $stage))))[0];
}
public function codePushed($models, $db, $uid, $password, $task_id){
# Check if upload have no error, then encode to base64.
if ($_FILES['input_file_code_form']['error'] == UPLOAD_ERR_OK
&& is_uploaded_file($_FILES['input_file_code_form']['tmp_name'])) {
$file_content = file_get_contents($_FILES['input_file_code_form']['tmp_name']);
$file_base64 = base64_encode($file_content);
}
else{
$res['status'] = 'warning';
$res['message'] = 'Something went wrong with the file you try to upload. Please try again. If problem persist, <a href="mailto:contact@jmdn-solutions.com">contact us</a>';
return $res;
}
//assign task to user in ERP
$stage_id = $this->_getStageId($models, $db, $uid, $password, "Approval");
$res['erp'] = $models->execute_kw(
$db, $uid, $password, 'project.task', 'write', array(
array((integer) $task_id),
array(
'stage_id'=>$stage_id,
'file_base64'=>$file_base64,
'file_name'=>$_FILES['input_file_code_form']['name'],
)
)); //the (integer) casting before $task_id is required
$res['status'] = 'success';
$res['message'] = 'Well done and thank you for your work. We will review it as soon as possible and let you know if it is approved or if a part of your work needs to be fixed.';
return $res;
}
public function getUnassignedTask($models, $db, $uid, $password, $task_id){
//assign task to user in ERP
$res = $models->execute_kw($db, $uid, $password, 'project.task', 'get_task', array(array((integer) $task_id))); //the (integer) casting before $task_id is required
return $res;
}
public function listMyCurrentTasks($models, $db, $uid, $password){
$res = $models->execute_kw($db, $uid, $password, 'project.task', 'search_read', array(array(array('user_id', '=', $uid))), array('fields'=>array()));
return $res;
}
public function getMyCurrentTask($models, $db, $uid, $password){
$stage_id = $this->_getStageId($models, $db, $uid, $password, "Current");
$res = $models->execute_kw($db, $uid, $password, 'project.task', 'search_read', array(array(array('user_id', '=', $uid), array('stage_id', '=', $stage_id))), array('fields'=>array()));
return $res;
}
public function listMyTasksOnApproval($models, $db, $uid, $password){
$stage_id = $this->_getStageId($models, $db, $uid, $password, "Approval");
$res = $models->execute_kw($db, $uid, $password, 'project.task', 'search_read', array(array(array('user_id', '=', $uid), array('stage_id', '=', $stage_id))), array('fields'=>array()));
return $res;
}
public function listTasksToFix($models, $db, $uid, $password){
$stage_id = $this->_getStageId($models, $db, $uid, $password, "To Fix");
$res = $models->execute_kw($db, $uid, $password, 'project.task', 'search_read', array(array(array('user_id', '=', $uid), array('stage_id', '=', $stage_id))), array('fields'=>array()));
return $res;
}
public function listMyTasksDone($models, $db, $uid, $password){
$stage_id = $this->_getStageId($models, $db, $uid, $password, "Done");
$res = $models->execute_kw($db, $uid, $password, 'project.task', 'search_read', array(array(array('user_id', '=', $uid), array('stage_id', '=', $stage_id))), array('fields'=>array()));
return $res;
}
public function listUnassignedTasks($models, $db, $uid, $password){
$res = $models->execute_kw($db, $uid, $password, 'project.task', 'search_read', array(array(array('user_id', '=', false),array('published', '=', true))), array('fields'=>array()));
return $res;
}
public function listFixTasks($models, $db, $uid, $password){
$res = $models->execute_kw($db, $uid, $password, 'project.task', 'list_to_fix_tasks', array());
return $res;
}
public function taskGaveUp($models, $db, $uid, $password, $task_id){
//unassign task from user in ERP
$stage_id = $this->_getStageId($models, $db, $uid, $password, "Current");
$res = $models->execute_kw($db, $uid, $password, 'project.task', 'write', array(array((integer) $task_id), array('stage_id'=>$stage_id, 'user_id'=>false))); //the (integer) casting before $task_id is required
return $res;
}
public function taskGetAttachment($models, $db, $uid, $password, $attachment_id){
$res = $models->execute_kw($db, $uid, $password, 'ir.attachment', 'read', array((integer) $attachment_id), array('fields'=>["datas", "name"])); //the (integer) casting before $attachment_id is required
return $res;
}
}

View File

@ -1,17 +0,0 @@
<?php
session_start();
require('../../../modules/InterfacePostgreSQL.php');
require('../../../modules/InterfaceConfig.php');
require('../../../modules/ClassConfig.php');
require('../../modules/ClassXMLRPC.php');
$url = $_SESSION['erp']['url'];
$db_name = $_SESSION['erp']['db'];
//$username = $_SESSION['user']['email'];
//$password = $_SESSION['user']['password'];
$xmlrpc = new ClassXMLRPC($url, $db_name, "admin", "admin");
$user_id = $_SESSION['user']['ext_id'];
$current_real_gain = $xmlrpc->execute("globsi.stats", "get_current_currency_gauge", [$user_id], []);
echo json_encode($current_real_gain);

View File

@ -1,18 +0,0 @@
<?php
session_start();
require_once('../modules/ripcord.php');
$url = $_SESSION['erp']['url'];
$db = $_SESSION['erp']['db'];
$username = $_SESSION['user']['email'];
$password = $_SESSION['user']['password'];
$common = ripcord::client($url."xmlrpc/2/common");
$uid = $common->authenticate($db, $username, $password, array());
$models = ripcord::client($url."xmlrpc/2/object");
$res = $models->execute_kw($db, $uid, $password, 'project.task', 'search', [[['user_id', '=', false],['published', '=', true]]]);
echo implode(",", $res);

View File

@ -1,8 +0,0 @@
//var svg = SVG.init("#current_real_gain", 600, 400);
get_gauge(
"custom/scripts/ajax/current_real_gain.php",
"#current_real_gain",
function(dataset){ return dataset.current; }, //current
function(){ return 0; }, //min
function(dataset){ return dataset.max; } //max
);

View File

@ -1,36 +0,0 @@
function grey_tasks(freetasks_ids){
$(".task_todo").each(function(){
var button = $(this).find("button[name='submit_getUnassignedTask_form']");
if(!freetasks_ids.includes(this.id) && !button.prop('disabled')){
button.prop('disabled', true);
button.text("Task assigned");
}
else if(freetasks_ids.includes(this.id) && button.prop('disabled')){
button.prop('disabled', false);
button.html("<i class='material-icons'>lock</i>");
}
})
}
function reatime_task_update(){
var self = reatime_task_update;
$.ajax({
type: "GET",
url: urlRoot + "custom/scripts/checkFreeTasks.php",
success: function(values)
{
var freetasks_ids = values.split(",");
freetasks_ids = $.map(freetasks_ids, function(id){
return "task_todo_" + id;
});
grey_tasks(freetasks_ids);
setTimeout(self, 5000);
},
error: function()
{
setTimeout(self, 5000);
}
});
}
$(document).ready(reatime_task_update);

View File

@ -16,7 +16,6 @@ ob_start();
session_start(); session_start();
//unset($_SESSION); //unset($_SESSION);
if(isset($_SESSION['user']) and !isset($_SESSION['user']['id'])){ if(isset($_SESSION['user']) and !isset($_SESSION['user']['id'])){
unset($_SESSION['user']); unset($_SESSION['user']);
unset($_SESSION['config']); unset($_SESSION['config']);
@ -62,7 +61,7 @@ try {
if(!isset($_COOKIE['firstvisit'])){ if(!isset($_COOKIE['firstvisit'])){
$display_cookie_message = true; $display_cookie_message = true;
setcookie("globsi-admin", "false", time()+60*60*24*60); setcookie("wefra-odoo11", "false", time()+60*60*24*60);
} }
$oTrans = new ClassTranslation(); $oTrans = new ClassTranslation();
@ -74,18 +73,14 @@ $oUser = new ClassUserCustom();
$oCountry = new ClassCountry(); $oCountry = new ClassCountry();
$oCurrency = new ClassCurrency(); $oCurrency = new ClassCurrency();
$oERP = new ClassERP(); $oERP = new ClassERP();
$oGlobsiClients = new ClassGlobsiClients();
$oGlobsiISP = new ClassGlobsiISP();
////TODO method to code ////TODO method to code
//if(isset($_SESSION['user']) and $_SESSION['user']['modules_path']!="") $oUser->getCustomerModules($_SESSION['user']['modules_path']); //if(isset($_SESSION['user']) and $_SESSION['user']['modules_path']!="") $oUser->getCustomerModules($_SESSION['user']['modules_path']);
// Load configuration in _SESSION // Load configuration in _SESSION
//unset($_SESSION['config']); //uncomment this line, even for test, creates a bug for translations for logged users //unset($_SESSION['config']); //uncomment this line, even for test, creates a bug for translations for logged users
if (!isset($_SESSION['config'])) { if (!isset($_SESSION['config'])) {
$_SESSION['config'] = $oConf->getConfig(); $_SESSION['config'] = $oConf->getConfig();
$_SESSION['erp'] = $oERP->getConfig(); $_SESSION['erp'] = $oERP->getConfig();
$_SESSION['globsi_clients'] = $oGlobsiClients->getConfig();
////// //////
//// The code below creates a bug in Chromium "Too many redirections //// The code below creates a bug in Chromium "Too many redirections

View File

@ -2,16 +2,4 @@
$oConf = new ClassConfig(); $oConf = new ClassConfig();
$oTrans = new ClassTranslation(); $oTrans = new ClassTranslation();
//$url = "http://localhost:8069"; //LOG IN process is managed at the start of themes/<theme_name>/index.php
//$db = "odoo11globsi";
//$username = $_POST['login'];
//$password = $_POST['password'];
//
//require_once('./custom/modules/ripcord.php');
//
//$common = ripcord::client("$url/xmlrpc/2/common");
//$uid = $common->authenticate($db, $username, $password, array());
//echo "user id is ".$uid;
//$models = ripcord::client("$url/xmlrpc/2/object");
//
//echo sha1('a-k3P[8x&');

View File

@ -1,10 +1,4 @@
<?php <?php
//unset($_SESSION['user']);
//print_r($_SESSION['user']);
//
//unset($_SESSION['message']);
//print_r($_SESSION['message']);
if(isset($_POST['formLoginButtonSubmit'])){ if(isset($_POST['formLoginButtonSubmit'])){
$url = $_SESSION['erp']['url']; $url = $_SESSION['erp']['url'];
$db = $_SESSION['erp']['db']; $db = $_SESSION['erp']['db'];
@ -15,7 +9,6 @@ if(isset($_POST['formLoginButtonSubmit'])){
if(isset($user['email']) && $user['email'] == $username){ if(isset($user['email']) && $user['email'] == $username){
$password = $user['password']; $password = $user['password'];
$common = ripcord::client($url."xmlrpc/2/common"); $common = ripcord::client($url."xmlrpc/2/common");
print_r($common);
$user['ext_id'] = $common->authenticate($db, $username, $password, array()); $user['ext_id'] = $common->authenticate($db, $username, $password, array());
$models = ripcord::client($url."xmlrpc/2/object"); $models = ripcord::client($url."xmlrpc/2/object");

View File

@ -14,8 +14,6 @@
</div> </div>
<?php <?php
//print_r($_SESSION['user']);
//print_r($_SESSION['message']);
if(!isset($_SESSION['user']) or (isset($_SESSION['user']) && $_SESSION['message']['status']=="orange")){ ?> if(!isset($_SESSION['user']) or (isset($_SESSION['user']) && $_SESSION['message']['status']=="orange")){ ?>
<div class="container"> <div class="container">
<div class="section"> <div class="section">

View File

@ -51,9 +51,3 @@
<!--ENDOF .section--> <!--ENDOF .section-->
</div> </div>
<!--ENDOF .container--> <!--ENDOF .container-->
<pre>
<?php
print_r($user);
?>
</pre>