note.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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 <http://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)) $object->fetchComments();
  36. // Security check
  37. $socid=0;
  38. //if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
  39. $result = restrictedArea($user, 'projet', $id,'projet&project');
  40. $permissionnote=$user->rights->projet->creer; // Used by the include of actions_setnotes.inc.php
  41. /*
  42. * Actions
  43. */
  44. include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
  45. /*
  46. * View
  47. */
  48. $title=$langs->trans("Project").' - '.$langs->trans("Note").' - '.$object->ref.' '.$object->name;
  49. if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->ref.' '.$object->name.' - '.$langs->trans("Note");
  50. $help_url="EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";
  51. llxHeader("",$title,$help_url);
  52. $form = new Form($db);
  53. $userstatic=new User($db);
  54. $now=dol_now();
  55. if ($id > 0 || ! empty($ref))
  56. {
  57. // To verify role of users
  58. //$userAccess = $object->restrictedProjectArea($user,'read');
  59. $userWrite = $object->restrictedProjectArea($user,'write');
  60. //$userDelete = $object->restrictedProjectArea($user,'delete');
  61. //print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete;
  62. $head = project_prepare_head($object);
  63. dol_fiche_head($head, 'notes', $langs->trans('Project'), -1, ($object->public?'projectpub':'project'));
  64. // Project card
  65. $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
  66. $morehtmlref='<div class="refidno">';
  67. // Title
  68. $morehtmlref.=$object->title;
  69. // Thirdparty
  70. if ($object->thirdparty->id > 0)
  71. {
  72. $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'project');
  73. }
  74. $morehtmlref.='</div>';
  75. // Define a complementary filter for search of next/prev ref.
  76. if (! $user->rights->projet->all->lire)
  77. {
  78. $objectsListId = $object->getProjectsAuthorizedForUser($user,0,0);
  79. $object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")";
  80. }
  81. dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
  82. print '<div class="fichecenter">';
  83. print '<div class="underbanner clearboth"></div>';
  84. $cssclass="titlefield";
  85. include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
  86. print '</div>';
  87. print '<div class="clearboth"></div>';
  88. dol_fiche_end();
  89. }
  90. // End of page
  91. llxFooter();
  92. $db->close();