dolibarr  21.0.0-alpha
stocktransfer.php
1 <?php
2 /* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
4  * Copyright (C) 2021 SuperAdmin
5  * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
6  * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20  */
21 
28 // Load Dolibarr environment
29 require '../main.inc.php';
30 
31 global $langs, $user;
32 
33 // Libraries
34 require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
35 require_once DOL_DOCUMENT_ROOT.'/product/stock/stocktransfer/class/stocktransfer.class.php';
36 require_once DOL_DOCUMENT_ROOT.'/product/stock/stocktransfer/lib/stocktransfer.lib.php';
37 
38 // Translations
39 $langs->loadLangs(array("admin", "stocks"));
40 
41 // Access control
42 if (!$user->admin) {
44 }
45 
46 // Parameters
47 $action = GETPOST('action', 'alpha');
48 $backtopage = GETPOST('backtopage', 'alpha');
49 
50 $value = GETPOST('value', 'alpha');
51 $label = GETPOST('label', 'alpha');
52 $scandir = GETPOST('scan_dir', 'alpha');
53 
54 $arrayofparameters = array(
55  'STOCKTRANSFER_MYPARAM1' => array('css' => 'minwidth200', 'enabled' => 1),
56  'STOCKTRANSFER_MYPARAM2' => array('css' => 'minwidth500', 'enabled' => 1)
57 );
58 
59 $error = 0;
60 $setupnotempty = 0;
61 
62 
63 /*
64  * Actions
65  */
66 
67 include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
68 
69 
70 if ($action == 'updateMask') {
71  $maskconststocktransfer = GETPOST('maskconststocktransfer', 'aZ09');
72  $maskstocktransfer = GETPOST('maskStockTransfer', 'alpha');
73 
74  if ($maskconststocktransfer && preg_match('/_MASK$/', $maskconststocktransfer)) {
75  $res = dolibarr_set_const($db, $maskconststocktransfer, $maskstocktransfer, 'chaine', 0, '', $conf->entity);
76  if ($res <= 0) {
77  $error++;
78  }
79  }
80 
81  if (!$error) {
82  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
83  } else {
84  setEventMessages($langs->trans("Error"), null, 'errors');
85  }
86 } elseif ($action == 'specimen') {
87  $modele = GETPOST('module', 'alpha');
88  $tmpobjectkey = 'StockTransfer';
89 
90  $tmpobject = new $tmpobjectkey($db);
91  $tmpobject->initAsSpecimen();
92 
93  // Search template files
94  $file = '';
95  $classname = '';
96  $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
97  foreach ($dirmodels as $reldir) {
98  $file = dol_buildpath($reldir."core/modules/stocktransfer/doc/pdf_".$modele.".modules.php", 0);
99  if (file_exists($file)) {
100  $classname = "pdf_".$modele;
101  break;
102  }
103  }
104 
105  if ($classname !== '') {
106  require_once $file;
107 
108  $module = new $classname($db);
109  '@phan-var-force CommonDocGenerator $module';
110 
111  if ($module->write_file($tmpobject, $langs) > 0) {
112  header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
113  return;
114  } else {
115  setEventMessages($module->error, null, 'errors');
116  dol_syslog($module->error, LOG_ERR);
117  }
118  } else {
119  setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
120  dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
121  }
122 } elseif ($action == 'set') { // Activate a model
123  $ret = addDocumentModel($value, 'stocktransfer', $label, $scandir);
124 } elseif ($action == 'del') {
125  $tmpobjectkey = 'StockTransfer';
126 
127  $ret = delDocumentModel($value, 'stocktransfer');
128  if ($ret > 0) {
129  $constforval = strtoupper($tmpobjectkey).'_ADDON_PDF';
130  if (getDolGlobalString($constforval) == "$value") {
131  dolibarr_del_const($db, $constforval, $conf->entity);
132  }
133  }
134 } elseif ($action == 'setdoc') { // Set default model
135  $tmpobjectkey = 'StockTransfer';
136  $constforval = strtoupper($tmpobjectkey).'_ADDON_PDF';
137  if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) {
138  // The constant that was read before the new set
139  // We therefore requires a variable to have a coherent view
140  $conf->global->$constforval = $value;
141  }
142 
143  // On active le modele
144  $ret = delDocumentModel($value, 'stocktransfer');
145  if ($ret > 0) {
146  $ret = addDocumentModel($value, 'stocktransfer', $label, $scandir);
147  }
148 } elseif ($action == 'setmod') {
149  // TODO Check if numbering module chosen can be activated
150  // by calling method canBeActivated
151  $tmpobjectkey = 'StockTransfer';
152  $constforval = 'STOCKTRANSFER_'.strtoupper($tmpobjectkey)."_ADDON";
153  dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
154 }
155 
156 
157 
158 /*
159  * View
160  */
161 
162 $form = new Form($db);
163 
164 $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
165 
166 $page_name = "StockTransferSetup";
167 llxHeader('', $langs->trans($page_name), '', '', 0, 0, '', '', '', 'mod-admin page-stocktransfer');
168 
169 // Subheader
170 $linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
171 
172 print load_fiche_titre($langs->trans($page_name), $linkback, 'stock');
173 
174 // Configuration header
176 print dol_get_fiche_head($head, 'settings', '', -1, "stocktransfer@stocktransfer");
177 
178 // Setup page goes here
179 print '<span class="opacitymedium">'.$langs->trans("StockTransferSetupPage").'</span>';
180 
181 
182 /*if ($action == 'edit')
183 {
184  print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
185  print '<input type="hidden" name="token" value="'.newToken().'">';
186  print '<input type="hidden" name="action" value="update">';
187 
188  print '<table class="noborder centpercent">';
189  print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
190 
191  foreach ($arrayofparameters as $key => $val)
192  {
193  print '<tr class="oddeven"><td>';
194  $tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : '');
195  print $form->textwithpicto($langs->trans($key), $tooltiphelp);
196  print '</td><td><input name="'.$key.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.getDolGlobalString($key).'"></td></tr>';
197  }
198  print '</table>';
199 
200  print '<br><div class="center">';
201  print '<input class="button" type="submit" value="'.$langs->trans("Save").'">';
202  print '</div>';
203 
204  print '</form>';
205  print '<br>';
206 } else {
207  if (!empty($arrayofparameters))
208  {
209  print '<table class="noborder centpercent">';
210  print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
211 
212  foreach ($arrayofparameters as $key => $val)
213  {
214  $setupnotempty++;
215 
216  print '<tr class="oddeven"><td>';
217  $tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : '');
218  print $form->textwithpicto($langs->trans($key), $tooltiphelp);
219  print '</td><td>'.getDolGlobalString($key).'</td></tr>';
220  }
221 
222  print '</table>';
223 
224  print '<div class="tabsAction">';
225  print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
226  print '</div>';
227  }
228  else
229  {
230  print '<br>'.$langs->trans("NothingToSetup");
231  }
232 }*/
233 
234 
235 $moduledir = 'stocktransfer';
236 $myTmpObjects = array();
237 $myTmpObjects[$moduledir] = array('includerefgeneration' => 1, 'includedocgeneration' => 1, 'class' => 'StockTransfer');
238 
239 foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
240  if ($myTmpObjectKey == 'MyObject') {
241  continue;
242  }
243  if ($myTmpObjectArray['includerefgeneration']) {
244  /*
245  * Orders Numbering model
246  */
247  $setupnotempty++;
248 
249  print load_fiche_titre($langs->trans("NumberingModules", $myTmpObjectKey), '', '');
250 
251  print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
252  print '<table class="noborder centpercent">';
253  print '<tr class="liste_titre">';
254  print '<td>'.$langs->trans("Name").'</td>';
255  print '<td>'.$langs->trans("Description").'</td>';
256  print '<td class="nowrap">'.$langs->trans("Example").'</td>';
257  print '<td class="center" width="60">'.$langs->trans("Status").'</td>';
258  print '<td class="center" width="16">'.$langs->trans("ShortInfo").'</td>';
259  print '</tr>'."\n";
260 
261  clearstatcache();
262 
263  foreach ($dirmodels as $reldir) {
264  $dir = dol_buildpath($reldir."core/modules/".$moduledir);
265 
266  if (is_dir($dir)) {
267  $handle = opendir($dir);
268  if (is_resource($handle)) {
269  while (($file = readdir($handle)) !== false) {
270  if (strpos($file, 'mod_'.strtolower($myTmpObjectKey).'_') === 0 && substr($file, dol_strlen($file) - 3, 3) == 'php') {
271  $file = substr($file, 0, dol_strlen($file) - 4);
272 
273  require_once $dir.'/'.$file.'.php';
274 
275  $module = new $file($db);
276 
277  // Show modules according to features level
278  if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
279  continue;
280  }
281  if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
282  continue;
283  }
284 
285  if ($module->isEnabled()) {
286  dol_include_once('/'.$moduledir.'/class/'.strtolower($myTmpObjectKey).'.class.php');
287 
288  print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
289  print $module->info($langs);
290  print '</td>';
291 
292  // Show example of numbering model
293  print '<td class="nowrap">';
294  $tmp = $module->getExample();
295  if (preg_match('/^Error/', $tmp)) {
296  print '<div class="error">'.$langs->trans($tmp).'</div>';
297  } elseif ($tmp == 'NotConfigured') {
298  print $langs->trans($tmp);
299  } else {
300  print $tmp;
301  }
302  print '</td>'."\n";
303 
304  print '<td class="center">';
305  $constforvar = 'STOCKTRANSFER_'.strtoupper($myTmpObjectKey).'_ADDON';
306  if (getDolGlobalString($constforvar) == $file) {
307  print img_picto($langs->trans("Activated"), 'switch_on');
308  } else {
309  print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&object='.strtolower($myTmpObjectKey).'&value='.$file.'">';
310  print img_picto($langs->trans("Disabled"), 'switch_off');
311  print '</a>';
312  }
313  print '</td>';
314 
315  $nameofclass = $myTmpObjectArray['class'];
316  $mytmpinstance = new $nameofclass($db);
317  $mytmpinstance->initAsSpecimen();
318 
319  // Info
320  $htmltooltip = '';
321  $htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
322 
323  $nextval = $module->getNextValue($mytmpinstance);
324  if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
325  $htmltooltip .= ''.$langs->trans("NextValue").': ';
326  if ($nextval) {
327  if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
328  $nextval = $langs->trans($nextval);
329  }
330  $htmltooltip .= $nextval.'<br>';
331  } else {
332  $htmltooltip .= $langs->trans($module->error).'<br>';
333  }
334  }
335 
336  print '<td class="center">';
337  print $form->textwithpicto('', $htmltooltip, 1, 0);
338  print '</td>';
339 
340  print "</tr>\n";
341  }
342  }
343  }
344  closedir($handle);
345  }
346  }
347  }
348  print "</table></div><br>\n";
349  }
350 
351  if ($myTmpObjectArray['includedocgeneration']) {
352  /*
353  * Document templates generators
354  */
355  $setupnotempty++;
356  $type = strtolower($myTmpObjectKey);
357 
358  print load_fiche_titre($langs->trans("DocumentModules", $myTmpObjectKey), '', '');
359 
360  // Load array def with activated templates
361  $def = array();
362  $sql = "SELECT nom";
363  $sql .= " FROM ".MAIN_DB_PREFIX."document_model";
364  $sql .= " WHERE type = '".$db->escape($type)."'";
365  $sql .= " AND entity = ".$conf->entity;
366  $resql = $db->query($sql);
367  if ($resql) {
368  $i = 0;
369  $num_rows = $db->num_rows($resql);
370  while ($i < $num_rows) {
371  $array = $db->fetch_array($resql);
372  if (is_array($array)) {
373  array_push($def, $array[0]);
374  }
375  $i++;
376  }
377  } else {
378  dol_print_error($db);
379  }
380 
381  print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
382  print '<table class="noborder centpercent">'."\n";
383  print '<tr class="liste_titre">'."\n";
384  print '<td>'.$langs->trans("Name").'</td>';
385  print '<td>'.$langs->trans("Description").'</td>';
386  print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
387  print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n";
388  print '<td class="center" width="38">'.$langs->trans("ShortInfo").'</td>';
389  print '<td class="center" width="38">'.$langs->trans("Preview").'</td>';
390  print "</tr>\n";
391 
392  clearstatcache();
393 
394  foreach ($dirmodels as $reldir) {
395  foreach (array('', '/doc') as $valdir) {
396  $realpath = $reldir."core/modules/".$moduledir.$valdir;
397  $dir = dol_buildpath($realpath);
398 
399  if (is_dir($dir)) {
400  $handle = opendir($dir);
401  if (is_resource($handle)) {
402  $filelist = array();
403  while (($file = readdir($handle)) !== false) {
404  $filelist[] = $file;
405  }
406  closedir($handle);
407  arsort($filelist);
408 
409  foreach ($filelist as $file) {
410  if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
411  if (file_exists($dir.'/'.$file)) {
412  $name = substr($file, 4, dol_strlen($file) - 16);
413  $classname = substr($file, 0, dol_strlen($file) - 12);
414 
415  require_once $dir.'/'.$file;
416  $module = new $classname($db);
417 
418  $modulequalified = 1;
419  if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
420  $modulequalified = 0;
421  }
422  if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
423  $modulequalified = 0;
424  }
425 
426  if ($modulequalified) {
427  print '<tr class="oddeven"><td>';
428  print(empty($module->name) ? $name : $module->name);
429  print "</td><td>\n";
430  if (method_exists($module, 'info')) {
431  print $module->info($langs);
432  } else {
433  print $module->description;
434  }
435  print '</td>';
436 
437  // Active
438  if (in_array($name, $def)) {
439  print '<td class="center">'."\n";
440  print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.urlencode($name).'&token='.newToken().'">';
441  print img_picto($langs->trans("Enabled"), 'switch_on');
442  print '</a>';
443  print '</td>';
444  } else {
445  print '<td class="center">'."\n";
446  print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
447  print "</td>";
448  }
449 
450  // Default
451  print '<td class="center">';
452  $constforvar = strtoupper($myTmpObjectKey).'_ADDON_PDF';
453  if (getDolGlobalString($constforvar) == $name) {
454  print img_picto($langs->trans("Default"), 'on');
455  } else {
456  print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&object='.urlencode($myTmpObjectKey).'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
457  }
458  print '</td>';
459 
460  // Info
461  $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
462  $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
463  if ($module->type == 'pdf') {
464  $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
465  }
466  $htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
467 
468  $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
469  $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
470  $htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
471 
472  print '<td class="center">';
473  print $form->textwithpicto('', $htmltooltip, 1, 0);
474  print '</td>';
475 
476  // Preview
477  print '<td class="center">';
478  if ($module->type == 'pdf') {
479  print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&object='.$myTmpObjectKey.'">'.img_object($langs->trans("Preview"), 'generic').'</a>';
480  } else {
481  print img_object($langs->trans("PreviewNotAvailable"), 'generic');
482  }
483  print '</td>';
484 
485  print "</tr>\n";
486  }
487  }
488  }
489  }
490  }
491  }
492  }
493  }
494 
495  print '</table></div>';
496  }
497 }
498 
499 if (empty($setupnotempty)) {
500  print '<br>'.$langs->trans("NothingToSetup");
501 }
502 
503 // Page end
504 print dol_get_fiche_end();
505 
506 llxFooter();
507 $db->close();
addDocumentModel($name, $type, $label='', $description='')
Add document model used by doc generator.
Definition: admin.lib.php:1940
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
Definition: admin.lib.php:656
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
Definition: admin.lib.php:580
delDocumentModel($name, $type)
Delete document model used by doc generator.
Definition: admin.lib.php:1971
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.
if(isModEnabled('invoice') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&!getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) if(isModEnabled('invoice') &&isModEnabled('order') && $user->hasRight("commande", "lire") &&!getDolGlobalString('WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER')) $sql
Social contributions to pay.
Definition: index.php:751
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
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.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
stocktransferAdminPrepareHead()
Prepare admin pages header.