Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Commit

Permalink
feature(HumanResources): free time grid
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliusweiss authored and paulmhh committed Mar 14, 2022
1 parent 73d28dc commit 4041ba6
Show file tree
Hide file tree
Showing 37 changed files with 501 additions and 388 deletions.
2 changes: 1 addition & 1 deletion tests/tine20/HumanResources/Controller/FreeTimeTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public function testCreateChangeRequestGrant()
HumanResources_Controller_Employee::getInstance()->get($freeTime->employee_id);
$contracts = HumanResources_Controller_Contract::getInstance()->search(
Tinebase_Model_Filter_FilterGroup::getFilterForModel(HumanResources_Model_Contract::class, [
['field' => 'employee_id', 'operator' => 'equals', 'value' => $freeTime->employee_id],
['field' => 'employee_id', 'operator' => 'equals', 'value' => $freeTime->getIdFromProperty('employee_id')],
]));
$this->assertSame(1, $contracts->count());
}
Expand Down
12 changes: 0 additions & 12 deletions tine20/HumanResources/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,6 @@ class HumanResources_Config extends Tinebase_Config_Abstract
const WTR_CORRECTION_STATUS_ACCEPTED = 'ACCEPTED';
const WTR_CORRECTION_STATUS_DECLINED = 'DECLINED';

/**
* Vacation Status
* @var string
*/
const VACATION_STATUS = 'vacationStatus';

/**
* Sickness Status
* @var string
*/
const SICKNESS_STATUS = 'sicknessStatus';

