PMCORE-2628 Message of Delete attribute does not display correctly

This commit is contained in:
Roly Rudy Gutierrez Pinto
2021-01-04 11:08:21 -04:00
parent 8e080147b7
commit ee456c4eb3
4 changed files with 72 additions and 26 deletions

View File

@@ -25907,6 +25907,12 @@ msgstr "There was a problem sending the email to"
msgid "Error: The application {0} is not canceled."
msgstr "Error: The application {0} is not canceled."
# TRANSLATION
# LABEL/ID_THE_ATTRIBUTE_HAS_ALREADY_INFORMATION_STORED_FOR_USERS_PLEASE_CONFIRM_THE_DELETE
#: LABEL/ID_THE_ATTRIBUTE_HAS_ALREADY_INFORMATION_STORED_FOR_USERS_PLEASE_CONFIRM_THE_DELETE
msgid "The attribute {0} has already information stored for users, if you proceed to delete this attribute all information for users stored in the attribute will be deleted, please confirm."
msgstr "The attribute {0} has already information stored for users, if you proceed to delete this attribute all information for users stored in the attribute will be deleted, please confirm."
# TRANSLATION
# LABEL/ID_THE_ATTRIBUTE_WILL_BE_DELETED_PLEASE_CONFIRM
#: LABEL/ID_THE_ATTRIBUTE_WILL_BE_DELETED_PLEASE_CONFIRM

View File

@@ -61274,6 +61274,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_THERE_MUST__LEAST_HOLIDAY','en','There must be at least a holiday','2014-01-15') ,
( 'LABEL','ID_THERE_PROBLEM_SENDING_EMAIL','en','There was a problem sending the email to','2016-04-08') ,
( 'LABEL','ID_THE_APPLICATION_IS_NOT_CANCELED','en','Error: The application {0} is not canceled.','2016-06-15') ,
( 'LABEL','ID_THE_ATTRIBUTE_HAS_ALREADY_INFORMATION_STORED_FOR_USERS_PLEASE_CONFIRM_THE_DELETE','en','The attribute {0} has already information stored for users, if you proceed to delete this attribute all information for users stored in the attribute will be deleted, please confirm.','2020-12-15') ,
( 'LABEL','ID_THE_ATTRIBUTE_WILL_BE_DELETED_PLEASE_CONFIRM','en','The attribute {0} will be deleted, please confirm.','2020-12-15') ,
( 'LABEL','ID_THE_DEFAULT_CONFIGURATION','en','The default configuration was not defined','2016-11-16') ,
( 'LABEL','ID_THE_FILE_COULDNT_BE_UPLOADED','en','The file couldnt be uploaded please review the allowed files or contact your System Administrator.','2020-06-12') ,

View File

@@ -2,6 +2,7 @@
use Illuminate\Support\Facades\DB;
use ProcessMaker\BusinessModel\Role;
use ProcessMaker\Model\User;
use ProcessMaker\Model\UserExtendedAttributes;
global $G_PUBLISH;
@@ -215,6 +216,25 @@ try {
];
echo G::json_encode($result);
break;
case "verifyAttributeUse":
$name = empty($_REQUEST["name"]) ? "" : $_REQUEST["name"];
$attributeId = empty($_REQUEST["attributeId"]) ? "" : $_REQUEST["attributeId"];
$user = User::query()
->where("USR_EXTENDED_ATTRIBUTES_DATA", "LIKE", "%\"{$attributeId}\"%")
->get()
->first();
$isUsed = false;
$message = "";
if (!empty($user)) {
$isUsed = true;
$message = G::loadTranslation("ID_THE_ATTRIBUTE_HAS_ALREADY_INFORMATION_STORED_FOR_USERS_PLEASE_CONFIRM_THE_DELETE", [$name]);
}
$result = [
"isUsed" => $isUsed,
"message" => $message
];
echo G::json_encode($result);
break;
default:
$conf = new Configurations();
$pageSize = $conf->getEnvSetting('casesListRowNumber');

View File

@@ -137,7 +137,20 @@
this.$emit("editAttribute", row);
},
deleteAttribute(row) {
this.$bvModal.msgBoxConfirm(this.$root.translation('ID_THE_ATTRIBUTE_WILL_BE_DELETED_PLEASE_CONFIRM', [row.name]), {
let formData = new FormData();
formData.append("option", "verifyAttributeUse");
formData.append("name", row.name);
formData.append("attributeId", row.attributeId);
axios.post(this.$root.baseUrl() + "userExtendedAttributes/index", formData)
.then(response => {
response;
let message = this.$root.translation('ID_THE_ATTRIBUTE_WILL_BE_DELETED_PLEASE_CONFIRM', [row.name]);
if ("isUsed" in response.data && "message" in response.data) {
if (response.data.isUsed === true) {
message = response.data.message;
}
}
this.$bvModal.msgBoxConfirm(message, {
title: " ", //is important because title disappear
hideHeaderClose: false,
okTitle: this.$root.translation('ID_CONFIRM'),
@@ -164,6 +177,12 @@
}).catch(err => {
err;
});
})
.catch(error => {
error;
})
.finally(() => {
});
},
refresh() {
this.$refs.vServerTable1.refresh();