info.php 4.0 KB

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