diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 81adbcb266b..37497491299 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -1,8 +1,8 @@ +/* Copyright (C) 2013-2017 Olivier Geffroy * Copyright (C) 2013-2017 Florian Henry - * Copyright (C) 2013-2017 Alexandre Spangaro - * Copyright (C) 2017 Laurent Destailleur + * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2017 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,6 +33,8 @@ require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; $langs->load("accountancy"); +$langs->load("bills"); +$langs->load("compta"); // Security check $id = GETPOST('id', 'int'); @@ -40,7 +42,7 @@ if ($user->societe_id > 0) { accessforbidden(); } $action = GETPOST('action','aZ09'); -$mode = GETPOST('mode','aZ09'); // '' or 'tmp' +$mode = GETPOST('mode','aZ09'); // '' or 'tmp' $piece_num = GETPOST("piece_num"); $mesg = ''; @@ -72,16 +74,16 @@ if ($action == "confirm_update") { $error = 0; if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) { - $error++; - setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); - $action='update'; + $error++; + setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); + $action='update'; + } + if (empty($account_number) || $account_number == '-1') + { + $error++; + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors'); + $action='update'; } - if (empty($account_number) || $account_number == '-1') - { - $error++; - setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors'); - $action='update'; - } if (! $error) { @@ -89,7 +91,7 @@ if ($action == "confirm_update") { $result = $book->fetch($id, null, $mode); if ($result < 0) { - $error++; + $error++; setEventMessages($book->error, $book->errors, 'errors'); } else { $book->numero_compte = $account_number; @@ -112,13 +114,13 @@ if ($action == "confirm_update") { if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); } else { - if ($mode != '_tmp') - { - setEventMessages($langs->trans('Saved'), null, 'mesgs'); - } + if ($mode != '_tmp') + { + setEventMessages($langs->trans('Saved'), null, 'mesgs'); + } - $debit = 0; - $credit = 0; + $debit = 0; + $credit = 0; $action = ''; } @@ -132,14 +134,14 @@ else if ($action == "add") { if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) { $error++; - setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); - $action=''; + setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); + $action=''; } if (empty($account_number) || $account_number == '-1') { - $error++; - setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors'); - $action=''; + $error++; + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors'); + $action=''; } if (! $error) { @@ -175,7 +177,7 @@ else if ($action == "add") { } else { if ($mode != '_tmp') { - setEventMessages($langs->trans('Saved'), null, 'mesgs'); + setEventMessages($langs->trans('Saved'), null, 'mesgs'); } $debit = 0; @@ -209,9 +211,9 @@ else if ($action == "confirm_create") { $book = new BookKeeping($db); if (! GETPOST('code_journal') || GETPOST('code_journal') == '-1') { - setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Journal")), null, 'errors'); - $action='create'; - $error++; + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Journal")), null, 'errors'); + $action='create'; + $error++; } if (! GETPOST('next_num_mvt')) { @@ -237,10 +239,10 @@ else if ($action == "confirm_create") { if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); } else { - if ($mode != '_tmp') - { - setEventMessages($langs->trans('Saved'), null, 'mesgs'); - } + if ($mode != '_tmp') + { + setEventMessages($langs->trans('Saved'), null, 'mesgs'); + } $action = 'update'; $id=$book->id; $piece_num = $book->piece_num; @@ -254,10 +256,10 @@ if ($action == 'setdate') { if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } else { - if ($mode != '_tmp') - { - setEventMessages($langs->trans('Saved'), null, 'mesgs'); - } + if ($mode != '_tmp') + { + setEventMessages($langs->trans('Saved'), null, 'mesgs'); + } $action = ''; } } @@ -270,7 +272,7 @@ if ($action == 'setjournal') { } else { if ($mode != '_tmp') { - setEventMessages($langs->trans('Saved'), null, 'mesgs'); + setEventMessages($langs->trans('Saved'), null, 'mesgs'); } $action = ''; } @@ -284,7 +286,7 @@ if ($action == 'setdocref') { } else { if ($mode != '_tmp') { - setEventMessages($langs->trans('Saved'), null, 'mesgs'); + setEventMessages($langs->trans('Saved'), null, 'mesgs'); } $action = ''; } @@ -318,7 +320,8 @@ if ($action == 'delete') { print $formconfirm; } -if ($action == 'create') { +if ($action == 'create') +{ print load_fiche_titre($langs->trans("CreateMvts")); $book = new BookKeeping($db); @@ -359,17 +362,21 @@ if ($action == 'create') { print ''; print ''; + /* print ''; print '' . $langs->trans("Doctype") . ''; print ''; print ''; + */ print ''; dol_fiche_end(); - print '
'; - print '     '; + print '
'; + print ''; + print '     '; + print ''; print '
'; print ''; @@ -380,9 +387,9 @@ if ($action == 'create') { setEventMessages($book->error, $book->errors, 'errors'); } - if (! empty($book->piece_num)) { - - $backlink = '' . $langs->trans('BackToList') . ''; + if (! empty($book->piece_num)) + { + $backlink = '' . $langs->trans('BackToList') . ''; print load_fiche_titre($langs->trans("UpdateMvts"), $backlink); @@ -395,23 +402,21 @@ if ($action == 'create') { dol_fiche_head($head, 'transaction', '', -1); - //dol_banner_tab($book, '', $backlink); - print '
'; print '
'; print '
'; print ''; - // account movement + // Account movement print ''; print ''; print ''; print ''; - // date + // Date print '
' . $langs->trans("NumMvts") . '' . $book->piece_num . '
'; print ''; print ''; - //journal + + // Journal print '
'; print $langs->trans('Docdate'); @@ -429,11 +434,12 @@ if ($action == 'create') { print ''; print ''; } else { - print $book->doc_date ? dol_print_date($book->doc_date, 'daytext') : ' '; + print $book->doc_date ? dol_print_date($book->doc_date, 'daytext') : ' '; } print '
'; print ''; print ''; - //docref + + // Ref document print '
'; print $langs->trans('Codejournal'); @@ -455,7 +461,8 @@ if ($action == 'create') { } print '
'; print '
'; print $langs->trans('Docref'); @@ -488,9 +495,20 @@ if ($action == 'create') { print ''; // Doc type + if(! empty($book->doc_type)) + { + print ''; + print ''; + print ''; + print ''; + } + + // Date document creation print ''; - print ''; - print ''; + print ''; + print ''; print ''; // Validate @@ -542,7 +560,6 @@ if ($action == 'create') { print '
'; - $result = $book->fetchAllPerMvt($piece_num, $mode); if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); @@ -570,7 +587,7 @@ if ($action == 'create') { print_liste_field_titre("AccountAccountingShort"); print_liste_field_titre("SubledgerAccount"); print_liste_field_titre("LabelAccount"); - print_liste_field_titre("Label"); + print_liste_field_titre("LabelOperation"); print_liste_field_titre("Debit", "", "", "", "", 'align="right"'); print_liste_field_titre("Credit", "", "", "", "", 'align="right"'); print_liste_field_titre("Action", "", "", "", "", 'width="60" align="center"'); @@ -587,16 +604,16 @@ if ($action == 'create') { print $formaccounting->select_account($line->numero_compte, 'account_number', 1, array (), 1, 1, ''); print ''; print ''; print ''; print ''; @@ -644,14 +661,14 @@ if ($action == 'create') { print ''; print ''; print ''; @@ -665,15 +682,15 @@ if ($action == 'create') { if ($mode=='_tmp' && $action=='') { - print '
'; + print '
'; print '
'; if ($total_debit == $total_credit) { - print ''.$langs->trans("ValidTransaction").''; + print ''.$langs->trans("ValidTransaction").''; } else { - print ''; + print ''; } print '   '; diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index 9febf20505f..8c402d53705 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -79,6 +79,7 @@ AccountancyTreasuryArea=Accountancy/Treasury area NewPayment=New payment Payments=Payments PaymentCustomerInvoice=Customer invoice payment +PaymentSupplierInvoice=Supplier invoice payment PaymentSocialContribution=Social/fiscal tax payment PaymentVat=VAT payment ListPayment=List of payments
' . $langs->trans("Doctype") . '' . $book->doc_type . '
' . $langs->trans("Doctype") . '' . $book->doc_type . '' . $langs->trans("DateCreation") . ''; + print $book->date_creation ? dol_print_date($book->date_creation, 'daytext') : ' '; + print '
'; - // TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not - // use setup of keypress to select thirdparty and this hang browser on large database. - if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) - { - print $formaccounting->select_auxaccount($line->subledger_account, 'subledger_account', 1); - } - else - { - print ''; - } + // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not + // use setup of keypress to select thirdparty and this hang browser on large database. + if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) + { + print $formaccounting->select_auxaccount($line->subledger_account, 'subledger_account', 1); + } + else + { + print ''; + } print ''; // TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not // use setup of keypress to select thirdparty and this hang browser on large database. - if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) - { - print $formaccounting->select_auxaccount($subledger_account, 'subledger_account', 1); - } - else - { - print ''; - } + if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) + { + print $formaccounting->select_auxaccount($subledger_account, 'subledger_account', 1); + } + else + { + print ''; + } print '