Hello!
I have a problem mixing bulk edit and event on_after_update.
I need to put my ID editable if I want the event on_after_update works properly when I use FORM EDIT. Inline workd perfect, because ID is active.
But when I use Bulk Edit, the ID do not coming on the array $data.
Follow my part code:
$e=array();
$e[“on_after_update”] = array(“autostatus”, null, true);
$g->set_events($e);
$col = array();
$col[“title”] = “ID”;
$col[“name”] = “ID_AUDIENCIA”;
$col[“width”] = “58”;
$myfieldval = $col[“name”];
$myfieldnam = $col[“title”];
$Primaria = $col[“name”];
$col[“editable”] = true; //I use this beacause ON_AFTER_UPDATE workd properly using form
$col[“editrules”] = array(“readonly”=>true);
$cols[] = $col;
function autostatus($data)
{
//conexão manual.
include_once(“../../config.php”);
$conn = mysqli_connect(PHPGRID_DBHOST, PHPGRID_DBUSER, PHPGRID_DBPASS, PHPGRID_DBNAME);
$resuli = mysqli_query($conn, “UPDATE AUDIENCIA SET FK_STATUS = 2 WHERE DTFIM > ‘2019-01-01’ AND DTFIM IS NOT NULL AND ID_AUDIENCIA IN(“.$data[‘params’][‘ID_AUDIENCIA’].”)”);
$resuli = mysqli_query($conn, “UPDATE AUDIENCIA SET FK_STATUS = 16 WHERE FK_STATUS IN(1,4,16) AND (FK_ADVCONTRATADO <> 0 AND FK_ADVCONTRATADO IS NOT NULL) AND (DTFIM < ‘2019-01-01’ OR DTFIM IS NULL )AND ID_AUDIENCIA IN(“.$data[‘params’][‘ID_AUDIENCIA’].”)”);
}
Can you undesrtand me?
Hello,
Yes, i understand. This issue is fixed now. I’ll be sending you update.
To get selected IDs in callback, you need to access it by:
$data[‘ID_AUDIENCIA’] – without [“params”]
You can always debug $data by putting phpgrid_error($data) at start of callback function.