Skip to content

Instantly share code, notes, and snippets.

@papinianus
Created December 13, 2023 17:12
Show Gist options
  • Save papinianus/9a2c1de349f5c5e97e1baafe58ca8f88 to your computer and use it in GitHub Desktop.
Save papinianus/9a2c1de349f5c5e97e1baafe58ca8f88 to your computer and use it in GitHub Desktop.
勤怠管理のサイトパッケージ
{
"HeaderInfo": {
"AssemblyVersion": "1.3.49.0",
"BaseSiteId": 9534841,
"Server": "https://demo.pleasanter.org",
"CreatorName": "テナント管理者",
"PackageTime": "2023-12-13T17:10:00.2559769+00:00",
"Convertors": [
{
"SiteId": 9534841,
"SiteTitle": "勤務時間管理",
"ReferenceType": "Sites",
"IncludeData": false,
"Order": "[]"
},
{
"SiteId": 9534840,
"SiteTitle": "入退室ログ",
"ReferenceType": "Results",
"IncludeData": false
},
{
"SiteId": 9536097,
"SiteTitle": "勤怠",
"ReferenceType": "Issues",
"IncludeData": false
}
],
"IncludeSitePermission": true,
"IncludeRecordPermission": true,
"IncludeColumnPermission": false,
"IncludeNotifications": false,
"IncludeReminders": false
},
"Sites": [
{
"TenantId": 13658,
"SiteId": 9534841,
"Title": "勤務時間管理",
"SiteName": "",
"SiteGroupName": "",
"Body": "",
"GridGuide": "",
"EditorGuide": "",
"CalendarGuide": "",
"CrosstabGuide": "",
"GanttGuide": "",
"BurnDownGuide": "",
"TimeSeriesGuide": "",
"KambanGuide": "",
"ImageLibGuide": "",
"ReferenceType": "Sites",
"ParentId": 0,
"InheritPermission": 9534841,
"SiteSettings": {
"Version": 1.017,
"ReferenceType": "Sites",
"NoDisplayIfReadOnly": false
},
"Publish": false,
"DisableCrossSearch": false,
"Comments": []
},
{
"TenantId": 13658,
"SiteId": 9534840,
"Title": "入退室ログ",
"SiteName": "",
"SiteGroupName": "",
"Body": "",
"GridGuide": "",
"EditorGuide": "",
"CalendarGuide": "",
"CrosstabGuide": "",
"GanttGuide": "",
"BurnDownGuide": "",
"TimeSeriesGuide": "",
"KambanGuide": "",
"ImageLibGuide": "",
"ReferenceType": "Results",
"ParentId": 9534841,
"InheritPermission": 9534840,
"SiteSettings": {
"Version": 1.017,
"ReferenceType": "Results",
"GridColumns": [
"ResultId",
"DateA",
"ClassA",
"ClassB",
"ClassC",
"Owner"
],
"EditorColumnHash": {
"General": [
"ResultId",
"DateA",
"ClassA",
"ClassB",
"Owner",
"ClassC"
]
},
"Columns": [
{
"ColumnName": "DateA",
"LabelText": "操作時刻",
"GridFormat": "Ymdhms",
"EditorFormat": "Ymdhms",
"DateTimeStep": 1
},
{
"ColumnName": "ClassA",
"LabelText": "場所"
},
{
"ColumnName": "ClassB",
"LabelText": "入退室",
"ChoicesText": "入室\n退室",
"SearchType": "PartialMatch"
},
{
"ColumnName": "Owner",
"LabelText": "ユーザ"
},
{
"ColumnName": "ClassC",
"LabelText": "ユーザコード"
}
],
"ImportEncoding": "UTF-8",
"ServerScripts": [
{
"Title": "OwnerFromUserCode",
"Name": "",
"BeforeCreate": true,
"Body": "const code = model.ClassC;\nmodel.Owner = 0;\nconst deptIds = [123135, 123136, 123137];\nlet id = -1;\nfor (let deptId of deptIds) {\n for (let user of depts.Get(deptId).GetMembers()) {\n if (user.UserCode === code) {\n id = user.UserId;\n break;\n }\n }\n if (id !== -1) {\n model.Owner = id;\n break;\n }\n}\n",
"Id": 1
}
],
"NoDisplayIfReadOnly": false,
"PermissionForCreating": {
"Owner": 5
},
"PermissionForUpdating": {
"Owner": 5
}
},
"Publish": false,
"DisableCrossSearch": false,
"Comments": []
},
{
"TenantId": 13658,
"SiteId": 9536097,
"Title": "勤怠",
"SiteName": "",
"SiteGroupName": "",
"Body": "",
"GridGuide": "",
"EditorGuide": "",
"CalendarGuide": "",
"CrosstabGuide": "",
"GanttGuide": "",
"BurnDownGuide": "",
"TimeSeriesGuide": "",
"KambanGuide": "",
"ImageLibGuide": "",
"ReferenceType": "Issues",
"ParentId": 9534841,
"InheritPermission": 9536097,
"SiteSettings": {
"Version": 1.017,
"ReferenceType": "Issues",
"GridColumns": [
"IssueId",
"Status",
"Owner",
"DateA",
"DateB",
"DateC",
"DateD",
"DateE",
"CheckA",
"CheckB"
],
"EditorColumnHash": {
"General": [
"IssueId",
"Status",
"Owner",
"ClassC",
"DateA",
"ClassA",
"ClassB",
"DateB",
"DateC",
"DateD",
"DateE",
"CheckA",
"CheckB",
"ClassD",
"CompletionTime"
]
},
"Columns": [
{
"ColumnName": "StartTime",
"EditorFormat": "Ymdhm",
"DateTimeStep": 1
},
{
"ColumnName": "CompletionTime",
"EditorFormat": "Ymdhm",
"DateTimeStep": 1
},
{
"ColumnName": "DateA",
"LabelText": "勤務日",
"GridFormat": "Ymd"
},
{
"ColumnName": "ClassA",
"LabelText": "始業"
},
{
"ColumnName": "ClassB",
"LabelText": "終業"
},
{
"ColumnName": "Owner",
"LabelText": "ユーザ"
},
{
"ColumnName": "ClassC",
"LabelText": "ユーザコード"
},
{
"ColumnName": "DateB",
"LabelText": "出勤",
"GridFormat": "Ymdhm",
"EditorFormat": "Ymdhm",
"DateTimeStep": 1
},
{
"ColumnName": "DateC",
"LabelText": "退勤",
"GridFormat": "Ymdhm",
"EditorFormat": "Ymdhm",
"DateTimeStep": 1
},
{
"ColumnName": "DateD",
"LabelText": "入室",
"GridFormat": "Ymdhm",
"EditorFormat": "Ymdhms"
},
{
"ColumnName": "DateE",
"LabelText": "退室",
"GridFormat": "Ymdhm",
"EditorFormat": "Ymdhms"
},
{
"ColumnName": "ClassD",
"LabelText": "理由"
}
],
"StatusControls": [
{
"Id": 1,
"Name": "完了したら読取専用",
"Status": -1,
"ReadOnly": true,
"View": {
"Id": 0,
"ColumnFilterHash": {
"Status": "[\"900\"]"
},
"ApiColumnKeyDisplayType": 0,
"ApiColumnValueDisplayType": 0,
"ApiDataType": 0
}
}
],
"ImportEncoding": "UTF-8",
"Exports": [
{
"Name": "minimum",
"Columns": [
{
"Id": 1,
"ColumnName": "Owner"
},
{
"Id": 2,
"ColumnName": "ClassC"
},
{
"Id": 3,
"ColumnName": "DateA"
},
{
"Id": 4,
"ColumnName": "ClassA"
},
{
"Id": 5,
"ColumnName": "ClassB"
},
{
"Id": 6,
"ColumnName": "CompletionTime"
}
],
"Type": 0,
"DelimiterType": 0,
"ExecutionType": 0,
"Id": 1
}
],
"ServerScripts": [
{
"Title": "OwnerFromUserCode",
"Name": "",
"BeforeCreate": true,
"Body": "const code = model.ClassC;\nmodel.Owner = 0;\nconst deptIds = [123135, 123136, 123137];\nlet id = -1;\nfor (let deptId of deptIds) {\n for (let user of depts.Get(deptId).GetMembers()) {\n if (user.UserCode === code) {\n id = user.UserId;\n break;\n }\n }\n if (id !== -1) {\n model.Owner = id;\n break;\n }\n}",
"Id": 1
},
{
"Title": "PullLog",
"Name": "",
"BeforeCreate": true,
"Body": "const digits2 = (n) => n.toString().padStart(2, '0');\nconst dateFormat = (d) => `${d.getFullYear()}/${digits2(d.getMonth() + 1)}/${digits2(d.getDate())} ${digits2(d.getHours())}:${digits2(d.getMinutes())}:${digits2(d.getSeconds())}`;\nconst logSiteId = 9534840;\nconst owner = model.Owner;\nconst workDate = model.DateA;\nconst nextDate = new Date(workDate)\nnextDate.setDate(nextDate.getDate() + 1);\nif (typeof owner === 'number' && owner > 1) {\n const paramsIn = {\n View: {\n ColumnFilterHash: {\n Owner: owner,\n DateA: JSON.stringify([`${dateFormat(workDate)},${dateFormat(nextDate)}`]),\n ClassB: \"[\\\"入室\\\"]\"\n },\n ColumnSorterHash: {\n DateA: \"asc\"\n },\n ColumnFilterSearchTypes: {\n ClassB: \"ExactMatch\"\n }\n },\n };\n let results = items.Get(logSiteId, JSON.stringify(paramsIn));\n if (results.Length > 0) {\n model.DateD = results[0].DateA;\n }\n const paramsOut = {\n View: {\n ColumnFilterHash: {\n Owner: owner,\n DateA: JSON.stringify([\n `${dateFormat(workDate)},${dateFormat(nextDate)}`,\n ]),\n ClassB: '[\"退室\"]',\n },\n ColumnSorterHash: {\n DateA: 'desc',\n },\n ColumnFilterSearchTypes: {\n ClassB: 'ExactMatch',\n },\n },\n };\n results = items.Get(logSiteId, JSON.stringify(paramsOut));\n if (results.Length > 0) {\n model.DateE = results[0].DateA;\n }\n}",
"Id": 2
},
{
"Title": "BuildDate",
"Name": "",
"BeforeCreate": true,
"Body": "const theDate = model.DateA\nconst startTime = `${model.ClassA}`\nif (startTime.includes(\":\")) {\n model.DateB = new Date(`${theDate.toISOString().substr(0,10)} ${startTime}`)\n}\nconst endTime = `${model.ClassB}`;\nif (endTime.includes(':')) {\n model.DateC = new Date(`${theDate.toISOString().substr(0, 10)} ${endTime}`);\n}",
"Id": 3
},
{
"Title": "StatusCheck",
"Name": "",
"BeforeCreate": true,
"Body": "const threshold = 15 * 60 * 1000; // 15 min\nif (Math.abs(model.DateB.getTime() - model.DateD.getTime()) > threshold) {\n model.CheckA = true;\n}\nif (Math.abs(model.DateC.getTime() - model.DateE.getTime()) > threshold) {\n model.CheckB = true;\n}\nif (!model.CheckA && !model.CheckB) {\n model.Status = 900;\n} else {\n model.Status = 300;\n}\n",
"Id": 4
}
],
"NoDisplayIfReadOnly": false,
"PermissionForCreating": {
"Owner": 5
}
},
"Publish": false,
"DisableCrossSearch": false,
"Comments": []
}
],
"Data": [],
"Permissions": [
{
"SiteId": 9534841,
"Permissions": [
{
"ReferenceId": 9534840,
"DeptId": 0,
"GroupId": 0,
"UserId": -1,
"PermissionType": 0
},
{
"ReferenceId": 9534840,
"DeptId": 0,
"GroupId": 0,
"UserId": 275509,
"PermissionType": 511
},
{
"ReferenceId": 9534840,
"DeptId": 123134,
"GroupId": 0,
"UserId": 0,
"PermissionType": 95
},
{
"ReferenceId": 9534841,
"DeptId": 0,
"GroupId": 0,
"UserId": -1,
"PermissionType": 31
},
{
"ReferenceId": 9534841,
"DeptId": 0,
"GroupId": 0,
"UserId": 275509,
"PermissionType": 511
},
{
"ReferenceId": 9536097,
"DeptId": 0,
"GroupId": 0,
"UserId": -1,
"PermissionType": 0
},
{
"ReferenceId": 9536097,
"DeptId": 0,
"GroupId": 0,
"UserId": 275509,
"PermissionType": 511
},
{
"ReferenceId": 9536097,
"DeptId": 123134,
"GroupId": 0,
"UserId": 0,
"PermissionType": 31
}
]
},
{
"SiteId": 9534840,
"Permissions": [
{
"ReferenceId": 9534840,
"DeptId": 0,
"GroupId": 0,
"UserId": -1,
"PermissionType": 0
},
{
"ReferenceId": 9534840,
"DeptId": 0,
"GroupId": 0,
"UserId": 275509,
"PermissionType": 511
},
{
"ReferenceId": 9534840,
"DeptId": 123134,
"GroupId": 0,
"UserId": 0,
"PermissionType": 95
},
{
"ReferenceId": 9536100,
"DeptId": 0,
"GroupId": 0,
"UserId": 275510,
"PermissionType": 5
},
{
"ReferenceId": 9536101,
"DeptId": 0,
"GroupId": 0,
"UserId": 275511,
"PermissionType": 5
},
{
"ReferenceId": 9536102,
"DeptId": 0,
"GroupId": 0,
"UserId": 275512,
"PermissionType": 5
},
{
"ReferenceId": 9536103,
"DeptId": 0,
"GroupId": 0,
"UserId": 275510,
"PermissionType": 5
},
{
"ReferenceId": 9536104,
"DeptId": 0,
"GroupId": 0,
"UserId": 275511,
"PermissionType": 5
},
{
"ReferenceId": 9536105,
"DeptId": 0,
"GroupId": 0,
"UserId": 275512,
"PermissionType": 5
},
{
"ReferenceId": 9536106,
"DeptId": 0,
"GroupId": 0,
"UserId": 275510,
"PermissionType": 5
},
{
"ReferenceId": 9536107,
"DeptId": 0,
"GroupId": 0,
"UserId": 275511,
"PermissionType": 5
},
{
"ReferenceId": 9536108,
"DeptId": 0,
"GroupId": 0,
"UserId": 275512,
"PermissionType": 5
},
{
"ReferenceId": 9536109,
"DeptId": 0,
"GroupId": 0,
"UserId": 275510,
"PermissionType": 5
},
{
"ReferenceId": 9536110,
"DeptId": 0,
"GroupId": 0,
"UserId": 275511,
"PermissionType": 5
},
{
"ReferenceId": 9536111,
"DeptId": 0,
"GroupId": 0,
"UserId": 275512,
"PermissionType": 5
},
{
"ReferenceId": 9536112,
"DeptId": 0,
"GroupId": 0,
"UserId": 275510,
"PermissionType": 5
},
{
"ReferenceId": 9536113,
"DeptId": 0,
"GroupId": 0,
"UserId": 275511,
"PermissionType": 5
},
{
"ReferenceId": 9536114,
"DeptId": 0,
"GroupId": 0,
"UserId": 275512,
"PermissionType": 5
},
{
"ReferenceId": 9536115,
"DeptId": 0,
"GroupId": 0,
"UserId": 275510,
"PermissionType": 5
},
{
"ReferenceId": 9536116,
"DeptId": 0,
"GroupId": 0,
"UserId": 275511,
"PermissionType": 5
},
{
"ReferenceId": 9536117,
"DeptId": 0,
"GroupId": 0,
"UserId": 275512,
"PermissionType": 5
},
{
"ReferenceId": 9536118,
"DeptId": 0,
"GroupId": 0,
"UserId": 275510,
"PermissionType": 5
},
{
"ReferenceId": 9536119,
"DeptId": 0,
"GroupId": 0,
"UserId": 275511,
"PermissionType": 5
},
{
"ReferenceId": 9536120,
"DeptId": 0,
"GroupId": 0,
"UserId": 275512,
"PermissionType": 5
},
{
"ReferenceId": 9536121,
"DeptId": 0,
"GroupId": 0,
"UserId": 275510,
"PermissionType": 5
},
{
"ReferenceId": 9536122,
"DeptId": 0,
"GroupId": 0,
"UserId": 275511,
"PermissionType": 5
},
{
"ReferenceId": 9536123,
"DeptId": 0,
"GroupId": 0,
"UserId": 275512,
"PermissionType": 5
},
{
"ReferenceId": 9536144,
"DeptId": 0,
"GroupId": 0,
"UserId": 275510,
"PermissionType": 5
},
{
"ReferenceId": 9536145,
"DeptId": 0,
"GroupId": 0,
"UserId": 275511,
"PermissionType": 5
},
{
"ReferenceId": 9536146,
"DeptId": 0,
"GroupId": 0,
"UserId": 275512,
"PermissionType": 5
},
{
"ReferenceId": 9536147,
"DeptId": 0,
"GroupId": 0,
"UserId": 275510,
"PermissionType": 5
},
{
"ReferenceId": 9536148,
"DeptId": 0,
"GroupId": 0,
"UserId": 275511,
"PermissionType": 5
},
{
"ReferenceId": 9536149,
"DeptId": 0,
"GroupId": 0,
"UserId": 275512,
"PermissionType": 5
},
{
"ReferenceId": 9536150,
"DeptId": 0,
"GroupId": 0,
"UserId": 275510,
"PermissionType": 5
},
{
"ReferenceId": 9536151,
"DeptId": 0,
"GroupId": 0,
"UserId": 275511,
"PermissionType": 5
},
{
"ReferenceId": 9536152,
"DeptId": 0,
"GroupId": 0,
"UserId": 275512,
"PermissionType": 5
},
{
"ReferenceId": 9536153,
"DeptId": 0,
"GroupId": 0,
"UserId": 275510,
"PermissionType": 5
},
{
"ReferenceId": 9536154,
"DeptId": 0,
"GroupId": 0,
"UserId": 275511,
"PermissionType": 5
},
{
"ReferenceId": 9536155,
"DeptId": 0,
"GroupId": 0,
"UserId": 275512,
"PermissionType": 5
},
{
"ReferenceId": 9536156,
"DeptId": 0,
"GroupId": 0,
"UserId": 275510,
"PermissionType": 5
},
{
"ReferenceId": 9536157,
"DeptId": 0,
"GroupId": 0,
"UserId": 275511,
"PermissionType": 5
},
{
"ReferenceId": 9536158,
"DeptId": 0,
"GroupId": 0,
"UserId": 275512,
"PermissionType": 5
},
{
"ReferenceId": 9536159,
"DeptId": 0,
"GroupId": 0,
"UserId": 275510,
"PermissionType": 5
},
{
"ReferenceId": 9536160,
"DeptId": 0,
"GroupId": 0,
"UserId": 275511,
"PermissionType": 5
},
{
"ReferenceId": 9536161,
"DeptId": 0,
"GroupId": 0,
"UserId": 275512,
"PermissionType": 5
},
{
"ReferenceId": 9536162,
"DeptId": 0,
"GroupId": 0,
"UserId": 275510,
"PermissionType": 5
},
{
"ReferenceId": 9536163,
"DeptId": 0,
"GroupId": 0,
"UserId": 275511,
"PermissionType": 5
},
{
"ReferenceId": 9536164,
"DeptId": 0,
"GroupId": 0,
"UserId": 275512,
"PermissionType": 5
},
{
"ReferenceId": 9536165,
"DeptId": 0,
"GroupId": 0,
"UserId": 275510,
"PermissionType": 5
},
{
"ReferenceId": 9536166,
"DeptId": 0,
"GroupId": 0,
"UserId": 275511,
"PermissionType": 5
},
{
"ReferenceId": 9536167,
"DeptId": 0,
"GroupId": 0,
"UserId": 275512,
"PermissionType": 5
}
]
},
{
"SiteId": 9536097,
"Permissions": [
{
"ReferenceId": 9536097,
"DeptId": 0,
"GroupId": 0,
"UserId": -1,
"PermissionType": 0
},
{
"ReferenceId": 9536097,
"DeptId": 0,
"GroupId": 0,
"UserId": 275509,
"PermissionType": 511
},
{
"ReferenceId": 9536097,
"DeptId": 123134,
"GroupId": 0,
"UserId": 0,
"PermissionType": 31
},
{
"ReferenceId": 9536138,
"DeptId": 0,
"GroupId": 0,
"UserId": 275510,
"PermissionType": 5
},
{
"ReferenceId": 9536139,
"DeptId": 0,
"GroupId": 0,
"UserId": 275511,
"PermissionType": 5
},
{
"ReferenceId": 9536140,
"DeptId": 0,
"GroupId": 0,
"UserId": 275512,
"PermissionType": 5
},
{
"ReferenceId": 9536141,
"DeptId": 0,
"GroupId": 0,
"UserId": 275510,
"PermissionType": 5
},
{
"ReferenceId": 9536142,
"DeptId": 0,
"GroupId": 0,
"UserId": 275511,
"PermissionType": 5
},
{
"ReferenceId": 9536143,
"DeptId": 0,
"GroupId": 0,
"UserId": 275512,
"PermissionType": 5
}
]
}
],
"PermissionIdList": {
"DeptIdList": [
{
"DeptId": 123134,
"DeptCode": "000110"
}
],
"GroupIdList": [],
"UserIdList": [
{
"UserId": 275509,
"LoginId": "Tenant13658_User1"
},
{
"UserId": 275510,
"LoginId": "Tenant13658_User2"
},
{
"UserId": 275511,
"LoginId": "Tenant13658_User3"
},
{
"UserId": 275512,
"LoginId": "Tenant13658_User4"
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment