Skip to content

Commit 5a02341

Browse files
committed
Merge branch 'develop'
2 parents eb9f052 + 68e19aa commit 5a02341

27 files changed

+457
-301
lines changed

Database/PostgreSQL/pg-build-schema.psql

Lines changed: 184 additions & 154 deletions
Large diffs are not rendered by default.

Database/PostgreSQL/pg-update-1.0to5.4.psql

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ ALTER TABLE object_acl
1212

1313
ALTER TABLE document ADD COLUMN company_id INT NULL;
1414
ALTER TABLE document ADD COLUMN job_id INT NULL;
15+
ALTER TABLE document ADD COLUMN keywords TEXT NULL;
16+
ALTER TABLE document ADD COLUMN tags_array TEXT[] GENERATED ALWAYS
17+
AS (string_to_array(keywords, ', ')) STORED;
18+
CREATE INDEX document_tags_gin ON document USING GIN (tags_array);
1519

1620
CREATE TABLE ctags (
1721
entity VARCHAR NOT NULL,
@@ -33,6 +37,9 @@ ALTER TABLE company ADD COLUMN family_status VARCHAR(255) NULL;
3337
ALTER TABLE company ADD COLUMN citizenship VARCHAR(255) NULL; -- CSV?!
3438
ALTER TABLE company ADD COLUMN dayofdeath TIMESTAMP WITH TIME ZONE NULL;
3539
ALTER TABLE company ADD COLUMN modern_password VARCHAR(255) NULL;
40+
ALTER TABLE company ADD COLUMN tags_array TEXT[] GENERATED ALWAYS
41+
AS (string_to_array(keywords, ', ')) STORED;
42+
CREATE INDEX company_tags_gin ON company USING GIN (tags_array);
3643

3744
-- district of a city (eg Magdeburg "Nord")
3845
ALTER TABLE address ADD COLUMN district VARCHAR(255) NULL;
@@ -52,7 +59,8 @@ ALTER TABLE address ADD CONSTRAINT company_unique_adrtype
5259

5360

5461
-- prepare for project hierarchies
55-
ALTER TABLE project ADD COLUMN parent_project_id INT NULL;
62+
ALTER TABLE project ADD COLUMN parent_project_id INT NULL;
63+
ALTER TABLE project ADD COLUMN source_url VARCHAR(255) NULL;
5664

5765
CREATE TABLE login_token (
5866
token VARCHAR(4096) PRIMARY KEY,
@@ -65,15 +73,27 @@ CREATE TABLE login_token (
6573
expiration_date TIMESTAMP WITH TIME ZONE NULL
6674
);
6775

68-
ALTER TABLE job ADD COLUMN owner_id INT;
76+
ALTER TABLE job ADD COLUMN owner_id INT;
6977
UPDATE job SET owner_id = creator_id WHERE owner_id IS NULL;
70-
ALTER TABLE job ADD COLUMN date_id INT;
71-
ALTER TABLE job ADD COLUMN url TEXT;
78+
ALTER TABLE job ADD COLUMN date_id INT;
79+
ALTER TABLE job ADD COLUMN url TEXT;
80+
ALTER TABLE job ADD COLUMN tags_array TEXT[] GENERATED ALWAYS
81+
AS (string_to_array(keywords, ', ')) STORED;
82+
CREATE INDEX job_tags_gin ON job USING GIN (tags_array);
7283

7384
ALTER TABLE date_x ADD COLUMN project_id INT;
7485
ALTER TABLE date_x ADD COLUMN url TEXT;
7586
ALTER TABLE date_x ADD COLUMN location_id INT;
7687
ALTER TABLE date_x ADD COLUMN location_id_version INT;
88+
ALTER TABLE date_x ADD COLUMN tags_array TEXT[] GENERATED ALWAYS
89+
AS (string_to_array(apt_type, ', ')) STORED;
90+
ALTER TABLE date_x ADD COLUMN write_access_ids INT[] GENERATED ALWAYS
91+
AS (string_to_array(write_access_list, ',')::INT[]) STORED;
92+
ALTER TABLE date_x ADD COLUMN resource_names_array TEXT[] GENERATED ALWAYS
93+
AS (string_to_array(resource_names, ', ')) STORED;
94+
CREATE INDEX date_tags_gin ON date_x USING GIN (tags_array);
95+
CREATE INDEX date_writeacl_gin ON date_x USING GIN (write_access_ids);
96+
CREATE INDEX date_resources_gin ON date_x USING GIN (resource_names_array);
7797

7898
-- pg-update-1.0to5.4.psql, used to be a separate file
7999

@@ -97,7 +117,8 @@ ALTER TABLE project_company_assignment
97117

98118
-- field to connect documents and notes to contacts
99119
-- Also in pg-update-1.x-to-5.5.psql
100-
ALTER TABLE document ADD COLUMN company_id INT NULL;
120+
ALTER TABLE document ADD COLUMN company_id INT NULL;
121+
ALTER TABLE document ADD COLUMN source_url VARCHAR(255) NULL;
101122

102123

103124
-- both do not work on SX:
@@ -561,25 +582,25 @@ ALTER TABLE document ADD COLUMN text_content_object_version INT NULL;
561582
-- 56+ - things changed in 2025
562583
UPDATE table_version SET table_version = 55 WHERE table_name = '_model';
563584
UPDATE table_version SET table_version = 56 WHERE table_name = 'address';
564-
UPDATE table_version SET table_version = 56 WHERE table_name = 'company';
585+
UPDATE table_version SET table_version = 57 WHERE table_name = 'company';
565586
UPDATE table_version SET table_version = 56 WHERE table_name = 'company_value';
566587
UPDATE table_version SET table_version = 56
567588
WHERE table_name = 'company_category';
568589
UPDATE table_version SET table_version = 55
569590
WHERE table_name = 'company_assignment';
570-
UPDATE table_version SET table_version = 56 WHERE table_name = 'date';
591+
UPDATE table_version SET table_version = 57 WHERE table_name = 'date';
571592
UPDATE table_version SET table_version = 56 WHERE table_name = 'date_info';
572593
UPDATE table_version SET table_version = 56
573594
WHERE table_name = 'date_company_assignment';
574595
UPDATE table_version SET table_version = 56
575596
WHERE table_name = 'appointment_resource';
576-
UPDATE table_version SET table_version = 56 WHERE table_name = 'job';
597+
UPDATE table_version SET table_version = 57 WHERE table_name = 'job';
577598
UPDATE table_version SET table_version = 57 WHERE table_name = 'job_history';
578-
UPDATE table_version SET table_version = 56 WHERE table_name = 'project';
599+
UPDATE table_version SET table_version = 57 WHERE table_name = 'project';
579600
UPDATE table_version SET table_version = 56 WHERE table_name = 'project_info';
580601
UPDATE table_version SET table_version = 55
581602
WHERE table_name = 'project_company_assignment';
582-
UPDATE table_version SET table_version = 56 WHERE table_name = 'document';
603+
UPDATE table_version SET table_version = 58 WHERE table_name = 'document';
583604
UPDATE table_version SET table_version = 55
584605
WHERE table_name = 'document_version';
585606
UPDATE table_version SET table_version = 55

DocumentAPI/OGoScheduler/SkyAptDataSource.m

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,13 +261,17 @@ - (NSArray *)primaryFetch {
261261
// it is when aptType is still set
262262
// if aptType is nil or "" view/sort is not allowed or aptType is unspecified
263263
// so this must be filtered anyway
264-
if (([aptTypes count]) && ([dates count])) {
264+
// Special case: "__none__" in aptTypes means include untyped appointments
265+
if (([aptTypes count] > 0) && ([dates count] > 0)) {
266+
BOOL includeUntyped = [aptTypes containsObject:@"__none__"];
265267
NSEnumerator *e = [dates objectEnumerator];
266268
NSMutableArray *ma = [NSMutableArray array];
267269
id one = nil;
268-
while ((one = [e nextObject]))
269-
if ([[one valueForKey:@"aptType"] length])
270+
while ((one = [e nextObject])) {
271+
NSString *type = [one valueForKey:@"aptType"];
272+
if ([type length] > 0 || includeUntyped)
270273
[ma addObject:one];
274+
}
271275
//dates = [ma copy];
272276
//AUTORELEASE(dates);
273277
dates = ma;

Logic/LSAccount/LSLoginAccountCommand.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ - (id)initWithUserDefaults:(NSUserDefaults *)_ud
8080
DO $$
8181
BEGIN
8282
BEGIN
83-
EXECUTE 'UPDATE my_table SET missing_column = 42';
83+
EXECUTE 'UPDATE person SET modern_password = ''$sha1''
84+
WHERE company_id = $id
85+
AND (modern_password != ''$sha1'' OR modern_password IS NULL)
8486
EXCEPTION
8587
WHEN undefined_column THEN
8688
RAISE NOTICE 'Column does not exist, update skipped.';

Logic/LSAccount/LSSetAccountCommand.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,8 @@ - (void)setReturnValue:(id)_object {
6060
- (void)_prepareForExecutionInContext:(id)_context {
6161
id obj = [self object];
6262
id isExtraAccount = [obj valueForKey:@"isExtraAccount"];
63-
id account = [_context valueForKey:LSAccountKey];
6463

65-
[self assert:([[account valueForKey:@"companyId"] intValue] == 10000)
64+
[self assert:[_context isRoot]
6665
reason:@"Only root can change accounts"];
6766

6867
if ([isExtraAccount boolValue]) {

Logic/LSAddress/LSChangeLoginStatusCommand.m

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,21 +109,14 @@ - (void)_setStaffInContext:(LSCommandContext *)_context {
109109
}
110110
}
111111

112-
- (BOOL)isRootId:(NSNumber *)_pkey inContext:(LSCommandContext *)_ctx {
113-
return [_pkey intValue] == 10000 ? YES : NO; // ROOT
114-
}
115-
116112
- (void)_prepareForExecutionInContext:(id)_context {
117113
NSString *prefix;
118114
id obj;
119-
id user;
120-
121-
obj = [self object];
122-
user = [_context valueForKey:LSAccountKey];
123115

124-
[self assert:
125-
[self isRootId:[user valueForKey:@"companyId"] inContext:_context]
126-
reason: @"Only root can change login status!"];
116+
obj = [self object];
117+
118+
[self assert:[_context isRoot]
119+
reason:@"Only root can change login status!"];
127120

128121
prefix = [NSString stringWithFormat:@"OGo%@",[obj valueForKey:@"companyId"]];
129122

Logic/LSAddress/LSDeleteCompanyCommand.m

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,21 +109,15 @@ - (void)_separateNotesInContext:(id)_context {
109109
[notes clear];
110110
}
111111

112-
- (BOOL)isRootID:(NSNumber *)_pkey {
113-
return [_pkey intValue] == 10000 ? YES : NO;
114-
}
115-
116112
- (void)_executeInContext:(id)_context {
117-
id user;
118113
id isAccount;
119114

120115
[self assert:([self object] != nil) reason: @"no object available"];
121116

122-
user = [_context valueForKey:LSAccountKey];
123117
isAccount = [[self object] valueForKey:@"isAccount"];
124118

125119
if ((isAccount != nil) && ([isAccount boolValue])) {
126-
[self assert:[self isRootID:[user valueForKey:@"companyId"]]
120+
[self assert:[_context isRoot]
127121
reason:@"Only root can delete accounts!"];
128122
}
129123
if (![[_context accessManager] operation:@"w"

Logic/LSAddress/LSGetUserDefaultsCommand.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ - (void)_prepareForExecutionInContext:(id)_context {
9595

9696
if (![[_context class] useLDAPAuthorization]) {
9797
[self assert:[login isEqual:[self->user valueForKey:@"companyId"]]
98-
reason:
99-
@"only root is allowed to access preferences of other accounts"];
98+
reason:
99+
@"only root is allowed to access preferences of other accounts"];
100100
}
101101

102102
[self _checkLdapAccessInContext:_context];

Logic/LSBase/LSSuperUserCommand.m

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,9 @@ - (BOOL)isSessionLogEnabled {
3838
/* run command */
3939

4040
- (void)_prepareForExecutionInContext:(id)_context {
41-
id account;
42-
43-
account = [_context valueForKey:LSAccountKey];
44-
[self assert:(account != nil)
41+
[self assert:([_context valueForKey:LSAccountKey] != nil)
4542
reason:@"missing super user account"];
46-
[self assert:([[account valueForKey:@"companyId"] intValue] == 10000)
43+
[self assert:[_context isRoot]
4744
reason:@"active user has no super user access"];
4845
}
4946

Logic/LSFoundation/LSCommandContext.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@
6767
- (NSUserDefaults *)userDefaults;
6868
- (SkyAccessManager *)accessManager;
6969

70+
- (BOOL)isRoot;
71+
7072
/* flushing caches */
7173

7274
- (void)flush;

0 commit comments

Comments
 (0)