mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 23:16:03 +00:00
Working time calendar default field, users, teams panels
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Classes\FieldProcessing\WorkingTimeCalendar;
|
||||
|
||||
use Espo\Core\FieldProcessing\Loader;
|
||||
use Espo\Core\FieldProcessing\Loader\Params;
|
||||
use Espo\Core\Utils\Config;
|
||||
use Espo\Entities\WorkingTimeCalendar;
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
/**
|
||||
* @implements Loader<WorkingTimeCalendar>
|
||||
*/
|
||||
class IsDefaultLoader implements Loader
|
||||
{
|
||||
public function __construct(
|
||||
private Config $config,
|
||||
) {}
|
||||
|
||||
public function process(Entity $entity, Params $params): void
|
||||
{
|
||||
$isDefault = $entity->getId() === $this->config->get('workingTimeCalendarId');
|
||||
|
||||
$entity->set('isDefault', $isDefault);
|
||||
}
|
||||
}
|
||||
@@ -18,9 +18,14 @@
|
||||
"weekday3TimeRanges": "Wed Schedule",
|
||||
"weekday4TimeRanges": "Thu Schedule",
|
||||
"weekday5TimeRanges": "Fri Schedule",
|
||||
"weekday6TimeRanges": "Sat Schedule"
|
||||
"weekday6TimeRanges": "Sat Schedule",
|
||||
"isDefault": "Is Default"
|
||||
},
|
||||
"links": {
|
||||
"users": "Users",
|
||||
"ranges": "Exceptions"
|
||||
},
|
||||
"tooltips": {
|
||||
"isDefault": "Indicates whether this calendar is the system default. The default working time calendar can be configured in: Administration > Settings > Working Time Calendar."
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
[]
|
||||
[
|
||||
"isDefault"
|
||||
]
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
{
|
||||
"name": "name",
|
||||
"link": true
|
||||
},
|
||||
{
|
||||
"name": "isDefault",
|
||||
"width": 14
|
||||
}
|
||||
]
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
[
|
||||
"ranges"
|
||||
"ranges",
|
||||
"users",
|
||||
"teams"
|
||||
]
|
||||
|
||||
@@ -15,5 +15,17 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"relationshipPanels": {
|
||||
"teams": {
|
||||
"createDisabled": true,
|
||||
"editDisabled": true,
|
||||
"removeDisabled": true
|
||||
},
|
||||
"users": {
|
||||
"createDisabled": true,
|
||||
"editDisabled": true,
|
||||
"removeDisabled": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,6 +83,14 @@
|
||||
"default": null,
|
||||
"view": "views/working-time-calendar/fields/time-ranges"
|
||||
},
|
||||
"isDefault": {
|
||||
"type": "bool",
|
||||
"readOnly": true,
|
||||
"notStorable": true,
|
||||
"orderDisabled": true,
|
||||
"loaderClassName": "Espo\\Classes\\FieldProcessing\\WorkingTimeCalendar\\IsDefaultLoader",
|
||||
"tooltip": true
|
||||
},
|
||||
"teams": {
|
||||
"type": "linkMultiple",
|
||||
"readOnly": true
|
||||
@@ -110,6 +118,12 @@
|
||||
"foreign": "calendars",
|
||||
"entity": "WorkingTimeRange"
|
||||
},
|
||||
"users": {
|
||||
"type": "hasMany",
|
||||
"foreign": "workingTimeCalendar",
|
||||
"entity": "User",
|
||||
"readOnly": true
|
||||
},
|
||||
"teams": {
|
||||
"type": "hasMany",
|
||||
"foreign": "workingTimeCalendar",
|
||||
|
||||
@@ -79,6 +79,16 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"isDefault": {
|
||||
"visible": {
|
||||
"conditionGroup": [
|
||||
{
|
||||
"type": "isNotEmpty",
|
||||
"attribute": "id"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user