Ajout archivage factures
This commit is contained in:
parent
79b3a72cca
commit
745de00331
4 changed files with 29 additions and 14 deletions
|
|
@ -13,11 +13,19 @@ $form->runIf(f('archiver') && !$form->hasErrors(),
|
|||
function () use($facture)
|
||||
{
|
||||
foreach(f('selected') as $f) {
|
||||
$facture->archiver($f);
|
||||
$facture->archiver($f, 1);
|
||||
}
|
||||
|
||||
}, 'archiver_factures');
|
||||
|
||||
$form->runIf(f('desarchiver') && !$form->hasErrors(),
|
||||
function () use($facture)
|
||||
{
|
||||
foreach(f('selected') as $f) {
|
||||
$facture->archiver($f, 0);
|
||||
}
|
||||
|
||||
}, 'desarchiver_factures');
|
||||
|
||||
$archive = isset($_GET['archive']) && $_GET['archive'] == 1;
|
||||
$list = $facture->list(! $archive);
|
||||
|
|
|
|||
|
|
@ -559,10 +559,10 @@ class Facture
|
|||
return DB::getInstance()->delete('plugin_facturation_factures', 'id = '. (int)$id);
|
||||
}
|
||||
|
||||
public function archiver($id)
|
||||
public function archiver($id, $archive)
|
||||
{
|
||||
$f = $this->get($id);
|
||||
$f->archivee = 1;
|
||||
$f->archivee = $archive;
|
||||
$f->date_emission = $f->date_emission->format('d/m/Y');
|
||||
$f->date_echeance = $f->date_echeance->format('d/m/Y');
|
||||
$id = $f->id;
|
||||
|
|
|
|||
|
|
@ -18,4 +18,8 @@ div.aide ul {
|
|||
padding: 1em;
|
||||
}
|
||||
|
||||
div.flex {
|
||||
display: flex;
|
||||
justify-content : space-between;
|
||||
}
|
||||
{/literal}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
{foreach from=$list->iterate() item="facture"}
|
||||
<tr>
|
||||
<td>{if ! $archive}{input type="checkbox" name="selected[]" value=$facture.id}{/if}</td>
|
||||
<td>{input type="checkbox" name="selected[]" value=$facture.id}</td>
|
||||
<td>{$facture.type}</td>
|
||||
<th><a href="facture.php?id={$facture.id}&archive={$archive}">{$facture.numero}</a></th>
|
||||
{if $facture.receveur_membre}
|
||||
|
|
@ -40,17 +40,20 @@
|
|||
</table>
|
||||
{$list->getHTMLPagination()|raw}
|
||||
|
||||
<p class="help">
|
||||
Export de la liste :
|
||||
<div class="submit flex">
|
||||
{if $archive}
|
||||
{csrf_field key="desarchiver_factures"}
|
||||
{button type="submit" name="desarchiver" label="Désarchiver les factures sélectionnées" shape="right"}
|
||||
{else}
|
||||
{csrf_field key="archiver_factures"}
|
||||
{button type="submit" name="archiver" label="Archiver les factures sélectionnées" shape="right"}
|
||||
{/if}
|
||||
<div>
|
||||
<span class="help">Export de la liste :</span>
|
||||
{linkbutton href="?export=csv" label="Export CSV" shape="download"}
|
||||
{linkbutton href="?export=ods" label="Export tableur" shape="download"}
|
||||
</p>
|
||||
{if !$archive}
|
||||
<p class="submit">
|
||||
{csrf_field key="archiver_factures"}
|
||||
{button type="submit" name="archiver" label="Archiver les factures sélectionnées" shape="right" class="main"}
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{else}
|
||||
<p class="help">Aucun document, vous pouvez commencer par {link href="facture_ajouter.php" label="créer un nouveau document"}.</p>
|
||||
{/if}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue