info.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <?php
  2. /* Copyright (C) 2016-2017 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/compta/tva/info.php
  19. * \ingroup tax
  20. * \brief Page with info about vat
  21. */
  22. // Load Dolibarr environment
  23. require '../../main.inc.php';
  24. require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
  25. require_once DOL_DOCUMENT_ROOT.'/core/lib/vat.lib.php';
  26. require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
  27. // Load translation files required by the page
  28. $langs->loadLangs(array('compta', 'bills'));
  29. $id = GETPOST('id', 'int');
  30. $action = GETPOST('action', 'aZ09');
  31. $object = new Tva($db);
  32. // Security check
  33. $socid = GETPOST('socid', 'int');
  34. if ($user->socid) {
  35. $socid = $user->socid;
  36. }
  37. $result = restrictedArea($user, 'tax', '', 'tva', 'charges');
  38. /*
  39. * Actions
  40. */
  41. if ($action == 'setlib' && $user->rights->tax->charges->creer) {
  42. $object->fetch($id);
  43. $result = $object->setValueFrom('label', GETPOST('lib', 'alpha'), '', '', 'text', '', $user, 'TAX_MODIFY');
  44. if ($result < 0) {
  45. setEventMessages($object->error, $object->errors, 'errors');
  46. }
  47. }
  48. /*
  49. * View
  50. */
  51. $title = $langs->trans("VAT")." - ".$langs->trans("Info");
  52. $help_url = '';
  53. llxHeader("", $title, $helpurl);
  54. $object = new Tva($db);
  55. $object->fetch($id);
  56. $object->info($id);
  57. $head = vat_prepare_head($object);
  58. print dol_get_fiche_head($head, 'info', $langs->trans("VATPayment"), -1, 'payment');
  59. $morehtmlref = '<div class="refidno">';
  60. // Label of social contribution
  61. $morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1);
  62. $morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1);
  63. $morehtmlref .= '</div>';
  64. $linkback = '<a href="'.DOL_URL_ROOT.'/compta/tva/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
  65. dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', '');
  66. print '<div class="fichecenter">';
  67. print '<div class="underbanner clearboth"></div>';
  68. print '<br>';
  69. print '<table width="100%"><tr><td>';
  70. dol_print_object_info($object);
  71. print '</td></tr></table>';
  72. print '</div>';
  73. print dol_get_fiche_end();
  74. llxFooter();
  75. $db->close();