dolibarr  17.0.4
accountancy_codes_edit.tpl.php
1 <?php
2 /* Copyright (C) 2021 Open-Dsi <support@open-dsi.fr>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  *
17  * Show extrafields. It also show fields from hook formAssetAccountancyCode. Need to have following variables defined:
18  * $object (asset, assetmodel, ...)
19  * $assetaccountancycodes
20  * $action
21  * $conf
22  * $langs
23  *
24  * $parameters
25  */
26 
27 // Protection to avoid direct call of template
28 if (empty($object) || !is_object($object)) {
29  print "Error, template page can't be called as URL";
30  exit;
31 }
32 
33 if (!is_object($form)) {
34  $form = new Form($db);
35 }
36 
37 if (isModEnabled('accounting') && !is_object($formaccounting)) {
38  require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
39  $formaccounting = new FormAccounting($db);
40 }
41 
42 
43 ?>
44 <!-- BEGIN PHP TEMPLATE accountancy_code_edit.tpl.php -->
45 <?php
46 
47 if (!is_array($parameters)) {
48  $parameters = array();
49 }
50 $parameters['assetaccountancycodes'] = &$assetaccountancycodes;
51 $reshook = $hookmanager->executeHooks('formAssetAccountancyCodes', $parameters, $object, $action);
52 print $hookmanager->resPrint;
53 if ($reshook < 0) {
54  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
55 }
56 
57 if (empty($reshook)) {
58  foreach ($assetaccountancycodes->accountancy_codes_fields as $mode_key => $mode_info) {
59  //if (empty($object->enabled_modes[$mode_key])) continue;
60 
61  print load_fiche_titre($langs->trans($mode_info['label']), '', '');
62  print '<div class="fichecenter">';
63  print '<div class="underbanner clearboth"></div>';
64  print '<table class="border centpercent tableforfield">';
65  foreach ($mode_info['fields'] as $field_key => $field_info) {
66  $html_name = $mode_key . '_' . $field_key;
67  print '<tr><td class="titlefieldcreate">' . $langs->trans($field_info['label']) . '</td><td colspan="3">';
68  $accountancy_code = GETPOSTISSET($html_name) ? GETPOST($html_name, 'aZ09') : (!empty($assetaccountancycodes->accountancy_codes[$mode_key][$field_key]) ? $assetaccountancycodes->accountancy_codes[$mode_key][$field_key] : '');
69  if (isModEnabled('accounting')) {
70  print $formaccounting->select_account($accountancy_code, $html_name, 1, null, 1, 1, 'minwidth150 maxwidth300', 1);
71  } else {
72  print '<input name="' . $html_name . '" class="maxwidth200" value="' . dol_escape_htmltag($accountancy_code) . '">';
73  }
74  print '</td></tr>';
75  }
76  print '</table>';
77  print '</div>';
78  }
79 }
80 ?>
81 <!-- END PHP TEMPLATE accountancy_code_edit.tpl.php -->
Class to manage generation of HTML components for accounting management.
Class to manage generation of HTML components Only common components must be here.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.