Merge branch 'ticket-payboxAgreement' into develop

This commit is contained in:
Marion Muszynski 2016-10-06 14:47:16 +02:00
commit 3b9e7d45e9
3 changed files with 20 additions and 3 deletions

View File

@ -60,7 +60,7 @@ $devise = 978;
$numbers = urldecode($paybox_card['handle']);
$dateval = $paybox_card['date'];
$customer = new Customer((int)$cart->id_customer);
$refabonne = $customer->email;
$refabonne = $paybox_card['refabonne'];
$language = new Language((int)$cart->id_lang);
switch ($language->iso_code)
{

View File

@ -28,7 +28,16 @@ $pbx_ipn = $ps_url.'modules/'.$module->name.'/validation.php';
$pbx_link = $ps_url.'modules/'.$module->name.'/paiement.php';
$save_paybox = Tools::getValue('save_paybox', false);
$refabonne = $customer->email;
if($save_paybox) {
$count_cards = Db::getInstance()->getValue('
SELECT COUNT(`id_paybox_card`)
FROM `'._DB_PREFIX_.'paybox_customer_agreement`
WHERE `id_customer` = '.(int)$cart->id_customer.'
');
if ($count_cards) {
$refabonne = $customer->email.((int)$count_cards+1);
}
$pbx_retour = 'm:M;r:R;t:T;a:A;b:B;p:P;c:C;s:S;y:Y;e:E;n:N;j:J;d:D;u:U;k:K';
} else {
$pbx_retour = 'm:M;r:R;t:T;a:A;b:B;p:P;c:C;s:S;y:Y;e:E;n:N;j:J;d:D;k:K';
@ -73,7 +82,7 @@ switch ($language->iso_code)
}
unset($language);
$params = "PBX_MODE=4 PBX_SITE=".$pbx_site." PBX_RANG=".$pbx_rang." PBX_TOTAL=".$pbx_total." PBX_DEVISE=".$pbx_devise." PBX_CMD=".(int)$cart->id." PBX_PORTEUR=".$customer->email." PBX_REFABONNE=".$customer->email." PBX_RETOUR='".$pbx_retour."' PBX_IDENTIFIANT=".$pbx_id." PBX_EFFECTUE='".$pbx_confurl."' PBX_ANNULE='".$pbx_cancelurl."' PBX_LANGUE='".$pbx_langue."' PBX_REFUSE='".$pbx_confurl."' PBX_REPONDRE_A='".$pbx_ipn."'";
$params = "PBX_MODE=4 PBX_SITE=".$pbx_site." PBX_RANG=".$pbx_rang." PBX_TOTAL=".$pbx_total." PBX_DEVISE=".$pbx_devise." PBX_CMD=".(int)$cart->id." PBX_PORTEUR=".$customer->email." PBX_REFABONNE=".$refabonne." PBX_RETOUR='".$pbx_retour."' PBX_IDENTIFIANT=".$pbx_id." PBX_EFFECTUE='".$pbx_confurl."' PBX_ANNULE='".$pbx_cancelurl."' PBX_LANGUE='".$pbx_langue."' PBX_REFUSE='".$pbx_confurl."' PBX_REPONDRE_A='".$pbx_ipn."'";
if( Configuration::get('PBX_DEMO_MODE') == 0 ) {
if (_PS_MOBILE_) {

View File

@ -365,11 +365,19 @@ class Paybox extends PaymentModule
FROM `ps_paybox_customer_agreement`
WHERE `handle` = "'.pSQL($handle[0]).'"
AND `date`="'.pSQL($date).'"
AND `refabonne`='.pSQL($refabonne).'
AND `payment_type`="'.pSQL($payment).'"
AND `id_customer`='.(int)$id_customer.'
');
if (empty($exists)) {
$count_cards = Db::getInstance()->getValue('
SELECT COUNT(`id_paybox_card`)
FROM `'._DB_PREFIX_.'paybox_customer_agreement`
WHERE `id_customer` = '.(int)$cart->id_customer.'
');
if ($count_cards) {
$refabonne = $customer->email.((int)$count_cards+1);
}
$num_value = (int)$values["n"].'XXXXX'.(int)$values["j"];
$save = Db::getInstance()->execute('
INSERT INTO `ps_paybox_customer_agreement`