note.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <?php
  2. /* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.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. $langs->load('projects');
  27. $action=GETPOST('action');
  28. $id = GETPOST('id','int');
  29. $ref= GETPOST('ref');
  30. $mine = $_REQUEST['mode']=='mine' ? 1 : 0;
  31. //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
  32. $object = new Project($db);
  33. include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
  34. // Security check
  35. $socid=0;
  36. if ($user->societe_id > 0) $socid=$user->societe_id;
  37. $result = restrictedArea($user, 'projet', $id,'projet&project');
  38. $permissionnote=$user->rights->projet->creer; // Used by the include of actions_setnotes.inc.php
  39. /*
  40. * Actions
  41. */
  42. include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
  43. /*
  44. * View
  45. */
  46. $title=$langs->trans("Project").' - '.$langs->trans("Note").' - '.$object->ref.' '.$object->name;
  47. 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");
  48. $help_url="EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";
  49. llxHeader("",$title,$help_url);
  50. $form = new Form($db);
  51. $userstatic=new User($db);
  52. $now=dol_now();
  53. if ($id > 0 || ! empty($ref))
  54. {
  55. // To verify role of users
  56. //$userAccess = $object->restrictedProjectArea($user,'read');
  57. $userWrite = $object->restrictedProjectArea($user,'write');
  58. //$userDelete = $object->restrictedProjectArea($user,'delete');
  59. //print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete;
  60. $head = project_prepare_head($object);
  61. dol_fiche_head($head, 'notes', $langs->trans('Project'), 0, ($object->public?'projectpub':'project'));
  62. print '<table class="border" width="100%">';
  63. $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php">'.$langs->trans("BackToList").'</a>';
  64. // Ref
  65. print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>';
  66. // Define a complementary filter for search of next/prev ref.
  67. if (! $user->rights->projet->all->lire)
  68. {
  69. $projectsListId = $object->getProjectsAuthorizedForUser($user,0,0);
  70. $object->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")";
  71. }
  72. print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
  73. print '</td></tr>';
  74. // Label
  75. print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->title.'</td></tr>';
  76. // Third party
  77. print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
  78. if ($object->thirdparty->id > 0) print $object->thirdparty->getNomUrl(1);
  79. else print'&nbsp;';
  80. print '</td></tr>';
  81. // Visibility
  82. print '<tr><td>'.$langs->trans("Visibility").'</td><td>';
  83. if ($object->public) print $langs->trans('SharedProject');
  84. else print $langs->trans('PrivateProject');
  85. print '</td></tr>';
  86. // Statut
  87. print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
  88. // Date start
  89. print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
  90. print dol_print_date($object->date_start,'day');
  91. print '</td></tr>';
  92. // Date end
  93. print '<tr><td>'.$langs->trans("DateEnd").'</td><td>';
  94. print dol_print_date($object->date_end,'day');
  95. print '</td></tr>';
  96. // Budget
  97. print '<tr><td>'.$langs->trans("Budget").'</td><td>';
  98. if (strcmp($object->budget_amount, '')) print price($object->budget_amount,'',$langs,0,0,0,$conf->currency);
  99. print '</td></tr>';
  100. print "</table>";
  101. print '<br>';
  102. $cssclass="titlefield";
  103. include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
  104. dol_fiche_end();
  105. }
  106. llxFooter();
  107. $db->close();