2010-04-29 06:20:03 +00:00
|
|
|
<?php
|
2025-08-20 17:04:01 +00:00
|
|
|
/* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@inodbox.com>
|
|
|
|
|
* Copyright (C) 2018 Juanjo Menent <jmenent@2byte.es>
|
|
|
|
|
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
2025-08-17 14:32:09 +00:00
|
|
|
* Copyright (C) 2025 Frédéric France <frederic.france@free.fr>
|
2010-04-29 06:20:03 +00:00
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2013-01-16 14:36:08 +00:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2010-04-29 06:20:03 +00:00
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2019-09-23 19:55:30 +00:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2010-04-29 06:20:03 +00:00
|
|
|
*/
|
2017-12-21 12:32:16 +00:00
|
|
|
|
2026-06-29 05:07:10 +00:00
|
|
|
/**
|
|
|
|
|
* @var Conf $conf
|
|
|
|
|
*/
|
|
|
|
|
|
2017-12-21 12:32:16 +00:00
|
|
|
// Protection to avoid direct call of template
|
2021-02-23 20:24:38 +00:00
|
|
|
if (empty($conf) || !is_object($conf)) {
|
2017-12-21 12:32:16 +00:00
|
|
|
print "Error, template page can't be called as URL";
|
2024-03-16 22:08:15 +00:00
|
|
|
exit(1);
|
2017-12-21 12:32:16 +00:00
|
|
|
}
|
|
|
|
|
|
2010-04-29 06:20:03 +00:00
|
|
|
|
2022-03-01 16:39:38 +00:00
|
|
|
print "<!-- BEGIN PHP TEMPLATE contrat/tpl/linkedobjectblock.tpl.php -->\n";
|
2010-04-29 06:20:03 +00:00
|
|
|
|
2010-12-24 11:28:46 +00:00
|
|
|
|
2016-03-30 17:18:31 +00:00
|
|
|
global $user;
|
2016-11-11 01:18:48 +00:00
|
|
|
global $noMoreLinkedObjectBlockAfter;
|
2016-03-30 17:18:31 +00:00
|
|
|
|
2010-12-24 11:28:46 +00:00
|
|
|
$langs = $GLOBALS['langs'];
|
2024-09-15 23:49:38 +00:00
|
|
|
'@phan-var-force Translate $langs';
|
2025-08-20 17:04:01 +00:00
|
|
|
/**
|
|
|
|
|
* @var CommonObject $object
|
|
|
|
|
* @var Translate $langs
|
|
|
|
|
*/
|
2011-08-22 22:04:21 +00:00
|
|
|
$linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
2025-08-17 14:32:09 +00:00
|
|
|
'@phan-var-force Contrat[] $linkedObjectBlock';
|
|
|
|
|
/** @var Contrat[] $linkedObjectBlock */
|
2010-12-24 11:28:46 +00:00
|
|
|
|
2018-05-26 18:32:23 +00:00
|
|
|
// Load translation files required by the page
|
2010-05-25 22:22:24 +00:00
|
|
|
$langs->load("contracts");
|
2016-03-30 17:18:31 +00:00
|
|
|
|
2024-08-07 00:53:45 +00:00
|
|
|
$total = 0;
|
|
|
|
|
$ilink = 0;
|
2021-02-23 20:24:38 +00:00
|
|
|
foreach ($linkedObjectBlock as $key => $objectlink) {
|
2020-10-31 13:32:18 +00:00
|
|
|
$ilink++;
|
2017-12-21 12:32:16 +00:00
|
|
|
|
2026-04-19 13:59:45 +00:00
|
|
|
$objectlink->fetch_thirdparty();
|
|
|
|
|
|
|
|
|
|
$refWithThirdparty = '<span class="small">';
|
|
|
|
|
$refWithThirdparty .= $objectlink->thirdparty->getNomUrl(1);
|
|
|
|
|
$refWithThirdparty .= '</span>';
|
|
|
|
|
|
2020-10-31 13:32:18 +00:00
|
|
|
$trclass = 'oddeven';
|
2021-02-23 20:24:38 +00:00
|
|
|
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) {
|
|
|
|
|
$trclass .= ' liste_sub_total';
|
2023-12-04 11:01:45 +00:00
|
|
|
} ?>
|
2016-11-11 01:18:48 +00:00
|
|
|
<tr class="<?php echo $trclass; ?>">
|
2021-02-23 20:24:38 +00:00
|
|
|
<td><?php echo $langs->trans("Contract"); ?></td>
|
2021-11-27 00:11:59 +00:00
|
|
|
<td class="nowraponall"><?php echo $objectlink->getNomUrl(1); ?></td>
|
2026-06-29 05:07:10 +00:00
|
|
|
<td class="nopaddingtopimp nopaddingbottomimp tdoverflowmax150"><?php echo $refWithThirdparty; ?></td>
|
2019-03-03 08:37:43 +00:00
|
|
|
<td class="center"><?php echo dol_print_date($objectlink->date_contrat, 'day'); ?></td>
|
2022-03-29 10:01:31 +00:00
|
|
|
<td class="nowraponall right"><?php
|
2019-10-26 16:23:51 +00:00
|
|
|
// Price of contract is not shown by default because a contract is a list of service with
|
2024-01-14 11:26:37 +00:00
|
|
|
// start and end date that change with time and that may be different that the period of reference for price.
|
2019-10-26 16:23:51 +00:00
|
|
|
// So price of a contract does often means nothing. Prices is on the different invoices done on same contract.
|
2023-11-27 10:39:32 +00:00
|
|
|
if ($user->hasRight('contrat', 'lire') && !getDolGlobalString('CONTRACT_SHOW_TOTAL_OF_PRODUCT_AS_PRICE')) {
|
2019-10-26 16:23:51 +00:00
|
|
|
$totalcontrat = 0;
|
|
|
|
|
foreach ($objectlink->lines as $linecontrat) {
|
2024-08-07 00:53:45 +00:00
|
|
|
$totalcontrat += $linecontrat->total_ht;
|
|
|
|
|
$total += $linecontrat->total_ht;
|
2019-10-26 16:23:51 +00:00
|
|
|
}
|
|
|
|
|
echo price($totalcontrat);
|
|
|
|
|
} ?></td>
|
2019-02-19 16:02:07 +00:00
|
|
|
<td class="right"><?php echo $objectlink->getLibStatut(7); ?></td>
|
2021-09-19 12:41:46 +00:00
|
|
|
<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>
|
2010-04-29 06:20:03 +00:00
|
|
|
</tr>
|
2019-10-26 16:23:51 +00:00
|
|
|
<?php
|
|
|
|
|
}
|
2010-04-29 06:20:03 +00:00
|
|
|
|
2019-10-26 16:23:51 +00:00
|
|
|
print "<!-- END PHP TEMPLATE -->\n";
|