From b240f536b5e121ac8a54bbf16ddf579ca593b3fe Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 17 Jun 2017 07:54:35 +0200 Subject: [PATCH] Fix : Accountancy - Debug and add information in database --- htdocs/accountancy/admin/accountmodel.php | 2 +- htdocs/accountancy/admin/card.php | 2 +- htdocs/accountancy/admin/categories_list.php | 2 +- htdocs/accountancy/admin/export.php | 2 +- htdocs/accountancy/admin/fiscalyear_info.php | 2 +- htdocs/accountancy/admin/importaccounts.php | 2 +- htdocs/accountancy/admin/productaccount.php | 2 +- htdocs/accountancy/bookkeeping/balance.php | 273 +++++++++--------- .../bookkeeping/balancebymonth.php | 6 +- htdocs/accountancy/bookkeeping/card.php | 18 +- htdocs/accountancy/bookkeeping/list.php | 6 +- .../accountancy/bookkeeping/listbyaccount.php | 15 +- htdocs/accountancy/bookkeeping/listbyyear.php | 18 +- .../class/accountancycategory.class.php | 4 +- .../class/accountancyexport.class.php | 20 +- .../class/accountancysystem.class.php | 2 +- .../class/accountingaccount.class.php | 2 +- .../accountancy/class/bookkeeping.class.php | 43 ++- htdocs/accountancy/customer/card.php | 2 +- htdocs/accountancy/customer/index.php | 2 +- htdocs/accountancy/customer/lines.php | 2 +- htdocs/accountancy/customer/list.php | 2 +- htdocs/accountancy/journal/bankjournal.php | 77 ++++- .../journal/expensereportsjournal.php | 15 +- .../accountancy/journal/purchasesjournal.php | 10 +- htdocs/accountancy/journal/sellsjournal.php | 14 +- htdocs/accountancy/report/result.php | 2 +- htdocs/accountancy/supplier/card.php | 2 +- htdocs/accountancy/supplier/index.php | 2 +- htdocs/accountancy/supplier/lines.php | 2 +- htdocs/accountancy/supplier/list.php | 2 +- htdocs/accountancy/tpl/export_journal.tpl.php | 2 +- .../bank/class/paymentvarious.class.php | 25 +- htdocs/compta/bank/ligne.php | 2 +- 34 files changed, 326 insertions(+), 258 deletions(-) diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index e22e993796f..aa6c4a71551 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -8,7 +8,7 @@ * Copyright (C) 2011 Remy Younes * Copyright (C) 2012-2015 Marcos García * Copyright (C) 2012 Christophe Battarel - * Copyright (C) 2011-2016 Alexandre Spangaro + * Copyright (C) 2011-2016 Alexandre Spangaro * Copyright (C) 2015 Ferran Marcet * Copyright (C) 2016 Raphaël Doursenaud * diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 73e3fdf6dd9..fa3adf1301b 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2014 Florian Henry * * This program is free software; you can redistribute it and/or modify diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index b10015baa6c..7c658d2661c 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -8,7 +8,7 @@ * Copyright (C) 2011 Remy Younes * Copyright (C) 2012-2015 Marcos García * Copyright (C) 2012 Christophe Battarel - * Copyright (C) 2011-2016 Alexandre Spangaro + * Copyright (C) 2011-2016 Alexandre Spangaro * Copyright (C) 2015 Ferran Marcet * Copyright (C) 2016 Raphaël Doursenaud * diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index eaf69f34f1f..cdec35415fd 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2015 Alexandre Spangaro + * Copyright (C) 2013-2015 Alexandre Spangaro * Copyright (C) 2014 Florian Henry * Copyright (C) 2014 Marcos García * Copyright (C) 2014 Juanjo Menent diff --git a/htdocs/accountancy/admin/fiscalyear_info.php b/htdocs/accountancy/admin/fiscalyear_info.php index 3596d73d751..baadbdc0828 100644 --- a/htdocs/accountancy/admin/fiscalyear_info.php +++ b/htdocs/accountancy/admin/fiscalyear_info.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2014-2016 Alexandre Spangaro * * 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 diff --git a/htdocs/accountancy/admin/importaccounts.php b/htdocs/accountancy/admin/importaccounts.php index 6ae94dc8ce2..93d41b3cbc6 100644 --- a/htdocs/accountancy/admin/importaccounts.php +++ b/htdocs/accountancy/admin/importaccounts.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2014 Florian Henry * * This program is free software; you can redistribute it and/or modify diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 33bf067fa9e..5b614061dbc 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2013-2016 Alexandre Spangaro * Copyright (C) 2014 Florian Henry * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Ari Elbaz (elarifr) diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 3f2c472cc58..a32b739752a 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -1,7 +1,7 @@ - * Copyright (C) 2016 Florian Henry - * Copyright (C) 2016 Alexandre Spangaro +/* Copyright (C) 2016 Olivier Geffroy + * Copyright (C) 2016 Florian Henry + * Copyright (C) 2016 Alexandre Spangaro * * 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 @@ -100,10 +100,10 @@ if (! empty($search_accountancy_code_end)) { if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers { - $search_accountancy_code_start = ''; - $search_accountancy_code_end = ''; - $search_date_start = ''; - $search_date_end = ''; + $search_accountancy_code_start = ''; + $search_accountancy_code_end = ''; + $search_date_start = ''; + $search_date_end = ''; } @@ -137,140 +137,137 @@ if ($action == 'export_csv') { } else { - $title_page = $langs->trans("AccountBalance") . (($search_date_start || $search_date_end) ? ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end) : ''); - - llxHeader('', $title_page); - - // List + $title_page = $langs->trans("AccountBalance") . (($search_date_start || $search_date_end) ? ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end) : ''); - $nbtotalofrecords = ''; - if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { - $nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter); - if ($nbtotalofrecords < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } - } - - $result = $object->fetchAllBalance($sortorder, $sortfield, $limit, $offset, $filter); - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } - - - print '
'; - - $button = ''; - print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $result, 'title_accountancy', 0, $button); - - - $moreforfilter = ''; - - $moreforfilter .= '
'; - $moreforfilter .= $langs->trans('DateStart') . ': '; - $moreforfilter .= $form->select_date($search_date_start, 'date_start', 0, 0, 1, '', 1, 0, 1); - $moreforfilter .= $langs->trans('DateEnd') . ': '; - $moreforfilter .= $form->select_date($search_date_end, 'date_end', 0, 0, 1, '', 1, 0, 1); - $moreforfilter .= '
'; - - if (! empty($moreforfilter)) { - print '
'; - print $moreforfilter; - $parameters = array(); - $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - print '
'; - } - - print ''; + llxHeader('', $title_page); - print ''; - print ''; - print ''; + + print ''; + + print ''; + print_liste_field_titre($langs->trans("AccountAccounting"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_operation", "", $options, "", $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Solde"), $_SERVER["PHP_SELF"], "", $options, "", 'align="right"', $sortfield, $sortorder); + print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder); + print "\n"; + + $total_debit = 0; + $total_credit = 0; + $sous_total_debit = 0; + $sous_total_credit = 0; + $displayed_account = ""; + + foreach ($object->lines as $line) { + $link = ''; + $total_debit += $line->debit; + $total_credit += $line->credit; + $description = $object->get_compte_desc($line->numero_compte); // Search description of the account + $root_account_description = $object->get_compte_racine($line->numero_compte); + if (empty($description)) { + $link = '' . img_edit_add() . ''; + } + print ''; + + // Permet d'afficher le compte comptable + if ($root_account_description != $displayed_account) { + + // Affiche un Sous-Total par compte comptable + if ($displayed_account != "") { + print ''; + print "\n"; + print ''; + } + + // Affiche le compte comptable en d�but de ligne + print ""; + print ''; + print ''; + + $displayed_account = $root_account_description; + $sous_total_debit = 0; + $sous_total_credit = 0; + } + + // $object->get_compte_racine($line->numero_compte); + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + + // Comptabilise le sous-total + $sous_total_debit += $line->debit; + $sous_total_credit += $line->credit; + } + + print ''; + print "\n"; + print ''; + + print ''; + print "\n"; + print ''; + + print "
'; - print $langs->trans('From'); - print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, ''); - print ' '; - print $langs->trans('to'); - print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array(), 1, 1, ''); - print ''; + // List + $nbtotalofrecords = ''; + if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { + $nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter); + if ($nbtotalofrecords < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + + $result = $object->fetchAllBalance($sortorder, $sortfield, $limit, $offset, $filter); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } + + print ''; + + $button = ''; + print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $result, 'title_accountancy', 0, $button); + + $moreforfilter = ''; + + $moreforfilter .= '
'; + $moreforfilter .= $langs->trans('DateStart') . ': '; + $moreforfilter .= $form->select_date($search_date_start, 'date_start', 0, 0, 1, '', 1, 0, 1); + $moreforfilter .= $langs->trans('DateEnd') . ': '; + $moreforfilter .= $form->select_date($search_date_end, 'date_end', 0, 0, 1, '', 1, 0, 1); + $moreforfilter .= '
'; + + if (! empty($moreforfilter)) { + print '
'; + print $moreforfilter; + $parameters = array(); + $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print '
'; + } + + print ''; + + print ''; + print ''; + print ''; - - print ''; - - print ''; - print_liste_field_titre($langs->trans("AccountAccounting"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_compte", "", $options, "", $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Solde"), $_SERVER["PHP_SELF"], "", $options, "", 'align="right"', $sortfield, $sortorder); - print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder); - print "\n"; - - $total_debit = 0; - $total_credit = 0; - $sous_total_debit = 0; - $sous_total_credit = 0; - $displayed_account = ""; - - foreach ($object->lines as $line) { - $link = ''; - $total_debit += $line->debit; - $total_credit += $line->credit; - $description = $object->get_compte_desc($line->numero_compte); // Search description of the account - $root_account_description = $object->get_compte_racine($line->numero_compte); - if (empty($description)) { - $link = '' . img_edit_add() . ''; - } - print ''; - - // Permet d'afficher le compte comptable - if ($root_account_description != $displayed_account) { - - // Affiche un Sous-Total par compte comptable - if ($displayed_account != "") { - print ''; - print "\n"; - print ''; - } - - // Affiche le compte comptable en d�but de ligne - print ""; - print ''; - print ''; - - $displayed_account = $root_account_description; - $sous_total_debit = 0; - $sous_total_credit = 0; - } - - // $object->get_compte_racine($line->numero_compte); - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - // Comptabilise le sous-total - $sous_total_debit += $line->debit; - $sous_total_credit += $line->credit; - } - - print ''; - print "\n"; - print ''; - - print ''; - print "\n"; - print ''; - - print "
'; + print $langs->trans('From'); + print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, ''); + print ' '; + print $langs->trans('to'); + print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array(), 1, 1, ''); + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; - print '
' . $langs->trans("SubTotal") . ':' . price($sous_total_debit) . '' . price($sous_total_credit) . '' . price($sous_total_credit - $sous_total_debit) . ' 
' . $root_account_description . '
' . length_accountg($line->numero_compte) . '' . $description . '' . price($line->debit) . '' . price($line->credit) . '' . price($line->credit - $line->debit) . '' . $link; - print '
' . $langs->trans("SubTotal") . ':' . price($sous_total_debit) . '' . price($sous_total_credit) . '' . price($sous_total_credit - $sous_total_debit) . ' 
' . $langs->trans("AccountBalance") . ':' . price($total_debit) . '' . price($total_credit) . '' . price($total_credit - $total_debit) . ' 
"; - print ''; - - llxFooter(); + print '
' . $langs->trans("SubTotal") . ':' . price($sous_total_debit) . '' . price($sous_total_credit) . '' . price($sous_total_credit - $sous_total_debit) . ' 
' . $root_account_description . '
' . length_accountg($line->numero_compte) . '' . $description . '' . price($line->debit) . '' . price($line->credit) . '' . price($line->credit - $line->debit) . '' . $link; + print '
' . $langs->trans("SubTotal") . ':' . price($sous_total_debit) . '' . price($sous_total_credit) . '' . price($sous_total_credit - $sous_total_debit) . ' 
' . $langs->trans("AccountBalance") . ':' . price($total_debit) . '' . price($total_credit) . '' . price($total_credit - $total_debit) . ' 
"; + print ''; + + llxFooter(); } $db->close(); \ No newline at end of file diff --git a/htdocs/accountancy/bookkeeping/balancebymonth.php b/htdocs/accountancy/bookkeeping/balancebymonth.php index 83908f72172..1d746b4d4df 100644 --- a/htdocs/accountancy/bookkeeping/balancebymonth.php +++ b/htdocs/accountancy/bookkeeping/balancebymonth.php @@ -1,8 +1,8 @@ - * Copyright (C) 2013-2014 Alexandre Spangaro - * Copyright (C) 2014 Florian Henry - * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2014 Florian Henry + * Copyright (C) 2015 Jean-François Ferry * * 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 diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 5c558ca0a90..660248a46a3 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -52,7 +52,7 @@ $subledger_account = GETPOST('subledger_account'); if ($subledger_account == - 1) { $subledger_account = null; } -$label_compte = GETPOST('label_compte'); +$label_operation = GETPOST('label_operation'); $debit = price2num(GETPOST('debit')); $credit = price2num(GETPOST('credit')); @@ -83,7 +83,7 @@ if ($action == "confirm_update") { } else { $book->numero_compte = $account_number; $book->subledger_account = $subledger_account; - $book->label_compte = $label_compte; + $book->label_operation = $label_operation; $book->debit = $debit; $book->credit = $credit; @@ -120,7 +120,7 @@ else if ($action == "add") { $book->numero_compte = $account_number; $book->subledger_account = $subledger_account; - $book->label_compte = $label_compte; + $book->label_operation = $label_operation; $book->debit = $debit; $book->credit = $credit; $book->doc_date = GETPOST('doc_date'); @@ -182,7 +182,7 @@ else if ($action == "confirm_create") { if (! $error) { - $book->label_compte = ''; + $book->label_operation = ''; $book->debit = 0; $book->credit = 0; $book->doc_date = $date_start = dol_mktime(0, 0, 0, GETPOST('doc_datemonth'), GETPOST('doc_dateday'), GETPOST('doc_dateyear')); @@ -392,7 +392,7 @@ if ($action == 'create') { print ''; print $formaccounting->select_auxaccount($line->subledger_account, 'subledger_account', 1, 'maxwidth300'); print ''; - print ''; + print ''; print ''; print ''; print '' . price($line->montant) . ''; @@ -404,17 +404,17 @@ if ($action == 'create') { } else { print '' . length_accountg($line->numero_compte) . ''; print '' . length_accounta($line->subledger_account) . ''; - print '' . $line->label_compte . ''; + print '' . $line->label_operation . ''; print '' . price($line->debit) . ''; print '' . price($line->credit) . ''; print '' . price($line->montant) . ''; print '' . $line->sens . ''; print ''; - print ''; + print ''; print img_edit(); print ' '; - print ''; + print ''; print img_delete(); print ''; @@ -436,7 +436,7 @@ if ($action == 'create') { print ''; print $formaccounting->select_auxaccount($subledger_account, 'subledger_account', 1, 'maxwidth300'); print ''; - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 4a7bca5e1b7..65e615cecaf 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -183,7 +183,7 @@ if (! empty($search_accountancy_aux_code_end)) { $param .= '&search_accountancy_aux_code_end=' . $search_accountancy_aux_code_end; } if (! empty($search_mvt_label)) { - $filter['t.label_compte'] = $search_mvt_label; + $filter['t.label_operation'] = $search_mvt_label; $param .= '&search_mvt_label=' . $search_mvt_label; } if (! empty($search_direction)) { @@ -424,7 +424,7 @@ print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_d print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("SubledgerAccount"), $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_compte", "", $param, "", $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder); @@ -450,7 +450,7 @@ foreach ($object->lines as $line ) { print '' . $line->doc_ref . ''; print '' . length_accountg($line->numero_compte) . ''; print '' . length_accounta($line->subledger_account) . ''; - print '' . $line->label_compte . ''; + print '' . $line->label_operation . ''; print '' . ($line->debit ? price($line->debit) : ''). ''; print '' . ($line->credit ? price($line->credit) : '') . ''; diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 7d0ba2280ea..a1398df6fb2 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -1,9 +1,8 @@ largely based on the great work of : - * - Copyright (C) 2013-2016 Olivier Geffroy - * - Copyright (C) 2013-2016 Florian Henry - * - Copyright (C) 2013-2016 Alexandre Spangaro +/* Copyright (C) 2016 Neil Orley + * Copyright (C) 2013-2016 Olivier Geffroy + * Copyright (C) 2013-2016 Florian Henry + * Copyright (C) 2013-2017 Alexandre Spangaro * * 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 @@ -100,11 +99,11 @@ if (!GETPOST("button_removefilter_x") && !GETPOST("button_removefilter")) // Bot $options .= '&search_accountancy_code_start=' . $search_accountancy_code_start; } if (! empty($search_label_account)) { - $filter['t.label_compte'] = $search_label_account; + $filter['t.label_operation'] = $search_label_account; $options .= '&search_label_account=' . $search_label_account; } if (! empty($search_mvt_label)) { - $filter['t.label_compte'] = $search_mvt_label; + $filter['t.label_operation'] = $search_mvt_label; $options .= '&search_mvt_label=' . $search_mvt_label; } if (! empty($search_direction)) { @@ -312,7 +311,7 @@ foreach ( $object->lines as $line ) { // Affiche un lien vers la facture client/fournisseur $doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref); - print strlen(length_accounta($line->subledger_account)) == 0 ? '' . $line->label_compte . '' : '' . $line->label_compte . '
(' . length_accounta($line->subledger_account) . ')'; + print strlen(length_accounta($line->subledger_account)) == 0 ? '' . $line->label_operation . '' : '' . $line->label_operation . '
(' . length_accounta($line->subledger_account) . ')'; print '' . ($line->debit ? price($line->debit) :''). ''; diff --git a/htdocs/accountancy/bookkeeping/listbyyear.php b/htdocs/accountancy/bookkeeping/listbyyear.php index e7e51ae67e0..becb700761a 100644 --- a/htdocs/accountancy/bookkeeping/listbyyear.php +++ b/htdocs/accountancy/bookkeeping/listbyyear.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2013-2016 Florian Henry * * This program is free software; you can redistribute it and/or modify @@ -61,7 +61,7 @@ $search_subledger_account_end = GETPOST('search_subledger_account_end', 'alpha') if ($search_subledger_account_end == - 1) { $search_subledger_account_end = ''; } -$search_label_compte = GETPOST('search_label_compte', 'alpha'); +$search_label_operation = GETPOST('search_label_operation', 'alpha'); $search_sens = GETPOST('search_sens', 'alpha'); $search_code_journal = GETPOST('search_code_journal', 'alpha'); @@ -93,7 +93,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $search_doc_ref = ""; $search_numero_compte = ""; $search_subledger_account = ""; - $search_label_compte = ""; + $search_label_operation = ""; $search_sens = ""; $search_code_journal = ""; } @@ -144,9 +144,9 @@ if (! empty($search_subledger_account_end)) { $filter['t.subledger_account<='] = $search_subledger_account_end; $options .= '&search_subledger_account_end=' . $search_subledger_account_end; } -if (! empty($search_label_compte)) { - $filter['t.label_compte'] = $search_label_compte; - $options .= '&search_label_compte=' . $search_label_compte; +if (! empty($search_label_operation)) { + $filter['t.label_operation'] = $search_label_operation; + $options .= '&search_label_operation=' . $search_label_operation; } if (! empty($search_sens)) { $filter['t.sens'] = $search_sens; @@ -207,7 +207,7 @@ print_liste_field_titre($langs->trans("Date"), $_SERVER['PHP_SELF'], "t.doc_date print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("AccountAccounting"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("ThirdPartyAccount"), $_SERVER['PHP_SELF'], "t.subledger_account", "", $options, "", $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_compte", "", $options, "", $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_operation", "", $options, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="center"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Amount"), $_SERVER['PHP_SELF'], "t.montant", "", $options, 'align="center"', $sortfield, $sortorder); @@ -242,7 +242,7 @@ print ''; print ''; -print ''; +print ''; print ''; print ''; @@ -279,7 +279,7 @@ foreach ( $object->lines as $line ) { print '' . $line->doc_ref . ''; print '' . length_accountg($line->numero_compte) . ''; print '' . length_accounta($line->subledger_account) . ''; - print '' . $line->label_compte . ''; + print '' . $line->label_operation . ''; print '' . price($line->debit) . ''; print '' . price($line->credit) . ''; print '' . price($line->montant) . ''; diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index e4e3017ab15..db75947771e 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -92,7 +92,7 @@ class AccountancyCategory public function getCptBK($id) { global $conf; - $sql = "SELECT t.numero_compte, t.label_compte, t.doc_ref"; + $sql = "SELECT t.numero_compte, t.label_operation, t.doc_ref"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t"; $sql .= " WHERE t.numero_compte NOT IN ("; $sql .= " SELECT t.account_number"; @@ -104,7 +104,7 @@ class AccountancyCategory $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; $sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS; $sql .= " AND aa.active = 1)"; - $sql .= " GROUP BY t.numero_compte, t.label_compte, t.doc_ref"; + $sql .= " GROUP BY t.numero_compte, t.label_operation, t.doc_ref"; $sql .= " ORDER BY t.numero_compte"; $this->lines_CptBk = array (); diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index dc2b3195ee3..a3358337889 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2015 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Pierre-Henry Favre - * Copyright (C) 2016 Alexandre Spangaro + * Copyright (C) 2016-2017 Alexandre Spangaro * * 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 @@ -198,7 +198,7 @@ class AccountancyExport print length_accounta($line->subledger_account) . $separator; print $line->sens . $separator; print price($line->montant) . $separator; - print $line->label_compte . $separator; + print $line->label_operation . $separator; print $line->doc_ref; print $this->end_line; } @@ -220,7 +220,7 @@ class AccountancyExport print $line->piece_num . $this->separator; print length_accountg($line->numero_compte) . $this->separator; print '' . $this->separator; - print $line->label_compte . $this->separator; + print $line->label_operation . $this->separator; print $date . $this->separator; if ($line->sens=='D') { print price($line->montant) . $this->separator; @@ -230,7 +230,7 @@ class AccountancyExport print price($line->montant) . $this->separator; } print $line->doc_ref . $this->separator; - print $line->label_compte . $this->separator; + print $line->label_operation . $this->separator; print $this->end_line; } } @@ -289,7 +289,7 @@ class AccountancyExport print price($line->debit) . $this->separator; print price($line->credit) . $this->separator; - print dol_trunc($line->label_compte, 32) . $this->separator; + print dol_trunc($line->label_operation, 32) . $this->separator; print $this->end_line; } } @@ -320,11 +320,11 @@ class AccountancyExport $Tab['date_ope'] = dol_print_date($data->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE); $Tab['num_piece'] = str_pad(self::trunc($data->piece_num, 12), 12); $Tab['num_compte'] = str_pad(self::trunc($code_compta, 11), 11); - $Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref . $data->label_compte, 25), 25); + $Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref . $data->label_operation, 25), 25); $Tab['montant'] = str_pad(abs($data->montant), 13, ' ', STR_PAD_LEFT); $Tab['type_montant'] = str_pad($data->sens, 1); $Tab['vide'] = str_repeat(' ', 18); - $Tab['intitule_compte'] = str_pad(self::trunc($data->label_compte, 34), 34); + $Tab['intitule_compte'] = str_pad(self::trunc($data->label_operation, 34), 34); $Tab['end'] = 'O2003'; $Tab['end_line'] = $this->end_line; @@ -359,7 +359,7 @@ class AccountancyExport $Tab['folio'] = '000'; $Tab['date_ecriture'] = $date_ecriture; $Tab['filler'] = ' '; - $Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref . ' ' . $data->label_compte, 20), 20); + $Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref . ' ' . $data->label_operation, 20), 20); $Tab['sens'] = $data->sens; // C or D $Tab['signe_montant'] = '+'; $Tab['montant'] = str_pad(abs($data->montant), 12, '0', STR_PAD_LEFT); // TODO manage negative amount @@ -375,7 +375,7 @@ class AccountancyExport $Tab['devis'] = str_pad($conf->currency, 3); $Tab['code_journal2'] = str_pad(self::trunc($data->code_journal, 3), 3); $Tab['filler3'] = str_repeat(' ', 3); - $Tab['libelle_ecriture2'] = str_pad(self::trunc($data->doc_ref . ' ' . $data->label_compte, 32), 32); + $Tab['libelle_ecriture2'] = str_pad(self::trunc($data->doc_ref . ' ' . $data->label_operation, 32), 32); $Tab['num_piece3'] = str_pad(self::trunc($data->piece_num, 10), 10); $Tab['filler4'] = str_repeat(' ', 73); @@ -406,7 +406,7 @@ class AccountancyExport print $line->code_journal . $this->separator; print length_accountg($line->numero_compte) . $this->separator; print substr(length_accountg($line->numero_compte),0,2) . $this->separator; - print '"'.dol_trunc($line->label_compte,40,'right','UTF-8',1).'"' . $this->separator; + print '"'.dol_trunc($line->label_operation,40,'right','UTF-8',1).'"' . $this->separator; print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1).'"'.$this->separator; print price2num($line->montant).$this->separator; print $line->sens.$this->separator; diff --git a/htdocs/accountancy/class/accountancysystem.class.php b/htdocs/accountancy/class/accountancysystem.class.php index a1c90a97b5b..87d1ccd663c 100644 --- a/htdocs/accountancy/class/accountancysystem.class.php +++ b/htdocs/accountancy/class/accountancysystem.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2013-2014 Alexandre Spangaro * Copyright (C) 2013-2014 Florian Henry * * This program is free software; you can redistribute it and/or modify diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index a526f9171a6..1dad83512e3 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2013-2016 Alexandre Spangaro * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Ari Elbaz (elarifr) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index d607c1dc287..2e826b55e08 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2015-2016 Alexandre Spangaro +/* Copyright (C) 2014-2016 Olivier Geffroy + * Copyright (C) 2015-2017 Alexandre Spangaro * Copyright (C) 2015-2016 Florian Henry * * This program is free software; you can redistribute it and/or modify @@ -80,6 +80,7 @@ class BookKeeping extends CommonObject public $subledger_label; public $numero_compte; public $label_compte; + public $label_operation; public $debit; public $credit; public $montant; @@ -144,6 +145,9 @@ class BookKeeping extends CommonObject if (isset($this->label_compte)) { $this->label_compte = trim($this->label_compte); } + if (isset($this->label_operation)) { + $this->label_operation = trim($this->label_operation); + } if (isset($this->debit)) { $this->debit = trim($this->debit); } @@ -263,6 +267,7 @@ class BookKeeping extends CommonObject $sql .= ", subledger_label"; $sql .= ", numero_compte"; $sql .= ", label_compte"; + $sql .= ", label_operation"; $sql .= ", debit"; $sql .= ", credit"; $sql .= ", montant"; @@ -284,6 +289,7 @@ class BookKeeping extends CommonObject $sql .= ",'" . $this->db->escape($this->subledger_label) . "'"; $sql .= ",'" . $this->db->escape($this->numero_compte) . "'"; $sql .= ",'" . $this->db->escape($this->label_compte) . "'"; + $sql .= ",'" . $this->db->escape($this->label_operation) . "'"; $sql .= "," . $this->debit; $sql .= "," . $this->credit; $sql .= "," . $this->montant; @@ -393,6 +399,9 @@ class BookKeeping extends CommonObject if (isset($this->label_compte)) { $this->label_compte = trim($this->label_compte); } + if (isset($this->label_operation)) { + $this->label_operation = trim($this->label_operation); + } if (isset($this->debit)) { $this->debit = trim($this->debit); } @@ -438,6 +447,7 @@ class BookKeeping extends CommonObject $sql .= 'subledger_label,'; $sql .= 'numero_compte,'; $sql .= 'label_compte,'; + $sql .= 'label_operation,'; $sql .= 'debit,'; $sql .= 'credit,'; $sql .= 'montant,'; @@ -459,6 +469,7 @@ class BookKeeping extends CommonObject $sql .= ' ' . (! isset($this->subledger_label) ? 'NULL' : "'" . $this->db->escape($this->subledger_label) . "'") . ','; $sql .= ' ' . (! isset($this->numero_compte) ? "NULL" : "'" . $this->db->escape($this->numero_compte) . "'") . ','; $sql .= ' ' . (! isset($this->label_compte) ? 'NULL' : "'" . $this->db->escape($this->label_compte) . "'") . ','; + $sql .= ' ' . (! isset($this->label_operation) ? 'NULL' : "'" . $this->db->escape($this->label_operation) . "'") . ','; $sql .= ' ' . (! isset($this->debit) ? 'NULL' : $this->debit ). ','; $sql .= ' ' . (! isset($this->credit) ? 'NULL' : $this->credit ). ','; $sql .= ' ' . (! isset($this->montant) ? 'NULL' : $this->montant ). ','; @@ -531,6 +542,7 @@ class BookKeeping extends CommonObject $sql .= " t.subledger_label,"; $sql .= " t.numero_compte,"; $sql .= " t.label_compte,"; + $sql .= " t.label_operation,"; $sql .= " t.debit,"; $sql .= " t.credit,"; $sql .= " t.montant,"; @@ -567,6 +579,7 @@ class BookKeeping extends CommonObject $this->subledger_label = $obj->subledger_label; $this->numero_compte = $obj->numero_compte; $this->label_compte = $obj->label_compte; + $this->label_operation = $obj->label_operation; $this->debit = $obj->debit; $this->credit = $obj->credit; $this->montant = $obj->montant; @@ -621,6 +634,7 @@ class BookKeeping extends CommonObject $sql .= " t.subledger_label,"; $sql .= " t.numero_compte,"; $sql .= " t.label_compte,"; + $sql .= " t.label_operation,"; $sql .= " t.debit,"; $sql .= " t.credit,"; $sql .= " t.montant,"; @@ -644,9 +658,9 @@ class BookKeeping extends CommonObject $sqlwhere[] = $key . '=' . $value; } elseif ($key == 't.subledger_account' || $key == 't.numero_compte') { $sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\''; - } elseif ($key == 't.label_compte') { + } elseif ($key == 't.label_operation') { $sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\''; - }else { + } else { $sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; } } @@ -686,6 +700,7 @@ class BookKeeping extends CommonObject $line->subledger_label = $obj->subledger_label; $line->numero_compte = $obj->numero_compte; $line->label_compte = $obj->label_compte; + $line->label_operation = $obj->label_operation; $line->debit = $obj->debit; $line->credit = $obj->credit; $line->montant = $obj->montant; @@ -725,7 +740,7 @@ class BookKeeping extends CommonObject public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') { global $conf; - dol_syslog(__METHOD__, LOG_DEBUG); + dol_syslog(__METHOD__, LOG_DEBUG); $sql = 'SELECT'; $sql .= ' t.rowid,'; @@ -739,6 +754,7 @@ class BookKeeping extends CommonObject $sql .= " t.subledger_label,"; $sql .= " t.numero_compte,"; $sql .= " t.label_compte,"; + $sql .= " t.label_operation,"; $sql .= " t.debit,"; $sql .= " t.credit,"; $sql .= " t.montant,"; @@ -801,6 +817,7 @@ class BookKeeping extends CommonObject $line->subledger_label = $obj->subledger_label; $line->numero_compte = $obj->numero_compte; $line->label_compte = $obj->label_compte; + $line->label_operation = $obj->label_operation; $line->debit = $obj->debit; $line->credit = $obj->credit; $line->montant = $obj->montant; @@ -945,6 +962,9 @@ class BookKeeping extends CommonObject if (isset($this->label_compte)) { $this->label_compte = trim($this->label_compte); } + if (isset($this->label_operation)) { + $this->label_operation = trim($this->label_operation); + } if (isset($this->debit)) { $this->debit = trim($this->debit); } @@ -988,6 +1008,7 @@ class BookKeeping extends CommonObject $sql .= ' subledger_label = ' . (isset($this->subledger_label) ? "'" . $this->db->escape($this->subledger_label) . "'" : "null") . ','; $sql .= ' numero_compte = ' . (isset($this->numero_compte) ? "'" . $this->db->escape($this->numero_compte) . "'" : "null") . ','; $sql .= ' label_compte = ' . (isset($this->label_compte) ? "'" . $this->db->escape($this->label_compte) . "'" : "null") . ','; + $sql .= ' label_operation = ' . (isset($this->label_operation) ? "'" . $this->db->escape($this->label_operation) . "'" : "null") . ','; $sql .= ' debit = ' . (isset($this->debit) ? $this->debit : "null") . ','; $sql .= ' credit = ' . (isset($this->credit) ? $this->credit : "null") . ','; $sql .= ' montant = ' . (isset($this->montant) ? $this->montant : "null") . ','; @@ -1245,14 +1266,15 @@ class BookKeeping extends CommonObject $this->fk_doc = ''; $this->fk_docdet = ''; $this->thirdparty_code = 'CU001'; - $this->subledger_account = '410CU001'; + $this->subledger_account = '41100001'; $this->subledger_label = 'My customer company'; - $this->numero_compte = '410'; - $this->label_compte = ''; + $this->numero_compte = '411'; + $this->label_compte = 'Customer'; + $this->label_operation = 'Sales of pea'; $this->debit = 99.9; $this->credit = ''; $this->montant = ''; - $this->sens = ''; + $this->sens = 'D'; $this->fk_user_author = $user->id; $this->import_key = ''; $this->code_journal = 'VT'; @@ -1358,6 +1380,7 @@ class BookKeeping extends CommonObject $line->subledger_label = $obj->subledger_label; $line->numero_compte = $obj->numero_compte; $line->label_compte = $obj->label_compte; + $line->label_operation = $obj->label_operation; $line->debit = $obj->debit; $line->credit = $obj->credit; $line->montant = $obj->montant; @@ -1416,6 +1439,7 @@ class BookKeeping extends CommonObject $line->subledger_label = $obj->subledger_label; $line->numero_compte = $obj->numero_compte; $line->label_compte = $obj->label_compte; + $line->label_operation = $obj->label_operation; $line->debit = $obj->debit; $line->credit = $obj->credit; $line->montant = $obj->montant; @@ -1606,6 +1630,7 @@ class BookKeepingLine public $subledger_label; public $numero_compte; public $label_compte; + public $label_operation; public $debit; public $credit; public $montant; diff --git a/htdocs/accountancy/customer/card.php b/htdocs/accountancy/customer/card.php index c436fdfd088..a10cd24adc4 100644 --- a/htdocs/accountancy/customer/card.php +++ b/htdocs/accountancy/customer/card.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2013-2017 Alexandre Spangaro * * 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 diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index deca83b6f12..24e066917bc 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2013-2016 Alexandre Spangaro * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry * diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index a5dfa3941d1..b5778ce86f2 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2013-2016 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2014-2016 Florian Henry * Copyright (C) 2014 Juanjo Menent diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 56765e1ba4f..85a97fb3a1e 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2013-2016 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Juanjo Menent diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 568edf051ff..bc27ebfa24f 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -50,6 +50,7 @@ require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php'; require_once DOL_DOCUMENT_ROOT . '/societe/class/client.class.php'; require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT . '/expensereport/class/paymentexpensereport.class.php'; +require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/paymentvarious.class.php'; $langs->load("companies"); $langs->load("other"); @@ -60,6 +61,7 @@ $langs->load('donations'); $langs->load("accountancy"); $langs->load("trips"); $langs->load("salaries"); +$langs->load("hrm"); // Multi journal $id_journal = GETPOST('id_journal', 'int'); @@ -131,6 +133,7 @@ $paymentdonstatic = new PaymentDonation($db); $paymentvatstatic = new TVA($db); $paymentsalstatic = new PaymentSalary($db); $paymentexpensereportstatic = new PaymentExpenseReport($db); +$paymentvariousstatic = new PaymentVarious($db); // Get code of finance journal $accountingjournalstatic = new AccountingJournal($db); @@ -208,7 +211,7 @@ if ($result) { // Now loop on each link of record in bank. foreach ( $links as $key => $val ) { - if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat', 'payment_expensereport', 'banktransfert', 'payment_donation', 'payment_salary'))) // So we excluded 'company' here + if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat', 'payment_expensereport', 'banktransfert', 'payment_donation', 'payment_salary', 'payment_various'))) // So we excluded 'company' here { // We save tabtype for a future use, to remember what kind of payment it is $tabtype[$obj->rowid] = $links[$key]['type']; @@ -250,9 +253,9 @@ if ($result) { $sqlmid = 'SELECT cchgsoc.accountancy_code'; $sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc "; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id"; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid"; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid"; + $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id"; + $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid"; + $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid"; $sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid; dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); @@ -285,6 +288,15 @@ if ($result) { $paymentexpensereportstatic->fk_expensereport = $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentexpensereportstatic->getNomUrl(2); $tabpay[$obj->rowid]["fk_expensereport"] = $paymentexpensereportstatic->id; + } else if ($links[$key]['type'] == 'payment_various') { + $paymentvariousstatic->id = $links[$key]['url_id']; + $paymentvariousstatic->ref = $links[$key]['url_id']; + $paymentvariousstatic->label = $links[$key]['label']; + $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvariousstatic->getNomUrl(2); + $tabpay[$obj->rowid]["paymentvariousid"] = $paymentvariousstatic->id; + $paymentvariousstatic->fetch($paymentvariousstatic->id); + $account_various = (! empty($paymentvariousstatic->accountancy_code) ? $paymentvariousstatic->accountancy_code : $langs->trans("CodeNotDef")); + $tabtp[$obj->rowid][$account_various] += $obj->amount; } else if ($links[$key]['type'] == 'banktransfert') { $tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("BankTransfer"); $tabtp[$obj->rowid][$account_transfer] += $obj->amount; @@ -353,7 +365,7 @@ if (! $error && $action == 'writebookkeeping') { $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = $val["fk_bank"]; $bookkeeping->numero_compte = $k; - $bookkeeping->label_compte = $compte->label; + $bookkeeping->label_operation = $val["label"]; $bookkeeping->montant = ($mt < 0 ? - $mt : $mt); $bookkeeping->sens = ($mt >= 0) ? 'D' : 'C'; $bookkeeping->debit = ($mt >= 0 ? $mt : 0); @@ -412,8 +424,11 @@ if (! $error && $action == 'writebookkeeping') { $bookkeeping->doc_ref = $langs->trans("Donation") . ' (' . $val["paymentdonationid"] . ')'; // Rowid of donation } else if ($tabtype[$key] == 'payment_salary') { $bookkeeping->subledger_account = ''; - $bookkeeping->label_compte = $tabuser[$key]['name']; + $bookkeeping->label_operation = $tabuser[$key]['name']; $bookkeeping->doc_ref = $langs->trans("SalaryPayment") . ' (' . $val["paymentsalid"] . ')'; // Ref of salary payment + } else if ($tabtype[$key] == 'payment_various') { + $bookkeeping->subledger_account = ''; + $bookkeeping->doc_ref = $langs->trans("VariousPayment") . ' (' . $val["paymentvariousid"] . ')'; // Ref of various payment } $result = $bookkeeping->create($user); @@ -447,7 +462,7 @@ if (! $error && $action == 'writebookkeeping') { $bookkeeping->doc_type = 'bank'; $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = $val["fk_bank"]; - $bookkeeping->label_compte = $tabcompany[$key]['name']; + $bookkeeping->label_operation = $tabcompany[$key]['name']; $bookkeeping->montant = ($mt < 0 ? - $mt : $mt); $bookkeeping->sens = ($mt < 0) ? 'D' : 'C'; $bookkeeping->debit = ($mt < 0 ? - $mt : 0); @@ -473,7 +488,8 @@ if (! $error && $action == 'writebookkeeping') { $bookkeeping->doc_ref = $objmid->facnumber; } $bookkeeping->subledger_account = $tabcompany[$key]['code_compta']; - $bookkeeping->numero_compte = $k; + $bookkeeping->subledger_label = $tabcompany[$key]['name']; + $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; } else if ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice $sqlmid = 'SELECT facf.ref_supplier,facf.ref'; $sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf "; @@ -487,7 +503,23 @@ if (! $error && $action == 'writebookkeeping') { $bookkeeping->doc_ref = $objmid->ref_supplier . ' (' . $objmid->ref . ')'; } $bookkeeping->subledger_account = $tabcompany[$key]['code_compta']; - $bookkeeping->numero_compte = $k; + $bookkeeping->subledger_label = $tabcompany[$key]['name']; + $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; + } else if ($tabtype[$key] == 'payment_expensereport') { + $bookkeeping->subledger_account = $tabuser[$key]['accountancy_code']; + $bookkeeping->subledger_label = $tabuser[$key]['name']; + $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; + $bookkeeping->label_operation = $tabuser[$key]['name']; + $sqlmid = 'SELECT e.ref'; + $sqlmid .= " FROM " . MAIN_DB_PREFIX . "expensereport as e"; + $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "payment_expensereport as payer ON payer.fk_expensereport=e.rowid"; + $sqlmid .= " WHERE payer.fk_expensereport=" . $val["fk_expensereport"]; + dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); + $resultmid = $db->query($sqlmid); + if ($resultmid) { + $objmid = $db->fetch_object($resultmid); + $bookkeeping->doc_ref = $objmid->ref; // Ref of expensereport + } } else if ($tabtype[$key] == 'payment_vat') { $bookkeeping->subledger_account = ''; $bookkeeping->numero_compte = $k; @@ -499,16 +531,19 @@ if (! $error && $action == 'writebookkeeping') { } else if ($tabtype[$key] == 'payment_salary') { $bookkeeping->subledger_account = $tabuser[$key]['accountancy_code']; $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; - $bookkeeping->label_compte = $tabuser[$key]['name']; + $bookkeeping->label_operation = $tabuser[$key]['name']; $bookkeeping->doc_ref = $langs->trans("SalaryPayment") . ' (' . $val["paymentsalid"] . ')'; // Rowid of salary payment + } else if ($tabtype[$key] == 'payment_various') { + $bookkeeping->subledger_account = ''; + $bookkeeping->numero_compte = $k; + $bookkeeping->doc_ref = $langs->trans("VariousPayment") . ' (' . $val["paymentvariousid"] . ')'; // Rowid of various payment } else if ($tabtype[$key] == 'banktransfert') { $bookkeeping->subledger_account = ''; $bookkeeping->numero_compte = $k; } else { - // FIXME Should be a temporary account ??? + // Temporary account $bookkeeping->doc_ref = $k; - //$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; - $bookkeeping->numero_compte = 'CodeNotDef'; + $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE; } $result = $bookkeeping->create($user); @@ -745,6 +780,7 @@ if (empty($action) || $action == 'view') { $vatstatic = new Tva($db); $donationstatic = new Don($db); $salarystatic = new PaymentSalary($db); + $variousstatic = new PaymentVarious($db); llxHeader('', $langs->trans("FinanceJournal")); @@ -913,7 +949,20 @@ if (empty($action) || $action == 'view') { } else dol_print_error($db); } - + elseif ($tabtype[$key] == 'payment_various') + { + $sqlmid = 'SELECT v.rowid as id'; + $sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_various as v"; + $sqlmid .= " WHERE v.rowid=" . $val["paymentvariousid"]; + dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG); + $resultmid = $db->query($sqlmid); + if ($resultmid) { + $objmid = $db->fetch_object($resultmid); + $variousstatic->fetch($objmid->id); + $ref=$variousstatic->getNomUrl(1); + } + else dol_print_error($db); + } /*$invoicestatic->id = $key; $invoicestatic->ref = $val["ref"]; diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 3da9e09aeda..6dba1443ae1 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -136,7 +136,7 @@ if ($result) { // Define array to display all VAT rates that use this accounting account $compta_tva if ((! price2num($obj->tva_tx)) || ! empty($obj->vat_src_code)) { - $def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':'')]=(vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':'')); + $def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':'')]=(vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':'')); } $taber[$obj->rowid]["date"] = $db->jdate($obj->de); @@ -148,7 +148,7 @@ if ($result) { $tabtva[$obj->rowid][$compta_tva] += $obj->total_tva; $tabuser[$obj->rowid] = array ( 'id' => $obj->uid, - 'name' => $obj->firstname.' '.$obj->lastname, + 'name' => dolGetFirstLastname($obj->firstname, $obj->lastname), 'user_accountancy_code' => $obj->user_accountancy_account ); @@ -169,6 +169,7 @@ if ($action == 'writebookkeeping') { $db->begin(); + // Thirdparty if (! $errorforline) { foreach ( $tabttc[$key] as $k => $mt ) { @@ -183,7 +184,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_docdet = $val["fk_expensereportdet"]; $bookkeeping->subledger_account = $tabuser[$key]['user_accountancy_code']; $bookkeeping->subledger_label = $tabuser[$key]['user_accountancy_code']; - $bookkeeping->label_compte = $tabuser[$key]['name']; + $bookkeeping->label_operation = $tabuser[$key]['name']; $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt >= 0) ? 'C' : 'D'; @@ -212,9 +213,9 @@ if ($action == 'writebookkeeping') { } } + // Fees if (! $errorforline) { - // Fees foreach ( $tabht[$key] as $k => $mt ) { $accountingaccount = new AccountingAccount($db); $accountingaccount->fetch(null, $k, true); @@ -231,7 +232,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_docdet = $val["fk_expensereportdet"]; $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; - $bookkeeping->label_compte = $accountingaccount->label; + $bookkeeping->label_operation = $accountingaccount->label; $bookkeeping->numero_compte = $k; $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; @@ -261,9 +262,9 @@ if ($action == 'writebookkeeping') { } } + // VAT if (! $errorforline) { - // VAT // var_dump($tabtva); foreach ( $tabtva[$key] as $k => $mt ) { if ($mt) { @@ -277,7 +278,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_docdet = $val["fk_expensereportdet"]; $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; - $bookkeeping->label_compte = $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]); + $bookkeeping->label_operation = $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]); $bookkeeping->numero_compte = $k; $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 9ef1afdac38..e80ae3ba059 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -3,7 +3,7 @@ * Copyright (C) 2007-2010 Jean Heimburger * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2013-2015 Alexandre Spangaro + * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2013-2016 Florian Henry * @@ -208,10 +208,10 @@ if ($action == 'writebookkeeping') { $companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur']; $companystatic->client = $tabcompany[$key]['code_client']; + // Thirdparty if (! $errorforline) { foreach ( $tabttc[$key] as $k => $mt ) { - // get compte id and label if ($mt) { $bookkeeping = new BookKeeping($db); $bookkeeping->doc_date = $val["date"]; @@ -223,7 +223,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_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("subledger_account"); + $bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("subledger_account"); $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt >= 0) ? 'C' : 'D'; @@ -272,7 +272,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->thirdparty_code = $companystatic->code_fournisseur; $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; - $bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $accountingaccount->label; + $bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $accountingaccount->label; $bookkeeping->numero_compte = $k; $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; @@ -319,7 +319,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->thirdparty_code = $companystatic->code_fournisseur; $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; - $bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]); + $bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]); $bookkeeping->numero_compte = $k; $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 4eb4dc72171..a50f8be7fb9 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -1,13 +1,13 @@ * Copyright (C) 2007-2010 Jean Heimburger - * Copyright (C) 2011 Juanjo Menent - * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2013 Christophe Battarel + * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2013 Christophe Battarel * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2013-2016 Olivier Geffroy - * Copyright (C) 2014 Raphaël Doursenaud + * Copyright (C) 2014 Raphaël Doursenaud * * 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 @@ -239,7 +239,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_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("subledger_account"); + $bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("subledger_account"); $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt >= 0) ? 'D' : 'C'; $bookkeeping->debit = ($mt >= 0) ? $mt : 0; @@ -286,7 +286,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; $bookkeeping->numero_compte = $k; - $bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label; + $bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label; $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt < 0) ? 'D' : 'C'; $bookkeeping->debit = ($mt < 0) ? $mt : 0; @@ -332,7 +332,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; $bookkeeping->numero_compte = $k; - $bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT").' '.join(', ',$def_tva[$key][$k]); + $bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT").' '.join(', ',$def_tva[$key][$k]); $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt < 0) ? 'D' : 'C'; $bookkeeping->debit = ($mt < 0) ? $mt : 0; diff --git a/htdocs/accountancy/report/result.php b/htdocs/accountancy/report/result.php index aa31185604a..801ba0a2007 100644 --- a/htdocs/accountancy/report/result.php +++ b/htdocs/accountancy/report/result.php @@ -1,6 +1,6 @@ - * Copyright (C) 2016 Alexandre Spangaro + * Copyright (C) 2016 Alexandre Spangaro * * 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 diff --git a/htdocs/accountancy/supplier/card.php b/htdocs/accountancy/supplier/card.php index 69a7855dfd2..b73c40ced74 100644 --- a/htdocs/accountancy/supplier/card.php +++ b/htdocs/accountancy/supplier/card.php @@ -1,7 +1,7 @@ * Copyright (C) 2005 Simon TOSSER - * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2013-2014 Olivier Geffroy * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Juanjo Menent diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 805c5e40420..3aa8e501bb9 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2015 Alexandre Spangaro + * Copyright (C) 2013-2015 Alexandre Spangaro * Copyright (C) 2014 Juanjo Menent * * This program is free software; you can redistribute it and/or modify diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 164525d5214..dc6b5e7ec20 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2014 Juanjo Menent diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 26000c3fb66..93aeb1746f5 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Juanjo Menent s diff --git a/htdocs/accountancy/tpl/export_journal.tpl.php b/htdocs/accountancy/tpl/export_journal.tpl.php index f69b47a8017..b5b6920e853 100644 --- a/htdocs/accountancy/tpl/export_journal.tpl.php +++ b/htdocs/accountancy/tpl/export_journal.tpl.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2016 Charlie Benke * * This program is free software; you can redistribute it and/or modify diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index d0c0d61a954..939872ce7fd 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2017 Alexandre Spangaro * * 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,9 +16,9 @@ */ /** - * \file htdocs/compta/bank/class/paymentvarious.class.php - * \ingroup salaries - * \brief Class for salaries module payment + * \file htdocs/compta/bank/class/paymentvarious.class.php + * \ingroup bank + * \brief Class for various payment */ // Put here all includes required by your class file @@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; */ class PaymentVarious extends CommonObject { - //public $element='payment_various'; //!< Id that identify managed objects + //public $element='payment_various'; //!< Id that identify managed objects //public $table_element='payment_various'; //!< Name of table without prefix where object is stored var $tms; @@ -74,7 +74,6 @@ class PaymentVarious extends CommonObject $error=0; // Clean parameters - $this->fk_user=trim($this->fk_user); $this->amount=trim($this->amount); $this->label=trim($this->label); $this->note=trim($this->note); @@ -85,10 +84,9 @@ class PaymentVarious extends CommonObject $this->db->begin(); // Update request - $sql = "UPDATE ".MAIN_DB_PREFIX."payment_salary SET"; + $sql = "UPDATE ".MAIN_DB_PREFIX."payment_various SET"; $sql.= " tms=".$this->db->idate($this->tms).","; - $sql.= " fk_user=".$this->fk_user.","; $sql.= " datep=".$this->db->idate($this->datep).","; $sql.= " datev=".$this->db->idate($this->datev).","; $sql.= " sens=".$this->sens.","; @@ -114,10 +112,10 @@ class PaymentVarious extends CommonObject if (! $notrigger) { - // Call trigger - $result=$this->call_trigger('PAYMENT_SALARY_MODIFY',$user); - if ($result < 0) $error++; - // End call triggers + // Call trigger + $result=$this->call_trigger('PAYMENT_VARIOUS_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers } if (! $error) @@ -178,7 +176,6 @@ class PaymentVarious extends CommonObject $this->id = $obj->rowid; $this->ref = $obj->rowid; $this->tms = $this->db->jdate($obj->tms); - $this->fk_user = $obj->fk_user; $this->datep = $this->db->jdate($obj->datep); $this->datev = $this->db->jdate($obj->datev); $this->sens = $obj->sens; @@ -252,12 +249,12 @@ class PaymentVarious extends CommonObject $this->id=0; $this->tms=''; - $this->fk_user=''; $this->datep=''; $this->datev=''; $this->sens=''; $this->amount=''; $this->label=''; + $this->accountancy_code=''; $this->note=''; $this->fk_bank=''; $this->fk_user_author=''; diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php index b50bf07d31a..99362167a07 100644 --- a/htdocs/compta/bank/ligne.php +++ b/htdocs/compta/bank/ligne.php @@ -49,7 +49,7 @@ $confirm=GETPOST('confirm','alpha'); $rowid=GETPOST("rowid",'int'); $orig_account=GETPOST("orig_account"); $backtopage=GETPOST('backtopage'); -$cancel=GETPOSt('cancel'); +$cancel=GETPOST('cancel'); // Security check $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref :''));