PageRenderTime 46ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/htdocs/asset/type.php

http://github.com/Dolibarr/dolibarr
PHP | 608 lines | 406 code | 125 blank | 77 comment | 82 complexity | 82faecf56046f543157376e4ce9d70e0 MD5 | raw file
Possible License(s): GPL-2.0, AGPL-3.0, LGPL-2.0, CC-BY-SA-4.0, BSD-3-Clause, MPL-2.0-no-copyleft-exception, LGPL-3.0, GPL-3.0, LGPL-2.1, MIT
  1. <?php
  2. /* Copyright (C) 2018 Alexandre Spangaro <aspangaro@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. /**
  18. * \file htdocs/asset/type.php
  19. * \ingroup asset
  20. * \brief Asset's type setup
  21. */
  22. require '../main.inc.php';
  23. require_once DOL_DOCUMENT_ROOT.'/core/lib/asset.lib.php';
  24. require_once DOL_DOCUMENT_ROOT.'/asset/class/asset.class.php';
  25. require_once DOL_DOCUMENT_ROOT.'/asset/class/asset_type.class.php';
  26. require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
  27. if (!empty($conf->accounting->enabled)) {
  28. require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
  29. }
  30. if (!empty($conf->accounting->enabled)) {
  31. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
  32. }
  33. if (!empty($conf->accounting->enabled)) {
  34. require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
  35. }
  36. // Load translation files required by the page
  37. $langs->load("assets");
  38. $rowid = GETPOST('rowid', 'int');
  39. $action = GETPOST('action', 'aZ09');
  40. $cancel = GETPOST('cancel', 'alpha');
  41. $backtopage = GETPOST('backtopage', 'alpha');
  42. $type = GETPOST('type', 'alpha');
  43. $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
  44. $sortfield = GETPOST("sortfield", 'alpha');
  45. $sortorder = GETPOST("sortorder", 'alpha');
  46. $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
  47. if (empty($page) || $page == -1) {
  48. $page = 0;
  49. } // If $page is not defined, or '' or -1
  50. $offset = $limit * $page;
  51. $pageprev = $page - 1;
  52. $pagenext = $page + 1;
  53. if (!$sortorder) {
  54. $sortorder = "DESC";
  55. }
  56. if (!$sortfield) {
  57. $sortfield = "a.label";
  58. }
  59. $label = GETPOST("label", "alpha");
  60. $accountancy_code_asset = GETPOST('accountancy_code_asset', 'string');
  61. $accountancy_code_depreciation_asset = GETPOST('accountancy_code_depreciation_asset', 'string');
  62. $accountancy_code_depreciation_expense = GETPOST('accountancy_code_depreciation_expense', 'string');
  63. $comment = GETPOST('comment', 'string');
  64. // Security check
  65. $result = restrictedArea($user, 'asset', $rowid, 'asset_type');
  66. $object = new AssetType($db);
  67. $extrafields = new ExtraFields($db);
  68. // fetch optionals attributes and labels
  69. $extrafields->fetch_name_optionals_label($object->table_element);
  70. if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
  71. $type = "";
  72. $sall = "";
  73. }
  74. // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
  75. $hookmanager->initHooks(array('assettypecard', 'globalcard'));
  76. $permissiontoadd = $user->rights->asset->setup_advance;
  77. /*
  78. * Actions
  79. */
  80. if ($cancel) {
  81. $action = '';
  82. if (!empty($backtopage)) {
  83. header("Location: ".$backtopage);
  84. exit;
  85. }
  86. }
  87. if ($action == 'add' && $user->rights->asset->write) {
  88. $object->label = trim($label);
  89. $object->accountancy_code_asset = trim($accountancy_code_asset);
  90. $object->accountancy_code_depreciation_asset = trim($accountancy_code_depreciation_asset);
  91. $object->accountancy_code_depreciation_expense = trim($accountancy_code_depreciation_expense);
  92. $object->note = trim($comment);
  93. // Fill array 'array_options' with data from add form
  94. $ret = $extrafields->setOptionalsFromPost(null, $object);
  95. if ($ret < 0) {
  96. $error++;
  97. }
  98. if (empty($object->label)) {
  99. $error++;
  100. setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
  101. } else {
  102. $sql = "SELECT label FROM ".MAIN_DB_PREFIX."asset_type WHERE label='".$db->escape($object->label)."'";
  103. $result = $db->query($sql);
  104. if ($result) {
  105. $num = $db->num_rows($result);
  106. }
  107. if ($num) {
  108. $error++;
  109. $langs->load("errors");
  110. setEventMessages($langs->trans("ErrorLabelAlreadyExists", $login), null, 'errors');
  111. }
  112. }
  113. if (!$error) {
  114. $id = $object->create($user);
  115. if ($id > 0) {
  116. header("Location: ".$_SERVER["PHP_SELF"]);
  117. exit;
  118. } else {
  119. setEventMessages($object->error, $object->errors, 'errors');
  120. $action = 'create';
  121. }
  122. } else {
  123. $action = 'create';
  124. }
  125. }
  126. if ($action == 'update' && $user->rights->asset->write) {
  127. $object->fetch($rowid);
  128. $object->oldcopy = clone $object;
  129. $object->label = trim($label);
  130. $object->accountancy_code_asset = trim($accountancy_code_asset);
  131. $object->accountancy_code_depreciation_asset = trim($accountancy_code_depreciation_asset);
  132. $object->accountancy_code_depreciation_expense = trim($accountancy_code_depreciation_expense);
  133. $object->note = trim($comment);
  134. // Fill array 'array_options' with data from add form
  135. $ret = $extrafields->setOptionalsFromPost(null, $object);
  136. if ($ret < 0) {
  137. $error++;
  138. }
  139. $ret = $object->update($user);
  140. if ($ret >= 0 && !count($object->errors)) {
  141. setEventMessages($langs->trans("AssetTypeModified"), null, 'mesgs');
  142. } else {
  143. setEventMessages($object->error, $object->errors, 'errors');
  144. }
  145. header("Location: ".$_SERVER["PHP_SELF"]."?rowid=".$object->id);
  146. exit;
  147. }
  148. if ($action == 'confirm_delete' && $user->rights->asset->write) {
  149. $object->fetch($rowid);
  150. $res = $object->delete();
  151. if ($res > 0) {
  152. setEventMessages($langs->trans("AssetsTypeDeleted"), null, 'mesgs');
  153. header("Location: ".$_SERVER["PHP_SELF"]);
  154. exit;
  155. } else {
  156. setEventMessages($langs->trans("AssetsTypeCanNotBeDeleted"), null, 'errors');
  157. $action = '';
  158. }
  159. }
  160. /*
  161. * View
  162. */
  163. $form = new Form($db);
  164. $help_url = '';
  165. llxHeader('', $langs->trans("AssetsTypeSetup"), $help_url);
  166. // List of asset type
  167. if (!$rowid && $action != 'create' && $action != 'edit') {
  168. //print dol_get_fiche_head('');
  169. $sql = "SELECT d.rowid, d.label as label, d.accountancy_code_asset, d.accountancy_code_depreciation_asset, d.accountancy_code_depreciation_expense, d.note";
  170. $sql .= " FROM ".MAIN_DB_PREFIX."asset_type as d";
  171. $sql .= " WHERE d.entity IN (".getEntity('asset_type').")";
  172. $result = $db->query($sql);
  173. if ($result) {
  174. $num = $db->num_rows($result);
  175. $nbtotalofrecords = $num;
  176. $i = 0;
  177. $param = '';
  178. print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
  179. if ($optioncss != '') {
  180. print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
  181. }
  182. print '<input type="hidden" name="token" value="'.newToken().'">';
  183. print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
  184. print '<input type="hidden" name="action" value="list">';
  185. print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
  186. print '<input type="hidden" name="page" value="'.$page.'">';
  187. print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
  188. $newcardbutton = dolGetButtonTitle($langs->trans('NewAssetType'), '', 'fa fa-plus-circle', dol_buildpath('/asset/type.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
  189. print_barre_liste($langs->trans("AssetsTypes"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit);
  190. $moreforfilter = '';
  191. print '<div class="div-table-responsive">';
  192. print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
  193. print '<tr class="liste_titre">';
  194. print '<th>'.$langs->trans("Ref").'</th>';
  195. print '<th>'.$langs->trans("Label").'</th>';
  196. print '<th class="center">'.$langs->trans("AccountancyCodeAsset").'</th>';
  197. print '<th class="center">'.$langs->trans("AccountancyCodeDepreciationAsset").'</th>';
  198. print '<th class="center">'.$langs->trans("AccountancyCodeDepreciationExpense").'</th>';
  199. print '<th>&nbsp;</th>';
  200. print "</tr>\n";
  201. $assettype = new AssetType($db);
  202. while ($i < $num) {
  203. $objp = $db->fetch_object($result);
  204. $assettype->id = $objp->rowid;
  205. $assettype->ref = $objp->rowid;
  206. $assettype->label = $objp->rowid;
  207. print '<tr class="oddeven">';
  208. print '<td>';
  209. print $assettype->getNomUrl(1);
  210. //<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a>
  211. print '</td>';
  212. print '<td>'.dol_escape_htmltag($objp->label).'</td>';
  213. print '<td class="center">';
  214. if (!empty($conf->accounting->enabled)) {
  215. $accountingaccount = new AccountingAccount($db);
  216. $accountingaccount->fetch('', $objp->accountancy_code_asset, 1);
  217. print $accountingaccount->getNomUrl(0, 1, 1, '', 0);
  218. } else {
  219. print $objp->accountancy_code_asset;
  220. }
  221. print '</td>';
  222. print '<td class="center">';
  223. if (!empty($conf->accounting->enabled)) {
  224. $accountingaccount2 = new AccountingAccount($db);
  225. $accountingaccount2->fetch('', $objp->accountancy_code_depreciation_asset, 1);
  226. print $accountingaccount2->getNomUrl(0, 1, 1, '', 0);
  227. } else {
  228. print $objp->accountancy_code_depreciation_asset;
  229. }
  230. print '</td>';
  231. print '<td class="center">';
  232. if (!empty($conf->accounting->enabled)) {
  233. $accountingaccount3 = new AccountingAccount($db);
  234. $accountingaccount3->fetch('', $objp->accountancy_code_depreciation_expense, 1);
  235. print $accountingaccount3->getNomUrl(0, 1, 1, '', 0);
  236. } else {
  237. print $objp->accountancy_code_depreciation_expense;
  238. }
  239. print '</td>';
  240. if ($user->rights->asset->write) {
  241. print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
  242. } else {
  243. print '<td class="right">&nbsp;</td>';
  244. }
  245. print "</tr>";
  246. $i++;
  247. }
  248. // If no record found
  249. if ($num == 0) {
  250. $colspan = 6;
  251. print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
  252. }
  253. print "</table>";
  254. print '</div>';
  255. print '</form>';
  256. } else {
  257. dol_print_error($db);
  258. }
  259. }
  260. /* ************************************************************************** */
  261. /* */
  262. /* Creation mode */
  263. /* */
  264. /* ************************************************************************** */
  265. if ($action == 'create') {
  266. $object = new AssetType($db);
  267. if (!empty($conf->accounting->enabled)) {
  268. $formaccounting = new FormAccounting($db);
  269. }
  270. print load_fiche_titre($langs->trans("NewAssetType"), '', $object->picto);
  271. print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
  272. print '<input type="hidden" name="token" value="'.newToken().'">';
  273. print '<input type="hidden" name="action" value="add">';
  274. print dol_get_fiche_head('');
  275. print '<table class="border centpercent">';
  276. print '<tbody>';
  277. print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="label" size="40"></td></tr>';
  278. if (!empty($conf->accounting->enabled)) {
  279. // Accountancy_code_asset
  280. print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeAsset").'</td>';
  281. print '<td>';
  282. print $formaccounting->select_account($object->accountancy_code_asset, 'accountancy_code_asset', 1, '', 1, 1);
  283. print '</td></tr>';
  284. // Accountancy_code_depreciation_expense
  285. print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeDepreciationAsset").'</td>';
  286. print '<td>';
  287. print $formaccounting->select_account($object->accountancy_code_depreciation_asset, 'accountancy_code_depreciation_asset', 1, '', 1, 1);
  288. print '</td></tr>';
  289. // Accountancy_code_depreciation_expense
  290. print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeDepreciationExpense").'</td>';
  291. print '<td>';
  292. print $formaccounting->select_account($object->accountancy_code_depreciation_expense, 'accountancy_code_depreciation_expense', 1, '', 1, 1);
  293. print '</td></tr>';
  294. } else // For external software
  295. {
  296. // Accountancy_code_asset
  297. print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeAsset").'</td>';
  298. print '<td><input name="accountancy_code_asset" class="maxwidth200" value="'.$object->accountancy_code_asset.'">';
  299. print '</td></tr>';
  300. // Accountancy_code_depreciation_asset
  301. print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeDepreciationAsset").'</td>';
  302. print '<td><input name="accountancy_code_depreciation_asset" class="maxwidth200" value="'.$object->accountancy_code_depreciation_asset.'">';
  303. print '</td></tr>';
  304. // Accountancy_code_depreciation_expense
  305. print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeDepreciationExpense").'</td>';
  306. print '<td><input name="accountancy_code_depreciation_expense" class="maxwidth200" value="'.$object->accountancy_code_depreciation_expense.'">';
  307. print '</td></tr>';
  308. }
  309. print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
  310. print '<textarea name="comment" wrap="soft" class="centpercent" rows="3"></textarea></td></tr>';
  311. // Other attributes
  312. $parameters = array();
  313. $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
  314. print $hookmanager->resPrint;
  315. if (empty($reshook)) {
  316. print $object->showOptionals($extrafields, 'create', $parameters);
  317. }
  318. print '<tbody>';
  319. print "</table>\n";
  320. print dol_get_fiche_end();
  321. print $form->buttonsSaveCancel("Add");
  322. print "</form>\n";
  323. }
  324. /* ************************************************************************** */
  325. /* */
  326. /* View mode */
  327. /* */
  328. /* ************************************************************************** */
  329. if ($rowid > 0) {
  330. if ($action != 'edit') {
  331. $object = new AssetType($db);
  332. $object->fetch($rowid);
  333. $object->fetch_optionals();
  334. /*
  335. * Confirmation suppression
  336. */
  337. if ($action == 'delete') {
  338. print $form->formconfirm($_SERVER['PHP_SELF']."?rowid=".$object->id, $langs->trans("DeleteAnAssetType"), $langs->trans("ConfirmDeleteAssetType", $object->label), "confirm_delete", '', 0, 1);
  339. }
  340. $head = asset_type_prepare_head($object);
  341. print dol_get_fiche_head($head, 'card', $langs->trans("AssetType"), -1, 'asset');
  342. $linkback = '<a href="'.DOL_URL_ROOT.'/asset/type.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
  343. $morehtmlref = '<div class="refidno">';
  344. // Ref asset type
  345. $morehtmlref .= $form->editfieldkey("Label", 'label', $object->label, $object, $user->rights->asset->write, 'string', '', 0, 1);
  346. $morehtmlref .= $form->editfieldval("Label", 'label', $object->label, $object, $user->rights->asset->write, 'string', '', null, null, '', 1);
  347. $morehtmlref .= '</div>';
  348. dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
  349. print '<div class="fichecenter">';
  350. print '<div class="underbanner clearboth"></div>';
  351. print '<table class="border centpercent tableforfield">';
  352. print '<tr>';
  353. print '<td class="nowrap titlefieldcreate">';
  354. print $langs->trans("AccountancyCodeAsset");
  355. print '</td><td>';
  356. if (!empty($conf->accounting->enabled)) {
  357. $accountingaccount = new AccountingAccount($db);
  358. $accountingaccount->fetch('', $object->accountancy_code_asset, 1);
  359. print $accountingaccount->getNomUrl(0, 1, 1, '', 1);
  360. } else {
  361. print $object->accountancy_code_asset;
  362. }
  363. print '</td>';
  364. print '</tr>';
  365. print '<tr>';
  366. print '<td class="nowrap">';
  367. print $langs->trans("AccountancyCodeDepreciationAsset");
  368. print '</td><td>';
  369. if (!empty($conf->accounting->enabled)) {
  370. $accountingaccount2 = new AccountingAccount($db);
  371. $accountingaccount2->fetch('', $object->accountancy_code_depreciation_asset, 1);
  372. print $accountingaccount2->getNomUrl(0, 1, 1, '', 1);
  373. } else {
  374. print $object->accountancy_code_depreciation_asset;
  375. }
  376. print '</td>';
  377. print '</tr>';
  378. print '<tr>';
  379. print '<td class="nowrap">';
  380. print $langs->trans("AccountancyCodeDepreciationExpense");
  381. print '</td><td>';
  382. if (!empty($conf->accounting->enabled)) {
  383. $accountingaccount3 = new AccountingAccount($db);
  384. $accountingaccount3->fetch('', $object->accountancy_code_depreciation_expense, 1);
  385. print $accountingaccount3->getNomUrl(0, 1, 1, '', 1);
  386. } else {
  387. print $object->accountancy_code_depreciation_expense;
  388. }
  389. print '</td>';
  390. print '</tr>';
  391. print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
  392. print nl2br($object->note)."</td></tr>";
  393. // Other attributes
  394. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
  395. print '</table>';
  396. print '</div>';
  397. print dol_get_fiche_end();
  398. /*
  399. * Buttons
  400. */
  401. print '<div class="tabsAction">';
  402. // Edit
  403. if ($user->rights->asset->write) {
  404. print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&token='.newToken().'&rowid='.((int) $object->id).'">'.$langs->trans("Modify").'</a></div>';
  405. }
  406. // Delete
  407. if ($user->rights->asset->write) {
  408. print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&rowid='.((int) $object->id).'">'.$langs->trans("DeleteType").'</a></div>';
  409. }
  410. print "</div>";
  411. }
  412. /* ************************************************************************** */
  413. /* */
  414. /* Edition mode */
  415. /* */
  416. /* ************************************************************************** */
  417. if ($action == 'edit') {
  418. $object = new AssetType($db);
  419. $object->fetch($rowid);
  420. $object->fetch_optionals();
  421. if (!empty($conf->accounting->enabled)) {
  422. $formaccounting = new FormAccounting($db);
  423. }
  424. $head = asset_type_prepare_head($object);
  425. print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'">';
  426. print '<input type="hidden" name="token" value="'.newToken().'">';
  427. print '<input type="hidden" name="rowid" value="'.$object->id.'">';
  428. print '<input type="hidden" name="action" value="update">';
  429. print dol_get_fiche_head($head, 'card', $langs->trans("AssetsType"), -1, 'setup');
  430. print '<table class="border centpercent">';
  431. print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td>'.$object->id.'</td></tr>';
  432. print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="label" size="40" value="'.dol_escape_htmltag($object->label).'"></td></tr>';
  433. if (!empty($conf->accounting->enabled)) {
  434. // Accountancy_code_asset
  435. print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeAsset").'</td>';
  436. print '<td>';
  437. print $formaccounting->select_account($object->accountancy_code_asset, 'accountancy_code_asset', 1, '', 1, 1);
  438. print '</td></tr>';
  439. // Accountancy_code_depreciation_expense
  440. print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeDepreciationAsset").'</td>';
  441. print '<td>';
  442. print $formaccounting->select_account($object->accountancy_code_depreciation_asset, 'accountancy_code_depreciation_asset', 1, '', 1, 1);
  443. print '</td></tr>';
  444. // Accountancy_code_depreciation_expense
  445. print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeDepreciationExpense").'</td>';
  446. print '<td>';
  447. print $formaccounting->select_account($object->accountancy_code_depreciation_expense, 'accountancy_code_depreciation_expense', 1, '', 1, 1);
  448. print '</td></tr>';
  449. } else // For external software
  450. {
  451. // Accountancy_code_asset
  452. print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeAsset").'</td>';
  453. print '<td><input name="accountancy_code_asset" class="maxwidth200" value="'.$object->accountancy_code_asset.'">';
  454. print '</td></tr>';
  455. // Accountancy_code_depreciation_asset
  456. print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeDepreciationAsset").'</td>';
  457. print '<td><input name="accountancy_code_depreciation_asset" class="maxwidth200" value="'.$object->accountancy_code_depreciation_asset.'">';
  458. print '</td></tr>';
  459. // Accountancy_code_depreciation_expense
  460. print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeDepreciationExpense").'</td>';
  461. print '<td><input name="accountancy_code_depreciation_expense" class="maxwidth200" value="'.$object->accountancy_code_depreciation_expense.'">';
  462. print '</td></tr>';
  463. }
  464. print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
  465. print '<textarea name="comment" wrap="soft" class="centpercent" rows="3">'.$object->note.'</textarea></td></tr>';
  466. // Other attributes
  467. $parameters = array();
  468. $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $act, $action); // Note that $action and $object may have been modified by hook
  469. print $hookmanager->resPrint;
  470. if (empty($reshook)) {
  471. print $object->showOptionals($extrafields, 'edit', $parameters);
  472. }
  473. // Other attributes
  474. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
  475. print '</table>';
  476. print dol_get_fiche_end();
  477. print $form->buttonsSaveCancel();
  478. print "</form>";
  479. }
  480. }
  481. // End of page
  482. llxFooter();
  483. $db->close();