linkedobjectblock.tpl.php 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. /**
  20. * \file htdocs/comm/propal/tpl/linkedobjectblock.tpl.php
  21. * \ingroup propal
  22. * \brief Template to show objects linked to proposals
  23. */
  24. // Protection to avoid direct call of template
  25. if (empty($conf) || !is_object($conf)) {
  26. print "Error, template page can't be called as URL";
  27. exit;
  28. }
  29. print "<!-- BEGIN PHP TEMPLATE comm/propal/tpl/linkedobjectblock.tpl.php -->\n";
  30. global $user;
  31. $langs = $GLOBALS['langs'];
  32. $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
  33. // Load translation files required by the page
  34. $langs->load("propal");
  35. $linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1);
  36. $total = 0;
  37. $ilink = 0;
  38. foreach ($linkedObjectBlock as $key => $objectlink) {
  39. $ilink++;
  40. $trclass = 'oddeven';
  41. if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) {
  42. $trclass .= ' liste_sub_total';
  43. }
  44. print '<tr class="'.$trclass.'" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" >';
  45. print '<td class="linkedcol-element tdoverflowmax100">'.$langs->trans("Proposal");
  46. if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) {
  47. $url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$objectlink->id;
  48. print '<a class="objectlinked_importbtn" href="'.$url.'&amp;action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > <i class="fa fa-indent"></i> </a>';
  49. }
  50. print '</td>';
  51. print '<td class="linkedcol-name tdoverflowmax150">'.$objectlink->getNomUrl(1).'</td>';
  52. print '<td class="linkedcol-ref" >'.$objectlink->ref_client.'</td>';
  53. print '<td class="linkedcol-date center">'.dol_print_date($objectlink->date, 'day').'</td>';
  54. print '<td class="linkedcol-amount right">';
  55. if ($user->rights->propal->lire) {
  56. $total = $total + $objectlink->total_ht;
  57. echo price($objectlink->total_ht);
  58. }
  59. print '</td>';
  60. print '<td class="linkedcol-statut right">'.$objectlink->getLibStatut(3).'</td>';
  61. print '<td class="linkedcol-action right"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&token='.newToken().'&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a></td>';
  62. print "</tr>\n";
  63. }
  64. if (count($linkedObjectBlock) > 1) {
  65. print '<tr class="liste_total '.(empty($noMoreLinkedObjectBlockAfter) ? 'liste_sub_total' : '').'">';
  66. print '<td>'.$langs->trans("Total").'</td>';
  67. print '<td></td>';
  68. print '<td class="center"></td>';
  69. print '<td class="center"></td>';
  70. print '<td class="right">'.price($total).'</td>';
  71. print '<td class="right"></td>';
  72. print '<td class="right"></td>';
  73. print "</tr>\n";
  74. }
  75. print "<!-- END PHP TEMPLATE -->\n";