PageRenderTime 40ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/htdocs/fichinter/note.php

https://github.com/zeert/dolibarr
PHP | 102 lines | 48 code | 25 blank | 29 comment | 13 complexity | de953dc5f0216d1a58bbbdbc04da5eaf MD5 | raw file
Possible License(s): LGPL-2.0
  1. <?php
  2. /* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
  3. * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
  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 2 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/fichinter/note.php
  20. * \ingroup fichinter
  21. * \brief Fiche d'information sur une fiche d'intervention
  22. */
  23. require("../main.inc.php");
  24. require_once(DOL_DOCUMENT_ROOT."/fichinter/class/fichinter.class.php");
  25. require_once(DOL_DOCUMENT_ROOT."/core/lib/fichinter.lib.php");
  26. $langs->load('companies');
  27. $langs->load("interventions");
  28. $id = GETPOST('id','int');
  29. $ref = GETPOST('ref', 'alpha');
  30. $action=GETPOST('action','alpha');
  31. // Security check
  32. if ($user->societe_id) $socid=$user->societe_id;
  33. $result = restrictedArea($user, 'ficheinter', $id, 'fichinter');
  34. $object = new Fichinter($db);
  35. $object->fetch($id,$ref);
  36. /*
  37. * Actions
  38. */
  39. if ($action == 'setnote_public' && $user->rights->ficheinter->creer)
  40. {
  41. $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
  42. if ($result < 0) dol_print_error($db,$object->error);
  43. }
  44. else if ($action == 'setnote_private' && $user->rights->ficheinter->creer)
  45. {
  46. $result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES));
  47. if ($result < 0) dol_print_error($db,$object->error);
  48. }
  49. /*
  50. * View
  51. */
  52. llxHeader();
  53. $form = new Form($db);
  54. if ($id > 0 || ! empty($ref))
  55. {
  56. dol_htmloutput_mesg($mesg);
  57. $societe = new Societe($db);
  58. if ($societe->fetch($object->socid))
  59. {
  60. $head = fichinter_prepare_head($object);
  61. dol_fiche_head($head, 'note', $langs->trans('InterventionCard'), 0, 'intervention');
  62. print '<table class="border" width="100%">';
  63. $linkback = '<a href="'.DOL_URL_ROOT.'/fichinter/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
  64. print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">';
  65. print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
  66. print '</td></tr>';
  67. // Company
  68. print '<tr><td>'.$langs->trans('Company').'</td><td colspan="3">'.$societe->getNomUrl(1).'</td></tr>';
  69. print "</table>";
  70. print '<br>';
  71. include(DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php');
  72. dol_fiche_end();
  73. }
  74. }
  75. llxFooter();
  76. $db->close();
  77. ?>