@@ -26,76 +26,76 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | <?php |
| 28 | 28 | |
| 29 | - // Fires before printing a line item column. |
|
| 30 | - do_action( "getpaid_form_cart_item_before_$key", $item, $form ); |
|
| 29 | + // Fires before printing a line item column. |
|
| 30 | + do_action( "getpaid_form_cart_item_before_$key", $item, $form ); |
|
| 31 | 31 | |
| 32 | - // Item name. |
|
| 33 | - if ( 'name' == $key ) { |
|
| 32 | + // Item name. |
|
| 33 | + if ( 'name' == $key ) { |
|
| 34 | 34 | |
| 35 | - // Display the name. |
|
| 36 | - echo '<div class="mb-1">' . esc_html( $item->get_name() ) . '</div>'; |
|
| 35 | + // Display the name. |
|
| 36 | + echo '<div class="mb-1">' . esc_html( $item->get_name() ) . '</div>'; |
|
| 37 | 37 | |
| 38 | - // And an optional description. |
|
| 38 | + // And an optional description. |
|
| 39 | 39 | $description = $item->get_description(); |
| 40 | 40 | |
| 41 | 41 | if ( ! empty( $description ) ) { |
| 42 | 42 | $description = wp_kses_post( $description ); |
| 43 | 43 | echo "<small class='form-text text-muted pr-2 m-0'>$description</small>"; |
| 44 | - } |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - // Price help text. |
|
| 46 | + // Price help text. |
|
| 47 | 47 | $description = getpaid_item_recurring_price_help_text( $item, $currency ); |
| 48 | 48 | if ( $description ) { |
| 49 | 49 | echo "<small class='getpaid-form-item-price-desc form-text text-muted pr-2 m-0'>$description</small>"; |
| 50 | - } |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - if ( wpinv_current_user_can_manage_invoicing() ) { |
|
| 52 | + if ( wpinv_current_user_can_manage_invoicing() ) { |
|
| 53 | 53 | |
| 54 | - edit_post_link( |
|
| 55 | - __( 'Edit this item.', 'invoicing' ), |
|
| 56 | - '<small class="form-text text-muted">', |
|
| 57 | - '</small>', |
|
| 58 | - $item->get_id(), |
|
| 59 | - 'text-danger' |
|
| 60 | - ); |
|
| 54 | + edit_post_link( |
|
| 55 | + __( 'Edit this item.', 'invoicing' ), |
|
| 56 | + '<small class="form-text text-muted">', |
|
| 57 | + '</small>', |
|
| 58 | + $item->get_id(), |
|
| 59 | + 'text-danger' |
|
| 60 | + ); |
|
| 61 | 61 | |
| 62 | - } |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - } |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - // Item price. |
|
| 67 | - if ( 'price' == $key ) { |
|
| 66 | + // Item price. |
|
| 67 | + if ( 'price' == $key ) { |
|
| 68 | 68 | |
| 69 | - // Set the currency position. |
|
| 70 | - $position = wpinv_currency_position(); |
|
| 69 | + // Set the currency position. |
|
| 70 | + $position = wpinv_currency_position(); |
|
| 71 | 71 | |
| 72 | - if ( $position == 'left_space' ) { |
|
| 73 | - $position = 'left'; |
|
| 74 | - } |
|
| 72 | + if ( $position == 'left_space' ) { |
|
| 73 | + $position = 'left'; |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - if ( $position == 'right_space' ) { |
|
| 77 | - $position = 'right'; |
|
| 78 | - } |
|
| 76 | + if ( $position == 'right_space' ) { |
|
| 77 | + $position = 'right'; |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - if ( $item->user_can_set_their_price() ) { |
|
| 81 | - $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
| 82 | - $minimum = (float) $item->get_minimum_price(); |
|
| 83 | - $validate_minimum = ''; |
|
| 84 | - $class = ''; |
|
| 85 | - $data_minimum = ''; |
|
| 80 | + if ( $item->user_can_set_their_price() ) { |
|
| 81 | + $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
| 82 | + $minimum = (float) $item->get_minimum_price(); |
|
| 83 | + $validate_minimum = ''; |
|
| 84 | + $class = ''; |
|
| 85 | + $data_minimum = ''; |
|
| 86 | 86 | |
| 87 | - if ( $minimum > 0 ) { |
|
| 88 | - $validate_minimum = sprintf( |
|
| 89 | - esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
| 90 | - strip_tags( wpinv_price( $minimum, $currency ) ) |
|
| 91 | - ); |
|
| 87 | + if ( $minimum > 0 ) { |
|
| 88 | + $validate_minimum = sprintf( |
|
| 89 | + esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
| 90 | + strip_tags( wpinv_price( $minimum, $currency ) ) |
|
| 91 | + ); |
|
| 92 | 92 | |
| 93 | - $class = 'getpaid-validate-minimum-amount'; |
|
| 93 | + $class = 'getpaid-validate-minimum-amount'; |
|
| 94 | 94 | |
| 95 | - $data_minimum = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'"; |
|
| 96 | - } |
|
| 95 | + $data_minimum = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'"; |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | - ?> |
|
| 98 | + ?> |
|
| 99 | 99 | <div class="input-group input-group-sm"> |
| 100 | 100 | <?php if( 'left' == $position ) : ?> |
| 101 | 101 | <div class="input-group-prepend"> |
@@ -119,38 +119,38 @@ discard block |
||
| 119 | 119 | </div> |
| 120 | 120 | |
| 121 | 121 | <?php |
| 122 | - } else { |
|
| 123 | - echo wpinv_price( $item->get_price(), $currency ); |
|
| 124 | - ?> |
|
| 122 | + } else { |
|
| 123 | + echo wpinv_price( $item->get_price(), $currency ); |
|
| 124 | + ?> |
|
| 125 | 125 | <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr( $item->get_price() ); ?>'> |
| 126 | 126 | <?php |
| 127 | - } |
|
| 128 | - } |
|
| 127 | + } |
|
| 128 | + } |
|
| 129 | 129 | |
| 130 | - // Item quantity. |
|
| 131 | - if ( 'quantity' == $key ) { |
|
| 130 | + // Item quantity. |
|
| 131 | + if ( 'quantity' == $key ) { |
|
| 132 | 132 | |
| 133 | - if ( $item->allows_quantities() ) { |
|
| 134 | - ?> |
|
| 133 | + if ( $item->allows_quantities() ) { |
|
| 134 | + ?> |
|
| 135 | 135 | <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type='text' style='width: 64px; line-height: 1; min-height: 35px;' class='getpaid-item-quantity-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border' value='<?php echo (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(); ?>' min='1' required> |
| 136 | 136 | <?php |
| 137 | - } else { |
|
| 138 | - echo (float) $item->get_quantity(); |
|
| 139 | - echo ' '; |
|
| 140 | - ?> |
|
| 137 | + } else { |
|
| 138 | + echo (float) $item->get_quantity(); |
|
| 139 | + echo ' '; |
|
| 140 | + ?> |
|
| 141 | 141 | <input type='hidden' name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' class='getpaid-item-quantity-input' value='<?php echo (float) $item->get_quantity(); ?>'> |
| 142 | 142 | <?php |
| 143 | - } |
|
| 143 | + } |
|
| 144 | 144 | |
| 145 | - } |
|
| 145 | + } |
|
| 146 | 146 | |
| 147 | - // Item sub total. |
|
| 148 | - if ( 'subtotal' == $key ) { |
|
| 149 | - echo wpinv_price( $item->get_sub_total(), $currency ); |
|
| 150 | - } |
|
| 147 | + // Item sub total. |
|
| 148 | + if ( 'subtotal' == $key ) { |
|
| 149 | + echo wpinv_price( $item->get_sub_total(), $currency ); |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | - do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
| 153 | - ?> |
|
| 152 | + do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
| 153 | + ?> |
|
| 154 | 154 | |
| 155 | 155 | </div> |
| 156 | 156 | |