Lock or Freeze records with value from field
Posted: 2021-01-09 08:02
Recently i have been working on new project to lock or read-only records in base a results of SQL statement, I have a fields call "lock_r" define this fields to prevent records edit after report present to the manager, keeping integrity of the information after time.
I think will be great implement this on the Hooks function for future release of Appgini.
so far I have this:
ts_project.php hook file
in the file ts_project_dml.php
inside of the function ts_projects_form between the
I add this code->
I guess my request is if possible generate this function in future Appgini release?
Best regards;
I think will be great implement this on the Hooks function for future release of Appgini.
so far I have this:
ts_project.php hook file
Code: Select all
function ts_projects_dv_readonly($selectedID) {
$readonly = (sqlValue("select lock_r from ts_projects where id={$selectedID}") === 1 ? true : false);
return $readonly;
}
inside of the function ts_projects_form between the
Code: Select all
$combo_employees->Render();
ob_start();
Code: Select all
$combo_employees->Render();
if (function_exists('ts_projects_dv_readonly')) {
if (ts_projects_dv_readonly($selected_id)) {
$AllowUpdate = 0;
$AllowInsert = 0;
}
}
ob_start();
Best regards;