note.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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. require '../main.inc.php';
  24. require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
  25. require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
  26. // Load translation files required by the page
  27. $langs->load('projects');
  28. $action = GETPOST('action', 'aZ09');
  29. $id = GETPOST('id', 'int');
  30. $ref = GETPOST('ref', 'alpha');
  31. $mine = $_REQUEST['mode'] == 'mine' ? 1 : 0;
  32. //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
  33. $object = new Project($db);
  34. include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
  35. if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) {
  36. $object->fetchComments();
  37. }
  38. // Security check
  39. $socid = 0;
  40. //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.
  41. $result = restrictedArea($user, 'projet', $id, 'projet&project');
  42. $permissionnote = $user->rights->projet->creer; // Used by the include of actions_setnotes.inc.php
  43. /*
  44. * Actions
  45. */
  46. include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
  47. /*
  48. * View
  49. */
  50. $title = $langs->trans("Project").' - '.$langs->trans("Note").' - '.$object->ref.' '.$object->name;
  51. if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) {
  52. $title = $object->ref.' '.$object->name.' - '.$langs->trans("Note");
  53. }
  54. $help_url = "EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";
  55. llxHeader("", $title, $help_url);
  56. $form = new Form($db);
  57. $userstatic = new User($db);
  58. $now = dol_now();
  59. if ($id > 0 || !empty($ref)) {
  60. // To verify role of users
  61. //$userAccess = $object->restrictedProjectArea($user,'read');
  62. $userWrite = $object->restrictedProjectArea($user, 'write');
  63. //$userDelete = $object->restrictedProjectArea($user,'delete');
  64. //print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete;
  65. $head = project_prepare_head($object);
  66. print dol_get_fiche_head($head, 'notes', $langs->trans('Project'), -1, ($object->public ? 'projectpub' : 'project'));
  67. // Project card
  68. $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
  69. $morehtmlref = '<div class="refidno">';
  70. // Title
  71. $morehtmlref .= $object->title;
  72. // Thirdparty
  73. if ($object->thirdparty->id > 0) {
  74. $morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project');
  75. }
  76. $morehtmlref .= '</div>';
  77. // Define a complementary filter for search of next/prev ref.
  78. if (!$user->rights->projet->all->lire) {
  79. $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
  80. $object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
  81. }
  82. dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
  83. print '<div class="fichecenter">';
  84. print '<div class="underbanner clearboth"></div>';
  85. $cssclass = "titlefield";
  86. include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
  87. print '</div>';
  88. print '<div class="clearboth"></div>';
  89. print dol_get_fiche_end();
  90. }
  91. // End of page
  92. llxFooter();
  93. $db->close();