Fix warning when order edit lock is released mid page load (#41278)
This commit is contained in:
parent
b608d0e79e
commit
ba43dce533
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Prevent PHP warning when order lock is released during page load.
|
|
@ -237,6 +237,10 @@ class Edit {
|
|||
// Order updated message.
|
||||
$this->message = 1;
|
||||
|
||||
// Claim lock.
|
||||
$edit_lock = wc_get_container()->get( EditLock::class );
|
||||
$edit_lock->lock( $this->order );
|
||||
|
||||
$this->redirect_order( $this->order );
|
||||
}
|
||||
|
||||
|
|
|
@ -166,9 +166,9 @@ class EditLock {
|
|||
* @return void
|
||||
*/
|
||||
public function render_dialog( $order ) {
|
||||
$locked = $this->is_locked_by_another_user( $order );
|
||||
$lock = $this->get_lock( $order );
|
||||
$user = get_user_by( 'id', $lock['user_id'] );
|
||||
$user = $lock ? get_user_by( 'id', $lock['user_id'] ) : false;
|
||||
$locked = $user && ( get_current_user_id() !== $user->ID );
|
||||
|
||||
$edit_url = wc_get_container()->get( \Automattic\WooCommerce\Internal\Admin\Orders\PageController::class )->get_edit_url( $order->get_id() );
|
||||
|
||||
|
|
Loading…
Reference in New Issue