Skip to content

Commit

Permalink
feat: Use SortIndex on custom fields
Browse files Browse the repository at this point in the history
  • Loading branch information
itssimple committed Apr 8, 2021
1 parent 29b1c72 commit 2d1c15c
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 20 deletions.
2 changes: 1 addition & 1 deletion PLUGIN-CHECKSUM
@@ -1 +1 @@
07b20a55c3f0de6d552f20d5af95efce
05a24934d8550bbca37dbf1a0b29e7f1
3 changes: 2 additions & 1 deletion content/template/bookingTemplate/contact-view.php
Expand Up @@ -91,7 +91,8 @@ class="eduadmin-civicRegNo" <?php echo( 'CivicRegistrationNumber' === $selected_
$contact_custom_fields = EDUAPI()->OData->CustomFields->Search(
null,
'ShowOnWeb and CustomFieldOwner eq \'Person\'',
'CustomFieldAlternatives'
'CustomFieldAlternatives',
'SortIndex'
)['value'];
if ( ! empty( $contact_custom_fields ) ) {
foreach ( $contact_custom_fields as $custom_field ) {
Expand Down
3 changes: 2 additions & 1 deletion content/template/bookingTemplate/customer-view.php
Expand Up @@ -226,7 +226,8 @@ class="tooltip-element">
$customer_custom_fields = EDUAPI()->OData->CustomFields->Search(
null,
'ShowOnWeb and CustomFieldOwner eq \'Customer\'',
'CustomFieldAlternatives'
'CustomFieldAlternatives',
'SortIndex'
)['value'];
if ( ! empty( $customer_custom_fields ) ) {
foreach ( $customer_custom_fields as $custom_field ) {
Expand Down
6 changes: 4 additions & 2 deletions content/template/bookingTemplate/single-person-booking.php
Expand Up @@ -305,7 +305,8 @@ class="edu-book-singleParticipant-customerInvoiceOtherInfo">
$contact_custom_fields = EDUAPI()->OData->CustomFields->Search(
null,
'ShowOnWeb and CustomFieldOwner eq \'Person\'',
'CustomFieldAlternatives'
'CustomFieldAlternatives',
'SortIndex'
)['value'];
set_transient( 'eduadmin-customfields_person' . '__' . EDU()->version, $contact_custom_fields, DAY_IN_SECONDS );
}
Expand Down Expand Up @@ -340,7 +341,8 @@ class="edu-book-singleParticipant-customerInvoiceOtherInfo">
$customer_custom_fields = EDUAPI()->OData->CustomFields->Search(
null,
'ShowOnWeb and CustomFieldOwner eq \'Customer\'',
'CustomFieldAlternatives'
'CustomFieldAlternatives',
'SortIndex'
)['value'];
set_transient( 'eduadmin-customfields_customer' . '__' . EDU()->version, $customer_custom_fields, DAY_IN_SECONDS );
}
Expand Down
4 changes: 2 additions & 2 deletions content/template/detailTemplate/course-price-names.php
Expand Up @@ -54,8 +54,8 @@
</h3>
<?php
foreach ( $price_names as $price ) {
echo esc_html( sprintf( '%1$s: %2$s', $price['PriceNameDescription'], edu_get_price( $price['Price'], $edo['ParticipantVat'] ) ) );
echo '<br />';
echo esc_html( sprintf( '<div class="pricename"><span class="pricename-description">%1$s</span>: <span class="pricename-price">%2$s</span></div>', $price['PriceNameDescription'], edu_get_price( $price['Price'], $edo['ParticipantVat'] ) ) );

}
?>
<hr />
Expand Down
5 changes: 1 addition & 4 deletions content/template/detailTemplate/template_A.php
Expand Up @@ -122,10 +122,7 @@ class="courseLevel"><?php echo esc_html( null !== $course_level ? $course_level[
echo esc_html( sprintf( '%1$s %2$s', current( $prices )['PriceNameDescription'], edu_get_price( current( $prices )['Price'], $selected_course['ParticipantVat'] ) ) );
} else {
foreach ( $prices as $up ) {
echo esc_html( sprintf( '%1$s %2$s', $up['PriceNameDescription'], edu_get_price( $up['Price'], $selected_course['ParticipantVat'] ) ) );
?>
<br />
<?php
echo esc_html( sprintf( '<div class="pricename"><span class="pricename-description">%1$s</span>: <span class="pricename-price">%2$s</span></div>', $up['PriceNameDescription'], edu_get_price( $up['Price'], $selected_course['ParticipantVat'] ) ) );
}
}
}
Expand Down
5 changes: 1 addition & 4 deletions content/template/detailTemplate/template_B.php
Expand Up @@ -105,10 +105,7 @@ class="courseLevel"><?php echo esc_html( null !== $course_level ? $course_level[
echo sprintf( '%1$s %2$s', current( $prices )['PriceNameDescription'], edu_get_price( current( $prices )['Price'], $selected_course['ParticipantVat'] ) );
} else {
foreach ( $prices as $up ) {
echo sprintf( '%1$s %2$s', $up['PriceNameDescription'], edu_get_price( $up['Price'], $selected_course['ParticipantVat'] ) );
?>
<br />
<?php
echo esc_html( sprintf( '<div class="pricename"><span class="pricename-description">%1$s</span>: <span class="pricename-price">%2$s</span></div>', $up['PriceNameDescription'], edu_get_price( $up['Price'], $selected_course['ParticipantVat'] ) ) );
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions content/template/programme/book.php
Expand Up @@ -185,7 +185,8 @@ class="last-name" name="contactLastName"
$contact_custom_fields = EDUAPI()->OData->CustomFields->Search(
null,
'ShowOnWeb and CustomFieldOwner eq \'Person\'',
'CustomFieldAlternatives'
'CustomFieldAlternatives',
'SortIndex'
)['value'];

foreach ( $contact_custom_fields as $custom_field ) {
Expand Down Expand Up @@ -404,7 +405,8 @@ class="last-name" name="contactLastName"
$customer_custom_fields = EDUAPI()->OData->CustomFields->Search(
null,
'ShowOnWeb and CustomFieldOwner eq \'Customer\'',
'CustomFieldAlternatives'
'CustomFieldAlternatives',
'SortIndex'
)['value'];

foreach ( $customer_custom_fields as $custom_field ) {
Expand Down
4 changes: 3 additions & 1 deletion includes/detail-settings.php
Expand Up @@ -42,7 +42,9 @@ function edu_render_detail_settings_page() {
$attributes = EDUAPI()->OData->CustomFields->Search(
null,
"ShowOnWeb and CustomFieldOwner eq 'Product' and CustomFieldSubOwner eq 'CourseTemplate'" .
" and (CustomFieldType eq 'Text' or CustomFieldType eq 'Html' or CustomFieldType eq 'Textarea')"
" and (CustomFieldType eq 'Text' or CustomFieldType eq 'Html' or CustomFieldType eq 'Textarea')",
null,
'SortIndex'
);
?>
<i><?php echo esc_html_x( 'Select which field in EduAdmin that should be shown in the page title', 'backend', 'eduadmin-booking' ); ?></i>
Expand Down
2 changes: 1 addition & 1 deletion includes/edu-shortcodes.php
Expand Up @@ -436,7 +436,7 @@ function eduadmin_get_detailinfo( $attributes ) {
$ret_str .= esc_html( edu_get_price( current( $prices )['Price'], $selected_course['ParticipantVat'] ) ) . "\n";
} else {
foreach ( $prices as $price ) {
$ret_str .= esc_html( sprintf( '%1$s: %2$s', $price['PriceNameDescription'], edu_get_price( $price['Price'], $selected_course['ParticipantVat'] ) ) ) . "<br />\n";
$ret_str .= esc_html( sprintf( '<div class="pricename"><span class="pricename-description">%1$s</span>: <span class="pricename-price">%2$s</span></div>', $price['PriceNameDescription'], edu_get_price( $price['Price'], $edo['ParticipantVat'] ) ) ) . "\n";
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion includes/list-settings.php
Expand Up @@ -104,7 +104,9 @@ function edu_render_list_settings_page() {
$attributes = EDUAPI()->OData->CustomFields->Search(
null,
"ShowOnWeb and CustomFieldOwner eq 'Product' and CustomFieldSubOwner eq 'CourseTemplate'" .
" and (CustomFieldType eq 'Text' or CustomFieldType eq 'Html' or CustomFieldType eq 'Textarea')"
" and (CustomFieldType eq 'Text' or CustomFieldType eq 'Html' or CustomFieldType eq 'Textarea')",
null,
'SortIndex'
);
?>
<select name="eduadmin-layout-descriptionfield">
Expand Down

0 comments on commit 2d1c15c

Please sign in to comment.