First steps in update to 1.3.0

This commit is contained in:
Noizette 2023-07-21 23:28:54 +02:00
parent 4aaed6f3c2
commit 3537314762
18 changed files with 33 additions and 34 deletions

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Garradin; namespace Paheko;
require_once __DIR__ . '/_inc.php'; require_once __DIR__ . '/_inc.php';
@ -12,7 +12,7 @@ if (!isset($target) || !in_array( $target, ['new', 'edit'])) {
$session->requireAccess($session::SECTION_ACCOUNTING, $session::ACCESS_WRITE); $session->requireAccess($session::SECTION_ACCOUNTING, $session::ACCESS_WRITE);
use Garradin\DB; use Paheko\DB;
use stdClass; use stdClass;
use const \Garradin\Plugin\Facturation\PATTERNS_LIST; use const \Garradin\Plugin\Facturation\PATTERNS_LIST;

View File

@ -1,9 +1,9 @@
<?php <?php
namespace Garradin\Plugin\Facturation; namespace Paheko\Plugin\Facturation;
use Garradin\Config; use Paheko\Config;
use Garradin\Utils; use Paheko\Utils;
define('DEVIS', 0); define('DEVIS', 0);
define('FACT', 1); define('FACT', 1);

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Garradin; namespace Paheko;
$target = 'new'; $target = 'new';
$csrf_key = 'ajout_facture'; $csrf_key = 'ajout_facture';

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Garradin; namespace Paheko;
$target = 'edit'; $target = 'edit';
$csrf_key = 'modifier_facture'; $csrf_key = 'modifier_facture';

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Garradin; namespace Paheko;
require_once __DIR__ . '/_inc.php'; require_once __DIR__ . '/_inc.php';
$session->requireAccess($session::SECTION_ACCOUNTING, $session::ACCESS_READ); $session->requireAccess($session::SECTION_ACCOUNTING, $session::ACCESS_READ);

View File

@ -1,7 +1,7 @@
<?php <?php
namespace Garradin; namespace Paheko;
use Garradin\Entities\Files\File; use Paheko\Entities\Files\File;
use Garradin\Plugin\Facturation\Facture; use Paheko\Plugin\Facturation\Facture;
$db = DB::getInstance(); $db = DB::getInstance();

View File

@ -1,14 +1,14 @@
<?php <?php
namespace Garradin\Plugin\Facturation; namespace Paheko\Plugin\Facturation;
use DateTime; use DateTime;
use Garradin\Config; use Paheko\Config;
use Garradin\DB; use Paheko\DB;
use Garradin\DynamicList; use Paheko\DynamicList;
use Garradin\UserException; use Paheko\UserException;
use Garradin\Utils; use Paheko\Utils;
use Garradin\Services\Services_User; use Paheko\Services\Services_User;
class Facture class Facture
{ {

View File

@ -1,8 +1,7 @@
nom="Facturation" name="Facturation"
description="Permet d'éditer des factures, devis et reçus à ses membres ainsi qu'à une base de clients supplémentaire." description="Permet d'éditer des factures, devis et reçus à ses membres ainsi qu'à une base de clients supplémentaire."
auteur="zou" author="zou"
url="https://gitlab.com/noizette/garradin-plugin-facturation/" url="https://gitlab.com/noizette/garradin-plugin-facturation/"
version="0.7.4" version="0.8.0"
menu=true menu=true
config=1 min_version="1.2.0"
min_version="1.1.0"

View File

@ -1,8 +1,8 @@
<?php <?php
namespace Garradin; namespace Paheko;
use Garradin\Plugin\Facturation\Facture; use Paheko\Plugin\Facturation\Facture;
use Garradin\Entities\Files\File; use Paheko\Entities\Files\File;
define('DEVIS', 0); define('DEVIS', 0);
define('FACT', 1); define('FACT', 1);
@ -11,11 +11,11 @@ define('COTIS', 3);
$db = DB::getInstance(); $db = DB::getInstance();
$facture = new Facture; $facture = new Facture;
$infos = $plugin->getInfos(); $version = $plugin->get('version');
// 0.2.0 - Stock le contenu en json plutôt qu'en serialized // 0.2.0 - Stock le contenu en json plutôt qu'en serialized
if (version_compare($infos->version, '0.2.0', '<')) if (version_compare($version, '0.2.0', '<'))
{ {
$r = (array) DB::getInstance()->get('SELECT * FROM plugin_facturation_factures'); $r = (array) DB::getInstance()->get('SELECT * FROM plugin_facturation_factures');
@ -26,7 +26,7 @@ if (version_compare($infos->version, '0.2.0', '<'))
} }
// 0.3.0 - Migration Facturation\Config vers la table plugins // 0.3.0 - Migration Facturation\Config vers la table plugins
if (version_compare($infos->version, '0.3.0', '<')) if (version_compare($version, '0.3.0', '<'))
{ {
$conf = $db->getAssoc('SELECT cle, valeur FROM plugin_facturation_config ORDER BY cle;'); $conf = $db->getAssoc('SELECT cle, valeur FROM plugin_facturation_config ORDER BY cle;');
foreach($conf as $k=>$v) foreach($conf as $k=>$v)
@ -40,7 +40,7 @@ if (version_compare($infos->version, '0.3.0', '<'))
} }
// 0.4.0 - // 0.4.0 -
if (version_compare($infos->version, '0.4.0', '<')) if (version_compare($version, '0.4.0', '<'))
{ {
$db->exec(<<<EOT $db->exec(<<<EOT
CREATE TABLE IF NOT EXISTS plugin_facturation_paiement CREATE TABLE IF NOT EXISTS plugin_facturation_paiement
@ -85,7 +85,7 @@ EOT
} }
// 0.6.0 - // 0.6.0 -
if (version_compare($infos->version, '0.6.0', '<')) if (version_compare($version, '0.6.0', '<'))
{ {
$r = $db->first('SELECT id, total FROM plugin_facturation_factures;'); $r = $db->first('SELECT id, total FROM plugin_facturation_factures;');
if (strpos($r->total,'.')) if (strpos($r->total,'.'))
@ -145,7 +145,7 @@ EOT
} }
// 0.6.2 - // 0.6.2 -
if (version_compare($infos->version, '0.6.2', '<')) if (version_compare($version, '0.6.2', '<'))
{ {
$db->exec(<<<EOT $db->exec(<<<EOT
INSERT OR IGNORE INTO plugin_facturation_paiement INSERT OR IGNORE INTO plugin_facturation_paiement
@ -195,13 +195,13 @@ EOT
} }
// 0.7.1 - Ajout clé config TTC/HT // 0.7.1 - Ajout clé config TTC/HT
if (version_compare($infos->version, '0.7.1', '<')) if (version_compare($version, '0.7.1', '<'))
{ {
$plugin->setConfig('ttc', false); $plugin->setConfig('ttc', false);
} }
// 0.7.4 - Signal menu item // 0.7.4 - Signal menu item
if (version_compare($infos->version, '0.7.4', '<')) if (version_compare($version, '0.7.4', '<'))
{ {
$plugin->registerSignal('menu.item', [Facture::class, 'menuItem']); $plugin->registerSignal('menu.item', [Facture::class, 'menuItem']);
} }