dolibarr 24.0.0-beta
linkedobjectblock.tpl.php
1<?php
2/* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@inodbox.com>
3 * Copyright (C) 2018 Juanjo Menent <jmenent@2byte.es>
4 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
5 * Copyright (C) 2025 Frédéric France <frederic.france@free.fr>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
25// Protection to avoid direct call of template
26if (empty($conf) || !is_object($conf)) {
27 print "Error, template page can't be called as URL";
28 exit(1);
29}
30
31
32print "<!-- BEGIN PHP TEMPLATE contrat/tpl/linkedobjectblock.tpl.php -->\n";
33
34
35global $user;
36global $noMoreLinkedObjectBlockAfter;
37
38$langs = $GLOBALS['langs'];
39'@phan-var-force Translate $langs';
44$linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
45'@phan-var-force Contrat[] $linkedObjectBlock';
48// Load translation files required by the page
49$langs->load("contracts");
50
51$total = 0;
52$ilink = 0;
53foreach ($linkedObjectBlock as $key => $objectlink) {
54 $ilink++;
55
56 $objectlink->fetch_thirdparty();
57
58 $refWithThirdparty = '<span class="small">';
59 $refWithThirdparty .= $objectlink->thirdparty->getNomUrl(1);
60 $refWithThirdparty .= '</span>';
61
62 $trclass = 'oddeven';
63 if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) {
64 $trclass .= ' liste_sub_total';
65 } ?>
66<tr class="<?php echo $trclass; ?>">
67 <td><?php echo $langs->trans("Contract"); ?></td>
68 <td class="nowraponall"><?php echo $objectlink->getNomUrl(1); ?></td>
69 <td class="nopaddingtopimp nopaddingbottomimp tdoverflowmax150"><?php echo $refWithThirdparty; ?></td>
70 <td class="center"><?php echo dol_print_date($objectlink->date_contrat, 'day'); ?></td>
71 <td class="nowraponall right"><?php
72 // Price of contract is not shown by default because a contract is a list of service with
73 // start and end date that change with time and that may be different that the period of reference for price.
74 // So price of a contract does often means nothing. Prices is on the different invoices done on same contract.
75 if ($user->hasRight('contrat', 'lire') && !getDolGlobalString('CONTRACT_SHOW_TOTAL_OF_PRODUCT_AS_PRICE')) {
76 $totalcontrat = 0;
77 foreach ($objectlink->lines as $linecontrat) {
78 $totalcontrat += $linecontrat->total_ht;
79 $total += $linecontrat->total_ht;
80 }
81 echo price($totalcontrat);
82 } ?></td>
83 <td class="right"><?php echo $objectlink->getLibStatut(7); ?></td>
84 <td class="right"><a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&token='.newToken().'&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
85</tr>
86 <?php
87}
88
89print "<!-- END PHP TEMPLATE -->\n";
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.