|
@@ -98,6 +98,30 @@ public function dp_update_more(&$o, &$p_data_map, &$p_data_map_create, &$p_data,
|
|
|
sync::_action('address', 'dp', 'osync', 'socpeople', $rowid);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if (P_CUSTOMER_DEFAULT_ADDRESSES) {
|
|
|
+ $p_data_map_more['customer'] = [];
|
|
|
+ $shipping_contact_type_id = static::$_d_type_contact_code['commande']['external']['SHIPPING'];
|
|
|
+ $invoice_contact_type_id = static::$_d_type_contact_code['commande']['external']['BILLING'];
|
|
|
+ //var_dump($shipping_contact_type_id);
|
|
|
+ if (!empty($d_data['societe_contacts'])) {
|
|
|
+ foreach ($d_data['societe_contacts'] as $row) {
|
|
|
+ //var_dump($row);
|
|
|
+ if ($row['fk_c_type_contact'] == $shipping_contact_type_id) {
|
|
|
+ //var_dump('yoooo');
|
|
|
+ $p_data_map_more['customer']['default_shipping_address_id'] = static::_dp_map_fk('address', 'socpeople', $row['fk_socpeople']);
|
|
|
+ //var_dump('yoooo');
|
|
|
+ }
|
|
|
+ if ($row['fk_c_type_contact']==$invoice_contact_type_id) {
|
|
|
+ $p_data_map_more['customer']['default_invoice_address_id'] = static::_dp_map_fk('address', 'socpeople', $row['fk_socpeople']);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!empty($p_data_map_more['customer'])) {
|
|
|
+ var_dump($p_data_map_more['customer']);
|
|
|
+ DB::p_update_row('customer', $p_data_map_more['customer'], ['id_customer'=>$p_id]);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// -- MAPPING --
|