Merge branch 'ticket-payboxAgreement' into develop
This commit is contained in:
commit
3e8ec797fb
@ -11,6 +11,17 @@ $controller->preProcess();
|
||||
if (!$cookie->isLogged())
|
||||
Tools::redirect('authentication.php');
|
||||
|
||||
// verif if there's at least one order with this delivery address
|
||||
$orders_with_delivery_address = Db::getInstance()->getValue('
|
||||
SELECT COUNT(`id_order`)
|
||||
FROM `'._DB_PREFIX_.'orders`
|
||||
WHERE `id_address_delivery` = '.(int)$cart->id_address_delivery.'
|
||||
AND `id_customer` = '.(int)$cart->id_customer.'
|
||||
');
|
||||
if ($orders_with_delivery_address == 0) {
|
||||
Tools::redirect('order.php?step=3&cgv=1&paybox_error=1');
|
||||
}
|
||||
|
||||
$id_paybox_card = Tools::getValue('id_paybox_card', false);
|
||||
if ($id_paybox_card) {
|
||||
$paybox_card = Db::getInstance()->getRow('
|
||||
|
@ -242,13 +242,24 @@ class Paybox extends PaymentModule
|
||||
$pbx_link = $ps_url.'modules/'.$this->name.'/paiement.php';
|
||||
$pbx_link_plus = $ps_url.'modules/'.$this->name.'/direct_paiement.php';
|
||||
|
||||
$paybox_cards = Db::getInstance()->executeS('
|
||||
SELECT `id_paybox_card`, `value`, `date`, `payment_type`
|
||||
FROM `'._DB_PREFIX_.'paybox_customer_agreement`
|
||||
WHERE `id_customer` = '.(int)$cart->id_customer.'
|
||||
// verif if there's at least one order with this delivery address
|
||||
$orders_with_delivery_address = Db::getInstance()->getValue('
|
||||
SELECT COUNT(`id_order`)
|
||||
FROM `'._DB_PREFIX_.'orders`
|
||||
WHERE `id_address_delivery` = '.(int)$cart->id_address_delivery.'
|
||||
AND `id_customer` = '.(int)$cart->id_customer.'
|
||||
');
|
||||
foreach ($paybox_cards as $key => $card) {
|
||||
$paybox_cards[$key]['date_validity'] = substr_replace($card['date'],'/',-2,0);
|
||||
if ($orders_with_delivery_address == 0){
|
||||
$paybox_cards = array();
|
||||
} else {
|
||||
$paybox_cards = Db::getInstance()->executeS('
|
||||
SELECT `id_paybox_card`, `value`, `date`, `payment_type`
|
||||
FROM `'._DB_PREFIX_.'paybox_customer_agreement`
|
||||
WHERE `id_customer` = '.(int)$cart->id_customer.'
|
||||
');
|
||||
foreach ($paybox_cards as $key => $card) {
|
||||
$paybox_cards[$key]['date_validity'] = substr_replace($card['date'],'/',-2,0);
|
||||
}
|
||||
}
|
||||
|
||||
$smarty->assign(array(
|
||||
|
Loading…
Reference in New Issue
Block a user