expedition.lib.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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 (!empty($conf->expedition->enabled)) {
  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;
  67. $langs->load("sendings");
  68. $h = 0;
  69. $head = array();
  70. $head[$h][0] = DOL_URL_ROOT."/admin/confexped.php";
  71. $head[$h][1] = $langs->trans("Setup");
  72. $head[$h][2] = 'general';
  73. $h++;
  74. if (!empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) {
  75. $head[$h][0] = DOL_URL_ROOT."/admin/expedition.php";
  76. $head[$h][1] = $langs->trans("Shipment");
  77. $head[$h][2] = 'shipment';
  78. $h++;
  79. }
  80. if (!empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) {
  81. $head[$h][0] = DOL_URL_ROOT.'/admin/expedition_extrafields.php';
  82. $head[$h][1] = $langs->trans("ExtraFields");
  83. $head[$h][2] = 'attributes_shipment';
  84. $h++;
  85. }
  86. if (!empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) {
  87. $head[$h][0] = DOL_URL_ROOT.'/admin/expeditiondet_extrafields.php';
  88. $head[$h][1] = $langs->trans("ExtraFieldsLines");
  89. $head[$h][2] = 'attributeslines_shipment';
  90. $h++;
  91. }
  92. if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY)) {
  93. $head[$h][0] = DOL_URL_ROOT."/admin/delivery.php";
  94. $head[$h][1] = $langs->trans("Receivings");
  95. $head[$h][2] = 'receivings';
  96. $h++;
  97. }
  98. if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY)) {
  99. $head[$h][0] = DOL_URL_ROOT.'/admin/delivery_extrafields.php';
  100. $head[$h][1] = $langs->trans("ExtraFields");
  101. $head[$h][2] = 'attributes_receivings';
  102. $h++;
  103. }
  104. if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY)) {
  105. $head[$h][0] = DOL_URL_ROOT.'/admin/deliverydet_extrafields.php';
  106. $head[$h][1] = $langs->trans("ExtraFieldsLines");
  107. $head[$h][2] = 'attributeslines_receivings';
  108. $h++;
  109. }
  110. complete_head_from_modules($conf, $langs, null, $head, $h, 'expedition_admin');
  111. complete_head_from_modules($conf, $langs, null, $head, $h, 'expedition_admin', 'remove');
  112. return $head;
  113. }