If you enable logical deletion, the delete button will change to the flag set function of a specific item. Combined with implicit conditions, it behaves as if it were deleted by appearance.
We will prepare two accounts as shown in Fig. 1 and Fig. 2 here.
|user||General user||Logical delete only|
|manager||Operation manager||Logical deletion and physical deletion can be performed|
Log on as a normal user.We will register 1 customer data.
After registration, click "Delete" button.At this point, the delete button is designed to operate as a logical deletion, and by pressing the button the date and time is set in the "expiration date" item and it becomes the update operation.
We set an implicit condition so that only the blank (null) value is searched for the value of the "expiration date" item.As a result, logical deleted data is not searched.
Then log on as a business administrator.Since the implicit condition is set to be canceled, data can be retrieved.
Open the details screen.You can see that the date and time of the logical deletion is set in the "expiration date" item.
The operation manager can perform physical deletion.Since the normal deletion button is a logical deletion, new "delete physical" button is prepared.
Deletion from the database is done by pressing the button.
In this example, we set the logical deletion function in the "customer" model.As shown in Figure 10, prepare the "expiration date" item.
(Item name and item ID are optional, but please prepare type as character string type.)
This item is used as an implicit condition.Therefore, we will save it in the database.
Also, it will be read only so that it can not be entered.(It can be hidden in production operation.)
Sets the implicit condition.Let's rule "value is equal to" null ". However, we set the exclusion authorization at the same time.The authority name is "pdelete".(Described later)
Set "Screen> Other> Delete". Activate "Delete data as logical deletion".In addition, set items for logical delete judgment.This is the item prepared in Figure 10.
On the screen shown in Fig. 14, prepare the physical deletion button as an original button.(FIG. 15)
|screen name||"Detailed display screen" will be.||Detailed display screen|
|Display condition||If you have a task manager principal "manager", we will display the physical deletion button.||HASPRINCIPAL("manager")|
|Button name||Specify an arbitrary name.||Physical delete|
|event name||You need to send a Send event to the Physical Delete screen.||Send|
|Action name||Physical deletion screen is physicalDelete <model name>.(*1)||physicalDeleteCustomer|
Prepare a new permission "pdelete".This is a fixed name.Japanese names are arbitrary, but here we will say "physical deletion".
Prepare a principal holding this permission.I distinguished it from general users, and prepared a business manager (manager) here.
By default, the judgment item of logical deletion is stored (at the time of deletion) date time (character string indicating).If this item is null it is assumed that it is not deleted.
You can customize this rule.For example, set the rule "0: Normal, 1: Delete".
Let's set the setting in Fig. 13 equal to 0.
Write a script that operates at the time of logical deletion.This specifies "Logical deletion" at the execution timing of "Screen> Script> Helper".
This time it will be the following code.
customer.valid = "1";
When using this setting, it is necessary to prepare the detailed screen of the target model.
You can not control the display order of the buttons.The original button is always placed on the right side of the button display.