Add Asset Management app
Assets from purchase invoice lines, straight-line depreciation/amortization with salvage value, disposals, and [Asset Mgmt] sources in Batch GL Entries. Green third workspace with an app access guard.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once '../../../assets/utils/db_auth.php';
|
||||
require_app_access('asset');
|
||||
require_role($user_role, ['owner', 'admin']);
|
||||
require_once '../../../assets/utils/classes_as/AssetCategoryManager.php';
|
||||
|
||||
try {
|
||||
$id = (new AssetCategoryManager($pdo2, $company_id))->save($data);
|
||||
$answer['success'] = 1;
|
||||
$answer['output'] = ['id' => $id];
|
||||
$answer['message'] = !empty($data['id']) ? 'Category updated.' : 'Category created.';
|
||||
} catch (PDOException $e) {
|
||||
error_log('[asset category] ' . $e->getMessage());
|
||||
$answer['message'] = 'Database error, please try again.';
|
||||
http_response_code(500);
|
||||
} catch (Exception $e) {
|
||||
$answer['message'] = $e->getMessage();
|
||||
http_response_code(400);
|
||||
}
|
||||
|
||||
exit(json_encode($answer));
|
||||
Reference in New Issue
Block a user