/**
* Default Feast Calendar (used for tailoring datepicker)
* @var string
Expand Down
5 changes: 4 additions & 1 deletion tine20/HumanResources/Controller/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ class HumanResources_Controller_Account extends Tinebase_Controller_Record_Abstr
protected $_contractController = NULL;

protected $_getMultipleGrant = [HumanResources_Model_DivisionGrants::READ_EMPLOYEE_DATA];
protected $_requiredFilterACLget = [HumanResources_Model_DivisionGrants::READ_EMPLOYEE_DATA];
protected $_requiredFilterACLget = [
HumanResources_Model_DivisionGrants::READ_EMPLOYEE_DATA,
'|' . HumanResources_Model_DivisionGrants::READ_BASIC_EMPLOYEE_DATA
];
protected $_requiredFilterACLupdate = [HumanResources_Model_DivisionGrants::UPDATE_EMPLOYEE_DATA];
protected $_requiredFilterACLsync = [HumanResources_Model_DivisionGrants::READ_EMPLOYEE_DATA];
protected $_requiredFilterACLexport = [HumanResources_Model_DivisionGrants::READ_EMPLOYEE_DATA];
Expand Down
3 changes: 2 additions & 1 deletion tine20/HumanResources/Controller/FreeTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ public function getTakenVacationDays($employeeId, $period)
$freeTimes = $this->search(new HumanResources_Model_FreeTimeFilter([
['field' => 'employee_id', 'operator' => 'equals', 'value' => $employeeId],
['field' => 'type', 'operator' => 'equals', 'value' => HumanResources_Model_FreeTimeType::ID_VACATION],
['field' => HumanResources_Model_FreeTime::FLD_PROCESS_STATUS, 'operator' => 'equals', 'value' => HumanResources_Config::FREE_TIME_PROCESS_STATUS_ACCEPTED],
]));

return HumanResources_Controller_FreeDay::getInstance()->search(new HumanResources_Model_FreeDayFilter([
Expand Down Expand Up @@ -224,7 +225,7 @@ protected function _handleOverwrittenVacation($_record) {
array('field' => 'type', 'operator' => 'equals', 'value' => 'vacation')
));
$vacationTimeFilter->addFilter(new Tinebase_Model_Filter_Text(
array('field' => 'employee_id', 'operator' => 'equals', 'value' => $_record->employee_id)
array('field' => 'employee_id', 'operator' => 'equals', 'value' => $_record->getIdFromProperty('employee_id'))
));

$vacationTimes = $this->search($vacationTimeFilter);
Expand Down
3 changes: 2 additions & 1 deletion tine20/HumanResources/Controller/FreeTimeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ protected function _checkGrant($_record, $_action, $_throw = true, $_errorMessag
protected function _inspectBeforeUpdate($_record, $_oldRecord)
{
if ($_oldRecord->system || $_record->system) {
throw new Tinebase_Exception_Record_NotAllowed('system fields may not be updated');
// 20222-03-11 cweiss: I think update of system fields is OK and nessesary
// throw new Tinebase_Exception_Record_NotAllowed('system fields may not be updated');
}

parent::_inspectBeforeUpdate($_record, $_oldRecord);
Expand Down
3 changes: 2 additions & 1 deletion tine20/HumanResources/Controller/WageType.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ protected function __construct()
protected function _inspectBeforeUpdate($_record, $_oldRecord)
{
if ($_oldRecord->system || $_record->system) {
throw new Tinebase_Exception_Record_NotAllowed('system fields may not be updated');
// 20222-03-11 cweiss: I think update of system fields is OK and nessesary
// throw new Tinebase_Exception_Record_NotAllowed('system fields may not be updated');
}

parent::_inspectBeforeUpdate($_record, $_oldRecord);
Expand Down
2 changes: 1 addition & 1 deletion tine20/HumanResources/Frontend/Json.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class HumanResources_Frontend_Json extends Tinebase_Frontend_Json_Abstract
'Account',
HumanResources_Model_FreeTimeType::MODEL_NAME_PART,
'FreeDay',
'FreeTime',
HumanResources_Model_BLDailyWTReport_WorkingTime::MODEL_NAME_PART,
HumanResources_Model_DailyWTReport::MODEL_NAME_PART,
HumanResources_Model_MonthlyWTReport::MODEL_NAME_PART,
Expand All @@ -58,6 +57,7 @@ class HumanResources_Frontend_Json extends Tinebase_Frontend_Json_Abstract
HumanResources_Model_StreamModalReport::MODEL_NAME_PART,
HumanResources_Model_WageType::MODEL_NAME_PART,
HumanResources_Model_WorkingTimeScheme::MODEL_NAME_PART,
HumanResources_Model_FreeTime::MODEL_NAME_PART,
];

protected $_defaultModel = 'Employee';
Expand Down
2 changes: 1 addition & 1 deletion tine20/HumanResources/HumanResources.jsb2
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"path": "js/"
},
{
"text": "FreeTimeGridPanel.js",
"text": "EmployeeEditDialogFreeTimeGridPanel.js",
"path": "js/"
},
{
Expand Down
2 changes: 1 addition & 1 deletion tine20/HumanResources/Model/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class HumanResources_Model_Account extends Tinebase_Record_Abstract
protected static $_modelConfiguration = array(
'version' => 5,
'recordName' => 'Personal account', // ngettext('Personal account', 'Personal accounts', n)
'recordsName' => 'Personal accounts',
'recordsName' => 'Personal accounts', // gettext('GENDER_Personal account')
'hasRelations' => TRUE,
'hasCustomFields' => TRUE,
'hasNotes' => TRUE,
Expand Down
2 changes: 1 addition & 1 deletion tine20/HumanResources/Model/Contract.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class HumanResources_Model_Contract extends Tinebase_Record_Abstract
protected static $_modelConfiguration = array(
'version' => 4,
'recordName' => 'Contract', // ngettext('Contract', 'Contracts', n)
'recordsName' => 'Contracts',
'recordsName' => 'Contracts', // gettext('GENDER_Contract')
'hasRelations' => FALSE,
'hasCustomFields' => FALSE,
'hasNotes' => FALSE,
Expand Down
2 changes: 1 addition & 1 deletion tine20/HumanResources/Model/DailyWTReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class HumanResources_Model_DailyWTReport extends Tinebase_Record_Abstract
*/
protected static $_modelConfiguration = [
'version' => 3,
'recordName' => 'Daily Working Time Report',
'recordName' => 'Daily Working Time Report', // gettext('GENDER_Daily Working Time Report')
'recordsName' => 'Daily Working Time Reports', // ngettext('Daily Working Time Report', 'Daily Working Time Reports', n)
'containerProperty' => null,
'hasRelations' => true,
Expand Down
12 changes: 11 additions & 1 deletion tine20/HumanResources/Model/Employee.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class HumanResources_Model_Employee extends Tinebase_Record_Abstract
*/
protected static $_modelConfiguration = array(
'version' => 17,
'recordName' => 'Employee',
'recordName' => 'Employee', // gettext('GENDER_Employee')
'recordsName' => 'Employees', // ngettext('Employee', 'Employees', n)
'hasRelations' => TRUE,
'hasCustomFields' => TRUE,
Expand All @@ -51,6 +51,16 @@ class HumanResources_Model_Employee extends Tinebase_Record_Abstract
'appName' => 'HumanResources',
'modelName' => self::MODEL_NAME_PART,

self::JSON_EXPANDER => [
Tinebase_Record_Expander::EXPANDER_PROPERTIES => [
'division_id' => [
Tinebase_Record_Expander::EXPANDER_PROPERTY_CLASSES => [
Tinebase_Record_Expander::PROPERTY_CLASS_ACCOUNT_GRANTS => [],
]
]
]
],

'filterModel' => array(
'is_employed' => array(
'label' => 'Is employed', // _('Is employed')
Expand Down
2 changes: 1 addition & 1 deletion tine20/HumanResources/Model/FreeDay.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class HumanResources_Model_FreeDay extends Tinebase_Record_Abstract
protected static $_modelConfiguration = array(
'version' => 3,
'recordName' => 'Free Day', // ngettext('Free Day', 'Free Days', n)
'recordsName' => 'Free Days',
'recordsName' => 'Free Days', // gettext('GENDER_Free Day')
'hasRelations' => FALSE,
'hasCustomFields' => FALSE,
'hasNotes' => FALSE,
Expand Down
24 changes: 19 additions & 5 deletions tine20/HumanResources/Model/FreeTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
*/
class HumanResources_Model_FreeTime extends Tinebase_Record_Abstract
{
public const MODEL_NAME_PART = 'FreeTime';

public const TABLE_NAME = 'humanresources_freetime';
public const FLD_TYPE_STATUS = 'type_status';
public const FLD_PROCESS_STATUS = 'process_status';
Expand All @@ -32,20 +34,32 @@ class HumanResources_Model_FreeTime extends Tinebase_Record_Abstract
protected static $_modelConfiguration = array(
'version' => 10,
'recordName' => 'Free Time', // ngettext('Free Time', 'Free Times', n)
'recordsName' => 'Free Times',
'recordsName' => 'Free Times', // gettext('GENDER_Free Time')
'hasRelations' => FALSE,
'hasCustomFields' => FALSE,
'hasNotes' => FALSE,
'hasTags' => FALSE,
'hasAttachments' => TRUE,
'modlogActive' => TRUE,
'isDependent' => TRUE,
'createModule' => FALSE,
'createModule' => TRUE,
'titleProperty' => 'description',
'appName' => 'HumanResources',
'modelName' => 'FreeTime',
'requiredRight' => HumanResources_Acl_Rights::MANAGE_WORKINGTIME,
self::DELEGATED_ACL_FIELD => 'employee_id',

self::JSON_EXPANDER => [
Tinebase_Record_Expander::EXPANDER_PROPERTIES => [
'employee_id' => [
Tinebase_Record_Expander::EXPANDER_PROPERTIES => [
'division_id' => [
Tinebase_Record_Expander::EXPANDER_PROPERTY_CLASSES => [
Tinebase_Record_Expander::PROPERTY_CLASS_ACCOUNT_GRANTS => [],
]
]
]
]
]
],
'associations' => [
\Doctrine\ORM\Mapping\ClassMetadataInfo::MANY_TO_ONE => [
'employee_id' => [
Expand Down Expand Up @@ -104,7 +118,7 @@ class HumanResources_Model_FreeTime extends Tinebase_Record_Abstract
)
),
'type' => array(
'label' => 'Type', // _('Type')
'label' => 'Absence reason', // _('Absence reason')
'type' => self::TYPE_RECORD,
'config' => array(
'appName' => HumanResources_Config::APP_NAME,
Expand Down
2 changes: 1 addition & 1 deletion tine20/HumanResources/Model/FreeTimeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class HumanResources_Model_FreeTimeType extends Tinebase_Record_Abstract
*/
protected static $_modelConfiguration = [
self::VERSION => 3,
self::RECORD_NAME => 'Absence reason',
self::RECORD_NAME => 'Absence reason', // gettext('GENDER_Absence reason')
self::RECORDS_NAME => 'Absence reasons', // ngettext('Absence reason', 'Absence reasons', n)
self::TITLE_PROPERTY => 'name',
self::HAS_CUSTOM_FIELDS => true,
Expand Down
2 changes: 1 addition & 1 deletion tine20/HumanResources/Model/MonthlyWTReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class HumanResources_Model_MonthlyWTReport extends Tinebase_Record_Abstract
*/
protected static $_modelConfiguration = [
self::VERSION => 2,
self::RECORD_NAME => 'Monthly Working Time Report',
self::RECORD_NAME => 'Monthly Working Time Report', // gettext('GENDER_Monthly Working Time Report')
self::RECORDS_NAME => 'Monthly Working Time Reports', // ngettext('Monthly Working Time Report', 'Monthly Working Time Reports', n)
self::TITLE_PROPERTY => self::FLDS_MONTH,
self::HAS_CUSTOM_FIELDS => true,
Expand Down
2 changes: 1 addition & 1 deletion tine20/HumanResources/Model/Stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class HumanResources_Model_Stream extends Tinebase_Record_NewAbstract
*/
protected static $_modelConfiguration = [
self::VERSION => 1,
self::RECORD_NAME => 'Stream',
self::RECORD_NAME => 'Stream', // gettext('GENDER_Stream')
self::RECORDS_NAME => 'Streams', // ngettext('Stream', 'Streams', n)
self::HAS_RELATIONS => true,
self::COPY_RELATIONS => false,
Expand Down
2 changes: 1 addition & 1 deletion tine20/HumanResources/Model/StreamModalReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class HumanResources_Model_StreamModalReport extends Tinebase_Record_NewAbstract
*/
protected static $_modelConfiguration = [
self::VERSION => 1,
self::RECORD_NAME => 'Modality Report',
self::RECORD_NAME => 'Modality Report', // gettext('GENDER_Modality Report')
self::RECORDS_NAME => 'Modality Reports', // ngettext('Modality Report', 'Modality Reports', n)
self::HAS_RELATIONS => true,
self::COPY_RELATIONS => false,
Expand Down
2 changes: 1 addition & 1 deletion tine20/HumanResources/Model/StreamModality.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class HumanResources_Model_StreamModality extends Tinebase_Record_NewAbstract
*/
protected static $_modelConfiguration = [
self::VERSION => 1,
self::RECORD_NAME => 'Modality',
self::RECORD_NAME => 'Modality', // gettext('GENDER_Modality')
self::RECORDS_NAME => 'Modalities', // ngettext('Modality', 'Modalities', n)
self::HAS_RELATIONS => true,
self::COPY_RELATIONS => false,
Expand Down
2 changes: 1 addition & 1 deletion tine20/HumanResources/Model/WageType.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class HumanResources_Model_WageType extends Tinebase_Record_Abstract
*/
protected static $_modelConfiguration = [
self::VERSION => 1,
self::RECORD_NAME => 'Wage type',
self::RECORD_NAME => 'Wage type', // gettext('GENDER_Wage type')
self::RECORDS_NAME => 'Wage types', // ngettext('Wage type', 'Wage types', n)
self::TITLE_PROPERTY => 'name',
self::HAS_CUSTOM_FIELDS => true,
Expand Down
2 changes: 1 addition & 1 deletion tine20/HumanResources/Model/WorkingTimeScheme.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class HumanResources_Model_WorkingTimeScheme extends Tinebase_Record_NewAbstract
*/
protected static $_modelConfiguration = array(
self::VERSION => self::MY_VERSION,
self::RECORD_NAME => 'Working time scheme',
self::RECORD_NAME => 'Working time scheme', // gettext('GENDER_Working time scheme')
self::RECORDS_NAME => 'Working time schemes', // ngettext('Working time scheme', 'Working time schemes', n)
self::MODLOG_ACTIVE => TRUE,
self::IS_DEPENDENT => TRUE,
Expand Down

0 comments on commit 4041ba6

Please sign in to comment.