PageRenderTime 45ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/htdocs/core/lib/order.lib.php

https://bitbucket.org/speedealing/speedealing
PHP | 110 lines | 59 code | 13 blank | 38 comment | 14 complexity | 2aba42334d2c98f0140618a0f82363ca MD5 | raw file
Possible License(s): LGPL-3.0, LGPL-2.1, GPL-3.0, MIT
  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@capnetworks.com>
  5. * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. * or see http://www.gnu.org/
  20. */
  21. /**
  22. * \file htdocs/core/lib/order.lib.php
  23. * \brief Ensemble de fonctions de base pour le module commande
  24. * \ingroup commande
  25. */
  26. /**
  27. * Prepare array with list of tabs
  28. *
  29. * @param Object $object Object related to tabs
  30. * @return array Array of tabs to shoc
  31. */
  32. function commande_prepare_head($object)
  33. {
  34. global $langs, $conf, $user;
  35. if (! empty($conf->expedition->enabled)) $langs->load("sendings");
  36. $langs->load("orders");
  37. $h = 0;
  38. $head = array();
  39. if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
  40. {
  41. $head[$h][0] = DOL_URL_ROOT.'/commande/fiche.php?id='.$object->id;
  42. $head[$h][1] = $langs->trans("OrderCard");
  43. $head[$h][2] = 'order';
  44. $h++;
  45. }
  46. if (($conf->expedition_bon->enabled && $user->rights->expedition->lire)
  47. || ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire))
  48. {
  49. $head[$h][0] = DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id;
  50. if ($conf->expedition_bon->enabled) $text=$langs->trans("Sendings");
  51. if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled) $text.='/';
  52. if ($conf->livraison_bon->enabled) $text.=$langs->trans("Receivings");
  53. $head[$h][1] = $text;
  54. $head[$h][2] = 'shipping';
  55. $h++;
  56. }
  57. if (! empty($conf->global->MAIN_USE_PREVIEW_TABS))
  58. {
  59. $head[$h][0] = DOL_URL_ROOT.'/commande/apercu.php?id='.$object->id;
  60. $head[$h][1] = $langs->trans("Preview");
  61. $head[$h][2] = 'preview';
  62. $h++;
  63. }
  64. if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
  65. {
  66. $head[$h][0] = DOL_URL_ROOT.'/commande/contact.php?id='.$object->id;
  67. $head[$h][1] = $langs->trans('ContactsAddresses');
  68. $head[$h][2] = 'contact';
  69. $h++;
  70. }
  71. // Show more tabs from modules
  72. // Entries must be declared in modules descriptor with line
  73. // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
  74. // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
  75. complete_head_from_modules($conf,$langs,$object,$head,$h,'order');
  76. $head[$h][0] = DOL_URL_ROOT.'/commande/document.php?id='.$object->id;
  77. /*$filesdir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($commande->ref);
  78. include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
  79. $listoffiles=dol_dir_list($filesdir,'files',1);
  80. $head[$h][1] = (count($listoffiles)?$langs->trans('DocumentsNb',count($listoffiles)):$langs->trans('Documents'));*/
  81. $head[$h][1] = $langs->trans('Documents');
  82. $head[$h][2] = 'documents';
  83. $h++;
  84. if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
  85. {
  86. $head[$h][0] = DOL_URL_ROOT.'/commande/note.php?id='.$object->id;
  87. $head[$h][1] = $langs->trans('Notes');
  88. $head[$h][2] = 'note';
  89. $h++;
  90. }
  91. $head[$h][0] = DOL_URL_ROOT.'/commande/info.php?id='.$object->id;
  92. $head[$h][1] = $langs->trans("Info");
  93. $head[$h][2] = 'info';
  94. $h++;
  95. return $head;
  96. }
  97. ?>