Skip to content

Commit

Permalink
bugfix for "Exception - Argument 3 passed to mod_booking\booking_camp…
Browse files Browse the repository at this point in the history
…aigns\campaigns_info::check_if_campaign_is_active() must be an instance of mod_booking\booking_campaigns\mixed, string given, called in [dirroot]/mod/booking/classes/booking_campaigns/campaigns/campaign_blockbooking.php on line 272" (#719)
  • Loading branch information
semteacher committed Nov 30, 2024
1 parent af3c3ef commit 088db3f
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions classes/booking_campaigns/campaigns_info.php
Original file line number Diff line number Diff line change
Expand Up @@ -467,20 +467,18 @@ public static function check_if_profilefield_applies(
public static function check_if_campaign_is_active(
int $starttime,
int $endtime,
mixed $fieldname,
$fieldname,
string $fieldvalue,
string $operator): bool {
string $operator
): bool {
$isactive = false;
$now = time();
if ($starttime <= $now && $now <= $endtime) {

if (!empty($fieldname)) {
if (is_string($fieldname)
&& $fieldname === $fieldvalue) {
if (is_string($fieldname) && $fieldname === $fieldvalue) {
// It's a string so we can compare directly.
$isactive = true;
} else if (is_array($fieldname)
&& in_array($fieldvalue, $fieldname)) {
} else if (is_array($fieldname) && in_array($fieldvalue, $fieldname)) {
// It's an array, so we check with in_array.
$isactive = true;
}
Expand Down

0 comments on commit 088db3f

Please sign in to comment.