2008-09-30 01:18:52 +02:00
< ? php
2011-05-30 15:45:51 +02:00
/* Copyright ( C ) 2007 - 2008 Jeremie Ollivier < jeremie . o @ laposte . net >
2018-01-04 18:09:25 +01:00
* Copyright ( C ) 2011 - 2017 Juanjo Menent < jmenent @ 2 byte . es >
2011-05-30 15:45:51 +02:00
* Copyright ( C ) 2011 Laurent Destailleur < eldy @ users . sourceforge . net >
2008-09-30 01:18:52 +02:00
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
2013-01-16 15:36:08 +01:00
* the Free Software Foundation ; either version 3 of the License , or
2008-09-30 01:18:52 +02:00
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2019-09-23 21:55:30 +02:00
* along with this program . If not , see < https :// www . gnu . org / licenses />.
2008-09-30 01:18:52 +02:00
*/
2009-05-22 00:55:53 +02:00
/**
* \file htdocs / cashdesk / index . php
* \ingroup cashdesk
* \brief File to login to point of sales
*/
2009-10-20 01:44:55 +02:00
// Set and init common variables
// This include will set: config file variable $dolibarr_xxx, $conf, $langs and $mysoc objects
2012-08-22 23:11:24 +02:00
require_once '../main.inc.php' ;
require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php' ;
2010-10-22 04:00:50 +02:00
2018-09-09 11:10:32 +02:00
// Load translation files required by the page
2020-04-10 10:59:32 +02:00
$langs -> loadLangs ( array ( " admin " , " cashdesk " ));
2008-09-30 01:18:52 +02:00
2010-09-28 19:35:49 +02:00
// Test if user logged
2020-04-10 10:59:32 +02:00
if ( $_SESSION [ 'uid' ] > 0 )
2009-05-22 00:28:05 +02:00
{
2011-10-13 20:32:03 +02:00
header ( 'Location: ' . DOL_URL_ROOT . '/cashdesk/affIndex.php' );
2009-05-22 00:28:05 +02:00
exit ;
2008-10-26 13:59:56 +01:00
}
2008-09-30 01:18:52 +02:00
2020-04-10 10:59:32 +02:00
$usertxt = GETPOST ( 'user' , '' , 1 );
$err = GETPOST ( " err " );
2010-11-20 14:08:44 +01:00
2019-01-17 16:01:32 +01:00
// Instantiate hooks of thirdparty module only if not already define
$hookmanager -> initHooks ( array ( 'cashdeskloginpage' ));
2009-10-20 01:44:55 +02:00
2010-10-22 04:00:50 +02:00
/*
* View
*/
2010-06-16 23:07:49 +02:00
2020-04-10 10:59:32 +02:00
$form = new Form ( $db );
$formproduct = new FormProduct ( $db );
2010-06-16 23:07:49 +02:00
2020-04-10 10:59:32 +02:00
$arrayofcss = array ( '/cashdesk/css/style.css' );
2019-01-27 11:55:16 +01:00
top_htmlhead ( '' , '' , 0 , 0 , '' , $arrayofcss );
2019-01-17 16:01:32 +01:00
// Execute hook getLoginPageOptions (for table)
2020-04-10 10:59:32 +02:00
$parameters = array ( 'entity' => GETPOST ( 'entity' , 'int' ));
$reshook = $hookmanager -> executeHooks ( 'getLoginPageOptions' , $parameters ); // Note that $action and $object may have been modified by some hooks.
if ( is_array ( $hookmanager -> resArray ) && ! empty ( $hookmanager -> resArray )) {
2019-01-17 16:01:32 +01:00
$morelogincontent = $hookmanager -> resArray ; // (deprecated) For compatibility
} else {
$morelogincontent = $hookmanager -> resPrint ;
}
2008-09-30 01:18:52 +02:00
?>
< body >
2008-10-26 13:59:56 +01:00
< div class = " conteneur " >
< div class = " conteneur_img_gauche " >
< div class = " conteneur_img_droite " >
2008-09-30 01:18:52 +02:00
2015-09-18 14:11:50 +02:00
< div class = " menu_principal hideonsmartphone " >
2017-01-22 16:07:48 +01:00
< div class = " logo " >
< ? php
2020-04-10 10:59:32 +02:00
if ( ! empty ( $mysoc -> logo_small ))
2017-01-22 16:07:48 +01:00
{
2020-03-23 15:54:02 +01:00
print '<img class="logopos" alt="Logo company" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&file=' . urlencode ( 'logos/thumbs/' . $mysoc -> logo_small ) . '">' ;
2020-05-21 15:05:19 +02:00
} else {
2020-03-23 15:54:02 +01:00
print '<div class="logopos">' . $mysoc -> name . '</div>' ;
2017-01-22 16:07:48 +01:00
}
?>
</ div >
2010-06-17 00:16:11 +02:00
</ div >
2008-09-30 01:18:52 +02:00
2008-10-26 13:59:56 +01:00
< div class = " contenu " >
2015-09-18 14:11:50 +02:00
< div class = " inline-block " style = " vertical-align: top " >
2008-10-26 13:59:56 +01:00
< div class = " principal_login " >
2014-09-13 19:04:25 +02:00
< ? php if ( $err ) print dol_escape_htmltag ( $err ) . " <br><br> \n " ; ?>
2011-05-06 18:56:08 +02:00
< fieldset class = " cadre_facturation " >< legend class = " titre1 " >< ? php echo $langs -> trans ( " Identification " ); ?> </legend>
2011-05-30 15:45:51 +02:00
< form id = " frmLogin " method = " POST " action = " index_verif.php " >
2019-12-18 23:07:26 +01:00
< input type = " hidden " name = " token " value = " <?php echo newToken(); ?> " />
2008-09-30 01:18:52 +02:00
2008-10-26 13:59:56 +01:00
< table >
2008-09-30 01:18:52 +02:00
2008-10-26 13:59:56 +01:00
< tr >
2009-09-27 23:10:09 +02:00
< td class = " label1 " >< ? php echo $langs -> trans ( " Login " ); ?> </td>
2019-09-16 18:40:58 +02:00
< td >< input name = " txtUsername " class = " texte_login maxwidth150onsmartphoneimp " type = " text " value = " <?php echo $usertxt ; ?> " /></ td >
2008-10-26 13:59:56 +01:00
</ tr >
< tr >
2009-09-27 23:10:09 +02:00
< td class = " label1 " >< ? php echo $langs -> trans ( " Password " ); ?> </td>
2019-09-16 18:40:58 +02:00
< td >< input name = " pwdPassword " class = " texte_login maxwidth150onsmartphoneimp " type = " password " value = " " /></ td >
2008-10-26 13:59:56 +01:00
</ tr >
2011-11-15 13:33:32 +01:00
2019-01-17 16:01:32 +01:00
< ? php
2020-04-10 10:59:32 +02:00
if ( ! empty ( $morelogincontent )) {
2019-01-17 16:01:32 +01:00
if ( is_array ( $morelogincontent )) {
foreach ( $morelogincontent as $format => $option )
{
if ( $format == 'table' ) {
echo '<!-- Option by hook -->' ;
echo $option ;
}
}
2020-05-21 15:05:19 +02:00
} else {
2019-01-17 16:01:32 +01:00
echo '<!-- Option by hook -->' ;
echo $morelogincontent ;
}
}
?>
2011-11-15 13:33:32 +01:00
< tr >
< td colspan = " 2 " >
& nbsp ;
</ td >
</ tr >
2010-06-17 00:16:11 +02:00
< ? php
2010-10-22 04:00:50 +02:00
print " <tr> " ;
print '<td class="label1">' . $langs -> trans ( " CashDeskThirdPartyForSell " ) . '</td>' ;
print '<td>' ;
2020-04-10 10:59:32 +02:00
$disabled = 0 ;
2011-05-06 18:56:08 +02:00
$langs -> load ( " companies " );
2020-04-10 10:59:32 +02:00
if ( ! empty ( $conf -> global -> CASHDESK_ID_THIRDPARTY )) $disabled = 1 ; // If a particular third party is defined, we disable choice
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' );
2010-10-22 04:00:50 +02:00
//print '<input name="warehouse_id" class="texte_login" type="warehouse_id" value="" />';
print '</td>' ;
print " </tr> \n " ;
2020-04-10 10:59:32 +02:00
if ( ! empty ( $conf -> stock -> enabled ) && empty ( $conf -> global -> CASHDESK_NO_DECREASE_STOCK ))
2010-06-16 23:07:49 +02:00
{
$langs -> load ( " stocks " );
print " <tr> " ;
print '<td class="label1">' . $langs -> trans ( " Warehouse " ) . '</td>' ;
print '<td>' ;
2020-04-10 10:59:32 +02:00
$disabled = 0 ;
if ( $conf -> global -> CASHDESK_ID_WAREHOUSE > 0 ) $disabled = 1 ; // If a particular stock is defined, we disable choice
print $formproduct -> selectWarehouses (( GETPOST ( 'warehouseid' ) ? GETPOST ( 'warehouseid' , 'int' ) : ( empty ( $conf -> global -> CASHDESK_ID_WAREHOUSE ) ? 'ifone' : $conf -> global -> CASHDESK_ID_WAREHOUSE )), 'warehouseid' , '' , ! $disabled , $disabled );
2010-06-16 23:07:49 +02:00
print '</td>' ;
2010-10-22 04:00:50 +02:00
print " </tr> \n " ;
2010-06-16 23:07:49 +02:00
}
2012-10-06 21:47:59 +02:00
print " <tr> " ;
print '<td class="label1">' . $langs -> trans ( " CashDeskBankAccountForSell " ) . '</td>' ;
print '<td>' ;
2020-04-10 10:59:32 +02:00
$defaultknown = 0 ;
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
$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 ));
2012-10-06 21:47:59 +02:00
print '</td>' ;
print " </tr> \n " ;
print " <tr> " ;
print '<td class="label1">' . $langs -> trans ( " CashDeskBankAccountForCheque " ) . '</td>' ;
print '<td>' ;
2020-04-10 10:59:32 +02:00
$defaultknown = 0 ;
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
$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 ));
2012-10-06 21:47:59 +02:00
print '</td>' ;
print " </tr> \n " ;
print " <tr> " ;
print '<td class="label1">' . $langs -> trans ( " CashDeskBankAccountForCB " ) . '</td>' ;
print '<td>' ;
2020-04-10 10:59:32 +02:00
$defaultknown = 0 ;
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
$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 ));
2012-10-06 21:47:59 +02:00
print '</td>' ;
print " </tr> \n " ;
2010-06-16 23:07:49 +02:00
?>
2011-11-15 13:33:32 +01:00
< tr >
< td colspan = " 2 " >
& nbsp ;
</ td >
</ tr >
2008-10-26 13:59:56 +01:00
</ table >
2011-11-15 13:33:32 +01:00
< br >
2008-09-30 01:18:52 +02:00
2020-03-31 17:45:45 +02:00
< div align = " center " >< span class = " bouton_login " >< input class = " button " type = " submit " value = " <?php echo dol_escape_htmltag( $langs->trans ( " Connection " )); ?> " /></ span ></ div >
2008-09-30 01:18:52 +02:00
2008-10-26 13:59:56 +01:00
</ form >
</ fieldset >
2008-09-30 01:18:52 +02:00
2015-09-18 14:11:50 +02:00
2008-10-26 13:59:56 +01:00
< ? php
2011-11-15 13:33:32 +01:00
if ( $_GET [ 'err' ] < 0 )
{
2008-10-26 13:59:56 +01:00
echo ( '<script type="text/javascript">' );
echo ( ' document.getElementById(\'frmLogin\').pwdPassword.focus();' );
echo ( '</script>' );
2020-05-21 15:05:19 +02:00
} else {
2008-10-26 13:59:56 +01:00
echo ( '<script type="text/javascript">' );
echo ( ' document.getElementById(\'frmLogin\').txtUsername.focus();' );
echo ( '</script>' );
}
2011-11-15 13:33:32 +01:00
?>
2015-09-18 14:11:50 +02:00
</ div >
2011-11-15 13:33:32 +01:00
</ div >
2008-10-26 13:59:56 +01:00
</ div >
2008-09-30 01:18:52 +02:00
2012-08-23 02:04:35 +02:00
< ? php include 'affPied.php' ; ?> </div>
2008-10-26 13:59:56 +01:00
</ div >
</ div >
2009-06-20 09:09:03 +02:00
</ body >
2011-02-20 12:25:28 +01:00
< ? php
print '</html>' ;