linkedobjectblock.tpl.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. /* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
  3. * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
  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 expedition/tpl/linkedobjectblock.tpl.php -->\n";
  24. global $user;
  25. $langs = $GLOBALS['langs'];
  26. $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
  27. // Load translation files required by the page
  28. $langs->load("sendings");
  29. $total = 0;
  30. $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("Shipment"); ?></td>
  40. <td><?php echo $objectlink->getNomUrl(1); ?></td>
  41. <td></td>
  42. <td class="center"><?php echo dol_print_date($objectlink->date_delivery, 'day'); ?></td>
  43. <td class="right"><?php
  44. if ($user->rights->expedition->lire) {
  45. $total = $total + $objectlink->total_ht;
  46. echo price($objectlink->total_ht);
  47. } ?></td>
  48. <td class="right"><?php echo $objectlink->getLibStatut(3); ?></td>
  49. <td class="right">
  50. <?php
  51. // For now, shipments must stay linked to order, so link is not deletable
  52. if ($object->element != 'commande') {
  53. ?>
  54. <a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&token='.newToken().'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td> <?php
  55. }
  56. ?>
  57. </tr>
  58. <?php
  59. }
  60. if (count($linkedObjectBlock) > 1) {
  61. ?>
  62. <tr class="liste_total <?php echo (empty($noMoreLinkedObjectBlockAfter) ? 'liste_sub_total' : ''); ?>">
  63. <td><?php echo $langs->trans("Total"); ?></td>
  64. <td></td>
  65. <td class="center"></td>
  66. <td class="center"></td>
  67. <td class="right"><?php echo price($total); ?></td>
  68. <td class="right"></td>
  69. <td class="right"></td>
  70. </tr>
  71. <?php
  72. }
  73. print "<!-- END PHP TEMPLATE -->\n";