NEW Can export leave requests

This commit is contained in:
Laurent Destailleur 2018-02-09 16:08:28 +01:00
parent a691dec90b
commit eb8664e649
4 changed files with 37 additions and 5 deletions

View File

@ -70,7 +70,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
else $classname = 'class="tmenu"';
$idsel='home';
$menu->add('/index.php?mainmenu=home&leftmenu=home', $langs->trans("Home"), 0, $showmode, $atarget, "home", '', 10, $id, $idsel, $classname);
$titlehome = $langs->trans("Home");
if (! empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) $titlehome = '&nbsp; <span class="fa fa-home"></span> &nbsp;';
$menu->add('/index.php?mainmenu=home&amp;leftmenu=home', $titlehome, 0, $showmode, $atarget, "home", '', 10, $id, $idsel, $classname);
// Third parties
$tmpentry=array('enabled'=>(( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)), 'perms'=>(! empty($user->rights->societe->lire) || ! empty($user->rights->fournisseur->lire)), 'module'=>'societe|fournisseur');

View File

@ -57,7 +57,7 @@ class modHoliday extends DolibarrModules
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this));
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
$this->description = "Leave management";
$this->description = "Leave requests";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'dolibarr';
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
@ -158,7 +158,25 @@ class modHoliday extends DolibarrModules
// Exports
$r=1;
$r=0;
$r++;
$this->export_code[$r]='leaverequest_'.$r;
$this->export_label[$r]='ListeCP';
$this->export_icon[$r]='holiday';
$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','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_entities_array[$r]=array('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_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 ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'holiday as d';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_holiday_types as t ON t.rowid = d.fk_type';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as ua ON ua.rowid = d.fk_validator,';
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'user as u';
$this->export_sql_end[$r] .=' WHERE d.fk_user = u.rowid';
$this->export_sql_end[$r] .=' AND d.entity IN ('.getEntity('holiday').')';
// Example:
// $this->export_code[$r]=$this->rights_class.'_'.$r;

View File

@ -69,8 +69,9 @@ $entitytoicon = array(
'category' => 'category',
'shipment' => 'sending',
'shipment_line'=> 'sending',
'expensereport'=> 'trip',
'expensereport'=> 'trip',
'expensereport_line'=> 'trip',
'holiday' => 'holiday',
'contract_line' => 'contract',
'translation' => 'generic'
);
@ -115,7 +116,8 @@ $entitytolang = array(
'action' => 'Event',
'expensereport'=> 'ExpenseReport',
'expensereport_line'=> 'ExpenseReportLine',
'contract' => 'Contract',
'holiday' => 'TitreRequestCP',
'contract' => 'Contract',
'contract_line'=> 'ContractLine',
'translation' => 'Translation'
);

View File

@ -16,7 +16,12 @@ CancelCP=Canceled
RefuseCP=Refused
ValidatorCP=Approbator
ListeCP=List of leaves
LeaveId=Leave ID
ReviewedByCP=Will be approved by
UserForApprovalID=User for approval ID
UserForApprovalFirstname=Firstname of approval user
UserForApprovalLastname=Lastname of approval user
UserForApprovalLogin=Login of approval user
DescCP=Description
SendRequestCP=Create leave request
DelayToRequestCP=Leave requests must be made at least <b>%s day(s)</b> before them.
@ -30,6 +35,9 @@ ErrorUserViewCP=You are not authorized to read this leave request.
InfosWorkflowCP=Information Workflow
RequestByCP=Requested by
TitreRequestCP=Leave request
TypeOfLeaveId=Type of leave ID
TypeOfLeaveCode=Type of leave code
TypeOfLeaveLabel=Type of leave label
NbUseDaysCP=Number of days of vacation consumed
EditCP=Edit
DeleteCP=Delete
@ -81,6 +89,8 @@ EmployeeFirstname=Employee first name
TypeWasDisabledOrRemoved=Leave type (id %s) was disabled or removed
LastHolidays=Latest %s leave requests
AllHolidays=All leave requests
HalfDay=Half day
NotTheAssignedApprover=You are not the assigned approver
## Configuration du Module ##
LastUpdateCP=Latest automatic update of leaves allocation