mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-11 12:01:23 +01:00
New: Ajout fonction export des relevs et transactions bancaires
This commit is contained in:
@@ -174,6 +174,8 @@ class Export
|
|||||||
|
|
||||||
// Execute requete export
|
// Execute requete export
|
||||||
$sql=$this->array_export_sql[$indice];
|
$sql=$this->array_export_sql[$indice];
|
||||||
|
|
||||||
|
dolibarr_syslog("Export::build_file sql=".$sql);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ $entitytoicon=array(
|
|||||||
'order'=>'order' ,'order_line'=>'order',
|
'order'=>'order' ,'order_line'=>'order',
|
||||||
'member'=>'user' ,'member_type'=>'group','subscription'=>'payment',
|
'member'=>'user' ,'member_type'=>'group','subscription'=>'payment',
|
||||||
'tax'=>'generic' ,'tax_type'=>'generic',
|
'tax'=>'generic' ,'tax_type'=>'generic',
|
||||||
|
'account'=>'account',
|
||||||
'payment'=>'payment');
|
'payment'=>'payment');
|
||||||
$entitytolang=array(
|
$entitytolang=array(
|
||||||
'user'=>'User',
|
'user'=>'User',
|
||||||
@@ -51,6 +52,7 @@ $entitytolang=array(
|
|||||||
'order'=>'Order','order_line'=>'OrderLine',
|
'order'=>'Order','order_line'=>'OrderLine',
|
||||||
'member'=>'Member','member_type'=>'MemberType','subscription'=>'Subscription',
|
'member'=>'Member','member_type'=>'MemberType','subscription'=>'Subscription',
|
||||||
'tax'=>'SocialContribution','tax_type'=>'DictionnarySocialContributions',
|
'tax'=>'SocialContribution','tax_type'=>'DictionnarySocialContributions',
|
||||||
|
'account'=>'BankTransactions',
|
||||||
'payment'=>'Payment');
|
'payment'=>'Payment');
|
||||||
|
|
||||||
$array_selected=isset($_SESSION["export_selected_fields"])?$_SESSION["export_selected_fields"]:array();
|
$array_selected=isset($_SESSION["export_selected_fields"])?$_SESSION["export_selected_fields"]:array();
|
||||||
|
|||||||
@@ -127,15 +127,26 @@ class ExportCsv extends ModeleExports
|
|||||||
|
|
||||||
function write_record($array_alias,$array_selected_sorted,$objp)
|
function write_record($array_alias,$array_selected_sorted,$objp)
|
||||||
{
|
{
|
||||||
foreach($array_selected_sorted as $code => $value)
|
global $langs;
|
||||||
|
|
||||||
|
$this->col=0;
|
||||||
|
foreach($array_selected_sorted as $code => $value)
|
||||||
{
|
{
|
||||||
$alias=$array_alias[$code];
|
$alias=$array_alias[$code];
|
||||||
//print "dd".$alias;
|
$newvalue=$objp->$alias;
|
||||||
$newvalue=ereg_replace(';',',',clean_html($objp->$alias));
|
// Nettoyage newvalue
|
||||||
|
$newvalue=ereg_replace(';',',',clean_html($newvalue));
|
||||||
$newvalue=ereg_replace("\r",'',$newvalue);
|
$newvalue=ereg_replace("\r",'',$newvalue);
|
||||||
$newvalue=ereg_replace("\n",'\n',$newvalue);
|
$newvalue=ereg_replace("\n",'\n',$newvalue);
|
||||||
fwrite($this->handle,$newvalue.";");
|
// Traduction newvalue
|
||||||
}
|
if (eregi('^\((.*)\)$',$newvalue,$reg))
|
||||||
|
{
|
||||||
|
$newvalue=$langs->transnoentities($reg[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
fwrite($this->handle,$newvalue.";");
|
||||||
|
$this->col++;
|
||||||
|
}
|
||||||
fwrite($this->handle,"\n");
|
fwrite($this->handle,"\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,12 +143,22 @@ class ExportExcel extends ModeleExports
|
|||||||
|
|
||||||
function write_record($array_alias,$array_selected_sorted,$objp)
|
function write_record($array_alias,$array_selected_sorted,$objp)
|
||||||
{
|
{
|
||||||
|
global $langs;
|
||||||
|
|
||||||
$this->col=0;
|
$this->col=0;
|
||||||
foreach($array_selected_sorted as $code => $value)
|
foreach($array_selected_sorted as $code => $value)
|
||||||
{
|
{
|
||||||
$alias=$array_alias[$code];
|
$alias=$array_alias[$code];
|
||||||
//print "dd".$alias;
|
$newvalue=$objp->$alias;
|
||||||
$this->worksheet->write($this->row, $this->col, clean_html($objp->$alias));
|
// Nettoyage newvalue
|
||||||
|
$newvalue=clean_html($newvalue);
|
||||||
|
// Traduction newvalue
|
||||||
|
if (eregi('^\((.*)\)$',$newvalue,$reg))
|
||||||
|
{
|
||||||
|
$newvalue=$langs->transnoentities($reg[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->worksheet->write($this->row, $this->col, $newvalue);
|
||||||
$this->col++;
|
$this->col++;
|
||||||
}
|
}
|
||||||
$this->row++;
|
$this->row++;
|
||||||
|
|||||||
@@ -111,6 +111,46 @@ class modBanque extends DolibarrModules
|
|||||||
$this->rights[$r][2] = 'w'; // type de la permission (d<>pr<70>ci<63> <20> ce jour)
|
$this->rights[$r][2] = 'w'; // type de la permission (d<>pr<70>ci<63> <20> 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++;
|
||||||
|
$this->rights[$r][0] = 115; // id de la permission
|
||||||
|
$this->rights[$r][1] = 'Exporter transactions et relev<65>s'; // libelle de la permission
|
||||||
|
$this->rights[$r][2] = 'r'; // type de la permission (d<>pr<70>ci<63> <20> ce jour)
|
||||||
|
$this->rights[$r][3] = 0; // La permission est-elle une permission par d<>faut
|
||||||
|
$this->rights[$r][4] = 'export';
|
||||||
|
|
||||||
|
|
||||||
|
// Exports
|
||||||
|
//--------
|
||||||
|
$r=0;
|
||||||
|
|
||||||
|
$r++;
|
||||||
|
$this->export_code[$r]=$this->id.'_'.$r;
|
||||||
|
$this->export_label[$r]='Ecritures bancaires et relev<65>s';
|
||||||
|
$this->export_fields_array[$r]=array('b.datev'=>'DateValue','b.dateo'=>'DateOperation','b.label'=>'Label','-b.amount'=>'Debit','b.amount'=>'Credit','b.num_releve'=>'AccountStatement','b.datec'=>"DateCreation");
|
||||||
|
$this->export_entities_array[$r]=array('b.datev'=>'account','b.dateo'=>'account','b.label'=>'account','-b.amount'=>'account','b.amount'=>'account','b.num_releve'=>'account','b.datec'=>"account");
|
||||||
|
$this->export_alias_array[$r]=array('b.datev'=>'datev','b.dateo'=>'dateo','b.label'=>'label','-b.amount'=>'debit','b.amount'=>'credit','b.num_releve'=>'numrel','b.datec'=>"datec");
|
||||||
|
$this->export_sql[$r]="select distinct ";
|
||||||
|
$i=0;
|
||||||
|
foreach ($this->export_alias_array[$r] as $key => $value)
|
||||||
|
{
|
||||||
|
if ($i > 0) $this->export_sql[$r].=', ';
|
||||||
|
else $i++;
|
||||||
|
// Cas special du debit et credit
|
||||||
|
if ($value=='credit' || $value=='debit')
|
||||||
|
{
|
||||||
|
$this->export_sql[$r].='IF('.$key.'>0,'.$key.',NULL) as '.$value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->export_sql[$r].=$key.' as '.$value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->export_sql[$r].=' from '.MAIN_DB_PREFIX.'bank as b';
|
||||||
|
//$this->export_sql[$r].=' LEFT JOIN '.MAIN_DB_PREFIX.'bank_url as but ON but.fk_bank = b.rowid';
|
||||||
|
$this->export_sql[$r].=' ORDER BY b.datev';
|
||||||
|
$this->export_permission[$r]=array(array("banque","export"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ DeleteAccount=Delete account
|
|||||||
ConfirmDeleteAccount=Are you sure you want to delete this account ?
|
ConfirmDeleteAccount=Are you sure you want to delete this account ?
|
||||||
Account=Account
|
Account=Account
|
||||||
ByCategories=By categories
|
ByCategories=By categories
|
||||||
|
BankTransactions=Bank transactions
|
||||||
SearchTransaction=Search transaction
|
SearchTransaction=Search transaction
|
||||||
TransactionsToConciliate=Transactions to conciliate
|
TransactionsToConciliate=Transactions to conciliate
|
||||||
Conciliable=Conciliable
|
Conciliable=Conciliable
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ DeleteAccount=Suppression de compte
|
|||||||
ConfirmDeleteAccount=Etes-vous sur de vouloir supprimer ce compte ?
|
ConfirmDeleteAccount=Etes-vous sur de vouloir supprimer ce compte ?
|
||||||
Account=Compte
|
Account=Compte
|
||||||
ByCategories=Par cat<61>gories
|
ByCategories=Par cat<61>gories
|
||||||
|
BankTransactions=Transactions bancaires
|
||||||
SearchTransaction=Recherche <20>criture
|
SearchTransaction=Recherche <20>criture
|
||||||
TransactionsToConciliate=Ecritures <20> rapprocher
|
TransactionsToConciliate=Ecritures <20> rapprocher
|
||||||
Conciliable=Rapprochable
|
Conciliable=Rapprochable
|
||||||
|
|||||||
Reference in New Issue
Block a user