note.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <?php
  2. /* Copyright (C) 2010 Regis Houssin <regis.houssin@inodbox.com>
  3. * Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
  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. /**
  19. * \file htdocs/projet/note.php
  20. * \ingroup project
  21. * \brief Fiche d'information sur un projet
  22. */
  23. // Load Dolibarr environment
  24. require '../main.inc.php';
  25. require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
  26. require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
  27. // Load translation files required by the page
  28. $langs->load('projects');
  29. $action = GETPOST('action', 'aZ09');
  30. $id = GETPOST('id', 'int');
  31. $ref = GETPOST('ref', 'alpha');
  32. $mine = (isset($_REQUEST['mode']) && $_REQUEST['mode'] == 'mine') ? 1 : 0;
  33. //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
  34. $object = new Project($db);
  35. include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
  36. if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) {
  37. $object->fetchComments();
  38. }
  39. // Security check
  40. $socid = 0;
  41. //if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
  42. $hookmanager->initHooks(array('projetnote'));
  43. $result = restrictedArea($user, 'projet', $id, 'projet&project');
  44. $permissionnote = $user->rights->projet->creer; // Used by the include of actions_setnotes.inc.php
  45. /*
  46. * Actions
  47. */
  48. $reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
  49. if ($reshook < 0) {
  50. setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  51. }
  52. if (empty($reshook)) {
  53. include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
  54. }
  55. /*
  56. * View
  57. */
  58. $title = $langs->trans("Notes").' - '.$object->ref.' '.$object->name;
  59. if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) {
  60. $title = $object->ref.' '.$object->name.' - '.$langs->trans("Note");
  61. }
  62. $help_url = "EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";
  63. llxHeader("", $title, $help_url);
  64. $form = new Form($db);
  65. $userstatic = new User($db);
  66. $now = dol_now();
  67. if ($id > 0 || !empty($ref)) {
  68. // To verify role of users
  69. //$userAccess = $object->restrictedProjectArea($user,'read');
  70. $userWrite = $object->restrictedProjectArea($user, 'write');
  71. //$userDelete = $object->restrictedProjectArea($user,'delete');
  72. //print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete;
  73. $head = project_prepare_head($object);
  74. print dol_get_fiche_head($head, 'notes', $langs->trans('Project'), -1, ($object->public ? 'projectpub' : 'project'));
  75. // Project card
  76. $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
  77. $morehtmlref = '<div class="refidno">';
  78. // Title
  79. $morehtmlref .= $object->title;
  80. // Thirdparty
  81. if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
  82. $morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1, 'project');
  83. }
  84. $morehtmlref .= '</div>';
  85. // Define a complementary filter for search of next/prev ref.
  86. if (empty($user->rights->projet->all->lire)) {
  87. $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
  88. $object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
  89. }
  90. dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
  91. print '<div class="fichecenter">';
  92. print '<div class="underbanner clearboth"></div>';
  93. $cssclass = "titlefield";
  94. include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
  95. print '</div>';
  96. print '<div class="clearboth"></div>';
  97. print dol_get_fiche_end();
  98. }
  99. // End of page
  100. llxFooter();
  101. $db->close();