Skip to content
Snippets Groups Projects
stateProcess.js 726 B
Newer Older
import("Util_lib");
import("system.entities");
import("system.vars");
import("system.result");
import("KeywordRegistry_basic");
import("system.neon");

var state = neon.COMPONENTSTATE_INVISIBLE;
if(Utils.toBoolean(vars.get("$field.hasAdvertising")))
{
    //only when there is a advertising we can load it
    var conf = entities.createConfigForLoadingConsumerRows(); 
    conf.consumer("AdvertisingInformationConsumer"); 
    conf.fields(["STATUS"]); 
    
    var adv = entities.getRows(conf); 
    
    if(adv[0]["STATUS"] ==  $KeywordRegistry.advertisingStatus$Open())
    {
        state = neon.COMPONENTSTATE_EDITABLE;
    }
    else 
    {
        state = neon.COMPONENTSTATE_READONLY;
    }   
}

result.string(state);