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o7AVT
 5y8Od7GPKHkYy/dkh0w+MfWzPWRrS88+ViTh8Qt9rodYQxr9TpRif4E03qQ1geCx
 H9CeqFw80xv4QXkEF2/wJ6LEcDJHE6cVQK9BPWFFCe/aZz33NSBp35rv6oihYdZo
 ZfUDXBR1oN8TKqYDQlDrIKlTbKsXy36SfwCJq+mJMIym7R7SIustt81wZyIwL8Yt
 3quXBTUQ
 =2IRg
 -----END PGP SIGNATURE-----

Merge tag '2.2.3'

2.2.3
This commit is contained in:
Jérémy Munsch 2021-10-26 12:50:42 +02:00
commit 2917520aa9
5 changed files with 19 additions and 5 deletions

View file

@ -1,5 +1,5 @@
{
"version": "2.2.1",
"version": "2.2.3",
"tokenTimeout": 60,
"apiRequestRatePerMinute": 256,
"servicesDBCache": 10

View file

@ -2,6 +2,10 @@
#All notable changes to `CRM CLient V2` will be documented in this file.
# version 2.2.3
- Changed for bool casting for response parse field 'status' when is int 1 or 0
- Changed, properties are filled from CRM after a save or update action, this will allow for props to be set on model as it is on the crm, after all checks and casts (firstname capitalized, ... etc)
# version 2.2.2
- Fixed Arcadia mail where sending parameters as query instead of Data

View file

@ -3,7 +3,7 @@
"type": "library",
"description": "LDC CRM Client V2",
"license": "MIT",
"version": "2.2.2",
"version": "2.2.3",
"authors": [
{
"name": "Jérémy Munsch",

View file

@ -124,6 +124,10 @@ abstract class CrmClientModel implements JsonSerializable
if (count($properties)) {
foreach ($properties as $field => $value) {
$type = $this->getPropType($field);
// Force boolean
if ($type === 'bool') {
$value = (\is_int($value) and ($value === 1 or $value === 0)) ? (bool)$value : $value;
}
if (!$this->checkFieldType($type, $value)) {
throw new TypeError("Wrong type for $field");
}

View file

@ -14,6 +14,11 @@ use TypeError;
* the account validation status. You can use it as
* a standalone class but beware of catching exceptions
*
* Be warned that on server side data is normalized
* - firstname and lastname are 'capitalized'
* - fields are trimmed
* - non numeric chars are removed from postcode
*
* @property string $hashcode The crm hashcode this is a readonly field
* @property string $email Must be a rfc valid email on a valid domain name
* @property string $password Required only on create, must have upper and lowers chars,
@ -453,7 +458,7 @@ class Customer extends CrmClientModel
$response = static::$apiInterface->call($request);
if ($status = $response->status->equals(ApiStatus::OK())) {
$this->updatedValues = [];
$this->hashcode = $response->data['hashcode'];
$this->fill($response->data);
}
return $status;
}
@ -469,6 +474,7 @@ class Customer extends CrmClientModel
$response = static::$apiInterface->call($request);
if ($status = $response->status->equals(ApiStatus::OK())) {
$this->updatedValues = [];
$this->fill($response->data);
}
return $status;
}
@ -512,7 +518,7 @@ class Customer extends CrmClientModel
]);
$response = static::$apiInterface->call($request);
$this->status = true;
$this->__set('status', true);
return $response->status->equals(ApiStatus::OK());
}
@ -527,7 +533,7 @@ class Customer extends CrmClientModel
*/
public function toggleOptin(): bool
{
$this->opt_in = !$this->opt_in;
$this->__set('opt_in', !$this->opt_in);
return $this->update();
}