dolibarr  9.0.0
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 <http://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 }
79 else
80 {
81  print '<div class="logopos">'.$mysoc->name.'</div>';
82 }
83 ?>
84 </div>
85 </div>
86 
87 <div class="contenu">
88 <div class="inline-block" style="vertical-align: top">
89 <div class="principal_login">
90 <?php if ($err) print dol_escape_htmltag($err)."<br><br>\n"; ?>
91 <fieldset class="cadre_facturation"><legend class="titre1"><?php echo $langs->trans("Identification"); ?></legend>
92 <form id="frmLogin" method="POST" action="index_verif.php">
93  <input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
94 
95 <table>
96 
97  <tr>
98  <td class="label1"><?php echo $langs->trans("Login"); ?></td>
99  <td><input name="txtUsername" class="texte_login" type="text" value="<?php echo $usertxt; ?>" /></td>
100  </tr>
101  <tr>
102  <td class="label1"><?php echo $langs->trans("Password"); ?></td>
103  <td><input name="pwdPassword" class="texte_login" type="password" value="" /></td>
104  </tr>
105 
106 <?php
107 if (! empty($morelogincontent)) {
108  if (is_array($morelogincontent)) {
109  foreach ($morelogincontent as $format => $option)
110  {
111  if ($format == 'table') {
112  echo '<!-- Option by hook -->';
113  echo $option;
114  }
115  }
116  }
117  else {
118  echo '<!-- Option by hook -->';
119  echo $morelogincontent;
120  }
121 }
122 ?>
123 
124  <tr>
125  <td colspan="2">
126  &nbsp;
127  </td>
128  </tr>
129 
130 <?php
131 print "<tr>";
132 print '<td class="label1">'.$langs->trans("CashDeskThirdPartyForSell").'</td>';
133 print '<td>';
134 $disabled=0;
135 $langs->load("companies");
136 if (! empty($conf->global->CASHDESK_ID_THIRDPARTY)) $disabled=1; // If a particular third party is defined, we disable choice
137 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, 1);
138 //print '<input name="warehouse_id" class="texte_login" type="warehouse_id" value="" />';
139 print '</td>';
140 print "</tr>\n";
141 
142 if (! empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK))
143 {
144  $langs->load("stocks");
145  print "<tr>";
146  print '<td class="label1">'.$langs->trans("Warehouse").'</td>';
147  print '<td>';
148  $disabled=0;
149  if ($conf->global->CASHDESK_ID_WAREHOUSE > 0) $disabled=1; // If a particular stock is defined, we disable choice
150  print $formproduct->selectWarehouses((GETPOST('warehouseid')?GETPOST('warehouseid','int'):(empty($conf->global->CASHDESK_ID_WAREHOUSE)?'ifone':$conf->global->CASHDESK_ID_WAREHOUSE)),'warehouseid','',!$disabled,$disabled);
151  print '</td>';
152  print "</tr>\n";
153 }
154 
155 print "<tr>";
156 print '<td class="label1">'.$langs->trans("CashDeskBankAccountForSell").'</td>';
157 print '<td>';
158 $defaultknown=0;
159 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
160 print $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));
161 print '</td>';
162 print "</tr>\n";
163 
164 print "<tr>";
165 print '<td class="label1">'.$langs->trans("CashDeskBankAccountForCheque").'</td>';
166 print '<td>';
167 $defaultknown=0;
168 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
169 print $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));
170 print '</td>';
171 print "</tr>\n";
172 
173 print "<tr>";
174 print '<td class="label1">'.$langs->trans("CashDeskBankAccountForCB").'</td>';
175 print '<td>';
176 $defaultknown=0;
177 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
178 print $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));
179 print '</td>';
180 print "</tr>\n";
181 
182 ?>
183 
184  <tr>
185  <td colspan="2">
186  &nbsp;
187  </td>
188  </tr>
189 
190 
191 </table>
192 <br>
193 
194 <div align="center"><span class="bouton_login"><input class="button" name="sbmtConnexion" type="submit" value=<?php echo $langs->trans("Connection"); ?> /></span></div>
195 
196 </form>
197 </fieldset>
198 
199 
200 <?php
201 if ($_GET['err'] < 0)
202 {
203  echo ('<script type="text/javascript">');
204  echo (' document.getElementById(\'frmLogin\').pwdPassword.focus();');
205  echo ('</script>');
206 }
207 else
208 {
209  echo ('<script type="text/javascript">');
210  echo (' document.getElementById(\'frmLogin\').txtUsername.focus();');
211  echo ('</script>');
212 }
213 ?>
214 
215 </div>
216 </div>
217 </div>
218 
219 <?php include 'affPied.php'; ?></div>
220 </div>
221 </div>
222 </body>
223 
224 <?php
225 print '</html>';
GETPOST($paramname, $check='none', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print
Draft customers invoices.
Definition: index.php:91
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition: repair.php:103
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...
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.
type
Definition: viewcat.php:284
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $disablejmobile=0, $disablenofollow=0)
Ouput html header of a page.
Definition: main.inc.php:1172