start drafting template handling

This commit is contained in:
Dennis Eichhorn 2021-02-12 18:00:25 +01:00
parent 254aba2706
commit b731522bcd
2 changed files with 11 additions and 1 deletions

View File

@ -14,6 +14,8 @@ declare(strict_types=1);
namespace Modules\Billing\Admin\Install;
use Model\CoreSettings;
use Model\Setting;
use phpOMS\DataStorage\Database\DatabasePool;
/**
@ -38,6 +40,11 @@ class Media
*/
public static function install(string $path, DatabasePool $dbPool) : void
{
\Modules\Media\Admin\Installer::installExternal($dbPool, ['path' => __DIR__ . '/Media.install.json']);
$media = \Modules\Media\Admin\Installer::installExternal($dbPool, ['path' => __DIR__ . '/Media.install.json']);
$defaultTemplate = \reset($result['upload']);
$setting = new Setting();
SettingMapper::create($setting->with(0, 'default_template', (string) $defaulTemplate->getId(), 'Billing'));
}
}

View File

@ -273,6 +273,9 @@ final class ApiController extends Controller
{
$bill = BillMapper::get($request->getData('id'));
$defaultTemplate = CoreSettings::get(null, 'default_template', self::MODULE_NAME);
$template = CollectionMapper::get((int) $defaultTemplate);
// get default template from database OR get template based on provided request template id
// create pdf based on template
}