
function preloadCatalog(catalog){
                var cat = u8.services.catalogs.tryGet(catalog); 
                if (!cat) u8.services.catalogs.request(catalog);
}


(function(){
                preloadCatalog(1052); //FI/X3 Geschäftsbereich
                //preloadCatalog(x); //R7Anwenderstatus                      
})();


(function () { // X3 Bonus

	//START Bonus1 Handel/EFGD - D_Bonus_Handel_Bon1
	//Author: O. Hilt & J. Kallies am 05.11.2019 - zuletzt aktualisiert am: x.x.20x
	//Feld Geschäftsbereich (X3 Bonus) FID 7020 - wenn Feld=Handel oder EFGD dann sichtbar
    u8.services.menus.registerMenuItem("D_Bonus_Handel_Bon1", {
        create: function(menu, args)   {                                       
            var menuItem = args.menuItem,
                executeArguments = menu && menu.executeOptions && menu.executeOptions.arguments,
                uid = executeArguments && executeArguments.uid;
					// asynchronously read the value 
				   u8.services.crud.readFields({ uid: uid, fields: [7020,86] }, function (sender, args) {
				   //debugger;
				   if (args && args.values && args.values.length > 0) {
					   var cat = u8.services.catalogs.tryGet(1052);
					   if (cat && (cat.codeToExternalKey(args.values[0]) == "1_1052_1" || cat.codeToExternalKey(args.values[0]) == "1_1052_7") && args.values[1] != u8.session.localeSettings.booleanFalse) {                                                                                         
						  menuItem.visible = true;  
						}
						else {
							menuItem.visible = false;   
						}
				   }
				   menuItem.update(); 
				   });
        },
                               
                   needsUpdateOnShow: true
    });
	//ENDE Bonus1 Handel/EFGD - D_Bonus_Handel_Bon1


	//START Bonus1 Subaru/FFS - D_Bonus_Subaru_Bon1
	//Author: O. Hilt & J. Kallies am 05.11.2019 - zuletzt aktualisiert am: x.x.20x
	u8.services.menus.registerMenuItem("D_Bonus_Subaru_Bon1", {
        create: function(menu, args)   {                                       
            var menuItem = args.menuItem,
                executeArguments = menu && menu.executeOptions && menu.executeOptions.arguments,
                uid = executeArguments && executeArguments.uid;
					// asynchronously read the value 
				   u8.services.crud.readFields({ uid: uid, fields: [7020,86] }, function (sender, args) {
				   //debugger;
				   if (args && args.values && args.values.length > 0) {
					   var cat = u8.services.catalogs.tryGet(1052);
					   if (cat && (cat.codeToExternalKey(args.values[0]) == "1_1052_3") && args.values[1] != u8.session.localeSettings.booleanFalse) {                                                                                         
						  menuItem.visible = true;  
						}
						else {
							menuItem.visible = false;   
						}
				   }
				   menuItem.update(); 
				   });
        },
                               
                   needsUpdateOnShow: true
    });
	//ENDE Bonus1 Subaru/FFS - D_Bonus_Subaru_Bon1


	//START Bonus4 Handel/EFGD - D_Bonus_Handel_Bon4
	//Author: O. Hilt & J. Kallies am 08.11.2019 - zuletzt aktualisiert am: x.x.20x
	u8.services.menus.registerMenuItem("D_Bonus_Handel_Bon4", {
        create: function(menu, args)   {                                       
            var menuItem = args.menuItem,
                executeArguments = menu && menu.executeOptions && menu.executeOptions.arguments,
                uid = executeArguments && executeArguments.uid;
					// asynchronously read the value 
				   u8.services.crud.readFields({ uid: uid, fields: [7020,7021,86] }, function (sender, args) {  
				   //debugger;
				   if (args && args.values && args.values.length > 0) {
					   var cat = u8.services.catalogs.tryGet(1052);
					   /*var cat2 = u8.services.catalogs.tryGet(1026);*/
					   if (cat && (cat.codeToExternalKey(args.values[0]) == "1_1052_1" || cat.codeToExternalKey(args.values[0]) == "1_1052_7") && args.values[1] != "0" && args.values[2] != u8.session.localeSettings.booleanFalse) 
						{                                                                                        
						  menuItem.visible = true;  
						}
						else {
							menuItem.visible = false;   
						}
				   }
				   menuItem.update(); 
				   });
        },
                               
                   needsUpdateOnShow: true
    });
	//ENDE Bonus4 Handel/EFGD - D_Bonus_Handel_Bon4


	//START Bonus4 Subaru/FFS - D_Bonus_Subaru_Bon4
	//Author: O. Hilt & J. Kallies am 08.11.2019 - zuletzt aktualisiert am: x.x.20x
	u8.services.menus.registerMenuItem("D_Bonus_Subaru_Bon4", {
        create: function(menu, args)   {                                       
            var menuItem = args.menuItem,
                executeArguments = menu && menu.executeOptions && menu.executeOptions.arguments,
                uid = executeArguments && executeArguments.uid;
					// asynchronously read the value 
				   u8.services.crud.readFields({ uid: uid, fields: [7020,7021,86] }, function (sender, args) {  
				   //debugger;
				   if (args && args.values && args.values.length > 0) {
					   var cat = u8.services.catalogs.tryGet(1052);
					   if (cat && (cat.codeToExternalKey(args.values[0]) == "1_1052_3") && args.values[1] != "0" && args.values[2] != u8.session.localeSettings.booleanFalse) 
					    {  
						  menuItem.visible = true;  
						}
						else {
							menuItem.visible = false;   
						}
				   }
				   menuItem.update(); 
				   });
        },
                               
                   needsUpdateOnShow: true
    });
	//ENDE Bonus4 Subaru/FFS - D_Bonus_Subaru_Bon4


	//START Anlage Steigerungsbonus - D_Bonus_Anl_Steiger
	//Author: O. Hilt & J. Kallies am 05.11.2019 - zuletzt aktualisiert am: x.x.20x
	//Feld Steigerungsbonus X3 Bonus FID 7059 - wenn Feld=true dann sichtbar
	u8.services.menus.registerMenuItem("D_Bonus_Anl_Steiger", {
        create: function(menu, args)   {                                       
            var menuItem = args.menuItem,
                executeArguments = menu && menu.executeOptions && menu.executeOptions.arguments, 
                uid = executeArguments && executeArguments.uid;
					// asynchronously read the value 
				   u8.services.crud.readFields({ uid: uid, fields: [7059,86] }, function (sender, args) {
				   //debugger;
				   if (args && args.values && args.values.length > 0 && args.values[0] != u8.session.localeSettings.booleanFalse && args.values[1] != u8.session.localeSettings.booleanFalse) {
					    menuItem.visible = true;  
				   }
				   else {
							menuItem.visible = false;   
					}
				   menuItem.update(); 
				   });
        }, 
                               
                   needsUpdateOnShow: true
    }); 
	//ENDE Anlage Steigerungsbonus - D_Bonus_Anl_Steiger


	//START D_Bonus_Anl_Plus50Vers
	//Author: O. Hilt am 05.11.2019 - zuletzt aktualisiert am: x.x.20x
	u8.services.menus.registerMenuItem("D_Bonus_Anl_Plus50Vers", {
        create: function(menu, args)   {                                       
            var menuItem = args.menuItem,
                executeArguments = menu && menu.executeOptions && menu.executeOptions.arguments, 
                uid = executeArguments && executeArguments.uid;
					// asynchronously read the value 
				   u8.services.crud.readFields({ uid: uid, fields: [7084,86] }, function (sender, args) {
				   //debugger;
				   if (args && args.values && args.values.length > 0 && args.values[0] != u8.session.localeSettings.booleanFalse && args.values[1] != u8.session.localeSettings.booleanFalse) {
					    menuItem.visible = true;  
				   }
				   else {
							menuItem.visible = false;   
					}
				   menuItem.update(); 
				   });
        }, 
                               
                   needsUpdateOnShow: true
    }); 	
	//ENDE D_Bonus_Anl_Plus50Vers


	//START D_Bonus_Anl_JuhuAuto
	//Author: O. Hilt am 05.11.2019 - zuletzt aktualisiert am: x.x.20x
	u8.services.menus.registerMenuItem("D_Bonus_Anl_JuhuAuto", {
        create: function(menu, args)   {                                       
            var menuItem = args.menuItem,
                executeArguments = menu && menu.executeOptions && menu.executeOptions.arguments, 
                uid = executeArguments && executeArguments.uid;
					// asynchronously read the value 
				   u8.services.crud.readFields({ uid: uid, fields: [7088,86] }, function (sender, args) {
				   //debugger;
				   if (args && args.values && args.values.length > 0 && args.values[0] != u8.session.localeSettings.booleanFalse && args.values[1] != u8.session.localeSettings.booleanFalse) {
					    menuItem.visible = true;  
				   }
				   else {
							menuItem.visible = false;   
					}
				   menuItem.update(); 
				   });
        }, 
                               
                   needsUpdateOnShow: true
    }); 	
	//ENDE D_Bonus_Anl_JuhuAuto


	//START D_Bonus_Anl_Loyalität
	//Author: O. Hilt am 05.11.2019 - zuletzt aktualisiert am: x.x.20x
	u8.services.menus.registerMenuItem("D_Bonus_Anl_Loyalität", {
        create: function(menu, args)   {                                       
            var menuItem = args.menuItem,
                executeArguments = menu && menu.executeOptions && menu.executeOptions.arguments, 
                uid = executeArguments && executeArguments.uid;
					// asynchronously read the value 
				   u8.services.crud.readFields({ uid: uid, fields: [88,86] }, function (sender, args) {
				   //debugger;
				   if (args && args.values && args.values.length > 0 && args.values[0] != u8.session.localeSettings.booleanFalse && args.values[1] != u8.session.localeSettings.booleanFalse) {
					    menuItem.visible = true;  
				   }
				   else {
							menuItem.visible = false;   
					}
				   menuItem.update(); 
				   });
        }, 
                               
                   needsUpdateOnShow: true
    }); 	
	//ENDE D_Bonus_Anl_Loyalität


	//START Doppelter Bonus - D_Bonus_Anl_DopBonus
	//Author: O. Hilt am 05.11.2019 - zuletzt aktualisiert am: x.x.20x
	u8.services.menus.registerMenuItem("D_Bonus_Anl_DopBonus", {
        create: function(menu, args)   {                                       
            var menuItem = args.menuItem,
                executeArguments = menu && menu.executeOptions && menu.executeOptions.arguments, 
                uid = executeArguments && executeArguments.uid;
					// asynchronously read the value 
				   u8.services.crud.readFields({ uid: uid, fields: [7087,86] }, function (sender, args) {
				   //debugger;
				   if (args && args.values && args.values.length > 0 && args.values[0] != u8.session.localeSettings.booleanFalse && args.values[1] != u8.session.localeSettings.booleanFalse) {
					    menuItem.visible = true;  
				   }
				   else {
							menuItem.visible = false;   
					}
				   menuItem.update(); 
				   });
        }, 
                               
                   needsUpdateOnShow: true
    }); 	
	//ENDE Doppelter Bonus - D_Bonus_Anl_DopBonus


	//START Remarketing - D_Bonus_Anl_Remarketing
	//Author: O. Hilt am 05.11.2019 - zuletzt aktualisiert am: x.x.20x
	u8.services.menus.registerMenuItem("D_Bonus_Anl_Remarketing", {
        create: function(menu, args)   {                                       
            var menuItem = args.menuItem,
                executeArguments = menu && menu.executeOptions && menu.executeOptions.arguments, 
                uid = executeArguments && executeArguments.uid;
					// asynchronously read the value 
				   u8.services.crud.readFields({ uid: uid, fields: [7047,86] }, function (sender, args) {
				   //debugger;
				   if (args && args.values && args.values.length > 0 && args.values[0] != u8.session.localeSettings.booleanFalse && args.values[1] != u8.session.localeSettings.booleanFalse) {
					    menuItem.visible = true;  
				   }
				   else {
							menuItem.visible = false;   
					}
				   menuItem.update(); 
				   });
        }, 
                               
                   needsUpdateOnShow: true
    }); 
	//ENDE Remarketing - D_Bonus_Anl_Remarketing


	//START AngeschlBetriebe - D_Bonus_Anl_AngeschlBetriebe
	//Author: O. Hilt am 05.11.2019 - zuletzt aktualisiert am: x.x.20x
	u8.services.menus.registerMenuItem("D_Bonus_Anl_AngeschlBetriebe", {
        create: function(menu, args)   {                                       
            var menuItem = args.menuItem,
                executeArguments = menu && menu.executeOptions && menu.executeOptions.arguments, 
                uid = executeArguments && executeArguments.uid;
					// asynchronously read the value 
				   u8.services.crud.readFields({ uid: uid, fields: [7089,86] }, function (sender, args) {
				   //debugger;
				   if (args && args.values && args.values.length > 0 && args.values[0] != u8.session.localeSettings.booleanFalse && args.values[1] != u8.session.localeSettings.booleanFalse) {
					    menuItem.visible = true;  
				   }
				   else {
							menuItem.visible = false;   
					}
				   menuItem.update(); 
				   });
        }, 
                               
                   needsUpdateOnShow: true
    }); 
	//ENDE	AngeschlBetriebe - D_Bonus_Anl_AngeschlBetriebe

    //START D_Bonus_Zusatz_JuhuAuto
    //Author: O. Hilt am 28.11.2020 - zuletzt aktualisiert am: x.x.20x
	u8.services.menus.registerMenuItem("D_Bonus_Zusatz_JuhuAuto", {
	    create: function (menu, args) {
	        var menuItem = args.menuItem,
                executeArguments = menu && menu.executeOptions && menu.executeOptions.arguments,
                uid = executeArguments && executeArguments.uid;
	        // asynchronously read the value 
	        u8.services.crud.readFields({ uid: uid, fields: [7093,86] }, function (sender, args) {
	            //debugger;
	            if (args && args.values && args.values.length > 0 && args.values[0] != u8.session.localeSettings.booleanFalse && args.values[1] != u8.session.localeSettings.booleanFalse) {
	                menuItem.visible = true;
	            }
	            else {
	                menuItem.visible = false;
	            }
	            menuItem.update();
	        });
	    },

	    needsUpdateOnShow: true
	});
    //ENDE	D_Bonus_Zusatz_JuhuAuto

	//START TreueBonus - D_Bonus_Anl_TreueBonus
	//Author: O. Hilt Anlage am 23.10.2023 - zuletzt aktualisiert am: x.x.20x
	u8.services.menus.registerMenuItem("D_Bonus_Anl_TreueBonus", {
		create: function (menu, args) {
			var menuItem = args.menuItem,
				executeArguments = menu && menu.executeOptions && menu.executeOptions.arguments,
				uid = executeArguments && executeArguments.uid;
			// asynchronously read the value 
			u8.services.crud.readFields({ uid: uid, fields: [7106,86] }, function (sender, args) {
				//debugger;
				if (args && args.values && args.values.length > 0 && args.values[0] != u8.session.localeSettings.booleanFalse && args.values[1] != u8.session.localeSettings.booleanFalse) {
					menuItem.visible = true;
				}
				else {
					menuItem.visible = false;
				}
				menuItem.update();
			});
		},

		needsUpdateOnShow: true
	});
	//ENDE TreueBonus - D_Bonus_Anl_TreueBonus

	//START BDK-ProduktWelt - D_Bonus_Anl_BdkProduktWelt
	//Author: O. Hilt Anlage am 23.10.2023 - zuletzt aktualisiert am: x.x.20x
	u8.services.menus.registerMenuItem("D_Bonus_Anl_BdkProduktWelt", {
		create: function (menu, args) {
			var menuItem = args.menuItem,
				executeArguments = menu && menu.executeOptions && menu.executeOptions.arguments,
				uid = executeArguments && executeArguments.uid;
			// asynchronously read the value 
			u8.services.crud.readFields({ uid: uid, fields: [7104, 86] }, function (sender, args) {
				//debugger;
				if (args && args.values && args.values.length > 0 && args.values[0] != u8.session.localeSettings.booleanFalse && args.values[1] != u8.session.localeSettings.booleanFalse) {
					menuItem.visible = true;
				}
				else {
					menuItem.visible = false;
				}
				menuItem.update();
			});
		},

		needsUpdateOnShow: true
	});
	//ENDE Qualitäts-Bonus - D_Bonus_Anl_QualiBonus

	//START TreueBonus - D_Bonus_Anl_TreueBonus
	//Author: O. Hilt Anlage am 23.10.2023 - zuletzt aktualisiert am: x.x.20x
	u8.services.menus.registerMenuItem("D_Bonus_Anl_QualiBonus", {
		create: function (menu, args) {
			var menuItem = args.menuItem,
				executeArguments = menu && menu.executeOptions && menu.executeOptions.arguments,
				uid = executeArguments && executeArguments.uid;
			// asynchronously read the value 
			u8.services.crud.readFields({ uid: uid, fields: [7105, 86] }, function (sender, args) {
				//debugger;
				if (args && args.values && args.values.length > 0 && args.values[0] != u8.session.localeSettings.booleanFalse && args.values[1] != u8.session.localeSettings.booleanFalse) {
					menuItem.visible = true;
				}
				else {
					menuItem.visible = false;
				}
				menuItem.update();
			});
		},

		needsUpdateOnShow: true
	});
	//ENDE Qualitäts-Bonus - D_Bonus_Anl_QualiBonus


    //START Platzhalter

    //ENDE	Platzhalter


	//START Platzhalter
	
	//ENDE	Platzhalter
	
})();
