dolibarr 21.0.0-alpha
info.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2014-2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
3 * Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
4 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
26// Load Dolibarr environment
27require '../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
29require_once DOL_DOCUMENT_ROOT.'/core/lib/loan.lib.php';
30require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
31if (isModEnabled('project')) {
32 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
33}
34
35// Load translation files required by the page
36$langs->loadLangs(array("compta", "bills", "loan"));
37
38$id = GETPOSTINT('id');
39$action = GETPOST('action', 'aZ09');
40
41// Security check
42$socid = GETPOSTINT('socid');
43if ($user->socid) {
44 $socid = $user->socid;
45}
46$result = restrictedArea($user, 'loan', $id, '', '');
47
48
49/*
50 * Actions
51 */
52
53// None
54
55
56/*
57 * View
58 */
59
60$form = new Form($db);
61
62$title = $langs->trans("Loan").' - '.$langs->trans("Info");
63$help_url = 'EN:Module_Loan|FR:Module_Emprunt';
64
65llxHeader("", $title, $help_url, '', 0, 0, '', '', '', 'mod-loan page-card_info');
66
67$object = new Loan($db);
68$object->fetch($id);
69$object->info($id);
70
71$head = loan_prepare_head($object);
72
73print dol_get_fiche_head($head, 'info', $langs->trans("Loan"), -1, 'money-bill-alt');
74
75$morehtmlref = '<div class="refidno">';
76// Ref loan
77$morehtmlref .= $form->editfieldkey("Label", 'label', $object->label, $object, 0, 'string', '', 0, 1);
78$morehtmlref .= $form->editfieldval("Label", 'label', $object->label, $object, 0, 'string', '', null, null, '', 1);
79// Project
80if (isModEnabled('project')) {
81 $langs->load("projects");
82 $morehtmlref .= '<br>'.$langs->trans('Project').' : ';
83 if ($user->hasRight('loan', 'write')) {
84 //if ($action != 'classify')
85 // $morehtmlref .= '<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token='.newToken().'&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
86 if ($action == 'classify') {
87 // $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
88 $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
89 $morehtmlref .= '<input type="hidden" name="action" value="classin">';
90 $morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
91 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
92 $morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
93 $morehtmlref .= '</form>';
94 } else {
95 $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
96 }
97 } else {
98 if (!empty($object->fk_project)) {
99 $proj = new Project($db);
100 $proj->fetch($object->fk_project);
101 $morehtmlref .= ' : '.$proj->getNomUrl(1);
102 if ($proj->title) {
103 $morehtmlref .= ' - '.$proj->title;
104 }
105 } else {
106 $morehtmlref .= '';
107 }
108 }
109}
110$morehtmlref .= '</div>';
111
112$linkback = '<a href="'.DOL_URL_ROOT.'/loan/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
113
114$morehtmlstatus = $morehtmlright;
115dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus);
116
117print '<div class="fichecenter">';
118print '<div class="underbanner clearboth"></div>';
119
120print '<br>';
121
122print '<table width="100%"><tr><td>';
123dol_print_object_info($object);
124print '</td></tr></table>';
125
126print '</div>';
127
128// End of page
129llxFooter();
130$db->close();
$id
Definition account.php:39
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:70
Class to manage generation of HTML components Only common components must be here.
Loan.
Class to manage projects.
llxFooter()
Footer empty.
Definition document.php:107
dol_print_object_info($object, $usetable=0)
Show information on an object TODO Move this into html.formother.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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:34
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.