PageRenderTime 43ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/htdocs/cashdesk/index.php

https://github.com/asterix14/dolibarr
PHP | 156 lines | 99 code | 27 blank | 30 comment | 6 complexity | e28b7ead35894f02fbf56561c87a33ef MD5 | raw file
Possible License(s): LGPL-2.0
  1. <?php
  2. /* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
  3. * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
  4. * Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. /**
  20. * \file htdocs/cashdesk/index.php
  21. * \ingroup cashdesk
  22. * \brief File to login to point of sales
  23. */
  24. // Set and init common variables
  25. // This include will set: config file variable $dolibarr_xxx, $conf, $langs and $mysoc objects
  26. require_once("../main.inc.php");
  27. require_once(DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php");
  28. $langs->load("admin");
  29. $langs->load("cashdesk");
  30. // Test if user logged
  31. if ( $_SESSION['uid'] > 0 )
  32. {
  33. header('Location: '.DOL_URL_ROOT.'/cashdesk/affIndex.php');
  34. exit;
  35. }
  36. $usertxt=GETPOST('user','',1);
  37. /*
  38. * View
  39. */
  40. $form=new Form($db);
  41. $formproduct=new FormProduct($db);
  42. $arrayofcss=array('/cashdesk/css/style.css');
  43. top_htmlhead('','',0,0,'',$arrayofcss);
  44. ?>
  45. <body>
  46. <div class="conteneur">
  47. <div class="conteneur_img_gauche">
  48. <div class="conteneur_img_droite">
  49. <h1 class="entete"></h1>
  50. <div class="menu_principal">
  51. </div>
  52. <div class="contenu">
  53. <div class="principal_login">
  54. <?php if (! empty($_GET["err"])) print $_GET["err"]."<br><br>\n"; ?>
  55. <fieldset class="cadre_facturation"><legend class="titre1"><?php echo $langs->trans("Identification"); ?></legend>
  56. <form id="frmLogin" method="POST" action="index_verif.php">
  57. <input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
  58. <table>
  59. <tr>
  60. <td class="label1"><?php echo $langs->trans("Login"); ?></td>
  61. <td><input name="txtUsername" class="texte_login" type="text" value="<?php echo $usertxt; ?>" /></td>
  62. </tr>
  63. <tr>
  64. <td class="label1"><?php echo $langs->trans("Password"); ?></td>
  65. <td><input name="pwdPassword" class="texte_login" type="password" value="" /></td>
  66. </tr>
  67. <tr>
  68. <td colspan="2">
  69. &nbsp;
  70. </td>
  71. </tr>
  72. <?php
  73. print "<tr>";
  74. print '<td class="label1">'.$langs->trans("CashDeskThirdPartyForSell").'</td>';
  75. print '<td>';
  76. $disabled=0;
  77. $langs->load("companies");
  78. if (! empty($conf->global->CASHDESK_ID_THIRDPARTY)) $disabled=1; // If a particular third party is defined, we disable choice
  79. $form->select_societes(GETPOST('socid')?GETPOST('socid'):$conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client in (1,3)',!$disabled,$disabled,1);
  80. //print '<input name="warehouse_id" class="texte_login" type="warehouse_id" value="" />';
  81. print '</td>';
  82. print "</tr>\n";
  83. if ($conf->stock->enabled)
  84. {
  85. $langs->load("stocks");
  86. print "<tr>";
  87. print '<td class="label1">'.$langs->trans("Warehouse").'</td>';
  88. print '<td>';
  89. $disabled=0;
  90. if (! empty($conf->global->CASHDESK_ID_WAREHOUSE)) $disabled=1; // If a particular stock is defined, we disable choice
  91. print $formproduct->selectWarehouses(GETPOST('warehouseid')?GETPOST('warehouseid'):$conf->global->CASHDESK_ID_WAREHOUSE,'warehouseid','',!$disabled,$disabled);
  92. //print '<input name="warehouse_id" class="texte_login" type="warehouse_id" value="" />';
  93. print '</td>';
  94. print "</tr>\n";
  95. }
  96. ?>
  97. <tr>
  98. <td colspan="2">
  99. &nbsp;
  100. </td>
  101. </tr>
  102. </table>
  103. <br>
  104. <center><span class="bouton_login"><input name="sbmtConnexion" type="submit" value=<?php echo $langs->trans("Connection"); ?> /></span></center>
  105. </form>
  106. </fieldset>
  107. <?php
  108. if ($_GET['err'] < 0)
  109. {
  110. echo ('<script type="text/javascript">');
  111. echo (' document.getElementById(\'frmLogin\').pwdPassword.focus();');
  112. echo ('</script>');
  113. }
  114. else
  115. {
  116. echo ('<script type="text/javascript">');
  117. echo (' document.getElementById(\'frmLogin\').txtUsername.focus();');
  118. echo ('</script>');
  119. }
  120. ?>
  121. </div>
  122. </div>
  123. <?php include('affPied.php'); ?></div>
  124. </div>
  125. </div>
  126. </body>
  127. <?php
  128. print '</html>';
  129. ?>