| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 2.0932 |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | 49 | public function onBeforeWrite() |
|
| 36 | { |
||
| 37 | 49 | parent::onBeforeWrite(); |
|
| 38 | |||
| 39 | // if Member data was imported from FoxyCart, PasswordEncryption will be set to 'none'. |
||
| 40 | // Change to sh1_v2.4 to ensure SilverStripe is using the same hash as FoxyCart API 1.1 |
||
| 41 | 49 | $this->owner->PasswordEncryption = 'sha1_v2.4'; |
|
| 42 | |||
| 43 | // Send updated customer data to Foxy Cart via API |
||
| 44 | 49 | $response = FoxyCart::putCustomer($this->owner); |
|
| 45 | |||
| 46 | // Grab customer_id record from FoxyCart response, store in Member |
||
| 47 | 49 | if ($response) { |
|
| 48 | $foxyResponse = new \SimpleXMLElement($response); |
||
| 49 | $this->owner->Customer_ID = (int) $foxyResponse->customer_id; |
||
| 50 | } |
||
| 53 |