| @@ 233-255 (lines=23) @@ | ||
| 230 | unset($_data['n_fn']); |
|
| 231 | ||
| 232 | // Fall through |
|
| 233 | case 'insert' : |
|
| 234 | if($_action == 'insert') { |
|
| 235 | // Addressbook backend doesn't like inserting with ID specified, it screws up the owner & etag |
|
| 236 | unset($_data['id']); |
|
| 237 | } |
|
| 238 | if(!isset($_data['org_name'])) { |
|
| 239 | // org_name is a trigger to update n_fileas |
|
| 240 | $_data['org_name'] = ''; |
|
| 241 | } |
|
| 242 | ||
| 243 | if ( $this->dry_run ) { |
|
| 244 | //print_r($_data); |
|
| 245 | $this->results[$_action]++; |
|
| 246 | return true; |
|
| 247 | } else { |
|
| 248 | $result = $this->bocontacts->save( $_data, $this->is_admin); |
|
| 249 | if(!$result) { |
|
| 250 | $this->errors[$record_num] = $this->bocontacts->error; |
|
| 251 | } else { |
|
| 252 | $this->results[$_action]++; |
|
| 253 | } |
|
| 254 | return $result; |
|
| 255 | } |
|
| 256 | default: |
|
| 257 | throw new Api\Exception('Unsupported action: '. $_action); |
|
| 258 | ||
| @@ 319-343 (lines=25) @@ | ||
| 316 | unset($_data['n_fn']); |
|
| 317 | ||
| 318 | // Fall through |
|
| 319 | case 'insert' : |
|
| 320 | if($_action == 'insert') { |
|
| 321 | // Addressbook backend doesn't like inserting with ID specified, it screws up the owner & etag |
|
| 322 | unset($_data['id']); |
|
| 323 | } |
|
| 324 | if(!isset($_data['org_name'])) { |
|
| 325 | // org_name is a trigger to update n_fileas |
|
| 326 | $_data['org_name'] = ''; |
|
| 327 | } |
|
| 328 | ||
| 329 | if ( $this->dry_run ) { |
|
| 330 | //print_r($_data); |
|
| 331 | $this->results[$_action]++; |
|
| 332 | return true; |
|
| 333 | } else { |
|
| 334 | $result = $this->bocontacts->save( $_data, $this->is_admin); |
|
| 335 | if(!$result) { |
|
| 336 | $this->errors[$record_num] = $this->bocontacts->error; |
|
| 337 | } else { |
|
| 338 | $this->results[$_action]++; |
|
| 339 | // This does nothing (yet?) but update the identifier |
|
| 340 | $record->save($result); |
|
| 341 | } |
|
| 342 | return $result; |
|
| 343 | } |
|
| 344 | default: |
|
| 345 | throw new Api\Exception('Unsupported action: '. $_action); |
|
| 346 | ||