info.php 5.0 KB

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