The site was only looked for in the PO's Subject field and in the email
subject, so a PO that names its site in the Description -- or only in the
project code on its line items -- could not be placed and was flagged for
review. MEGCPO9547 ("Chamberlain PO", Chamberlain is the supplier) gave the
site three ways: Description "Tools (Nellmapius EXT25)" and C26/27 on
every line, while its email subject named nothing.
The site is now resolved from the document itself, in order of how reliable
each signal is: the project code on the PO's own lines, then the site named
in its Description, then its Subject, then the email subject. Only the
line-item block is scanned for project codes, so the "Head office" in a PO's
contact block cannot be mistaken for the HEAD site code, and lines naming
two different sites are left for a human, as MEGA's own finalisation step
treats them.
Also splits the document parsing out of parse_pdf so it can be tested, and
covers it with scripts/test_po_email_intake.py.