From 5cbcef44652a2e7ef086fe54be2f97cc30dc3692 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 20 Oct 2018 08:26:30 +0200 Subject: [PATCH] Debug Lettering --- .../thirdparty_lettering_customer.php | 65 ++++++------- .../thirdparty_lettering_supplier.php | 95 ++++++++----------- .../accountancy/class/bookkeeping.class.php | 14 +-- htdocs/langs/en_US/accountancy.lang | 1 + 4 files changed, 78 insertions(+), 97 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php index fa41b404f03..24532b86e35 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php @@ -23,10 +23,9 @@ /** * \file accountancy/bookkeeping/thirdparty_lettering_customer.php * \ingroup Advanced accountancy - * \brief Onglet de gestion de parametrages des ventilations + * \brief Tab to manage customer lettering */ require '../../main.inc.php'; - require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php'; @@ -34,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; // Load translation files required by the page -$langs->loadLangs(array("compta")); +$langs->loadLangs(array("compta","accountancy")); $action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); @@ -79,6 +78,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $socid = GETPOST("socid", 'int'); // if ($user->societe_id) $socid=$user->societe_id; +$lettering = new lettering($db); $object = new Societe($db); $object->id = $socid; $result = $object->fetch($socid); @@ -87,39 +87,40 @@ if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } -$form = new Form($db); -$BookKeeping = new lettering($db); -$formaccounting = new FormAccounting($db); - /* * Action */ if ($action == 'lettering') { - $result = $BookKeeping->updateLettrage($toselect); + $result = $lettering->updateLettrage($toselect); if ($result < 0) { - setEventMessages('', $BookKeeping->errors, 'errors'); + setEventMessages('', $lettering->errors, 'errors'); $error ++; } } if ($action == 'autolettrage') { - $result = $BookKeeping->lettering_thirdparty($socid); + $result = $lettering->lettering_thirdparty($socid); if ($result < 0) { - setEventMessages('', $BookKeeping->errors, 'errors'); + setEventMessages('', $lettering->errors, 'errors'); $error ++; } } -llxHeader('', 'Compta - Grand Livre'); - /* - * Affichage onglets + * View */ +$form = new Form($db); +$formaccounting = new FormAccounting($db); + +$title=$object->name." - ".$langs->trans('TabLetteringCustomer'); +$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; +llxHeader('',$title,$help_url); + $head = societe_prepare_head($object); dol_htmloutput_mesg(is_numeric($error) ? '' : $error, $errors, 'error'); @@ -192,21 +193,19 @@ if ($resql) { print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Docref", $_SERVER["PHP_SELF"], "bk.doc_ref", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Labelcompte", $_SERVER["PHP_SELF"], "bk.label_compte", "", $param, "", $sortfield, $sortorder); + print_liste_field_titre("LabelAccount", $_SERVER["PHP_SELF"], "bk.label_compte", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "bk.debit", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "bk.credit", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "bk.montant", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Sens", $_SERVER["PHP_SELF"], "bk.sens", "", $param, "", $sortfield, $sortorder); + print_liste_field_titre("Balancing", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Solde", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder); - print ''; + print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder); print "\n"; print ''; print ''; print ''; print ''; - print ' '; + print ' '; print ''; $searchpicto = $form->showFilterButtons(); print $searchpicto; @@ -236,38 +235,36 @@ if ($resql) { print '' . dol_print_date($db->jdate($obj->doc_date), 'day') . ''; print '' . $obj->doc_ref . ''; print '' . $obj->label_compte . ''; - print '' . price($obj->debit) . ''; - print '' . price($obj->credit) . ''; - print '' . price($obj->montant) . ''; - print '' . $obj->sens . ''; - print '' . $obj->code_journal . ''; - print '' . round($solde, 2) . ''; + print '' . price($obj->debit) . ''; + print '' . price($obj->credit) . ''; + print '' . price(round($solde, 2)) . ''; + print '' . $obj->code_journal . ''; if (empty($obj->lettering_code)) { print ''; } else - print '' . $obj->lettering_code . ''; + print '' . $obj->lettering_code . ''; print "\n"; } print ''; - print 'Mouvement totaux' . "\n"; - print '' . price($debit) . ''; - print '' . price($credit) . ''; + print ''.$langs->trans("Total").':' . "\n"; + print '' . price($debit) . ''; + print '' . price($credit) . ''; print ''; print "\n"; print ''; - print 'Solde Comptable' . "\n"; - print '' . price($credit - $debit) . ''; - print ''; + print ''.$langs->trans("Balancing").':' . "\n"; + print '' . price($credit - $debit) . ''; + print ''; print "\n"; print ""; print ''; - print '' . $langs->trans('AccountancyAutoLettering') . ''; + //print '' . $langs->trans('AccountancyAutoLettering') . ''; print ""; $db->free($resql); } else { diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php index b70d0a07242..6fdc5a26452 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php @@ -1,9 +1,9 @@ - * Copyright (C) 2005 Laurent Destailleur - * Copyright (C) 2013 Olivier Geffroy - * Copyright (C) 2013 Florian Henry - * Copyright (C) 2013 Alexandre Spangaro +/* Copyright (C) 2004-2005 Rodolphe Quiedeville + * Copyright (C) 2005 Laurent Destailleur + * Copyright (C) 2013 Olivier Geffroy + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013-2018 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 @@ -21,14 +21,11 @@ */ /** - * \file accountancy/bookkeeping/thirdparty_lettrage_supplier.php - * \ingroup Advanced accountancy - * \brief Tab to setup lettering + * \file accountancy/bookkeeping/thirdparty_lettering_supplier.php + * \ingroup Advanced accountancy + * \brief Tab to setup lettering */ - -// Dolibarr environment require '../../main.inc.php'; - require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php'; @@ -36,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; // Load translation files required by the page -$langs->loadLangs(array("compta")); +$langs->loadLangs(array("compta","accountancy")); $action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); @@ -83,6 +80,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x', $socid = GETPOST("socid", 'int'); // if ($user->societe_id) $socid=$user->societe_id; +$lettering = new lettering($db); $object = new Societe($db); $object->id = $socid; $result = $object->fetch($socid); @@ -91,51 +89,39 @@ if ($result<0) setEventMessages($object->error, $object->errors, 'errors'); } -$form = new Form($db); -$BookKeeping = new lettering($db); -$formaccounting = new FormAccounting($db); - /* * Action */ if ($action == 'lettering') { - $result = $BookKeeping->updateLettrage($toselect); + $result = $lettering->updateLettrage($toselect); - // var_dump($result); if ($result < 0) { - setEventMessages('', $BookKeeping->errors, 'errors'); + setEventMessages('', $lettering->errors, 'errors'); $error ++; } } if ($action == 'autolettrage') { - $result = $BookKeeping->lettering_thirdparty($socid); + $result = $lettering->lettering_thirdparty($socid); if ($result < 0) { - setEventMessages('', $BookKeeping->errors, 'errors'); + setEventMessages('', $lettering->errors, 'errors'); $error ++; } } -$title = 'AccountancyLettrage'; - -llxHeader('', $title); - - -$param=''; -if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; -if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; -if (!empty($search_year)) $param.='&search_year='.$search_year; -if (!empty($socid)) $param.='&socid='.$socid; -if (!empty($search_doc_type)) $param.='&search_doc_type='.$search_doc_type; -if (!empty($search_doc_ref)) $param.='&search_doc_ref='.$search_doc_ref; - - /* - * Display tabs + * View */ +$form = new Form($db); +$formaccounting = new FormAccounting($db); + +$title=$object->name." - ".$langs->trans('TabLetteringSupplier'); +$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; +llxHeader('',$title,$help_url); + $head = societe_prepare_head($object); dol_htmloutput_mesg(is_numeric($error) ? '' : $error, $errors, 'error'); @@ -210,21 +196,19 @@ if ($resql) { print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type","",$param,"",$sortfield,$sortorder); print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date","",$param,"",$sortfield,$sortorder); print_liste_field_titre("Docref", $_SERVER["PHP_SELF"], "bk.doc_ref","",$param,"",$sortfield,$sortorder); - print_liste_field_titre("Labelcompte", $_SERVER["PHP_SELF"], "bk.label_compte","",$param,"",$sortfield,$sortorder); + print_liste_field_titre("LabelAccount", $_SERVER["PHP_SELF"], "bk.label_compte","",$param,"",$sortfield,$sortorder); print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "bk.debit","",$param,"",$sortfield,$sortorder); print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "bk.credit","",$param,"",$sortfield,$sortorder); - print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "bk.montant","",$param,"",$sortfield,$sortorder); - print_liste_field_titre("Sens", $_SERVER["PHP_SELF"], "bk.sens","",$param,"",$sortfield,$sortorder); + print_liste_field_titre("Balancing", $_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder); print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal","",$param,"",$sortfield,$sortorder); - print_liste_field_titre("Solde", $_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder); - print ''; + print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder); print "\n"; print ''; print ''; print ''; print ''; - print ' '; + print ' '; print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; @@ -254,39 +238,36 @@ if ($resql) { print '' . dol_print_date($db->jdate($obj->doc_date), 'day') . ''; print '' . $obj->doc_ref . ''; print '' . $obj->label_compte . ''; - print '' . price($obj->debit) . ''; - print '' . price($obj->credit) . ''; - print '' . price($obj->montant) . ''; - print '' . $obj->sens . ''; - print '' . $obj->code_journal . ''; - print '' . round($solde, 2) . ''; + print '' . price($obj->debit) . ''; + print '' . price($obj->credit) . ''; + print '' . price(round($solde, 2)) . ''; + print '' . $obj->code_journal . ''; if (empty($obj->lettering_code)) { print ''; } else - print '' . $obj->lettering_code . ''; + print '' . $obj->lettering_code . ''; print "\n"; } print ''; - - print 'Mouvement totaux' . "\n"; - print '' . price($debit) . ''; - print '' . price($credit) . ''; + print ''.$langs->trans("Total").':' . "\n"; + print '' . price($debit) . ''; + print '' . price($credit) . ''; print ''; print "\n"; print ''; - print 'Solde Comptable' . "\n"; - print '' . price($credit - $debit) . ''; - print ''; + print ''.$langs->trans("Balancing").':' . "\n"; + print '' . price($credit - $debit) . ''; + print ''; print "\n"; print ""; print ''; - print ''.$langs->trans('AccountancyAutoLettering').''; + //print ''.$langs->trans('AccountancyAutoLettering').''; print ""; $db->free($resql); } else { diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 87d561b6add..6bbc4cce743 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1,7 +1,7 @@ - * Copyright (C) 2015-2017 Alexandre Spangaro - * Copyright (C) 2015-2017 Florian Henry +/* Copyright (C) 2014-2017 Olivier Geffroy + * Copyright (C) 2015-2017 Alexandre Spangaro + * Copyright (C) 2015-2017 Florian Henry * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -19,9 +19,9 @@ */ /** - * \file htdocs/accountancy/class/bookkeeping.class.php - * \ingroup Advanced accountancy - * \brief File of class to manage Ledger (General Ledger and Subledger) + * \file htdocs/accountancy/class/bookkeeping.class.php + * \ingroup Advanced accountancy + * \brief File of class to manage Ledger (General Ledger and Subledger) */ // Class @@ -862,6 +862,7 @@ class BookKeeping extends CommonObject $sql .= " t.label_operation,"; $sql .= " t.debit,"; $sql .= " t.credit,"; + $sql .= " t.lettering_code,"; $sql .= " t.montant,"; $sql .= " t.sens,"; $sql .= " t.fk_user_author,"; @@ -934,6 +935,7 @@ class BookKeeping extends CommonObject $line->credit = $obj->credit; $line->montant = $obj->montant; $line->sens = $obj->sens; + $line->lettering_code = $obj->lettering_code; $line->fk_user_author = $obj->fk_user_author; $line->import_key = $obj->import_key; $line->code_journal = $obj->code_journal; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index e6215269512..e2f6083e6a6 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -226,6 +226,7 @@ AutomaticBindingDone=Automatic binding done ErrorAccountancyCodeIsAlreadyUse=Error, you cannot delete this accounting account because it is used MvtNotCorrectlyBalanced=Movement not correctly balanced. Debit = %s | Credit = %s +Balancing=Balancing FicheVentilation=Binding card GeneralLedgerIsWritten=Transactions are written in the Ledger GeneralLedgerSomeRecordWasNotRecorded=Some of the transactions could not be journalized. If there is no other error message, this is probably because they were already journalized.