info.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <?php
  2. /* Copyright (C) 2014-2018 Alexandre Spangaro <aspangaro@zendsi.com>
  3. * Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /**
  19. * \file htdocs/loan/info.php
  20. * \ingroup loan
  21. * \brief Page with info about loan
  22. */
  23. require '../main.inc.php';
  24. require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
  25. require_once DOL_DOCUMENT_ROOT.'/core/lib/loan.lib.php';
  26. require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
  27. if (! empty($conf->projet->enabled)) {
  28. require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
  29. }
  30. // Load translation files required by the page
  31. $langs->loadLangs(array("compta","bills","loan"));
  32. $id=GETPOST('id','int');
  33. $action=GETPOST('action','aZ09');
  34. // Security check
  35. $socid = GETPOST('socid','int');
  36. if ($user->societe_id) $socid=$user->societe_id;
  37. $result = restrictedArea($user, 'loan', $id, '','');
  38. /*
  39. * View
  40. */
  41. $form = new Form($db);
  42. $title = $langs->trans("Loan") . ' - ' . $langs->trans("Info");
  43. $help_url = 'EN:Module_Loan|FR:Module_Emprunt';
  44. llxHeader("",$title,$help_url);
  45. $object = new Loan($db);
  46. $object->fetch($id);
  47. $object->info($id);
  48. $head = loan_prepare_head($object);
  49. dol_fiche_head($head, 'info', $langs->trans("Loan"), -1, 'bill');
  50. $morehtmlref='<div class="refidno">';
  51. // Ref loan
  52. $morehtmlref.=$form->editfieldkey("Label", 'label', $object->label, $object, 0, 'string', '', 0, 1);
  53. $morehtmlref.=$form->editfieldval("Label", 'label', $object->label, $object, 0, 'string', '', null, null, '', 1);
  54. // Project
  55. if (! empty($conf->projet->enabled)) {
  56. $langs->load("projects");
  57. $morehtmlref .= '<br>' . $langs->trans('Project') . ' : ';
  58. if ($user->rights->loan->write) {
  59. //if ($action != 'classify')
  60. // $morehtmlref .= '<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
  61. if ($action == 'classify') {
  62. // $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
  63. $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '">';
  64. $morehtmlref .= '<input type="hidden" name="action" value="classin">';
  65. $morehtmlref .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
  66. $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
  67. $morehtmlref .= '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
  68. $morehtmlref .= '</form>';
  69. } else {
  70. $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
  71. }
  72. } else {
  73. if (! empty($object->fk_project)) {
  74. $proj = new Project($db);
  75. $proj->fetch($object->fk_project);
  76. $morehtmlref .= '<a href="' . DOL_URL_ROOT . '/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
  77. $morehtmlref .= $proj->ref;
  78. $morehtmlref .= '</a>';
  79. } else {
  80. $morehtmlref .= '';
  81. }
  82. }
  83. }
  84. $morehtmlref.='</div>';
  85. $linkback = '<a href="' . DOL_URL_ROOT . '/loan/list.php">' . $langs->trans("BackToList") . '</a>';
  86. $object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
  87. dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
  88. print '<div class="fichecenter">';
  89. print '<div class="underbanner clearboth"></div>';
  90. print '<br>';
  91. print '<table width="100%"><tr><td>';
  92. dol_print_object_info($object);
  93. print '</td></tr></table>';
  94. print '</div>';
  95. // End of page
  96. llxFooter();
  97. $db->close();