Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 10 additions & 98 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,113 +31,25 @@ jobs:
with:
access_token: ${{ github.token }}

# A copy of InvoiceShelf's own workflow used to run here: `pint` from a
# vendor directory the module never installs, `php artisan test` and a
# `make dist` of InvoiceShelf.zip, none of which a module has. It is now the
# style check alone; release.yaml builds the module's zip.
php_syntax_errors:
name: 1️⃣ PHP Code Style errors
runs-on: ubuntu-latest
needs:
- kill_previous
steps:
- name: Set up PHP
- name: Set up PHP with Pint
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
php-version: 8.4
tools: pint:1.29.0
coverage: none

- name: Checkout code
uses: actions/checkout@v4

- name: Install dependencies
uses: ramsey/composer-install@v2

- name: Check source code for syntax errors
run: ./vendor/bin/pint --test

tests:
name: 2️⃣ PHP ${{ matrix.php-version }} Tests
needs:
- php_syntax_errors
runs-on: ubuntu-latest
strategy:
matrix:
php-version:
- 8.2
- 8.3
env:
extensions: bcmath, curl, dom, gd, imagick, json, libxml, mbstring, pcntl, pdo, pdo_mysql, zip

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP Action
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.extensions }}
coverage: xdebug
tools: pecl, composer

- name: Install Composer dependencies
uses: ramsey/composer-install@v2

- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20

- name: Install
run: npm install

- name: Compile Front-end
run: npm run build

- name: Apply tests ${{ matrix.php-version }}
run: php artisan test

createReleaseFile:
name: 3️⃣ Build / Upload - Release File
if: github.ref_type == 'tag'
needs:
- tests
runs-on: ubuntu-latest
env:
extensions: bcmath, curl, dom, gd, imagick, json, libxml, mbstring, pcntl, pdo, pdo_mysql, zip

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: ${{ env.extensions }}
coverage: none

- name: Install Composer dependencies
uses: ramsey/composer-install@v2
with:
composer-options: --no-dev

- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20

- name: Install
run: npm install

- name: Compile Front-end
run: npm run build

- name: Build Dist
run: |
make clean dist

- name: Upload package
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ github.token }}
file: InvoiceShelf.zip
asset_name: InvoiceShelf.zip
tag: ${{ github.ref }}
overwrite: true
- name: Check code style
run: pint --test
17 changes: 12 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@ jobs:
runs-on: [ubuntu-latest]

steps:
- name: Checkout InvoiceShelf
# The module is for InvoiceShelf 2.x and bundles host code from it, so it is
# built against the 2.x branch, not the default branch (3.x).
- name: Checkout InvoiceShelf 2.x
uses: actions/checkout@v4
with:
repository: InvoiceShelf/InvoiceShelf
ref: 2.x

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
php-version: 8.4
extensions: bcmath, curl, dom, gd, imagick, json, libxml, mbstring, pcntl, pdo, pdo_mysql, zip
coverage: none

Expand All @@ -30,13 +33,17 @@ jobs:
with:
composer-options: --no-dev

- name: Set up pnpm
uses: pnpm/action-setup@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 24

- name: Install and build InvoiceShelf node dependencies
run: npm install && npm run build
# The module build resolves pinia, axios and host components from here.
- name: Install InvoiceShelf node dependencies
run: pnpm install --frozen-lockfile

- name: Checkout WhiteLabel module
uses: actions/checkout@v4
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [1.1.4](https://github.com/InvoiceShelf/module-whitelabel/compare/v1.1.3...v1.1.4) (2026-09-24)


### Bug Fixes

* work on InvoiceShelf 2.3.0 and later: the store uses Pinia 3's `defineStore(id, options)` form and the host's HTTP client instead of the removed `window.axios`
* the module's stylesheet no longer breaks the app's layout on InvoiceShelf 2.3.0 and later (missing sidebar and header controls): it now sits in the app's Tailwind 4 `utilities` cascade layer instead of outside any layer
* saving the customer portal settings with an empty page title no longer fails with a server error
* themes apply again on InvoiceShelf 2.3.0 and later, which reads the colour variables as full colours (Tailwind 4) rather than r, g, b triplets
* build releases against InvoiceShelf's `2.x` branch with its toolchain (PHP 8.4, Node 24, pnpm)


### Documentation

* say the module is for InvoiceShelf 2.x only, add a compatibility table and the cache step after installing

### [1.1.3](https://github.com/InvoiceShelf/module-whitelabel/compare/v1.1.2...v1.1.3) (2025-02-25)


Expand Down
2 changes: 1 addition & 1 deletion Config/config.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php

return [
'name' => 'WhiteLabel'
'name' => 'WhiteLabel',
];
13 changes: 5 additions & 8 deletions Database/Seeders/WhiteLabelDatabaseSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@
use App\Models\User;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Modules\WhiteLabel\Helpers\VersionHelper;

if (VersionHelper::checkAppVersion('<', '2.0.0')) {
VersionHelper::aliasClass('InvoiceShelf\Models\User', 'App\Models\User');
VersionHelper::aliasClass('InvoiceShelf\Models\CompanySetting', 'App\Models\CompanySetting');
}



class WhiteLabelDatabaseSeeder extends Seeder
{
/**
Expand All @@ -32,11 +29,11 @@ public function run()
/**
* check if customer portal page title entry exists
*/
if (!CompanySetting::getSetting('customer_portal_page_title', $company_id)) {
CompanySetting::setSettings(
['customer_portal_page_title' => ''],
$company_id
);
if (! CompanySetting::getSetting('customer_portal_page_title', $company_id)) {
CompanySetting::setSettings(
['customer_portal_page_title' => ''],
$company_id
);
}

}
Expand Down
16 changes: 9 additions & 7 deletions Helpers/VersionHelper.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Version Helper
*
Expand All @@ -8,11 +9,13 @@
* PHP version 8.1
*
* @category Helpers
* @package Modules\WhiteLabel\Helpers
*
* @author Rihards Simanovics <rihards.s@griffin-web.studio>
* @copyright 2024 Rihards Simanovics
* @license GNU GPLv3
*
* @version GIT: <git_id>
*
* @link https://invoiceshelf.com
*/

Expand All @@ -33,9 +36,8 @@ class VersionHelper
* This method checks the application version against a specified version using a comparison operator.
* It temporarily aliases the Setting class to access the version information.
*
* @param string $operator The comparison operator (e.g., '<', '>=').
* @param string $version The version to compare against.
*
* @param string $operator The comparison operator (e.g., '<', '>=').
* @param string $version The version to compare against.
* @return bool True if the comparison is valid, false otherwise.
*/
public static function checkAppVersion($operator, $version)
Expand All @@ -49,12 +51,12 @@ public static function checkAppVersion($operator, $version)
/**
* Alias old namespace classes to new ones if necessary.
*
* @param string $oldClass The old class name with namespace.
* @param string $newClass The new class name with namespace.
* @param string $oldClass The old class name with namespace.
* @param string $newClass The new class name with namespace.
*/
public static function aliasClass($newClass, $oldClass)
{
if (!class_exists($oldClass) && class_exists($newClass)) {
if (! class_exists($oldClass) && class_exists($newClass)) {
class_alias($newClass, $oldClass);
}
}
Expand Down
4 changes: 2 additions & 2 deletions Http/Controllers/UploadLogoController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function uploadLogos(Request $request)
$customerPortalLogoUrl = 'whitelabel/customer_portal_logo/'.$imageName;

$settings = [
'customer_portal_logo' => $customerPortalLogoUrl
'customer_portal_logo' => $customerPortalLogoUrl,
];

CompanySetting::setSettings($settings, $request->header('company'));
Expand Down Expand Up @@ -56,7 +56,7 @@ public function uploadLogos(Request $request)
'success' => true,
'customerPortalLogoUrl' => $customerPortalLogoUrl,
'adminPortalLogoUrl' => $adminPortalLogoUrl,
'loginPageLogoUrl' => $loginPageLogoUrl
'loginPageLogoUrl' => $loginPageLogoUrl,
], 200);
}
}
17 changes: 11 additions & 6 deletions Http/Controllers/WhiteLabelController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class WhiteLabelController extends Controller
{
/**
* Display a listing of the resource.
*
* @return Renderable
*/
public function index()
Expand All @@ -19,6 +20,7 @@ public function index()

/**
* Show the form for creating a new resource.
*
* @return Renderable
*/
public function create()
Expand All @@ -28,7 +30,7 @@ public function create()

/**
* Store a newly created resource in storage.
* @param Request $request
*
* @return Renderable
*/
public function store(Request $request)
Expand All @@ -38,7 +40,8 @@ public function store(Request $request)

/**
* Show the specified resource.
* @param int $id
*
* @param int $id
* @return Renderable
*/
public function show($id)
Expand All @@ -48,7 +51,8 @@ public function show($id)

/**
* Show the form for editing the specified resource.
* @param int $id
*
* @param int $id
* @return Renderable
*/
public function edit($id)
Expand All @@ -58,8 +62,8 @@ public function edit($id)

/**
* Update the specified resource in storage.
* @param Request $request
* @param int $id
*
* @param int $id
* @return Renderable
*/
public function update(Request $request, $id)
Expand All @@ -69,7 +73,8 @@ public function update(Request $request, $id)

/**
* Remove the specified resource from storage.
* @param int $id
*
* @param int $id
* @return Renderable
*/
public function destroy($id)
Expand Down
1 change: 0 additions & 1 deletion Listeners/ModuleDisabledListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public function __construct()
/**
* Handle the event.
*
* @param ModuleDisabledEvent $event
* @return void
*/
public function handle(ModuleDisabledEvent $event)
Expand Down
6 changes: 3 additions & 3 deletions Providers/WhiteLabelServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
use App\Events\ModuleDisabledEvent;
use App\Services\Module\ModuleFacade;
use Illuminate\Support\ServiceProvider;
use Modules\WhiteLabel\Listeners\ModuleDisabledListener;
use Modules\WhiteLabel\Helpers\VersionHelper;
use Modules\WhiteLabel\Listeners\ModuleDisabledListener;

if (VersionHelper::checkAppVersion('<', '2.0.0')) {
VersionHelper::aliasClass('InvoiceShelf\Events\ModuleDisabledEvent', 'App\Events\ModuleDisabledEvent');
Expand Down Expand Up @@ -80,7 +80,7 @@ public function registerViews()
$sourcePath = module_path($this->moduleName, 'Resources/views');

$this->publishes([
$sourcePath => $viewPath
$sourcePath => $viewPath,
], ['views', $this->moduleNameLower.'-module-views']);

$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
Expand Down Expand Up @@ -134,7 +134,7 @@ public function registerMenu()
'icon' => 'TagIcon',
'owner_only' => true,
'ability' => '',
'model' => ''
'model' => '',
];

\Menu::make('setting_menu', function ($menu) use ($data) {
Expand Down
Loading
Loading