New: [ task #210 ] Can choose cash account during POS login

This commit is contained in:
Laurent Destailleur 2012-10-06 21:47:59 +02:00
parent 8076719d9c
commit 053b4dd63c
6 changed files with 53 additions and 17 deletions

View File

@ -52,6 +52,7 @@ For users:
- New: Can make one invoice for several orders.
- New: POS module can works with only one payment method (cach, chq, credit card).
- New: Add possibility to defined position/job of a user
- New: [ task #210 ] Can choose cash account during POS login
New experimental modules:
- New: Add margin and commissions management module.

View File

@ -111,6 +111,34 @@ if (! empty($conf->stock->enabled))
print '</td>';
print "</tr>\n";
}
print "<tr>";
print '<td class="label1">'.$langs->trans("CashDeskBankAccountForSell").'</td>';
print '<td>';
$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
print $form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CASH,'CASHDESK_ID_BANKACCOUNT_CASH',0,"courant=2",($defaultknown?0:2));
print '</td>';
print "</tr>\n";
print "<tr>";
print '<td class="label1">'.$langs->trans("CashDeskBankAccountForCheque").'</td>';
print '<td>';
$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
print $form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE,'CASHDESK_ID_BANKACCOUNT_CHEQUE',0,"courant=1",($defaultknown?0:2));
print '</td>';
print "</tr>\n";
print "<tr>";
print '<td class="label1">'.$langs->trans("CashDeskBankAccountForCB").'</td>';
print '<td>';
$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
print $form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CB,'CASHDESK_ID_BANKACCOUNT_CB',0,"courant=1",($defaultknown?0:2));
print '</td>';
print "</tr>\n";
?>
<tr>

View File

