new.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. /* Copyright (C) 2013-2016 Jean-François FERRY <hello@librethic.io>
  3. * Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
  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/ticket/new.php
  20. * \ingroup ticket
  21. */
  22. require '../main.inc.php';
  23. require_once DOL_DOCUMENT_ROOT . '/ticket/class/actions_ticket.class.php';
  24. require_once DOL_DOCUMENT_ROOT . '/core/class/html.formticket.class.php';
  25. require_once DOL_DOCUMENT_ROOT . '/core/lib/ticket.lib.php';
  26. require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
  27. // Load translation files required by the page
  28. $langs->loadLangs(array('companies', 'other', 'ticket'));
  29. // Get parameters
  30. $id = GETPOST('id', 'int');
  31. $socid = GETPOST('socid', 'int');
  32. $contactid = GETPOST('contactid', 'int');
  33. $msg_id = GETPOST('msg_id', 'int');
  34. $notifyTiers = GETPOST("notify_tiers_at_create", 'alpha');
  35. $action = GETPOST('action', 'aZ09');
  36. // Protection if external user
  37. if (!$user->rights->ticket->read || !$user->rights->ticket->write) {
  38. accessforbidden();
  39. }
  40. $object = new Ticket($db);
  41. $actionobject = new ActionsTicket($db);
  42. /*
  43. * Actions
  44. */
  45. $actionobject->doActions($action, $object);
  46. /*
  47. * View
  48. */
  49. $form = new Form($db);
  50. $help_url = 'FR:DocumentationModuleTicket';
  51. $page_title = $actionobject->getTitle($action);
  52. llxHeader('', $page_title, $help_url);
  53. if ($action == 'create_ticket') {
  54. $formticket = new FormTicket($db);
  55. print load_fiche_titre($langs->trans('NewTicket'), '', 'title_ticket');
  56. $formticket->withfromsocid = $socid ? $socid : $user->societe_id;
  57. $formticket->withfromcontactid = $contactid ? $contactid : '';
  58. $formticket->withtitletopic = 1;
  59. $formticket->withnotifytiersatcreate = ($notifyTiers?1:0);
  60. $formticket->withusercreate = 1;
  61. $formticket->withref = 1;
  62. $formticket->fk_user_create = $user->id;
  63. $formticket->withfile = 2;
  64. $formticket->withextrafields = 1;
  65. $formticket->param = array('origin' => GETPOST('origin'), 'originid' => GETPOST('originid'));
  66. if (empty($defaultref)) {
  67. $defaultref = '';
  68. }
  69. $formticket->showForm(1);
  70. }
  71. //$somethingshown=$object->showLinkedObjectBlock();
  72. // End of page
  73. llxFooter('');
  74. $db->close();