PageRenderTime 41ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/htdocs/cashdesk/index.php

https://bitbucket.org/speedealing/speedealing
PHP | 184 lines | 123 code | 31 blank | 30 comment | 12 complexity | 4b0b145027ae9db0010c5e10edd310b6 MD5 | raw file
Possible License(s): LGPL-3.0, LGPL-2.1, GPL-3.0, MIT
  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 3 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. print $form->select_company(GETPOST('socid','int')?GETPOST('socid','int'):$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 (! empty($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. print "<tr>";
  97. print '<td class="label1">'.$langs->trans("CashDeskBankAccountForSell").'</td>';
  98. print '<td>';
  99. $defaultknown=0;
  100. if (! empty($conf->global->CASHDESK_ID_BANKACCOUNT_CASH) && $conf->global->CASHDESK_ID_BANKACCOUNT_CASH > 0) $defaultknown=1; // If a particular stock is defined, we disable choice
  101. print $form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CASH,'CASHDESK_ID_BANKACCOUNT_CASH',0,"courant=2",($defaultknown?0:2));
  102. print '</td>';
  103. print "</tr>\n";
  104. print "<tr>";
  105. print '<td class="label1">'.$langs->trans("CashDeskBankAccountForCheque").'</td>';
  106. print '<td>';
  107. $defaultknown=0;
  108. if (! empty($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE) && $conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE > 0) $defaultknown=1; // If a particular stock is defined, we disable choice
  109. print $form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE,'CASHDESK_ID_BANKACCOUNT_CHEQUE',0,"courant=1",($defaultknown?0:2));
  110. print '</td>';
  111. print "</tr>\n";
  112. print "<tr>";
  113. print '<td class="label1">'.$langs->trans("CashDeskBankAccountForCB").'</td>';
  114. print '<td>';
  115. $defaultknown=0;
  116. if (! empty($conf->global->CASHDESK_ID_BANKACCOUNT_CB) && $conf->global->CASHDESK_ID_BANKACCOUNT_CB > 0) $defaultknown=1; // If a particular stock is defined, we disable choice
  117. print $form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CB,'CASHDESK_ID_BANKACCOUNT_CB',0,"courant=1",($defaultknown?0:2));
  118. print '</td>';
  119. print "</tr>\n";
  120. ?>
  121. <tr>
  122. <td colspan="2">
  123. &nbsp;
  124. </td>
  125. </tr>
  126. </table>
  127. <br>
  128. <div align="center"><span class="bouton_login"><input name="sbmtConnexion" type="submit" value=<?php echo $langs->trans("Connection"); ?> /></span></div>
  129. </form>
  130. </fieldset>
  131. <?php
  132. if ($_GET['err'] < 0)
  133. {
  134. echo ('<script type="text/javascript">');
  135. echo (' document.getElementById(\'frmLogin\').pwdPassword.focus();');
  136. echo ('</script>');
  137. }
  138. else
  139. {
  140. echo ('<script type="text/javascript">');
  141. echo (' document.getElementById(\'frmLogin\').txtUsername.focus();');
  142. echo ('</script>');
  143. }
  144. ?>
  145. </div>
  146. </div>
  147. <?php include 'affPied.php'; ?></div>
  148. </div>
  149. </div>
  150. </body>
  151. <?php
  152. print '</html>';
  153. ?>