Compare commits

..

1 Commits

Author SHA1 Message Date
Allan Carr
0d3161ef84 IO-3445 RBAC Bill:Enter
Signed-off-by: Allan Carr <allan@imexsystems.ca>
2025-11-18 16:47:26 -08:00
23 changed files with 4 additions and 92 deletions

View File

@@ -26,6 +26,7 @@ import { CalculateBillTotal } from "../bill-form/bill-form.totals.utility";
import { handleUpload as handleLocalUpload } from "../documents-local-upload/documents-local-upload.utility";
import { handleUpload } from "../documents-upload/documents-upload.utility";
import { handleUpload as handleUploadToImageProxy } from "../documents-upload-imgproxy/documents-upload-imgproxy.utility";
import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component";
const mapStateToProps = createStructuredSelector({
billEnterModal: selectBillEnterModal,
@@ -450,7 +451,9 @@ function BillEnterModalContainer({ billEnterModal, toggleModalVisible, bodyshop,
setEnterAgain(false);
}}
>
<BillFormContainer form={form} disableInvNumber={billEnterModal.context.disableInvNumber} />
<RbacWrapper action="bills:enter">
<BillFormContainer form={form} disableInvNumber={billEnterModal.context.disableInvNumber} />
</RbacWrapper>
</Form>
</Modal>
);

View File

@@ -1,5 +0,0 @@
alter table "public"."media_analytics_detail" drop constraint "media_analytics_detail_jobid_fkey",
add constraint "media_analytics_detail_jobid_fkey"
foreign key ("jobid")
references "public"."jobs"
("id") on update restrict on delete restrict;

View File

@@ -1,5 +0,0 @@
alter table "public"."media_analytics_detail" drop constraint "media_analytics_detail_jobid_fkey",
add constraint "media_analytics_detail_jobid_fkey"
foreign key ("jobid")
references "public"."jobs"
("id") on update set null on delete set null;

View File

@@ -1,23 +0,0 @@
-- Could not auto-generate a down migration.
-- Please write an appropriate down migration for the SQL below:
-- CREATE OR REPLACE FUNCTION set_fk_to_null_if_invalid_media_analytics()
-- RETURNS TRIGGER AS $$
-- BEGIN
-- -- Check if the foreign key value is not NULL
-- IF NEW.jobid IS NOT NULL THEN
-- -- Check if the corresponding record exists in the parent table
-- IF NOT EXISTS (SELECT 1 FROM jobs WHERE id = NEW.jobid) THEN
-- -- If it doesn't exist, set the foreign key to NULL
-- NEW.jobid = NULL;
-- END IF;
-- END IF;
--
-- -- Return the (potentially modified) record to be inserted/updated
-- RETURN NEW;
-- END;
-- $$ LANGUAGE plpgsql;
--
-- CREATE TRIGGER media_analytics_fk_null
-- BEFORE INSERT OR UPDATE ON media_analytics_detail
-- FOR EACH ROW
-- EXECUTE FUNCTION set_fk_to_null_if_invalid_media_analytics();

View File

@@ -1,21 +0,0 @@
CREATE OR REPLACE FUNCTION set_fk_to_null_if_invalid_media_analytics()
RETURNS TRIGGER AS $$
BEGIN
-- Check if the foreign key value is not NULL
IF NEW.jobid IS NOT NULL THEN
-- Check if the corresponding record exists in the parent table
IF NOT EXISTS (SELECT 1 FROM jobs WHERE id = NEW.jobid) THEN
-- If it doesn't exist, set the foreign key to NULL
NEW.jobid = NULL;
END IF;
END IF;
-- Return the (potentially modified) record to be inserted/updated
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER media_analytics_fk_null
BEFORE INSERT OR UPDATE ON media_analytics_detail
FOR EACH ROW
EXECUTE FUNCTION set_fk_to_null_if_invalid_media_analytics();

View File

@@ -1 +0,0 @@
DROP INDEX IF EXISTS "public"."media_analytics_detail_bodyshopid";

View File

@@ -1,2 +0,0 @@
CREATE INDEX "media_analytics_detail_bodyshopid" on
"public"."media_analytics_detail" using btree ("bodyshopid");

View File

@@ -1 +0,0 @@
DROP INDEX IF EXISTS "public"."media_analytics_detail_jobid";

View File

@@ -1,2 +0,0 @@
CREATE INDEX "media_analytics_detail_jobid" on
"public"."media_analytics_detail" using btree ("jobid");

View File

@@ -1 +0,0 @@
DROP INDEX IF EXISTS "public"."media_analytics_detail_media_analytics";

View File

@@ -1,2 +0,0 @@
CREATE INDEX "media_analytics_detail_media_analytics" on
"public"."media_analytics_detail" using btree ("media_analytics_id");

View File

@@ -1,4 +0,0 @@
-- Could not auto-generate a down migration.
-- Please write an appropriate down migration for the SQL below:
-- alter table "public"."media_analytics" add column "unique_documents" numeric
-- null;

View File

@@ -1,2 +0,0 @@
alter table "public"."media_analytics" add column "unique_documents" numeric
null;

View File

@@ -1,4 +0,0 @@
-- Could not auto-generate a down migration.
-- Please write an appropriate down migration for the SQL below:
-- alter table "public"."media_analytics" add column "duplicate_documents" numeric
-- null;

View File

@@ -1,2 +0,0 @@
alter table "public"."media_analytics" add column "duplicate_documents" numeric
null;

View File

@@ -1,4 +0,0 @@
-- Could not auto-generate a down migration.
-- Please write an appropriate down migration for the SQL below:
-- alter table "public"."media_analytics_detail" add column "unique_documents" numeric
-- null;

View File

@@ -1,2 +0,0 @@
alter table "public"."media_analytics_detail" add column "unique_documents" numeric
null;

View File

@@ -1,4 +0,0 @@
-- Could not auto-generate a down migration.
-- Please write an appropriate down migration for the SQL below:
-- alter table "public"."media_analytics_detail" add column "duplicate_documents" numeric
-- null;

View File

@@ -1,2 +0,0 @@
alter table "public"."media_analytics_detail" add column "duplicate_documents" numeric
null;

View File

@@ -1 +0,0 @@
alter table "public"."media_analytics_detail" rename column "unique_document_count" to "unique_documents";

View File

@@ -1 +0,0 @@
alter table "public"."media_analytics_detail" rename column "unique_documents" to "unique_document_count";

View File

@@ -1 +0,0 @@
alter table "public"."media_analytics_detail" rename column "duplicate_count" to "duplicate_documents";

View File

@@ -1 +0,0 @@
alter table "public"."media_analytics_detail" rename column "duplicate_documents" to "duplicate_count";