OK, this is the fault I had - it is the switch in one of the door locks that has failed-the ecu thinks the door is n't shut so it won't lock.
I suspect it will be the drivers door, if you are careful you can prove which door it is by disconnecting the big connector from the door to the A post. Be care if you do this not to close the door though-you WILL smash the connector! If when you do this you can lock the doors you know which door it is. You can now reconnect the door to A post connector.
Remove the lower door card and disconnect the wiring to the lock mechanism as a temporary fix and you will have to disconnect the cable from the exterior door handle because once you disconnect the wiring plug the central locking will no longer work on that door. Once you have done that you will be able to lock the car. Beware if you open the faulty door once it as locked automatically DO NOT leave the key card in the car and close the door or you will have locked yourself out of the car - been there, done that!
You will need a replacement door lock, I got one secondhand off ebay.
John