dolibarr  13.0.2
index.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
3  * Copyright (C) 2011-2017 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 <https://www.gnu.org/licenses/>.
18  */
19 
26 // Set and init common variables
27 // This include will set: config file variable $dolibarr_xxx, $conf, $langs and $mysoc objects
28 require_once '../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
30 
31 // Load translation files required by the page
32 $langs->loadLangs(array("admin", "cashdesk"));
33 
34 // Test if user logged
35 if ($_SESSION['uid'] > 0)
36 {
37  header('Location: '.DOL_URL_ROOT.'/cashdesk/affIndex.php');
38  exit;
39 }
40 
41 $usertxt = GETPOST('user', '', 1);
42 $err = GETPOST("err");
43 
44 // Instantiate hooks of thirdparty module only if not already define
45 $hookmanager->initHooks(array('cashdeskloginpage'));
46 
47 /*
48  * View
49  */
50 
51 $form = new Form($db);
52 $formproduct = new FormProduct($db);
53 
54 $arrayofcss = array('/cashdesk/css/style.css');
55 top_htmlhead('', '', 0, 0, '', $arrayofcss);
56 
57 // Execute hook getLoginPageOptions (for table)
58 $parameters = array('entity' => GETPOST('entity', 'int'));
59 $reshook = $hookmanager->executeHooks('getLoginPageOptions', $parameters); // Note that $action and $object may have been modified by some hooks.
60 if (is_array($hookmanager->resArray) && !empty($hookmanager->resArray)) {
61  $morelogincontent = $hookmanager->resArray; // (deprecated) For compatibility
62 } else {
63  $morelogincontent = $hookmanager->resPrint;
64 }
65 ?>
66 
67 <body>
68 <div class="conteneur">
69 <div class="conteneur_img_gauche">
70 <div class="conteneur_img_droite">
71 
72 <div class="menu_principal hideonsmartphone">
73 <div class="logo">
74 <?php
75 if (!empty($mysoc->logo_small))
76 {
77  print '<img class="logopos" alt="Logo company" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small).'">';
78 } else {
79  print '<div class="logopos">'.$mysoc->name.'</div>';
80 }
81 ?>
82 </div>
83 </div>
84 
85 <div class="contenu">
86 <div class="inline-block" style="vertical-align: top">
87 <div class="principal_login">
88 <?php if ($err) print dol_escape_htmltag($err)."<br><br>\n"; ?>
89 <fieldset class="cadre_facturation"><legend class="titre1"><?php echo $langs->trans("Identification"); ?></legend>
90 <form id="frmLogin" method="POST" action="index_verif.php">
91  <input type="hidden" name="token" value="<?php echo newToken(); ?>" />
92 
93 <table>
94 
95  <tr>
96  <td class="label1"><?php echo $langs->trans("Login"); ?></td>
97  <td><input name="txtUsername" class="texte_login maxwidth150onsmartphoneimp" type="text" value="<?php echo $usertxt; ?>" /></td>
98  </tr>
99  <tr>
100  <td class="label1"><?php echo $langs->trans("Password"); ?></td>
101  <td><input name="pwdPassword" class="texte_login maxwidth150onsmartphoneimp" type="password" value="" /></td>
102  </tr>
103 
104 <?php
105 if (!empty($morelogincontent)) {
106  if (is_array($morelogincontent)) {
107  foreach ($morelogincontent as $format => $option)
108  {
109  if ($format == 'table') {
110  echo '<!-- Option by hook -->';
111  echo $option;
112  }
113  }
114  } else {
115  echo '<!-- Option by hook -->';
116  echo $morelogincontent;
117  }
118 }
119 ?>
120 
121  <tr>
122  <td colspan="2">
123  &nbsp;
124  </td>
125  </tr>
126 
127 <?php
128 print "<tr>";
129 print '<td class="label1">'.$langs->trans("CashDeskThirdPartyForSell").'</td>';
130 print '<td>';
131 $disabled = 0;
132 $langs->load("companies");
133 if (!empty($conf->global->CASHDESK_ID_THIRDPARTY)) $disabled = 1; // If a particular third party is defined, we disable choice
134 print $form->select_company(GETPOST('socid', 'int') ?GETPOST('socid', 'int') : $conf->global->CASHDESK_ID_THIRDPARTY, 'socid', '(s.client IN (1,3) AND s.status = 1)', !$disabled, $disabled, 0, array(), 0, 'maxwidth300');
135 //print '<input name="warehouse_id" class="texte_login" type="warehouse_id" value="" />';
136 print '</td>';
137 print "</tr>\n";
138 
139 if (!empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK))
140 {
141  $langs->load("stocks");
142  print "<tr>";
143  print '<td class="label1">'.$langs->trans("Warehouse").'</td>';
144  print '<td>';
145  $disabled = 0;
146  if ($conf->global->CASHDESK_ID_WAREHOUSE > 0) $disabled = 1; // If a particular stock is defined, we disable choice
147  print $formproduct->selectWarehouses((GETPOST('warehouseid') ?GETPOST('warehouseid', 'int') : (empty($conf->global->CASHDESK_ID_WAREHOUSE) ? 'ifone' : $conf->global->CASHDESK_ID_WAREHOUSE)), 'warehouseid', '', !$disabled, $disabled);
148  print '</td>';
149  print "</tr>\n";
150 }
151 
152 print "<tr>";
153 print '<td class="label1">'.$langs->trans("CashDeskBankAccountForSell").'</td>';
154 print '<td>';
155 $defaultknown = 0;
156 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
157 $form->select_comptes(((GETPOST('bankid_cash') > 0) ?GETPOST('bankid_cash') : $conf->global->CASHDESK_ID_BANKACCOUNT_CASH), 'CASHDESK_ID_BANKACCOUNT_CASH', 0, "courant=2", ($defaultknown ? 0 : 2));
158 print '</td>';
159 print "</tr>\n";
160 
161 print "<tr>";
162 print '<td class="label1">'.$langs->trans("CashDeskBankAccountForCheque").'</td>';
163 print '<td>';
164 $defaultknown = 0;
165 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
166 $form->select_comptes(((GETPOST('bankid_cheque') > 0) ?GETPOST('bankid_cheque') : $conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE), 'CASHDESK_ID_BANKACCOUNT_CHEQUE', 0, "courant=1", ($defaultknown ? 0 : 2));
167 print '</td>';
168 print "</tr>\n";
169 
170 print "<tr>";
171 print '<td class="label1">'.$langs->trans("CashDeskBankAccountForCB").'</td>';
172 print '<td>';
173 $defaultknown = 0;
174 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
175 $form->select_comptes(((GETPOST('bankid_cb') > 0) ?GETPOST('bankid_cb') : $conf->global->CASHDESK_ID_BANKACCOUNT_CB), 'CASHDESK_ID_BANKACCOUNT_CB', 0, "courant=1", ($defaultknown ? 0 : 2));
176 print '</td>';
177 print "</tr>\n";
178 
179 ?>
180 
181  <tr>
182  <td colspan="2">
183  &nbsp;
184  </td>
185  </tr>
186 
187 
188 </table>
189 <br>
190 
191 <div align="center"><span class="bouton_login"><input class="button" type="submit" value="<?php echo dol_escape_htmltag($langs->trans("Connection")); ?>" /></span></div>
192 
193 </form>
194 </fieldset>
195 
196 
197 <?php
198 if ($_GET['err'] < 0)
199 {
200  echo ('<script type="text/javascript">');
201  echo (' document.getElementById(\'frmLogin\').pwdPassword.focus();');
202  echo ('</script>');
203 } else {
204  echo ('<script type="text/javascript">');
205  echo (' document.getElementById(\'frmLogin\').txtUsername.focus();');
206  echo ('</script>');
207 }
208 ?>
209 
210 </div>
211 </div>
212 </div>
213 
214 <?php include 'affPied.php'; ?></div>
215 </div>
216 </div>
217 </body>
218 
219 <?php
220 print '</html>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
top_htmlhead($head, $title= '', $disablejs=0, $disablehead=0, $arrayofjs= '', $arrayofcss= '', $disablejmobile=0, $disablenofollow=0)
Ouput html header of a page.
Definition: main.inc.php:1280
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition: repair.php:108
Class with static methods for building HTML components related to products Only components common to ...
Class to manage generation of HTML components Only common components must be here.
print
Draft customers invoices.
Definition: index.php:89
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition: repair.php:105
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $keepmoretags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...