Compare commits

..

No commits in common. "e4d1f1918c96927c7be71e8f4027cd867898a963" and "d0b01a8f0f21fecd379727aa484599fcf4d0afcf" have entirely different histories.

21 changed files with 12954 additions and 55 deletions

View File

@ -1,27 +1,2 @@
# globsi-admin # globsi-admin
How to install Wefra for Odoo 11+
1. clone this repository
2. set the right parameters in the files above
=> modules/InterfaceConfig.php
=> modules/InterfacePostgreSQL.php
=> scripts/config.js
3. execute the SQL files
=> __private/install/install-v1.0.0.sql
=> __private/install/install.php
4. then set the right values in the SQL table erp_config to connect wefra to your odoo instance. And if needed you can change the settings of Wefra in core_config
Multi-languages:
Activate the languages you want in the SQL table core_lang. If the flag for the language does not display, you can copy paste from images/flags/world to images/flags/default and rename it with the language code that you can find in SQL table core_lang
Multi-currencies:
If you want to create a e-commerce frontend and use multi-currencies, activate the wanted currencies in SQL table core_currency
Naming convention:
FOR SQL:
(install|update)-(v1.N1.N2).sql where N1 is a middle evolution (a new feature) and N2 is a fix/imp
Organisation:
A module includes: the SQL file based

10
__private/.htaccess Normal file
View File

@ -0,0 +1,10 @@
Options +FollowSymlinks
RewriteEngine on
#RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} !index.php
#RewriteRule ^install$ custom/__private/install/install.php [L]
RewriteRule ^([a-z\-]+)-([0-9\.]+)$ index.php?page=$1&reference=$2 [L]
RewriteRule ^([a-z\-]+)$ index.php?page=$1 [L]

View File

@ -1,5 +1,12 @@
<?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

@ -0,0 +1,127 @@
<?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

@ -0,0 +1,118 @@
<?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

@ -0,0 +1,118 @@
<?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

@ -0,0 +1,96 @@
<?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

@ -0,0 +1,17 @@
<?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

@ -0,0 +1,18 @@
<?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

@ -0,0 +1,8 @@
//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

