linkedobjectblock.tpl.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. /* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@inodbox.com>
  3. * Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
  4. * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  18. */
  19. // Protection to avoid direct call of template
  20. if (empty($conf) || !is_object($conf)) {
  21. print "Error, template page can't be called as URL";
  22. exit;
  23. }
  24. print "<!-- BEGIN PHP TEMPLATE commande/tpl/linkedobjectblock.tpl.php -->\n";
  25. global $user;
  26. global $noMoreLinkedObjectBlockAfter;
  27. $langs = $GLOBALS['langs'];
  28. $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
  29. // Load translation files required by the page
  30. $langs->load("orders");
  31. $linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1);
  32. $total = 0;
  33. $ilink = 0;
  34. foreach ($linkedObjectBlock as $key => $objectlink) {
  35. $ilink++;
  36. $trclass = 'oddeven';
  37. if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) {
  38. $trclass .= ' liste_sub_total';
  39. }
  40. echo '<tr class="'.$trclass.'" >';
  41. echo '<td class="linkedcol-element tdoverflowmax100">'.$langs->trans("CustomerOrder");
  42. if (!empty($showImportButton) && !empty($conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES)) {
  43. print '<a class="objectlinked_importbtn" href="'.$objectlink->getNomUrl(0, '', 0, 1).'&amp;action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > <i class="fa fa-indent"></i> </a';
  44. }
  45. echo '</td>';
  46. echo '<td class="linkedcol-name tdoverflowmax150" >'.$objectlink->getNomUrl(1).'</td>';
  47. echo '<td class="linkedcol-ref">'.$objectlink->ref_client.'</td>';
  48. echo '<td class="linkedcol-date center">'.dol_print_date($objectlink->date, 'day').'</td>';
  49. echo '<td class="linkedcol-amount right">';
  50. if ($user->rights->commande->lire) {
  51. $total = $total + $objectlink->total_ht;
  52. echo price($objectlink->total_ht);
  53. }
  54. echo '</td>';
  55. echo '<td class="linkedcol-statut right">'.$objectlink->getLibStatut(3).'</td>';
  56. echo '<td class="linkedcol-action right">';
  57. // For now, shipments must stay linked to order, so link is not deletable
  58. if ($object->element != 'shipping') {
  59. echo '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&token='.newToken().'&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a>';
  60. }
  61. echo '</td>';
  62. echo "</tr>\n";
  63. }
  64. if (count($linkedObjectBlock) > 1) {
  65. echo '<tr class="liste_total '.(empty($noMoreLinkedObjectBlockAfter) ? 'liste_sub_total' : '').'">';
  66. echo '<td>'.$langs->trans("Total").'</td>';
  67. echo '<td></td>';
  68. echo '<td class="center"></td>';
  69. echo '<td class="center"></td>';
  70. echo '<td class="right">'.price($total).'</td>';
  71. echo '<td class="right"></td>';
  72. echo '<td class="right"></td>';
  73. echo "</tr>\n";
  74. }
  75. echo "<!-- END PHP TEMPLATE -->\n";