dolibarr 19.0.3
info.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2014-2023 Alexandre Spangaro <aspangaro@easya.solutions>
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 <https://www.gnu.org/licenses/>.
17 */
18
25// Load Dolibarr environment
26require '../main.inc.php';
27require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
28require_once DOL_DOCUMENT_ROOT.'/core/lib/loan.lib.php';
29require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
30if (isModEnabled('project')) {
31 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
32}
33
34// Load translation files required by the page
35$langs->loadLangs(array("compta", "bills", "loan"));
36
37$id = GETPOST('id', 'int');
38$action = GETPOST('action', 'aZ09');
39
40// Security check
41$socid = GETPOST('socid', 'int');
42if ($user->socid) {
43 $socid = $user->socid;
44}
45$result = restrictedArea($user, 'loan', $id, '', '');
46
47
48/*
49 * View
50 */
51
52$form = new Form($db);
53
54$title = $langs->trans("Loan").' - '.$langs->trans("Info");
55$help_url = 'EN:Module_Loan|FR:Module_Emprunt';
56llxHeader("", $title, $help_url);
57
58$object = new Loan($db);
59$object->fetch($id);
60$object->info($id);
61
62$head = loan_prepare_head($object);
63
64print dol_get_fiche_head($head, 'info', $langs->trans("Loan"), -1, 'money-bill-alt');
65
66$morehtmlref = '<div class="refidno">';
67// Ref loan
68$morehtmlref .= $form->editfieldkey("Label", 'label', $object->label, $object, 0, 'string', '', 0, 1);
69$morehtmlref .= $form->editfieldval("Label", 'label', $object->label, $object, 0, 'string', '', null, null, '', 1);
70// Project
71if (isModEnabled('project')) {
72 $langs->load("projects");
73 $morehtmlref .= '<br>'.$langs->trans('Project').' : ';
74 if ($user->hasRight('loan', 'write')) {
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 if ($action == 'classify') {
78 // $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
79 $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
80 $morehtmlref .= '<input type="hidden" name="action" value="classin">';
81 $morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
82 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
83 $morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
84 $morehtmlref .= '</form>';
85 } else {
86 $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
87 }
88 } else {
89 if (!empty($object->fk_project)) {
90 $proj = new Project($db);
91 $proj->fetch($object->fk_project);
92 $morehtmlref .= ' : '.$proj->getNomUrl(1);
93 if ($proj->title) {
94 $morehtmlref .= ' - '.$proj->title;
95 }
96 } else {
97 $morehtmlref .= '';
98 }
99 }
100}
101$morehtmlref .= '</div>';
102
103$linkback = '<a href="'.DOL_URL_ROOT.'/loan/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
104
105dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
106
107print '<div class="fichecenter">';
108print '<div class="underbanner clearboth"></div>';
109
110print '<br>';
111
112print '<table width="100%"><tr><td>';
113dol_print_object_info($object);
114print '</td></tr></table>';
115
116print '</div>';
117
118// End of page
119llxFooter();
120$db->close();
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
Class to manage generation of HTML components Only common components must be here.
Loan.
Class to manage projects.
dol_print_object_info($object, $usetable=0)
Show informations on an object TODO Move this into html.formother.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
loan_prepare_head($object)
Prepare array with list of tabs.
Definition loan.lib.php:33
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.