info.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <?php
  2. /* Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
  4. * Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  18. */
  19. /**
  20. * \file htdocs/commande/info.php
  21. * \ingroup commande
  22. * \brief Sale Order info page
  23. */
  24. // Load Dolibarr environment
  25. require '../main.inc.php';
  26. require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
  27. require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
  28. require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php';
  29. if (isModEnabled('project')) {
  30. require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
  31. }
  32. if (!$user->rights->commande->lire) {
  33. accessforbidden();
  34. }
  35. // Load translation files required by the page
  36. $langs->loadLangs(array('orders', 'sendings', 'bills'));
  37. $socid = 0;
  38. $comid = GETPOST("id", 'int');
  39. $id = GETPOST("id", 'int');
  40. $ref = GETPOST('ref', 'alpha');
  41. // Security check
  42. if ($user->socid) {
  43. $socid = $user->socid;
  44. }
  45. $result = restrictedArea($user, 'commande', $comid, '');
  46. $usercancreate = $user->hasRight("commande", "creer");
  47. $object = new Commande($db);
  48. if (!$object->fetch($id, $ref) > 0) {
  49. dol_print_error($db);
  50. exit;
  51. }
  52. /*
  53. * View
  54. */
  55. $form = new Form($db);
  56. $title = $langs->trans('Order')." - ".$langs->trans('Info');
  57. $help_url = 'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes|DE:Modul_Kundenaufträge';
  58. llxHeader('', $title, $help_url);
  59. $object->fetch_thirdparty();
  60. $object->info($object->id);
  61. $head = commande_prepare_head($object);
  62. print dol_get_fiche_head($head, 'info', $langs->trans("CustomerOrder"), -1, 'order');
  63. // Order card
  64. $linkback = '<a href="'.DOL_URL_ROOT.'/commande/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
  65. $morehtmlref = '<div class="refidno">';
  66. // Ref customer
  67. $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
  68. $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
  69. // Thirdparty
  70. $morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1);
  71. // Project
  72. if (isModEnabled('project')) {
  73. $langs->load("projects");
  74. $morehtmlref .= '<br>';
  75. if (0) {
  76. $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
  77. if ($action != 'classify') {
  78. $morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
  79. }
  80. $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
  81. } else {
  82. if (!empty($object->fk_project)) {
  83. $proj = new Project($db);
  84. $proj->fetch($object->fk_project);
  85. $morehtmlref .= $proj->getNomUrl(1);
  86. if ($proj->title) {
  87. $morehtmlref .= '<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).'</span>';
  88. }
  89. }
  90. }
  91. }
  92. $morehtmlref .= '</div>';
  93. dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
  94. print '<div class="fichecenter">';
  95. print '<div class="underbanner clearboth"></div>';
  96. print '<br>';
  97. print '<table width="100%"><tr><td>';
  98. dol_print_object_info($object);
  99. print '</td></tr></table>';
  100. print '</div>';
  101. print dol_get_fiche_end();
  102. // End of page
  103. llxFooter();
  104. $db->close();