Merge branch 'fix/500-module-invite' into 'master'
fix errror 500 : See merge request dev-antadis/bebeboutik!12
This commit is contained in:
commit
a8669628ff
@ -1225,7 +1225,7 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor=
|
||||
public function hookPreProcess($params)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
|
||||
if(Configuration::get('INVITE_CREDIT_ENABLE') == 1 && $cookie->isLogged()) {
|
||||
global $smarty, $page_name, $cart;
|
||||
$smarty->assign('customer_credit', $this->_get_credit((int) $cookie->id_customer, FALSE, FALSE, 'frontoffice'));
|
||||
@ -1261,7 +1261,7 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor=
|
||||
public function hookAdminCustomers($params)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
|
||||
$orders = isset($params['orders']) ? $params['orders'] : array();
|
||||
$customer = new Customer((int) $params['id_customer']);
|
||||
|
||||
@ -1269,7 +1269,7 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor=
|
||||
die (Tools::displayError('Incorrect object Customer.'));
|
||||
|
||||
$result = '';
|
||||
|
||||
|
||||
// Add / Modify a sponsor
|
||||
if (Tools::getIsset('submitAddSponsor')) {
|
||||
$id_sponsor = Tools::getValue('id_sponsor');
|
||||
@ -1325,15 +1325,15 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor=
|
||||
when_invite = 0 WHERE id_invite='.$checkSentLink['id_invite'].'
|
||||
');
|
||||
}
|
||||
|
||||
|
||||
if (!$result) {
|
||||
$error_edit = $this->l("Impossible d'enregistrer le parain");
|
||||
}
|
||||
|
||||
|
||||
// Create rewards
|
||||
if (count($orders) == 1 && $result) {
|
||||
$sponsorCustomer = new Customer($id_sponsor);
|
||||
$this->_make_rewards($sponsorCustomer->id);
|
||||
$this->_make_rewards($sponsorCustomer->id, FALSE);
|
||||
}
|
||||
}
|
||||
// Replace
|
||||
@ -1391,7 +1391,7 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor=
|
||||
});" class="button">'.$this->l('Click here to add a sponsor').'</button>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$result .= '
|
||||
<div class="clear"> </div>
|
||||
<h2>'.$this->l('Referral program').'</h2>
|
||||
@ -1550,11 +1550,11 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor=
|
||||
|
||||
if((int) $orderState->logable && $nbOrdersCustomer == 1) {
|
||||
if(Configuration::get('INVITE_REWARD_SPONSOR_ON') == 1) {
|
||||
$this->_make_rewards($sponsor);
|
||||
$this->_make_rewards($sponsor, FALSE, $invite);
|
||||
}
|
||||
|
||||
if(Configuration::get('INVITE_REWARD_SPONSORED_ON') == 1) {
|
||||
$this->_make_rewards($customer, TRUE);
|
||||
$this->_make_rewards($customer, TRUE, $invite);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@ -1628,11 +1628,11 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor=
|
||||
$invite = $invite[0];
|
||||
|
||||
if(Configuration::get('INVITE_REWARD_SPONSOR_ON') == 0) {
|
||||
$this->_make_rewards($sponsor);
|
||||
$this->_make_rewards($sponsor, FALSE, $invite);
|
||||
}
|
||||
|
||||
if(Configuration::get('INVITE_REWARD_SPONSORED_ON') == 0) {
|
||||
$this->_make_rewards($newCustomer, TRUE);
|
||||
$this->_make_rewards($newCustomer, TRUE, $invite);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@ -1677,7 +1677,7 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor=
|
||||
}
|
||||
}
|
||||
|
||||
private function _make_rewards($customer, $sponsored=FALSE)
|
||||
private function _make_rewards($customer, $sponsored=FALSE, $invite = null)
|
||||
{
|
||||
global $cookie;
|
||||
$reward_type = Configuration::get('INVITE_REWARD_SPONSOR'.($sponsored? 'ED': '').'_TYPE');
|
||||
|
Loading…
Reference in New Issue
Block a user