info.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. require '../../main.inc.php';
  26. require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
  27. require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
  28. require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php';
  29. if (!empty($conf->project->enabled)) {
  30. require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
  31. }
  32. // Load translation files required by the page
  33. $langs->loadLangs(array('propal', 'compta'));
  34. $id = GETPOST('id', 'int');
  35. $ref = GETPOST('ref', 'alpha');
  36. $socid = GETPOST('socid', 'int');
  37. $object = new Propal($db);
  38. if (!$object->fetch($id, $ref) > 0) {
  39. dol_print_error($db);
  40. exit;
  41. }
  42. // Security check
  43. if (!empty($user->socid)) {
  44. $socid = $user->socid;
  45. $object->id = $user->socid;
  46. }
  47. restrictedArea($user, 'propal', $object->id);
  48. /*
  49. * View
  50. */
  51. $form = new Form($db);
  52. $title = $langs->trans('Proposal')." - ".$langs->trans('Info');
  53. $help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos';
  54. llxHeader('', $title, $help_url);
  55. $object->fetch_thirdparty();
  56. $head = propal_prepare_head($object);
  57. print dol_get_fiche_head($head, 'info', $langs->trans('Proposal'), -1, 'propal');
  58. $object->info($object->id);
  59. // Proposal card
  60. $linkback = '<a href="'.DOL_URL_ROOT.'/comm/propal/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
  61. $morehtmlref = '<div class="refidno">';
  62. // Ref customer
  63. $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
  64. $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
  65. // Thirdparty
  66. $morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
  67. // Project
  68. if (!empty($conf->project->enabled)) {
  69. $langs->load("projects");
  70. $morehtmlref .= '<br>'.$langs->trans('Project').' ';
  71. if ($user->rights->propal->creer) {
  72. if ($action != 'classify') {
  73. //$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token='.newToken().'&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>';
  74. $morehtmlref .= ' : ';
  75. }
  76. if ($action == 'classify') {
  77. //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
  78. $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
  79. $morehtmlref .= '<input type="hidden" name="action" value="classin">';
  80. $morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
  81. $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
  82. $morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
  83. $morehtmlref .= '</form>';
  84. } else {
  85. $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
  86. }
  87. } else {
  88. if (!empty($object->fk_project)) {
  89. $proj = new Project($db);
  90. $proj->fetch($object->fk_project);
  91. $morehtmlref .= ' : '.$proj->getNomUrl(1);
  92. if ($proj->title) {
  93. $morehtmlref .= ' - '.$proj->title;
  94. }
  95. } else {
  96. $morehtmlref .= '';
  97. }
  98. }
  99. }
  100. $morehtmlref .= '</div>';
  101. dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
  102. print '<div class="fichecenter">';
  103. print '<div class="underbanner clearboth"></div>';
  104. print '<br>';
  105. dol_print_object_info($object);
  106. print '</div>';
  107. print dol_get_fiche_end();
  108. // End of page
  109. llxFooter();
  110. $db->close();