hi…i have 2 question regarding security possibilities:
here is my connector cose:
function mark_timesheet($row)
{
if ($row->get_value(“in_note”) == “Timb. non rilevata” || $row->get_value(“out_note”) == “Timb. non rilevata”)
$row->set_row_style(“font-weight:bold;color:red;”);
}
$timesheet_grid = new GridConnector($res);
$timesheet_grid->enable_log(“Log/timesheet_grid_connector.log”,true);
$timesheet_grid->set_encoding(“ISO-8859-1”);
$timesheet_grid->dynamic_loading(100);
$timesheet_grid->event->attach(“beforeRender”,mark_timesheet);
function timesheet_update($data)
{
$attendance_id=$data->get_value(“attendance_id”);
$employee_id=$data->get_value(“employee_id”);
$punchin_time=$data->get_value(“punchin_time”);
$punchout_time=$data->get_value(“punchout_time”);
$in_note=$data->get_value(“in_note”);
$out_note=$data->get_value(“out_note”);
$status=$data->get_value(“status”);
//$conn->sql->query(“UPDATE hs_hr_attendance SET in_note=’{$in_note}’ , out_note=’{$out_note}’ where attendance_id={$attendance_id}”);
mysql_query(“UPDATE hs_hr_attendance SET in_note=’{$in_note}’ , out_note=’{$out_note}’ , punchin_time=’{$punchin_time}’ , punchout_time=’{$punchout_time}’ , status=’{$status}’ where attendance_id={$attendance_id}”);
$data->success(); //if you have made custom update - mark operation as finished
}
function timesheet_delete($data)
{
$attendance_id=$data->get_value(“attendance_id”);
//$conn->sql->query(“UPDATE hs_hr_attendance SET in_note=’{$in_note}’ , out_note=’{$out_note}’ where attendance_id={$attendance_id}”);
mysql_query(“DELETE FROM hs_hr_attendance where attendance_id={$attendance_id}”);
$data->success(); //if you have made custom update - mark operation as finished
}
function timesheet_insert($data)
{
$attendance_id=$data->get_value(“attendance_id”);
$employee_id=$data->get_value(“employee_id”);
$punchin_time=$data->get_value(“punchin_time”);
$punchout_time=$data->get_value(“punchout_time”);
$in_note=$data->get_value(“in_note”);
$out_note=$data->get_value(“out_note”);
$status=$data->get_value(“status”);
mysql_query(“INSERT hs_hr_attendance SET in_note=’{$in_note}’ , out_note=’{$out_note}’ , punchin_time=’{$punchin_time}’ , punchout_time=’{$punchout_time}’ , status=’{$status}’ where attendance_id={$attendance_id}”);
$data->success(); //if you have made custom update - mark operation as finished
}
$timesheet_grid->event->attach(“beforeUpdate”,“timesheet_update”);
$timesheet_grid->event->attach(“beforeDelete”,“timesheet_delete”);
$timesheet_grid->event->attach(“beforeInsert”,“timesheet_insert”);
$timesheet_grid->render_sql("SELECT " .
"hs_hr_attendance.attendance_id, hs_hr_attendance.punchin_time, hs_hr_attendance.in_note, " .
“hs_hr_attendance.punchout_time, hs_hr_attendance.out_note, " .
“hs_hr_attendance.status, hs_hr_attendance.employee_id from hs_hr_attendance " .
“JOIN hs_hr_employee " .
“ON hs_hr_attendance.employee_id=hs_hr_employee.emp_number " .
“WHERE hs_hr_employee.employee_id LIKE” .”’”. $_GET[“filter”] .”%” . “’”.
“ORDER BY punchin_time DESC”, “attendance_id”,“punchin_time,in_note,punchout_time,out_note,status”);
?>
1st question:
is there a possibility to enable edit function only if a cell have a certain value? pls see function mark timesheet
2nd question:
in my php script i check if a user have rights to access to a particular page with something like this:
if (!($check[‘team’]==‘Group 1’) && !($check[‘team’]==‘Group 3’))
{ etc etc etc…
is there a way to use deny update function in cunjunction with php code?
Thank u
is there a possibility to enable edit function only if a cell have a certain value
function timesheet_update($data){
$in_note=$data->get_value(“in_note”);
$out_note=$data->get_value(“out_note”);
if ($in_note != “Timb. non rilevata” && $out_note != “Timb. non rilevata”)
return $data->error();
>>is there a way to use deny update function in cunjunction with php code?
You can place any custom logic in beforeUpdate handler, and block update operation from it.
function timesheet_update($data){
global $check;
if (!($check[‘team’]==‘Group 1’) && !($check[‘team’]==‘Group 3’))
return $data->error();
$in_note=$data->get_value(“in_note”);
$out_note=$data->get_value(“out_note”);
if ($in_note != “Timb. non rilevata” && $out_note != “Timb. non rilevata”)
return $data->error();
To distinguish between sql errors and your custom rules , you can use
$data->invalid();
instead of
$data->error();
The code:
function timesheet_update($data){
$in_note=$data->get_value(“in_note”);
$out_note=$data->get_value(“out_note”);
if ($in_note != “Timb. non rilevata” && $out_note != “Timb. non rilevata”)
return $data->error();
doesnt work…
seem its not able to verify this string…“Timb. non rilevata”…how can be?
You can try to enable the server-side logs and check the incoming data, it possible that incoming data differs from above text ( some extra whitespace or similar )
This is my code:
and connector:
<?php
require_once("../dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php");
session_start();
$res=mysql_connect("localhost","root","sandbgroup");
mysql_select_db("hr_mysql");
function bold_matricola($row)
{
$row->set_cell_style("employee_id","font-weight:bold;");
if ($row->get_value("in_note") == "Timb. non rilevata" || $row->get_value("out_note") == "Timb. non rilevata")
$row->set_row_style("font-weight:bold;color:red;");
}
$date_timesheet_grid = new GridConnector($res);
$date_timesheet_grid->enable_log("Log/date_timesheet_grid_connector.log",true);
$date_timesheet_grid->set_encoding("ISO-8859-1");
$date_timesheet_grid->dynamic_loading(100);
$date_timesheet_grid->event->attach("beforeRender",bold_matricola);
function date_timesheet_update($data)
{
$attendance_id=$data->get_value("attendance_id");
$employee_id=$data->get_value("employee_id");
$punchin_time=$data->get_value("punchin_time");
$punchout_time=$data->get_value("punchout_time");
$in_note=$data->get_value("in_note");
$out_note=$data->get_value("out_note");
if ($in_note != "Timb. non rilevata" || $out_note != "Timb. non rilevata");
return $data->error();
$status=$data->get_value("status");
//$conn->sql->query("UPDATE hs_hr_attendance SET in_note='{$in_note}' , out_note='{$out_note}' where attendance_id={$attendance_id}");
mysql_query("UPDATE hs_hr_attendance SET in_note='{$in_note}' , out_note='{$out_note}' , punchin_time='{$punchin_time}' , punchout_time='{$punchout_time}' , status='{$status}' where attendance_id={$attendance_id}");
$data->success(); //if you have made custom update - mark operation as finished
}
function date_timesheet_delete($data)
{
$attendance_id=$data->get_value("attendance_id");
//$conn->sql->query("UPDATE hs_hr_attendance SET in_note='{$in_note}' , out_note='{$out_note}' where attendance_id={$attendance_id}");
mysql_query("DELETE FROM hs_hr_attendance where attendance_id={$attendance_id}");
$data->success(); //if you have made custom update - mark operation as finished
}
$date_timesheet_grid->event->attach("beforeUpdate","date_timesheet_update");
$date_timesheet_grid->event->attach("beforeDelete","date_timesheet_delete");
//$date_timesheet_grid->access->deny("delete");
$date_timesheet_grid->render_sql("SELECT" .
"a.emp_number,a.employee_id, a.emp_lastname, a.emp_firstname," .
"b.attendance_id ,b.punchin_time, b.in_note, b.punchout_time, b.out_note, b.status " .
"from hs_hr_employee a " .
"JOIN hs_hr_attendance b " .
"ON a.emp_number=b.employee_id " .
"WHERE b.punchin_time LIKE" ."'".$_SESSION['date']."%"."' ORDER BY b.punchin_time DESC",
"attendance_id","employee_id, emp_lastname, emp_firstname,punchin_time,in_note,punchout_time,out_note,status");
session_destroy();
?>
my log says:
====================================
Log started, 03/11/2009 04:11:36
====================================
Use of undefined constant bold_matricola - assumed ‘bold_matricola’ at /var/www/punch1.0/includes/DataProcessor/date_timesheet_grid_connector.php line 22
SELECT DISTINCT in_note as value FROM hs_hr_employee a JOIN hs_hr_attendance b ON a.emp_number=b.employee_id WHERE b.punchin_time LIKE’%‘
SELECT DISTINCT out_note as value FROM hs_hr_employee a JOIN hs_hr_attendance b ON a.emp_number=b.employee_id WHERE b.punchin_time LIKE’%‘
SELECT a.emp_number,a.employee_id, a.emp_lastname, a.emp_firstname,b.attendance_id ,b.punchin_time, b.in_note, b.punchout_time, b.out_note, b.status FROM hs_hr_employee a JOIN hs_hr_attendance b ON a.emp_number=b.employee_id WHERE b.punchin_time LIKE’%’ ORDER BY b.punchin_time DESC LIMIT 0,100
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
SELECT COUNT() as DHX_COUNT FROM hs_hr_employee a JOIN hs_hr_attendance b ON a.emp_number=b.employee_id WHERE b.punchin_time LIKE’%‘
Done in 0.167422056198s
====================================
Log started, 03/11/2009 04:11:39
====================================
Use of undefined constant bold_matricola - assumed ‘bold_matricola’ at /var/www/punch1.0/includes/DataProcessor/date_timesheet_grid_connector.php line 22
SELECT a.emp_number,a.employee_id, a.emp_lastname, a.emp_firstname,b.attendance_id ,b.punchin_time, b.in_note, b.punchout_time, b.out_note, b.status FROM hs_hr_employee a JOIN hs_hr_attendance b ON a.emp_number=b.employee_id WHERE b.punchin_time LIKE’%’ AND in_note LIKE ‘%Timb. non rilevata%’ ORDER BY b.punchin_time DESC LIMIT 0,100
Undefined index: employee_id at /var/www/punch1.0/includes/dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php line 65
SELECT COUNT(*) as DHX_COUNT FROM hs_hr_employee a JOIN hs_hr_attendance b ON a.emp_number=b.employee_id WHERE b.punchin_time LIKE’%’ AND in_note LIKE '%Timb. non rilevata%'
Done in 0.00934219360352s
====================================
Log started, 03/11/2009 04:11:41
====================================
Use of undefined constant bold_matricola - assumed ‘bold_matricola’ at /var/www/punch1.0/includes/DataProcessor/date_timesheet_grid_connector.php line 22
DataProcessor object initialized
2276_gr_id => 2276
2276_c0 => 600-1013
2276_c1 => ZAGO
2276_c2 => FABIANA
2276_c3 => 2009-10-14 08:13:45
2276_c4 => Entrata
2276_c5 => 2009-10-14 12:31:55
2276_c6 => Uscita
2276_c7 => 1
2276_!nativeeditor_status => updated
ids => 2276
Row data [2276]
attendance_id => 2276
employee_id => 600-1013
emp_lastname => ZAGO
emp_firstname => FABIANA
punchin_time => 2009-10-14 08:13:45
in_note => Entrata
punchout_time => 2009-10-14 12:31:55
out_note => Uscita
status => 1
!nativeeditor_status => updated
Event code for update processed
Edit operation finished
0 => action:error; sid:2276; tid:2276;
Done in 0.000880002975464s
my log doesn’t show me “Timb. non rilevata” but in my grid i see it…
i discover why…
the code: $row->get_value(“in_note”) == “Timb. non rilevata” if i understand well means:
"if u want to update data with value equals to : “Timb. non rilevata” then…bla bla bla…
but my needs are:
"if in the render u will find a value different to: “Timb. non rilevata” then return $data->error();
is it possible?
Thank u
Dataprocessor sends data to the server side, which contains only cells from the updated row. It doesn’t provide any other data, so it is not possible to check any other values in grid.
You can add the check to client side code
date_timesheet_dataprocessor.attachEvent(“onBeforeUpdate”,function(){
var exist = date_timesheet.findCell(“Timb. non rilevata”,false,true);
return exists.length!=0;
})
With such code, data will be sent to server side , only if mentioned string exists somewhere in the grid.
( you need to include ext/dhtmlxgrid_filter.js to use findCell command )
ok…i will try…
thank u
maybe i cannot explain well what i’m tring to do…
my grid will contains a row that can assume only 2 value: “Entrata” or “Timb. non rilevata”…
i want that a user can edit rows that contains only “Timb. non rilevata” and in case he tries to edit rows that contain “Entrata” the system
gives him an alert like “You are not allowed to edit this cell”…
if i undertood well in the code u posted the condition means … find in every rows in the grid at least one value that contain “Timb. non rilevata”…
my needs are: find in row u are tring to edit one value that contain “Timb. non rilevata” if it is present send an alert…if not pemitt the editing operation
what do u think about it?
Any Update regarding?
Thank you
i want that a user can edit rows that contains only “Timb. non rilevata” and in case he tries to edit rows that contain “Entrata” the system
cell level block
mygrid.attachEvent(“onEditCell”,function(stage,id,ind){
if (mygrid.cells(id,ind).getValue()==“Timb. non rilevata”) return true;
alert(“not allowed”);
return false;
})
or row level block
mygrid.attachEvent(“onEditCell”,function(stage,id,ind){
flag = false;
for (var i=0; i<mygrid.getColumnsNum(); i++)
if(mygrid.cells(id,ind).getValue()==“Timb. non rilevata”) flag = true;
if (!flag)
alert(“not allowed”);
return flag;
})
seems to doesn’t work…
when i try to edit an entire row that contain in a cell “Timb. non rilevata” its says to me always not allowed…
and when i try to edit only cell containing “Timb. non rilevata” it lets me edit but when i confirm the new value its prompts me always
no allowed…
how can i solve ?
thank u
Hello,
could you please provide the sample to reproduce the issue (grid initialization code and xml)
sure…
grid init.
Timbrature: (Doppio click sulla riga per modificarne i valori)
first connector:
<?php
require_once("../config.php");
require_once("../dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php");
$db_selected = mysql_select_db($mysql_db_1, $link);
function bold_matricola($row)
{
$row->set_cell_style("employee_id","font-weight:bold;");
}
$employee_grid = new GridConnector($link);
$employee_grid->set_encoding("ISO-8859-1");
$employee_grid->enable_log("Log/employee_grid_connector.log",true);
$employee_grid->dynamic_loading(100);
$employee_grid->event->attach("beforeRender",bold_matricola);
$employee_grid->render_sql ("SELECT hs.loc_code, hs.loc_city, b.employee_id, b.emp_lastname, b.emp_firstname, a.emp_number " .
"FROM hs_hr_location hs " .
"JOIN (hs_hr_emp_locations a " .
"JOIN hs_hr_employee b " .
"ON (a.emp_number=b.emp_number)) " .
"ON (a.loc_code=hs.loc_code) " .
"WHERE b.emp_status<>'EST009' AND b.emp_status<>'EST011'" .
"AND (b.terminated_date LIKE" . "'" . date("Y-m") . "%" . "'" .
"OR b.terminated_date IS NULL)",
"emp_number","employee_id,emp_lastname,emp_firstname,loc_city");
require_once("../close.php");
?>
second connector:
<?php
require_once("../config.php");
require_once("../dhtmlxSuite/dhtmlxConnector/php/codebase/grid_connector.php");
$db_selected = mysql_select_db($mysql_db_1, $link);
function mark_timesheet($row)
{
if ($row->get_value("in_note") == "Timb. non rilevata" || $row->get_value("out_note") == "Timb. non rilevata")
$row->set_row_style("font-weight:bold;color:red;");
}
$timesheet_grid = new GridConnector($link);
$timesheet_grid->enable_log("Log/timesheet_grid_connector.log",true);
$timesheet_grid->set_encoding("ISO-8859-1");
$timesheet_grid->dynamic_loading(100);
$timesheet_grid->event->attach("beforeRender",mark_timesheet);
function timesheet_update($data)
{
$attendance_id=$data->get_value("attendance_id");
$employee_id=$data->get_value("employee_id");
$punchin_time=$data->get_value("punchin_time");
$punchout_time=$data->get_value("punchout_time");
$in_note=$data->get_value("in_note");
$out_note=$data->get_value("out_note");
$status=$data->get_value("status");
//$conn->sql->query("UPDATE hs_hr_attendance SET in_note='{$in_note}' , out_note='{$out_note}' where attendance_id={$attendance_id}");
mysql_query("UPDATE hs_hr_attendance SET in_note='{$in_note}' , out_note='{$out_note}' , punchin_time='{$punchin_time}' , punchout_time='{$punchout_time}' , status='{$status}' where attendance_id={$attendance_id}");
$data->success(); //if you have made custom update - mark operation as finished
}
function timesheet_delete($data)
{
$attendance_id=$data->get_value("attendance_id");
//$conn->sql->query("UPDATE hs_hr_attendance SET in_note='{$in_note}' , out_note='{$out_note}' where attendance_id={$attendance_id}");
mysql_query("DELETE FROM hs_hr_attendance where attendance_id={$attendance_id}");
$data->success(); //if you have made custom update - mark operation as finished
}
function timesheet_insert($data)
{
$attendance_id=$data->get_value("attendance_id");
$employee_id=$data->get_value("employee_id");
$punchin_time=$data->get_value("punchin_time");
$punchout_time=$data->get_value("punchout_time");
$in_note=$data->get_value("in_note");
$out_note=$data->get_value("out_note");
$status=$data->get_value("status");
mysql_query("INSERT hs_hr_attendance SET in_note='{$in_note}' , out_note='{$out_note}' , punchin_time='{$punchin_time}' , punchout_time='{$punchout_time}' , status='{$status}' where attendance_id={$attendance_id}");
$data->success(); //if you have made custom update - mark operation as finished
}
$timesheet_grid->event->attach("beforeUpdate","timesheet_update");
$timesheet_grid->event->attach("beforeDelete","timesheet_delete");
$timesheet_grid->event->attach("beforeInsert","timesheet_insert");
$timesheet_grid->render_sql("SELECT " .
"hs_hr_attendance.attendance_id, hs_hr_attendance.punchin_time, hs_hr_attendance.in_note, " .
"hs_hr_attendance.punchout_time, hs_hr_attendance.out_note, " .
"hs_hr_attendance.status, hs_hr_attendance.employee_id from hs_hr_attendance " .
"JOIN hs_hr_employee " .
"ON hs_hr_attendance.employee_id=hs_hr_employee.emp_number " .
"WHERE hs_hr_employee.employee_id LIKE" ."'". $_GET["filter"] ."%" . "'".
"AND hs_hr_attendance.status= '1' AND ( hs_hr_attendance.in_note<>'' OR hs_hr_attendance.out_note<>'') " .
"ORDER BY punchin_time DESC", "attendance_id","punchin_time,in_note,punchout_time,out_note,status");
require_once("../close.php");
?>
and log:
====================================
Log started, 13/11/2009 08:11:28
====================================
Use of undefined constant mark_timesheet - assumed ‘mark_timesheet’ at /var/www/hrmsoftware_bench/includes/DataProcessor/timesheet_grid_connector.php line 18
DataProcessor object initialized
4915_gr_id => 4915
4915_c0 => 2009-10-27 14:25:25
4915_c1 => Entrata
4915_c2 => 2009-10-27 23:59:59
4915_c3 => Uscita
4915_c4 => 1
4915_!nativeeditor_status => updated
ids => 4915
Row data [4915]
attendance_id => 4915
punchin_time => 2009-10-27 14:25:25
in_note => Entrata
punchout_time => 2009-10-27 23:59:59
out_note => Uscita
status => 1
!nativeeditor_status => updated
Incorrect field name used: employee_id
data
attendance_id => 4915
punchin_time => 2009-10-27 14:25:25
in_note => Entrata
punchout_time => 2009-10-27 23:59:59
out_note => Uscita
status => 1
!nativeeditor_status => updated
Event code for update processed
Edit operation finished
0 => action:updated; sid:4915; tid:4915;
Done in 0.0603079795837s
Event code for update processed
Edit operation finished
0 => action:updated; sid:4915; tid:4915;
Done in 0.0898258686066s
Event code for update processed
Edit operation finished
0 => action:updated; sid:4915; tid:4915;
Done in 0.0503029823303s
Event code for update processed
Edit operation finished
0 => action:updated; sid:4915; tid:4915;
Done in 0.0873880386353s
====================================
Log started, 13/11/2009 08:11:29
====================================
Use of undefined constant mark_timesheet - assumed ‘mark_timesheet’ at /var/www/hrmsoftware_bench/includes/DataProcessor/timesheet_grid_connector.php line 18
SELECT hs_hr_attendance.attendance_id, hs_hr_attendance.punchin_time, hs_hr_attendance.in_note, hs_hr_attendance.punchout_time, hs_hr_attendance.out_note, hs_hr_attendance.status, hs_hr_attendance.employee_id FROM hs_hr_attendance JOIN hs_hr_employee ON hs_hr_attendance.employee_id=hs_hr_employee.emp_number WHERE hs_hr_employee.employee_id LIKE’601-1190%‘AND hs_hr_attendance.status= ‘1’ AND ( hs_hr_attendance.in_note<>’’ OR hs_hr_attendance.out_note<>’’) ORDER BY punchin_time DESC LIMIT 0,100
SELECT COUNT() as DHX_COUNT FROM hs_hr_attendance JOIN hs_hr_employee ON hs_hr_attendance.employee_id=hs_hr_employee.emp_number WHERE hs_hr_employee.employee_id LIKE’601-1190%‘AND hs_hr_attendance.status= ‘1’ AND ( hs_hr_attendance.in_note<>’’ OR hs_hr_attendance.out_note<>’’)
Done in 0.0889308452606s
in log u can find an error …“Use of undefined constant mark_timesheet” why?
i’ve tried…the entire row cannot be modified … only the cell “Timb. non rilevata”…but it generate anyway error “Not Allowed” …even if
the record are updated…
what i want is to be able to modify entire row where in one of the cell that belongs to row contain “Timb. non rilevata” without alert error…
thank u
There was a typo in the approach provided before. Try to use
employee_timesheet.attachEvent(“onEditCell”,function(stage,id,ind){
flag = false;
for (var i=0; i<employee_timesheet.getColumnsNum(); i++)
if(employee_timesheet.cells(id,i).getValue()==“Timb. non rilevata”) flag = true;
if (!flag)
alert(“not allowed”);
return flag;
})
instead of
employee_timesheet.attachEvent(“onEditCell”,function(stage,id,ind){
flag = false;
for (var i=0; i<employee_timesheet.getColumnsNum(); i++)
if(employee_timesheet.cells(id,ind).getValue()==“Timb. non rilevata”) flag = true;
if (!flag)
alert(“not allowed”);
return flag;
})
>> in log u can find an error …“Use of undefined constant mark_timesheet” why?
There should be $timesheet_grid->event->attach(“beforeRender”,“mark_timesheet”) instead of $timesheet_grid->event->attach(“beforeRender”,mark_timesheet)
it works now in every cell of selected row…but when i change from “Timb. non rilevata” to “Uscita” the record was edited but having now value different
from Timb…etc… it alert me “Not Allowed”…
why?
.but when i change from “Timb. non rilevata” to “Uscita” the record was edited but having now value different from Timb…etc… it alert me “Not Allowed”…
It is correct behaviour according to the onEditCell event handler provided before. What result do you want to achieve ?
the result should be:
i should be able to edit any cell in selected row that contain “Timb. non rilevata” value…any cell should be editable if at least one cell of selected row contains “Timb. non rilevata”…when i change the cell from “Timb. non rilevata” to another value it should permitt me to edit without any alert…
if i try to edit any cell in row that contain values different from “Timb. non rilevata” it shouldn’t permitt me and give me an alert “Not Allowed”.
In this case try to add additional check
employee_timesheet.attachEvent(“onEditCell”,function(stage,id,ind){
if(stage) return true;
flag = false;
for (var i=0; i<employee_timesheet.getColumnsNum(); i++)
if(employee_timesheet.cells(id,i).getValue()==“Timb. non rilevata”) flag = true;
if (!flag)
alert(“not allowed”);
return flag;
})