note.php 4.4 KB

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