Merge branch 'fix/500-module-invite' into 'master'

fix errror 500 :

See merge request dev-antadis/bebeboutik!12
This commit is contained in:
Marion Muszynski 2017-12-05 16:26:11 +01:00
commit a8669628ff

View File

@ -1333,7 +1333,7 @@ RewriteRule ^invite/(.*)$ '.__PS_BASE_URI__.'modules/invite/sponsor.php?sponsor=
// Create rewards
if (count($orders) == 1 && $result) {
$sponsorCustomer = new Customer($id_sponsor);
$this->_make_rewards($sponsorCustomer->id);
$this->_make_rewards($sponsorCustomer->id, FALSE);
}
}
// Replace
@ -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');