systopia / Contact-Update-Queue

Ilja's Initiative for Input Validation
Other
2 stars 4 forks source link

Bad address caching causes wrong original address records (and potentially more) #44

Open bjendres opened 2 years ago

bjendres commented 2 years ago

In ticket #19 the address handler was refactored. The new implementation contains a grave/stupid error (see here), that stores the addresses across different calls and different contacts. In particular the recorded original address might be wrong when submitting multiple changes in the same PHP session.

pbatroff commented 2 years ago

Verified Extension Version: 0.5-alpha12

Can be reproduced by Creating 2 Contact (e.g. id 10 & 11). Both have an address, and then put in two request updates for addresses in, one for each contact:

$result_1 = civicrm_api3('Contact', 'request_update', [
    'id' => "10",
    'street_address' => 'Yorckstr. 38',
    'postal_code' => '12345',
    'city' => 'Yorck',
    'country_id' => '1082',
  ]);

  $result_2 = civicrm_api3('Contact', 'request_update', [
    'id' => "11",
    'street_address' => 'testStreet 1',
    'postal_code' => '77777',
    'city' => 'Entenhausen',
    'country_id' => '1082',
  ]);

Resulting Origin Address (Ursprüngliche Addresse) remains the origin address of the first contact, as seen in the screenshots:

hbs_i3val_debug_1

hbs_i3val_debug_2

pbatroff commented 2 years ago

I did the test again with e84a8a9 active, and now origin address is correct.