| @@ -935,9 +935,23 @@ | ||
| 935 | 935 | } else { |
| 936 | 936 | $status = $default_status; |
| 937 | 937 | } |
| 938 | 938 | } else { |
| 939 | - $current_status = ( new Booking( $id ) )->get_status(); | |
| 939 | + $current_booking = new Booking( $id ); | |
| 940 | + | |
| 941 | + // Reschedule only moves time. | |
| 942 | + if ( (int) $current_booking->get_appointment() !== $appointment ) { | |
| 943 | + return new WP_HTTP_Response( | |
| 944 | + [ | |
| 945 | + 'status_code' => 403, | |
| 946 | + 'success' => 0, | |
| 947 | + 'message' => esc_html__( 'You can not change the appointment of a booking.', 'timetics' ), | |
| 948 | + ], | |
| 949 | + 403 | |
| 950 | + ); | |
| 951 | + } | |
| 952 | + | |
| 953 | + $current_status = $current_booking->get_status(); | |
| 940 | 954 | if ( 'cancel' === $client_status ) { |
| 941 | 955 | $status = 'cancel'; |
| 942 | 956 | } else { |
| 943 | 957 | $status = $current_status; |
| @@ -1100,9 +1114,9 @@ | ||
| 1100 | 1114 | 'date' => $date, |
| 1101 | 1115 | 'end_date' => $end_date, |
| 1102 | 1116 | 'start_time' => $start_time, |
| 1103 | 1117 | 'end_time' => $end_time, |
| 1104 | - 'order_total' => $this->calculate_order_total( $data ), | |
| 1118 | + 'order_total' => ( $id && ! $is_privileged ) ? $booking->get_total() : $this->calculate_order_total( $data ), | |
| 1105 | 1119 | 'post_status' => $status, |
| 1106 | 1120 | 'location' => $location, |
| 1107 | 1121 | 'location_type' => $location_type, |
| 1108 | 1122 | 'timezone' => $timezone, |