Skip to content

Commit

Permalink
GH-639 MUSI-619 Improvement: apply cpfield for blocking campaign
Browse files Browse the repository at this point in the history
  • Loading branch information
eynimeni committed Oct 23, 2024
1 parent 380f56d commit 3fb6ec4
Show file tree
Hide file tree
Showing 10 changed files with 184 additions and 165 deletions.
2 changes: 1 addition & 1 deletion amd/build/dynamiccampaignsform.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion amd/build/dynamiccampaignsform.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions amd/src/dynamiccampaignsform.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ function editCampaignsModal(element) {
}

if (action == "delete") {
// eslint-disable-next-line no-console
console.log("delete");
// A campaign is deleted.
const deleteForm = new ModalForm({

Expand All @@ -79,6 +81,9 @@ function editCampaignsModal(element) {
deleteForm.show();

} else if (action == "edit-or-new") {

// eslint-disable-next-line no-console
console.log("editornew");
// A campaign is added (campaignid == 0) or edited (campaignid > 0).
const modalForm = new ModalForm({
// Name of the class where form is defined (must extend \core_form\dynamic_form):
Expand Down Expand Up @@ -108,8 +113,7 @@ function editCampaignsModal(element) {
if (!e.target.name) {
return;
}
if (e.target.name == 'bookingcampaigntype'
|| e.target.name == 'fieldname') {
if (e.target.name == 'bookingcampaigntype') {
window.skipClientValidation = true;
let button = document.querySelector('[name="btn_bookingcampaigntype"]');
modalForm.processNoSubmitButton(button);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function is_available(booking_option_settings $settings, int $userid, boo
// This is the return value. Not available to begin with.
$isavailable = true;

$result = booking_option::is_blocked_by_campaign($settings);
$result = booking_option::is_blocked_by_campaign($settings, $userid);

if ($result['status']) {
$isavailable = false;
Expand Down
3 changes: 2 additions & 1 deletion classes/booking_campaigns/booking_campaign.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ public function apply_logic(booking_option_settings &$settings, stdClass &$dbrec
/**
* Check if particular campaign is blocking right now.
* @param booking_option_settings $settings the booking option settings class
* @param int $userid blocking can be specific to a user
* @return array
*/
public function is_blocking(booking_option_settings $settings): array;
public function is_blocking(booking_option_settings $settings, int $userid): array;
}
Loading

0 comments on commit 3fb6ec4

Please sign in to comment.