Bugfix
This commit is contained in:
parent
8f30875314
commit
d260adf1f0
|
@ -32,7 +32,7 @@ class Module extends Model
|
||||||
parent::boot();
|
parent::boot();
|
||||||
|
|
||||||
static::addGlobalScope('enabled', function (Builder $builder) {
|
static::addGlobalScope('enabled', function (Builder $builder) {
|
||||||
//$builder->where('enabled', true);
|
$builder->where('enabled', true);
|
||||||
});
|
});
|
||||||
|
|
||||||
static::addGlobalScope('permission', function (Builder $builder) {
|
static::addGlobalScope('permission', function (Builder $builder) {
|
||||||
|
@ -126,13 +126,13 @@ class Module extends Model
|
||||||
|
|
||||||
public function children()
|
public function children()
|
||||||
{
|
{
|
||||||
return $this->hasMany(self::class, 'parent')
|
return $this->hasMany(self::class, 'parent')->withoutGlobalScope('enabled')
|
||||||
->orderBy('order');
|
->orderBy('order');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function parent()
|
public function parent()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(self::class, 'parent');
|
return $this->belongsTo(self::class, 'parent')->withoutGlobalScope('enabled');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function allParents()
|
public function allParents()
|
||||||
|
@ -154,13 +154,4 @@ class Module extends Model
|
||||||
->orderBy('order')
|
->orderBy('order')
|
||||||
->get();
|
->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getCompleteHierarchy()
|
|
||||||
{
|
|
||||||
return self::withoutGlobalScope('enabled')
|
|
||||||
->with('allChildren')
|
|
||||||
->whereNull('parent')
|
|
||||||
->orderBy('order')
|
|
||||||
->get();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,7 +213,7 @@ class Modules
|
||||||
public static function getHierarchy()
|
public static function getHierarchy()
|
||||||
{
|
{
|
||||||
if (!isset(self::$hierarchy)) {
|
if (!isset(self::$hierarchy)) {
|
||||||
self::$hierarchy = Module::getCompleteHierarchy()->toArray();
|
self::$hierarchy = Module::getHierarchy()->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::$hierarchy;
|
return self::$hierarchy;
|
||||||
|
|
|
@ -27,7 +27,8 @@ class Prints
|
||||||
$prints = [];
|
$prints = [];
|
||||||
|
|
||||||
// Inizializzazione dei riferimenti
|
// Inizializzazione dei riferimenti
|
||||||
foreach (Modules::getModules() as $module) {
|
$modules = Modules::getModules();
|
||||||
|
foreach ($modules as $module) {
|
||||||
self::$modules[$module['id']] = [];
|
self::$modules[$module['id']] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,6 +208,7 @@ class Prints
|
||||||
{
|
{
|
||||||
$infos = self::get($id_print);
|
$infos = self::get($id_print);
|
||||||
$options = self::readOptions($infos['options']);
|
$options = self::readOptions($infos['options']);
|
||||||
|
$docroot = DOCROOT;
|
||||||
|
|
||||||
$dbo = $database = Database::getConnection();
|
$dbo = $database = Database::getConnection();
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
include_once __DIR__.'/../../core.php';
|
include_once __DIR__.'/../../core.php';
|
||||||
|
|
||||||
// carica report html
|
// carica report html
|
||||||
$report = file_get_contents($docroot.'/templates/magazzino_inventario/magazzino_inventario.html');
|
$report = file_get_contents(__DIR__.'/magazzino_inventario.html');
|
||||||
$body = file_get_contents($docroot.'/templates/magazzino_inventario/magazzino_inventario_body.html');
|
$body = file_get_contents(__DIR__.'/magazzino_inventario_body.html');
|
||||||
|
|
||||||
$search_codice = $_GET['search_codice'];
|
$search_codice = $_GET['search_codice'];
|
||||||
$search_descrizione = $_GET['search_descrizione'];
|
$search_descrizione = $_GET['search_descrizione'];
|
||||||
|
@ -52,7 +52,7 @@ include_once $docroot.'/templates/pdfgen_variables.php';
|
||||||
// LEFT OUTER JOIN mg_categorie ON (mg_categorie.id=mg_articoli.id_categoria AND mg_categorie.parent = 0) OR (mg_categorie.id=mg_articoli.id_sottocategoria AND mg_categorie.parent = 1)
|
// LEFT OUTER JOIN mg_categorie ON (mg_categorie.id=mg_articoli.id_categoria AND mg_categorie.parent = 0) OR (mg_categorie.id=mg_articoli.id_sottocategoria AND mg_categorie.parent = 1)
|
||||||
$period_end = $_SESSION['period_end'];
|
$period_end = $_SESSION['period_end'];
|
||||||
|
|
||||||
$query = 'SELECT *, mg_articoli.id AS id_articolo, (SELECT nome FROM mg_categorie WHERE mg_categorie.parent = 0 AND mg_categorie.id = mg_articoli.id_categoria) AS categoria, (SELECT nome FROM mg_categorie WHERE mg_categorie.parent = 1 AND mg_categorie.id = mg_articoli.id_sottocategoria) AS subcategoria, (SELECT SUM(qta) FROM mg_movimenti WHERE mg_movimenti.idarticolo=mg_articoli.id AND (mg_movimenti.idintervento IS NULL OR mg_movimenti.idautomezzo = 0) AND data <= '.prepare($period_end).' ) AS qta FROM mg_articoli WHERE 1=1 '.$add_where.' HAVING 2=2 '.$add_having.' ORDER BY codice ASC';
|
$query = 'SELECT *, mg_articoli.id AS id_articolo, (SELECT nome FROM mg_categorie WHERE mg_categorie.parent = 0 AND mg_categorie.id = mg_articoli.id_categoria) AS categoria, (SELECT nome FROM mg_categorie WHERE mg_categorie.parent = 1 AND mg_categorie.id = mg_articoli.id_sottocategoria) AS subcategoria, (SELECT SUM(qta) FROM mg_movimenti WHERE mg_movimenti.idarticolo=mg_articoli.id AND (mg_movimenti.idintervento IS NULL OR mg_movimenti.idautomezzo = 0) AND data <= '.prepare($period_end).' ) AS qta FROM mg_articoli WHERE 1=1 '.$add_where.' HAVING 2=2 AND qta > 0 '.$add_having.' ORDER BY codice ASC';
|
||||||
$rs = $dbo->fetchArray($query);
|
$rs = $dbo->fetchArray($query);
|
||||||
$totrows = sizeof($rs);
|
$totrows = sizeof($rs);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue