PageRenderTime 50ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/htdocs/projet/note.php

https://github.com/hregis/dolibarr
PHP | 132 lines | 60 code | 32 blank | 40 comment | 15 complexity | 22f3049c6f14fa2b8935687e7a19a735 MD5 | raw file
  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 = (isset($_REQUEST['mode']) && $_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. $hookmanager->initHooks(array('projetnote'));
  42. $result = restrictedArea($user, 'projet', $id, 'projet&project');
  43. $permissionnote = $user->rights->projet->creer; // Used by the include of actions_setnotes.inc.php
  44. /*
  45. * Actions
  46. */
  47. $reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
  48. if ($reshook < 0) {
  49. setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  50. }
  51. if (empty($reshook)) {
  52. include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
  53. }
  54. /*
  55. * View
  56. */
  57. $title = $langs->trans("Project").' - '.$langs->trans("Note").' - '.$object->ref.' '.$object->name;
  58. if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) {
  59. $title = $object->ref.' '.$object->name.' - '.$langs->trans("Note");
  60. }
  61. $help_url = "EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";
  62. llxHeader("", $title, $help_url);
  63. $form = new Form($db);
  64. $userstatic = new User($db);
  65. $now = dol_now();
  66. if ($id > 0 || !empty($ref)) {
  67. // To verify role of users
  68. //$userAccess = $object->restrictedProjectArea($user,'read');
  69. $userWrite = $object->restrictedProjectArea($user, 'write');
  70. //$userDelete = $object->restrictedProjectArea($user,'delete');
  71. //print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete;
  72. $head = project_prepare_head($object);
  73. print dol_get_fiche_head($head, 'notes', $langs->trans('Project'), -1, ($object->public ? 'projectpub' : 'project'));
  74. // Project card
  75. $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
  76. $morehtmlref = '<div class="refidno">';
  77. // Title
  78. $morehtmlref .= $object->title;
  79. // Thirdparty
  80. if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
  81. $morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project');
  82. }
  83. $morehtmlref .= '</div>';
  84. // Define a complementary filter for search of next/prev ref.
  85. if (empty($user->rights->projet->all->lire)) {
  86. $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
  87. $object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
  88. }
  89. dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
  90. print '<div class="fichecenter">';
  91. print '<div class="underbanner clearboth"></div>';
  92. $cssclass = "titlefield";
  93. include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
  94. print '</div>';
  95. print '<div class="clearboth"></div>';
  96. print dol_get_fiche_end();
  97. }
  98. // End of page
  99. llxFooter();
  100. $db->close();