-
Notifications
You must be signed in to change notification settings - Fork 2
/
invite_user_to_a_case.sql.gen.go
7 lines (5 loc) · 3.51 KB
/
invite_user_to_a_case.sql.gen.go
1
2
3
4
5
6
7
// AUTOMATICALLY GENERATED FILE. DO NOT EDIT.
package invite
var invite_user_to_a_case = esql(asset{Name: "invite_user_to_a_case.sql", Content: "" +
"# For any question about this script, ask Franck\n#\n#################################################################\n#\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#\n# UPDATE THE BELOW VARIABLES ACCORDING TO YOUR NEEDS\t\t\t#\n#\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#\n#################################################################\n#\n# The MEFE invitation id that we want to process:\n\tSET @mefe_invitation_id = '%s';\n#\n# Environment: Which environment are you creating the unit in?\n#\t- 1 is for the DEV/Staging\n#\t- 2 is for the prod environment\n#\t- 3 is for the Demo environment\n\tSET @environment = %d;\n#\n########################################################################\n#\n#\tALL THE VARIABLES WE NEED HAVE BEEN DEFINED, WE CAN RUN THE SCRIPT #\n#\n########################################################################\n#\n#\n#\n#############################################\n#\t\t\t\t\t\t\t\t\t\t\t#\n# IMPORTANT INFORMATION ABOUT THIS SCRIPT\t#\n#\t\t\t\t\t\t\t\t\t\t\t#\n#############################################\n#\n# Built for BZFE database v3.26+\n#\n# Use this script only if the Unit EXIST in the BZFE \n# It assumes that the unit has been created with all the necessary BZ objects and all the roles assigned to dummy users.\n#\n# Pre-requisite:\n#\t- The table 'ut_invitation_api_data' has been updated \n# \t- We know the MEFE Invitation id that we need to process.\n#\t- We know the environment where this script is run\n# \n# This script depends on several SQL procedures:\n#\t- Procedure to add a user to a role in a unit.\n\n# This script will also\n#\t- Add an existing BZ user as ASSIGNEE to an existing case which has already been created.\n#\t- Does NOT update the bug_user_last_visit table as the user had no action in there.\n#\n# Limits of this script:\n#\t- Unit must have all roles created with Dummy user roles.\n\n####################\n#\n# Let's do this!\n#\n####################\n\n\tCALL `add_user_to_role_in_unit`;\n\n# We have invited the user to a role in the unit\n# We now invite the user to the case\n\n\t# Info about this script\n\t\tSET @this_script = '1_invite_user_to_a_case.sql';\n\t\n\t# Timestamp\t\n SET @timestamp = NOW();\n\n\t# The case id\n\t\tSET @bz_case_id = (SELECT `bz_case_id` FROM `ut_invitation_api_data` WHERE `id` = @reference_for_update);\n\n\t# Do we need to change the case assignee?\n\t\tSET @change_case_assignee = IF (@invitation_type = 'type_assigned'\n\t\t\t, 1\n\t\t\t, 0\n\t\t\t)\n\t\t\t;\n\n\t# Do we need to put the invitee in CC for this case?\n\t\tSET @add_invitee_in_cc = IF (@invitation_type = 'type_cc'\n\t\t\t, 1\n\t\t\t, 0\n\t\t\t)\n\t\t\t;\n\t# Change the assignee for the case if needed\n\t# This procedure needs the following objects:\n\t#\t- variables:\n\t#\t\t- @bz_user_id\n\t#\t\t- @creator_bz_id\n\t#\t\t- @bz_case_id\n\t\tCALL `change_case_assignee`;\n\n\t# Add the invited user in CC of the case if needed\n\t# This procedure needs the following objects:\n\t#\t- variables:\n\t\tCALL `add_invitee_in_cc`;\n\n# Update the table 'ut_invitation_api_data' so we record what we have done\n\n\t# Timestamp\t\n\t\tSET @timestamp = NOW();\n\t\t\n\t# We do the update to record that we have reached the end of the script...\n\t\tUPDATE `ut_invitation_api_data`\n\t\t\tSET `processed_datetime` = @timestamp\n\t\t\t\t, `script` = @this_script\n\t\t\tWHERE `mefe_invitation_id` = @mefe_invitation_id\n\t\t\t;\n" +
"", etag: `"Tbf0njqMrRI="`})