601,100
562,"NULL"
586,
585,
564,
565,"hdlITYA=aXVZ0>^Uf9^=h95`T[?@`mW@^D@dP1qeGChysxRHEG^t7rOzUyu44xJl@N209kEc1Lwprgy]sfWi2XKu^Ei>BVa\rTR;[AlP@TDNto7c=\gHQNj1xKdMbbhfxP6f\lY=>;q[i@pyQ32[UQ^I;1cP@6vjuNVyhqFvXOhlwCWf\:;au\xNR\bkOj0^47p]Uz]>"
559,0
593,
594,
595,
597,
598,
596,
800,
801,
566,0
567,","
588,"."
589,
568,""""
570,
571,
569,0
592,0
599,1000
560,3
pObjectType
pObject
pPlan
561,3
2
2
2
590,3
pObjectType,"WIZARD"
pObject,"sm_plan_wizard_temp_"
pPlan,"plan_version"
637,3
pObjectType,Object Type
pObject,Object ID
pPlan,Plan
577,0
578,0
579,0
580,0
581,0
582,0
572,111

#****GENERATED STATEMENTS START****
#****GENERATED STATEMENTS FINISH****

vObjectPrefix = attrs('}sm_controls', 'subman_object_prefix', 'value');
vObjectSeparator = attrs('}sm_controls', 'subman_object_separator', 'value');

# if deleting a plan or version make sure the plan exists
if (pObjectType @= 'version' % pObjectType @= 'plan');
vPlanDimension = vObjectPrefix | 'sm_plans';
vDimIX = DIMIX(vPlanDimension, pPlan);

# verify that the plan exists
if (vDimIX = 0);
processquit;
endif;
endif;

vObjectDimension = '';
vTaskDimension = '';

# deleting a version
if (pObjectType @= 'version');
vObjectDimension = vObjectPrefix | 'sm_versions' | vObjectSeparator | pPlan;
vTaskDimension = vObjectPrefix | 'sm_versiontasks' | vObjectSeparator | pPlan | vObjectSeparator | pObject;
vBindingsCube = vObjectPrefix | 'sm_versionbindings' | vObjectSeparator | pPlan | vObjectSeparator | pObject;

# deleting a template
elseif (pObjectType @= 'template');
vObjectDimension = vObjectPrefix | 'sm_templates';
vTaskDimension = vObjectPrefix | 'sm_templatetasks' | vObjectSeparator | pObject;
vBindingsCube = vObjectPrefix | 'sm_templatebindings' | vObjectSeparator | pObject;

# deleting a plan
elseif (pObjectType @= 'plan');
pObject = pPlan;
vObjectDimension = vPlanDimension;

# deleting a version status
elseif (pObjectType @= 'version_status');
vObjectDimension = vObjectPrefix | 'sm_version_status';

# deleting a task status
elseif (pObjectType @= 'status');
vObjectDimension = vObjectPrefix | 'sm_task_status';

# deleting a task action
elseif (pObjectType @= 'action');
vObjectDimension = vObjectPrefix | 'sm_task_action';

# deleting a  simple task
elseif (pObjectType @= 'simpletask');
vObjectDimension = vObjectPrefix | 'sm_simple_tasks';

elseif (pObjectType @= 'WIZARD');
dimensiondestroy(vObjectPrefix | pObject);
processbreak;

endif;

# find the object to be deleted
vDimIX = DIMIX(vObjectDimension , pObject);

if (vDimIX = 0);
processbreak;
endif;

# delete the object
dimensionelementdelete(vObjectDimension, pObject);

#if delete a version, delete version/tasks attachments
if (pObjectType @= 'version');
ExecuteProcess('}sm_remove_versiontask_attachments', 'pPlan', pPlan, 'pVersion', pObject);
endif;

#if delete a task, delete all task attachments

# if deleting a plan, also clean up all of the plan versions
if (pObjectType @= 'plan');
vPlanVersionsDimension = vObjectPrefix | 'sm_versions' | vObjectSeparator | pPlan;
vVersions = DIMSIZ(vPlanVersionsDimension);
vVersionIndex = vVersions;

while (vVersionIndex  >= 1);
vVersion = DIMNM(vPlanVersionsDimension, vVersionIndex);

#delete all version/tasks attachments
ExecuteProcess('}sm_remove_versiontask_attachments', 'pPlan', pPlan, 'pVersion', vVersion);
vPlanVersionTasksDimension = vObjectPrefix | 'sm_versiontasks' | vObjectSeparator | pPlan | vObjectSeparator | vVersion;
dimensiondestroy(vPlanVersionTasksDimension);

dimensionelementdelete(vPlanVersionsDimension, vVersion);
vVersionIndex = vVersionIndex - 1;
end;

# delete the plan_version dimension
dimensiondestroy(vPlanVersionsDimension);

else;

vDimIX = DIMIX(vObjectDimension , pObject);

# if there is an associated task dimension, destroy it
if (vTaskDimension @<> '');
if (vBindingsCube @<> '');
cubedestroy(vBindingsCube);
endif;
dimensiondestroy(vTaskDimension);
endif;

endif;
573,3

#****GENERATED STATEMENTS START****
#****GENERATED STATEMENTS FINISH****
574,3

#****GENERATED STATEMENTS START****
#****GENERATED STATEMENTS FINISH****
575,5

#****GENERATED STATEMENTS START****
#****GENERATED STATEMENTS FINISH****


576,CubeAction=1511	DataAction=1503	CubeLogChanges=0	
638,1
804,0
900,
901,
902,
903,
906,
907,
908,
904,0
905,0
909,0
910,0
911,
912,
913,
914,
915,
916,
