FIX Update of leave request when CSRF with token is on
FIX Export of leave request show the number of open days
This commit is contained in:
parent
90850c4d31
commit
24cb1390e4
@ -202,13 +202,13 @@ class modHoliday extends DolibarrModules
|
||||
$this->export_permission[$r]=array(array("holiday","read_all"));
|
||||
$this->export_fields_array[$r]=array(
|
||||
'd.rowid'=>"LeaveId",'d.fk_type'=>'TypeOfLeaveId','t.code'=>'TypeOfLeaveCode','t.label'=>'TypeOfLeaveLabel','d.fk_user'=>'UserID',
|
||||
'u.lastname'=>'Lastname','u.firstname'=>'Firstname','u.login'=>"Login",'d.date_debut'=>'DateStart','d.date_fin'=>'DateEnd','d.halfday'=>'HalfDay',
|
||||
'u.lastname'=>'Lastname','u.firstname'=>'Firstname','u.login'=>"Login",'d.date_debut'=>'DateStart','d.date_fin'=>'DateEnd','d.halfday'=>'HalfDay','none.num_open_days'=>'NbUseDaysCP',
|
||||
'd.date_valid'=>'DateApprove','d.fk_validator'=>"UserForApprovalID",'ua.lastname'=>"UserForApprovalLastname",'ua.firstname'=>"UserForApprovalFirstname",
|
||||
'ua.login'=>"UserForApprovalLogin",'d.description'=>'Description','d.statut'=>'Status'
|
||||
);
|
||||
$this->export_TypeFields_array[$r]=array(
|
||||
'd.rowid'=>"Numeric",'t.code'=>'Text', 't.label'=>'Text','d.fk_user'=>'Numeric',
|
||||
'u.lastname'=>'Text','u.firstname'=>'Text','u.login'=>"Text",'d.date_debut'=>'Date','d.date_fin'=>'Date',
|
||||
'u.lastname'=>'Text','u.firstname'=>'Text','u.login'=>"Text",'d.date_debut'=>'Date','d.date_fin'=>'Date','none.num_open_days'=>'NumericCompute',
|
||||
'd.date_valid'=>'Date','d.fk_validator'=>"Numeric",'ua.lastname'=>"Text",'ua.firstname'=>"Text",
|
||||
'ua.login'=>"Text",'d.description'=>'Text','d.statut'=>'Numeric'
|
||||
);
|
||||
@ -216,6 +216,7 @@ class modHoliday extends DolibarrModules
|
||||
'u.lastname'=>'user','u.firstname'=>'user','u.login'=>'user','ua.lastname'=>'user','ua.firstname'=>'user','ua.login'=>'user'
|
||||
);
|
||||
$this->export_alias_array[$r]=array('d.rowid'=>"idholiday");
|
||||
$this->export_special_array[$r] = array('none.num_open_days'=>'getNumOpenDays');
|
||||
$this->export_dependencies_array[$r]=array(); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
|
||||
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
|
||||
@ -540,7 +540,7 @@ class Export
|
||||
public function build_file($user, $model, $datatoexport, $array_selected, $array_filterValue, $sqlquery = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf,$langs;
|
||||
global $conf,$langs,$mysoc;
|
||||
|
||||
$indice=0;
|
||||
asort($array_selected);
|
||||
@ -634,6 +634,13 @@ class Export
|
||||
$alias=str_replace(array('.', '-','(',')'), '_', $key);
|
||||
if ($obj->$alias < 0) $obj->$alias='0';
|
||||
}
|
||||
// Operation GETNUMOPENDAYS (for Holiday module)
|
||||
elseif ($this->array_export_special[$indice][$key]=='getNumOpenDays')
|
||||
{
|
||||
//$alias=$this->array_export_alias[$indice][$key];
|
||||
$alias=str_replace(array('.', '-','(',')'), '_', $key);
|
||||
$obj->$alias=num_open_day(dol_stringtotime($obj->d_date_debut, 1), dol_stringtotime($obj->d_date_fin, 1), 0, 1, $obj->d_halfday, $mysoc->country_code);
|
||||
}
|
||||
// Operation INVOICEREMAINTOPAY
|
||||
elseif ($this->array_export_special[$indice][$key]=='getRemainToPay')
|
||||
{
|
||||
|
||||
@ -1134,6 +1134,7 @@ else
|
||||
if ($action == 'edit' && $object->statut == Holiday::STATUS_DRAFT) $edit = true;
|
||||
|
||||
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />'."\n";
|
||||
print '<input type="hidden" name="action" value="update"/>'."\n";
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'" />'."\n";
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user