dolibarr  13.0.2
note.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
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 require '../main.inc.php';
26 require_once DOL_DOCUMENT_ROOT.'/core/lib/asset.lib.php';
27 require_once DOL_DOCUMENT_ROOT.'/asset/class/asset.class.php';
28 
29 // Load translation files required by the page
30 $langs->loadLangs(array("asset", "companies"));
31 
32 // Get parameters
33 $id = GETPOST('id', 'int');
34 $ref = GETPOST('ref', 'alpha');
35 $action = GETPOST('action', 'aZ09');
36 $cancel = GETPOST('cancel', 'aZ09');
37 $backtopage = GETPOST('backtopage', 'alpha');
38 
39 // Initialize technical objects
40 $object = new Asset($db);
41 $extrafields = new ExtraFields($db);
42 $diroutputmassaction = $conf->asset->dir_output.'/temp/massgeneration/'.$user->id;
43 $hookmanager->initHooks(array('assetnote')); // Note that conf->hooks_modules contains array
44 
45 // Fetch optionals attributes and labels
46 $extrafields->fetch_name_optionals_label($object->table_element);
47 
48 // Security check - Protection if external user
49 //if ($user->socid > 0) accessforbidden();
50 //if ($user->socid > 0) $socid = $user->socid;
51 //$result = restrictedArea($user, 'asset', $id);
52 
53 // Load object
54 include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
55 if ($id > 0 || !empty($ref)) $upload_dir = $conf->asset->multidir_output[$object->entity]."/".$object->id;
56 
57 // Security check
58 if (!empty($user->socid)) $socid = $user->socid;
59 $result = restrictedArea($user, 'asset', $id);
60 
61 $permissionnote = 1;
62 //$permissionnote=$user->rights->asset->creer; // Used by the include of actions_setnotes.inc.php
63 
64 
65 /*
66  * Actions
67  */
68 
69 include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
70 
71 
72 /*
73  * View
74  */
75 
76 $form = new Form($db);
77 
78 //$help_url='EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes';
79 $help_url = '';
80 llxHeader('', $langs->trans('Assets'), $help_url);
81 
82 if ($id > 0 || !empty($ref))
83 {
84  $object->fetch_thirdparty();
85 
86  $head = asset_prepare_head($object);
87 
88  print dol_get_fiche_head($head, 'note', $langs->trans("Asset"), -1, 'generic');
89 
90  // Object card
91  // ------------------------------------------------------------
92  $linkback = '<a href="'.dol_buildpath('/asset/list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
93 
94  $morehtmlref = '<div class="refidno">';
95  /*
96  // Ref customer
97  $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
98  $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
99  // Thirdparty
100  $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
101  // Project
102  if (! empty($conf->projet->enabled))
103  {
104  $langs->load("projects");
105  $morehtmlref.='<br>'.$langs->trans('Project') . ' ';
106  if ($user->rights->asset->creer)
107  {
108  if ($action != 'classify')
109  //$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
110  $morehtmlref.=' : ';
111  if ($action == 'classify') {
112  //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
113  $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
114  $morehtmlref.='<input type="hidden" name="action" value="classin">';
115  $morehtmlref.='<input type="hidden" name="token" value="'.newToken().'">';
116  $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
117  $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
118  $morehtmlref.='</form>';
119  } else {
120  $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
121  }
122  } else {
123  if (! empty($object->fk_project)) {
124  $proj = new Project($db);
125  $proj->fetch($object->fk_project);
126  $morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
127  $morehtmlref.=$proj->ref;
128  $morehtmlref.='</a>';
129  } else {
130  $morehtmlref.='';
131  }
132  }
133  }*/
134  $morehtmlref .= '</div>';
135 
136 
137  dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
138 
139 
140  print '<div class="fichecenter">';
141  print '<div class="underbanner clearboth"></div>';
142 
143 
144  $cssclass = "titlefield";
145  include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
146 
147  print '</div>';
148 
150 }
151 
152 // End of page
153 llxFooter();
154 $db->close();
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
llxHeader()
Empty header.
Definition: wrapper.php:45
Class to manage standard extra fields.
Class to manage generation of HTML components Only common components must be here.
asset_prepare_head(Asset $object)
Prepare admin pages header.
Definition: asset.lib.php:74
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
Definition: index.php:89
Class for Asset.
Definition: asset.class.php:30
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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.
llxFooter()
Empty footer.
Definition: wrapper.php:59