Your IP : 216.73.217.64


Current Path : /home3/gp97/compta.penannou.97gp.net/data/plugins/caisse/admin/
Upload File :
Current File : //home3/gp97/compta.penannou.97gp.net/data/plugins/caisse/admin/session_open.php

<?php

namespace Paheko;

use Paheko\Plugin\Caisse\Sessions;
use function Paheko\Plugin\Caisse\get_amount;

require __DIR__ . '/_inc.php';

$pos_session = null;
$csrf_key = 'pos_open_session';

$form->runIf('open', function () use ($session) {
	if (trim(f('amount')) === '') {
		throw new UserException('Le solde de la caisse ne peut ĂȘtre laissĂ© vide.');
	}

	$s = Sessions::open(f('user_name') ?: $session->getUser()->name(), get_amount(f('amount')));
	Utils::redirect(Utils::plugin_url(['file' => 'tab.php', 'query' => 'session=' . $s->id()]));
}, $csrf_key);

$tpl->assign(compact('csrf_key', 'pos_session'));

$tpl->assign('user_name', $session->getUser()->name());
$tpl->assign('current_pos_session', Sessions::getCurrentId());

$tpl->display(PLUGIN_ROOT . '/templates/session_open.tpl');