-
Notifications
You must be signed in to change notification settings - Fork 13
/
Init.php
73 lines (60 loc) · 2.25 KB
/
Init.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
namespace FacturaScripts\Plugins\POS;
use FacturaScripts\Core\Base\DataBase\DataBaseWhere;
use FacturaScripts\Core\Model\EstadoDocumento;
use FacturaScripts\Core\Template\InitClass;
class Init extends InitClass
{
public function init(): void
{
//$this->loadExtension(new Extension\Controller\EditFamilia());
$this->loadExtension(new Extension\Controller\EditAlbaranCliente());
//$this->loadExtension(new Extension\Controller\EditPedidoCliente());
//$this->loadExtension(new Extension\Lib\BusinessDocumentGenerator());
$this->loadExtension(new Extension\Model\Familia());
$this->loadExtension(new Extension\Model\FacturaCliente());
$this->loadExtension(new Extension\Model\Base\SalesDocument());
$this->loadExtension(new Extension\Model\Base\SalesDocument());
$this->loadExtension(new Extension\Controller\EditEstadoDocumento());
}
public function update(): void
{
$this->createDraftDocumentOpenStatus();
$this->createDraftDocumentCompletedStatus();
}
protected function createDraftDocumentOpenStatus()
{
$where = [
new DataBaseWhere('tipodoc', 'BorradorPuntoVenta'),
new DataBaseWhere('nombre', 'Abierto'),
];
$status = new EstadoDocumento();
if (false === $status->loadFromCode('', $where)) {
$status->icon = 'fas fa-file-pen';
$status->nombre = 'Abierto';
$status->predeterminado = true;
$status->tipodoc = 'BorradorPuntoVenta';
$status->save();
}
}
protected function createDraftDocumentCompletedStatus()
{
$where = [
new DataBaseWhere('tipodoc', 'BorradorPuntoVenta'),
new DataBaseWhere('nombre', 'Completado'),
];
$status = new EstadoDocumento();
if (false === $status->loadFromCode('', $where)) {
$status->icon = 'fas fa-receipt';
$status->editable = false;
$status->nombre = 'Completado';
$status->predeterminado = false;
$status->tipodoc = 'BorradorPuntoVenta';
$status->save();
}
}
public function uninstall(): void
{
// TODO: Implement uninstall() method.
}
}