New: Accountancy Add message when general ledger is witten

This commit is contained in:
aspangaro 2015-09-06 06:43:40 +02:00
parent b268ccf064
commit a4a72d64c0
4 changed files with 43 additions and 8 deletions

View File

@ -402,7 +402,7 @@ if ($action == 'writeBookKeeping')
} }
if (empty($error)) { if (empty($error)) {
setEventMessage($langs->trans('Success'), 'mesgs'); setEventMessage($langs->trans("GeneralLedgerIsWritten"),'mesgs');
} }
} }
// Export // Export

View File

@ -157,6 +157,7 @@ if ($result) {
// Bookkeeping Write // Bookkeeping Write
if ($action == 'writebookkeeping') { if ($action == 'writebookkeeping') {
$now = dol_now(); $now = dol_now();
$error = 0;
foreach ( $tabfac as $key => $val ) { foreach ( $tabfac as $key => $val ) {
foreach ( $tabttc[$key] as $k => $mt ) { foreach ( $tabttc[$key] as $k => $mt ) {
@ -179,7 +180,11 @@ if ($action == 'writebookkeeping') {
$bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL; $bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$bookkeeping->create(); $result = $bookkeeping->create();
if ($result < 0) {
$error ++;
setEventMessage($object->errors, 'errors');
}
} }
// Product / Service // Product / Service
@ -205,7 +210,11 @@ if ($action == 'writebookkeeping') {
$bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL; $bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$bookkeeping->create(); $result = $bookkeeping->create();
if ($result < 0) {
$error ++;
setEventMessage($object->errors, 'errors');
}
} }
} }
} }
@ -232,12 +241,20 @@ if ($action == 'writebookkeeping') {
$bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL; $bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$bookkeeping->create(); $result = $bookkeeping->create();
if ($result < 0) {
$error ++;
setEventMessage($object->errors, 'errors');
} }
} }
} }
} }
if (empty($error)) {
setEventMessage($langs->trans("GeneralLedgerIsWritten"),'mesgs');
}
}
/* /*
* View * View

View File

@ -170,6 +170,7 @@ if ($result) {
// Bookkeeping Write // Bookkeeping Write
if ($action == 'writebookkeeping') { if ($action == 'writebookkeeping') {
$now = dol_now(); $now = dol_now();
$error = 0;
foreach ( $tabfac as $key => $val ) { foreach ( $tabfac as $key => $val ) {
foreach ( $tabttc[$key] as $k => $mt ) { foreach ( $tabttc[$key] as $k => $mt ) {
@ -190,7 +191,11 @@ if ($action == 'writebookkeeping') {
$bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL; $bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$bookkeeping->create(); $result = $bookkeeping->create();
if ($result < 0) {
$error ++;
setEventMessage($object->errors, 'errors');
}
} }
// Product / Service // Product / Service
@ -216,7 +221,11 @@ if ($action == 'writebookkeeping') {
$bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL; $bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$bookkeeping->create(); $result = $bookkeeping->create();
if ($result < 0) {
$error ++;
setEventMessage($object->errors, 'errors');
}
} }
} }
} }
@ -242,11 +251,19 @@ if ($action == 'writebookkeeping') {
$bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL; $bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$bookkeeping->create(); $result = $bookkeeping->create();
if ($result < 0) {
$error ++;
setEventMessage($object->errors, 'errors');
} }
} }
} }
} }
if (empty($error)) {
setEventMessage($langs->trans("GeneralLedgerIsWritten"),'mesgs');
}
}
// Export // Export
if ($action == 'export_csv') { if ($action == 'export_csv') {
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;

View File

@ -158,3 +158,4 @@ ValidateHistory=Validate Automatically
ErrorAccountancyCodeIsAlreadyUse=Error, you cannot delete this accounting account because it is used ErrorAccountancyCodeIsAlreadyUse=Error, you cannot delete this accounting account because it is used
FicheVentilation=Breakdown card FicheVentilation=Breakdown card
GeneralLedgerIsWritten=Operations are written in the general ledger