_fo_qry_FLD_POP_FIX
_prf_HLIST_RECREATE

_long:=_prf_ DataChangeDone ("10.02.2012 data changes")
If (_long=kFalse )
 _txt:="False"
 If (_qry Fld (0;wlg_kWork_Calendar ;"=";->_txt;"";kFalse;kTrue )>0)
  _txt:=""
  _sel APPLY_TO_SEL (wlg_kWork_Calendar ;->_txt)
 End if 
 _txt:="True"
 If (_qry Fld (0;wlg_kWork_Calendar ;"=";->_txt;"";kFalse;kTrue )>0)
  _txt:=""
  _sel APPLY_TO_SEL (wlg_kWork_Calendar ;->_txt)
 End if 
    `save update text to prf
    _prf_ DATA_CHANGE_SET ("10.02.2012 data changes")
End if 

_long:=_prf_ DataChangeDone ("01.01.2009 data changes")
If (_long=kFalse )
 _prf_ NAME_CHANGE("ld_wp_";"ldwp_")
 _prf_ NAME_CHANGE("ld_ro_";"ldro_")
 _prf_ NAME_CHANGE("ld_fl_";"ldfl_")
 _prf_ NAME_CHANGE("<>ld_lDefault_CalcType";"<>ld_lCalcType")
 _prf_ NAME_CHANGE("<>ld_lDefault_UseExtraTime";"<>ld_lUseExtraTime")
 _prf_ NAME_CHANGE("<>ld_lDefault_Direction";"<>ld_lDirection")
 _prf_ NAME_CHANGE("<>ldwp_lAutomaticStockEvents";"<>wo_lAutomaticStockEvents")
 
 _txt:="False"
 If (_qry Fld (0;so_kCustomer_Order_Number ;"=";->_txt;"";kFalse;kTrue )>0)
  _txt:=""
  _sel APPLY_TO_SEL (so_kCustomer_Order_Number ;->_txt)
 End if 
 _txt:="True"
 If (_qry Fld (0;so_kCustomer_Order_Number ;"=";->_txt;"";kFalse;kTrue )>0)
  _txt:=""
  _sel APPLY_TO_SEL (so_kCustomer_Order_Number ;->_txt)
 End if 

 _txt:="False"
 If (_qry Fld (0;so_kCost_Center;"=";->_txt;"";kFalse )>0)
  _txt:=""
  _sel APPLY_TO_SEL (so_kCost_Center ;->_txt)
 End if 
 _txt:="0"
 If (_qry Fld (0;so_kCost_Center;"=";->_txt;"";kFalse )>0)
  _txt:=""
  _sel APPLY_TO_SEL (so_kCost_Center ;->_txt)
 End if 
    `save update text to prf
    _prf_ DATA_CHANGE_SET ("01.01.2009 data changes")
End if 

 _long:=_prf_ DataChangeDone ("05.02.2009 data changes")
If (_long=kFalse )
  _long:=_info_ Confirm (_lang Current ("Run data repair code?")+ksCR +"(05.02.2009 data changes)")
  If (_long=kYes )
    _txt:=""
    _long:=0
    _real:=0
      `wpe
    _sel ALL_RECS (wpe_kTbl )
    _sel APPLY_TO_SEL (wpe_kPrevious_Phase ;->_txt)
    _sel APPLY_TO_SEL (wpe_kNext_Phase ;->_txt)
    _sel APPLY_TO_SEL (wpe_kLink_Target ;->_long)
    _sel APPLY_TO_SEL (wpe_kLinking_Hours ;->_real)
    _sel APPLY_TO_SEL (wpe_kSpecial_Extra_Hours ;->_real)
      `wos
    _sel ALL_RECS (wos_kTbl )
    _sel APPLY_TO_SEL (wos_kPrevious_Phase ;->_txt)
    _sel APPLY_TO_SEL (wos_kNext_Phase ;->_txt)
    _sel APPLY_TO_SEL (wos_kProd_Lot__linked_phase ;->_txt)
    _sel APPLY_TO_SEL (wos_kLink_Target ;->_long)
    _sel APPLY_TO_SEL (wos_kLinking_Hours ;->_real)
      `wlg
    _sel ALL_RECS (wlg_kTbl )
    _sel APPLY_TO_SEL (wlg_kExtra_Time_Capacity_Name ;->_txt)
      `save update text to prf
    _prf_ DATA_CHANGE_SET ("05.02.2009 data changes")
  End if 
End if 

_long:=_prf_ DataChangeDone ("11.03.2009 data changes")
If (_long=kFalse )
  _bool:=True
  If (_qry Fld (0;pr_kNo_Automatic_Stock_Remove ;"=";->_bool;"";kFalse )>0)
    _bool:=False
    _sel APPLY_TO_SEL (pr_kNo_Automatic_Stock_Remove ;->_bool)
    _long:=pr_ SetType
    _long2:=_qry Fld (0;pr_kType_ ;"#";->_long;"";kTrue )
    If (_long2>0)
      _sel_ SEL_TO_ARR_ONE (pr_kProduct_ID ;->_atArr)
      _txt:=_arr ToText (->_atArr)
      _txt:=_lang Current ("Product Is set -fields are cleared")+": "+ksCR +_txt+ksCR 
      _info MESSAGE (kInfo ;_txt;"11.03.2009 data changes";kFalse )
      _long2:=_info_ Confirm (_lang Current ("Product Is set -fields are cleared")+ksCR +_lang Current ("Do you want to change products Type-fields to type of Set?"))
      If (_long2=kYes )
        _long:=pr_ SetType 
        _sel APPLY_TO_SEL (pr_kType_ ;->_long)
      End if 
    End if 
  End if 
  _prf_ DATA_CHANGE_SET ("11.03.2009 data changes")
End if  

_long:=_prf_ DataChangeDone ("25.05.2009 transfer_id clear")
If (_long=kFalse )
  _long2:=_tbl_ Count
  For (_long;1;_long2)
    Case of 
      : (_long=_dlg_kTbl )
        IDLE
      Else 
        _long3:=_tbl_ TransferIdFldNum (_long)  `transfer_id field
        If (_long3#0)
          _txt:=""
          _qry Fld (0;_long3;"#";->_txt;"";kFalse )
          If (_sel RecsInSel (_long)>0)
            _txt:=""
            _sel APPLY_TO_SEL (_long3;->_txt)
          End if 
        End if 
    End case 
  End for 
  _prf_ DATA_CHANGE_SET ("25.05.2009 transfer_id clear")
End if 

_long:=_prf_ DataChangeDone ("22.06.2009 data changes")
If (_long=kFalse )
    _prf_ TXT_CHANGE ("_atPrevious_Phase";"_atPrevious_Phase")
    _prf_ TXT_CHANGE ("_atPhaseNext";"_atPhaseNext")
    _prf_ TXT_CHANGE ("_atPhasePrev";"_atPhasePrev")
    _prf_ TXT_CHANGE ("_atPhaseNext";"_atPhaseNext")
    _prf_ TXT_CHANGE ("_arShelf_Stock_Balance";"_arShelf_Stock_Balance")
    _prf_ TXT_CHANGE ("Hyllysaldo";"Hyllysaldo")
    _prf_ TXT_CHANGE ("Ed. vaihe";"Ed. vaihe")
    _prf_ TXT_CHANGE ("Seur. vaihe";"Seur. vaihe")
      `save update text to prf
    _prf_ DATA_CHANGE_SET ("22.06.2009 data changes")
End if 

