Do you have electric door locks and/or an anti-car-theft system? If so then it may be more difficult to solve.
Not being able to shift out of P makes me think you’ve got a problem with the brake interlock safety system. You know, where you have to press on the brake pedal to get it out of P normally? Check to make sure your brake lights are coming on when you step on the brakes, that often provides a clue what the problem is for that.
The relationship with the battery disconnection, that’s a weird one. Seems like there’s a computer reset that’s needed, maybe to clear a problem with an electric door latch. Sometimes those use a servo gadget that gets into an unknown state that confuses the door circuitry, and needs to be homed to the initial position, during a reset. If so, the lock diddling may have damaged that device. You’d have to remove the door panel for a look-see.