Archivage plusieurs documents et interdiction modifier doc archivé
This commit is contained in:
parent
a80bebcc4e
commit
79b3a72cca
7 changed files with 60 additions and 17 deletions
|
|
@ -69,7 +69,10 @@ if ( !$target ) {
|
|||
throw new UserException("Ce document n'existe pas.");
|
||||
}
|
||||
}
|
||||
|
||||
if ($f->archivee)
|
||||
{
|
||||
throw new UserException("Ce document est archivé, vous n'avez pas le droit de le modifier");
|
||||
}
|
||||
// Traitement
|
||||
$data=[];
|
||||
$form->runIf(f('save') && !$form->hasErrors(),
|
||||
|
|
@ -227,7 +230,6 @@ if (! $form->hasErrors())
|
|||
}
|
||||
|
||||
// Affichage
|
||||
|
||||
if ($target)
|
||||
{
|
||||
$doc = null;
|
||||
|
|
@ -274,6 +276,7 @@ else
|
|||
$doc['type'] = $f->type_facture;
|
||||
$doc['numero_facture'] = $f->numero;
|
||||
$doc['reglee'] = $f->reglee;
|
||||
$doc['archivee'] = $f->archivee;
|
||||
$doc['base_receveur'] = $f->receveur_membre?'membre':'client';
|
||||
$doc['client'] = $f->receveur_id;
|
||||
$doc['membre'] = $f->receveur_id;
|
||||
|
|
@ -294,6 +297,7 @@ else
|
|||
|
||||
$radio['type'] = f('type')??$doc['type'];
|
||||
}
|
||||
|
||||
$tpl->assign('types_details', $facture->types);
|
||||
|
||||
$tpl->assign('client_id', f('client') ?: -1);
|
||||
|
|
|
|||
|
|
@ -20,10 +20,12 @@ if (!$f)
|
|||
throw new UserException("Ce document n'existe pas.");
|
||||
}
|
||||
|
||||
$archive = $f->archivee;
|
||||
$tpl->assign('type', $f->type_facture);
|
||||
$tpl->assign('facture', $f);
|
||||
$tpl->assign('id', $id);
|
||||
$tpl->assign('footer', $plugin->getConfig('footer')?:'');
|
||||
$tpl->assign('siret_asso', $plugin->getConfig('siret_asso')?:'');
|
||||
$tpl->assign('archive', $archive);
|
||||
|
||||
$tpl->display(PLUGIN_ROOT . '/templates/facture.tpl');
|
||||
|
|
|
|||
|
|
@ -8,8 +8,18 @@ if ($plugin->needUpgrade()) {
|
|||
require_once __DIR__ . '/_inc.php';
|
||||
|
||||
$session->requireAccess($session::SECTION_ACCOUNTING, $session::ACCESS_READ);
|
||||
$archive = isset($_GET['archive']) && $_GET['archive'] == 1;
|
||||
|
||||
$form->runIf(f('archiver') && !$form->hasErrors(),
|
||||
function () use($facture)
|
||||
{
|
||||
foreach(f('selected') as $f) {
|
||||
$facture->archiver($f);
|
||||
}
|
||||
|
||||
}, 'archiver_factures');
|
||||
|
||||
|
||||
$archive = isset($_GET['archive']) && $_GET['archive'] == 1;
|
||||
$list = $facture->list(! $archive);
|
||||
$list->loadFromQueryString();
|
||||
$list->setPageSize(50);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue