extrafields_add.tpl.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /* Copyright (C) 2014 Maxime Kohlhaas <support@atm-consulting.fr>
  3. * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. *
  18. * Need to have following variables defined:
  19. * $object (invoice, order, ...)
  20. * $action
  21. * $conf
  22. * $langs
  23. *
  24. * $parameters
  25. * $cols
  26. */
  27. // Protection to avoid direct call of template
  28. if (empty($conf) || !is_object($conf)) {
  29. print "Error, template page can't be called as URL";
  30. exit;
  31. }
  32. ?>
  33. <!-- BEGIN PHP TEMPLATE extrafields_add.tpl.php -->
  34. <?php
  35. // Other attributes
  36. if (!isset($parameters)) {
  37. $parameters = array();
  38. }
  39. $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
  40. print $hookmanager->resPrint;
  41. if (empty($reshook)) {
  42. $params = array();
  43. $params['cols'] = key_exists('colspanvalue', $parameters) ? $parameters['colspanvalue'] : '';
  44. if (!empty($parameters['tdclass'])) {
  45. $params['tdclass'] = $parameters['tdclass'];
  46. }
  47. if (!empty($parameters['tpl_context'])) {
  48. $params['tpl_context'] = $parameters['tpl_context'];
  49. }
  50. print $object->showOptionals($extrafields, 'create', $params);
  51. }
  52. ?>
  53. <!-- END PHP TEMPLATE extrafields_add.tpl.php -->