objectline_view.tpl.php 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <?php
  2. /* Copyright (C) 2010-2013 Regis Houssin <regis.houssin@inodbox.com>
  3. * Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
  5. * Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
  6. * Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
  7. * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
  8. * Copyright (C) 2017 Juanjo Menent <jmenent@2byte.es>
  9. * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
  10. * Copyright (C) 2021 Greg Rastklan <greg.rastklan@atm-consulting.fr>
  11. * Copyright (C) 2021 Jean-Pascal BOUDET <jean-pascal.boudet@atm-consulting.fr>
  12. * Copyright (C) 2021 Grégory BLEMAND <gregory.blemand@atm-consulting.fr>
  13. *
  14. * This program is free software; you can redistribute it and/or modify
  15. * it under the terms of the GNU General Public License as published by
  16. * the Free Software Foundation; either version 3 of the License, or
  17. * (at your option) any later version.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License
  25. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  26. *
  27. * Need to have following variables defined:
  28. * $object (invoice, order, ...)
  29. * $conf
  30. * $langs
  31. * $dateSelector
  32. * $forceall (0 by default, 1 for supplier invoices/orders)
  33. * $element (used to test $user->rights->$element->creer)
  34. * $permtoedit (used to replace test $user->rights->$element->creer)
  35. * $senderissupplier (0 by default, 1 for supplier invoices/orders)
  36. * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
  37. * $outputalsopricetotalwithtax
  38. * $usemargins (0 to disable all margins columns, 1 to show according to margin setup)
  39. * $object_rights->creer initialized from = $object->getRights()
  40. * $disableedit, $disablemove, $disableremove
  41. *
  42. * $text, $description, $line
  43. */
  44. // Protection to avoid direct call of template
  45. if (empty($object) || !is_object($object)) {
  46. print "Error, template page can't be called as URL";
  47. exit;
  48. }
  49. global $mysoc;
  50. global $forceall, $senderissupplier, $inputalsopricewithtax, $outputalsopricetotalwithtax;
  51. // add html5 elements
  52. $domData = ' data-element="'.$line->element.'"';
  53. $domData .= ' data-id="'.$line->id.'"';
  54. $domData .= ' data-qty="'.$line->qty.'"';
  55. $domData .= ' data-product_type="'.$line->product_type.'"';
  56. $coldisplay = 0;
  57. ?>
  58. <!-- BEGIN PHP TEMPLATE objectline_view.tpl.php -->
  59. <tr id="row-<?php print $line->id?>" class="drag drop oddeven" <?php print $domData; ?> >
  60. <?php if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?>
  61. <td class="linecolnum center"><span class="opacitymedium"><?php $coldisplay++; ?><?php print ($i + 1); ?></span></td>
  62. <?php } ?>
  63. <td class="linecollabel"><?php $coldisplay++; ?><div id="line_<?php print $line->id; ?>"></div>
  64. <?php
  65. if ($line->fk_skill > 0) {
  66. $skill = new Skill($this->db);
  67. $resSkill = $skill->fetch($line->fk_skill);
  68. if ($resSkill > 0) {
  69. print Skill::typeCodeToLabel($skill->skill_type).'</td>';
  70. print '<td>'.$skill->getNomUrl(1);
  71. }
  72. }
  73. ?>
  74. </td>
  75. <td class="linecoldescription minwidth300imp"><?php $coldisplay++; ?>
  76. <?php
  77. // Add description in form
  78. if ($line->fk_skill > 0 && $resSkill > 0) {
  79. print $skill->description;
  80. }
  81. print '</td>';
  82. ?>
  83. <td class="linecolrank nowrap right"><?php $coldisplay++; ?>
  84. <?php
  85. global $permissiontoadd;
  86. print displayRankInfos($line->rankorder, $line->fk_skill, 'TNote', ($this->status == 0 && $permissiontoadd) ? 'edit' : 'view');
  87. ?>
  88. </td>
  89. <?php
  90. if ($this->statut == 0 && !empty($object_rights->creer) && $action != 'selectlines') {
  91. $situationinvoicelinewithparent = 0;
  92. if ($line->fk_prev_id != null && in_array($object->element, array('facture', 'facturedet'))) {
  93. if (!empty($object->situation_cycle_ref)) {
  94. // Set constant to disallow editing during a situation cycle
  95. $situationinvoicelinewithparent = 1;
  96. }
  97. }
  98. print '<td class="linecoledit center">';
  99. $coldisplay++;
  100. if (($line->info_bits & 2) == 2 || !empty($disableedit)) {
  101. } else { ?>
  102. <a class="editfielda reposition" href="<?php print $_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=editline&amp;lineid='.$line->id.'#line_'.$line->id; ?>">
  103. <?php print img_edit().'</a>';
  104. }
  105. print '</td>';
  106. /*print '<td class="linecoldelete center">';
  107. $coldisplay++;
  108. if (!$situationinvoicelinewithparent && empty($disableremove)) { // For situation invoice, deletion is not possible if there is a parent company.
  109. print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=ask_deleteline&amp;lineid='.$line->id.'">';
  110. print img_delete();
  111. print '</a>';
  112. }
  113. print '</td>';
  114. if ($num > 1 && $conf->browser->layout != 'phone' && ($this->situation_counter == 1 || !$this->situation_cycle_ref) && empty($disablemove)) {
  115. print '<td class="linecolmove tdlineupdown center">';
  116. $coldisplay++;
  117. if ($i > 0) { ?>
  118. <a class="lineupdown" href="<?php print $_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=up&amp;rowid='.$line->id; ?>">
  119. <?php print img_up('default', 0, 'imgupforline'); ?>
  120. </a>
  121. <?php }
  122. if ($i < $num - 1) { ?>
  123. <a class="lineupdown" href="<?php print $_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=down&amp;rowid='.$line->id; ?>">
  124. <?php print img_down('default', 0, 'imgdownforline'); ?>
  125. </a>
  126. <?php }
  127. print '</td>';
  128. } else {
  129. print '<td '.(($conf->browser->layout != 'phone' && empty($disablemove)) ? ' class="linecolmove tdlineupdown center"' : ' class="linecolmove center"').'></td>';
  130. $coldisplay++;
  131. }*/
  132. } else {
  133. //print '<td colspan="3"></td>';
  134. $coldisplay = $coldisplay + 3;
  135. }
  136. if ($action == 'selectlines') { ?>
  137. <td class="linecolcheck center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php print $i + 1; ?>]" value="<?php print $line->id; ?>" ></td>
  138. <?php }
  139. print "</tr>\n";
  140. print "<!-- END PHP TEMPLATE objectline_view.tpl.php -->\n";