PageRenderTime 42ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/htdocs/admin/workflow.php

https://github.com/asterix14/dolibarr
PHP | 138 lines | 78 code | 23 blank | 37 comment | 11 complexity | 4a688684107dc0a6f0b224ec5eb657cf MD5 | raw file
Possible License(s): LGPL-2.0
  1. <?php
  2. /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
  4. * Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
  5. * Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
  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 2 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. */
  20. /**
  21. * \file htdocs/admin/workflow.php
  22. * \ingroup company
  23. * \brief Workflows setup page
  24. */
  25. require("../main.inc.php");
  26. require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php");
  27. $langs->load("admin");
  28. $langs->load("workflow");
  29. if (!$user->admin)
  30. accessforbidden();
  31. /*
  32. * Actions
  33. */
  34. if (preg_match('/set(.*)/',$_GET["action"],$reg))
  35. {
  36. $code=$reg[1];
  37. if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0)
  38. {
  39. Header("Location: ".$_SERVER["PHP_SELF"]);
  40. exit;
  41. }
  42. else
  43. {
  44. dol_print_error($db);
  45. }
  46. }
  47. if (preg_match('/del(.*)/',$_GET["action"],$reg))
  48. {
  49. $code=$reg[1];
  50. if (dolibarr_del_const($db, $code, $conf->entity) > 0)
  51. {
  52. Header("Location: ".$_SERVER["PHP_SELF"]);
  53. exit;
  54. }
  55. else
  56. {
  57. dol_print_error($db);
  58. }
  59. }
  60. /*
  61. * View
  62. */
  63. $form=new Form($db);
  64. llxHeader('',$langs->trans("WorkflowSetup"),'');
  65. $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
  66. print_fiche_titre($langs->trans("WorkflowSetup"),$linkback,'setup');
  67. print $langs->trans("WorkflowDesc").'<br>';
  68. print "<br>";
  69. // Choix du module de gestion des codes clients / fournisseurs
  70. print "<table class=\"noborder\" width=\"100%\">\n";
  71. print "<tr class=\"liste_titre\">\n";
  72. print ' <td>'.$langs->trans("Description").'</td>';
  73. print ' <td align="center">'.$langs->trans("Status").'</td>';
  74. //print ' <td align="center" width="80">'.$langs->trans("Infos").'</td>';
  75. print "</tr>\n";
  76. clearstatcache();
  77. $workflowcodes=array();
  78. if ($conf->propal->enabled && $conf->commande->enabled) $workflowcodes['WORKFLOW_PROPAL_AUTOCREATE_ORDER']='WORKFLOW_PROPAL_AUTOCREATE_ORDER';
  79. //if ($conf->propal->enabled && $conf->facture->enabled) $workflowcodes['WORKFLOW_PROPAL_AUTOCREATE_INVOICE']='WORKFLOW_PROPAL_AUTOCREATE_INVOICE';
  80. //if ($conf->contrat->enabled && $conf->facture->enabled) $workflowcodes['WORKFLOW_CONTRACT_AUTOCREATE_INVOICE']='WORKFLOW_CONTRACT_AUTOCREATE_INVOICE';
  81. if ($conf->commande->enabled && $conf->facture->enabled) $workflowcodes['WORKFLOW_ORDER_AUTOCREATE_INVOICE']='WORKFLOW_ORDER_AUTOCREATE_INVOICE';
  82. if (count($workflowcodes) > 0)
  83. {
  84. foreach($workflowcodes as $code)
  85. {
  86. $var = !$var;
  87. print "<tr ".$bc[$var].">\n";
  88. print "<td>".$langs->trans('desc'.$code)."</td>\n";
  89. if (! empty($conf->global->$code))
  90. {
  91. print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=del'.$code.'">';
  92. print img_picto($langs->trans("Activated"),'switch_on');
  93. print '</a></td>';
  94. }
  95. else
  96. {
  97. print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=set'.$code.'">';
  98. print img_picto($langs->trans("Disabled"),'switch_off');
  99. print '</a></td>';
  100. }
  101. //print '<td align="center">';
  102. //$s=$modCodeTiers->getToolTip($langs,$soc,-1);
  103. //print $form->textwithpicto('',$s,1);
  104. //print '</td>';
  105. print '</tr>';
  106. }
  107. }
  108. else
  109. {
  110. print '<tr><td colspan="3">'.$langs->trans("ThereIsNoWorkflowToModify");
  111. }
  112. print '</table>';
  113. $db->close();
  114. llxFooter();
  115. ?>