dolibarr  13.0.2
info.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
23 require '../../main.inc.php';
24 require_once DOL_DOCUMENT_ROOT.'/core/lib/hrm.lib.php';
25 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
26 require_once DOL_DOCUMENT_ROOT.'/hrm/class/establishment.class.php';
27 
28 // Load translation files required by the page
29 $langs->loadLangs(array('admin', 'hrm'));
30 
31 // Get parameters
32 $id = GETPOST('id', 'int');
33 $ref = GETPOST('ref', 'alpha');
34 $action = GETPOST('action', 'aZ09');
35 $cancel = GETPOST('cancel', 'aZ09');
36 $backtopage = GETPOST('backtopage', 'alpha');
37 
38 if (GETPOST('actioncode', 'array')) {
39  $actioncode = GETPOST('actioncode', 'array', 3);
40  if (!count($actioncode)) $actioncode = '0';
41 } else {
42  $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
43 }
44 $search_agenda_label = GETPOST('search_agenda_label');
45 
46 $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
47 $sortfield = GETPOST("sortfield", 'alpha');
48 $sortorder = GETPOST("sortorder", 'alpha');
49 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
50 if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
51 $offset = $limit * $page;
52 $pageprev = $page - 1;
53 $pagenext = $page + 1;
54 if (!$sortfield) $sortfield = 'a.datep,a.id';
55 if (!$sortorder) $sortorder = 'DESC,DESC';
56 
57 // Initialize technical objects
58 $object = new Establishment($db);
59 $extrafields = new ExtraFields($db);
60 $diroutputmassaction = $conf->hrm->dir_output.'/temp/massgeneration/'.$user->id;
61 $hookmanager->initHooks(array('hrmagenda', 'globalcard')); // Note that conf->hooks_modules contains array
62 // Fetch optionals attributes and labels
63 $extrafields->fetch_name_optionals_label($object->table_element);
64 
65 // Load object
66 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
67 if ($id > 0 || !empty($ref)) $upload_dir = $conf->hrm->multidir_output[$object->entity]."/".$object->id;
68 
69 // Security check - Protection if external user
70 //if ($user->socid > 0) accessforbidden();
71 //if ($user->socid > 0) $socid = $user->socid;
72 //$result = restrictedArea($user, 'mymodule', $object->id);
73 
74 $permissiontoadd = $user->rights->hrm->write; // Used by the include of actions_addupdatedelete.inc.php
75 
76 
77 /*
78  * Actions
79  */
80 
81 $parameters = array('id'=>$id);
82 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
83 if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
84 
85 if (empty($reshook))
86 {
87  // Cancel
88  if (GETPOST('cancel', 'alpha') && !empty($backtopage))
89  {
90  header("Location: ".$backtopage);
91  exit;
92  }
93 
94  // Purge search criteria
95  if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
96  {
97  $actioncode = '';
98  $search_agenda_label = '';
99  }
100 }
101 
102 
103 
104 /*
105  * View
106  */
107 
108 $form = new Form($db);
109 
110 if ($object->id > 0)
111 {
112  $title = $langs->trans("Agenda");
113  //if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title;
114  $help_url = '';
115  llxHeader('', $title, $help_url);
116 
117  if (!empty($conf->notification->enabled)) $langs->load("mails");
118  $head = establishment_prepare_head($object);
119 
120 
121  print dol_get_fiche_head($head, 'info', $langs->trans("Establishment"), -1, 'building');
122 
123  // Object card
124  // ------------------------------------------------------------
125  $linkback = '<a href="'.dol_buildpath('/hrm/hrm/myobject_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
126 
127  $morehtmlref = '<div class="refidno">';
128  /*
129  // Ref customer
130  $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
131  $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
132  // Thirdparty
133  $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
134  // Project
135  if (! empty($conf->projet->enabled))
136  {
137  $langs->load("projects");
138  $morehtmlref.='<br>'.$langs->trans('Project') . ' ';
139  if ($permissiontoadd)
140  {
141  if ($action != 'classify')
142  //$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
143  $morehtmlref.=' : ';
144  if ($action == 'classify') {
145  //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
146  $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
147  $morehtmlref.='<input type="hidden" name="action" value="classin">';
148  $morehtmlref.='<input type="hidden" name="token" value="'.newToken().'">';
149  $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
150  $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
151  $morehtmlref.='</form>';
152  } else {
153  $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
154  }
155  } else {
156  if (! empty($object->fk_project)) {
157  $proj = new Project($db);
158  $proj->fetch($object->fk_project);
159  $morehtmlref .= ': '.$proj->getNomUrl();
160  } else {
161  $morehtmlref .= '';
162  }
163  }
164  }*/
165  $morehtmlref .= '</div>';
166 
167 
168  dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
169 
170  print '<div class="fichecenter">';
171  print '<div class="underbanner clearboth"></div>';
172 
173  $object->info($object->id);
174  dol_print_object_info($object, 1);
175 
176  print '</div>';
177 
179 }
180 
181 
182 // End of page
183 llxFooter();
184 $db->close();
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_object_info($object, $usetable=0)
Show informations on an object TODO Move this into html.formother.
llxHeader()
Empty header.
Definition: wrapper.php:45
Class to manage standard extra fields.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
Class to manage generation of HTML components Only common components must be here.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage establishments.
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
establishment_prepare_head($object)
Return head table for establishment tabs screen.
Definition: hrm.lib.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