6 $app->get(
'/latest', \
Paperyard\Controllers\Archive\Confirm::class);
8 $app->get(
'/latest/{path}', \
Paperyard\Controllers\Archive\ConfirmDetails::class);
10 $app->post(
'/latest/confirm',
function(Request $request, Response $response, $args) {
14 $parsed_body = $request->getParsedBody();
17 $fullpath = base64_decode($parsed_body[
'document-path']);
20 if (!file_exists($fullpath)) {
21 $this->flash->addMessage(
'error', _(
'Document not found.'));
22 return $response->withRedirect(
'/latest');
25 $document = new \Paperyard\Models\Document($fullpath);
26 $errors = $document->fill($request->getParsedBody());
28 if ($errors !==
true) {
29 $this->flash->addMessages(
'error', $errors);
30 return $response->withRedirect(
'/latest/' . $document->identifier);
33 if (isset($parsed_body[
'save_and_confirm'])) {
40 $outbox = glob(
"/data/outbox/*.pdf", GLOB_NOSORT);
41 $inbox = glob(
"/data/inbox/*.pdf", GLOB_NOSORT);
45 array_walk(
$pdfs,
function (&$pdf) {
46 $pdf = (new \Paperyard\Models\Document($pdf))->toArray();
49 $pdfs = array_filter($pdfs,
function ($pdf) {
50 return !$pdf[
'isConfirmed'];
54 $item = current($pdfs);
55 return $response->withRedirect(
'/latest/' . $item[
'identifier']);
58 return $response->withRedirect(
'/latest');