note.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <?php
  2. /* Copyright (C) 2007-2022 Laurent Destailleur <eldy@users.sourceforge.net>
  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/sociales/note.php
  19. * \ingroup tax
  20. * \brief Tab for notes on Taxes
  21. */
  22. require '../../main.inc.php';
  23. require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
  24. require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
  25. require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
  26. if (!empty($conf->projet->enabled)) {
  27. include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
  28. include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
  29. }
  30. // Load translation files required by the page
  31. $langs->loadLangs(array('compta', 'bills'));
  32. // Get parameters
  33. $id = GETPOST('id', 'int');
  34. $ref = GETPOST('ref', 'alpha');
  35. $action = GETPOST('action', 'aZ09');
  36. $cancel = GETPOST('cancel', 'aZ09');
  37. $backtopage = GETPOST('backtopage', 'alpha');
  38. $object = new ChargeSociales($db);
  39. if ($id > 0) {
  40. $object->fetch($id);
  41. }
  42. // Security check
  43. $socid = GETPOST('socid', 'int');
  44. if ($user->socid) {
  45. $socid = $user->socid;
  46. }
  47. $result = restrictedArea($user, 'tax', $object->id, 'chargesociales', 'charges');
  48. $permissiontoread = $user->rights->tax->charges->lire;
  49. $permissiontoadd = $user->rights->tax->charges->creer;
  50. $permissionnote = $user->rights->tax->charges->creer; // Used by the include of actions_setnotes.inc.php
  51. /*
  52. * Actions
  53. */
  54. $parameters = array();
  55. $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
  56. if ($reshook < 0) {
  57. setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  58. }
  59. if (empty($reshook)) {
  60. include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
  61. }
  62. /*
  63. * View
  64. */
  65. $form = new Form($db);
  66. $title = $langs->trans("SocialContribution").' - '.$langs->trans("Note");
  67. $help_url = 'EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividendes|ES:M&oacute;dulo Impuestos y cargas sociales (IVA, impuestos)';
  68. llxHeader('', $title, $help_url);
  69. if ($id > 0 || !empty($ref)) {
  70. $object->fetch_thirdparty();
  71. $head = tax_prepare_head($object);
  72. print dol_get_fiche_head($head, 'note', $langs->trans("SocialContribution"), -1, $object->picto);
  73. $morehtmlref = '<div class="refidno">';
  74. // Label of social contribution
  75. $morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1);
  76. $morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1);
  77. // Project
  78. if (!empty($conf->projet->enabled)) {
  79. $langs->load("projects");
  80. $morehtmlref .= '<br>'.$langs->trans('Project').' : ';
  81. if (!empty($object->fk_project)) {
  82. $proj = new Project($db);
  83. $proj->fetch($object->fk_project);
  84. $morehtmlref .= ' : '.$proj->getNomUrl(1);
  85. if ($proj->title) {
  86. $morehtmlref .= ' - '.dol_escape_htmltag($proj->title);
  87. }
  88. } else {
  89. $morehtmlref .= '';
  90. }
  91. }
  92. $morehtmlref .= '</div>';
  93. // Object card
  94. // ------------------------------------------------------------
  95. $linkback = '<a href="'.DOL_URL_ROOT.'/compta/sociales/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
  96. //$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
  97. $morehtmlright = '';
  98. dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
  99. print '<div class="fichecenter">';
  100. print '<div class="underbanner clearboth"></div>';
  101. $cssclass = "titlefield";
  102. include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
  103. print '</div>';
  104. print dol_get_fiche_end();
  105. }
  106. // End of page
  107. llxFooter();
  108. $db->close();