_long:=_prf_ DataChangeDone ("06.07.2009 project field changes")
If (_long=kFalse )
    `so_
  _fld_ TXT_CHANGE (_rep_kRunner_Code ;"so_kProject_Code";"so_kCustomer_Project")
  _fld_ TXT_CHANGE (_rep_kRunner_Code ;"so_asProject_Code";"so_asCustomer_Project")
  _fld_ TXT_CHANGE (_rep_kRunner_Code ;"[Sales_Order]Project_Code";"[Sales_Order]Customer_Project")
    `po_
  _fld_ TXT_CHANGE (_rep_kRunner_Code ;"po_kProject_Code";"po_kCustomer_Project")
  _fld_ TXT_CHANGE (_rep_kRunner_Code ;"po_asProject_Code";"po_asCustomer_Project")
  _fld_ TXT_CHANGE (_rep_kRunner_Code ;"[Purchase_Order]Project_Code";"[Purchase_Order]Customer_Project")
    `in_
  _fld_ TXT_CHANGE (_rep_kRunner_Code ;"in_kProject_id";"in_kCustomer_Project")
  _fld_ TXT_CHANGE (_rep_kRunner_Code ;"in_asProject_id";"in_asCustomer_Project")
  _fld_ TXT_CHANGE (_rep_kRunner_Code ;"[Invoice]Project_id";"[Invoice]Customer_Project")
    `dn_
  _fld_ TXT_CHANGE (_rep_kRunner_Code ;"dn_kProjects";"dn_kCustomer_Project")
  _fld_ TXT_CHANGE (_rep_kRunner_Code ;"dn_asProjects";"dn_asCustomer_Project")
  _fld_ TXT_CHANGE (_rep_kRunner_Code ;"[Dispatch_Note]Projects";"[Dispatch_Note]Customer_Project")
    `save update text to prf
  _prf_ DATA_CHANGE_SET ("06.07.2009 project field changes")
End if 

_long:=_prf_ DataChangeDone ("12.01.2010 data changes")
If (_long=kFalse )
   _prf_ NAME_CHANGE("<>ld_lRawMatCriticalDateChange";"<>prnc_lRawMatCrDateChange")
   _prf_ NAME_CHANGE("<>ld_lProductNeedCalculationUse";"<>prnc_lNeedCalcFldTypePr_")
      `save update text to prf
    _prf_ DATA_CHANGE_SET ("12.01.2010 data changes")
End if 

_long:=_prf_ DataChangeDone ("18.06.2011 report format changes")
If (_long=kFalse )
   _sel ALL_RECS(_rep_kTbl)
   _rep_SRPRO_FORMAT_REPAIR
      `save update text to prf
    _prf_ DATA_CHANGE_SET ("18.06.2011 report format changes")
End if 

_long:=_prf_ DataChangeDone ("2.5.2012 stock post name changes")
If (_long=kFalse )
   _prf_ TXT_CHANGE ("stsp_atDispatchNoteState";"stsp_atPackingState")
   _prf_ TXT_CHANGE ("stsp_alDispatchNoteState";"stsp_alPackingState")
   _prf_ TXT_CHANGE ("stsp_atDispatchNote";"stsp_atCodeID")
   _prf_ DATA_CHANGE_SET ("2.5.2012 stock post name changes")
End if 

_prf_ NAME_CHANGE("_tbl_fld_List";"_tbl_fld_List_old_")

_long:=_prf_ DataChangeDone ("15.11.2012 coming amount array name changes")
If (_long=kFalse )
   _prf_ TXT_CHANGE ("ld_all_arMatSubComingAmount";"ld_all_arMatSubComingAmount")
   _prf_ TXT_CHANGE ("ld_work_arMatSubComingAmount";"ld_work_arMatSubComingAmount")
   _prf_ TXT_CHANGE ("ld_phase_arMatSubComingAmount";"ld_phase_arMatSubComingAmount")
   _prf_ DATA_CHANGE_SET ("15.11.2012 coming amount array name changes")
End if 

_long:=_prf_ DataChangeDone ("20.03.2013 resr_kWork_Load_Group_id-field empty")
If (_long=kFalse )
 _txt:="0:@"
 If (_qry Fld (0;resr_kWork_Load_Group_id ;"=";->_txt;"";kFalse;kTrue )>0)
  _txt:=""
  _sel APPLY_TO_SEL (resr_kWork_Load_Group_id ;->_txt)
 End if 
    `save update text to prf
    _prf_ DATA_CHANGE_SET ("20.03.2013 resr_kWork_Load_Group_id-field empty")
