diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 7293797ecc6..ba3c37f1997 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -18,9 +18,9 @@ */ /** - * \file htdocs/accountancy/bookkeeping/card.php - * \ingroup Advanced accountancy - * \brief Page to show book-entry + * \file htdocs/accountancy/bookkeeping/card.php + * \ingroup Advanced accountancy + * \brief Page to show book-entry */ require '../../main.inc.php'; @@ -62,17 +62,17 @@ if (! empty($update)) { } if ($action == "confirm_update") { - + $error = 0; - + if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) { setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); $error ++; } - + if (empty($error)) { $book = new BookKeeping($db); - + $result = $book->fetch($id); if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); @@ -82,7 +82,7 @@ if ($action == "confirm_update") { $book->label_compte = $label_compte; $book->debit = $debit; $book->credit = $credit; - + if (floatval($debit) != 0.0) { $book->montant = $debit; $book->sens = 'D'; @@ -91,7 +91,7 @@ if ($action == "confirm_update") { $book->montant = $credit; $book->sens = 'C'; } - + $result = $book->update($user); if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); @@ -101,19 +101,19 @@ if ($action == "confirm_update") { } } } -} +} else if ($action == "add") { $error = 0; - + if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) { setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); $error ++; } - + if (empty($error)) { $book = new BookKeeping($db); - + $book->numero_compte = $account_number; $book->code_tiers = $code_tiers; $book->label_compte = $label_compte; @@ -126,17 +126,17 @@ else if ($action == "add") { $book->code_journal = GETPOST('code_journal'); $book->fk_doc = GETPOST('fk_doc'); $book->fk_docdet = GETPOST('fk_docdet'); - + if (floatval($debit) != 0.0) { $book->montant = $debit; $book->sens = 'D'; } - + if (floatval($credit) != 0.0) { $book->montant = $credit; $book->sens = 'C'; } - + $result = $book->createStd($user); if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); @@ -145,15 +145,15 @@ else if ($action == "add") { $action = ''; } } -} +} else if ($action == "confirm_delete") { $book = new BookKeeping($db); - + $result = $book->fetch($id); - + $piece_num = $book->piece_num; - + if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); } else { @@ -163,11 +163,11 @@ else if ($action == "confirm_delete") { } } $action = ''; -} +} else if ($action == "confirm_create") { $book = new BookKeeping($db); - + $book->label_compte = ''; $book->debit = 0; $book->credit = 0; @@ -178,9 +178,9 @@ else if ($action == "confirm_create") { $book->code_journal = GETPOST('code_journal'); $book->fk_doc = 0; $book->fk_docdet = 0; - + $book->montant = 0; - + $result = $book->createStd($user); if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); @@ -209,15 +209,15 @@ if ($action == 'delete') { if ($action == 'create') { print load_fiche_titre($langs->trans("CreateMvts")); - + $code_journal_array = array ( $conf->global->ACCOUNTING_SELL_JOURNAL => $conf->global->ACCOUNTING_SELL_JOURNAL, $conf->global->ACCOUNTING_PURCHASE_JOURNAL => $conf->global->ACCOUNTING_PURCHASE_JOURNAL, $conf->global->ACCOUNTING_SOCIAL_JOURNAL => $conf->global->ACCOUNTING_SOCIAL_JOURNAL, $conf->global->ACCOUNTING_MISCELLANEOUS_JOURNAL => $conf->global->ACCOUNTING_MISCELLANEOUS_JOURNAL, - $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL => $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL + $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL => $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL ); - + $sql = 'SELECT DISTINCT accountancy_journal FROM ' . MAIN_DB_PREFIX . 'bank_account WHERE clos=0'; $resql = $db->query($sql); if (! $resql) { @@ -229,52 +229,52 @@ if ($action == 'create') { } } } - + $book = new BookKeeping($db); $next_num_mvt = $book->getNextNumMvt(); - + print '
'; } else { $book = new BookKeeping($db); @@ -283,9 +283,9 @@ if ($action == 'create') { setEventMessages($book->error, $book->errors, 'errors'); } if (! empty($book->piece_num)) { - + print load_fiche_titre($langs->trans("UpdateMvts"), '' . $langs->trans('BackToList') . ''); - + print '| ' . $langs->trans("NumMvts") . ' | '; @@ -309,14 +309,14 @@ if ($action == 'create') { print '