|
|
|
@ -40,6 +40,7 @@ if (empty($currency)) { |
|
|
|
Display::addFlash( |
|
|
|
Display::addFlash( |
|
|
|
Display::return_message($plugin->get_lang('CurrencyIsNotConfigured'), 'error') |
|
|
|
Display::return_message($plugin->get_lang('CurrencyIsNotConfigured'), 'error') |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
$currency = null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$currencyIso = null; |
|
|
|
$currencyIso = null; |
|
|
|
@ -69,30 +70,44 @@ if ($editingCourse) { |
|
|
|
$defaultBeneficiaries[] = $teacher->getId(); |
|
|
|
$defaultBeneficiaries[] = $teacher->getId(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$currentBeneficiaries = $plugin->getItemBeneficiaries($courseItem['item_id']); |
|
|
|
if (!empty($courseItem['item_id'])) { |
|
|
|
if (!empty($currentBeneficiaries)) { |
|
|
|
$currentBeneficiaries = $plugin->getItemBeneficiaries($courseItem['course_id']); |
|
|
|
$defaultBeneficiaries = array_column($currentBeneficiaries, 'user_id'); |
|
|
|
if (!empty($currentBeneficiaries)) { |
|
|
|
if ($commissionsEnable === 'true') { |
|
|
|
$defaultBeneficiaries = array_column($currentBeneficiaries, 'user_id'); |
|
|
|
$defaultCommissions = array_column($currentBeneficiaries, 'commissions'); |
|
|
|
if ($commissionsEnable === 'true') { |
|
|
|
foreach ($defaultCommissions as $defaultCommission) { |
|
|
|
$defaultCommissions = array_column($currentBeneficiaries, 'commissions'); |
|
|
|
$commissions .= $defaultCommission.','; |
|
|
|
foreach ($defaultCommissions as $defaultCommission) { |
|
|
|
|
|
|
|
$commissions .= $defaultCommission.','; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$commissions = substr($commissions, 0, -1); |
|
|
|
} |
|
|
|
} |
|
|
|
$commissions = substr($commissions, 0, -1); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$currencyIso = $courseItem['currency']; |
|
|
|
$currencyIso = $courseItem['currency']; |
|
|
|
$formDefaults = [ |
|
|
|
$formDefaults = [ |
|
|
|
'product_type' => get_lang('Course'), |
|
|
|
'product_type' => get_lang('Course'), |
|
|
|
'id' => $courseItem['course_id'], |
|
|
|
'id' => $courseItem['course_id'], |
|
|
|
'type' => BuyCoursesPlugin::PRODUCT_TYPE_COURSE, |
|
|
|
'type' => BuyCoursesPlugin::PRODUCT_TYPE_COURSE, |
|
|
|
'name' => $courseItem['course_title'], |
|
|
|
'name' => $courseItem['course_title'], |
|
|
|
'visible' => $courseItem['visible'], |
|
|
|
'visible' => $courseItem['visible'], |
|
|
|
'price' => $courseItem['price'], |
|
|
|
'price' => $courseItem['price'], |
|
|
|
'tax_perc' => $courseItem['tax_perc'], |
|
|
|
'tax_perc' => $courseItem['tax_perc'], |
|
|
|
'beneficiaries' => $defaultBeneficiaries, |
|
|
|
'beneficiaries' => $defaultBeneficiaries, |
|
|
|
$commissionsEnable == 'true' ? 'commissions' : '' => $commissionsEnable == 'true' ? $commissions : '', |
|
|
|
$commissionsEnable == 'true' ? 'commissions' : '' => $commissionsEnable == 'true' ? $commissions : '', |
|
|
|
]; |
|
|
|
]; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$formDefaults = [ |
|
|
|
|
|
|
|
'product_type' => get_lang('Course'), |
|
|
|
|
|
|
|
'id' => $courseItem['course_id'], |
|
|
|
|
|
|
|
'type' => BuyCoursesPlugin::PRODUCT_TYPE_COURSE, |
|
|
|
|
|
|
|
'name' => $courseItem['course_title'], |
|
|
|
|
|
|
|
'visible' => false, |
|
|
|
|
|
|
|
'price' => 0, |
|
|
|
|
|
|
|
'tax_perc' => 0, |
|
|
|
|
|
|
|
'beneficiaries' => [], |
|
|
|
|
|
|
|
$commissionsEnable == 'true' ? 'commissions' : '' => $commissionsEnable == 'true' ? '' : '', |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
} |
|
|
|
} elseif ($editingSession) { |
|
|
|
} elseif ($editingSession) { |
|
|
|
if (!$includeSession) { |
|
|
|
if (!$includeSession) { |
|
|
|
api_not_allowed(true); |
|
|
|
api_not_allowed(true); |
|
|
|
@ -175,7 +190,7 @@ if ($commissionsEnable === 'true') { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
showSliders(100, 'default', '".$commissions."'); |
|
|
|
showSliders(100, 'default', '".$commissions."'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var maxPercentage = 100; |
|
|
|
var maxPercentage = 100; |
|
|
|
$('#selectBox').on('change', function() { |
|
|
|
$('#selectBox').on('change', function() { |
|
|
|
$('#panelSliders').html(''); |
|
|
|
$('#panelSliders').html(''); |
|
|
|
|