Add option all to export
This commit is contained in:
parent
bd53218245
commit
0f1c4032ab
@ -63,7 +63,7 @@ print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
|
|||||||
dol_syslog($script_file." launched with arg ".join(',',$argv));
|
dol_syslog($script_file." launched with arg ".join(',',$argv));
|
||||||
|
|
||||||
if (! isset($argv[3]) || ! $argv[3]) {
|
if (! isset($argv[3]) || ! $argv[3]) {
|
||||||
print "Usage: ".$script_file." bank_ref bank_receipt_number (csv|tsv|excel|excel2007) [lang=xx_XX]\n";
|
print "Usage: ".$script_file." bank_ref [bank_receipt_number|all] (csv|tsv|excel|excel2007) [lang=xx_XX]\n";
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
$bankref=$argv[1];
|
$bankref=$argv[1];
|
||||||
@ -173,26 +173,31 @@ $array_export_TypeFields=array(
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// Recherche les ecritures pour le releve
|
// Build request to find records for a bank account/receipt
|
||||||
$listofnum="'";
|
$listofnum="";
|
||||||
$arraynum=explode(',',$num);
|
if (! empty($num) && $num != "all")
|
||||||
foreach($arraynum as $val)
|
|
||||||
{
|
{
|
||||||
|
$listofnum.="'";
|
||||||
|
$arraynum=explode(',',$num);
|
||||||
|
foreach($arraynum as $val)
|
||||||
|
{
|
||||||
if ($listofnum != "'") $listofnum.="','";
|
if ($listofnum != "'") $listofnum.="','";
|
||||||
$listofnum.=$val;
|
$listofnum.=$val;
|
||||||
|
}
|
||||||
|
$listofnum.="'";
|
||||||
}
|
}
|
||||||
$listofnum.="'";
|
|
||||||
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv,";
|
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv,";
|
||||||
$sql.= " b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type,";
|
$sql.= " b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type,";
|
||||||
$sql.= " ba.rowid as bankid, ba.ref as bankref, ba.label as banklabel";
|
$sql.= " ba.rowid as bankid, ba.ref as bankref, ba.label as banklabel";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba";
|
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."bank as b";
|
$sql.= ", ".MAIN_DB_PREFIX."bank as b";
|
||||||
$sql.= " WHERE b.num_releve IN (".$listofnum.")";
|
$sql.= " WHERE b.fk_account = ".$acct->id;
|
||||||
|
if ($listofnum) $sql.= " AND b.num_releve IN (".$listofnum.")";
|
||||||
if (!isset($num)) $sql.= " OR b.num_releve is null";
|
if (!isset($num)) $sql.= " OR b.num_releve is null";
|
||||||
$sql.= " AND b.fk_account = ".$acct->id;
|
|
||||||
$sql.= " AND b.fk_account = ba.rowid";
|
$sql.= " AND b.fk_account = ba.rowid";
|
||||||
$sql.= $db->order("b.num_releve, b.datev, b.datec", "ASC"); // We add date of creation to have correct order when everything is done the same day
|
$sql.= $db->order("b.num_releve, b.datev, b.datec", "ASC"); // We add date of creation to have correct order when everything is done the same day
|
||||||
//print $sql;
|
//print $sql;
|
||||||
|
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user