Enable/Disable credit display

This commit is contained in:
Michael RICOIS 2018-02-14 14:54:13 +01:00
parent 7b734c9b60
commit 1903c42573
2 changed files with 24 additions and 9 deletions

View File

@ -75,7 +75,8 @@ if($canSendInvitations) {
if (Tools::isSubmit('submitSponsorFriends')
&& Tools::getValue('friendsEmail')
&& sizeof($friendsEmail = Tools::getValue('friendsEmail')) >= 1) {
if(!Tools::getValue('conditionsValided')) {
if (!Tools::getValue('conditionsValided')) {
$error = 'conditions not valided';
} else {
$friendsLastName = Tools::getValue('friendsLastName');
@ -175,11 +176,11 @@ if($canSendInvitations) {
}
}
if(Tools::isSubmit('revive')) {
if (Tools::isSubmit('revive')) {
$activeTab = 'pending';
if(Tools::getValue('friendChecked') && sizeof($friendsChecked = Tools::getValue('friendChecked')) >= 1) {
foreach($friendsChecked as $key => $friendChecked) {
if($invite->isFriend((int) $cookie->id_customer, (int) $key)) {
if (Tools::getValue('friendChecked') && sizeof($friendsChecked = Tools::getValue('friendChecked')) >= 1) {
foreach ($friendsChecked as $key => $friendChecked) {
if ($invite->isFriend((int) $cookie->id_customer, (int) $key)) {
$infos = $invite->getInvite((int) $key);
if(Configuration::get('INVITE_FORM_LINKFORMAT')) {
@ -235,13 +236,22 @@ if($canSendInvitations) {
}
$oi_services = FALSE;
if($oi_enable = Configuration::get('INVITE_OPENINVITER_ENABLE')) {
if ($oi_enable = Configuration::get('INVITE_OPENINVITER_ENABLE')) {
include('openinviter/openinviter.php');
$inviter = new OpenInviter();
$oi_services = $inviter->getPlugins();
}
$customer_credit = $invite->_get_credit((int) $cookie->id_customer, false, false, 'frontoffice');
$display_credits = true;
$sql = 'SELECT id_customer FROM `'._DB_PREFIX_.'customer_credits` WHERE id_customer = ' . (int)$customer->id;
if (Db::getInstance()->getValue($sql)){
$display_credits = false;
}
$customer_credit = 0;
if ($display_credits === false) {
$customer_credit = $invite->_get_credit((int) $cookie->id_customer, false, false, 'frontoffice');
}
$smarty->assign(array(
'activeTab' => $activeTab,
@ -269,6 +279,7 @@ $smarty->assign(array(
'subscribeFriends' => $invite->getFriends($customer->id),
'currency' => $currency->sign,
'customer_credit' => $customer_credit,
'credits_display' => $display_credits,
));
echo Module::display(dirname(__FILE__).'/invite.php', 'invite-program.tpl');

View File

@ -50,15 +50,19 @@
<div class="block_invite_tab">
<ul class="idTabs">
{if $credits_display == true}
<li><a href="#idTab1" {if $activeTab=='credit'}class="selected"{/if}>{l s='Credit parrainage disponible' mod='invite'}</a></li>
{/if}
<li><a href="#idTab2" {if $activeTab=='sponsor'}class="selected"{/if}>{l s='Sponsor my friends' mod='invite'}</a></li>
<li><a href="#idTab3" {if $activeTab=='pending'}class="selected"{/if}>{l s='Pending friends' mod='invite'}</a></li>
<li><a href="#idTab4" {if $activeTab=='subscribed'}class="selected"{/if}>{l s='Friends I sponsored' mod='invite'}</a></li>
</ul>
<div class="sheets">
{if $credits_display == true}
<div id="idTab1">
{include file="tab-credit.tpl"}
</div>
{/if}
<div id="idTab2">
{include file="tab1.tpl"}
</div>