diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 9be65e7261a..c6d84ec9b57 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -2,6 +2,7 @@ /* Copyright (C) 2013-2017 Olivier Geffroy * Copyright (C) 2013-2017 Florian Henry * 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 @@ -16,13 +17,14 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + /** * \file htdocs/accountancy/bookkeeping/card.php * \ingroup Advanced accountancy * \brief Page to show book-entry */ -require '../../main.inc.php'; +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; @@ -38,7 +40,7 @@ if ($user->societe_id > 0) { accessforbidden(); } $action = GETPOST('action','aZ09'); -$mode = GETPOST('mode'); +$mode = GETPOST('mode','aZ09'); // '' or 'tmp' $piece_num = GETPOST("piece_num"); $mesg = ''; @@ -53,15 +55,18 @@ $label_operation= GETPOST('label_operation'); $debit = price2num(GETPOST('debit')); $credit = price2num(GETPOST('credit')); -$save = GETPOST('save'); -if (! empty($save)) { - $action = 'add'; -} -$update = GETPOST('update'); -if (! empty($update)) { - $action = 'confirm_update'; -} +$save = GETPOST('save','alpha'); +if (! empty($save)) $action = 'add'; +$update = GETPOST('update','alpha'); +if (! empty($update)) $action = 'confirm_update'; + $object = new BookKeeping($db); + + +/* + * Actions + */ + if ($action == "confirm_update") { $error = 0; @@ -98,7 +103,14 @@ if ($action == "confirm_update") { if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); } else { - setEventMessages($langs->trans('Saved'), null, 'mesgs'); + if ($mode != '_tmp') + { + setEventMessages($langs->trans('Saved'), null, 'mesgs'); + } + + $debit = 0; + $credit = 0; + $action = ''; } } @@ -108,7 +120,7 @@ if ($action == "confirm_update") { else if ($action == "add") { $error = 0; - if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) { + if (empty($debit) && empty($credit)) { setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); $error ++; } @@ -144,7 +156,14 @@ else if ($action == "add") { if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); } else { - setEventMessages($langs->trans('Saved'), null, 'mesgs'); + if ($mode != '_tmp') + { + setEventMessages($langs->trans('Saved'), null, 'mesgs'); + } + + $debit = 0; + $credit = 0; + $action = ''; } } @@ -172,6 +191,11 @@ 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++; + } if (! GETPOST('next_num_mvt')) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NumPiece")), null, 'errors'); @@ -196,7 +220,10 @@ else if ($action == "confirm_create") { if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); } else { - 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; @@ -210,39 +237,43 @@ if ($action == 'setdate') { if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } else { - setEventMessages($langs->trans('Saved'), null, 'mesgs'); + if ($mode != '_tmp') + { + setEventMessages($langs->trans('Saved'), null, 'mesgs'); + } $action = ''; } } if ($action == 'setjournal') { $journaldoc = trim(GETPOST('code_journal')); - if (!empty($journaldoc)) { - $journaldoc='\''.$journaldoc.'\''; - } $result = $object->updateByMvt($piece_num,'code_journal',$journaldoc,$mode); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } else { - setEventMessages($langs->trans('Saved'), null, 'mesgs'); + if ($mode != '_tmp') + { + setEventMessages($langs->trans('Saved'), null, 'mesgs'); + } $action = ''; } } if ($action == 'setdocref') { $refdoc = trim(GETPOST('doc_ref')); - if (!empty($refdoc)) { - $refdoc='\''.$refdoc.'\''; - } - $result = $object->updateByMvt(doc_ref,'code_journal',$refdoc,$mode); + $result = $object->updateByMvt($piece_num,'doc_ref',$refdoc,$mode); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } else { - setEventMessages($langs->trans('Saved'), null, 'mesgs'); + if ($mode != '_tmp') + { + setEventMessages($langs->trans('Saved'), null, 'mesgs'); + } $action = ''; } } +// Validate transaction if ($action == 'valid') { $result = $object->transformTransaction(0,$piece_num); if ($result < 0) { @@ -253,14 +284,17 @@ if ($action == 'valid') { } } + /* * View */ -llxHeader(); + $html = new Form($db); $formaccounting = new FormAccounting($db); $accountjournal = new AccountingJournal($db); +llxHeader('', $langs->trans("CreateMvts")); + // Confirmation to delete the command if ($action == 'delete') { $formconfirm = $html->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $id.'&mode='. $mode, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'confirm_delete', '', 0, 1); @@ -300,7 +334,7 @@ if ($action == 'create') { print ''; print '' . $langs->trans("Codejournal") . ''; - print '' . $formaccounting->select_journal(GETPOST('code_journal'),'code_journal',0,0,array(),1,1) . ''; + print '' . $formaccounting->select_journal(GETPOST('code_journal'),'code_journal',0,1,array(),1,1) . ''; print ''; print ''; @@ -328,29 +362,45 @@ if ($action == 'create') { if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); } + if (! empty($book->piece_num)) { - print load_fiche_titre($langs->trans("UpdateMvts"), '' . $langs->trans('BackToList') . ''); + $backlink = '' . $langs->trans('BackToList') . ''; - dol_fiche_head(); + print load_fiche_titre($langs->trans("UpdateMvts"), $backlink); + $head=array(); + $h=0; + $head[$h][0] = $_SERVER['PHP_SELF'].'?piece_num='.$book->piece_num.($mode?'&mode='.$mode:''); + $head[$h][1] = $langs->trans("Transaction"); + $head[$h][2] = 'transaction'; + $h++; + + dol_fiche_head($head, 'transaction', '', -1); + + + //dol_banner_tab($book, '', $backlink); + + + print '
'; print '
'; + print '
'; - print ''; + print '
'; // account movement - print ''; + print ''; print ''; print ''; print ''; // date - print ''; print ''; //journal - print ''; print ''; //docref - print ''; print ''; - //doctype - print ''; - print ''; - print ''; - print ''; + print '
' . $langs->trans("NumMvts") . '' . $book->piece_num . '
'; + print '
'; print ''; if ($action != 'editdate') - print 'piece_num .'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('SetDate'),1).''; + print ''; print '
'; print $langs->trans('Docdate'); print 'piece_num .'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('SetDate'),1).'
'; print '
'; if ($action == 'editdate') { @@ -361,18 +411,18 @@ if ($action == 'create') { $form->select_date($book->doc_date ? $book->doc_date : - 1, 'doc_date', '', '', '', "setdate"); print ''; print ''; - } else { - print $book->doc_date ? dol_print_date($book->doc_date, 'daytext') : ' '; + } else { + print $book->doc_date ? dol_print_date($book->doc_date, 'daytext') : ' '; } print '
'; + print '
'; print ''; if ($action != 'editjournal') - print 'piece_num.'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).''; + print ''; print '
'; print $langs->trans('Codejournal'); print 'piece_num.'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).'
'; print '
'; if ($action == 'editjournal') { @@ -389,12 +439,12 @@ if ($action == 'create') { print '
'; + print '
'; print ''; if ($action != 'editdocref') - print 'piece_num.'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).''; + print ''; print '
'; print $langs->trans('Docref'); print 'piece_num.'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).'
'; print '
'; if ($action == 'editdocref') { @@ -410,21 +460,25 @@ if ($action == 'create') { } print '
' . $langs->trans("Doctype") . '' . $book->doc_type . '
'; print '
'; print '
'; + print '
'; print ''; + // Doc type + print ''; + print ''; + print ''; + print ''; + // Validate - print ''; + /* + print ''; print ''; print ''; print ''; + */ + // check data - print ''; - print ''; /* + print ''; + print ''; if ($book->doc_type == 'customer_invoice') { $sqlmid = 'SELECT rowid as ref'; @@ -457,14 +513,19 @@ if ($action == 'create') { } else dol_print_error($db); } - */ print ''; + print ''; + */ print "
' . $langs->trans("Doctype") . '' . $book->doc_type . '
' . $langs->trans("Status") . ''; if (empty($book->validated)) { @@ -438,10 +492,12 @@ if ($action == 'create') { } print '
' . $langs->trans("Control") . '
' . $langs->trans("Control") . '' . $ref .'
\n"; - print '
'; + print '
'; + print ''; + print '
'; + print '
'; + $result = $book->fetchAllPerMvt($piece_num, $mode); if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); @@ -490,11 +551,11 @@ if ($action == 'create') { print ''; print_liste_field_titre($langs->trans("AccountAccountingShort")); - print_liste_field_titre($langs->trans("Subledger_account")); + print_liste_field_titre($langs->trans("SubledgerAccount")); print_liste_field_titre($langs->trans("Labelcompte")); - print_liste_field_titre($langs->trans("Labeloperation")); - print_liste_field_titre($langs->trans("Debit"), "", "", "", "", 'align="center"'); - print_liste_field_titre($langs->trans("Credit"), "", "", "", "", 'align="center"'); + print_liste_field_titre($langs->trans("Label")); + print_liste_field_titre($langs->trans("Debit"), "", "", "", "", 'align="right"'); + print_liste_field_titre($langs->trans("Credit"), "", "", "", "", 'align="right"'); print_liste_field_titre($langs->trans("Action"), "", "", "", "", 'width="60" align="center"'); print "\n"; @@ -509,7 +570,16 @@ if ($action == 'create') { print $formaccounting->select_account($line->numero_compte, 'account_number', 0, array (), 1, 1, ''); print ''; print ''; - print $formaccounting->select_auxaccount($line->subledger_account, 'subledger_account', 1); + // 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 ''; + } print ''; print ''; print ''; @@ -528,10 +598,14 @@ if ($action == 'create') { print '' . price($line->credit) . ''; print ''; - print 'id . '&piece_num=' . $line->piece_num . '&mode='.$mode.'">'; + print 'id . '&piece_num=' . $line->piece_num . '&mode='.$mode.'">'; print img_edit(); - print ' '; - print 'id . '&piece_num=' . $line->piece_num . '&mode='.$mode.'">'; + print '  '; + + $actiontodelete='detele'; + if ($mode == '_tmp') $actiontodelete='confirm_delete'; + + print ''; print img_delete(); print ''; @@ -551,19 +625,37 @@ if ($action == 'create') { print $formaccounting->select_account($account_number, 'account_number', 0, array (), 1, 1, ''); print ''; print ''; - print $formaccounting->select_auxaccount($subledger_account, 'subledger_account', 1); + // 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 ''; + } print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; } print ''; - if ($mode=='_tmp' && $total_debit == $total_credit && $action=='') { + + if ($mode=='_tmp' && $action=='') + { print '
'; - print ''.$langs->trans("ValidTransaction").''; + if ($total_debit == $total_credit) + { + print ''.$langs->trans("ValidTransaction").''; + } + else + { + print ''.$langs->trans("ValidTransaction").''; + } print "
"; } print ''; diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 6f994eb1110..114b765e658 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -399,11 +399,29 @@ print ''; print ''; print '
'; print $langs->trans('From'); -print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1); +// 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($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1); +} +else +{ + print ''; +} print '
'; print '
'; print $langs->trans('to'); -print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1); +// 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($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1); +} +else +{ + print ''; +} print '
'; print ''; print ''; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 20780e72508..5c5fb022de9 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -430,6 +430,9 @@ class BookKeeping extends CommonObject if (empty($this->debit)) $this->debit = 0; if (empty($this->credit)) $this->credit = 0; + $this->debit = price2num($this->debit, 'MT'); + $this->credit = price2num($this->credit, 'MT'); + $now = dol_now(); if (empty($this->date_create)) { $this->date_create = $now; @@ -999,6 +1002,9 @@ class BookKeeping extends CommonObject $this->piece_num = trim($this->piece_num); } + $this->debit = price2num($this->debit, 'MT'); + $this->credit = price2num($this->credit, 'MT'); + // Check parameters // Put here code to add a control on parameters values @@ -1069,9 +1075,10 @@ class BookKeeping extends CommonObject public function updateByMvt($piece_num='', $field='', $value='', $mode='') { $this->db->begin(); $sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . $mode . " as ab"; - $sql .= ' SET ab.' . $field . '=' . $value; + $sql .= ' SET ab.' . $field . '=' . (is_numeric($value)?$value:"'".$value."'"); $sql .= ' WHERE ab.piece_num=' . $piece_num ; $resql = $this->db->query($sql); + if (! $resql) { $error ++; $this->errors[] = 'Error ' . $this->db->lasterror(); @@ -1576,6 +1583,7 @@ class BookKeeping extends CommonObject $this->db->rollback(); return - 1; } + /* $sql = "DELETE FROM "; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.account_number = ab.numero_compte"; @@ -1584,6 +1592,7 @@ class BookKeeping extends CommonObject $sql .= " AND asy.rowid = " . $pcgver; $sql .= " AND ab.entity IN (" . getEntity('accountancy') . ")"; $sql .= " ORDER BY account_number ASC"; + */ } /** diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 8d6f8ca4dcd..e0341b5fa9c 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -106,7 +106,7 @@ $sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don' if ($date_start && $date_end) $sql .= " AND er.date_debut >= '" . $db->idate($date_start) . "' AND er.date_debut <= '" . $db->idate($date_end) . "'"; if ($in_bookkeeping == 'yes') - $sql .= " AND (er.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='expense_report') )"; + $sql .= " AND er.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')"; $sql .= " ORDER BY er.date_debut"; dol_syslog('accountancy/journal/expensereportsjournal.php:: $sql=' . $sql); @@ -595,7 +595,7 @@ if (empty($action) || $action == 'view') { } else print $accountoshow; print ""; - print "" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("subledger_account") . ""; + print "" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("SubledgerAccount") . ""; print '' . ($mt < 0 ? - price(- $mt) : '') . ""; print '' . ($mt >= 0 ? price($mt) : '') . ""; print ""; diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index d95df1c26df..c4091018f16 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -110,7 +110,7 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if ($date_start && $date_end) $sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'"; if ($in_bookkeeping == 'yes') - $sql .= " AND (f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='supplier_invoice') )"; + $sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='supplier_invoice')"; $sql .= " ORDER BY f.datef"; dol_syslog('accountancy/journal/purchasesjournal.php:: $sql=' . $sql); @@ -226,7 +226,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->thirdparty_code = $companystatic->code_fournisseur; $bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur']; $bookkeeping->subledger_label = ''; // TODO To complete - $bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("subledger_account"); + $bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("SubledgerAccount"); $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt >= 0) ? 'C' : 'D'; @@ -629,7 +629,7 @@ if (empty($action) || $action == 'view') { } else print $accountoshow; print ""; - print "" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("subledger_account") . ""; + print "" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("SubledgerAccount") . ""; // print "" . $langs->trans("ThirdParty"); // print ' (' . $companystatic->getNomUrl(0, 'supplier', 16) . ')'; // print ""; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 5060397fc6a..59b4a82cbde 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -116,7 +116,7 @@ $sql .= " AND fd.product_type IN (0,1)"; if ($date_start && $date_end) $sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'"; if ($in_bookkeeping == 'yes') - $sql .= " AND (f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice') )"; + $sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')"; $sql .= " ORDER BY f.datef"; dol_syslog('accountancy/journal/sellsjournal.php', LOG_DEBUG); @@ -243,7 +243,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->subledger_account = $tabcompany[$key]['code_compta']; $bookkeeping->subledger_label = ''; // TODO To complete $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; - $bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("subledger_account"); + $bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount"); $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt >= 0) ? 'D' : 'C'; $bookkeeping->debit = ($mt >= 0) ? $mt : 0; @@ -589,7 +589,7 @@ if (empty($action) || $action == 'view') { // print "" . $langs->trans("ThirdParty"); // print ' (' . $companystatic->getNomUrl(0, 'customer', 16) . ')'; print ''; - print "" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("subledger_account") . ""; + print "" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount") . ""; print "" . ($mt >= 0 ? price($mt) : '') . ""; print "" . ($mt < 0 ? price(- $mt) : '') . ""; print ""; diff --git a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql index c72d7a7ec34..8e4785ab4d9 100644 --- a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql +++ b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql @@ -246,6 +246,7 @@ ALTER TABLE llx_accounting_bookkeeping ADD COLUMN date_lettering datetime AFTER ALTER TABLE llx_accounting_bookkeeping ADD COLUMN journal_label varchar(255) AFTER code_journal; ALTER TABLE llx_accounting_bookkeeping ADD COLUMN date_validated datetime AFTER validated; +DROP TABLE llx_accounting_bookkeeping_tmp; CREATE TABLE llx_accounting_bookkeeping_tmp ( rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY, @@ -258,14 +259,14 @@ CREATE TABLE llx_accounting_bookkeeping_tmp thirdparty_code varchar(32), -- Third party code (customer or supplier) when record is saved (may help debug) subledger_account varchar(32), -- FEC:CompAuxNum | account number of subledger account subledger_label varchar(255), -- FEC:CompAuxLib | label of subledger account - numero_compte varchar(32) NOT NULL, -- FEC:CompteNum | account number + numero_compte varchar(32), -- FEC:CompteNum | account number label_compte varchar(255) NOT NULL, -- FEC:CompteLib | label of account label_operation varchar(255), -- FEC:EcritureLib | label of the operation - debit numeric(24,8) NOT NULL, -- FEC:Debit - credit numeric(24,8) NOT NULL, -- FEC:Credit - montant numeric(24,8) NOT NULL, -- FEC:Montant (Not necessary) + debit double(24,8) NOT NULL, -- FEC:Debit + credit double(24,8) NOT NULL, -- FEC:Credit + montant double(24,8) NOT NULL, -- FEC:Montant (Not necessary) sens varchar(1) DEFAULT NULL, -- FEC:Sens (Not necessary) - multicurrency_amount numeric(24,8), -- FEC:Montantdevise + multicurrency_amount double(24,8), -- FEC:Montantdevise multicurrency_code varchar(255), -- FEC:Idevise lettering_code varchar(255), -- FEC:EcritureLet date_lettering datetime, -- FEC:DateLet @@ -286,6 +287,13 @@ ALTER TABLE llx_accounting_bookkeeping_tmp ADD INDEX idx_accounting_bookkeeping_ ALTER TABLE llx_accounting_bookkeeping_tmp ADD INDEX idx_accounting_bookkeeping_numero_compte (numero_compte); ALTER TABLE llx_accounting_bookkeeping_tmp ADD INDEX idx_accounting_bookkeeping_code_journal (code_journal); + +ALTER TABLE llx_accounting_bookkeeping MODIFY COLUMN debit double(24,8); +ALTER TABLE llx_accounting_bookkeeping MODIFY COLUMN credit double(24,8); +ALTER TABLE llx_accounting_bookkeeping MODIFY COLUMN montant double(24,8); +ALTER TABLE llx_accounting_bookkeeping MODIFY COLUMN multicurrency_amount double(24,8); + + ALTER TABLE llx_paiementfourn ADD COLUMN model_pdf varchar(255); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_CREATE','Expense report created','Executed when an expense report is created','expensereport',201); diff --git a/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql b/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql index ad1160c356d..f33db4be484 100644 --- a/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql +++ b/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql @@ -32,11 +32,11 @@ CREATE TABLE llx_accounting_bookkeeping numero_compte varchar(32) NOT NULL, -- FEC:CompteNum | account number label_compte varchar(255) NOT NULL, -- FEC:CompteLib | label of account label_operation varchar(255), -- FEC:EcritureLib | label of the operation - debit double NOT NULL, -- FEC:Debit - credit double NOT NULL, -- FEC:Credit - montant double NOT NULL, -- FEC:Montant (Not necessary) + debit double(24,8) NOT NULL, -- FEC:Debit + credit double(24,8) NOT NULL, -- FEC:Credit + montant double(24,8) NOT NULL, -- FEC:Montant (Not necessary) sens varchar(1) DEFAULT NULL, -- FEC:Sens (Not necessary) - multicurrency_amount double, -- FEC:Montantdevise + multicurrency_amount double(24,8), -- FEC:Montantdevise multicurrency_code varchar(255), -- FEC:Idevise lettering_code varchar(255), -- FEC:EcritureLet date_lettering datetime, -- FEC:DateLet diff --git a/htdocs/install/mysql/tables/llx_accounting_bookkeeping_tmp.sql b/htdocs/install/mysql/tables/llx_accounting_bookkeeping_tmp.sql index 79954769cef..9ead8c6c6ba 100644 --- a/htdocs/install/mysql/tables/llx_accounting_bookkeeping_tmp.sql +++ b/htdocs/install/mysql/tables/llx_accounting_bookkeeping_tmp.sql @@ -29,14 +29,14 @@ CREATE TABLE llx_accounting_bookkeeping_tmp thirdparty_code varchar(32), -- Third party code (customer or supplier) when record is saved (may help debug) subledger_account varchar(32), -- FEC:CompAuxNum | account number of subledger account subledger_label varchar(255), -- FEC:CompAuxLib | label of subledger account - numero_compte varchar(32) NOT NULL, -- FEC:CompteNum | account number + numero_compte varchar(32), -- FEC:CompteNum | account number label_compte varchar(255) NOT NULL, -- FEC:CompteLib | label of account label_operation varchar(255), -- FEC:EcritureLib | label of the operation - debit numeric(24,8) NOT NULL, -- FEC:Debit - credit numeric(24,8) NOT NULL, -- FEC:Credit - montant numeric(24,8) NOT NULL, -- FEC:Montant (Not necessary) + debit double(24,8) NOT NULL, -- FEC:Debit + credit double(24,8) NOT NULL, -- FEC:Credit + montant double(24,8) NOT NULL, -- FEC:Montant (Not necessary) sens varchar(1) DEFAULT NULL, -- FEC:Sens (Not necessary) - multicurrency_amount numeric(24,8), -- FEC:Montantdevise + multicurrency_amount double(24,8), -- FEC:Montantdevise multicurrency_code varchar(255), -- FEC:Idevise lettering_code varchar(255), -- FEC:EcritureLet date_lettering datetime, -- FEC:DateLet diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 87555ef5158..8307fdcebf3 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -63,7 +63,6 @@ Addanaccount=Add an accounting account AccountAccounting=Accounting account AccountAccountingShort=Account SubledgerAccount=Subledger Account -subledger_account=Subledger Account ShowAccountingAccount=Show accounting account ShowAccountingJournal=Show accounting journal AccountAccountingSuggest=Accounting account suggested @@ -80,6 +79,7 @@ SuppliersVentilation=Supplier invoice binding ExpenseReportsVentilation=Expense report binding CreateMvts=Create new transaction UpdateMvts=Modification of a transaction +ValidTransaction=Validate transaction WriteBookKeeping=Journalize transactions in Ledger Bookkeeping=Ledger AccountBalance=Account balance diff --git a/test/phpunit/CodingSqlTest.php b/test/phpunit/CodingSqlTest.php index d158b71fc2e..0b29b29240d 100644 --- a/test/phpunit/CodingSqlTest.php +++ b/test/phpunit/CodingSqlTest.php @@ -176,6 +176,10 @@ class CodingSqlTest extends PHPUnit_Framework_TestCase print __METHOD__." Result for checking we don't have 'ON DELETE CASCADE' = ".$result."\n"; $this->assertTrue($result===false, 'Found ON DELETE CASCADE into '.$file.'. Bad.'); + $result=strpos($filecontent,'NUMERIC('); + print __METHOD__." Result for checking we don't have 'NUMERIC(' = ".$result."\n"; + $this->assertTrue($result===false, 'Found NUMERIC( into '.$file.'. Bad.'); + if ($dir == DOL_DOCUMENT_ROOT.'/install/mysql/migration') { // Test for migration files only