[OGo-Developer] LSJob (instance) does not recognize setNotificationTime:
Sebastian Reitenbach
developer@opengroupware.org
Tue, 13 Mar 2007 06:50:53 +0100
developer@opengroupware.org wrote:
> On Mar 12, 2007, at 08:48, Sebastian Reitenbach wrote:
> > In OGoJobs/SkyJobDocument.h, I have a setNotificationTime defined,
> > as it is in
> > the
> > SkyAppointmentDocument.h for appointments, like this: -
> > (void)setNotificationTime:(NSNumber
> > *)_notificationTime;
> ....
> > [job setNotificationTime:(id)[NSNull null]];
> ...
> > I get no compiler warnings or errors about it while compiling,
>
> (well, if you cast it to 'id', you can't expect warnings ... ;-)
I just checked, where this line comes from, and it is more or less copied from
skyaptnotify ;)
[_apt setNotificationTime:(id)[NSNull null]];
> [job takeValue:nil forKey:@"notificationTime"];
>
as said, this works well now. I now only have one problem, updating the
database. I have the
following snippet in skyjobnotify:
- (void)_processJob:(SkyJobDocument *)job onContext:(LSCommandContext *)_ctx {
NSArray *devices;
id cmdResult;
id j;
j = job;
devices = [self _notificationDevicesForAccount:[j valueForKey:@"executant"]];
// email
if ([devices containsObject:@"email"]) {
[self _sendEMailForJob:job];
}
// mark as send
//[job setNotificationTime:0];
[j takeValue:0 forKey:@"notificationTime"];
cmdResult = [_ctx runCommand:@"job::set" arguments:j];
if (cmdResult != nil) {
NSString *comment;
comment = [NSString stringWithFormat:@"reminder sent"];
cmdResult = [_ctx runCommand:@"job::jobaction",
@"object", j,
@"action", @"comment",
@"comment", comment,
nil];
}
if (self->beVerbose)
NSLog(@"%s Notification sent to '%@' (%@) for '%@'",
__PRETTY_FUNCTION__, [[job valueForKey:@"executant"]
valueForKey:@"login"],
[devices componentsJoinedByString:@", "], [job
valueForKey:@"name"]);
}
when I run this with skyjobnotfiy -PGDebugEnabled YES
I can observe the following:
Mar 12 21:54:13 skyjobnotify [26001]: PG0x0x7d375484 SQL: BEGIN TRANSACTION
...
Mar 12 21:54:14 skyjobnotify [26001]: Note: PostgreSQL72 adaptor using timezone
'MET' as
default
Mar 12 21:54:14 skyjobnotify [26001]: PG0x0x7d375484 SQL: UPDATE job SET
keywords = null,
notification_time = null, percent_complete = 0, job_comment = null,
last_modified = null,
parent_job_id = null, category = null, db_status = 'updated', notify_x = 0,
sensitivity = 1,
is_team_job = 0, executant_id = 10100, project_id = null, kind = null,
source_url = null,
timer_date = null, actual_work = 0, accounting_info = null, start_date =
'2007-03-11
01:00:00+0100', end_date = '2007-03-13 01:00:00+0100', associated_companies =
'',
associated_contacts = '', total_work = 0, priority = 1, completion_date = null,
name
= 'testreminder', kilometers = null, is_control_job = null, job_status =
'20_processing',
creator_id = 10100 WHERE object_version=6 AND job_id=46330
<0x0x820e15e4[SkyAccessManager]> found no access handler for entity Job GID
<0x0x86f18b84
[EOKeyGlobalID]: Job 46330>: {}
Mar 12 21:54:14 skyjobnotify [26001]: PG0x0x7d375484 SQL: UPDATE job SET
keywords = null,
notification_time = null, percent_complete = 0, job_comment = null,
last_modified = null,
parent_job_id = null, category = null, db_status = 'updated', notify_x = 0,
sensitivity = 1,
is_team_job = 0, executant_id = 10100, project_id = null, kind = null,
source_url = null,
timer_date = null, actual_work = 0, accounting_info = null, start_date =
'2007-03-11
01:00:00+0100', end_date = '2007-03-13 01:00:00+0100', associated_companies =
'',
associated_contacts = '', total_work = 0, priority = 1, completion_date = null,
name
= 'testreminder', kilometers = null, is_control_job = null, object_version = 7,
job_status
= '20_processing', creator_id = 10100 WHERE object_version=6 AND job_id=46330
Mar 12 21:54:14 skyjobnotify [26001]: PG0x0x7d375484 SQL: select
nextval('key_generator')
Mar 12 21:54:14 skyjobnotify [26001]: PG0x0x7d375484 SQL: INSERT INTO
job_history (db_status,
actor_id, action_date, job_status, job_history_id, job_id, action) VALUES
('inserted',
10000, '2007-03-12 21:54:14+0100', '20_processing', 46960, 46330,
'10_commented')
Mar 12 21:54:14 skyjobnotify [26001]: PG0x0x7d375484 SQL: SELECT t1.action,
t1.action_date,
t1.actor_id, t1.db_status, t1.job_history_id, t1.job_id, t1.job_status FROM
job_history t1
WHERE t1.job_history_id=46960
Mar 12 21:54:14 skyjobnotify [26001]: PG0x0x7d375484 SQL: INSERT INTO obj_info (
obj_id,
obj_type ) VALUES ( 46960, 'JobHistory' );
Mar 12 21:54:14 skyjobnotify [26001]: PG0x0x7d375484 SQL: select
nextval('key_generator')
Mar 12 21:54:14 skyjobnotify [26001]: PG0x0x7d375484 SQL: INSERT INTO
job_history_info
(db_status, job_history_id, comment, job_history_info_id) VALUES ('inserted',
46960, 'reminder sent', 46970)
Mar 12 21:54:14 skyjobnotify [26001]: PG0x0x7d375484 SQL: select
nextval('key_generator')
Mar 12 21:54:14 skyjobnotify [26001]: PG0x0x7d375484 SQL: INSERT INTO log
(object_id,
account_id, log_id, creation_date, log_text, action) VALUES (46330, 10000,
46980, '2007-03-12
21:54:14+0100', 'Job comment', '05_changed')
Mar 12 21:54:14 skyjobnotify [26001]: PG0x0x7d375484 SQL: SELECT t1.account_id,
t1.action,
t1.creation_date, t1.log_id, t1.log_text, t1.object_id FROM log t1 WHERE
t1.log_id=46980
The transaction is not committed, and therefore nothing changed in the
database. I can
cut 'n paste the sql statements into psql and they work.
How do I get the tool to send a COMMIT transaction to the database?
kind regards
Sebastian