| @@ -158,9 +158,9 @@ | ||
| 158 | 158 | <?php endif; ?> |
| 159 | 159 | <?php |
| 160 | 160 | } elseif ( 'subscrpt_next_date' === $column ) { |
| 161 | 161 | $next_date = get_post_meta( $post_id, '_subscrpt_next_date', true ); |
| 162 | - echo ! empty( $next_date ) ? esc_html( wp_date( 'F d, Y', $next_date ) ) : '-'; | |
| 162 | + echo ! empty( $next_date ) && Helper::has_next_payment( get_post_status( $post_id ) ) ? esc_html( wp_date( 'F d, Y', $next_date ) ) : '-'; | |
| 163 | 163 | } elseif ( 'subscrpt_status' === $column ) { |
| 164 | 164 | $status_obj = get_post_status_object( get_post_status( $post_id ) ); |
| 165 | 165 | ?> |
| 166 | 166 | <span |
| @@ -305,15 +305,12 @@ | ||
| 305 | 305 | */ |
| 306 | 306 | public static function process_status_change( $post_id, $action ) { |
| 307 | 307 | $old_status = get_post_status( $post_id ); |
| 308 | 308 | |
| 309 | - wp_update_post( | |
| 310 | - array( | |
| 311 | - 'ID' => $post_id, | |
| 312 | - 'post_status' => $action, | |
| 313 | - ) | |
| 314 | - ); | |
| 315 | - | |
| 309 | + // Do not wp_update_post() the status here: Action::status() and the order | |
| 310 | + // cascade below both skip their hooks (incl. next-date generation) when | |
| 311 | + // the post_status already equals the target, so this must stay the only | |
| 312 | + // place a real transition happens. | |
| 316 | 313 | if ( $old_status !== $action ) { |
| 317 | 314 | $old_status_object = get_post_status_object( $old_status ); |
| 318 | 315 | $new_status_object = get_post_status_object( $action ); |
| 319 | 316 | WC()->mailer(); |