diff --git a/apps/maarch_entreprise/js/functions.js b/apps/maarch_entreprise/js/functions.js index 0636966c713a3c493a0cbbe0798f0b5301cc6ecd..3cc461a14a73f493d21c11b858c2392bf0beb840 100755 --- a/apps/maarch_entreprise/js/functions.js +++ b/apps/maarch_entreprise/js/functions.js @@ -2907,6 +2907,9 @@ function affiche_reference() { function erase_contact_external_id(id, erase_id) { if ($j('#' + id).val() == '') { $j('#' + erase_id).val(''); + if (id == "contact") { + $j('#contact').css("background-color", ""); + } } } diff --git a/apps/maarch_entreprise/js/indexing.js b/apps/maarch_entreprise/js/indexing.js index 3a62e11bd0d6fa4d7eac41cb5b96b5e1b8558eda..6a7183678dbb03ff918263ee7b7b7b1c8ba56f4b 100755 --- a/apps/maarch_entreprise/js/indexing.js +++ b/apps/maarch_entreprise/js/indexing.js @@ -1717,6 +1717,9 @@ function set_new_contact_address(path_manage_script, id_div, close,transmission) } else if (parent.parent.$('contact') && parent.parent.$('add_multi_contact_tr').style.display == 'none') { parent.parent.$('contact').value = response.contactName; } + if (response.rateColor != "") { + parent.$j('#contact').css('background-color', response.rateColor); + } if (parent.$('email') && parent.$('add_multi_contact_tr').style.display != 'none') { parent.$('email').value = response.contactName; } else if (parent.parent.$('email') && parent.parent.$('add_multi_contact_tr').style.display != 'none') { diff --git a/apps/maarch_entreprise/my_contacts/get_last_contact_address.php b/apps/maarch_entreprise/my_contacts/get_last_contact_address.php index 792391adf83b1fcc101b4c3eed3a6d2cae28c6eb..97ac05f07f5bc216986d5531d3ea3a263c96c821 100755 --- a/apps/maarch_entreprise/my_contacts/get_last_contact_address.php +++ b/apps/maarch_entreprise/my_contacts/get_last_contact_address.php @@ -128,5 +128,8 @@ if (!empty($trimed)) { $contactId = $res->contact_id; $addressId = $res->ca_id; -echo "{ status: 1, contactName: '" . addslashes($contact) . "', contactId: '" . $contactId . "', addressId: '" . $addressId . "'}"; +$contactData = \Contact\models\ContactModel::getOnView(['select' => ['*'], 'where' => ['ca_id = ?'], 'data' => [$addressId]]); +$rate = \Contact\controllers\ContactController::getFillingRate(['contact' => (array)$contactData[0]]); + +echo "{ status: 1, contactName: '" . addslashes($contact) . "', contactId: '" . $contactId . "', addressId: '" . $addressId . "', rateColor: '". $rate['color']."'}"; exit; \ No newline at end of file diff --git a/src/app/contact/controllers/ContactController.php b/src/app/contact/controllers/ContactController.php index 5e6e65c594aea37be524babd5e8b9165f957c9be..230486fca7e2e9a27ed5179aab0d066d31f47809 100644 --- a/src/app/contact/controllers/ContactController.php +++ b/src/app/contact/controllers/ContactController.php @@ -202,7 +202,6 @@ class ContactController } $data = $request->getParams(); - $check = Validator::boolType()->validate($data['enable']); $check = $check && Validator::arrayType()->validate($data['rating_columns']); $check = $check && Validator::intVal()->notEmpty()->validate($data['first_threshold']) && $data['first_threshold'] > 0 && $data['first_threshold'] < 99; @@ -228,6 +227,14 @@ class ContactController $contactsFilling['rating_columns'] = json_decode($contactsFilling['rating_columns']); if ($contactsFilling['enable'] && !empty($contactsFilling['rating_columns'])) { + if ($aArgs['contact']['is_corporate_person'] == 'N') { + foreach ($contactsFilling['rating_columns'] as $key => $value) { + if (in_array($value, ['firstname', 'lastname', 'title', 'function'])) { + + $contactsFilling['rating_columns'][$key] = 'contact_' . $value; + } + } + } $percent = 0; foreach ($contactsFilling['rating_columns'] as $ratingColumn) { if (!empty($aArgs['contact'][$ratingColumn])) {