forked from Wavyzz/dolibarr
Fix: Export for bank module always export credit and devit instead of debit or credit
This commit is contained in:
@@ -187,16 +187,6 @@ class Export
|
|||||||
else $i++;
|
else $i++;
|
||||||
$newfield=$key.' as '.$value;
|
$newfield=$key.' as '.$value;
|
||||||
|
|
||||||
// Cas particulier
|
|
||||||
/* if ($this->array_export_module[$indice]->name == 'Banque')
|
|
||||||
{
|
|
||||||
// Cas special du debit et credit
|
|
||||||
if ($value=='credit' || $value=='debit')
|
|
||||||
{
|
|
||||||
$newfield='IF('.$key.'>0,'.$key.',NULL) as '.$value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
$sql.=$newfield;
|
$sql.=$newfield;
|
||||||
}
|
}
|
||||||
$sql.=$this->array_export_sql_end[$indice];
|
$sql.=$this->array_export_sql_end[$indice];
|
||||||
@@ -213,49 +203,57 @@ class Export
|
|||||||
|
|
||||||
// Open file
|
// Open file
|
||||||
create_exdir($dirname);
|
create_exdir($dirname);
|
||||||
$objmodel->open_file($dirname."/".$filename);
|
$result=$objmodel->open_file($dirname."/".$filename);
|
||||||
|
|
||||||
// Genere en-tete
|
if ($result >= 0)
|
||||||
$objmodel->write_header($langs);
|
|
||||||
|
|
||||||
// Genere ligne de titre
|
|
||||||
$objmodel->write_title($this->array_export_fields[$indice],$array_selected,$langs);
|
|
||||||
|
|
||||||
while ($objp = $this->db->fetch_object($resql))
|
|
||||||
{
|
{
|
||||||
$var=!$var;
|
// Genere en-tete
|
||||||
|
$objmodel->write_header($langs);
|
||||||
|
|
||||||
// Process special operations
|
// Genere ligne de titre
|
||||||
if (! empty($this->array_export_special[$indice]))
|
$objmodel->write_title($this->array_export_fields[$indice],$array_selected,$langs);
|
||||||
|
|
||||||
|
while ($objp = $this->db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
foreach ($this->array_export_special[$indice] as $key => $value)
|
$var=!$var;
|
||||||
{
|
|
||||||
if (! array_key_exists($key, $array_selected)) continue; // Field not selected
|
// Process special operations
|
||||||
// Operation NULLIFNEG
|
if (! empty($this->array_export_special[$indice]))
|
||||||
if ($this->array_export_special[$indice][$key]=='NULLIFNEG')
|
{
|
||||||
{
|
foreach ($this->array_export_special[$indice] as $key => $value)
|
||||||
$alias=$this->array_export_alias[$indice][$key];
|
{
|
||||||
if ($objp->$alias < 0) $objp->$alias='';
|
if (! array_key_exists($key, $array_selected)) continue; // Field not selected
|
||||||
}
|
// Operation NULLIFNEG
|
||||||
// Operation ZEROIFNEG
|
if ($this->array_export_special[$indice][$key]=='NULLIFNEG')
|
||||||
if ($this->array_export_special[$indice][$key]=='ZEROIFNEG')
|
{
|
||||||
{
|
$alias=$this->array_export_alias[$indice][$key];
|
||||||
$alias=$this->array_export_alias[$indice][$key];
|
if ($objp->$alias < 0) $objp->$alias='';
|
||||||
if ($objp->$alias < 0) $objp->$alias='0';
|
}
|
||||||
|
// Operation ZEROIFNEG
|
||||||
|
if ($this->array_export_special[$indice][$key]=='ZEROIFNEG')
|
||||||
|
{
|
||||||
|
$alias=$this->array_export_alias[$indice][$key];
|
||||||
|
if ($objp->$alias < 0) $objp->$alias='0';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
// end of special operation processing
|
||||||
// end of special operation processing
|
|
||||||
|
|
||||||
$objmodel->write_record($this->array_export_alias[$indice],$array_selected,$objp);
|
$objmodel->write_record($this->array_export_alias[$indice],$array_selected,$objp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Genere en-tete
|
// Genere en-tete
|
||||||
$objmodel->write_footer($langs);
|
$objmodel->write_footer($langs);
|
||||||
|
|
||||||
// Close file
|
|
||||||
$objmodel->close_file();
|
|
||||||
|
|
||||||
|
// Close file
|
||||||
|
$objmodel->close_file();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error=$objmodel->error;
|
||||||
|
dolibarr_syslog("Error: ".$this->error);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -97,11 +97,28 @@ class ExportCsv extends ModeleExports
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function open_file($file)
|
/**
|
||||||
|
* \brief Open output file
|
||||||
|
* \param file Path of filename
|
||||||
|
* \return int <0 if KO, >=0 if OK
|
||||||
|
*/
|
||||||
|
function open_file($file)
|
||||||
{
|
{
|
||||||
dolibarr_syslog("ExportCsv::open_file file=$file");
|
global $langs;
|
||||||
$this->handle = fopen($file, "wt");
|
dolibarr_syslog("ExportCsv::open_file file=".$file);
|
||||||
return 0;
|
|
||||||
|
$ret=1;
|
||||||
|
|
||||||
|
$langs->load("exports");
|
||||||
|
$this->handle = fopen($file, "wt");
|
||||||
|
if (! $this->handle)
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
$this->error=$langs->trans("ErrorFailToCreateFile",$file);
|
||||||
|
$ret=-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -104,18 +104,26 @@ class ExportExcel extends ModeleExports
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Open output file
|
||||||
|
* \param file Path of filename
|
||||||
|
* \return int <0 if KO, >=0 if OK
|
||||||
|
*/
|
||||||
function open_file($file)
|
function open_file($file)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
dolibarr_syslog("ExportExcel::open_file file=".$file);
|
||||||
|
|
||||||
|
$ret=1;
|
||||||
|
|
||||||
$langs->load("exports");
|
$langs->load("exports");
|
||||||
dolibarr_syslog("ExportExcel::open_file file=$file");
|
|
||||||
$this->workbook = &new writeexcel_workbookbig($file);
|
$this->workbook = &new writeexcel_workbookbig($file);
|
||||||
$this->workbook->set_sheetname($langs->trans("Sheet"));
|
$this->workbook->set_sheetname($langs->trans("Sheet"));
|
||||||
$this->worksheet = &$this->workbook->addworksheet();
|
$this->worksheet = &$this->workbook->addworksheet();
|
||||||
|
|
||||||
// $this->worksheet->set_column(0, 50, 18);
|
// $this->worksheet->set_column(0, 50, 18);
|
||||||
|
|
||||||
return 0;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
# Dolibarr language file - en_US - errors
|
# Dolibarr language file - en_US - errors
|
||||||
ErrorDuplicateTrigger=A trigger file with class nam '<b>%s</b>' is present sevaral times. Remove duplicate trigger file in directory '<b>%s</b>'.
|
ErrorDuplicateTrigger=A trigger file with class nam '<b>%s</b>' is present sevaral times. Remove duplicate trigger file in directory '<b>%s</b>'.
|
||||||
ErrorFailToDeleteFile=Failed to remove file '<b>%s</b>'.
|
ErrorFailToDeleteFile=Failed to remove file '<b>%s</b>'.
|
||||||
|
ErrorFailToCreateFile=Failed to create file '<b>%s</b>'.
|
||||||
ErrorThisContactIsAlreadyDefinedAsThisType=This contact is already defined as contact for this type.
|
ErrorThisContactIsAlreadyDefinedAsThisType=This contact is already defined as contact for this type.
|
||||||
ErrorCashAccountAcceptsOnlyCashMoney=This bank account is a cash account, so it accepts payments of type cash only.
|
ErrorCashAccountAcceptsOnlyCashMoney=This bank account is a cash account, so it accepts payments of type cash only.
|
||||||
ErrorFromToAccountsMustDiffers=Source and targets bank accounts must be different.
|
ErrorFromToAccountsMustDiffers=Source and targets bank accounts must be different.
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
# Dolibarr language file - fr_FR - errors
|
# Dolibarr language file - fr_FR - errors
|
||||||
ErrorDuplicateTrigger=Un fichier trigger de classe '<b>%s</b>' est present plusieurs fois. Supprimer le doublon du r<>pertoire '<b>%s</b>'.
|
ErrorDuplicateTrigger=Un fichier trigger de classe '<b>%s</b>' est present plusieurs fois. Supprimer le doublon du r<>pertoire '<b>%s</b>'.
|
||||||
|
ErrorFailToCreateFile=Echec de la cr<63>ation du fichier '<b>%s</b>'.
|
||||||
ErrorFailToDeleteFile=Echec de l'effacement du fichier '<b>%s</b>'.
|
ErrorFailToDeleteFile=Echec de l'effacement du fichier '<b>%s</b>'.
|
||||||
ErrorThisContactIsAlreadyDefinedAsThisType=Ce contact est d<>j<EFBFBD> d<>fini comme contact pour ce type.
|
ErrorThisContactIsAlreadyDefinedAsThisType=Ce contact est d<>j<EFBFBD> d<>fini comme contact pour ce type.
|
||||||
ErrorCashAccountAcceptsOnlyCashMoney=Ce compte bancaire est de type caisse et n'accepte que les mode de r<>glement de type <b>esp<73>ce</b>.
|
ErrorCashAccountAcceptsOnlyCashMoney=Ce compte bancaire est de type caisse et n'accepte que les mode de r<>glement de type <b>esp<73>ce</b>.
|
||||||
|
|||||||
Reference in New Issue
Block a user