-
Notifications
You must be signed in to change notification settings - Fork 0
/
card_tab_financial.php
executable file
·146 lines (113 loc) · 5.72 KB
/
card_tab_financial.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?php
/**
* \file flightlog/bbcvols_card.php
* \ingroup flightlog
* \brief This file is an example of a php page
* Initialy built by build_class_from_table on 2017-02-09 11:10
*/
// Change this following line to use the correct relative path (../, ../../, etc)
$res = 0;
if (!$res && file_exists("../main.inc.php")) {
$res = @include '../main.inc.php';
} // to work if your module directory is into dolibarr root htdocs directory
if (!$res && file_exists("../../main.inc.php")) {
$res = @include '../../main.inc.php';
} // to work if your module directory is into a subdir of root htdocs directory
if (!$res && file_exists("../../../dolibarr/htdocs/main.inc.php")) {
$res = @include '../../../dolibarr/htdocs/main.inc.php';
} // Used on dev env only
if (!$res && file_exists("../../../../dolibarr/htdocs/main.inc.php")) {
$res = @include '../../../../dolibarr/htdocs/main.inc.php';
} // Used on dev env only
if (!$res) {
die("Include of main fails");
}
// Change this following line to use the correct relative path from htdocs
include_once(DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php');
dol_include_once('/flightlog/class/bbcvols.class.php');
dol_include_once('/flightlog/class/bbctypes.class.php');
dol_include_once('/flightlog/lib/flightLog.lib.php');
dol_include_once('/flightlog/lib/card.lib.php');
dol_include_once('/flightlog/lib/PilotService.php');
dol_include_once('/flightballoon/bbc_ballons.class.php');
dol_include_once('/user/class/usergroup.class.php');
global $langs, $user;
// Load traductions files requiredby by page
$langs->load("mymodule@flightlog");
$langs->load("other");
$id = GETPOST('id', 'int') ?: GETPOST('idBBC_vols', 'int');
$action = GETPOST('action', 'alpha');
$permissiondellink=$user->rights->flightlog->vol->financial;
$object = new Bbcvols($db);
$extrafields = new ExtraFields($db);
$receiver = new User($db);
$pilotService = new PilotService($db);
$pilot = new User($db);
$organisator = new User($db);
$flightType = new Bbctypes($db);
$balloon = new Bbc_ballons($db);
// fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
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
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php';
// Initialize technical object to manage hooks of modules. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('bbcvols'));
$object->ref = $object->idBBC_vols;
if (!($user->rights->flightlog->vol->financial || $user->id == $object->fk_pilot)) {
accessforbidden($langs->trans("Tu n'as pas accès au vol"));
}
$receiver->fetch($object->fk_receiver);
$pilot->fetch($object->fk_pilot);
$organisator->fetch($object->fk_organisateur);
$flightType->fetch($object->fk_type);
$balloon->fetch($object->BBC_ballons_idBBC_ballons);
if ($action === 'open' && $user->rights->flightlog->vol->financial) {
$object->open();
$object->update($user);
}
llxHeader('', $langs->trans('financial of flight'), '');
$head = prepareFlightTabs($object);
dol_fiche_head($head, 'financial', $langs->trans("Vol"));
$linkback = '<a href="' . DOL_URL_ROOT . '/flightlog/list.php">' . $langs->trans("BackToList") . '</a>';
print $form->showrefnav($object, "idBBC_vols", $linkback, true, "idBBC_vols");
print '<table class="border centpercent">' . "\n";
print '<tr><td class="fieldrequired">' . $langs->trans("FieldidBBC_vols") . '</td><td>' . $object->idBBC_vols . '</td></tr>';
print '<tr><td class="fieldrequired">' . $langs->trans("Fielddate") . '</td><td>' . dol_print_date($object->date) . '</td></tr>';
if ($user->rights->flightlog->vol->financial) {
print '<tr><td class="fieldrequired">' . $langs->trans("Fieldis_facture") . '</td><td>' . $object->getLibStatut(5). '</td></tr>';
}
print '<tr><td class="fieldrequired">' . $langs->trans("Fieldkilometers") . '</td><td>' . $object->kilometers . ' KM</td></tr>';
print '<tr><td class="fieldrequired">' . $langs->trans("Fieldjustif_kilometers") . '</td><td>' . $object->justif_kilometers . '</td></tr>';
if($object->hasReceiver()){
print '<tr><td class="fieldrequired">' . $langs->trans("Fieldcost") . '</td><td>' . $object->cost . " " . $langs->getCurrencySymbol($conf->currency) . '</td></tr>';
print '<tr><td class="fieldrequired">' . $langs->trans("Fieldfk_receiver") . '</td><td>' . $receiver->getNomUrl(1) . '</td></tr>';
}
if($object->isLinkedToOrder()){
print '<tr><td class="fieldrequired">' . $langs->trans("Order") . '</td><td><ul>';
foreach($object->getOrders() as $currentOrder){
print '<li>'.$currentOrder->getNomUrl(1).'</li>';
}
print '</ul></td></tr>';
}
print '</table>';
dol_fiche_end();
// Buttons
print '<div class="tabsAction">' . "\n";
// Make invoice
if($user->rights->flightlog->vol->financial && $object->fk_type == 2 && !$object->hasFacture()){
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/flightlog/facture.php?id=' . $object->id.'">' . $langs->trans("Facturer") . '</a></div>' . "\n";
}
// Open
if($object->isBilled() && $object->isBillingRequired()){
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/flightlog/card_tab_financial.php?action=open&id=' . $object->id.'">' . $langs->trans("Ouvrir") . '</a></div>' . "\n";
}
print '</div>' . "\n";
if($user->rights->flightlog->vol->financial){
print '<div class="fichecenter"><div class="fichehalfleft">';
$form->showLinkedObjectBlock($object);
print '</div></div>';
}
// End of page
llxFooter();
$db->close();