Bad place of code

This commit is contained in:
Laurent Destailleur 2014-09-29 16:22:00 +02:00
parent ba33f73767
commit cb302c16e7

View File

@ -137,17 +137,19 @@ if ($result) {
$tabpay = array (); $tabpay = array ();
$tabbq = array (); $tabbq = array ();
$tabtp = array (); $tabtp = array ();
$tabcompany[$obj->rowid] = array (
'id' => $obj->socid,
'name' => $obj->name,
'code_client' => $obj->code_compta
);
$tabtype = array (); $tabtype = array ();
$i = 0; $i = 0;
while ( $i < $num ) { while ( $i < $num )
{
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$tabcompany[$obj->rowid] = array(
'id' => $obj->socid,
'name' => $obj->name,
'code_client' => $obj->code_compta
);
// Controls // Controls
$compta_bank = $obj->account_number; $compta_bank = $obj->account_number;
if ($obj->label == '(SupplierInvoicePayment)') if ($obj->label == '(SupplierInvoicePayment)')
@ -169,8 +171,8 @@ if ($result) {
} }
$links = $object->get_url($obj->rowid); $links = $object->get_url($obj->rowid);
foreach ( $links as $key => $val ) { foreach ( $links as $key => $val )
{
$tabtype[$obj->rowid] = $links[$key]['type']; $tabtype[$obj->rowid] = $links[$key]['type'];
if ($links[$key]['type'] == 'payment') if ($links[$key]['type'] == 'payment')
@ -259,14 +261,17 @@ if ($result) {
/* /*
* Actions * Actions
*/ */
// Write bookkeeping // Write bookkeeping
if ($action == 'writeBookKeeping') { if ($action == 'writeBookKeeping')
{
$error = 0; $error = 0;
foreach ( $tabpay as $key => $val ) { foreach ( $tabpay as $key => $val )
{
// Bank // Bank
foreach ( $tabbq[$key] as $k => $mt ) { foreach ( $tabbq[$key] as $k => $mt )
{
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
$bookkeeping->doc_ref = $val["ref"]; $bookkeeping->doc_ref = $val["ref"];
@ -317,8 +322,8 @@ if ($action == 'writeBookKeeping') {
} }
} }
// Third party // Third party
foreach ( $tabtp[$key] as $k => $mt ) { foreach ( $tabtp[$key] as $k => $mt )
{
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
$bookkeeping->doc_ref = $val["ref"]; $bookkeeping->doc_ref = $val["ref"];
@ -399,7 +404,8 @@ if ($action == 'writeBookKeeping') {
} }
} }
// export csv // export csv
if ($action == 'export_csv') { if ($action == 'export_csv')
{
$sep = $conf->global->ACCOUNTING_SEPARATORCSV; $sep = $conf->global->ACCOUNTING_SEPARATORCSV;
header('Content-Type: text/csv'); header('Content-Type: text/csv');
@ -482,7 +488,9 @@ if ($action == 'export_csv') {
} }
} }
} }
} else { }
else
{
$form = new Form($db); $form = new Form($db);
@ -580,4 +588,5 @@ if ($action == 'export_csv') {
// End of page // End of page
llxFooter(); llxFooter();
} }
$db->close(); $db->close();