Intermittent Orders Overwriting 4.4.2

Hi,

We're running 4.4.2 and we seem to have an intermittent error.

When an order has failed the customer has the ability to pay again,

Rather than creating a new order, the store tries to over write the open / failed order.

I have checked the status settings and the store admin settings and this is not how it should act.

I have created the error in my test environment and turned on the error code and pasted the results below.

An order should never be overwritten,

We need a list of all failed orders, (this would also help battle fraud)

The other issue we have is if someone uses the back button on the browser after placing and order successfully, they can go back select an item they forgot and place a new order.

This then over writes the existing placed order,

Needless to say this has played havoc with the warehouse, the stock level, and items not delivered despite being payed for and also for tax when we import / export all orders.

Has anyone else come across this issue?

PHP Notice

Message

Undefined variable: opt_info

Error at

app/functions/fn.cart.php, line: 2298

Backtrace

			File:
		
			app/functions/fn.cart.php
	
			Line:
		
			2298
	
			Function:
		
			{closure}
	
			File:
		
			app/functions/fn.cart.php
	
			Line:
		
			8211
	
			Function:
		
			fn_delete_order
	
			File:
		
			app/controllers/frontend/checkout.php
	
			Line:
		
			380
	
			Function:
		
			fn_checkout_place_order
	
			File:
		
			app/functions/fn.control.php
	
			Line:
		
			700
	
			Function:
		
			include
	
			File:
		
			app/functions/fn.control.php
	
			Line:
		
			456
	
			Function:
		
			fn_run_controller
	
			File:
		
			index.php
	
			Line:
		
			25
	
			Function:
		
			fn_dispatch
	
Tygh\Exceptions\AException

Message

Duplicate entry '350770' for key 'PRIMARY' (1062)

INSERT INTO cscart_orders (`discount`, `total`, `subtotal`, `shipping_cost`, `promotions`, `subtotal_discount`, `payment_id`, `payment_surcharge`, `profile_id`, `parent_order_id`, `user_id`, `tax_exempt`, `issuer_id`, `b_state`, `s_state`, `email`, `firstname`, `lastname`, `b_firstname`, `b_lastname`, `b_address`, `b_address_2`, `s_firstname`, `s_lastname`, `s_address`, `s_address_2`, `b_country`, `s_country`, `phone`, `shipping_ids`, `ip_address`, `timestamp`, `lang_code`, `company_id`, `status`, `is_parent_order`, `order_id`) VALUES (0, 2500, 2500, 0, 'a:0:{}', 0, 2, 0, 1, 0, 1, 'N', NULL, '----- PERSONAL DATA REMOVED FOR PUBLIC FORUM PURPOSES ------, 'en', 1, 'N', 'N', 350770)

Error at

app/Tygh/Database/Connection.php, line: 1114

Backtrace

			File:
		
			app/Tygh/Database/Connection.php
	
			Line:
		
			488
	
			Function:
		
			throwError
	
			File:
		
			app/functions/fn.database.php
	
			Line:
		
			129
	
			Function:
		
			query
	
			File:
		
			app/functions/fn.cart.php
	
			Line:
		
			941
	
			Function:
		
			db_query
	
			File:
		
			app/functions/fn.cart.php
	
			Line:
		
			1275
	
			Function:
		
			fn_update_order
	
			File:
		
			app/functions/fn.cart.php
	
			Line:
		
			8265
	
			Function:
		
			fn_place_order
	
			File:
		
			app/controllers/frontend/checkout.php
	
			Line:
		
			380
	
			Function:
		
			fn_checkout_place_order
	
			File:
		
			app/functions/fn.control.php
	
			Line:
		
			700
	
			Function:
		
			include
	
			File:
		
			app/functions/fn.control.php
	
			Line:
		
			456
	
			Function:
		
			fn_run_controller
	
			File:
		
			index.php
	
			Line:
		
			25
	
			Function:
		
			fn_dispatch