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
namespace Garradin;
namespace Paheko;
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);
use Garradin\DB;
use Paheko\DB;
use stdClass;
use const \Garradin\Plugin\Facturation\PATTERNS_LIST;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,14 +1,14 @@
<?php
namespace Garradin\Plugin\Facturation;
namespace Paheko\Plugin\Facturation;
use DateTime;
use Garradin\Config;
use Garradin\DB;
use Garradin\DynamicList;
use Garradin\UserException;
use Garradin\Utils;
use Garradin\Services\Services_User;
use Paheko\Config;
use Paheko\DB;
use Paheko\DynamicList;
use Paheko\UserException;
use Paheko\Utils;
use Paheko\Services\Services_User;
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."
auteur="zou"
author="zou"
url="https://gitlab.com/noizette/garradin-plugin-facturation/"
version="0.7.4"
version="0.8.0"
menu=true
config=1
min_version="1.1.0"
min_version="1.2.0"

View File

@ -1,8 +1,8 @@
<?php
namespace Garradin;
use Garradin\Plugin\Facturation\Facture;
use Garradin\Entities\Files\File;
namespace Paheko;
use Paheko\Plugin\Facturation\Facture;
use Paheko\Entities\Files\File;
define('DEVIS', 0);
define('FACT', 1);
@ -11,11 +11,11 @@ define('COTIS', 3);
$db = DB::getInstance();
$facture = new Facture;
$infos = $plugin->getInfos();
$version = $plugin->get('version');
// 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');
@ -26,7 +26,7 @@ if (version_compare($infos->version, '0.2.0', '<'))
}
// 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;');
foreach($conf as $k=>$v)
@ -40,7 +40,7 @@ if (version_compare($infos->version, '0.3.0', '<'))
}
// 0.4.0 -
if (version_compare($infos->version, '0.4.0', '<'))
if (version_compare($version, '0.4.0', '<'))
{
$db->exec(<<<EOT
CREATE TABLE IF NOT EXISTS plugin_facturation_paiement
@ -85,7 +85,7 @@ EOT
}
// 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;');
if (strpos($r->total,'.'))
@ -145,7 +145,7 @@ EOT
}
// 0.6.2 -
if (version_compare($infos->version, '0.6.2', '<'))
if (version_compare($version, '0.6.2', '<'))
{
$db->exec(<<<EOT
INSERT OR IGNORE INTO plugin_facturation_paiement
@ -195,13 +195,13 @@ EOT
}
// 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);
}
// 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']);
}