@@ -132,7 +132,7 @@ function os2web_gf_service_handler($file_id) {
132
132
* @param string $value
133
133
* The value of the conf, which has to be altered/stored.
134
134
*/
135
- function os2web_cs_service_alter_configuration ($key, $value) {
135
+ function os2web_cp_service_alter_configuration ($key, $value) {
136
136
switch ($key) {
137
137
case 'FileServiceURL':
138
138
return variable_set('os2web_cp_service_cp_document_fileurl', $value);
@@ -150,9 +150,11 @@ function os2web_cs_service_alter_configuration($key, $value) {
150
150
* @return bool
151
151
* TRUE on successful content creation.
152
152
*/
153
- function os2web_cs_service_create_case(array $data) {
153
+ function os2web_cp_service_create_case(array $data) {
154
+
155
+ watchdog('os2web_cp_service', 'CP case start: %time', array('%time' => timer_read('cp')), WATCHDOG_NOTICE);
154
156
// Prepare data.
155
- $data = array_replace_recursive(os2web_cs_service_default_case (), $data);
157
+ $data = array_replace_recursive(os2web_cp_service_default_case (), $data);
156
158
157
159
$query = new EntityFieldQuery();
158
160
$result = $query
@@ -170,6 +172,7 @@ function os2web_cs_service_create_case(array $data) {
170
172
else {
171
173
$node = node_load(array_pop($nids));
172
174
}
175
+ watchdog('os2web_cp_service', 'CP old deleted: %time', array('%time' => timer_read('cp')), WATCHDOG_NOTICE);
173
176
174
177
// See if the triggered rules on the published node, is approved
175
178
// in the vocabulary. Otherwise the node will be unpublished.
@@ -197,7 +200,9 @@ function os2web_cs_service_create_case(array $data) {
197
200
198
201
switch ($data['fields']['Sagstype - Sagstype']) {
199
202
case 'EJSAG':
200
- $node->title = (string) $data['fields']['Sagstitel'] . ' - ' . $data['fields']['Sagsindhold'];
203
+ // Old cases comes as: "Birkevej (8410) 11, 8410 Rønde"
204
+ // regex removes " (8410)"
205
+ $node->title = (string) preg_replace('/\s\(\d{4}\)/', '', $data['fields']['Sagstitel']) . ' - ' . $data['fields']['Sagsindhold'];
201
206
break;
202
207
203
208
default:
@@ -274,6 +279,7 @@ function os2web_cs_service_create_case(array $data) {
274
279
try {
275
280
node_submit($node);
276
281
node_save($node);
282
+ watchdog('os2web_cp_service', 'CP case done: %time', array('%time' => timer_read('cp')), WATCHDOG_NOTICE);
277
283
return TRUE;
278
284
}
279
285
catch (Exception $e) {
@@ -285,7 +291,7 @@ function os2web_cs_service_create_case(array $data) {
285
291
/**
286
292
* Default array structure for a case.
287
293
*/
288
- function os2web_cs_service_default_case () {
294
+ function os2web_cp_service_default_case () {
289
295
return array(
290
296
'type' => 'case',
291
297
'rules' => array(),
@@ -394,8 +400,10 @@ function os2web_cs_service_default_case() {
394
400
* @return bool
395
401
* TRUE on successful content creation.
396
402
*/
397
- function os2web_cs_service_create_document(array $data) {
398
- $data = array_replace_recursive(os2web_cs_service_default_document(), $data);
403
+ function os2web_cp_service_create_document(array $data) {
404
+
405
+ watchdog('os2web_cp_service', 'CP document start: %time', array('%time' => timer_read('cp')), WATCHDOG_NOTICE);
406
+ $data = array_replace_recursive(os2web_cp_service_default_document(), $data);
399
407
// Prepare data.
400
408
$query = new EntityFieldQuery();
401
409
$result = $query
@@ -413,6 +421,7 @@ function os2web_cs_service_create_document(array $data) {
413
421
else {
414
422
$node = node_load(array_pop($nids));
415
423
}
424
+ watchdog('os2web_cp_service', 'CP old deleted: %time', array('%time' => timer_read('cp')), WATCHDOG_NOTICE);
416
425
417
426
// See if the triggered rules on the published node, is approved
418
427
// in the vocabulary. Otherwise the node will be unpublished.
@@ -511,13 +520,14 @@ function os2web_cs_service_create_document(array $data) {
511
520
}
512
521
}
513
522
}
523
+ watchdog('os2web_cp_service', 'CP document done: %time', array('%time' => timer_read('cp')), WATCHDOG_NOTICE);
514
524
return TRUE;
515
525
}
516
526
517
527
/**
518
528
* Default array structure for a case.
519
529
*/
520
- function os2web_cs_service_default_document () {
530
+ function os2web_cp_service_default_document () {
521
531
return array(
522
532
'type' => 'document',
523
533
'rules' => array(),
0 commit comments