dolibarr 23.0.3
accountancy_codes_edit.tpl.php
1<?php
2/* Copyright (C) 2021 Open-Dsi <support@open-dsi.fr>
3 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
4 * Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 *
19 * Show extrafields. It also shows fields from hook formAssetAccountancyCode. Need to have the following variables defined:
20 * $object (asset, assetmodel, ...)
21 * $assetaccountancycodes
22 * $action
23 * $conf
24 * $langs
25 *
26 * $parameters
27 */
28
37// Protection to avoid direct call of template
38if (empty($object) || !is_object($object)) {
39 print "Error, template page can't be called as URL";
40 exit(1);
41}
42
43if (!is_object($form)) {
44 $form = new Form($db);
45}
46
47global $formaccounting;
48if (isModEnabled('accounting') && !is_object($formaccounting)) {
49 require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
50 $formaccounting = new FormAccounting($db);
51}
52
53
54?>
55<!-- BEGIN PHP TEMPLATE accountancy_code_edit.tpl.php -->
56<?php
57
58if (!is_array($parameters)) {
59 $parameters = array();
60}
61$parameters['assetaccountancycodes'] = &$assetaccountancycodes;
62$reshook = $hookmanager->executeHooks('formAssetAccountancyCodes', $parameters, $object, $action);
63print $hookmanager->resPrint;
64if ($reshook < 0) {
65 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
66}
67
68if (empty($reshook)) {
69 foreach ($assetaccountancycodes->accountancy_codes_fields as $mode_key => $mode_info) {
70 //if (empty($object->enabled_modes[$mode_key])) continue;
71 $width = ($mode_key == "economic") ? "width50p pull-left" : "width50p";
72 print '<table class="border '. $width .'" id="block_' . $mode_key . '">';
73 print '<tr><td class="info-box-title">'.$langs->trans($mode_info['label']).'</td></tr>';
74 foreach ($mode_info['fields'] as $field_key => $field_info) {
75 $html_name = $mode_key . '_' . $field_key;
76 print '<tr><td class="width40p">' . $langs->trans($field_info['label']) . '</td><td>';
77 $accountancy_code = GETPOSTISSET($html_name) ? GETPOST($html_name, 'aZ09') : (!empty($assetaccountancycodes->accountancy_codes[$mode_key][$field_key]) ? $assetaccountancycodes->accountancy_codes[$mode_key][$field_key] : '');
78 if (isModEnabled('accounting')) {
79 print $formaccounting->select_account($accountancy_code, $html_name, 1, array(), 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', '1');
80 } else {
81 print '<input name="' . $html_name . '" class="maxwidth200 " value="' . dol_escape_htmltag($accountancy_code) . '">';
82 }
83 print '</td></tr>';
84 }
85 print '</table>';
86 }
87
88 print '<div class="clearboth"></div>';
89}
90?>
91<!-- END PHP TEMPLATE accountancy_code_edit.tpl.php -->
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
Class to manage generation of HTML components for accounting management.
Class to manage generation of HTML components Only common components must be here.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
isModEnabled($module)
Is Dolibarr module enabled.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...