Only check takepos configuration if a terminal is choosen, to prevent error message
This commit is contained in:
parent
02f21d478a
commit
a39f469a50
@ -978,36 +978,39 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
|
||||
<?php
|
||||
|
||||
// TakePOS setup check
|
||||
$sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_paiement";
|
||||
$sql .= " WHERE entity IN (".getEntity('c_paiement').")";
|
||||
$sql .= " AND active = 1";
|
||||
$sql .= " ORDER BY libelle";
|
||||
if ( isset( $_SESSION["takeposterminal"] ) && $_SESSION["takeposterminal"] ) {
|
||||
$sql = "SELECT code, libelle FROM " . MAIN_DB_PREFIX . "c_paiement";
|
||||
$sql .= " WHERE entity IN (" . getEntity( 'c_paiement' ) . ")";
|
||||
$sql .= " AND active = 1";
|
||||
$sql .= " ORDER BY libelle";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
$paiementsModes = array();
|
||||
if ($resql) {
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
$paycode = $obj->code;
|
||||
if ($paycode == 'LIQ') {
|
||||
$paycode = 'CASH';
|
||||
}
|
||||
if ($paycode == 'CHQ') {
|
||||
$paycode = 'CHEQUE';
|
||||
}
|
||||
$resql = $db->query( $sql );
|
||||
$paiementsModes = array();
|
||||
if ( $resql ) {
|
||||
while ( $obj = $db->fetch_object( $resql ) ) {
|
||||
$paycode = $obj->code;
|
||||
if ( $paycode == 'LIQ' ) {
|
||||
$paycode = 'CASH';
|
||||
}
|
||||
if ( $paycode == 'CHQ' ) {
|
||||
$paycode = 'CHEQUE';
|
||||
}
|
||||
|
||||
$constantforkey = "CASHDESK_ID_BANKACCOUNT_".$paycode.$_SESSION["takeposterminal"];
|
||||
//var_dump($constantforkey.' '.$conf->global->$constantforkey);
|
||||
if (!empty($conf->global->$constantforkey) && $conf->global->$constantforkey > 0) {
|
||||
array_push($paiementsModes, $obj);
|
||||
$constantforkey = "CASHDESK_ID_BANKACCOUNT_" . $paycode . $_SESSION["takeposterminal"];
|
||||
//var_dump($constantforkey.' '.$conf->global->$constantforkey);
|
||||
if ( ! empty( $conf->global->$constantforkey ) && $conf->global->$constantforkey > 0 ) {
|
||||
array_push( $paiementsModes, $obj );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty( $paiementsModes ) ) {
|
||||
$langs->load( 'errors' );
|
||||
setEventMessages( $langs->trans( "ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv( "TakePOS" ) ), null, 'errors' );
|
||||
setEventMessages( $langs->trans( "ProblemIsInSetupOfTerminal", $_SESSION["takeposterminal"] ), null, 'errors' );
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($paiementsModes)) {
|
||||
$langs->load('errors');
|
||||
setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("TakePOS")), null, 'errors');
|
||||
setEventMessages($langs->trans("ProblemIsInSetupOfTerminal", $_SESSION["takeposterminal"]), null, 'errors');
|
||||
}
|
||||
if (count($maincategories) == 0) {
|
||||
if ($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0) {
|
||||
$tmpcategory = new Categorie($db);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user