program TempUp;

{used for updating data while developing system}
uses tuiapp, fixit, kstaff, jimmys, global, tuimsgs, kperson,
			ksorder, kdiary, kqnote,
			kcompany, krongai, kusers;

{this one for rongai w/shops, getting/putting jimmys for new staff
& converting drivers from TDirectoryItems to TStaff}

procedure DoJimmy(var Jimmy : PJimmy); far;
var Staff : PStaff;
		P : byte;
begin
	if (Jimmy^.srType = srPerson) then
		if pos('STA',PPerson(Jimmy)^.GetCategories)>0 then begin
			New(Staff, init);
			Staff^.RecNo := Jimmy^.RecNo; {so it replaces}
			Staff^.SurName := PPerson(Jimmy)^.SurName;
			Staff^.ForName := PPerson(Jimmy)^.ForName;
			Staff^.Title := PPerson(Jimmy)^.Title;
			Staff^.SurName := PPerson(Jimmy)^.SurName;
			Staff^.NAtID := PPerson(Jimmy)^.NatID;
			Staff^.CategoryCOdes := PPerson(Jimmy)^.CategoryCodes;
			{remove staff marker - automatic now}
			{hmmm... can't do this as then the pointers are out of synch}
{			P := pos('STA', Staff^.CategoryCodes);
			Staff^.CategoryCodes := copy(Staff^.CategoryCodes,1,P-1)+copy(Staff^.CategoryCodes,P+7,256);{}

			{copy pointers}
			Staff^.LoadAllPtrs;

			dispose(Jimmy, done);
			Jimmy := Staff;
		end;

	PutJimmy(JImmy);
end;


procedure Update;
begin
	ThinkingOn('Updating jimmys to latest ver');
	{Changed jimmy pointer-storing bit, so this involves basically
	re-ordering the index pointers to fit wiht the new way, ie getting and
	putting.  Auto ver-update will handle the get}

	ForAllJimmys('Updating Data items','New index/hook ptr format', DoJimmy, OnNilDoStd);
end;

begin
	New(Kameleon, init);
	Update;
	dispose(Kameleon, done);
end.