Commit e11cfb9f by Mac Stephens

Fixed small issue created by merge. Working now.

parent a72bb77e
......@@ -1216,8 +1216,6 @@ begin
ordersDB.UniQuery1.Post;
ordersDB.UniQuery1.Close;
//Retrieve Order ID
if mode = 'ADD' then
begin
......@@ -1226,53 +1224,56 @@ begin
ORDER_ID := ordersDB.UniQuery1.FieldByName('OrderID').AsInteger;
end;
if mode = 'ADD' then
SQL := 'select * from corrugated_plate_orders where ORDER_ID = 0 and ORDER_ID <> 0'
else
begin
ORDER_ID := JSONData.GetValue<integer>('ORDER_ID');
SQL := 'select * from corrugated_plate_orders where ORDER_ID = ' + IntToStr(ORDER_ID);
end;
doQuery(ordersDB.UniQuery1, SQL);
try
// Second query
if mode = 'ADD' then
ordersDB.UniQuery1.Insert
SQL := 'select * from corrugated_plate_orders where ORDER_ID = 0 and ORDER_ID <> 0'
else
ordersDB.UniQuery1.Edit;
for Pair in JSONData do
begin
Field := ordersDB.UniQuery1.FindField(Pair.JsonString.Value); // Checks if the field exists in the dataset
if Assigned(Field) then
ORDER_ID := JSONData.GetValue<integer>('ORDER_ID');
SQL := 'select * from corrugated_plate_orders where ORDER_ID = ' + IntToStr(ORDER_ID);
end;
doQuery(ordersDB.UniQuery1, SQL);
try
if mode = 'ADD' then
ordersDB.UniQuery1.Insert
else
ordersDB.UniQuery1.Edit;
for Pair in JSONData do
begin
// handles any dates or datetimes
if (Field is TDateTimeField) and (Pair.JsonValue.Value <> '') then
TDateTimeField(Field).AsDateTime := StrToDate(Pair.JsonValue.Value)
else if Pair.JsonValue.Value <> '' then
Field.AsString := Pair.JsonValue.Value;
Field := ordersDB.UniQuery1.FindField(Pair.JsonString.Value);
if Assigned(Field) then
begin
if (Field is TDateTimeField) and (Pair.JsonValue.Value <> '') then
TDateTimeField(Field).AsDateTime := StrToDate(Pair.JsonValue.Value)
else if Pair.JsonValue.Value <> '' then
Field.AsString := Pair.JsonValue.Value;
end;
end;
end;
ordersDB.UniQuery1.FieldByName('ORDER_ID').AsInteger := ORDER_ID;
ordersDB.UniQuery1.FieldByName('ORDER_ID').AsInteger := ORDER_ID;
ordersDB.UniQuery1.Post;
// Post the record to the database
ordersDB.UniQuery1.Post;
if JSONData.GetValue<string>('staff_fields_proof_date') <> '' then
AddStatusSchedule('PROOF', JSONData, ORDER_ID);
if JSONData.GetValue<string>('staff_fields_ship_date') <> '' then
AddStatusSchedule('SHIP', JSONData, ORDER_ID);
if JSONData.GetValue<string>('staff_fields_art_due') <> '' then
AddStatusSchedule('ART', JSONData, ORDER_ID);
if JSONData.GetValue<string>('staff_fields_plate_due') <> '' then
AddStatusSchedule('PLATE', JSONData, ORDER_ID);
if JSONData.GetValue<string>('staff_fields_mount_due') <> '' then
AddStatusSchedule('MOUNT', JSONData, ORDER_ID);
// Updated so an object isn't being created in the exception for memory control
Result.AddPair('status', 'success');
if JSONData.GetValue<string>('staff_fields_proof_date') <> '' then
AddStatusSchedule('PROOF', JSONData, ORDER_ID);
if JSONData.GetValue<string>('staff_fields_ship_date') <> '' then
AddStatusSchedule('SHIP', JSONData, ORDER_ID);
if JSONData.GetValue<string>('staff_fields_art_due') <> '' then
AddStatusSchedule('ART', JSONData, ORDER_ID);
if JSONData.GetValue<string>('staff_fields_plate_due') <> '' then
AddStatusSchedule('PLATE', JSONData, ORDER_ID);
if JSONData.GetValue<string>('staff_fields_mount_due') <> '' then
AddStatusSchedule('MOUNT', JSONData, ORDER_ID);
finally
ordersDB.UniQuery1.Close;
end;
// Updated so an object isn't being created in the exception for memory control
Result.AddPair('status', 'success');
except
on E: Exception do
begin
......@@ -1282,6 +1283,7 @@ begin
end;
function TLookupService.AddStatusSchedule(StatusType: string; order: TJSONObject; ORDER_ID: integer): string;
// Adds/edits orders_status_schedule table.
// StatusType: name of the status getting added to the schedule.
......
[Settings]
MemoLogLevel=4
FileLogLevel=5
LogFileNum=146
LogFileNum=147
webClientVersion=1.0.0
[Database]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment