dolibarr 24.0.0-beta
accountancy_codes_view.tpl.php
1<?php
2/* Copyright (C) 2021 Open-Dsi <support@open-dsi.fr>
3 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
4 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
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.
20 */
21
36// Protection to avoid direct call of template
37if (empty($object) || !is_object($object)) {
38 print "Error, template page can't be called as URL";
39 exit(1);
40}
41
42if (!is_object($form)) {
43 $form = new Form($db);
44}
45
46
47?>
48<!-- BEGIN PHP TEMPLATE accountancy_code_view.tpl.php -->
49<?php
50
51if (!is_array($parameters)) {
52 $parameters = array();
53}
54$parameters['assetaccountancycodes'] = &$assetaccountancycodes;
55$reshook = $hookmanager->executeHooks('formAssetAccountancyCodes', $parameters, $object, $action);
56print $hookmanager->resPrint;
57if ($reshook < 0) {
58 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
59}
60
61if (empty($reshook)) {
62 if (isModEnabled('accounting')) {
63 require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
64 }
65
66 foreach ($assetaccountancycodes->accountancy_codes_fields as $mode_key => $mode_info) {
67 if (empty($assetdepreciationoptions->deprecation_options[$mode_key]) && $mode_key == "accelerated_depreciation") {
68 continue;
69 }
70 $width = "pull-left";
71 print '<table class="liste centpercent '. $width .'" id="block_' . $mode_key . '">' . "\n";
72 print '<tr class="liste_titre"><td colspan="5">'.$langs->trans($mode_info['label']).'</td></tr>';
73 foreach ($mode_info['fields'] as $field_key => $field_info) {
74 $key = $mode_key . '_' . $field_key;
75 print '<tr class="field_' . $key . '" id="block_' . $mode_key . '"><td class="titlefieldmiddle">' . $langs->trans($field_info['label']) . '</td><td colspan="3">';
76 if (!empty($assetaccountancycodes->accountancy_codes[$mode_key][$field_key])) {
77 $accountancy_code = $assetaccountancycodes->accountancy_codes[$mode_key][$field_key];
78 if (isModEnabled('accounting')) {
79 $accountingaccount = new AccountingAccount($db);
80 $accountingaccount->fetch(0, $accountancy_code, 1);
81
82 print $accountingaccount->getNomUrl(0, 1, 1, '', 1);
83 } else {
84 print $accountancy_code;
85 }
86 }
87 print '</td></tr>';
88 }
89 print '</table>';
90 print '<div class="clearboth"></div>';
91 print '<br>';
92 }
93 print '<div class="clearboth"></div>';
94}
95?>
96<!-- END PHP TEMPLATE accountancy_code_view.tpl.php -->
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
Class to manage accounting accounts.
Class to manage generation of HTML components Only common components must be here.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
isModEnabled($module)
Is Dolibarr module enabled.