Completed
Push — master ( 7bb44a...72105c )
by Laurent
02:19
created

card_tab_follow.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/**
4
 *    \file       flightLog/bbcvols_card.php
5
 *        \ingroup    flightLog
6
 *        \brief      This file is an example of a php page
7
 *                    Initialy built by build_class_from_table on 2017-02-09 11:10
8
 */
9
10
// Change this following line to use the correct relative path (../, ../../, etc)
11
$res = 0;
12
if (!$res && file_exists("../main.inc.php")) {
13
    $res = @include '../main.inc.php';
14
}                    // to work if your module directory is into dolibarr root htdocs directory
15
if (!$res && file_exists("../../main.inc.php")) {
16
    $res = @include '../../main.inc.php';
17
}            // to work if your module directory is into a subdir of root htdocs directory
18
if (!$res && file_exists("../../../dolibarr/htdocs/main.inc.php")) {
19
    $res = @include '../../../dolibarr/htdocs/main.inc.php';
20
}     // Used on dev env only
21
if (!$res && file_exists("../../../../dolibarr/htdocs/main.inc.php")) {
22
    $res = @include '../../../../dolibarr/htdocs/main.inc.php';
23
}   // Used on dev env only
24
if (!$res) {
25
    die("Include of main fails");
26
}
27
// Change this following line to use the correct relative path from htdocs
28
include_once(DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php');
29
dol_include_once('/flightLog/class/bbcvols.class.php');
30
dol_include_once('/flightLog/class/bbctypes.class.php');
31
dol_include_once('/flightLog/lib/flightLog.lib.php');
32
dol_include_once('/flightLog/lib/card.lib.php');
33
dol_include_once('/flightLog/lib/PilotService.php');
34
dol_include_once('/flightBalloon/bbc_ballons.class.php');
35
dol_include_once('/user/class/usergroup.class.php');
36
37
global $langs, $user;
38
39
// Load traductions files requiredby by page
40
$langs->load("mymodule@flightLog");
41
$langs->load("other");
42
43
$id = GETPOST('id', 'int') ?: GETPOST('idBBC_vols', 'int');
44
45
$object = new Bbcvols($db);
46
$extrafields = new ExtraFields($db);
47
48
$receiver = new User($db);
49
50
$pilotService = new PilotService($db);
51
$pilot = new User($db);
52
53
$organisator = new User($db);
54
55
$flightType = new Bbctypes($db);
56
$balloon = new Bbc_ballons($db);
57
58
// fetch optionals attributes and labels
59
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
60
61
// Load object
62
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
63
64
// Initialize technical object to manage hooks of modules. Note that conf->hooks_modules contains array array
65
$hookmanager->initHooks(array('bbcvols'));
66
$object->ref = $object->idBBC_vols;
67
68 View Code Duplication
if (!($user->rights->flightLog->vol->financial || $user->id != $object->fk_pilot)) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
69
    accessforbidden($langs->trans("Tu n'as pas accès au vol"));
70
}
71
72
$receiver->fetch($object->fk_receiver);
73
$pilot->fetch($object->fk_pilot);
74
$organisator->fetch($object->fk_organisateur);
75
$flightType->fetch($object->fk_type);
76
$balloon->fetch($object->BBC_ballons_idBBC_ballons);
77
78
llxHeader('', $langs->trans('financial of flight'), '');
79
80
$head = prepareFlightTabs($object);
81
dol_fiche_head($head, 'follow', $langs->trans("Vol"));
82
83
$linkback = '<a href="' . DOL_URL_ROOT . '/flightLog/list.php">' . $langs->trans("BackToList") . '</a>';
84
print $form->showrefnav($object, "idBBC_vols", $linkback, true, "idBBC_vols");
85
86
print '<table class="border centpercent">' . "\n";
87
88
print '<tr><td class="fieldrequired">' . $langs->trans("FieldidBBC_vols") . '</td><td>' . $object->idBBC_vols . '</td></tr>';
89
print '<tr><td class="fieldrequired">' . $langs->trans("FieldDateCreation") . '</td><td>' . dol_print_date($object->date_creation) . '</td></tr>';
90
print '<tr><td class="fieldrequired">' . $langs->trans("FieldDateUpdate") . '</td><td>' . dol_print_date($object->date_update) . '</td></tr>';
91
92
print '</table>';
93
94
dol_fiche_end();
95
96
// Buttons
97
print '<div class="tabsAction">' . "\n";
98
print '</div>' . "\n";
99
100
101
// End of page
102
llxFooter();
103
$db->close();