diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index d35561359729080387dfa63f67c6db6a62d508d6..62e35fa0f5738a66b7fdf9a9a5058ed195172a8f 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -27,7 +27,6 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; -require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; // Langs $langs->load("compta"); diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index 55c194cd4169125428ea5da54e99ef5ec2aa74af..ca26c35c442083a6103db52629a3854371364215 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; -if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; +if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; $langs->load("errors"); $langs->load("admin"); @@ -1258,8 +1258,8 @@ function fieldListAccountModel($fieldlist, $obj='', $tabname='', $context='') $formadmin = new FormAdmin($db); $formcompany = new FormCompany($db); - $formaccountancy = new FormVentilation($db); - + $formaccounting = new FormAccounting($db); + foreach ($fieldlist as $field => $value) { if ($fieldlist[$field] == 'country') @@ -1400,7 +1400,7 @@ function fieldListAccountModel($fieldlist, $obj='', $tabname='', $context='') if (! empty($conf->accounting->enabled)) { $accountancy_account = (! empty($obj->$fieldlist[$field]) ? $obj->$fieldlist[$field] : 0); - print $formaccountancy->select_account($accountancy_account, $fieldlist[$field], 1, '', 1, 1, 'maxwidth200 maxwidthonsmartphone'); + print $formaccounting->select_account($accountancy_account, $fieldlist[$field], 1, '', 1, 1, 'maxwidth200 maxwidthonsmartphone'); } else { diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 3522460e07b9aaf71ad2653e78de4f1e4863d0f6..73e3fdf6dd9e06df329001e26ee169d3cb2a7490 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -1,7 +1,7 @@ <?php /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> - * Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> - * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> + * Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> + * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> * * 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 @@ -19,7 +19,7 @@ /** * \file htdocs/accountancy/admin/card.php - * \ingroup Advanced accountancy + * \ingroup Advanced accountancy * \brief Card of accounting account */ @@ -27,7 +27,6 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancysystem.class.php'; -require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; $error = 0; @@ -59,7 +58,7 @@ if (GETPOST('cancel')) header("Location: ".$urltogo); exit; } - + if ($action == 'add' && $user->rights->accounting->chartofaccount) { if (! $cancel) { @@ -86,7 +85,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) } else { $account_parent = GETPOST('account_parent','int'); } - + $object->fk_pcg_version = $obj->pcg_version; $object->pcg_type = GETPOST('pcg_type'); $object->pcg_subtype = GETPOST('pcg_subtype'); @@ -95,7 +94,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) $object->account_category = GETPOST('account_category'); $object->label = GETPOST('label', 'alpha'); $object->active = 1; - + $res = $object->create($user); if ($res == - 3) { $error = 1; @@ -124,9 +123,9 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) } else if ($action == 'edit' && $user->rights->accounting->chartofaccount) { if (! $cancel) { $result = $object->fetch($id); - + $sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS; - + dol_syslog('accountancy/admin/card.php:: $sql=' . $sql); $result2 = $db->query($sql); $obj = $db->fetch_object($result2); @@ -156,9 +155,9 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) $object->account_parent = $account_parent; $object->account_category = GETPOST('account_category'); $object->label = GETPOST('label', 'alpha'); - + $result = $object->update($user); - + if ($result > 0) { $urltogo=$backtopage?$backtopage:($_SERVER["PHP_SELF"]."?id=".$id); header("Location: " . $urltogo); @@ -196,7 +195,6 @@ $helpurl = ''; llxheader('', $title, $helpurl); $form = new Form($db); -$htmlacc = new FormVentilation($db); $formaccounting = new FormAccounting($db); $accountsystem = new AccountancySystem($db); @@ -205,13 +203,13 @@ $accountsystem->fetch($conf->global->CHARTOFACCOUNTS); // Create mode if ($action == 'create') { print load_fiche_titre($langs->trans('NewAccountingAccount')); - + print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n"; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="action" value="add">'; - + dol_fiche_head(); - + print '<table class="border" width="100%">'; // Chart of account @@ -219,8 +217,7 @@ if ($action == 'create') { print '<td>'; print $accountsystem->ref; print '</td></tr>'; - - + // Account number print '<tr><td class="titlefieldcreate"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>'; print '<td><input name="account_number" size="30" value="' . $object->account_number . '"></td></tr>'; @@ -232,7 +229,7 @@ if ($action == 'create') { // Account parent print '<tr><td>' . $langs->trans("Accountparent") . '</td>'; print '<td>'; - print $htmlacc->select_account($object->account_parent, 'account_parent', 1, null, 0, 0, 'minwidth200'); + print $formaccounting->select_account($object->account_parent, 'account_parent', 1, null, 0, 0, 'minwidth200'); print '</td></tr>'; // Category @@ -245,72 +242,69 @@ if ($action == 'create') { print '<tr><td>' . $langs->trans("Pcgtype") . '</td>'; print '<td>'; print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(isset($_POST['pcg_type'])?GETPOST('pcg_type','alpha'):$object->pcg_type).'">'; - //print $htmlacc->select_pcgtype($object->pcg_type, 'pcg_type', 1); print '</td></tr>'; // Chart of acounts subtype print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>'; print '<td>'; print '<input type="text" name="pcg_subtype" value="'.dol_escape_htmltag(isset($_POST['pcg_subtype'])?GETPOST('pcg_subtype','alpha'):$object->pcg_subtype).'">'; - //print $htmlacc->select_pcgsubtype($object->pcg_subtype, 'pcg_subtype', 1); print '</td></tr>'; - + print '</table>'; - + dol_fiche_end(); - + print '<div class="center">'; print '<input class="button" type="submit" value="' . $langs->trans("Save") . '">'; print ' '; print '<input class="button" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">'; print '</div>'; - + print '</form>'; } else if ($id) { $result = $object->fetch($id); - + if ($result > 0) { dol_htmloutput_mesg($mesg); - + $head = accounting_prepare_head($object); - + // Edit mode if ($action == 'update') { dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr'); - + print '<form name="update" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n"; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="action" value="edit">'; print '<input type="hidden" name="id" value="' . $id . '">'; print '<input type="hidden" name="backtopage" value="' . $backtopage . '">'; - + print '<table class="border" width="100%">'; - + // Account number print '<tr><td class="titlefieldcreate"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>'; print '<td><input name="account_number" size="30" value="' . $object->account_number . '"</td></tr>'; - + // Label print '<tr><td><span class="fieldrequired">' . $langs->trans("Label") . '</span></td>'; print '<td><input name="label" size="70" value="' . $object->label . '"</td></tr>'; - + // Account parent print '<tr><td>' . $langs->trans("Accountparent") . '</td>'; print '<td>'; - print $htmlacc->select_account($object->account_parent, 'account_parent', 1); + print $formaccounting->select_account($object->account_parent, 'account_parent', 1); print '</td></tr>'; // Category - print '<tr><td>'.$langs->trans("AccountingCategory").'</td>'; + print '<tr><td>'.$langs->trans("AccountingCategory").'</td>'; print '<td>'; - $formaccounting->select_accounting_category($object->account_category, 'account_category', 1); - print '</td></tr>'; + $formaccounting->select_accounting_category($object->account_category, 'account_category', 1); + print '</td></tr>'; // Chart of accounts type print '<tr><td>' . $langs->trans("Pcgtype") . '</td>'; print '<td>'; - //print $htmlacc->select_pcgtype($object->pcg_type, 'pcg_type', 1); print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(isset($_POST['pcg_type'])?GETPOST('pcg_type','alpha'):$object->pcg_type).'">'; print '</td></tr>'; @@ -318,29 +312,27 @@ if ($action == 'create') { print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>'; print '<td>'; print '<input type="text" name="pcg_subtype" value="'.dol_escape_htmltag(isset($_POST['pcg_subtype'])?GETPOST('pcg_subtype','alpha'):$object->pcg_subtype).'">'; - //print $htmlacc->select_pcgsubtype($object->pcg_subtype, 'pcg_subtype', 1); print '</td></tr>'; - + print '</table>'; - + dol_fiche_end(); - + print '<div class="center">'; print '<input type="submit" class="button" value="' . $langs->trans("Save") . '">'; print ' '; print '<input type="submit" name="cancel" class="button" value="' . $langs->trans("Cancel") . '">'; print '</div>'; - + print '</form>'; } else { - // View mode $linkback = '<a href="../admin/account.php">' . $langs->trans("BackToChartofaccounts") . '</a>'; - + dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr'); - + print '<table class="border" width="100%">'; - + // Account number print '<tr><td class="titlefield">' . $langs->trans("AccountNumber") . '</td>'; print '<td>' . $object->account_number . '</td>'; @@ -378,31 +370,30 @@ if ($action == 'create') { } else { print img_picto($langs->trans("Activated"), 'switch_on'); }*/ - + print '</td></tr>'; - + print '</table>'; - + dol_fiche_end(); - + /* * Actions buttons */ - print '<div class="tabsAction">'; - + if (! empty($user->rights->accounting->chartofaccount)) { print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $id . '">' . $langs->trans('Modify') . '</a>'; } else { print '<a class="butActionRefused" href="#" title="' . dol_escape_htmltag($langs->trans("NotAllowed")) . '">' . $langs->trans('Modify') . '</a>'; } - + if (! empty($user->rights->accounting->chartofaccount)) { print '<a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?action=delete&id=' . $id . '">' . $langs->trans('Delete') . '</a>'; } else { print '<a class="butActionRefused" href="#" title="' . dol_escape_htmltag($langs->trans("NotAllowed")) . '">' . $langs->trans('Delete') . '</a>'; } - + print '</div>'; } } else { diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index c0fa895ae4ce5c838ff54583afe3311c8cef7e5e..f3a35350084d51d9e9b9833b04ea60b3899eae1a 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; $langs->load("errors"); $langs->load("admin"); @@ -982,7 +982,7 @@ function fieldListAccountingCategories($fieldlist, $obj='', $tabname='', $contex $formadmin = new FormAdmin($db); $formcompany = new FormCompany($db); - if (! empty($conf->accounting->enabled)) $formaccountancy = new FormVentilation($db); + if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db); foreach ($fieldlist as $field => $value) { @@ -1125,7 +1125,7 @@ function fieldListAccountingCategories($fieldlist, $obj='', $tabname='', $contex { $fieldname = $fieldlist[$field]; $accountancy_account = (! empty($obj->$fieldname) ? $obj->$fieldname : 0); - print $formaccountancy->select_account($accountancy_account, $fieldlist[$field], 1, '', 1, 1, 'maxwidth200 maxwidthonsmartphone'); + print $formaccounting->select_account($accountancy_account, $fieldlist[$field], 1, '', 1, 1, 'maxwidth200 maxwidthonsmartphone'); } else { diff --git a/htdocs/accountancy/admin/defaultaccounts.php b/htdocs/accountancy/admin/defaultaccounts.php index 4b733bee5a6eb2af28bab44210b3197696dc46b7..c2a6453ffeef2ac5a9cefaec13198192b093d539 100644 --- a/htdocs/accountancy/admin/defaultaccounts.php +++ b/htdocs/accountancy/admin/defaultaccounts.php @@ -32,7 +32,7 @@ require '../../main.inc.php'; // Class require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; $langs->load("compta"); $langs->load("bills"); @@ -117,7 +117,7 @@ if ($action == 'update') { llxHeader(); $form = new Form($db); -$formaccountancy = new FormVentilation($db); +$formaccounting = new FormAccounting($db); $linkback = ''; print load_fiche_titre($langs->trans('MenuDefaultAccounts'), $linkback, 'title_accountancy'); @@ -142,7 +142,7 @@ foreach ( $list_account as $key ) { print '<td>' . $label . '</td>'; // Value print '<td>'; // Do not force align=right, or it align also the content of the select box - print $formaccountancy->select_account($conf->global->$key, $key, 1, '', 1, 1); + print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1); print '</td>'; print '</tr>'; } diff --git a/htdocs/accountancy/admin/importaccounts.php b/htdocs/accountancy/admin/importaccounts.php index 4a6c82cb5811fc67496bd6a825b0f19f2b9ea73b..1bb1bf178b30916de4cdf9f10654d3355e3f9d24 100644 --- a/htdocs/accountancy/admin/importaccounts.php +++ b/htdocs/accountancy/admin/importaccounts.php @@ -1,8 +1,7 @@ <?php -/* - * Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> - * Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> - * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> +/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> + * Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> + * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> * * 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 @@ -28,7 +27,7 @@ require '../../main.inc.php'; // Class require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; -require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; // langs $langs->load("compta"); @@ -65,22 +64,22 @@ if ($_POST["action"] == 'import') { if (is_array($to_import) && count($to_import) > 0) { print '<div><font color="red">' . count($to_import) . ' ' . $langs->trans("SelectedLines") . '</font></div>'; $sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS; - + $result = $db->query($sql); if ($result && ($db->num_rows($result) > 0)) { - + $obj = $db->fetch_object($result); - + $cpt = 0; foreach ( $to_import as $maLigneCochee ) { - + $accounting = new AccountingAccount($db); - + $monLabel = GETPOST('label' . $maLigneCochee); $monParentAccount = GETPOST('AccountParent' . $maLigneCochee); $monType = GETPOST('pcgType' . $maLigneCochee); $monSubType = GETPOST('pcgSubType' . $maLigneCochee); - + $accounting->fk_pcg_version = $obj->pcg_version; $accounting->account_number = $maLigneCochee; $accounting->label = $monLabel; @@ -126,10 +125,10 @@ if ($result) { $num_lines = $db->num_rows($result); $i = 0; print_barre_liste($langs->trans("ImportAccount"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines); - + print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n"; print '<input type="hidden" name="action" value="import">'; - + print '<table class="noborder" width="100%">'; print '<tr class="liste_titre"><td>' . $langs->trans("AccountAccouting") . '</td>'; print '<td>' . $langs->trans("label") . '</td>'; @@ -138,44 +137,43 @@ if ($result) { print '<td>' . $langs->trans("Pcgsubtype") . '</td>'; print '<td align="center">' . $langs->trans("Import") . '</td>'; print '</tr>'; - + $form = new Form($db); - $htmlacc = new FormVentilation($db); - + $formaccounting = new FormAccounting($db); + $var = true; while ( $i < min($num_lines, $limit) ) { $objp = $db->fetch_object($result); print '<tr class="oddeven">'; - + print '<td align="left">'; print $objp->accounting; print '</td>'; - + print '<td align="left">'; print '<input name="label" size="30" value="">'; print '</td>'; - + // Colonne choix du compte print '<td>'; - print $htmlacc->select_account($accounting->account_parent, 'AccountParent'); + print $formaccounting->select_account($accounting->account_parent, 'AccountParent'); print '</td>'; - + print '<td>'; - print $htmlacc->select_pcgtype($accounting->pcg_type, 'pcgType'); + print '<input type="text" name="pcgType" value="'.dol_escape_htmltag(isset($_POST['pcg_subtype'])?GETPOST('pcg_subtype','alpha'):$accounting->pcg_type).'">'; print '</td>'; - + print '<td>'; - print $htmlacc->select_pcgsubtype($accounting->pcg_subtype, 'pcgSubType'); + print '<input type="text" name="pcgSubType" value="'.dol_escape_htmltag(isset($_POST['pcg_subtype'])?GETPOST('pcg_subtype','alpha'):$accounting->pcg_subtype).'">'; print '</td>'; - + // Colonne choix ligne a ventiler - $checked = ('label' == 'O') ? ' checked' : ''; - + print '<td align="center">'; print '<input type="checkbox" name="mesCasesCochees[]" ' . $checked . ' value="' . $objp->accounting . '"/>'; print '</td>'; - + print '</tr>'; $i ++; } diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 899aaa1a3d2308e2ead33b7e3d749c94fbd44cf3..0e1f67a0e610d26bc6294a761640ee0207441247 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -1,11 +1,11 @@ <?php -/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> - * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> - * Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com> - * Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com> +/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> + * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> + * Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com> + * Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> - * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> - * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> + * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> + * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * * 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 @@ -31,8 +31,6 @@ require '../../main.inc.php'; // Class require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; $langs->load("compta"); $langs->load("bills"); @@ -160,7 +158,6 @@ if ($action == 'setdisabledirectinput') { llxHeader(); $form = new Form($db); -$formaccountancy = new FormVentilation($db); $linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>'; print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup'); diff --git a/htdocs/accountancy/admin/journal.php b/htdocs/accountancy/admin/journal.php deleted file mode 100644 index 8e19a3e3e871ca6eca6955f4631dd8f7400d0f49..0000000000000000000000000000000000000000 --- a/htdocs/accountancy/admin/journal.php +++ /dev/null @@ -1,207 +0,0 @@ -<?php -/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> - * Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com> - * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> - * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> - * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> - * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> - * Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net> - * - * 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 - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -/** - * \file htdocs/accountancy/admin/journal.php -* \ingroup Advanced accountancy -* \brief Setup page to configure accounting expert module -*/ -require '../../main.inc.php'; - -// Class -require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; - -$langs->load("compta"); -$langs->load("bills"); -$langs->load("admin"); -$langs->load("accountancy"); -$langs->load("salaries"); - -// Security check -if (empty($user->admin) || ! empty($user->rights->accountancy->chartofaccount)) -{ - accessforbidden(); -} - -$action = GETPOST('action', 'alpha'); - -// Other parameters ACCOUNTING_* -$list = array ( - 'ACCOUNTING_SELL_JOURNAL', - 'ACCOUNTING_PURCHASE_JOURNAL', - 'ACCOUNTING_SOCIAL_JOURNAL', - 'ACCOUNTING_MISCELLANEOUS_JOURNAL', - 'ACCOUNTING_EXPENSEREPORT_JOURNAL' -); - -/* - * Actions -*/ - -if ($action == 'update') { - $error = 0; - - // Save vars - foreach ($list as $constname) - { - $constvalue = GETPOST($constname, 'alpha'); - - if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { - $error ++; - } - } - - // Save bank account journals - $arrayofbankaccount = GETPOST('bank_account', 'array'); - foreach($arrayofbankaccount as $key => $code) - { - $bankaccount = new Account($db); - $res = $bankaccount->fetch($key); - if ($res > 0) - { - $bankaccount->accountancy_journal = $code; - $bankaccount->update($user); - } - else - { - $error++; - break; - } - } - - if (! $error) { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - setEventMessages($langs->trans("Error"), null, 'errors'); - } -} - -/* - * View -*/ - -llxHeader(); - -$form = new Form($db); - -$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>'; -print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup'); - -$head = admin_accounting_prepare_head(null); - -print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">'; -print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; -print '<input type="hidden" name="action" value="update">'; - -dol_fiche_head($head, 'journal', $langs->trans("Configuration"), 0, 'cron'); - -print '<table class="noborder" width="100%">'; -print '<tr class="liste_titre">'; -print '<td colspan="2">' . $langs->trans('Journaux') . '</td>'; -print "</tr>\n"; - -foreach ( $list as $key ) { - - print '<tr class="oddeven value">'; - - // Param - $label = $langs->trans($key); - print '<td width="50%"><label for="' . $key . '">' . $label . '</label></td>'; - - // Value - print '<td>'; - print '<input type="text" size="20" id="' . $key . '" name="' . $key . '" value="' . $conf->global->$key . '">'; - print '</td></tr>'; -} - -print "</table>\n"; - -print '<br>'; - -print '<table class="noborder" width="100%">'; -print '<tr class="liste_titre">'; -print '<td colspan="2">' . $langs->trans('JournalFinancial') . ' ('.$langs->trans('Opened').')</td>'; -print "</tr>\n"; - -// Bank account -$sql = "SELECT rowid, ref, label, number, account_number, accountancy_journal"; -$sql .= " FROM " . MAIN_DB_PREFIX . "bank_account"; -$sql .= " WHERE entity = " . $conf->entity; -$sql .= " AND clos = 0"; -$sql .= " ORDER BY label"; - -$resql = $db->query($sql); -if ($resql) { - $numr = $db->num_rows($resql); - $i = 0; - - if ($numr > 0) - - $bankaccountstatic = new Account($db); - - while ( $i < $numr ) { - $objp = $db->fetch_object($resql); - - $bankaccountstatic->rowid = $objp->rowid; - $bankaccountstatic->id = $objp->rowid; - $bankaccountstatic->ref = $objp->ref; - $bankaccountstatic->label = $objp->label; - $bankaccountstatic->number = $objp->number; - $bankaccountstatic->account_number = $objp->account_number; - $bankaccountstatic->accountancy_journal = $objp->accountancy_journal; - - print '<tr class="oddeven value">'; - - // Param - print '<td width="50%"><label for="' . $objp->rowid . '">' . $langs->trans("Journal"); - print ' - '.$bankaccountstatic->getNomUrl(1); - print '</label></td>'; - - // Value - print '<td>'; - print '<input type="text" size="20" id="' . $objp->rowid . '" name="bank_account['.$objp->rowid.']" value="' . $objp->accountancy_journal . '">'; - print '</td></tr>'; - - $i ++; - } - $db->free($resql); -} -else -{ - dol_print_error($db); -} - -print "</table>\n"; - -dol_fiche_end(); - -print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('Modify') . '" name="button"></div>'; - -print '</form>'; - -llxFooter(); -$db->close(); \ No newline at end of file diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 359a8b40c12c67f4a45844564b0baf3ba4fad9cc..fcb44c6f858ca5a366ffda2acf07e52a0f85d6b4 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; @@ -184,7 +184,7 @@ if ($action == 'update') { * View */ -$form = new FormVentilation($db); +$form = new FormAccounting($db); // Defaut AccountingAccount RowId Product / Service // at this time ACCOUNTING_SERVICE_SOLD_ACCOUNT & ACCOUNTING_PRODUCT_SOLD_ACCOUNT are account number not accountingacount rowid diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 9e5be25eb73f4397cf4d2b0479c6573daff7403a..3111707cff666a81ac4cef4ce6c9f7013ef2ac3a 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -28,8 +28,8 @@ require '../../main.inc.php'; // Class require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; // Langs @@ -61,7 +61,7 @@ $offset = $limit * $page; $object = new BookKeeping($db); -$formventilation = new FormVentilation($db); +$formaccounting = new FormAccounting($db); $formother = new FormOther($db); $form = new Form($db); @@ -186,10 +186,10 @@ else { print '<tr class="liste_titre_filter">'; print '<td class="liste_titre" colspan="5">'; print $langs->trans('From'); - print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, ''); + print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, ''); print ' '; print $langs->trans('to'); - print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array(), 1, 1, ''); + print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array(), 1, 1, ''); print '</td>'; print '<td align="right" class="liste_titre">'; $searchpicto=$form->showFilterAndCheckAddButtons(0); diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 7ee3e6bb4fe186c72b2e9a45d78a2a48f95850cb..4443fb959b2dce7c7e946e1d76da06ec4c1e24d9 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -27,9 +27,8 @@ require '../../main.inc.php'; // Class 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 . '/accountancy/class/html.formventilation.class.php'; -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; // Langs $langs->load("accountancy"); @@ -215,7 +214,6 @@ else if ($action == "confirm_create") { llxHeader(); $html = new Form($db); -$formventilation = new FormVentilation($db); $formaccountancy = new FormAccounting($db); /* @@ -389,10 +387,10 @@ if ($action == 'create') { if ($action == 'update' && $line->id == $id) { print '<td>'; - print $formventilation->select_account($line->numero_compte, 'account_number', 0, array (), 1, 1, ''); + print $formaccounting->select_account($line->numero_compte, 'account_number', 0, array (), 1, 1, ''); print '</td>'; print '<td>'; - print $formventilation->select_auxaccount($line->code_tiers, 'code_tiers', 1); + print $formaccounting->select_auxaccount($line->code_tiers, 'code_tiers', 1); print '</td>'; print '<td><input type="text" size="15" name="label_compte" value="' . $line->label_compte . '"/></td>'; print '<td align="right"><input type="text" size="6" name="debit" value="' . price($line->debit) . '"/></td>'; @@ -433,10 +431,10 @@ if ($action == 'create') { if ($action == "" || $action == 'add') { print '<tr class="oddeven">'; print '<td>'; - print $formventilation->select_account($account_number, 'account_number', 0, array (), 1, 1, ''); + print $formaccounting->select_account($account_number, 'account_number', 0, array (), 1, 1, ''); print '</td>'; print '<td>'; - print $formventilation->select_auxaccount($code_tiers, 'code_tiers', 1); + print $formaccounting->select_auxaccount($code_tiers, 'code_tiers', 1); print '</td>'; print '<td><input type="text" size="15" name="label_compte" value="' . $label_compte . '"/></td>'; print '<td align="right"><input type="text" class="right maxwidth50" name="debit" value="' . price($debit) . '"/></td>'; diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 0c49ac0e1baa1a4d85928b8bba2f7953b2af6694..369dd7afcec88bf1688aedec73d5a2d2d0b1e469 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -28,10 +28,10 @@ require '../../main.inc.php'; // Class require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php'; -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; // Langs $langs->load("accountancy"); @@ -94,7 +94,7 @@ if ($sortfield == "") $sortfield = "t.rowid"; $object = new BookKeeping($db); -$formventilation = new FormVentilation($db); +$formaccounting = new FormAccounting($db); $formother = new FormOther($db); $form = new Form($db); @@ -292,7 +292,6 @@ $title_page = $langs->trans("Bookkeeping"); llxHeader('', $title_page); // List - $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter); @@ -322,8 +321,8 @@ if ($action == 'delbookkeepingyear') { if (empty($delyear)) { $delyear = dol_print_date(dol_now(), '%Y'); } - $year_array = $formventilation->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array'); - $journal_array = $formventilation->selectjournal_accountancy_bookkepping($deljournal, 'deljournal', 0, 'array'); + $year_array = $formaccounting->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array'); + $journal_array = $formaccounting->selectjournal($deljournal, 'deljournal', '', 1, 'array', 1, 1); $form_question['delyear'] = array ( 'name' => 'delyear', @@ -386,17 +385,17 @@ print '</td>'; print '<td class="liste_titre"><input type="text" name="search_doc_ref" size="8" value="' . dol_escape_htmltag($search_doc_ref) . '"></td>'; print '<td class="liste_titre">'; print $langs->trans('From'); -print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, ''); +print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, ''); print '<br>'; print $langs->trans('to'); -print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, ''); +print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, ''); print '</td>'; print '<td class="liste_titre">'; print $langs->trans('From'); -print $formventilation->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1); +print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1); print '<br>'; print $langs->trans('to'); -print $formventilation->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1); +print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1); print '</td>'; print '<td class="liste_titre">'; print '<input type="text" size="7" class="flat" name="search_mvt_label" value="' . $search_mvt_label . '"/>'; diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index eb8a53561d2bfda0c23893a8e0f895c18d2f2b82..6b329e421ade6a900e552fd28a437e0621dfa994 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -29,8 +29,8 @@ require '../../main.inc.php'; // Class require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; // Langs @@ -75,7 +75,7 @@ if (empty($search_date_end)) $search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_ $object = new BookKeeping($db); -$formventilation = new FormVentilation($db); +$formaccounting = new FormAccounting($db); $formother = new FormOther($db); $form = new Form($db); @@ -188,7 +188,7 @@ if ($action == 'delbookkeepingyear') { if (empty($delyear)) { $delyear = dol_print_date(dol_now(), '%Y'); } - $year_array = $formventilation->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array'); + $year_array = $formaccounting->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array'); $form_question['delyear'] = array ( 'name' => 'delyear', diff --git a/htdocs/accountancy/bookkeeping/listbyyear.php b/htdocs/accountancy/bookkeeping/listbyyear.php index 263f293043a6554a721a659d43f982edff57d0da..5fba55f2eba852d7979e042ada35d80782f78102 100644 --- a/htdocs/accountancy/bookkeeping/listbyyear.php +++ b/htdocs/accountancy/bookkeeping/listbyyear.php @@ -29,7 +29,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.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 . '/accountancy/class/html.formventilation.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; // Langs $langs->load("accountancy"); @@ -67,7 +67,7 @@ $search_code_journal = GETPOST('search_code_journal', 'alpha'); $object = new BookKeeping($db); $form = new Form($db); -$formventilation = new FormVentilation($db); +$formaccounting = new FormAccounting($db); // Filter if (empty($search_date_start)) { @@ -182,15 +182,15 @@ print $form->select_date($search_date_end, 'date_end'); print '</div>'; print '<div class="liste_titre">'; print $langs->trans('From') . ' ' . $langs->trans('AccountAccounting') . ': '; -print $formventilation->select_account($search_numero_compte_start, 'search_numero_compte_start', 1, array (), 1, 1, ''); +print $formaccounting->select_account($search_numero_compte_start, 'search_numero_compte_start', 1, array (), 1, 1, ''); print $langs->trans('To') . ' ' . $langs->trans('AccountAccounting') . ': '; -print $formventilation->select_account($search_numero_compte_end, 'search_numero_compte_end', 1, array (), 1, 1, ''); +print $formaccounting->select_account($search_numero_compte_end, 'search_numero_compte_end', 1, array (), 1, 1, ''); print '</div>'; print '<div class="liste_titre">'; print $langs->trans('From') . ' ' . $langs->trans('ThirdPartyAccount') . ': '; -print $formventilation->select_auxaccount($search_code_tiers_start, 'search_code_tiers_start', 1); +print $formaccounting->select_auxaccount($search_code_tiers_start, 'search_code_tiers_start', 1); print $langs->trans('To') . ' ' . $langs->trans('ThirdPartyAccount') . ': '; -print $formventilation->select_auxaccount($search_code_tiers_end, 'searchcode_tiers_end', 1); +print $formaccounting->select_auxaccount($search_code_tiers_end, 'searchcode_tiers_end', 1); print '</div>'; print "<table class=\"noborder\" width=\"100%\">"; diff --git a/htdocs/accountancy/class/html.formventilation.class.php b/htdocs/accountancy/class/html.formventilation.class.php deleted file mode 100644 index 112bde760382855ad18a792e435d341ef77ec790..0000000000000000000000000000000000000000 --- a/htdocs/accountancy/class/html.formventilation.class.php +++ /dev/null @@ -1,383 +0,0 @@ -<?php -/* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro> - * Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> - * Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> - * Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com> - * Copyright (C) 2016 Marcos García <marcosgdf@gmail.com> - * - * 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 - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -/** - * \file htdocs/accountancy/class/html.formventilation.class.php - * \ingroup Advanced accountancy - * \brief File of class with all html predefined components - */ - -/** - * Class to manage generation of HTML components for bank module - */ -class FormVentilation extends Form -{ - - private $options_cache = array(); - - - /** - * Return select filter with date of transaction - * - * @param string $htmlname Name of select field - * @param string $selectedkey Value - * @return string HTML edit field - */ - function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '') { - $options = array(); - - $sql = 'SELECT DISTINCT import_key from ' . MAIN_DB_PREFIX . 'accounting_bookkeeping'; - $sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")"; - $sql .= ' ORDER BY import_key DESC'; - - dol_syslog(get_class($this) . "::select_bookkeeping_importkey", LOG_DEBUG); - $resql = $this->db->query($sql); - - if (!$resql) { - $this->error = "Error " . $this->db->lasterror(); - dol_syslog(get_class($this) . "::select_bookkeeping_importkey " . $this->error, LOG_ERR); - return - 1; - } - - while ($obj = $this->db->fetch_object($resql)) { - $options[$obj->import_key] = dol_print_date($obj->import_key, 'dayhourtext'); - } - - return Form::selectarray($htmlname, $options, $selectedkey); - } - - /** - * Return list of accounts with label by chart of accounts - * - * @param string $selectid Preselected id or code of accounting accounts (depends on $select_in) - * @param string $htmlname Name of field in html form - * @param int $showempty Add an empty field - * @param array $event Event options - * @param int $select_in 0=selectid value is a aa.rowid (default) or 1=selectid is aa.account_number - * @param int $select_out Set value returned by select. 0=rowid (default), 1=account_number - * @param string $morecss More css non HTML object - * @param string $usecache Key to use to store result into a cache. Next call with same key will reuse the cache. - * @return string String with HTML select - */ - function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $morecss='maxwidth300 maxwidthonsmartphone', $usecache='') - { - global $conf; - - require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; - - $out = ''; - - $options = array(); - if ($usecache && ! empty($this->options_cache[$usecache])) - { - $options = $this->options_cache[$usecache]; - $selected=$selectid; - } - else - { - $trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50; - - $sql = "SELECT DISTINCT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version"; - $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa"; - $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 .= " ORDER BY aa.account_number"; - - dol_syslog(get_class($this) . "::select_account", LOG_DEBUG); - $resql = $this->db->query($sql); - - if (!$resql) { - $this->error = "Error " . $this->db->lasterror(); - dol_syslog(get_class($this) . "::select_account " . $this->error, LOG_ERR); - return -1; - } - - $out .= ajax_combobox($htmlname, $event); - - $selected = 0; - while ($obj = $this->db->fetch_object($resql)) - { - $label = length_accountg($obj->account_number) . ' - ' . $obj->label; - $label = dol_trunc($label, $trunclength); - - $select_value_in = $obj->rowid; - $select_value_out = $obj->rowid; - - // Try to guess if we have found default value - if ($select_in == 1) { - $select_value_in = $obj->account_number; - } - if ($select_out == 1) { - $select_value_out = $obj->account_number; - } - // Remember guy's we store in database llx_facturedet the rowid of accounting_account and not the account_number - // Because same account_number can be share between different accounting_system and do have the same meaning - if ($selectid != '' && $selectid == $select_value_in) { - //var_dump("Found ".$selectid." ".$select_value_in); - $selected = $select_value_out; - } - - $options[$select_value_out] = $label; - } - $this->db->free($resql); - - if ($usecache) - { - $this->options_cache[$usecache] = $options; - } - } - - $out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, 1); - - return $out; - } - - /** - * Return list of accounts with label by class of accounts - * - * @param string $selectid Preselected pcg_type - * @param string $htmlname Name of field in html form - * @param int $showempty Add an empty field - * @param array $event Event options - * - * @return string String with HTML select - */ - function select_pcgtype($selectid, $htmlname = 'pcg_type', $showempty = 0, $event = array()) { - global $conf; - - $sql = "SELECT DISTINCT pcg_type "; - $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa"; - $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 .= " ORDER BY pcg_type"; - - dol_syslog(get_class($this) . "::select_pcgtype", LOG_DEBUG); - $resql = $this->db->query($sql); - - if (!$resql) { - $this->error = "Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::select_pcgtype ".$this->error, LOG_ERR); - return -1; - } - - $options = array(); - $out = ajax_combobox($htmlname, $event); - - while ($obj = $this->db->fetch_object($resql)) - { - if ($obj->pcg_type != '-1') - { - $options[$obj->pcg_type] = $obj->pcg_type; - } - } - - $out .= Form::selectarray($htmlname, $options, $selectid, $showempty, 0, 0, '', 0, 0, 0, '', 'minwidth200'); - - $this->db->free($resql); - return $out; - } - - /** - * Return list of accounts with label by sub_class of accounts - * - * @param string $selectid Preselected pcg_type - * @param string $htmlname Name of field in html form - * @param int $showempty Add an empty field - * @param array $event Event options - * - * @return string String with HTML select - */ - function select_pcgsubtype($selectid, $htmlname = 'pcg_subtype', $showempty = 0, $event = array()) - { - global $conf; - - $sql = "SELECT DISTINCT pcg_subtype "; - $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa"; - $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 .= " ORDER BY pcg_subtype"; - - dol_syslog(get_class($this) . "::select_pcgsubtype", LOG_DEBUG); - $resql = $this->db->query($sql); - - if (!$resql) { - $this->error = "Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::select_pcgsubtype ".$this->error, LOG_ERR); - return -1; - } - - $options = array(); - $out = ajax_combobox($htmlname, $event); - - while ($obj = $this->db->fetch_object($resql)) - { - if ($obj->pcg_type != '-1') - { - $options[$obj->pcg_subtype] = $obj->pcg_subtype; - } - } - - $out .= Form::selectarray($htmlname, $options, $selectid, $showempty, 0, 0, '', 0, 0, 0, '', 'minwidth200'); - - $this->db->free($resql); - return $out; - } - - /** - * Return list of auxilary thirdparty accounts - * - * @param string $selectid Preselected pcg_type - * @param string $htmlname Name of field in html form - * @param int $showempty Add an empty field - * @param array $event Event options - * - * @return string String with HTML select - */ - function select_auxaccount($selectid, $htmlname = 'account_num_aux', $showempty = 0, $event = array()) { - - $aux_account = array(); - - // Auxiliary customer account - $sql = "SELECT DISTINCT code_compta, nom "; - $sql .= " FROM ".MAIN_DB_PREFIX."societe"; - $sql .= " WHERE entity IN (" . getEntity("societe", 1) . ")"; - $sql .= " ORDER BY code_compta"; - dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) { - while ($obj = $this->db->fetch_object($resql)) { - if (!empty($obj->code_compta)) { - $aux_account[$obj->code_compta] = $obj->code_compta.' ('.$obj->nom.')'; - } - } - } else { - $this->error = "Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::select_pcgsubtype ".$this->error, LOG_ERR); - return -1; - } - $this->db->free($resql); - - // Auxiliary supplier account - $sql = "SELECT DISTINCT code_compta_fournisseur, nom "; - $sql .= " FROM ".MAIN_DB_PREFIX."societe"; - $sql .= " WHERE entity IN (" . getEntity("societe", 1) . ")"; - $sql .= " ORDER BY code_compta_fournisseur"; - dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) { - while ($obj = $this->db->fetch_object($resql)) { - if (!empty($obj->code_compta_fournisseur)) { - $aux_account[$obj->code_compta_fournisseur] = $obj->code_compta_fournisseur.' ('.$obj->nom.')'; - } - } - } else { - $this->error = "Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::select_pcgsubtype ".$this->error, LOG_ERR); - return -1; - } - $this->db->free($resql); - - // Build select - $out = ajax_combobox($htmlname, $event); - $out .= Form::selectarray($htmlname, $aux_account, $selectid, $showempty, 0, 0, '', 0, 0, 0, '', 'maxwidth300'); - - return $out; - } - - /** - * Return HTML combo list of years existing into book keepping - * - * @param string $selected Preselected value - * @param string $htmlname Name of HTML select object - * @param int $useempty Affiche valeur vide dans liste - * @param string $output_format (html/opton (for option html only)/array (to return options arrays - * @return string/array - */ - function selectyear_accountancy_bookkepping($selected = '', $htmlname = 'yearid', $useempty = 0, $output_format = 'html') - { - global $conf; - - $out_array = array(); - - $sql = "SELECT DISTINCT date_format(doc_date,'%Y') as dtyear"; - $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping"; - $sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")"; - $sql .= " ORDER BY date_format(doc_date,'%Y')"; - dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG); - $resql = $this->db->query($sql); - - if (!$resql) { - $this->error = "Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::".__METHOD__.$this->error, LOG_ERR); - return -1; - } - while ($obj = $this->db->fetch_object($resql)) { - $out_array[$obj->dtyear] = $obj->dtyear; - } - $this->db->free($resql); - - if ($output_format == 'html') { - return Form::selectarray($htmlname, $out_array, $selected, $useempty, 0, 0, 'placeholder="aa"'); - } else { - return $out_array; - } - } - - /** - * Return HTML combo list of years existing into book keepping - * - * @param string $selected Preselected value - * @param string $htmlname Name of HTML select object - * @param int $useempty Affiche valeur vide dans liste - * @param string $output_format Html/option (for option html only)/array (to return options arrays - * @return string/array - */ - function selectjournal_accountancy_bookkepping($selected = '', $htmlname = 'journalid', $useempty = 0, $output_format = 'html') - { - global $conf,$langs; - - $out_array = array(); - - $sql = "SELECT DISTINCT code_journal"; - $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping"; - $sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")"; - $sql .= " ORDER BY code_journal"; - dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG); - $resql = $this->db->query($sql); - - if (!$resql) { - $this->error = "Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::".__METHOD__.$this->error, LOG_ERR); - return -1; - } - while ($obj = $this->db->fetch_object($resql)) { - $out_array[$obj->code_journal] = $obj->code_journal?$obj->code_journal:$langs->trans("NotDefined"); // TODO Not defined is accepted ? We should avoid this, shouldn't we ? - } - $this->db->free($resql); - - if ($output_format == 'html') { - return Form::selectarray($htmlname, $out_array, $selected, $useempty, 0, 0, 'placeholder="aa"'); - } else { - return $out_array; - } - } -} diff --git a/htdocs/accountancy/customer/card.php b/htdocs/accountancy/customer/card.php index baa70bf51e880e8cd209d0bbe04f4e24e0544ebd..eca3be1d4772308b38c6e21520ddc6094795a5b2 100644 --- a/htdocs/accountancy/customer/card.php +++ b/htdocs/accountancy/customer/card.php @@ -1,7 +1,7 @@ <?php /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> - * Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> + * Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * * 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 @@ -26,7 +26,7 @@ require '../../main.inc.php'; // Class require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; -require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; // Langs $langs->load("bills"); @@ -39,9 +39,7 @@ $id = GETPOST('id'); // Security check if ($user->societe_id > 0) accessforbidden(); - - - + /* * Actions */ @@ -84,7 +82,7 @@ if ($cancel == $langs->trans("Cancel")) { */ $form = new Form($db); $facture_static = new Facture($db); -$formventilation = new FormVentilation($db); +$formaccounting = new FormAccounting($db); if (! empty($id)) { $sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, l.price,"; @@ -96,50 +94,50 @@ if (! empty($id)) { $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = l.fk_facture"; $sql .= " WHERE f.fk_statut > 0 AND l.rowid = " . $id; $sql .= " AND f.entity IN (" . getEntity("facture", 0) . ")"; // We don't share object for accountancy - + dol_syslog("/accounting/customer/card.php sql=" . $sql, LOG_DEBUG); $result = $db->query($sql); - + if ($result) { $num_lines = $db->num_rows($result); $i = 0; - + if ($num_lines) { - + $objp = $db->fetch_object($result); - + print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '" method="post">' . "\n"; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="action" value="ventil">'; - + print load_fiche_titre($langs->trans('CustomersVentilation'), '', 'title_setup'); - + dol_fiche_head(); - + print '<table class="border" width="100%">'; - + // Ref facture print '<tr><td>' . $langs->trans("Invoice") . '</td>'; $facture_static->ref = $objp->facnumber; $facture_static->id = $objp->facid; print '<td>' . $facture_static->getNomUrl(1) . '</td>'; print '</tr>'; - + print '<tr><td width="20%">' . $langs->trans("Line") . '</td>'; print '<td>' . nl2br($objp->description) . '</td></tr>'; print '<tr><td width="20%">' . $langs->trans("Account") . '</td><td>'; - print $formventilation->select_account($objp->fk_code_ventilation, 'codeventil', 1); + print $formaccounting->select_account($objp->fk_code_ventilation, 'codeventil', 1); print '</td></tr>'; print '</table>'; - + dol_fiche_end(); - + print '<div class="center">'; print '<input class="button" type="submit" value="' . $langs->trans("Save") . '">'; print ' '; print '<input class="button" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">'; print '</div>'; - + print '</form>'; } else { print "Error"; diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 52b3a31d6f08d51586b3ccc80f3c343c24513924..f3763dd9ca02038750618e4684ee50582224fbde 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -28,7 +28,7 @@ require '../../main.inc.php'; // Class -require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; @@ -77,7 +77,7 @@ if ($user->societe_id > 0) if (! $user->rights->accounting->bind->write) accessforbidden(); -$formventilation = new FormVentilation($db); +$formaccounting = new FormAccounting($db); /* @@ -254,14 +254,14 @@ if ($result) { print $langs->trans("DescVentilDoneCustomer") . '<br>'; print '<br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>'; - print $formventilation->select_account($account_parent, 'account_parent', 1); + print $formaccounting->select_account($account_parent, 'account_parent', 1); print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("ChangeBinding") . '"/></div>'; $moreforfilter = ''; - - print '<div class="div-table-responsive">'; + + print '<div class="div-table-responsive">'; print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n"; - + print '<tr class="liste_titre_filter">'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>'; @@ -278,7 +278,7 @@ if ($result) { $searchpicto=$form->showFilterButtons(); print $searchpicto; print "</td></tr>\n"; - + print '<tr class="liste_titre">'; print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "fd.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder); @@ -303,16 +303,16 @@ if ($result) { $facture_static->ref = $objp->facnumber; $facture_static->id = $objp->rowid; - + $product_static->ref = $objp->product_ref; $product_static->id = $objp->product_id; $product_static->type = $objp->product_type; $product_static->label = $objp->product_label; - + print '<tr class="oddeven">'; print '<td>' . $objp->rowid . '</td>'; - + // Ref Invoice print '<td>' . $facture_static->getNomUrl(1) . '</td>'; @@ -324,13 +324,13 @@ if ($result) { print $product_static->getNomUrl(1); if ($objp->product_label) print '<br>'.$objp->product_label; print '</td>'; - + print '<td>'; $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description)); $trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32; print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->description); print '</td>'; - + print '<td align="right">' . price($objp->total_ht) . '</td>'; print '<td align="center">' . price($objp->tva_tx) . '</td>'; print '<td>'; @@ -338,20 +338,20 @@ if ($result) { print img_edit(); print '</a>'; print '</td>'; - + print '<td>' . $objp->country .'</td>'; - + print '<td>' . $objp->tva_intra . '</td>'; - + print '<td class="center"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="' . $objp->rowid . '"/></td>'; print "</tr>"; $i ++; } - + print "</table>"; print "</div>"; - + if ($nbtotalofrecords > $limit) { print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, '', 0, '', '', $limit, 1); } diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index bbd875e0dbf53105980737a972ba57d9f5697bfc..8af289f2c991d3c88cba0d8848ccaec1e16b8f74 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -30,7 +30,7 @@ require '../../main.inc.php'; // Class require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; -require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; @@ -85,7 +85,7 @@ if ($user->societe_id > 0) if (! $user->rights->accounting->bind->write) accessforbidden(); -$formventilation = new FormVentilation($db); +$formaccounting = new FormAccounting($db); $accounting = new AccountingAccount($db); $aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT, 1); $aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT, 1); @@ -101,7 +101,7 @@ if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != // Purge search criteria if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers { - $search_lineid = ''; + $search_lineid = ''; $search_ref = ''; $search_invoice = ''; $search_label = ''; @@ -241,7 +241,7 @@ if ($result) { $i = 0; $arrayofselected=is_array($toselect)?$toselect:array(); - + $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; @@ -254,8 +254,7 @@ if ($result) { //if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); //if ($massaction == 'presend') $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1); - - + print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n"; print '<input type="hidden" name="action" value="ventil">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; @@ -264,16 +263,16 @@ if ($result) { print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="page" value="'.$page.'">'; - + print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); print $langs->trans("DescVentilTodoCustomer") . '</br><br>'; if ($msg) print $msg.'<br>'; - + $moreforfilter = ''; - - print '<div class="div-table-responsive">'; + + print '<div class="div-table-responsive">'; print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n"; // We add search filter @@ -309,7 +308,7 @@ if ($result) { if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1); print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"'); print "</tr>\n"; - + $facture_static = new Facture($db); $product_static = new Product($db); $form = new Form($db); @@ -330,7 +329,7 @@ if ($result) { $facture_static->ref = $objp->facnumber; $facture_static->id = $objp->facid; $facture_static->type = $objp->ftype; - + $code_sell_p_notset = ''; $objp->aarowid_suggest = $objp->aarowid; @@ -350,30 +349,30 @@ if ($result) { if (! empty($objp->code_sell)) { $objp->code_sell_p = $objp->code_sell; // Code on product } else { - $code_sell_p_notset = 'color:orange'; + $code_sell_p_notset = 'color:orange'; } if (empty($objp->code_sell_l) && empty($objp->code_sell_p)) $code_sell_p_notset = 'color:red'; - + // $objp->code_sell_p is now code of product/service // $objp->code_sell_l is now default code of product/service - + print '<tr class="oddeven">'; // Line id print '<td>' . $objp->rowid . '</td>'; - + // Ref Invoice print '<td>' . $facture_static->getNomUrl(1) . '</td>'; print '<td align="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>'; - + // Ref Product print '<td>'; if ($product_static->id) print $product_static->getNomUrl(1); if ($objp->product_label) print '<br>'.$objp->product_label; print '</td>'; - + print '<td class="tdoverflowonsmartphone">'; $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description)); $trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32; @@ -383,14 +382,14 @@ if ($result) { print '<td align="right">'; print price($objp->total_ht); print '</td>'; - + // Vat rate if ($objp->vat_tx_l != $objp->vat_tx_p) $code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red'; print '<td style="' . $code_vat_differ . '" align="right">'; print price($objp->tva_tx_line); print '</td>'; - + // Current account print '<td align="center" style="' . $code_sell_p_notset . '">'; print (($objp->type_l == 1)?$langs->trans("DefaultForService"):$langs->trans("DefaultForProduct")) . ' = ' . ($objp->code_sell_l > 0 ? length_accountg($objp->code_sell_l) : $langs->trans("Unknown")); @@ -403,7 +402,7 @@ if ($result) { // Suggested accounting account print '<td align="center">'; - print $formventilation->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone'); + print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone'); print '</td>'; print '<td align="center">'; @@ -414,7 +413,7 @@ if ($result) { } print '</table>'; print "</div>"; - + print '</form>'; } else { print $db->error(); diff --git a/htdocs/accountancy/expensereport/card.php b/htdocs/accountancy/expensereport/card.php index 52440385e504b34eff28571f515f69ca4e6e9a9b..e37b35f10032c36c8b15a86bd744ab58332db493 100644 --- a/htdocs/accountancy/expensereport/card.php +++ b/htdocs/accountancy/expensereport/card.php @@ -30,7 +30,7 @@ require '../../main.inc.php'; // Class require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php'; -require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; // Langs $langs->load("bills"); @@ -85,7 +85,7 @@ if ($cancel == $langs->trans("Cancel")) { // Create $form = new Form($db); $expensereport_static = new ExpenseReport($db); -$formventilation = new FormVentilation($db); +$formaccounting = new FormAccounting($db); if (! empty($id)) { $sql = "SELECT er.ref, er.rowid as facid, erd.fk_c_type_fees, erd.comments, erd.rowid, erd.fk_code_ventilation,"; @@ -135,7 +135,7 @@ if (! empty($id)) { print '<td>' . ($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code))) . '</td>'; print '<tr><td>' . $langs->trans("Account") . '</td><td>'; - print $formventilation->select_account($objp->fk_code_ventilation, 'codeventil', 1); + print $formaccounting->select_account($objp->fk_code_ventilation, 'codeventil', 1); print '</td></tr>'; print '</table>'; diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index 6d0ffbd447647253d5ec0ea79a65a8d192439a33..b3936bbf1a6ca6c1a42cefafce6561a61cbaaf83 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -27,7 +27,7 @@ require '../../main.inc.php'; // Class -require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; @@ -74,7 +74,7 @@ if ($user->societe_id > 0) if (! $user->rights->accounting->bind->write) accessforbidden(); -$formventilation = new FormVentilation($db); +$formaccounting = new FormAccounting($db); /* @@ -226,7 +226,7 @@ if ($result) { print $langs->trans("DescVentilDoneExpenseReport") . '<br>'; print '<br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>'; - print $formventilation->select_account(GETPOST('account_parent'), 'account_parent', 1); + print $formaccounting->select_account(GETPOST('account_parent'), 'account_parent', 1); print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("ChangeBinding") . '" /></div>'; $moreforfilter = ''; diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 72316e4c4d62208c359b22bd0e57a1bc5d8c7faa..b1a86c96838e5eed6035ca689c3d93cc168e7e42 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -29,7 +29,7 @@ require '../../main.inc.php'; // Class require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php'; -require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; @@ -83,7 +83,7 @@ if ($user->societe_id > 0) if (! $user->rights->accounting->bind->write) accessforbidden(); -$formventilation = new FormVentilation($db); +$formaccounting = new FormAccounting($db); $accounting = new AccountingAccount($db); @@ -343,7 +343,7 @@ if ($result) { // Suggested accounting account print '<td align="center">'; - print $formventilation->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone'); + print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone'); print '</td>'; print '<td align="center">'; diff --git a/htdocs/accountancy/supplier/card.php b/htdocs/accountancy/supplier/card.php index b7c5979aa7a772d5d6e22fd603210f0fd011c20b..47a99c884964b7fe5346a5cafe90380d62209c20 100644 --- a/htdocs/accountancy/supplier/card.php +++ b/htdocs/accountancy/supplier/card.php @@ -1,11 +1,11 @@ <?php /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com> - * Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> + * Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> - * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> - * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> - * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> + * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> + * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> + * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * * 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 @@ -30,7 +30,7 @@ require '../../main.inc.php'; // Class require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php'; -require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; // Langs $langs->load("bills"); @@ -52,11 +52,11 @@ if ($user->societe_id > 0) if ($action == 'ventil' && $user->rights->accounting->bind->write) { if (! GETPOST('cancel', 'alpha')) { if ($codeventil < 0) $codeventil = 0; - + $sql = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det"; $sql .= " SET fk_code_ventilation = " . $codeventil; $sql .= " WHERE rowid = " . $id; - + $resql = $db->query($sql); if (! $resql) { setEventMessages($db->lasterror(), null, 'errors'); @@ -85,7 +85,7 @@ if ($cancel == $langs->trans("Cancel")) { // Create $form = new Form($db); $facturefournisseur_static = new FactureFournisseur($db); -$formventilation = new FormVentilation($db); +$formaccounting = new FormAccounting($db); if (! empty($id)) { $sql = "SELECT f.ref as facnumber, f.rowid as facid, l.fk_product, l.description, l.rowid, l.fk_code_ventilation, "; @@ -107,41 +107,41 @@ if (! empty($id)) { if ($num_lines) { $objp = $db->fetch_object($result); - + print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '" method="post">' . "\n"; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="action" value="ventil">'; - + print load_fiche_titre($langs->trans('SuppliersVentilation'), '', 'title_setup'); - + dol_fiche_head(); - + print '<table class="border" width="100%">'; - + // ref invoice print '<tr><td>' . $langs->trans("BillsSuppliers") . '</td>'; $facturefournisseur_static->ref = $objp->facnumber; $facturefournisseur_static->id = $objp->facid; print '<td>' . $facturefournisseur_static->getNomUrl(1) . '</td>'; print '</tr>'; - + print '<tr><td width="20%">' . $langs->trans("Line") . '</td>'; print '<td>' . stripslashes(nl2br($objp->description)) . '</td></tr>'; print '<tr><td width="20%">' . $langs->trans("ProductLabel") . '</td>'; print '<td>' . dol_trunc($objp->product_label, 24) . '</td>'; print '<tr><td width="20%">' . $langs->trans("Account") . '</td><td>'; - print $formventilation->select_account($objp->fk_code_ventilation, 'codeventil', 1); + print $formaccounting->select_account($objp->fk_code_ventilation, 'codeventil', 1); print '</td></tr>'; print '</table>'; - + dol_fiche_end(); - + print '<div class="center">'; print '<input class="button" type="submit" value="' . $langs->trans("Save") . '">'; print ' '; print '<input class="button" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">'; print '</div>'; - + print '</form>'; } else { print "Error"; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 1a95262f8616403ea11f9b696cdc947b41bebf65..2757b6d8aec10581a142788ca4e98e981b1f34e9 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -1,9 +1,9 @@ <?php /* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com> - * Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> + * Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com> * Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro> - * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> + * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> * * 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 @@ -27,7 +27,7 @@ require '../../main.inc.php'; // Class -require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; @@ -76,7 +76,7 @@ if ($user->societe_id > 0) if (! $user->rights->accounting->bind->write) accessforbidden(); -$formventilation = new FormVentilation($db); +$formaccounting = new FormAccounting($db); /* @@ -237,7 +237,7 @@ if ($result) { print $langs->trans("DescVentilDoneSupplier") . '<br>'; print '<br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>'; - print $formventilation->select_account(GETPOST('account_parent'), 'account_parent', 1); + print $formaccounting->select_account(GETPOST('account_parent'), 'account_parent', 1); print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("ChangeBinding") . '" /></div>'; $moreforfilter = ''; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 061e465b1e708ff67afdbc187636803246d3b1ff..9c822425a1cf904baed198621665dbb7e37cf340 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -1,10 +1,10 @@ <?php /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> - * Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> + * Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>s - * Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net> * * 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 @@ -30,7 +30,7 @@ require '../../main.inc.php'; // Class require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php'; -require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; @@ -85,7 +85,7 @@ if ($user->societe_id > 0) if (! $user->rights->accounting->bind->write) accessforbidden(); -$formventilation = new FormVentilation($db); +$formaccounting = new FormAccounting($db); $accounting = new AccountingAccount($db); // TODO: we should need to check if result is a really exist accountaccount rowid..... $aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT, 1); @@ -238,11 +238,11 @@ if ($result) { $i = 0; $arrayofselected=is_array($toselect)?$toselect:array(); - + $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; - + $arrayofmassactions = array( 'ventil'=>$langs->trans("Ventilate") //'presend'=>$langs->trans("SendByMail"), @@ -251,8 +251,7 @@ if ($result) { //if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); //if ($massaction == 'presend') $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1); - - + print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n"; print '<input type="hidden" name="action" value="ventil">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; @@ -261,15 +260,15 @@ if ($result) { print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="page" value="'.$page.'">'; - + print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); print $langs->trans("DescVentilTodoCustomer") . '</br><br>'; if ($msg) print $msg.'<br>'; - + $moreforfilter = ''; - + print '<div class="div-table-responsive">'; print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n"; @@ -329,7 +328,7 @@ if ($result) { $productfourn_static->id = $objp->product_id; $productfourn_static->type = $objp->type; $productfourn_static->label = $objp->product_label; - + $facturefourn_static->ref = $objp->ref; $facturefourn_static->id = $objp->facid; $facturefourn_static->type = $objp->type; @@ -347,14 +346,14 @@ if ($result) { $objp->aarowid_suggest = $aarowid_p; } if ($objp->code_buy_l == -1) $objp->code_buy_l=''; - + if (! empty($objp->code_buy)) { $objp->code_buy_p = $objp->code_buy; // Code on product } else { $code_buy_p_notset = 'color:orange'; } if (empty($objp->code_buy_l) && empty($objp->code_buy_p)) $code_buy_p_notset = 'color:red'; - + // $objp->code_buy_p is now code of product/service // $objp->code_buy_l is now default code of product/service @@ -362,23 +361,23 @@ if ($result) { // Line id print '<td>' . $objp->rowid . '</td>'; - + // Ref Invoice print '<td>' . $facturefourn_static->getNomUrl(1) . '</td>'; print '<td class="tdoverflowonsmartphone">'; print $objp->invoice_label; print '</td>'; - + print '<td align="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>'; - + // Ref product print '<td>'; if ($productfourn_static->id) print $productfourn_static->getNomUrl(1); if ($objp->product_label) print '<br>'.$objp->product_label; print '</td>'; - + // Description print '<td>'; $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description)); @@ -409,9 +408,9 @@ if ($result) { // Suggested accounting account print '<td align="center">'; - print $formventilation->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone'); + print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone'); print '</td>'; - + // Colonne choix ligne a ventiler print '<td align="center">'; print '<input type="checkbox" class="flat checkforselect" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>'; diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 28db9ef8b49bfc3363708029da62ecfa052a61f7..913fcf75de68fdd0a6001892f7fbcc263fa8f8a5 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; -if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; +if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; $langs->load("errors"); $langs->load("admin"); @@ -1662,7 +1662,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') $formadmin = new FormAdmin($db); $formcompany = new FormCompany($db); - if (! empty($conf->accounting->enabled)) $formaccountancy = new FormVentilation($db); + if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db); foreach ($fieldlist as $field => $value) { @@ -1811,7 +1811,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') { $fieldname = $fieldlist[$field]; $accountancy_account = (! empty($obj->$fieldname) ? $obj->$fieldname : 0); - print $formaccountancy->select_account($accountancy_account, $fieldlist[$field], 1, '', 1, 1, 'maxwidth200 maxwidthonsmartphone'); + print $formaccounting->select_account($accountancy_account, $fieldlist[$field], 1, '', 1, 1, 'maxwidth200 maxwidthonsmartphone'); } else { diff --git a/htdocs/admin/loan.php b/htdocs/admin/loan.php index 86d963ed54f776fe81a4fa2d79faf566ea05fa07..c3e8bad9f6d7b0b332bd4f4c59f03d43b4c8fff7 100644 --- a/htdocs/admin/loan.php +++ b/htdocs/admin/loan.php @@ -1,5 +1,5 @@ <?php -/* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> +/* Copyright (C) 2014-2017 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * * 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 @@ -26,7 +26,7 @@ require '../main.inc.php'; // Class require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; +if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; $langs->load("admin"); $langs->load("loan"); @@ -77,7 +77,7 @@ if ($action == 'update') llxHeader(); $form = new Form($db); -if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db); +if (! empty($conf->accounting->enabled)) $formaccounting = New FormAccounting($db); $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; print load_fiche_titre($langs->trans('ConfigLoan'),$linkback,'title_setup'); @@ -106,7 +106,7 @@ foreach ($list as $key) print '<td>'; if (! empty($conf->accounting->enabled)) { - print $formaccountancy->select_account($conf->global->$key, $key, 1, '', 1, 1); + print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1); } else { diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index b9e5df738adf26a48ab661c3842d7fec46f26469..caea3bef9f799ce6dfa727a47dff27564edee9d2 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; -if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; +if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; $langs->load("errors"); $langs->load("admin"); @@ -841,7 +841,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') $formadmin = new FormAdmin($db); $formcompany = new FormCompany($db); - if (! empty($conf->accounting->enabled)) $formaccountancy = new FormVentilation($db); + if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db); foreach ($fieldlist as $field => $value) { diff --git a/htdocs/admin/salaries.php b/htdocs/admin/salaries.php index 8f115d3963bcd0ffd0e7994065c0a7a025c40f41..85603de2ae505a1dda82a0231fbbf1e55a57f69d 100644 --- a/htdocs/admin/salaries.php +++ b/htdocs/admin/salaries.php @@ -26,7 +26,7 @@ require '../main.inc.php'; // Class require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; +if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; $langs->load("admin"); $langs->load("salaries"); @@ -76,7 +76,7 @@ if ($action == 'update') llxHeader('',$langs->trans('SalariesSetup')); $form = new Form($db); -if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db); +if (! empty($conf->accounting->enabled)) $formaccounting = New FormAccounting($db); $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; print load_fiche_titre($langs->trans('SalariesSetup'),$linkback,'title_setup'); @@ -109,7 +109,7 @@ foreach ($list as $key) print '<td>'; if (! empty($conf->accounting->enabled)) { - print $formaccountancy->select_account($conf->global->$key, $key, 1, '', 1, 1); + print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1); } else { diff --git a/htdocs/admin/taxes.php b/htdocs/admin/taxes.php index dbdce59c3c57999b98ea3091176fa4f90ac4c46f..59796919a8b2555d8b72e66e568e2dabfa470043 100644 --- a/htdocs/admin/taxes.php +++ b/htdocs/admin/taxes.php @@ -27,7 +27,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; -if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; +if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; $langs->load('admin'); @@ -113,7 +113,7 @@ if ($action == 'update') { llxHeader(); $form=new Form($db); -if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db); +if (! empty($conf->accounting->enabled)) $formaccounting = New FormAccounting($db); $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; print load_fiche_titre($langs->trans('TaxSetup'),$linkback,'title_setup'); @@ -216,7 +216,7 @@ foreach ($list as $key) print '<td>'; if (! empty($conf->accounting->enabled)) { - print $formaccountancy->select_account($conf->global->$key, $key, 1, '', 1, 1); + print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1); } else { diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index a8263a74916dab5432a4a3ad84c99e1691455828..2cb90b6a44aa70ee43921d7c4058a2d3919cd4a9 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -35,7 +35,6 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formbank.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; if (! empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; -if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; @@ -281,8 +280,7 @@ if ($action == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights-> $form = new Form($db); $formbank = new FormBank($db); $formcompany = new FormCompany($db); -if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db); -if (! empty($conf->accounting->enabled)) $formaccountancy2 = New FormAccounting($db); +if (! empty($conf->accounting->enabled)) $formaccounting = New FormAccounting($db); $countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; @@ -511,7 +509,7 @@ if ($action == 'create') { print '<tr><td class="'.$fieldrequired.'titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>'; print '<td>'; - print $formaccountancy->select_account($object->account_number, 'account_number', 1, '', 1, 1); + print $formaccounting->select_account($object->account_number, 'account_number', 1, '', 1, 1); print '</td></tr>'; } else @@ -525,7 +523,7 @@ if ($action == 'create') { print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>'; print '<td>'; - print $formaccountancy2->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, '', 0, 0); + print $formaccounting->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, '', 0, 0); print '</td></tr>'; } @@ -957,43 +955,42 @@ else //print '<div class="underbanner clearboth"></div>'; - + print '<table class="border" width="100%">'; - + // Accountancy code $tdextra = ' class="titlefieldcreate"'; - + if (!empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) { $tdextra = ' class="fieldrequired titlefieldcreate"'; } - + print '<tr class="liste_titre_add"><td'.$tdextra.'>'.$langs->trans("AccountancyCode").'</td>'; print '<td>'; if (!empty($conf->accounting->enabled)) { - print $formaccountancy->select_account($object->account_number, 'account_number', 1, '', 1, 1); + print $formaccounting->select_account($object->account_number, 'account_number', 1, '', 1, 1); } else { print '<input type="text" name="account_number" value="'.(GETPOST("account_number") ? GETPOST("account_number") : $object->account_number).'">'; } print '</td></tr>'; - + // Accountancy journal if (! empty($conf->accounting->enabled)) { print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>'; print '<td>'; - print $formaccountancy2->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, '', 0, 0); + print $formaccounting->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, '', 0, 0); print '</td></tr>'; } - + print '</table>'; - - + if ($_POST["type"] == Account::TYPE_SAVINGS || $_POST["type"] == Account::TYPE_CURRENT) { print '<br>'; - + //print '<div class="underbanner clearboth"></div>'; - + print '<table class="border" width="100%">'; // If bank account diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 4875ac593c65ae641e91e338a36fba5d106e67c5..20c49c714684f2ef67605126f1c28e5ad3cd4a36 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -26,7 +26,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; -if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php'; +if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; $langs->load("compta"); @@ -180,7 +180,7 @@ if ($action == 'delete') llxHeader("",$langs->trans("VariousPayment")); $form = new Form($db); -if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db); +if (! empty($conf->accounting->enabled)) $formaccounting = New FormAccounting($db); if ($id) { @@ -271,9 +271,9 @@ if ($action == 'create') { print '<tr><td>'.$langs->trans("AccountAccounting").'</td>'; print '<td>'; - print $formaccountancy->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1, ''); + print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1, ''); print '</td></tr>'; - } + } else // For external software { print '<tr><td>'.$langs->trans("AccountAccounting").'</td>'; diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index 97f31f05e99da30a94b8bf2c38b1d7133fe31e49..f3db577778363ac45f5259cc98a6630c36564e88 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -1,5 +1,9 @@ <?php -/* Copyright (C) 2016-2017 Alexandre Spangaro <aspangaro@zendsi.com> +/* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro> + * Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> + * Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com> + * Copyright (C) 2016 Marcos García <marcosgdf@gmail.com> + * Copyright (C) 2016-2017 Alexandre Spangaro <aspangaro@zendsi.com> * * 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 @@ -28,7 +32,7 @@ class FormAccounting extends Form { - private $options_cache = array(); + private $options_cache = array(); var $db; var $error; @@ -205,5 +209,222 @@ class FormAccounting extends Form print $out; } + + /** + * Return select filter with date of transaction + * + * @param string $htmlname Name of select field + * @param string $selectedkey Value + * @return string HTML edit field + */ + function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '') { + $options = array(); + + $sql = 'SELECT DISTINCT import_key from ' . MAIN_DB_PREFIX . 'accounting_bookkeeping'; + $sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")"; + $sql .= ' ORDER BY import_key DESC'; + + dol_syslog(get_class($this) . "::select_bookkeeping_importkey", LOG_DEBUG); + $resql = $this->db->query($sql); + + if (!$resql) { + $this->error = "Error " . $this->db->lasterror(); + dol_syslog(get_class($this) . "::select_bookkeeping_importkey " . $this->error, LOG_ERR); + return - 1; + } + + while ($obj = $this->db->fetch_object($resql)) { + $options[$obj->import_key] = dol_print_date($obj->import_key, 'dayhourtext'); + } + + return Form::selectarray($htmlname, $options, $selectedkey); + } + + /** + * Return list of accounts with label by chart of accounts + * + * @param string $selectid Preselected id or code of accounting accounts (depends on $select_in) + * @param string $htmlname Name of field in html form + * @param int $showempty Add an empty field + * @param array $event Event options + * @param int $select_in 0=selectid value is a aa.rowid (default) or 1=selectid is aa.account_number + * @param int $select_out Set value returned by select. 0=rowid (default), 1=account_number + * @param string $morecss More css non HTML object + * @param string $usecache Key to use to store result into a cache. Next call with same key will reuse the cache. + * @return string String with HTML select + */ + function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $morecss='maxwidth300 maxwidthonsmartphone', $usecache='') + { + global $conf; + + require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; + + $out = ''; + + $options = array(); + if ($usecache && ! empty($this->options_cache[$usecache])) + { + $options = $this->options_cache[$usecache]; + $selected=$selectid; + } + else + { + $trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50; + + $sql = "SELECT DISTINCT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version"; + $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa"; + $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 .= " ORDER BY aa.account_number"; + + dol_syslog(get_class($this) . "::select_account", LOG_DEBUG); + $resql = $this->db->query($sql); + + if (!$resql) { + $this->error = "Error " . $this->db->lasterror(); + dol_syslog(get_class($this) . "::select_account " . $this->error, LOG_ERR); + return -1; + } + + $out .= ajax_combobox($htmlname, $event); + + $selected = 0; + while ($obj = $this->db->fetch_object($resql)) + { + $label = length_accountg($obj->account_number) . ' - ' . $obj->label; + $label = dol_trunc($label, $trunclength); + + $select_value_in = $obj->rowid; + $select_value_out = $obj->rowid; + + // Try to guess if we have found default value + if ($select_in == 1) { + $select_value_in = $obj->account_number; + } + if ($select_out == 1) { + $select_value_out = $obj->account_number; + } + // Remember guy's we store in database llx_facturedet the rowid of accounting_account and not the account_number + // Because same account_number can be share between different accounting_system and do have the same meaning + if ($selectid != '' && $selectid == $select_value_in) { + //var_dump("Found ".$selectid." ".$select_value_in); + $selected = $select_value_out; + } + + $options[$select_value_out] = $label; + } + $this->db->free($resql); + + if ($usecache) + { + $this->options_cache[$usecache] = $options; + } + } + + $out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, 1); + + return $out; + } + + /** + * Return list of auxilary thirdparty accounts + * + * @param string $selectid Preselected pcg_type + * @param string $htmlname Name of field in html form + * @param int $showempty Add an empty field + * @param array $event Event options + * + * @return string String with HTML select + */ + function select_auxaccount($selectid, $htmlname = 'account_num_aux', $showempty = 0, $event = array()) { + + $aux_account = array(); + + // Auxiliary customer account + $sql = "SELECT DISTINCT code_compta, nom "; + $sql .= " FROM ".MAIN_DB_PREFIX."societe"; + $sql .= " WHERE entity IN (" . getEntity("societe", 1) . ")"; + $sql .= " ORDER BY code_compta"; + dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + while ($obj = $this->db->fetch_object($resql)) { + if (!empty($obj->code_compta)) { + $aux_account[$obj->code_compta] = $obj->code_compta.' ('.$obj->nom.')'; + } + } + } else { + $this->error = "Error ".$this->db->lasterror(); + dol_syslog(get_class($this)."::select_pcgsubtype ".$this->error, LOG_ERR); + return -1; + } + $this->db->free($resql); + + // Auxiliary supplier account + $sql = "SELECT DISTINCT code_compta_fournisseur, nom "; + $sql .= " FROM ".MAIN_DB_PREFIX."societe"; + $sql .= " WHERE entity IN (" . getEntity("societe", 1) . ")"; + $sql .= " ORDER BY code_compta_fournisseur"; + dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + while ($obj = $this->db->fetch_object($resql)) { + if (!empty($obj->code_compta_fournisseur)) { + $aux_account[$obj->code_compta_fournisseur] = $obj->code_compta_fournisseur.' ('.$obj->nom.')'; + } + } + } else { + $this->error = "Error ".$this->db->lasterror(); + dol_syslog(get_class($this)."::select_pcgsubtype ".$this->error, LOG_ERR); + return -1; + } + $this->db->free($resql); + + // Build select + $out = ajax_combobox($htmlname, $event); + $out .= Form::selectarray($htmlname, $aux_account, $selectid, $showempty, 0, 0, '', 0, 0, 0, '', 'maxwidth300'); + + return $out; + } + + /** + * Return HTML combo list of years existing into book keepping + * + * @param string $selected Preselected value + * @param string $htmlname Name of HTML select object + * @param int $useempty Affiche valeur vide dans liste + * @param string $output_format (html/opton (for option html only)/array (to return options arrays + * @return string/array + */ + function selectyear_accountancy_bookkepping($selected = '', $htmlname = 'yearid', $useempty = 0, $output_format = 'html') + { + global $conf; + + $out_array = array(); + + $sql = "SELECT DISTINCT date_format(doc_date,'%Y') as dtyear"; + $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping"; + $sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")"; + $sql .= " ORDER BY date_format(doc_date,'%Y')"; + dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG); + $resql = $this->db->query($sql); + + if (!$resql) { + $this->error = "Error ".$this->db->lasterror(); + dol_syslog(get_class($this)."::".__METHOD__.$this->error, LOG_ERR); + return -1; + } + while ($obj = $this->db->fetch_object($resql)) { + $out_array[$obj->dtyear] = $obj->dtyear; + } + $this->db->free($resql); + + if ($output_format == 'html') { + return Form::selectarray($htmlname, $out_array, $selected, $useempty, 0, 0, 'placeholder="aa"'); + } else { + return $out_array; + } + } } diff --git a/htdocs/core/lib/accounting.lib.php b/htdocs/core/lib/accounting.lib.php index c8863ce8f615f97b226448b7e83079bab01162e7..7952c0eda7d3d798ea35f5b9a9d6d3da4761ccd8 100644 --- a/htdocs/core/lib/accounting.lib.php +++ b/htdocs/core/lib/accounting.lib.php @@ -1,7 +1,7 @@ <?php /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> * Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> - * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> + * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> * * 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 @@ -27,7 +27,7 @@ * Prepare array with list of admin tabs * * @param AccountingAccount $object Object instance we show card - * @return array Array of tabs to show + * @return array Array of tabs to show */ function admin_accounting_prepare_head(AccountingAccount $object=null) { @@ -41,11 +41,6 @@ function admin_accounting_prepare_head(AccountingAccount $object=null) $head[$h][2] = 'general'; $h ++; - $head[$h][0] = DOL_URL_ROOT.'/accountancy/admin/journals.php'; - $head[$h][1] = $langs->trans("Journaux"); - $head[$h][2] = 'journal'; - $h ++; - $head[$h][0] = DOL_URL_ROOT.'/accountancy/admin/export.php'; $head[$h][1] = $langs->trans("ExportOptions"); $head[$h][2] = 'export'; @@ -91,35 +86,6 @@ function accounting_prepare_head(AccountingAccount $object) return $head; } -/** - * Prepare array with list of tabs - * - * @param AccountingAccount $object Accounting account - * @return array Array of tabs to show - */ -function accounting_journal_prepare_head(AccountingJournal $object) -{ - global $langs, $conf; - - $h = 0; - $head = array (); - - $head[$h][0] = DOL_URL_ROOT.'/accountancy/admin/journals_card.php?id=' . $object->id; - $head[$h][1] = $langs->trans("Card"); - $head[$h][2] = 'card'; - $h ++; - - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab - // $this->tabs = array('entity:-tabname); to remove a tab - complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_journal'); - - complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_journal', 'remove'); - - return $head; -} - /** * Return accounting account without zero on the right * @@ -129,7 +95,7 @@ function accounting_journal_prepare_head(AccountingJournal $object) function clean_account($account) { $account = rtrim($account,"0"); - + return $account; } @@ -144,9 +110,9 @@ function length_accountg($account) global $conf; if ($account < 0 || empty($account)) return ''; - + if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $account; - + $g = $conf->global->ACCOUNTING_LENGTH_GACCOUNT; if (! empty($g)) { // Clean parameters @@ -179,9 +145,9 @@ function length_accounta($accounta) global $conf, $langs; if ($accounta < 0 || empty($accounta)) return ''; - + if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $accounta; - + $a = $conf->global->ACCOUNTING_LENGTH_AACCOUNT; if (! empty($a)) { // Clean parameters diff --git a/htdocs/don/admin/donation.php b/htdocs/don/admin/donation.php index 2888b9117005507fc306ecf7e46f56290a9bf248..c8d8be2461de9cdcf28b695199417df0c75236c2 100644 --- a/htdocs/don/admin/donation.php +++ b/htdocs/don/admin/donation.php @@ -1,9 +1,9 @@ <?php /* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net> - * Copyright (C) 2012-2015 Juanjo Menent <jmenent@2byte.es> + * Copyright (C) 2012-2015 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2013-2017 Philippe Grand <philippe.grand@atoo-net.com> - * Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> - * Copyright (C) 2015 Benoit Bruchard <benoitb21@gmail.com> + * Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> + * Copyright (C) 2015 Benoit Bruchard <benoitb21@gmail.com> * * 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 @@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/donation.lib.php'; require_once DOL_DOCUMENT_ROOT . '/don/class/don.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; -if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; +if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; $langs->load("admin"); $langs->load("donations"); @@ -199,7 +199,7 @@ else if ($action == 'setart885') { $dir = "../../core/modules/dons/"; $form=new Form($db); -if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db); +if (! empty($conf->accounting->enabled)) $formaccounting = New FormAccounting($db); llxHeader('',$langs->trans("DonationsSetup"),'DonConfiguration'); $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; @@ -364,7 +364,7 @@ print '<label for="DONATION_ACCOUNTINGACCOUNT">' . $label . '</label></td>'; print '<td>'; if (! empty($conf->accounting->enabled)) { - print $formaccountancy->select_account($conf->global->DONATION_ACCOUNTINGACCOUNT, 'DONATION_ACCOUNTINGACCOUNT', 1, '', 1, 1); + print $formaccounting->select_account($conf->global->DONATION_ACCOUNTINGACCOUNT, 'DONATION_ACCOUNTINGACCOUNT', 1, '', 1, 1); } else { @@ -401,7 +401,7 @@ if (preg_match('/fr/i',$conf->global->MAIN_INFO_SOCIETE_COUNTRY)) print '<tr class="liste_titre">'; print '<td colspan="3">' . $langs->trans('Parameters') . '</td>'; print "</tr>\n"; - + print '<tr class="oddeven">'; print '<td width="80%">' . $langs->trans("DONATION_ART200") . '</td>'; if (! empty($conf->global->DONATION_ART200)) { @@ -414,7 +414,7 @@ if (preg_match('/fr/i',$conf->global->MAIN_INFO_SOCIETE_COUNTRY)) print '</a></td>'; } print '</tr>'; - + print '<tr class="oddeven">'; print '<td width="80%">' . $langs->trans("DONATION_ART238") . '</td>'; if (! empty($conf->global->DONATION_ART238)) { @@ -427,7 +427,7 @@ if (preg_match('/fr/i',$conf->global->MAIN_INFO_SOCIETE_COUNTRY)) print '</a></td>'; } print '</tr>'; - + print '<tr class="oddeven">'; print '<td width="80%">' . $langs->trans("DONATION_ART885") . '</td>'; if (! empty($conf->global->DONATION_ART885)) { diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index b58bfb929d99737b7aac61c38756add6322a5701..81d43e46ab0bcd0d78b0d42ac8ce92131ba72151 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -1,5 +1,5 @@ <?php -/* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro@zendsi.com> +/* Copyright (C) 2014-2017 Alexandre Spangaro <aspangaro@zendsi.com> * Copyright (C) 2015 Frederic France <frederic.france@free.fr> * * This program is free software; you can redistribute it and/or modify @@ -27,7 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/loan.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; -if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php'; +if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; @@ -235,7 +235,7 @@ if (empty($reshook)) $form = new Form($db); $formproject = new FormProjets($db); -if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db); +if (! empty($conf->accounting->enabled)) $formaccounting = New FormAccounting($db); $title = $langs->trans("Loan") . ' - ' . $langs->trans("Card"); $help_url = 'EN:Module_Loan|FR:Module_Emprunt'; @@ -337,19 +337,19 @@ if ($action == 'create') // Accountancy_account_capital print '<tr><td class="titlefieldcreate">'.$langs->trans("LoanAccountancyCapitalCode").'</td>'; print '<td>'; - print $formaccountancy->select_account($object->accountancy_account_capital, 'accountancy_account_capital', 1, '', 0, 1); + print $formaccounting->select_account($object->accountancy_account_capital, 'accountancy_account_capital', 1, '', 0, 1); print '</td></tr>'; // Accountancy_account_insurance print '<tr><td>'.$langs->trans("LoanAccountancyInsuranceCode").'</td>'; print '<td>'; - print $formaccountancy->select_account($object->accountancy_account_insurance, 'accountancy_account_insurance', 1, '', 0, 1); + print $formaccounting->select_account($object->accountancy_account_insurance, 'accountancy_account_insurance', 1, '', 0, 1); print '</td></tr>'; // Accountancy_account_interest print '<tr><td>'.$langs->trans("LoanAccountancyInterestCode").'</td>'; print '<td>'; - print $formaccountancy->select_account($object->accountancy_account_interest, 'accountancy_account_interest', 1, '', 0, 1); + print $formaccounting->select_account($object->accountancy_account_interest, 'accountancy_account_interest', 1, '', 0, 1); print '</td></tr>'; } else // For external software @@ -541,7 +541,7 @@ if ($id > 0) { if (! empty($conf->accounting->enabled)) { - print $formaccountancy->select_account($object->account_capital, 'accountancy_account_capital', 1, '', 0, 1); + print $formaccounting->select_account($object->account_capital, 'accountancy_account_capital', 1, '', 0, 1); } else { @@ -566,7 +566,7 @@ if ($id > 0) { if (! empty($conf->accounting->enabled)) { - print $formaccountancy->select_account($object->account_insurance, 'accountancy_account_insurance', 1, '', 0, 1); + print $formaccounting->select_account($object->account_insurance, 'accountancy_account_insurance', 1, '', 0, 1); } else { @@ -591,7 +591,7 @@ if ($id > 0) { if (! empty($conf->accounting->enabled)) { - print $formaccountancy->select_account($object->account_interest, 'accountancy_account_interest', 1, '', 0, 1); + print $formaccounting->select_account($object->account_interest, 'accountancy_account_interest', 1, '', 0, 1); } else { diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 3ed6368ec8d1a533577b750a69d4cd2aa060eadb..5c6690b44f200e2e614ca739256fb1874abae6ef 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -51,7 +51,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/product/modules_product.php'; if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; -if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php'; +if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; +if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; $langs->load("products"); @@ -808,7 +809,7 @@ llxHeader('', $title, $helpurl); $form = new Form($db); $formfile = new FormFile($db); $formproduct = new FormProduct($db); -if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db); +if (! empty($conf->accounting->enabled)) $formaccounting = New FormAccounting($db); // Load object modBarCodeProduct $res=0; @@ -1113,13 +1114,13 @@ else // Accountancy_code_sell print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellCode").'</td>'; print '<td>'; - print $formaccountancy->select_account(GETPOST('accountancy_code_sell'), 'accountancy_code_sell', 1, null, 1, 1, ''); + print $formaccounting->select_account(GETPOST('accountancy_code_sell'), 'accountancy_code_sell', 1, null, 1, 1, ''); print '</td></tr>'; // Accountancy_code_buy print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>'; print '<td>'; - print $formaccountancy->select_account(GETPOST('accountancy_code_buy'), 'accountancy_code_buy', 1, null, 1, 1, ''); + print $formaccounting->select_account(GETPOST('accountancy_code_buy'), 'accountancy_code_buy', 1, null, 1, 1, ''); print '</td></tr>'; } else // For external software @@ -1406,13 +1407,13 @@ else // Accountancy_code_sell print '<tr><td class="titlefield">'.$langs->trans("ProductAccountancySellCode").'</td>'; print '<td>'; - print $formaccountancy->select_account($object->accountancy_code_sell, 'accountancy_code_sell', 1, '', 1, 1); + print $formaccounting->select_account($object->accountancy_code_sell, 'accountancy_code_sell', 1, '', 1, 1); print '</td></tr>'; // Accountancy_code_buy print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>'; print '<td>'; - print $formaccountancy->select_account($object->accountancy_code_buy, 'accountancy_code_buy', 1, '', 1, 1); + print $formaccounting->select_account($object->accountancy_code_buy, 'accountancy_code_buy', 1, '', 1, 1); print '</td></tr>'; } else // For external software