Skip to content

Commit 2193582

Browse files
authored
Merge pull request #197 from MultinetInteractive/master
2.0.17
2 parents 838d161 + 626fcaf commit 2193582

14 files changed

Lines changed: 76 additions & 25 deletions

.scrutinizer.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ filter:
1515
- libraries/
1616
excluded_paths:
1717
- 'tests/*'
18-
- scripts/
18+
- scripts/
19+
- Composer/

class/class-eduadmin-bookinghandler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ private function get_contact_person() {
415415
$contact->PriceNameId = intval( $_POST['contactPriceName'] ); // Var input okay.
416416
}
417417

418-
$contact->CanLogin = !!get_option( 'eduadmin-useLogin', false );
418+
$contact->CanLogin = ! ! get_option( 'eduadmin-useLogin', false );
419419
$contact->Answers = $this->get_contact_questions();
420420
$contact->CustomFields = $this->get_contact_custom_fields();
421421
$contact->Sessions = $this->get_contact_sessions();
@@ -872,8 +872,8 @@ private function get_answer_data( $key, $question_answer_id, $question_type ) {
872872
case 'dropdown':
873873
case 'check':
874874
case 'radio':
875-
$question_answer_id = $_POST[ $key ]; // Var input okay.
876-
$answer->AnswerId = intval( $question_answer_id );
875+
$question_answer_id = $_POST[ $key ]; // Var input okay.
876+
$answer->AnswerId = intval( $question_answer_id );
877877
$answer->AnswerValue = true;
878878
break;
879879
default:

class/class-eduadmin-bookinginfo.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
<?php
2+
23
// phpcs:disable WordPress.NamingConventions
34
class EduAdmin_BookingInfo {
45
/**
5-
* @var stdClass|object
6+
* @var stdClass|object|array
67
*/
78
public $EventBooking;
89
/**
9-
* @var stdClass|object
10+
* @var stdClass|object|array
1011
*/
1112
public $Customer;
1213
/**
13-
* @var stdClass|object
14+
* @var stdClass|object|array
1415
*/
1516
public $Contact;
1617
/**
@@ -21,9 +22,9 @@ class EduAdmin_BookingInfo {
2122
/**
2223
* EduAdminBookingInfo constructor.
2324
*
24-
* @param null $event_booking
25-
* @param null $customer
26-
* @param null $contact
25+
* @param stdClass|object|array|null $event_booking
26+
* @param stdClass|object|array|null $customer
27+
* @param stdClass|object|array|null $contact
2728
*/
2829
public function __construct( $event_booking = null, $customer = null, $contact = null ) {
2930
$this->EventBooking = $event_booking;

class/class-eduadmin-loginhandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function __construct() {
1515
public function process_login() {
1616
if ( ! empty( $_POST['edu-login-ver'] ) && wp_verify_nonce( $_POST['edu-login-ver'], 'edu-profile-login' ) ) {
1717
$surl = get_home_url();
18-
$cat = get_option( 'eduadmin-rewriteBaseUrl' );
18+
$cat = get_option( 'eduadmin-rewriteBaseUrl', '' );
1919
$base_url = $surl . '/' . $cat;
2020

2121
$regular_login = ! empty( $_POST['eduformloginaction'] ) && 'login' === sanitize_text_field( wp_unslash( $_POST['eduformloginaction'] ) ); // Input var okay.

content/template/bookingTemplate/-check-email.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
required autocomplete="off" title="<?php
3737
/* translators: %s is the chosen field to use for login */
3838
echo esc_attr( sprintf( __( 'Please enter your %s here', 'eduadmin-booking' ), $login_label ) );
39-
?>" placeholder="<?php echo esc_attr( $login_label ); ?>" value="<?php echo @esc_attr( $login_value ); ?>" />
39+
?>" placeholder="<?php echo esc_attr( $login_label ); ?>" value="<?php echo esc_attr( $login_value ); ?>" />
4040
</div>
4141
</label>
4242
<input type="submit" class="bookingLoginButton cta-btn"<?php echo( 'CivicRegistrationNumber' === $selected_login_field && 'true' === get_option( 'eduadmin-validateCivicRegNo', false ) ? ' onclick="if(!eduBookingView.ValidateCivicRegNo()) { alert(\'' . esc_js( __( 'Please enter a valid swedish civic registration number.', 'eduadmin-booking' ) ) . '\'); return false; }"' : '' ); ?>

content/template/bookingTemplate/-login-form.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
<input type="hidden" name="eduReturnUrl" value="<?php echo esc_attr( $_SERVER['REQUEST_URI'] ); ?>"/>
55
<h3><?php esc_html_e( 'Please login to continue.', 'eduadmin-booking' ); ?></h3>
66
<?php
7+
$login_value = ! empty( $_POST['eduadminloginEmail'] ) ? sanitize_text_field( $_POST['eduadminloginEmail'] ) : '';
8+
79
$selected_login_field = get_option( 'eduadmin-loginField', 'Email' );
810
$login_label = __( 'E-mail address', 'eduadmin-booking' );
911
$field_type = 'text';
@@ -26,7 +28,7 @@
2628
<div class="loginLabel"><?php echo esc_html( $login_label ); ?></div>
2729
<div class="loginInput">
2830
<input type="<?php echo esc_attr( $field_type ); ?>" name="eduadminloginEmail"<?php echo( 'CivicRegistrationNumber' === $selected_login_field ? ' class="eduadmin-civicRegNo" onblur="eduBookingView.ValidateCivicRegNo();"' : '' ); ?>
29-
required autocomplete="off" title="<?php echo esc_attr( sprintf( __( 'Please enter your %s here', 'eduadmin-booking' ), $login_label ) ); ?>" placeholder="<?php echo esc_attr( $login_label ); ?>" value="<?php echo @esc_attr( sanitize_text_field( $_POST['eduadminloginEmail'] ) ); ?>"/>
31+
required autocomplete="off" title="<?php echo esc_attr( sprintf( __( 'Please enter your %s here', 'eduadmin-booking' ), $login_label ) ); ?>" placeholder="<?php echo esc_attr( $login_label ); ?>" value="<?php echo esc_attr( $login_value ); ?>"/>
3032
</div>
3133
</label>
3234
<label>

content/template/detailTemplate/blocks/event-item.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,13 @@
3535
?>
3636
</div>
3737
<?php } ?>
38-
<div class="eventStatus<?php echo esc_attr( $group_by_city_class ); ?>">
38+
<div class="eventStatus<?php echo esc_attr( $group_by_city_class ); ?>"
39+
data-spots-left="<?php echo esc_attr(intval($ev['ParticipantNumberLeft'])); ?>"
40+
data-max-spots="<?php echo esc_attr(intval( $ev['MaxParticipantNumber'] )); ?>"
41+
data-spots-left-option="<?php echo esc_attr($spot_left_option); ?>"
42+
data-spots-settings="<?php echo esc_attr($spot_settings); ?>"
43+
data-always-few-spots="<?php echo esc_attr($always_few_spots); ?>"
44+
>
3945
<?php
4046
$spots_left = intval( $ev['ParticipantNumberLeft'] );
4147
echo '<span class="spotsLeftInfo">' . esc_html( get_spots_left( $spots_left, intval( $ev['MaxParticipantNumber'] ), $spot_left_option, $spot_settings, $always_few_spots ) ) . '</span>';

content/template/detailTemplate/blocks/event-list.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
?>
2121
<?php if ( $allow_region_search && empty( $_GET['eid'] ) ) : ?>
22+
<h3><?php esc_html_e('Region', 'eduadmin-booking'); ?></h3>
2223
<div class="search-regionitems">
2324
<?php
2425
include EDUADMIN_PLUGIN_PATH . '/content/template/listTemplate/search/region.php';

content/template/detailTemplate/course-info.php

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,28 @@
6464
$cat = get_option( 'eduadmin-rewriteBaseUrl' );
6565
$base_url = $surl . '/' . $cat;
6666

67-
$events = $selected_course['Events'];
67+
$events = array();
68+
69+
foreach ( $selected_course['Events'] as $event ) {
70+
$event['CourseTemplate'] = $selected_course;
71+
unset( $event['CourseTemplate']['Events'] );
72+
73+
$pricenames = array();
74+
foreach ( $selected_course['PriceNames'] as $pn ) {
75+
$pricenames[] = $pn['Price'];
76+
}
77+
foreach ( $event['PriceNames'] as $pn ) {
78+
$pricenames[] = $pn['Price'];
79+
}
80+
81+
$event = array_merge( $event['CourseTemplate'], $event );
82+
83+
$min_price = min( $pricenames );
84+
$event['Price'] = $min_price;
85+
$event['PriceNames'] = $pricenames;
86+
87+
$events[] = $event;
88+
}
6889

6990
$tr = EDU()->start_timer( 'GetRegions' );
7091
$regions = get_transient( 'eduadmin-regions' . '__' . EDU()->version );
@@ -99,6 +120,19 @@
99120
} );
100121
}
101122

123+
$order_by = array();
124+
$order = array( 1 );
125+
$order_option = ( ! ! $group_by_city ? 'City' : 'StartDate' );
126+
127+
array_push( $order_by, $order_option );
128+
array_push( $order, 1 );
129+
if ( $order_option == 'City' ) {
130+
array_push( $order_by, 'StartDate' );
131+
array_push( $order, 1 );
132+
}
133+
134+
$events = sortEvents( $events, $order_by, $order );
135+
102136
$prices = array();
103137

104138
if ( ! empty( $selected_course['PriceNames'] ) ) {
@@ -124,7 +158,7 @@
124158
$org = EDUAPI()->REST->Organisation->GetOrganisation();
125159
set_transient( 'eduadmin-organization' . '__' . EDU()->version, $org, DAY_IN_SECONDS );
126160
}
127-
$inc_vat = $org['PriceIncVat'];
161+
$inc_vat = $org['PriceIncVat'];
128162
$show_headers = get_option( 'eduadmin-showDetailHeaders', true );
129163

130164
$hide_sections = array();

content/template/listTemplate/list-courses.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
$surl = get_home_url();
3-
$cat = get_option( 'eduadmin-rewriteBaseUrl' );
3+
$cat = get_option( 'eduadmin-rewriteBaseUrl', '' );
44
$base_url = $surl . '/' . $cat;
55

66
$fetch_months = get_option( 'eduadmin-monthsToFetch', 6 );
@@ -156,7 +156,7 @@
156156
$show_next_event_date = get_option( 'eduadmin-showNextEventDate', false );
157157
$show_course_locations = get_option( 'eduadmin-showCourseLocations', false );
158158
$show_event_price = get_option( 'eduadmin-showEventPrice', false );
159-
$org = get_transient( 'eduadmin-organization' . '__' . EDU()->version );
159+
$org = get_transient( 'eduadmin-organization' . '__' . EDU()->version );
160160
if ( ! $org ) {
161161
$org = EDUAPI()->REST->Organisation->GetOrganisation();
162162
set_transient( 'eduadmin-organization' . '__' . EDU()->version, $org, DAY_IN_SECONDS );

0 commit comments

Comments
 (0)