Fix cash payment in some cases. Make pay requests language independant and rely on payment method code.
This commit is contained in:
parent
a39f469a50
commit
807b4bf93e
@ -188,11 +188,9 @@ if ($action == 'valid' && $user->rights->facture->creer) {
|
||||
if (!empty($conf->global->TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT)) {
|
||||
$bankaccount = GETPOST('accountid', 'int');
|
||||
} else {
|
||||
if ($pay == "cash") {
|
||||
if ($pay == 'LIQ') {
|
||||
$bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CASH'.$_SESSION["takeposterminal"]}; // For backward compatibility
|
||||
} elseif ($pay == "card") {
|
||||
$bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CB'.$_SESSION["takeposterminal"]}; // For backward compatibility
|
||||
} elseif ($pay == "cheque") {
|
||||
} elseif ($pay == "CHQ") {
|
||||
$bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$_SESSION["takeposterminal"]}; // For backward compatibility
|
||||
} else {
|
||||
$accountname = "CASHDESK_ID_BANKACCOUNT_".$pay.$_SESSION["takeposterminal"];
|
||||
|
||||
@ -316,23 +316,20 @@ print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad
|
||||
$paycode = $arrayOfValidPaymentModes[0]->code;
|
||||
$payIcon = '';
|
||||
if ($paycode == 'LIQ') {
|
||||
$paycode = 'cash';
|
||||
if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
|
||||
$payIcon = 'coins';
|
||||
}
|
||||
} elseif ($paycode == 'CB') {
|
||||
$paycode = 'card';
|
||||
if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
|
||||
$payIcon = 'credit-card';
|
||||
}
|
||||
} elseif ($paycode == 'CHQ') {
|
||||
$paycode = 'cheque';
|
||||
if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
|
||||
$payIcon = 'money-check';
|
||||
}
|
||||
}
|
||||
|
||||
print '<button type="button" class="calcbutton2" onclick="Validate(\''.$langs->trans($paycode).'\');">'.(!empty($payIcon) ? '<span class="fa fa-2x fa-'.$payIcon.' iconwithlabel"></span><span class="hideonsmartphone"><br>'. $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[0]->code) : $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[0]->code)).'</span></button>';
|
||||
print '<button type="button" class="calcbutton2" onclick="Validate(\''.$paycode.'\');">'.(!empty($payIcon) ? '<span class="fa fa-2x fa-'.$payIcon.' iconwithlabel"></span><span class="hideonsmartphone"><br>'. $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[0]->code) : $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[0]->code)).'</span></button>';
|
||||
} else {
|
||||
print '<button type="button" class="calcbutton2">'.$langs->trans("NoPaimementModesDefined").'</button>';
|
||||
}
|
||||
@ -345,23 +342,20 @@ print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad
|
||||
$paycode = $arrayOfValidPaymentModes[1]->code;
|
||||
$payIcon = '';
|
||||
if ($paycode == 'LIQ') {
|
||||
$paycode = 'cash';
|
||||
if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
|
||||
$payIcon = 'coins';
|
||||
}
|
||||
} elseif ($paycode == 'CB') {
|
||||
$paycode = 'card';
|
||||
if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
|
||||
$payIcon = 'credit-card';
|
||||
}
|
||||
} elseif ($paycode == 'CHQ') {
|
||||
$paycode = 'cheque';
|
||||
if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
|
||||
$payIcon = 'money-check';
|
||||
}
|
||||
}
|
||||
|
||||
print '<button type="button" class="calcbutton2" onclick="Validate(\''.$langs->trans($paycode).'\');">'.(!empty($payIcon) ? '<span class="fa fa-2x fa-'.$payIcon.' iconwithlabel"></span><br> '. $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[1]->code) : $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[1]->code)).'</button>';
|
||||
print '<button type="button" class="calcbutton2" onclick="Validate(\''.$paycode.'\');">'.(!empty($payIcon) ? '<span class="fa fa-2x fa-'.$payIcon.' iconwithlabel"></span><br> '. $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[1]->code) : $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[1]->code)).'</button>';
|
||||
} else {
|
||||
$button = array_pop($action_buttons);
|
||||
print '<button type="button" class="calcbutton2" onclick="'.$button["function"].'"><span '.$button["span"].'>'.$button["text"].'</span></button>';
|
||||
@ -375,23 +369,20 @@ print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad
|
||||
$paycode = $arrayOfValidPaymentModes[2]->code;
|
||||
$payIcon = '';
|
||||
if ($paycode == 'LIQ') {
|
||||
$paycode = 'cash';
|
||||
if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
|
||||
$payIcon = 'coins';
|
||||
}
|
||||
} elseif ($paycode == 'CB') {
|
||||
$paycode = 'card';
|
||||
if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
|
||||
$payIcon = 'credit-card';
|
||||
}
|
||||
} elseif ($paycode == 'CHQ') {
|
||||
$paycode = 'cheque';
|
||||
if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
|
||||
$payIcon = 'money-check';
|
||||
}
|
||||
}
|
||||
|
||||
print '<button type="button" class="calcbutton2" onclick="Validate(\''.$langs->trans($paycode).'\');">'.(!empty($payIcon) ? '<span class="fa fa-2x fa-'.$payIcon.' iconwithlabel"></span>'.(!empty($conf->global->TAKEPOS_NUMPAD_FORCE_PAYMENT_ICONS_LABELS) ? '<br> '. $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[2]->code) : '') : $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[2]->code)).'</button>';
|
||||
print '<button type="button" class="calcbutton2" onclick="Validate(\''.$paycode.'\');">'.(!empty($payIcon) ? '<span class="fa fa-2x fa-'.$payIcon.' iconwithlabel"></span>'.(!empty($conf->global->TAKEPOS_NUMPAD_FORCE_PAYMENT_ICONS_LABELS) ? '<br> '. $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[2]->code) : '') : $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[2]->code)).'</button>';
|
||||
} else {
|
||||
$button = array_pop($action_buttons);
|
||||
print '<button type="button" class="calcbutton2" onclick="'.$button["function"].'"><span '.$button["span"].'>'.$button["text"].'</span></button>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user