1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
use FlightLog\Application\Damage\ViewModel\Damage; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* @var Damage $damage |
7
|
|
|
* @var Bbcvols $flight |
8
|
|
|
*/ |
9
|
|
|
global $damage, $langs, $form, $flight; |
10
|
|
|
|
11
|
|
|
function prepareTabsDamage(Damage $damage) |
12
|
|
|
{ |
13
|
|
|
global $langs, $conf; |
14
|
|
|
|
15
|
|
|
dol_include_once('/flightlog/flightlog.inc.php'); |
16
|
|
|
|
17
|
|
|
$tabUrls = [ |
18
|
|
|
DOL_URL_ROOT . '/flightlog/index.php?r=get_one_damage&id=' . $damage->getId(), |
19
|
|
|
]; |
20
|
|
|
|
21
|
|
|
$tabNames = [ |
22
|
|
|
'general', |
23
|
|
|
]; |
24
|
|
|
|
25
|
|
|
$tabTitle = [ |
26
|
|
|
'Degat', |
27
|
|
|
]; |
28
|
|
|
|
29
|
|
|
$tabCollection = new TabCollection(); |
30
|
|
|
|
31
|
|
|
$countUrls = count($tabUrls); |
32
|
|
View Code Duplication |
for ($i = 0; $i < $countUrls; $i++) { |
|
|
|
|
33
|
|
|
if (empty($tabUrls[$i])) { |
34
|
|
|
continue; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
$tabCollection = $tabCollection->addTab(new Tab($tabTitle[$i], $tabNames[$i], $tabUrls[$i])); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
$head = $tabCollection->toArray(); |
41
|
|
|
$tabCount = count($tabCollection); |
42
|
|
|
|
43
|
|
|
complete_head_from_modules($conf, $langs, $damage, $head, $tabCount, 'bbcDamage'); |
44
|
|
|
|
45
|
|
|
return $head; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
$head = prepareTabsDamage($damage); |
49
|
|
|
dol_fiche_head([], 'general', $langs->trans("Dégats")); |
50
|
|
|
|
51
|
|
|
$linkback = '<a href="' . DOL_URL_ROOT . '/flightlog/index.php?r=get_list_damages">' . $langs->trans("BackToList") . '</a>'; |
52
|
|
|
//print $form->showrefnav($object, "idBBC_vols", $linkback, true, "idBBC_vols"); |
53
|
|
|
?> |
54
|
|
|
|
55
|
|
|
<table class="border centpercent"> |
56
|
|
|
<tr><td class="fieldrequired">Auteur</td><td><?php echo $damage->getAuthorName();?></td></tr> |
57
|
|
|
<tr><td class="fieldrequired">Montant</td><td><?php echo $damage->getAmount();?>€</td></tr> |
58
|
|
|
<tr><td class="fieldrequired">Facturé</td><td><?php echo $damage->isInvoiced()? 'Oui' : 'Non';?></td></tr> |
59
|
|
|
<tr> |
60
|
|
|
<td class="fieldrequired">Vol</td> |
61
|
|
|
<td> |
62
|
|
|
<?php print $flight->getNomUrl(); ?> |
63
|
|
|
</td> |
64
|
|
|
</tr> |
65
|
|
|
</table> |
66
|
|
|
|
67
|
|
|
<div class="fichecenter"> |
68
|
|
|
<div class="fichehalfleft"> |
69
|
|
|
<?php $form->showLinkedObjectBlock($damage); ?> |
70
|
|
|
</div> |
71
|
|
|
</div> |
72
|
|
|
|
73
|
|
|
<?php |
74
|
|
|
dol_fiche_end(); |
75
|
|
|
?> |
76
|
|
|
|
77
|
|
|
|
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.