| @@ 202-214 (lines=13) @@ | ||
| 199 | $ok = move_uploaded_file($_FILES['document']['tmp_name'][0], $preferences['upload.folder'] . $documentDestination); |
|
| 200 | } |
|
| 201 | ||
| 202 | if ($ok) { |
|
| 203 | $delivery->set('current_revision_id', $revision['id']); |
|
| 204 | $delivery->save(); |
|
| 205 | $app->flash('save_ok', 'ok'); |
|
| 206 | ORM::get_db()->commit(); |
|
| 207 | } |
|
| 208 | else { |
|
| 209 | if ($newData) { |
|
| 210 | unlink($documentDestination); |
|
| 211 | } |
|
| 212 | $app->flash('save_error', 'error'); |
|
| 213 | ORM::get_db()->rollback(); |
|
| 214 | } |
|
| 215 | ||
| 216 | $app->redirect($app->request()->getPathInfo()); |
|
| 217 | } |
|
| @@ 347-359 (lines=13) @@ | ||
| 344 | $ok = move_uploaded_file($_FILES['document']['tmp_name'][0], $preferences['upload.folder'] . $documentDestination); |
|
| 345 | } |
|
| 346 | ||
| 347 | if ($ok) { |
|
| 348 | $revision->set('original_document_id', $document['id']); |
|
| 349 | $revision->save(); |
|
| 350 | $app->flash('save_ok', 'ok'); |
|
| 351 | ORM::get_db()->commit(); |
|
| 352 | } |
|
| 353 | else { |
|
| 354 | if ($newData) { |
|
| 355 | unlink($documentDestination); |
|
| 356 | } |
|
| 357 | $app->flash('save_error', 'error'); |
|
| 358 | ORM::get_db()->rollback(); |
|
| 359 | } |
|
| 360 | ||
| 361 | $app->redirect($app->urlFor('tree', array('id' => $category['id']))); |
|
| 362 | } |
|