-
Notifications
You must be signed in to change notification settings - Fork 282
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Menu Boards: BE, admin and minor widget additions (#1944)
* Bump to v4.0.0-rc1 * Menu Boards: - re-enabled admin UI - fix feature checking - fix thumbnail columns/unmatched properties - add product data type - add menu board product and category widget with filters, sorting, etc - add calories, displayOrder to product, convert price to decimal - add description to category - translate datatypes - install modules by default Preview: - pass properties into onElementParseData Weather: - fix issue with element rendering in preview * Widgets: add isRepeatData for data widgets xibosignageltd/xibo-private#371
- Loading branch information
Showing
38 changed files
with
1,321 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
db/migrations/20230727102500_menuboard_additional_fields_migration.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?php | ||
/* | ||
* Copyright (C) 2023 Xibo Signage Ltd | ||
* | ||
* Xibo - Digital Signage - https://xibosignage.com | ||
* | ||
* This file is part of Xibo. | ||
* | ||
* Xibo is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* any later version. | ||
* | ||
* Xibo is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with Xibo. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
use Phinx\Migration\AbstractMigration; | ||
|
||
/** | ||
* Add some additional fields to menu boards | ||
* @phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace | ||
*/ | ||
class MenuboardAdditionalFieldsMigration extends AbstractMigration | ||
{ | ||
public function change(): void | ||
{ | ||
// Before I do this I need to make sure that all products in this table have a numeric field in price | ||
foreach ($this->fetchAll('SELECT `menuProductId`, `price` FROM `menu_product`') as $row) { | ||
if (!empty($row['price'])) { | ||
$this->execute('UPDATE `menu_product` SET `price` = :price WHERE menuProductId = :id', [ | ||
'id' => $row['menuProductId'], | ||
'price' => preg_replace('/[^A-Za-z0-9 ]/', '', $row['price']), | ||
]); | ||
} | ||
} | ||
|
||
$this->table('menu_product') | ||
->addColumn('calories', 'integer', [ | ||
'length' => \Phinx\Db\Adapter\MysqlAdapter::INT_SMALL, | ||
'null' => true, | ||
'default' => null, | ||
]) | ||
->addColumn('displayOrder', 'integer', [ | ||
'length' => \Phinx\Db\Adapter\MysqlAdapter::INT_MEDIUM, | ||
'null' => false, | ||
'default' => 0, | ||
]) | ||
->changeColumn('price', 'decimal', [ | ||
'precision' => 10, | ||
'scale' => 4, | ||
'default' => null, | ||
'null' => true, | ||
]) | ||
->save(); | ||
|
||
$this->table('menu_category') | ||
->addColumn('description', 'string', [ | ||
'length' => 254, | ||
'null' => true, | ||
'default' => null, | ||
]) | ||
->save(); | ||
|
||
// Drop the old menu-board module entirely, and insert the new ones. | ||
$this->execute('DELETE FROM `module` WHERE moduleId = \'core-menuboard\''); | ||
$this->execute(' | ||
INSERT INTO `module` (`moduleId`, `enabled`, `previewEnabled`, `defaultDuration`, `settings`) VALUES | ||
(\'core-menuboard-category\', \'1\', \'1\', \'60\', \'[]\'), | ||
(\'core-menuboard-product\', \'1\', \'1\', \'60\', \'[]\'); | ||
'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.