@ -0,0 +1,36 @@
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,6 +16,7 @@ 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']);
@ -61,7 +62,7 @@ try {
if(!isset($_COOKIE['firstvisit'])){ if(!isset($_COOKIE['firstvisit'])){
$display_cookie_message = true; $display_cookie_message = true;
setcookie("wefra-odoo11", "false", time()+60*60*24*60); setcookie("globsi-admin", "false", time()+60*60*24*60);
} }
$oTrans = new ClassTranslation(); $oTrans = new ClassTranslation();
@ -73,14 +74,18 @@ $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

@ -1,7 +1,6 @@
<?php <?php
$oConf = new ClassConfig(); $oConf = new ClassConfig();
$oTrans = new ClassTranslation(); $oTrans = new ClassTranslation();
$lang_code = (isset($_SESSION['user']['lang_code']))?$_SESSION['user']['lang_code']:$_SESSION['config']['default_lang_code'];
//if(isset($_SESSION['user'])){ //if(isset($_SESSION['user'])){
// $url = $_SESSION['erp']['url']; // $url = $_SESSION['erp']['url'];

View File

@ -2,4 +2,16 @@
$oConf = new ClassConfig(); $oConf = new ClassConfig();
$oTrans = new ClassTranslation(); $oTrans = new ClassTranslation();
//LOG IN process is managed at the start of themes/<theme_name>/index.php //$url = "http://localhost:8069";
//$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,4 +1,10 @@
<?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'];
@ -9,6 +15,7 @@ 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");
@ -43,14 +50,14 @@ $lang_code = (isset($_SESSION['user']['lang_code']))?$_SESSION['user']['lang_cod
<!-- CSS --> <!-- CSS -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="<?php echo $oConf->getURLRoot('lib/materialize/materialize-1.1.0.min.css'); ?>" type="text/css" rel="stylesheet" media="screen,projection"/> <link href="<?php echo $oConf->getURLRoot('themes/materialize/css/materialize.css'); ?>" type="text/css" rel="stylesheet" media="screen,projection"/>
<link href="<?php echo $oConf->getURLRoot('themes/materialize/css/style.css'); ?>" type="text/css" rel="stylesheet" media="screen,projection"/> <link href="<?php echo $oConf->getURLRoot('themes/materialize/css/style.css'); ?>" type="text/css" rel="stylesheet" media="screen,projection"/>
<!--JQUERY and addons--> <!--JQUERY and addons-->
<script src="<?php echo $oConf->getURLRoot('lib/jquery/jquery-3.2.1.js'); ?>"></script> <script src="<?php echo $oConf->getURLRoot('lib/jquery/jquery-3.2.1.js'); ?>"></script>
<script src="<?php echo $oConf->getURLRoot('lib/jquery/jquery-ui.js'); ?>"></script> <script src="<?php echo $oConf->getURLRoot('lib/jquery/jquery-ui.js'); ?>"></script>
<script src="<?php echo $oConf->getURLRoot('lib/materialize/materialize-1.1.0.min.js'); ?>"></script> <script src="<?php echo $oConf->getURLRoot('themes/materialize/js/materialize.js'); ?>"></script>
<script src="<?php echo $oConf->getURLRoot('themes/materialize/js/init.js'); ?>"></script> <script src="<?php echo $oConf->getURLRoot('themes/materialize/js/init.js'); ?>"></script>
<!--D3JS v5--> <!--D3JS v5-->
@ -120,21 +127,7 @@ if(isset($display_cookie_message)){
} //ENDOF foreach($_SESSION['features'] as $k=>$v){ } //ENDOF foreach($_SESSION['features'] as $k=>$v){
$li_list = '';
foreach($_SESSION['activeLanguages'] as $language){
if($language['code'] == $_SESSION['config']['default_lang_code']){
$li_active_language = '<img src="'.$oConf->getURLRoot("images/flags/default/".$language['code']).'.png" style="width:25px;">';
} else {
$li_list .= '<li><a href="'.$oConf->getURLRoot("scripts/changeLang.php?lang=".$language['code']).'"><img src="'.$oConf->getURLRoot("images/flags/default/".$language['code']).'.png" style="width:25px;"></a></li>';
}
}
?> ?>
<!--DISPLAYS FLAGS FOR LANGUAGES-->
<ul id="dropdown1" class="dropdown-content">
<?php echo $li_list; ?>
</ul>
<li><a class="dropdown-trigger" href="#!" data-target="dropdown1"><?php echo $li_active_language; ?><i class="material-icons right">arrow_drop_down</i></a></li>
</ul> </ul>
<ul id="nav-mobile" class="sidenav"> <ul id="nav-mobile" class="sidenav">
@ -142,7 +135,7 @@ if(isset($display_cookie_message)){
<?php <?php
foreach($_SESSION['features'] as $k=>$v){ foreach($_SESSION['features'] as $k=>$v){
// condition for guest features // condition for guest features
if ($_SESSION['features'][$k]->is_menu_display == true){ if ($_SESSION['features'][$k]->is_menu_display == true && $_SESSION['features'][$k]->is_menu_backend != true && $_SESSION['features'][$k]->is_user_feature == false){
// condition for logout // condition for logout
if ($_SESSION['features'][$k]->code == 'logout'){ if ($_SESSION['features'][$k]->code == 'logout'){
echo ' echo '
@ -232,8 +225,10 @@ if(isset($display_cookie_message)){
<!-- Scripts--> <!-- Scripts-->
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function(){
$(function(){
$('select').formSelect(); $('select').formSelect();
}); });
});
</script> </script>
</body> </body>

View File

@ -3,7 +3,6 @@
$('.sidenav').sidenav(); $('.sidenav').sidenav();
$('.parallax').parallax(); $('.parallax').parallax();
$(".dropdown-trigger").dropdown();
}); // end of document ready }); // end of document ready
})(jQuery); // end of jQuery name space })(jQuery); // end of jQuery name space

12337
themes/materialize/js/materialize.js vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@ if(isset($_SESSION['user'])){
<div class="col s12"> <div class="col s12">
<div class="icon-block"> <div class="icon-block">
<h2 class="center brown-text"><i class="material-icons">face</i></h2> <h2 class="center brown-text"><i class="material-icons">face</i></h2>
<?php echo $oTrans->getTranslation('webpage_home_content_welldoneMessageSuccesInstall', $lang_code); ?> <h5 class="center">Well Done, you have successfully been able to log in. Which means installation is finished.</h5>
</div> </div>
</div> </div>
<!--ENDOF .col--> <!--ENDOF .col-->
@ -78,7 +78,7 @@ if(isset($_SESSION['user'])){
<div class="section" style="padding: 100px 0px 100px 0px; "> <div class="section" style="padding: 100px 0px 100px 0px; ">
<div class="row"> <div class="row">
<div class="col s12 center"> <div class="col s12 center">
<?php echo $oTrans->getTranslation('webpage_home_content_welcome', $lang_code); ?> <h1>Welcome to Wefra for Odoo 11.0</h1>
</div> </div>
</div> </div>
</div> </div>
@ -88,9 +88,7 @@ if(isset($_SESSION['user'])){
<div class="container"> <div class="container">
<div class="section"> <div class="section">
<div class="row"> <div class="row">
<div class="col s12 center"> <div class="col s12 center"><h2>Included Libraries</h2></div>
<?php echo $oTrans->getTranslation('webpage_home_content_includedLibrariesTitle', $lang_code); ?>
</div>
<!--jQuery--> <!--jQuery-->
<div class="col s12 m4 center"> <div class="col s12 m4 center">
<div class="icon-block"> <div class="icon-block">

View File

@ -1,9 +1,21 @@
<div id="index-banner" class="parallax-container"> <div id="index-banner" class="parallax-container">
<div class="section no-pad-bot"></div> <div class="section no-pad-bot">
<div class="parallax"><img src="<?php echo $oConf->getURLRoot('images/jmdn-group-business-data.jpg'); ?>" alt="Code && Make Cash!" style="max-width: 100px;"></div> <div class="container">
<br><br>
<h1 class="header center teal-text text-lighten-2">Code & Make Cash!</h1>
<div class="row center">
<h5 class="header col s12 light">We are seeking for software developers all around the world.</h5>
</div>
<br><br>
</div>
</div>
<div class="parallax"><img src="<?php echo $oConf->getURLRoot('images/geneva-xl-01-banner.jpg'); ?>" alt="Unsplashed background img 2"></div>
</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,3 +51,9 @@
<!--ENDOF .section--> <!--ENDOF .section-->
</div> </div>
<!--ENDOF .container--> <!--ENDOF .container-->
<pre>
<?php
print_r($user);
?>
</pre>