New: early development of multi-company module
This commit is contained in:
parent
9cc8f2fed8
commit
47cde9d686
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -32,178 +32,178 @@
|
|||||||
|
|
||||||
class Export
|
class Export
|
||||||
{
|
{
|
||||||
var $db;
|
var $db;
|
||||||
|
|
||||||
var $array_export_code=array(); // Tableau de "idmodule_numlot"
|
var $array_export_code=array(); // Tableau de "idmodule_numlot"
|
||||||
var $array_export_module=array(); // Tableau de "nom de modules"
|
var $array_export_module=array(); // Tableau de "nom de modules"
|
||||||
var $array_export_label=array(); // Tableau de "libelle de lots"
|
var $array_export_label=array(); // Tableau de "libelle de lots"
|
||||||
var $array_export_sql=array(); // Tableau des "requetes sql"
|
var $array_export_sql=array(); // Tableau des "requetes sql"
|
||||||
var $array_export_fields=array(); // Tableau des listes de champ+libell<6C> <20> exporter
|
var $array_export_fields=array(); // Tableau des listes de champ+libell<6C> <20> exporter
|
||||||
var $array_export_alias=array(); // Tableau des listes de champ+alias <20> exporter
|
var $array_export_alias=array(); // Tableau des listes de champ+alias <20> exporter
|
||||||
var $array_export_special=array(); // Tableau des operations speciales sur champ
|
var $array_export_special=array(); // Tableau des operations speciales sur champ
|
||||||
|
|
||||||
// To store export modules
|
// To store export modules
|
||||||
var $hexa;
|
var $hexa;
|
||||||
var $datatoexport;
|
var $datatoexport;
|
||||||
var $model_name;
|
var $model_name;
|
||||||
|
|
||||||
var $sqlusedforexport;
|
var $sqlusedforexport;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Constructeur de la classe
|
* \brief Constructeur de la classe
|
||||||
* \param DB Handler acces base de donnees
|
* \param DB Handler acces base de donnees
|
||||||
*/
|
*/
|
||||||
function Export($DB)
|
function Export($DB)
|
||||||
|
{
|
||||||
|
$this->db=$DB;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Load an exportable dataset
|
||||||
|
* \param user Object user making export
|
||||||
|
* \param filter Code export pour charger un lot de donnees particulier
|
||||||
|
*/
|
||||||
|
function load_arrays($user,$filter='')
|
||||||
|
{
|
||||||
|
global $langs,$conf;
|
||||||
|
|
||||||
|
dol_syslog("Export::load_arrays user=".$user->id." filter=".$filter);
|
||||||
|
|
||||||
|
$dir=DOL_DOCUMENT_ROOT."/includes/modules";
|
||||||
|
$handle=opendir($dir);
|
||||||
|
|
||||||
|
// Recherche des exports disponibles
|
||||||
|
$var=True;
|
||||||
|
$i=0;
|
||||||
|
while (($file = readdir($handle))!==false)
|
||||||
{
|
{
|
||||||
$this->db=$DB;
|
if (eregi("^(mod.*)\.class\.php$",$file,$reg))
|
||||||
}
|
{
|
||||||
|
$modulename=$reg[1];
|
||||||
|
|
||||||
|
// Defined if module is enabled
|
||||||
/**
|
$enabled=true;
|
||||||
* \brief Load an exportable dataset
|
$part=strtolower(eregi_replace('^mod','',$modulename));
|
||||||
* \param user Object user making export
|
|
||||||
* \param filter Code export pour charger un lot de donnees particulier
|
|
||||||
*/
|
|
||||||
function load_arrays($user,$filter='')
|
|
||||||
{
|
|
||||||
global $langs,$conf;
|
|
||||||
|
|
||||||
dol_syslog("Export::load_arrays user=".$user->id." filter=".$filter);
|
|
||||||
|
|
||||||
$dir=DOL_DOCUMENT_ROOT."/includes/modules";
|
|
||||||
$handle=opendir($dir);
|
|
||||||
|
|
||||||
// Recherche des exports disponibles
|
|
||||||
$var=True;
|
|
||||||
$i=0;
|
|
||||||
while (($file = readdir($handle))!==false)
|
|
||||||
{
|
|
||||||
if (eregi("^(mod.*)\.class\.php",$file,$reg))
|
|
||||||
{
|
|
||||||
$modulename=$reg[1];
|
|
||||||
|
|
||||||
// Defined if module is enabled
|
|
||||||
$enabled=true;
|
|
||||||
$part=strtolower(eregi_replace('^mod','',$modulename));
|
|
||||||
if (empty($conf->$part->enabled)) $enabled=false;
|
if (empty($conf->$part->enabled)) $enabled=false;
|
||||||
|
|
||||||
if ($enabled)
|
if ($enabled)
|
||||||
{
|
{
|
||||||
// Chargement de la classe
|
// Chargement de la classe
|
||||||
$file = $dir."/".$modulename.".class.php";
|
$file = $dir."/".$modulename.".class.php";
|
||||||
$classname = $modulename;
|
$classname = $modulename;
|
||||||
require_once($file);
|
require_once($file);
|
||||||
$module = new $classname($this->db);
|
$module = new $classname($this->db);
|
||||||
|
|
||||||
if (is_array($module->export_code))
|
if (is_array($module->export_code))
|
||||||
{
|
{
|
||||||
foreach($module->export_code as $r => $value)
|
foreach($module->export_code as $r => $value)
|
||||||
{
|
{
|
||||||
if ($filter && ($filter != $module->export_code[$r])) continue;
|
if ($filter && ($filter != $module->export_code[$r])) continue;
|
||||||
|
|
||||||
// Test si permissions ok \todo tester sur toutes permissions
|
// Test si permissions ok \todo tester sur toutes permissions
|
||||||
$perm=$module->export_permission[$r][0];
|
$perm=$module->export_permission[$r][0];
|
||||||
//print_r("$perm[0]-$perm[1]-$perm[2]<br>");
|
//print_r("$perm[0]-$perm[1]-$perm[2]<br>");
|
||||||
if ($perm[2])
|
if ($perm[2])
|
||||||
{
|
{
|
||||||
$bool=$user->rights->$perm[0]->$perm[1]->$perm[2];
|
$bool=$user->rights->$perm[0]->$perm[1]->$perm[2];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$bool=$user->rights->$perm[0]->$perm[1];
|
$bool=$user->rights->$perm[0]->$perm[1];
|
||||||
}
|
}
|
||||||
if ($perm[0]=='user' && $user->admin) $bool=true;
|
if ($perm[0]=='user' && $user->admin) $bool=true;
|
||||||
//print $bool." $perm[0]"."<br>";
|
//print $bool." $perm[0]"."<br>";
|
||||||
|
|
||||||
// Permissions ok
|
// Permissions ok
|
||||||
// if ($bool)
|
// if ($bool)
|
||||||
// {
|
// {
|
||||||
// Charge fichier lang en rapport
|
// Charge fichier lang en rapport
|
||||||
$langtoload=$module->getLangFilesArray();
|
$langtoload=$module->getLangFilesArray();
|
||||||
if (is_array($langtoload))
|
if (is_array($langtoload))
|
||||||
{
|
{
|
||||||
foreach($langtoload as $key)
|
foreach($langtoload as $key)
|
||||||
{
|
{
|
||||||
$langs->load($key);
|
$langs->load($key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Module
|
// Module
|
||||||
$this->array_export_module[$i]=$module;
|
$this->array_export_module[$i]=$module;
|
||||||
// Permission
|
// Permission
|
||||||
$this->array_export_perms[$i]=$bool;
|
$this->array_export_perms[$i]=$bool;
|
||||||
// Icon
|
// Icon
|
||||||
$this->array_export_icon[$i]=(isset($module->export_icon[$r])?$module->export_icon[$r]:$module->picto);
|
$this->array_export_icon[$i]=(isset($module->export_icon[$r])?$module->export_icon[$r]:$module->picto);
|
||||||
// Code du dataset export
|
// Code du dataset export
|
||||||
$this->array_export_code[$i]=$module->export_code[$r];
|
$this->array_export_code[$i]=$module->export_code[$r];
|
||||||
// Libelle du dataset export
|
// Libelle du dataset export
|
||||||
$this->array_export_label[$i]=$module->getDatasetLabel($r);
|
$this->array_export_label[$i]=$module->getDatasetLabel($r);
|
||||||
// Tableau des champ a exporter (cle=champ, valeur=libelle)
|
// Tableau des champ a exporter (cle=champ, valeur=libelle)
|
||||||
$this->array_export_fields[$i]=$module->export_fields_array[$r];
|
$this->array_export_fields[$i]=$module->export_fields_array[$r];
|
||||||
// Tableau des entites a exporter (cle=champ, valeur=entite)
|
// Tableau des entites a exporter (cle=champ, valeur=entite)
|
||||||
$this->array_export_entities[$i]=$module->export_entities_array[$r];
|
$this->array_export_entities[$i]=$module->export_entities_array[$r];
|
||||||
// Tableau des alias a exporter (cle=champ, valeur=alias)
|
// Tableau des alias a exporter (cle=champ, valeur=alias)
|
||||||
$this->array_export_alias[$i]=$module->export_alias_array[$r];
|
$this->array_export_alias[$i]=$module->export_alias_array[$r];
|
||||||
// Tableau des operations speciales sur champ
|
// Tableau des operations speciales sur champ
|
||||||
$this->array_export_special[$i]=$module->export_special_array[$r];
|
$this->array_export_special[$i]=$module->export_special_array[$r];
|
||||||
|
|
||||||
// Requete sql du dataset
|
// Requete sql du dataset
|
||||||
$this->array_export_sql_start[$i]=$module->export_sql_start[$r];
|
$this->array_export_sql_start[$i]=$module->export_sql_start[$r];
|
||||||
$this->array_export_sql_end[$i]=$module->export_sql_end[$r];
|
$this->array_export_sql_end[$i]=$module->export_sql_end[$r];
|
||||||
//$this->array_export_sql[$i]=$module->export_sql[$r];
|
//$this->array_export_sql[$i]=$module->export_sql[$r];
|
||||||
|
|
||||||
dol_syslog("Export loaded for module ".$modulename." with index ".$i.", dataset=".$module->export_code[$r].", nb of fields=".sizeof($module->export_fields_code[$r]));
|
dol_syslog("Export loaded for module ".$modulename." with index ".$i.", dataset=".$module->export_code[$r].", nb of fields=".sizeof($module->export_fields_code[$r]));
|
||||||
$i++;
|
$i++;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir($handle);
|
closedir($handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Lance la generation du fichier
|
* \brief Lance la generation du fichier
|
||||||
* \param user User qui exporte
|
* \param user User qui exporte
|
||||||
* \param model Modele d'export
|
* \param model Modele d'export
|
||||||
* \param datatoexport Lot de donn<EFBFBD>e <EFBFBD> exporter
|
* \param datatoexport Lot de donnee a exporter
|
||||||
* \param array_selected Tableau des champs <EFBFBD> exporter
|
* \param array_selected Tableau des champs a exporter
|
||||||
* \remarks Les tableaux array_export_xxx sont d<EFBFBD>j<EFBFBD> charg<EFBFBD>es pour le bon datatoexport
|
* \remarks Les tableaux array_export_xxx sont deja chargees pour le bon datatoexport
|
||||||
* aussi le parametre datatoexport est inutilis<EFBFBD>
|
* aussi le parametre datatoexport est inutilise
|
||||||
*/
|
*/
|
||||||
function build_file($user, $model, $datatoexport, $array_selected)
|
function build_file($user, $model, $datatoexport, $array_selected)
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
$indice=0;
|
$indice=0;
|
||||||
asort($array_selected);
|
asort($array_selected);
|
||||||
|
|
||||||
dol_syslog("Export::build_file $model, $datatoexport, $array_selected");
|
dol_syslog("Export::build_file $model, $datatoexport, $array_selected");
|
||||||
|
|
||||||
// Creation de la classe d'export du model ExportXXX
|
// Creation de la classe d'export du model ExportXXX
|
||||||
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/export/";
|
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/export/";
|
||||||
$file = "export_".$model.".modules.php";
|
$file = "export_".$model.".modules.php";
|
||||||
$classname = "Export".$model;
|
$classname = "Export".$model;
|
||||||
require_once($dir.$file);
|
require_once($dir.$file);
|
||||||
$objmodel = new $classname($db);
|
$objmodel = new $classname($db);
|
||||||
|
|
||||||
// Build the sql request
|
// Build the sql request
|
||||||
$sql=$this->array_export_sql_start[$indice];
|
$sql=$this->array_export_sql_start[$indice];
|
||||||
$i=0;
|
$i=0;
|
||||||
//print_r($array_selected);
|
//print_r($array_selected);
|
||||||
foreach ($this->array_export_alias[$indice] as $key => $value)
|
foreach ($this->array_export_alias[$indice] as $key => $value)
|
||||||
{
|
{
|
||||||
if (! array_key_exists($key, $array_selected)) continue; // Field not selected
|
if (! array_key_exists($key, $array_selected)) continue; // Field not selected
|
||||||
|
|
||||||
if ($i > 0) $sql.=', ';
|
if ($i > 0) $sql.=', ';
|
||||||
else $i++;
|
else $i++;
|
||||||
$newfield=$key.' as '.$value;
|
$newfield=$key.' as '.$value;
|
||||||
|
|
||||||
$sql.=$newfield;
|
$sql.=$newfield;
|
||||||
}
|
}
|
||||||
$sql.=$this->array_export_sql_end[$indice];
|
$sql.=$this->array_export_sql_end[$indice];
|
||||||
|
|
||||||
// Run the sql
|
// Run the sql
|
||||||
$this->sqlusedforexport=$sql;
|
$this->sqlusedforexport=$sql;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -492,14 +492,14 @@ if ($step == 3 && $datatoexport)
|
|||||||
print $objexport->array_export_module[0]->getName();
|
print $objexport->array_export_module[0]->getName();
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Lot de donn<EFBFBD>es <20> exporter
|
// Lot de donnees a exporter
|
||||||
print '<tr><td width="25%">'.$langs->trans("DatasetToExport").'</td>';
|
print '<tr><td width="25%">'.$langs->trans("DatasetToExport").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print img_object($objexport->array_export_module[0]->getName(),$objexport->array_export_icon[0]).' ';
|
print img_object($objexport->array_export_module[0]->getName(),$objexport->array_export_icon[0]).' ';
|
||||||
print $objexport->array_export_label[0];
|
print $objexport->array_export_label[0];
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Nbre champs export<EFBFBD>s
|
// Nbre champs exportes
|
||||||
print '<tr><td width="25%">'.$langs->trans("ExportedFields").'</td>';
|
print '<tr><td width="25%">'.$langs->trans("ExportedFields").'</td>';
|
||||||
$list='';
|
$list='';
|
||||||
foreach($array_selected as $code=>$value)
|
foreach($array_selected as $code=>$value)
|
||||||
|
|||||||
@ -66,7 +66,7 @@ class ModeleExports
|
|||||||
$i=0;
|
$i=0;
|
||||||
while (($file = readdir($handle))!==false)
|
while (($file = readdir($handle))!==false)
|
||||||
{
|
{
|
||||||
if (eregi("^export_(.*)\.modules\.php",$file,$reg))
|
if (eregi("^export_(.*)\.modules\.php$",$file,$reg))
|
||||||
{
|
{
|
||||||
$moduleid=$reg[1];
|
$moduleid=$reg[1];
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
|
* Copyright (C) 2008-2009 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -46,110 +47,113 @@ class modBanque extends DolibarrModules
|
|||||||
*/
|
*/
|
||||||
function modBanque($DB)
|
function modBanque($DB)
|
||||||
{
|
{
|
||||||
$this->db = $DB ;
|
global $conf;
|
||||||
$this->numero = 85 ;
|
|
||||||
|
|
||||||
$this->family = "financial";
|
$this->db = $DB ;
|
||||||
|
$this->numero = 85 ;
|
||||||
|
|
||||||
|
$this->family = "financial";
|
||||||
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
||||||
$this->name = eregi_replace('^mod','',get_class($this));
|
$this->name = eregi_replace('^mod','',get_class($this));
|
||||||
$this->description = "Gestion des comptes financiers de type Comptes bancaires ou postaux";
|
$this->description = "Gestion des comptes financiers de type Comptes bancaires ou postaux";
|
||||||
|
|
||||||
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
||||||
$this->version = 'dolibarr';
|
$this->version = 'dolibarr';
|
||||||
|
|
||||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||||
$this->special = 0;
|
$this->special = 0;
|
||||||
$this->picto='account';
|
$this->picto='account';
|
||||||
|
|
||||||
// Dépendances
|
// Dépendances
|
||||||
$this->depends = array();
|
$this->depends = array();
|
||||||
$this->requiredby = array("modComptabilite","modComptabiliteExpert");
|
$this->requiredby = array("modComptabilite","modComptabiliteExpert");
|
||||||
$this->conflictwith = array();
|
$this->conflictwith = array();
|
||||||
$this->langfiles = array("banks","compta","bills","companies");
|
$this->langfiles = array("banks","compta","bills","companies");
|
||||||
|
|
||||||
// Constantes
|
// Constantes
|
||||||
$this->const = array();
|
$this->const = array();
|
||||||
|
|
||||||
$this->dirs = array();
|
$this->dirs = array();
|
||||||
|
|
||||||
// Boites
|
// Boites
|
||||||
$this->boxes = array();
|
$this->boxes = array();
|
||||||
$this->boxes[0][1] = "box_comptes.php";
|
$this->boxes[0][1] = "box_comptes.php";
|
||||||
|
|
||||||
// Permissions
|
// Permissions
|
||||||
$this->rights = array();
|
$this->rights = array();
|
||||||
$this->rights_class = 'banque';
|
$this->rights_class = 'banque';
|
||||||
$r=0;
|
$r=0;
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = 111; // id de la permission
|
$this->rights[$r][0] = 111; // id de la permission
|
||||||
$this->rights[$r][1] = 'Lire les comptes bancaires'; // libelle de la permission
|
$this->rights[$r][1] = 'Lire les comptes bancaires'; // libelle de la permission
|
||||||
$this->rights[$r][2] = 'r'; // type de la permission (déprécié à ce jour)
|
$this->rights[$r][2] = 'r'; // type de la permission (déprécié à ce jour)
|
||||||
$this->rights[$r][3] = 1; // La permission est-elle une permission par défaut
|
$this->rights[$r][3] = 1; // La permission est-elle une permission par défaut
|
||||||
$this->rights[$r][4] = 'lire';
|
$this->rights[$r][4] = 'lire';
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = 112; // id de la permission
|
$this->rights[$r][0] = 112; // id de la permission
|
||||||
$this->rights[$r][1] = 'Creer/modifier montant/supprimer ecriture bancaire'; // libelle de la permission
|
$this->rights[$r][1] = 'Creer/modifier montant/supprimer ecriture bancaire'; // libelle de la permission
|
||||||
$this->rights[$r][2] = 'w'; // type de la permission (déprécié à ce jour)
|
$this->rights[$r][2] = 'w'; // type de la permission (déprécié à ce jour)
|
||||||
$this->rights[$r][3] = 0; // La permission est-elle une permission par défaut
|
$this->rights[$r][3] = 0; // La permission est-elle une permission par défaut
|
||||||
$this->rights[$r][4] = 'modifier';
|
$this->rights[$r][4] = 'modifier';
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = 113; // id de la permission
|
$this->rights[$r][0] = 113; // id de la permission
|
||||||
$this->rights[$r][1] = 'Configurer les comptes bancaires (creer, gerer categories)'; // libelle de la permission
|
$this->rights[$r][1] = 'Configurer les comptes bancaires (creer, gerer categories)'; // libelle de la permission
|
||||||
$this->rights[$r][2] = 'a'; // type de la permission (déprécié à ce jour)
|
$this->rights[$r][2] = 'a'; // type de la permission (déprécié à ce jour)
|
||||||
$this->rights[$r][3] = 0; // La permission est-elle une permission par défaut
|
$this->rights[$r][3] = 0; // La permission est-elle une permission par défaut
|
||||||
$this->rights[$r][4] = 'configurer';
|
$this->rights[$r][4] = 'configurer';
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = 114; // id de la permission
|
$this->rights[$r][0] = 114; // id de la permission
|
||||||
$this->rights[$r][1] = 'Rapprocher les ecritures bancaires'; // libelle de la permission
|
$this->rights[$r][1] = 'Rapprocher les ecritures bancaires'; // libelle de la permission
|
||||||
$this->rights[$r][2] = 'w'; // type de la permission (déprécié à ce jour)
|
$this->rights[$r][2] = 'w'; // type de la permission (déprécié à ce jour)
|
||||||
$this->rights[$r][3] = 0; // La permission est-elle une permission par défaut
|
$this->rights[$r][3] = 0; // La permission est-elle une permission par défaut
|
||||||
$this->rights[$r][4] = 'consolidate';
|
$this->rights[$r][4] = 'consolidate';
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = 115; // id de la permission
|
$this->rights[$r][0] = 115; // id de la permission
|
||||||
$this->rights[$r][1] = 'Exporter transactions et releves'; // libelle de la permission
|
$this->rights[$r][1] = 'Exporter transactions et releves'; // libelle de la permission
|
||||||
$this->rights[$r][2] = 'r'; // type de la permission (déprécié à ce jour)
|
$this->rights[$r][2] = 'r'; // type de la permission (déprécié à ce jour)
|
||||||
$this->rights[$r][3] = 0; // La permission est-elle une permission par défaut
|
$this->rights[$r][3] = 0; // La permission est-elle une permission par défaut
|
||||||
$this->rights[$r][4] = 'export';
|
$this->rights[$r][4] = 'export';
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = 116; // id de la permission
|
$this->rights[$r][0] = 116; // id de la permission
|
||||||
$this->rights[$r][1] = 'Virements entre comptes'; // libelle de la permission
|
$this->rights[$r][1] = 'Virements entre comptes'; // libelle de la permission
|
||||||
$this->rights[$r][2] = 'w'; // type de la permission (déprécié à ce jour)
|
$this->rights[$r][2] = 'w'; // type de la permission (déprécié à ce jour)
|
||||||
$this->rights[$r][3] = 0; // La permission est-elle une permission par défaut
|
$this->rights[$r][3] = 0; // La permission est-elle une permission par défaut
|
||||||
$this->rights[$r][4] = 'transfer';
|
$this->rights[$r][4] = 'transfer';
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = 117; // id de la permission
|
$this->rights[$r][0] = 117; // id de la permission
|
||||||
$this->rights[$r][1] = 'Gerer les envois de cheques'; // libelle de la permission
|
$this->rights[$r][1] = 'Gerer les envois de cheques'; // libelle de la permission
|
||||||
$this->rights[$r][2] = 'w'; // type de la permission (déprécié à ce jour)
|
$this->rights[$r][2] = 'w'; // type de la permission (déprécié à ce jour)
|
||||||
$this->rights[$r][3] = 0; // La permission est-elle une permission par défaut
|
$this->rights[$r][3] = 0; // La permission est-elle une permission par défaut
|
||||||
$this->rights[$r][4] = 'cheque';
|
$this->rights[$r][4] = 'cheque';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Exports
|
// Exports
|
||||||
//--------
|
//--------
|
||||||
$r=0;
|
$r=0;
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||||
$this->export_label[$r]='Ecritures bancaires et relevés';
|
$this->export_label[$r]='Ecritures bancaires et relevés';
|
||||||
$this->export_permission[$r]=array(array("banque","export"));
|
$this->export_permission[$r]=array(array("banque","export"));
|
||||||
$this->export_fields_array[$r]=array('b.rowid'=>'IdTransaction','ba.ref'=>'AccountRef','ba.label'=>'AccountLabel','b.datev'=>'DateValue','b.dateo'=>'DateOperation','b.label'=>'Label','b.num_chq'=>'ChequeOrTransferNumber','-b.amount'=>'Debit','b.amount'=>'Credit','b.num_releve'=>'AccountStatement','b.datec'=>"DateCreation","bu.url_id"=>"IdThirdParty","s.nom"=>"ThirdParty","s.code_compta"=>"CustomerAccountancyCode","s.code_compta_fournisseur"=>"SupplierAccountancyCode");
|
$this->export_fields_array[$r]=array('b.rowid'=>'IdTransaction','ba.ref'=>'AccountRef','ba.label'=>'AccountLabel','b.datev'=>'DateValue','b.dateo'=>'DateOperation','b.label'=>'Label','b.num_chq'=>'ChequeOrTransferNumber','-b.amount'=>'Debit','b.amount'=>'Credit','b.num_releve'=>'AccountStatement','b.datec'=>"DateCreation","bu.url_id"=>"IdThirdParty","s.nom"=>"ThirdParty","s.code_compta"=>"CustomerAccountancyCode","s.code_compta_fournisseur"=>"SupplierAccountancyCode");
|
||||||
$this->export_entities_array[$r]=array('b.rowid'=>'account','ba.ref'=>'account','ba.label'=>'account','b.datev'=>'account','b.dateo'=>'account','b.label'=>'account','b.num_chq'=>'account','-b.amount'=>'account','b.amount'=>'account','b.num_releve'=>'account','b.datec'=>"account","bu.url_id"=>"company","s.nom"=>"company","s.code_compta"=>"company","s.code_compta_fournisseur"=>"company");
|
$this->export_entities_array[$r]=array('b.rowid'=>'account','ba.ref'=>'account','ba.label'=>'account','b.datev'=>'account','b.dateo'=>'account','b.label'=>'account','b.num_chq'=>'account','-b.amount'=>'account','b.amount'=>'account','b.num_releve'=>'account','b.datec'=>"account","bu.url_id"=>"company","s.nom"=>"company","s.code_compta"=>"company","s.code_compta_fournisseur"=>"company");
|
||||||
$this->export_alias_array[$r]=array('b.rowid'=>'tran_id','ba.ref'=>'account_ref','ba.label'=>'account_label','b.datev'=>'datev','b.dateo'=>'dateo','b.label'=>'label','b.num_chq'=>'num','-b.amount'=>'debit','b.amount'=>'credit','b.num_releve'=>'numrel','b.datec'=>"datec","bu.url_id"=>"soc_id","s.nom"=>"thirdparty","s.code_compta"=>"customeracccode","s.code_compta_fournisseur"=>"supplieracccode");
|
$this->export_alias_array[$r]=array('b.rowid'=>'tran_id','ba.ref'=>'account_ref','ba.label'=>'account_label','b.datev'=>'datev','b.dateo'=>'dateo','b.label'=>'label','b.num_chq'=>'num','-b.amount'=>'debit','b.amount'=>'credit','b.num_releve'=>'numrel','b.datec'=>"datec","bu.url_id"=>"soc_id","s.nom"=>"thirdparty","s.code_compta"=>"customeracccode","s.code_compta_fournisseur"=>"supplieracccode");
|
||||||
$this->export_special_array[$r]=array('-b.amount'=>'NULLIFNEG','b.amount'=>'NULLIFNEG');
|
$this->export_special_array[$r]=array('-b.amount'=>'NULLIFNEG','b.amount'=>'NULLIFNEG');
|
||||||
|
|
||||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||||
$this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'bank_account as ba, '.MAIN_DB_PREFIX.'bank as b)';
|
$this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'bank_account as ba, '.MAIN_DB_PREFIX.'bank as b)';
|
||||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."bank_url as bu ON (bu.fk_bank = b.rowid AND bu.type = 'company')";
|
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."bank_url as bu ON (bu.fk_bank = b.rowid AND bu.type = 'company')";
|
||||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON bu.url_id = s.rowid';
|
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON bu.url_id = s.rowid';
|
||||||
$this->export_sql_end[$r] .=' WHERE ba.rowid=b.fk_account';
|
$this->export_sql_end[$r] .=' WHERE ba.rowid = b.fk_account';
|
||||||
|
$this->export_sql_end[$r] .=' AND ba.entity = '.$conf->entity;
|
||||||
$this->export_sql_end[$r] .=' ORDER BY b.datev, b.num_releve';
|
$this->export_sql_end[$r] .=' ORDER BY b.datev, b.num_releve';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,16 +164,16 @@ class modBanque extends DolibarrModules
|
|||||||
*/
|
*/
|
||||||
function init()
|
function init()
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
// Permissions
|
// Permissions
|
||||||
$this->remove();
|
$this->remove();
|
||||||
|
|
||||||
$sql = array();
|
$sql = array();
|
||||||
|
|
||||||
$this->dirs[0] = $conf->banque->dir_output;
|
$this->dirs[0] = $conf->banque->dir_output;
|
||||||
|
|
||||||
return $this->_init($sql);
|
return $this->_init($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user