linkedobjectblock.tpl.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@inodbox.com>
  3. * Copyright (C) 2018 Juanjo Menent <jmenent@2byte.es>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. */
  18. // Protection to avoid direct call of template
  19. if (empty($conf) || !is_object($conf)) {
  20. print "Error, template page can't be called as URL";
  21. exit;
  22. }
  23. print "<!-- BEGIN PHP TEMPLATE contrat/tpl/linkedobjectblock.tpl.php -->\n";
  24. global $user;
  25. global $noMoreLinkedObjectBlockAfter;
  26. $langs = $GLOBALS['langs'];
  27. $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
  28. // Load translation files required by the page
  29. $langs->load("contracts");
  30. $total = 0; $ilink = 0;
  31. foreach ($linkedObjectBlock as $key => $objectlink) {
  32. $ilink++;
  33. $trclass = 'oddeven';
  34. if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) {
  35. $trclass .= ' liste_sub_total';
  36. }
  37. ?>
  38. <tr class="<?php echo $trclass; ?>">
  39. <td><?php echo $langs->trans("Contract"); ?></td>
  40. <td class="nowraponall"><?php echo $objectlink->getNomUrl(1); ?></td>
  41. <td></td>
  42. <td class="center"><?php echo dol_print_date($objectlink->date_contrat, 'day'); ?></td>
  43. <td class="nowraponall right"><?php
  44. // Price of contract is not shown by default because a contract is a list of service with
  45. // start and end date that change with time andd that may be different that the period of reference for price.
  46. // So price of a contract does often means nothing. Prices is on the different invoices done on same contract.
  47. if ($user->rights->contrat->lire && empty($conf->global->CONTRACT_SHOW_TOTAL_OF_PRODUCT_AS_PRICE)) {
  48. $totalcontrat = 0;
  49. foreach ($objectlink->lines as $linecontrat) {
  50. $totalcontrat = $totalcontrat + $linecontrat->total_ht;
  51. $total = $total + $linecontrat->total_ht;
  52. }
  53. echo price($totalcontrat);
  54. } ?></td>
  55. <td class="right"><?php echo $objectlink->getLibStatut(7); ?></td>
  56. <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>
  57. </tr>
  58. <?php
  59. }
  60. print "<!-- END PHP TEMPLATE -->\n";