@ -32,6 +32,9 @@ $username = GETPOST("txtUsername");
$password = GETPOST("pwdPassword");
$thirdpartyid = (GETPOST('socid','int')!='')?GETPOST('socid','int'):$conf->global->CASHDESK_ID_THIRDPARTY;
$warehouseid = (GETPOST("warehouseid")!='')?GETPOST("warehouseid"):$conf->global->CASHDESK_ID_WAREHOUSE;
$bankid_cash = (GETPOST("CASHDESK_ID_BANKACCOUNT_CASH")!='')?GETPOST("CASHDESK_ID_BANKACCOUNT_CASH"):$conf->global->CASHDESK_ID_BANKACCOUNT_CASH;
$bankid_cheque = (GETPOST("CASHDESK_ID_BANKACCOUNT_CHEQUE")!='')?GETPOST("CASHDESK_ID_BANKACCOUNT_CHEQUE"):$conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE;
$bankid_cb = (GETPOST("CASHDESK_ID_BANKACCOUNT_CB")!='')?GETPOST("CASHDESK_ID_BANKACCOUNT_CB"):$conf->global->CASHDESK_ID_BANKACCOUNT_CB;
// Check username
if (empty($username))
@ -56,6 +59,7 @@ if (! empty($conf->stock->enabled) && $conf->global->STOCK_CALCULATE_ON_BILL &&
exit;
}
/*
if (! empty($_POST['txtUsername']) && ! empty($conf->banque->enabled) && (empty($conf_fkaccount_cash) && empty($conf_fkaccount_cheque) && empty($conf_fkaccount_cb)))
{
$langs->load("errors");
@ -63,7 +67,7 @@ if (! empty($_POST['txtUsername']) && ! empty($conf->banque->enabled) && (empty(
header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid);
exit;
}
*/
// Check password
$auth = new Auth($db);
@ -94,7 +98,10 @@ if ( $retour >= 0 )
$_SESSION['prenom'] = $tab['firstname'];
$_SESSION['CASHDESK_ID_THIRDPARTY'] = $thirdpartyid;
$_SESSION['CASHDESK_ID_WAREHOUSE'] = $warehouseid;
//var_dump($_SESSION);exit;
$_SESSION['CASHDESK_ID_BANKACCOUNT_CASH'] = ($bankid_cash > 0 ? $bankid_cash : '');
$_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE'] = ($bankid_cheque > 0 ? $bankid_cheque : '');
$_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] = ($bankid_cb > 0 ? $bankid_cb : '');
//var_dump($_SESSION);exit;
header('Location: '.DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation&id=NOUV');
exit;

View File

@ -184,7 +184,7 @@ $langs->load("cashdesk");
<tr>
<?php
print '<td>';
if (empty($conf->global->CASHDESK_ID_BANKACCOUNT_CASH) || $conf->global->CASHDESK_ID_BANKACCOUNT_CASH < 0)
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CASH']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CASH'] < 0)
{
$langs->load("errors");
print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("Cash").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete")).'" />';
@ -192,7 +192,7 @@ $langs->load("cashdesk");
else print '<input class="bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("Cash").'" onclick="javascript: verifClic(\'ESP\');" />';
print '</td>';
print '<td>';
if (empty($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE) || $conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE < 0)
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE'] < 0)
{
$langs->load("errors");
print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("CreditCard").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete")).'" />';
@ -200,7 +200,7 @@ $langs->load("cashdesk");
else print '<input class="bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("CreditCard").'" onclick="javascript: verifClic(\'CB\');" />';
print '</td>';
print '<td>';
if (empty($conf->global->CASHDESK_ID_BANKACCOUNT_CB) || $conf->global->CASHDESK_ID_BANKACCOUNT_CB < 0)
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CB']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] < 0)
{
$langs->load("errors");
print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("Cheque").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete")).'" />';

View File

@ -29,23 +29,23 @@ if (!empty($_SESSION["CASHDESK_ID_THIRDPARTY"]))
$company->fetch($_SESSION["CASHDESK_ID_THIRDPARTY"]);
$companyLink = $company->getNomUrl(1);
}
if (!empty($conf->global->CASHDESK_ID_BANKACCOUNT_CASH))
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"]))
{
$bankcash=new Account($db);
$bankcash->fetch($conf->global->CASHDESK_ID_BANKACCOUNT_CASH);
$bankcash->fetch($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"]);
$bankcash->label=$bankcash->ref;
$bankcashLink = $bankcash->getNomUrl(1);
}
if (!empty($conf->global->CASHDESK_ID_BANKACCOUNT_CB))
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"]))
{
$bankcb=new Account($db);
$bankcb->fetch($conf->global->CASHDESK_ID_BANKACCOUNT_CB);
$bankcb->fetch($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"]);
$bankcbLink = $bankcb->getNomUrl(1);
}
if (!empty($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE))
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"]))
{
$bankcheque=new Account($db);
$bankcheque->fetch($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE);
$bankcheque->fetch($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"]);
$bankchequeLink = $bankcheque->getNomUrl(1);
}
if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && ! empty($conf->stock->enabled))

View File

@ -49,20 +49,20 @@ $langs->load("main");
case 'ESP':
echo $langs->trans("Cash");
$filtre='courant=2';
if (!empty($conf->global->CASHDESK_ID_BANKACCOUNT_CASH))
$selected = $conf->global->CASHDESK_ID_BANKACCOUNT_CASH;
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"]))
$selected = $_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"];
break;
case 'CB':
echo $langs->trans("CreditCard");
$filtre='courant=1';
if (!empty($conf->global->CASHDESK_ID_BANKACCOUNT_CB))
$selected = $conf->global->CASHDESK_ID_BANKACCOUNT_CB;
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"]))
$selected = $_SESSION["CASHDESK_ID_BANKACCOUNT_CB"];
break;
case 'CHQ':
echo $langs->trans("Cheque");
$filtre='courant=1';
if (!empty($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE))
$selected = $conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE;
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"]))
$selected = $_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"];
break;
case 'DIF':
echo $langs->trans("Reported");