expedition.lib.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <?php
  2. /* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  4. * Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
  5. * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
  6. * Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. * or see https://www.gnu.org/
  21. */
  22. /**
  23. * \file htdocs/core/lib/expedition.lib.php
  24. * \brief Function for expedition module
  25. * \ingroup expedition
  26. */
  27. /**
  28. * Prepare array with list of tabs
  29. *
  30. * @param Expedition $object Object related to tabs
  31. * @return array Array of tabs to show
  32. */
  33. function expedition_prepare_head(Expedition $object)
  34. {
  35. global $langs, $conf, $user;
  36. if (isModEnabled("expedition")) {
  37. $langs->load("sendings");
  38. }
  39. $langs->load("orders");
  40. $h = 0;
  41. $head = array();
  42. $h = 0;
  43. $head[$h][0] = DOL_URL_ROOT."/admin/confexped.php";
  44. $head[$h][1] = $langs->trans("Setup");
  45. $h++;
  46. $head[$h][0] = DOL_URL_ROOT."/admin/expedition.php";
  47. $head[$h][1] = $langs->trans("Shipment");
  48. $hselected = $h;
  49. $h++;
  50. if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY)) {
  51. $head[$h][0] = DOL_URL_ROOT."/admin/delivery.php";
  52. $head[$h][1] = $langs->trans("Receivings");
  53. $h++;
  54. }
  55. complete_head_from_modules($conf, $langs, $object, $head, $h, 'order');
  56. complete_head_from_modules($conf, $langs, $object, $head, $h, 'order', 'remove');
  57. return $head;
  58. }
  59. /**
  60. * Return array head with list of tabs to view object informations.
  61. *
  62. * @return array head array with tabs
  63. */
  64. function expedition_admin_prepare_head()
  65. {
  66. global $langs, $conf, $user, $db;
  67. $langs->load("sendings");
  68. $extrafields = new ExtraFields($db);
  69. $h = 0;
  70. $head = array();
  71. /*
  72. $head[$h][0] = DOL_URL_ROOT."/admin/confexped.php";
  73. $head[$h][1] = $langs->trans("Setup");
  74. $head[$h][2] = 'general';
  75. $h++;
  76. */
  77. if (!empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) {
  78. $extrafields->fetch_name_optionals_label('expedition');
  79. $extrafields->fetch_name_optionals_label('expeditiondet');
  80. $head[$h][0] = DOL_URL_ROOT."/admin/expedition.php";
  81. $head[$h][1] = $langs->trans("Shipment");
  82. $head[$h][2] = 'shipment';
  83. $h++;
  84. $head[$h][0] = DOL_URL_ROOT.'/admin/expedition_extrafields.php';
  85. $head[$h][1] = $langs->trans("ExtraFields");
  86. $nbExtrafields = $extrafields->attributes['expedition']['count'];
  87. if ($nbExtrafields > 0) {
  88. $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
  89. }
  90. $head[$h][2] = 'attributes_shipment';
  91. $h++;
  92. $head[$h][0] = DOL_URL_ROOT.'/admin/expeditiondet_extrafields.php';
  93. $head[$h][1] = $langs->trans("ExtraFieldsLines");
  94. $nbExtrafields = $extrafields->attributes['expeditiondet']['count'];
  95. if ($nbExtrafields > 0) {
  96. $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
  97. }
  98. $head[$h][2] = 'attributeslines_shipment';
  99. $h++;
  100. }
  101. $head[$h][0] = DOL_URL_ROOT."/admin/delivery.php";
  102. $head[$h][1] = $langs->trans("Receivings");
  103. $head[$h][2] = 'receivings';
  104. $h++;
  105. if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY)) {
  106. $extrafields->fetch_name_optionals_label('delivery');
  107. $extrafields->fetch_name_optionals_label('deliverydet');
  108. $head[$h][0] = DOL_URL_ROOT.'/admin/delivery_extrafields.php';
  109. $head[$h][1] = $langs->trans("ExtraFields");
  110. $nbExtrafields = $extrafields->attributes['delivery']['count'];
  111. if ($nbExtrafields > 0) {
  112. $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
  113. }
  114. $head[$h][2] = 'attributes_receivings';
  115. $h++;
  116. $head[$h][0] = DOL_URL_ROOT.'/admin/deliverydet_extrafields.php';
  117. $head[$h][1] = $langs->trans("ExtraFieldsLines");
  118. $nbExtrafields = $extrafields->attributes['deliverydet']['count'];
  119. if ($nbExtrafields > 0) {
  120. $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
  121. }
  122. $head[$h][2] = 'attributeslines_receivings';
  123. $h++;
  124. }
  125. complete_head_from_modules($conf, $langs, null, $head, $h, 'expedition_admin');
  126. complete_head_from_modules($conf, $langs, null, $head, $h, 'expedition_admin', 'remove');
  127. return $head;
  128. }