Modify aygetname postgres function to handle translation of items that do not have a name, also code to back it at server
This commit is contained in:
@@ -33,7 +33,7 @@ namespace AyaNova.Util
|
||||
|
||||
///////////////////////////////////////////////////////////////// C1301:I153:CC518:FC193:V11:R2
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -357,74 +357,79 @@ END;
|
||||
$BODY$;
|
||||
");
|
||||
|
||||
//Name fetcher function
|
||||
//CoreBizObject ADD here
|
||||
await ExecQueryAsync(@"
|
||||
CREATE OR REPLACE FUNCTION PUBLIC.AYGETNAME(IN AYOBJECTID BIGINT, IN AYATYPE INTEGER) RETURNS TEXT AS $BODY$
|
||||
|
||||
|
||||
/*
|
||||
|
||||
-- FUNCTION: public.aygetnameex(bigint, integer)
|
||||
-- DROP FUNCTION IF EXISTS public.aygetnameex(bigint, integer);
|
||||
|
||||
CREATE OR REPLACE FUNCTION PUBLIC.AYGETNAMEEX(AYOBJECTID bigint, AYATYPE integer, TRANSLATIONID integer) RETURNS text LANGUAGE 'plpgsql' COST 100 STABLE PARALLEL UNSAFE AS $BODY$
|
||||
DECLARE
|
||||
aytable TEXT DEFAULT '';
|
||||
aynamecolumn TEXT DEFAULT 'name';
|
||||
aytkey TEXT DEFAULT 'no';
|
||||
returnstr TEXT DEFAULT '';
|
||||
BEGIN
|
||||
BEGIN
|
||||
case ayatype
|
||||
when 0 then return 'LT:NoType';
|
||||
when 1 then return 'LT:Global';
|
||||
when 0 then aytkey= 'NoType';
|
||||
when 1 then aytkey= 'Global';
|
||||
when 2 then return 'FormUserOptions';
|
||||
when 3 then aytable = 'auser';
|
||||
when 4 then return 'LT:ServerState';
|
||||
when 5 then return 'LT:License';
|
||||
when 6 then return 'LT:LogFile';
|
||||
when 7 then return 'LT:PickListTemplate';
|
||||
when 4 then aytkey= 'ServerState';
|
||||
when 5 then aytkey= 'License';
|
||||
when 6 then aytkey= 'LogFile';
|
||||
when 7 then aytkey= 'PickListTemplate';
|
||||
when 8 then aytable = 'acustomer';
|
||||
when 9 then return 'LT:ServerJob';
|
||||
when 9 then aytkey= 'ServerJob';
|
||||
when 10 then aytable = 'acontract';
|
||||
when 11 then return 'LT:TrialSeeder';
|
||||
when 12 then return 'LT:ServerMetrics';
|
||||
when 11 then aytkey= 'TrialSeeder';
|
||||
when 12 then aytkey= 'ServerMetrics';
|
||||
when 13 then aytable = 'atranslation';
|
||||
when 14 then return 'LT:UserOptions';
|
||||
when 14 then aytkey= 'UserOptions';
|
||||
when 15 then aytable = 'aheadoffice';
|
||||
when 16 then aytable = 'aloanunit';
|
||||
when 16 then aytable = 'aloanunit';
|
||||
when 17 then aytable = 'afileattachment'; aynamecolumn ='displayfilename';
|
||||
when 18 then aytable = 'adatalistsavedfilter';
|
||||
when 19 then aytable = 'aformcustom'; aynamecolumn = 'formkey';
|
||||
when 20 then aytable = 'apart'; aynamecolumn ='partnumber';
|
||||
when 21 then aytable = 'apm'; aynamecolumn ='serial';
|
||||
when 22 then return 'LT:PMItem';
|
||||
when 23 then return 'LT:WorkOrderItemExpense';
|
||||
when 24 then return 'LT:WorkOrderItemLabor';
|
||||
when 22 then aytkey= 'PMItem';
|
||||
when 23 then aytkey= 'WorkOrderItemExpense';
|
||||
when 24 then aytkey= 'WorkOrderItemLabor';
|
||||
when 25 then aytable = 'aproject';
|
||||
when 26 then aytable = 'apurchaseorder'; aynamecolumn = 'serial';
|
||||
when 27 then aytable = 'aquote'; aynamecolumn = 'serial';
|
||||
when 28 then return 'LT:QuoteItem';
|
||||
when 29 then return 'LT:WorkOrderItemLoan';
|
||||
when 30 then return 'LT:WorkOrderItemPart';
|
||||
when 28 then aytkey= 'QuoteItem';
|
||||
when 29 then aytkey= 'WorkOrderItemLoan';
|
||||
when 30 then aytkey= 'WorkOrderItemPart';
|
||||
when 31 then aytable = 'aunit'; aynamecolumn = 'serial';
|
||||
when 32 then aytable = 'aunitmodel'; aynamecolumn = 'name';
|
||||
when 33 then aytable = 'avendor';
|
||||
when 34 then aytable = 'aworkorder'; aynamecolumn = 'serial';
|
||||
when 35 then return 'LT:WorkOrderItem';
|
||||
when 36 then return 'LT:WorkOrderItemExpense';
|
||||
when 37 then return 'LT:WorkOrderItemLabor';
|
||||
when 38 then return 'LT:WorkOrderItemLoan';
|
||||
when 39 then return 'LT:WorkOrderItemPart';
|
||||
when 40 then return 'LT:WorkOrderItemPartRequest';
|
||||
when 41 then return 'LT:WorkOrderItemScheduledUser';
|
||||
when 42 then return 'LT:WorkOrderItemTask';
|
||||
when 43 then return 'LT:WorkOrderItemTravel';
|
||||
when 44 then return 'LT:WorkOrderItemUnit';
|
||||
when 45 then return 'LT:WorkOrderItemScheduledUser';
|
||||
when 46 then return 'LT:WorkOrderItemTask';
|
||||
when 47 then return 'LT:GlobalOps';
|
||||
when 48 then return 'LT:BizMetrics';
|
||||
when 49 then return 'LT:Backup';
|
||||
when 35 then aytkey= 'WorkOrderItem';
|
||||
when 36 then aytkey= 'WorkOrderItemExpense';
|
||||
when 37 then aytkey= 'WorkOrderItemLabor';
|
||||
when 38 then aytkey= 'WorkOrderItemLoan';
|
||||
when 39 then aytkey= 'WorkOrderItemPart';
|
||||
when 40 then aytkey= 'WorkOrderItemPartRequest';
|
||||
when 41 then aytkey= 'WorkOrderItemScheduledUser';
|
||||
when 42 then aytkey= 'WorkOrderItemTask';
|
||||
when 43 then aytkey= 'WorkOrderItemTravel';
|
||||
when 44 then aytkey= 'WorkOrderItemUnit';
|
||||
when 45 then aytkey= 'WorkOrderItemScheduledUser';
|
||||
when 46 then aytkey= 'WorkOrderItemTask';
|
||||
when 47 then aytkey= 'GlobalOps';
|
||||
when 48 then aytkey= 'BizMetrics';
|
||||
when 49 then aytkey= 'Backup';
|
||||
when 50 then aytable = 'ainappnotification';
|
||||
when 51 then return 'LT:NotifySubscription';
|
||||
when 51 then aytkey= 'NotifySubscription';
|
||||
when 52 then aytable = 'areminder';
|
||||
when 53 then return 'LT:UnitMeterReading';
|
||||
when 53 then aytkey= 'UnitMeterReading';
|
||||
when 54 then aytable = 'acustomerservicerequest';
|
||||
when 56 then return 'LT:OpsNotificationSettings';
|
||||
when 56 then aytkey= 'OpsNotificationSettings';
|
||||
when 57 then aytable = 'areport';
|
||||
when 58 then return 'LT:DashBoardView';
|
||||
when 58 then aytkey= 'DashBoardView';
|
||||
when 59 then aytable = 'acustomernote'; aynamecolumn = 'notedate';
|
||||
when 60 then aytable = 'amemo';
|
||||
when 61 then aytable = 'areview';
|
||||
@@ -437,27 +442,147 @@ BEGIN
|
||||
when 68 then return format('DataListColumnView %L', ayobjectid);
|
||||
when 71 then aytable = 'aworkorderstatus';
|
||||
when 72 then aytable = 'aTaskGroup';
|
||||
when 73 then return 'LT:WorkOrderItemOutsideService';
|
||||
when 73 then aytkey= 'WorkOrderItemOutsideService';
|
||||
when 74 then aytable = 'aWorkOrderItemPriority';
|
||||
when 75 then aytable = 'aWorkOrderItemStatus';
|
||||
when 76 then return 'LT:WorkOrderItemTravel';
|
||||
when 77 then return 'LT:WorkOrderItemUnit';
|
||||
when 76 then aytkey= 'WorkOrderItemTravel';
|
||||
when 77 then aytkey= 'WorkOrderItemUnit';
|
||||
when 78 then aytable = 'aquotestatus';
|
||||
when 79 then return 'LT:WorkOrderItemOutsideService';
|
||||
when 80 then return 'LT:WorkOrderItemExpense';
|
||||
when 81 then return 'LT:WorkOrderItemLabor';
|
||||
when 82 then return 'LT:WorkOrderItemLoan';
|
||||
when 83 then return 'LT:WorkOrderItemPart';
|
||||
when 84 then return 'LT:WorkOrderItemPartRequest';
|
||||
when 85 then return 'LT:WorkOrderItemScheduledUser';
|
||||
when 86 then return 'LT:WorkOrderItemTask';
|
||||
when 87 then return 'LT:WorkOrderItemTravel';
|
||||
when 88 then return 'LT:WorkOrderItemUnit';
|
||||
when 89 then return 'LT:WorkOrderItemOutsideService';
|
||||
when 79 then aytkey= 'WorkOrderItemOutsideService';
|
||||
when 80 then aytkey= 'WorkOrderItemExpense';
|
||||
when 81 then aytkey= 'WorkOrderItemLabor';
|
||||
when 82 then aytkey= 'WorkOrderItemLoan';
|
||||
when 83 then aytkey= 'WorkOrderItemPart';
|
||||
when 84 then aytkey= 'WorkOrderItemPartRequest';
|
||||
when 85 then aytkey= 'WorkOrderItemScheduledUser';
|
||||
when 86 then aytkey= 'WorkOrderItemTask';
|
||||
when 87 then aytkey= 'WorkOrderItemTravel';
|
||||
when 88 then aytkey= 'WorkOrderItemUnit';
|
||||
when 89 then aytkey= 'WorkOrderItemOutsideService';
|
||||
else
|
||||
RETURN returnstr;
|
||||
end case;
|
||||
EXECUTE format('SELECT %I FROM %I WHERE id = %L', aynamecolumn, aytable, ayobjectid) INTO returnstr;
|
||||
|
||||
IF aytkey='no' then
|
||||
EXECUTE format('SELECT %I FROM %I WHERE id = %L', aynamecolumn, aytable, ayobjectid) INTO returnstr;
|
||||
else
|
||||
EXECUTE format('select display from atranslationitem where translationid=%L and key=%L', TRANSLATIONID, aytkey) INTO returnstr;
|
||||
END if;
|
||||
RETURN returnstr;
|
||||
END;
|
||||
$BODY$;
|
||||
|
||||
|
||||
ALTER FUNCTION PUBLIC.AYGETNAME(bigint, integer) OWNER TO POSTGRES;
|
||||
*/
|
||||
|
||||
//Name fetcher function
|
||||
//CoreBizObject ADD here
|
||||
await ExecQueryAsync(@"
|
||||
CREATE OR REPLACE FUNCTION PUBLIC.AYGETNAME(IN AYOBJECTID BIGINT, IN AYATYPE INTEGER,TRANSLATIONID integer) RETURNS TEXT AS $BODY$
|
||||
DECLARE
|
||||
aytable TEXT DEFAULT '';
|
||||
aynamecolumn TEXT DEFAULT 'name';
|
||||
aytkey TEXT DEFAULT 'no';
|
||||
returnstr TEXT DEFAULT '';
|
||||
BEGIN
|
||||
case ayatype
|
||||
when 0 then aytkey= 'NoType';
|
||||
when 1 then aytkey= 'Global';
|
||||
when 2 then return 'FormUserOptions';
|
||||
when 3 then aytable = 'auser';
|
||||
when 4 then aytkey= 'ServerState';
|
||||
when 5 then aytkey= 'License';
|
||||
when 6 then aytkey= 'LogFile';
|
||||
when 7 then aytkey= 'PickListTemplate';
|
||||
when 8 then aytable = 'acustomer';
|
||||
when 9 then aytkey= 'ServerJob';
|
||||
when 10 then aytable = 'acontract';
|
||||
when 11 then aytkey= 'TrialSeeder';
|
||||
when 12 then aytkey= 'ServerMetrics';
|
||||
when 13 then aytable = 'atranslation';
|
||||
when 14 then aytkey= 'UserOptions';
|
||||
when 15 then aytable = 'aheadoffice';
|
||||
when 16 then aytable = 'aloanunit';
|
||||
when 17 then aytable = 'afileattachment'; aynamecolumn ='displayfilename';
|
||||
when 18 then aytable = 'adatalistsavedfilter';
|
||||
when 19 then aytable = 'aformcustom'; aynamecolumn = 'formkey';
|
||||
when 20 then aytable = 'apart'; aynamecolumn ='partnumber';
|
||||
when 21 then aytable = 'apm'; aynamecolumn ='serial';
|
||||
when 22 then aytkey= 'PMItem';
|
||||
when 23 then aytkey= 'WorkOrderItemExpense';
|
||||
when 24 then aytkey= 'WorkOrderItemLabor';
|
||||
when 25 then aytable = 'aproject';
|
||||
when 26 then aytable = 'apurchaseorder'; aynamecolumn = 'serial';
|
||||
when 27 then aytable = 'aquote'; aynamecolumn = 'serial';
|
||||
when 28 then aytkey= 'QuoteItem';
|
||||
when 29 then aytkey= 'WorkOrderItemLoan';
|
||||
when 30 then aytkey= 'WorkOrderItemPart';
|
||||
when 31 then aytable = 'aunit'; aynamecolumn = 'serial';
|
||||
when 32 then aytable = 'aunitmodel'; aynamecolumn = 'name';
|
||||
when 33 then aytable = 'avendor';
|
||||
when 34 then aytable = 'aworkorder'; aynamecolumn = 'serial';
|
||||
when 35 then aytkey= 'WorkOrderItem';
|
||||
when 36 then aytkey= 'WorkOrderItemExpense';
|
||||
when 37 then aytkey= 'WorkOrderItemLabor';
|
||||
when 38 then aytkey= 'WorkOrderItemLoan';
|
||||
when 39 then aytkey= 'WorkOrderItemPart';
|
||||
when 40 then aytkey= 'WorkOrderItemPartRequest';
|
||||
when 41 then aytkey= 'WorkOrderItemScheduledUser';
|
||||
when 42 then aytkey= 'WorkOrderItemTask';
|
||||
when 43 then aytkey= 'WorkOrderItemTravel';
|
||||
when 44 then aytkey= 'WorkOrderItemUnit';
|
||||
when 45 then aytkey= 'WorkOrderItemScheduledUser';
|
||||
when 46 then aytkey= 'WorkOrderItemTask';
|
||||
when 47 then aytkey= 'GlobalOps';
|
||||
when 48 then aytkey= 'BizMetrics';
|
||||
when 49 then aytkey= 'Backup';
|
||||
when 50 then aytable = 'ainappnotification';
|
||||
when 51 then aytkey= 'NotifySubscription';
|
||||
when 52 then aytable = 'areminder';
|
||||
when 53 then aytkey= 'UnitMeterReading';
|
||||
when 54 then aytable = 'acustomerservicerequest';
|
||||
when 56 then aytkey= 'OpsNotificationSettings';
|
||||
when 57 then aytable = 'areport';
|
||||
when 58 then aytkey= 'DashBoardView';
|
||||
when 59 then aytable = 'acustomernote'; aynamecolumn = 'notedate';
|
||||
when 60 then aytable = 'amemo';
|
||||
when 61 then aytable = 'areview';
|
||||
when 62 then aytable = 'aservicerate';
|
||||
when 63 then aytable = 'atravelrate';
|
||||
when 64 then aytable = 'ataxcode';
|
||||
when 65 then aytable = 'apartassembly';
|
||||
when 66 then aytable = 'apartwarehouse';
|
||||
when 67 then aytable = 'apartinventory'; aynamecolumn='description';
|
||||
when 68 then return format('DataListColumnView %L', ayobjectid);
|
||||
when 71 then aytable = 'aworkorderstatus';
|
||||
when 72 then aytable = 'aTaskGroup';
|
||||
when 73 then aytkey= 'WorkOrderItemOutsideService';
|
||||
when 74 then aytable = 'aWorkOrderItemPriority';
|
||||
when 75 then aytable = 'aWorkOrderItemStatus';
|
||||
when 76 then aytkey= 'WorkOrderItemTravel';
|
||||
when 77 then aytkey= 'WorkOrderItemUnit';
|
||||
when 78 then aytable = 'aquotestatus';
|
||||
when 79 then aytkey= 'WorkOrderItemOutsideService';
|
||||
when 80 then aytkey= 'WorkOrderItemExpense';
|
||||
when 81 then aytkey= 'WorkOrderItemLabor';
|
||||
when 82 then aytkey= 'WorkOrderItemLoan';
|
||||
when 83 then aytkey= 'WorkOrderItemPart';
|
||||
when 84 then aytkey= 'WorkOrderItemPartRequest';
|
||||
when 85 then aytkey= 'WorkOrderItemScheduledUser';
|
||||
when 86 then aytkey= 'WorkOrderItemTask';
|
||||
when 87 then aytkey= 'WorkOrderItemTravel';
|
||||
when 88 then aytkey= 'WorkOrderItemUnit';
|
||||
when 89 then aytkey= 'WorkOrderItemOutsideService';
|
||||
else
|
||||
RETURN returnstr;
|
||||
end case;
|
||||
|
||||
IF aytkey='no' then
|
||||
EXECUTE format('SELECT %I FROM %I WHERE id = %L', aynamecolumn, aytable, ayobjectid) INTO returnstr;
|
||||
else
|
||||
EXECUTE format('select display from atranslationitem where translationid=%L and key=%L', TRANSLATIONID, aytkey) INTO returnstr;
|
||||
END if;
|
||||
RETURN returnstr;
|
||||
END;
|
||||
$BODY$ LANGUAGE PLPGSQL STABLE");
|
||||
|
||||
Reference in New Issue
Block a user