End if 

_long:=_prf_ DataChangeDone ("16.10.2014 customer group field changes")
If (_long=kFalse )
  _fld_ TXT_CHANGE (_rep_kRunner_Code ;"co_kGroup_2";"co_kzGroup_2")
  _fld_ TXT_CHANGE (_rep_kRunner_Code ;"co_kGroup_3";"co_kzGroup_3")
  _fld_ TXT_CHANGE (_rep_kRunner_Code ;"co_asGroup_2";"co_aszGroup_2")
  _fld_ TXT_CHANGE (_rep_kRunner_Code ;"co_asGroup_3";"co_aszGroup_3")

  _fld_ TXT_CHANGE (_rep_kRunner_Code ;"co_kGroup";"co_kGroup_1")
  _fld_ TXT_CHANGE (_rep_kRunner_Code ;"co_asGroup";"co_asGroup_1")

  _fld_ TXT_CHANGE (_rep_kRunner_Code ;"co_kzGroup_2";"co_kGroup_2")
  _fld_ TXT_CHANGE (_rep_kRunner_Code ;"co_kzGroup_3";"co_kGroup_3")
  _fld_ TXT_CHANGE (_rep_kRunner_Code ;"co_aszGroup_2";"co_asGroup_2")
  _fld_ TXT_CHANGE (_rep_kRunner_Code ;"co_aszGroup_3";"co_asGroup_3")
      `save update text to prf
  _prf_ DATA_CHANGE_SET ("16.10.2014 customer group field changes")
End if 

_long:=_prf_ DataChangeDone ("17.10.2014 text field name changes")
If (_long=kFalse )
  _fld_ TXT_CHANGE (_rep_kRunner_Code ;"[Dispatch_Note]Text";"[Dispatch_Note]Notes")
  _fld_ TXT_CHANGE (_rep_kRunner_Code ;"dn_kText";"dn_kNotes")
  _fld_ TXT_CHANGE (_rep_kRunner_Code ;"dn_atText";"dn_atNotes")
  _fld_ TXT_CHANGE (_rep_kRunner_Code ;"[Purchase_Order]Text";"[Purchase_Order]Order_Text")
  _fld_ TXT_CHANGE (_rep_kRunner_Code ;"po_kText";"po_kOrder_Text")
  _fld_ TXT_CHANGE (_rep_kRunner_Code ;"po_atText";"po_atOrder_Text")
  _prf_ DATA_CHANGE_SET ("17.10.2014 text field name changes")
End if 

_long:=_prf_ DataChangeDone ("21.10.2014 User_id field name changes")
If (_long=kFalse )
   _prf_ TXT_CHANGE ("wpa_asUser_id;";"wpa_asUser_id;")
  _prf_ DATA_CHANGE_SET ("21.10.2014 User_id field name changes")
End if 

_long:=_prf_ DataChangeDone ("3.12.2014 start_dt, end_dt")
If (_long=kFalse )
   _prf_ TXT_CHANGE ("start_dt";"start_dt")
   _prf_ TXT_CHANGE ("end_dt";"end_dt")
  _prf_ DATA_CHANGE_SET ("3.12.2014 time_start, time_end")
End if 

_long:=_prf_ DataChangeDone ("07.05.2015 data changes")
If (_long=kFalse )
   _prf_ NAME_CHANGE("cap_Preference.json";"capacity/preference.json")
   _prf_ NAME_CHANGE("cap_ShiftLimitPreference.json";"capacity/shift_limit.json")
   _prf_ NAME_CHANGE("cap_ShowPreference.json";"capacity/show.json")
   _prf_ NAME_CHANGE("cap_WebDefinition.json";"capacity/web_definition.json")
      `save update text to prf
    _prf_ DATA_CHANGE_SET ("07.05.2015 data changes")
End if 


