Ajout archivage factures
This commit is contained in:
parent
cb3d201aec
commit
a80bebcc4e
5 changed files with 20 additions and 11 deletions
|
|
@ -8,12 +8,11 @@ if ($plugin->needUpgrade()) {
|
|||
require_once __DIR__ . '/_inc.php';
|
||||
|
||||
$session->requireAccess($session::SECTION_ACCOUNTING, $session::ACCESS_READ);
|
||||
$archive = isset($_GET['archive']) && $_GET['archive'] == 1;
|
||||
|
||||
|
||||
$list = $facture->list();
|
||||
$list = $facture->list(! $archive);
|
||||
$list->loadFromQueryString();
|
||||
$list->setPageSize(50);
|
||||
|
||||
$tpl->assign(compact('list'));
|
||||
|
||||
$tpl->assign(compact('list', 'archive'));
|
||||
$tpl->display(PLUGIN_ROOT . '/templates/index.tpl');
|
||||
|
|
|
|||
|
|
@ -318,7 +318,7 @@ class Facture
|
|||
return $r;
|
||||
}
|
||||
|
||||
public function list(): DynamicList
|
||||
public function list($all = true): DynamicList
|
||||
{
|
||||
$id_field = \Paheko\Users\DynamicFields::getNameFieldsSQL('u');
|
||||
$plugin_name = preg_replace('/^.*\/(\w+)\/$/', '${1}', \Paheko\PLUGIN_ADMIN_URL);
|
||||
|
|
@ -396,7 +396,12 @@ class Facture
|
|||
LEFT JOIN users AS u ON f.receveur_membre = 1 AND u.id = f.receveur_id
|
||||
LEFT JOIN plugin_facturation_clients AS c ON f.receveur_membre = 0 AND c.id = f.receveur_id';
|
||||
|
||||
$list = new DynamicList($columns, $tables);
|
||||
if ($all) {
|
||||
$where = "f.archivee != TRUE";
|
||||
} else {
|
||||
$where = "f.archivee == TRUE";
|
||||
}
|
||||
$list = new DynamicList($columns, $tables, $where);
|
||||
$list->orderBy('date_emission', true);
|
||||
|
||||
$currency = Config::getInstance()->monnaie;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
|
||||
{input type="checkbox" name="reglee" value="1" label="Réglée" source=$doc data-types="t1"}
|
||||
<div data-types="t0 t1 t2">
|
||||
{input type="checkbox" name="archivee" value="1" label="Archivée" source=$doc disabled="disabled"}
|
||||
{input type="checkbox" name="archivee" value="1" label="Archivée" source=$doc}
|
||||
</div>
|
||||
|
||||
</dl>
|
||||
|
|
|
|||
|
|
@ -5,12 +5,13 @@
|
|||
<ul>
|
||||
<li{if $current == 'index'} class="current"{/if}><a href="{$plugin_admin_url}">Liste documents</a></li>
|
||||
{if $session->canAccess($session::SECTION_ACCOUNTING, $session::ACCESS_WRITE)}
|
||||
<li{if $current == 'facture'} class="current"{/if}><a href="{$plugin_admin_url}facture_ajouter.php">Nouveau document</a></li>
|
||||
<li{if $current == 'facture'} class="current"{/if}><a href="{$plugin_admin_url}facture_ajouter.php">Nouveau document</a></li>
|
||||
{/if}
|
||||
<li{if $current == 'clients'} class="current"{/if}><a href="{$plugin_admin_url}clients.php">Liste clients</a></li>
|
||||
<li{if $current == 'archives'} class="current"{/if}><a href="{$plugin_admin_url}index.php?archive=1">Archives</a></li>
|
||||
{if $session->canAccess($session::SECTION_ACCOUNTING, $session::ACCESS_ADMIN)}
|
||||
<li{if $current == 'config'} class="current"{/if}><a href="{$plugin_admin_url}config.php">Configuration</a></li>
|
||||
{/if}
|
||||
<li{if $current == 'aide'} class="current"{/if}><a href="{$plugin_admin_url}aide.php">Aide</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</nav>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
{include file="_head.tpl" title="Documents — %s"|args:$plugin.name current="plugin_%s"|args:$plugin.name}
|
||||
{include file="%s/templates/_menu.tpl"|args:$plugin_root current="index"}
|
||||
{if $archive}
|
||||
{include file="%s/templates/_menu.tpl"|args:$plugin_root current="archives"}
|
||||
{else}
|
||||
{include file="%s/templates/_menu.tpl"|args:$plugin_root current="index"}
|
||||
{/if}
|
||||
|
||||
{form_errors}
|
||||
|
||||
|
|
@ -26,7 +30,7 @@
|
|||
<td>{$facture.total|escape|money_currency}</td>
|
||||
<td class="actions">
|
||||
{linkbutton shape="download" href="pdf.php?id=%d&d"|args:$facture.id label="Télécharger"}
|
||||
{linkbutton shape="menu" href="facture.php?id=%d"|args:$facture.id label="Voir"}
|
||||
{linkbutton shape="eye" href="facture.php?id=%d"|args:$facture.id label="Voir"}
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue