Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion IRP/src/CommonModules/BuilderAPI/Module.bsl
Original file line number Diff line number Diff line change
Expand Up @@ -449,10 +449,11 @@ EndFunction
// TableName - String - Table name
// ReturnRowKey - Boolean -
// RowKey - String -
// LineNumber - Number -
//
// Returns:
// ValueTableRow, String
Function AddRow(Wrapper, TableName = Undefined, ReturnRowKey = False, RowKey = "") Export
Function AddRow(Wrapper, TableName = Undefined, ReturnRowKey = False, RowKey = "", LineNumber = 0) Export
If TableName = Undefined Then
TableName = Wrapper.DefaultTable;
EndIf;
Expand All @@ -466,12 +467,19 @@ Function AddRow(Wrapper, TableName = Undefined, ReturnRowKey = False, RowKey = "
NewRow.Key = RowKey;
EndIf;
EndIf;
If LineNumber > 0 Then
NewRow.LineNumber = LineNumber;
EndIf;
ServerParameters = ControllerClientServer_V2.GetServerParameters(Wrapper.Object);
ServerParameters.TableName = TableName;
Rows = New Array(); // Array Of DocumentTabularSectionRow.SalesInvoice.ItemList
Rows.Add(NewRow);
ServerParameters.Rows = Rows;
Parameters = ControllerClientServer_V2.GetParameters(ServerParameters);
If ControllerClientServer_V2.IsFullTransferTabularSection(Parameters, TableName)
OR ControllerClientServer_V2.IsFullLoadTabularSection(Parameters, TableName) Then
Raise StrTemplate(R().Error_TableNotSupportedInBuilder, TableName);
EndIf;
ControllerClientServer_V2.AddNewRow(TableName, Parameters);
If KeyFieldExists Then
NewRow = WrapperTable.FindRows(New Structure("Key", NewRow.Key))[0];
Expand Down
24 changes: 19 additions & 5 deletions IRP/src/CommonModules/ControllerClientServer_V2/Module.bsl
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ Function CreateParameters(ServerParameters, FormParameters, LoadParameters)
WrappedRows = WrapRows(Parameters, ServerParameters.Rows);
If WrappedRows.Count() Then
Parameters.Insert("Rows", WrappedRows);
Parameters.Insert("CurrentRow", WrappedRows[0].LineNumber);
EndIf;

Parameters.Insert("NextSteps" , New Array());
Expand Down Expand Up @@ -273,6 +274,9 @@ Function WrapRows(Parameters, Rows) Export
NewRow.Insert("Key", RowLine);
RowLine = RowLine + 1;
EndIf;
If Not NewRow.Property("LineNumber") Then
NewRow.Insert("LineNumber", 0);
EndIf;
ArrayOfRows.Add(NewRow);

// SpecialOffers
Expand Down Expand Up @@ -404,6 +408,7 @@ Function GetEventHandlerMap(Parameters, DataPath, IsBuilder)
EventHandlerMap.Insert("ItemList.ExpCount" , "SetItemListExpCount");
EventHandlerMap.Insert("ItemList.SalesInvoice" , "SetItemListSalesDocument");
EventHandlerMap.Insert("ItemList.RetailSalesReceipt" , "SetItemListSalesDocument");
EventHandlerMap.Insert("ItemList.OffersAmount" , "StepItemListCalculations_IsOffersChanged");

If Parameters.ObjectMetadataInfo.MetadataName = "SalesReportToConsignor" Then
EventHandlerMap.Insert("ItemList.TotalAmount",
Expand Down Expand Up @@ -499,7 +504,11 @@ Procedure API_SetProperty(Parameters, Property, Value, IsBuilder = False, Settin
If ArrayOfEventHandlers = Undefined Then // no steps, no setter, no commands
If IsColumn Then
For Each Row In GetRows(Parameters, Parameters.TableName) Do
SetterObject("BindVoid", Property.DataPath, Parameters, ResultArray(Row.Key, Value));
RowKey = Row.Key;
If RowKey = 0 And Row.Property("LineNumber") Then
RowKey = Row.LineNumber;
EndIf;
SetterObject("BindVoid", Property.DataPath, Parameters, ResultArray(RowKey, Value));
EndDo;
Else
SetterObject("BindVoid", Property.DataPath, Parameters, ResultArray(Undefined, Value));
Expand Down Expand Up @@ -872,7 +881,11 @@ Procedure AddNewRow(TableName, Parameters, ViewNotify = Undefined, LaunchSteps =
If Default <> Undefined Then

RegisterNextSteps(Parameters, True , Default.StepsEnabler, DataPath);


// service attribute
ElsIf ColumnName = "LineNumber" Then
Continue;

// if column is filled and has its own handler .OnChage call it
ElsIf ValueIsFilled(NewRow[ColumnName]) Then
SetPropertyObject(Parameters, DataPath, NewRow.Key, NewRow[ColumnName]);
Expand Down Expand Up @@ -17912,7 +17925,7 @@ Procedure ExecuteViewNotify(Parameters, ViewNotify)
EndProcedure
#ENDIF

Function IsFullTransferTabularSection(Parameters, PropertyName)
Function IsFullTransferTabularSection(Parameters, PropertyName) Export
_PropertyName = Upper(PropertyName);
If _PropertyName = Upper("SerialLotNumbers")
Or _PropertyName = Upper("SpecialOffers")
Expand All @@ -17928,7 +17941,7 @@ Function IsFullTransferTabularSection(Parameters, PropertyName)
Return False;
EndFunction

Function IsFullLoadTabularSection(Parameters, PropertyName)
Function IsFullLoadTabularSection(Parameters, PropertyName) Export
_PropertyName = Upper(PropertyName);
If _PropertyName = Upper("SourceOfOrigins") Then
Return True;
Expand Down Expand Up @@ -17985,7 +17998,8 @@ Procedure _CommitChainChanges(Cache, Source, Parameters)
If FoundedRowInMap <> Undefined Then
FoundedRowInMap[KeyValue.Key] = KeyValue.Value;
EndIf;
If Not TypeOf(Row.Key) = Type("Number") Then
// If Not TypeOf(Row.Key) = Type("Number") Then // ?????
If KeyValue.Key <> "Key" Then
FoundedRow[KeyValue.Key] = KeyValue.Value;
EndIf;
EndDo;
Expand Down
5 changes: 5 additions & 0 deletions IRP/src/CommonModules/Localization/Module.bsl
Original file line number Diff line number Diff line change
Expand Up @@ -1005,6 +1005,10 @@
// * Error_UnknownRefType - String -
// * Error_StepsEnablerNotDefined - String -
// * Error_UnsupportedExternalLinkSC3 - String -
// * Error_CreatingPDF - String -
// * Error_ReadingPDF - String -
// * Error_ChromiumNotFound - String -
// * Error_TableNotSupportedInBuilder - String -
// * Task_Result_Execution - String -
// * Task_Result_Execution_Not - String -
// * Task_Result_Verification - String -
Expand Down Expand Up @@ -2855,6 +2859,7 @@ Strings.Insert("ExternalAccountingOperationExchangeReport", NStr("en = 'External
Strings.Insert("Error_CreatingPDF", NStr("en = 'Error creating PDF'", Lang));
Strings.Insert("Error_ReadingPDF", NStr("en = 'Error reading PDF'", Lang));
Strings.Insert("Error_ChromiumNotFound", NStr("en = 'Chromium not found'", Lang));
Strings.Insert("Error_TableNotSupportedInBuilder", NStr("en = 'Table [%1] is not supported in Builder API'", Lang));
#EndRegion

#Region Tasks
Expand Down
5 changes: 2 additions & 3 deletions IRP/src/CommonModules/TransformObjects/Module.bsl
Original file line number Diff line number Diff line change
Expand Up @@ -397,11 +397,10 @@ EndFunction
Procedure FillTableRows(Source, Rule, Wrapper, TableName)
TableRules = Rule.Mapping.Unload(New Structure("SortingIndex", TableName));

//@skip-check variable-value-type
//@skip-check variable-value-type, property-return-type
For Each SourceRow In Source[TableName] Do // ValueTableRow
TableHasKey = CommonFunctionsClientServer.ObjectHasProperty(SourceRow, "Key");
TargetRow = BuilderAPI.AddRow(Wrapper, TableName, False, ?(TableHasKey, SourceRow.Key, Undefined));

TargetRow = BuilderAPI.AddRow(Wrapper, TableName, False, ?(TableHasKey, SourceRow.Key, Undefined), SourceRow.LineNumber); // ValueTableRow
FillTableRowAttributes(Source, SourceRow, Rule, Wrapper, TargetRow, TableName, TableRules);
EndDo;
EndProcedure
Expand Down