Stav dette: Photometric calibration of the supernova legacy survey fields