info.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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.'/supplier_proposal/class/supplier_proposal.class.php';
  28. require_once DOL_DOCUMENT_ROOT.'/core/lib/supplier_proposal.lib.php';
  29. if (!empty($conf->projet->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('supplier_proposal', 'compta'));
  34. $id = GETPOST('id', 'int');
  35. $socid = GETPOST('socid', 'int');
  36. // Security check
  37. if (!empty($user->socid)) {
  38. $socid = $user->socid;
  39. }
  40. $result = restrictedArea($user, 'supplier_proposal', $id);
  41. /*
  42. * View
  43. */
  44. $form = new Form($db);
  45. $title = $langs->trans('CommRequest')." - ".$langs->trans('Info');
  46. $help_url = 'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur';
  47. llxHeader('', $title, $help_url);
  48. $object = new SupplierProposal($db);
  49. $object->fetch($id);
  50. $object->fetch_thirdparty();
  51. $object->info($object->id);
  52. $head = supplier_proposal_prepare_head($object);
  53. print dol_get_fiche_head($head, 'info', $langs->trans('CommRequest'), -1, 'supplier_proposal');
  54. // Supplier proposal card
  55. $linkback = '<a href="'.DOL_URL_ROOT.'/supplier_proposal/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
  56. $morehtmlref = '<div class="refidno">';
  57. // Ref supplier
  58. //$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1);
  59. //$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', null, null, '', 1);
  60. // Thirdparty
  61. $morehtmlref .= $langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
  62. // Project
  63. if (!empty($conf->projet->enabled)) {
  64. $langs->load("projects");
  65. $morehtmlref .= '<br>'.$langs->trans('Project').' ';
  66. if ($user->rights->supplier_proposal->creer) {
  67. if ($action != 'classify') {
  68. //$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token='.newToken().'&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
  69. $morehtmlref .= ' : ';
  70. }
  71. if ($action == 'classify') {
  72. //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
  73. $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
  74. $morehtmlref .= '<input type="hidden" name="action" value="classin">';
  75. $morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
  76. $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
  77. $morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
  78. $morehtmlref .= '</form>';
  79. } else {
  80. $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
  81. }
  82. } else {
  83. if (!empty($object->fk_project)) {
  84. $proj = new Project($db);
  85. $proj->fetch($object->fk_project);
  86. $morehtmlref .= ' : '.$proj->getNomUrl(1);
  87. if ($proj->title) {
  88. $morehtmlref .= ' - '.$proj->title;
  89. }
  90. } else {
  91. $morehtmlref .= '';
  92. }
  93. }
  94. }
  95. $morehtmlref .= '</div>';
  96. dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
  97. print '<div class="fichecenter">';
  98. print '<div class="underbanner clearboth"></div>';
  99. print '<br>';
  100. print '<table width="100%"><tr><td>';
  101. dol_print_object_info($object);
  102. print '</td></tr></table>';
  103. print '</div>';
  104. print dol_get_fiche_end();
  105. // End of page
  106. llxFooter();
  107. $db->close();