R30127 SalesOrder - Set Pos Attributes
| Code | R30127 | 
| Entity | Crm.Sales.SalesOrders Entity | 
| Name | SetPosAttributes | 
| Attribute | PosLocation, PosOperator, PosTerminal, PosFiscalPrinter | 
| Layer | Front-End | 
| Events | AttributeChanged(EnterpriseCompanyLocation) | 
| Priority | Normal | 
| Modify | YES | 
| Applicable Legislations | ALL // no condition needed | 
| Action | The rule sets values in PosLocation, PosOperator, PosTerminal and PosFiscalPrinter,
according to the following conditions: // The order of execution of the actions must be retained! 1) If ((PosLocations[(EnterpriseCompanyLocation = SalesOrder.EnterpriseCompanyLocation) && (Active = True)].Count() == 1)) , set value: PosLocation = PosLocations[(EnterpriseCompanyLocation = SalesOrder.EnterpriseCompanyLocation) && (Active = True)] (2) If ((PosLocation != NULL) && (PosOperators[(User = CurrentUser*) && (PosLocation = SalesOrder. PosLocation) && (Active = True) && (StartingDate >= CurrentDate) && ((CurrentDate <= TerminationDate) || (TerminationDate == NULL))].Count() == 1)) , set value: PosOperator = PosOperator [(User = CurrentUser*) && (PosLocation = SalesOrder. PosLocation) && (Active = True) && (StartingDate >= CurrentDate) && ((CurrentDate <= TerminationDate) || (TerminationDate == NULL))] * CurrentUser - the user that is currently logged into the system. (3) If ((PosLocation != NULL) && (PosOperator != NULL)) , set value: PosTerminal = PosOperator.DefaultPosTerminal (4) If ((PosTerminal != NULL) && (PosTerminal.DefaultPOSFiscalDevice !=NULL)) , set value: PosFiscalPrinter = PosTerminal.DefaultPOSFiscalDevice else if ((PosTerminal != NULL) && (PosDevices[(PosTerminal = SalesOrder.PosTerminal) && (Active = True) && (DeviceType = FiscalPrinter)].Count() = =1 )) , set value: PosFiscalPrinter = PosDevice[(PosTerminal = SalesOrder.PosTerminal) && (Active = True) && (DeviceType = FiscalPrinter) | 
| Description | The rule successively sets values in the POS Location, POS Operator, POS Terminal and POS
FiscalPrinter fields of the Sales Order when the Enterprise Company Location is set/changed
and if the following conditions are met: (1) POS Location - if there is exactly one active POS Location with the same Enterprise Company Location as the Sales Order's Enterprise Company Location. (2) POS Operator - if the field POS Location has a value and for the user that is currently logged into the system there is only one Active (and according to the Starting and Termination dates and the Active check-mark) POS Operator with the Sales Order's POS Location. (3) POS Terminal - with the value of the POS Operator's Default Pos Terminal - if the fields POS Location and POS Operator have values. (4) POS Fiscal Printer - if the Sales Order's POS Terminal has a value and it has a Default POS Fiscal Device OR there is only one Active POS Device with Fiscal Printer type for this POS Terminal. | 
| Message | - | 
| Version | Introduced: 2019.1 Updated: 2020.1 - in Action (4) is added a condition by POS Terminal's Default POS Fiscal Device | 
| Revocable | YES | 
* For more information about the Business Rules Documentation Template and a short explanation of each column, see topic System Business Rules.