diff --git a/bot_modules/all_orders.py b/bot_modules/all_orders.py index 7fbf33c..b56bd0b 100644 --- a/bot_modules/all_orders.py +++ b/bot_modules/all_orders.py @@ -153,13 +153,13 @@ class ModuleAllOrders(orders.ModuleOrders): n, k, a = super().GetButtonNameAndKeyValueAndAccess(a_Item) return str(a_Item[key_field_id]) + ":" + n + "," + str(a_Item[user_field_id]), k, a - def GetPayInlineKeyboardFunc(self, a_ItemID): + def GetPayInlineKeyboardFunc(self, a_ItemID, a_Destiny): def PayInlineKeyboard(a_Message, a_UserGroups): print('PayInlineKeyboard', a_Message, a_UserGroups, a_ItemID) cur_buttons = [] orders_mod = self.GetModule(orders.module_name) - dst = bd_table.TableFieldDestiny.PHOTO_PAY + dst = a_Destiny if orders_mod: prefix = orders_mod.m_EditPrefix.get(dst, None) if prefix: @@ -205,8 +205,10 @@ class ModuleAllOrders(orders.ModuleOrders): inline_keyboard = None print('new_status', str(orders.OrderStatus.PAY), new_status) if new_status == str(orders.OrderStatus.PAY): - inline_keyboard = self.GetPayInlineKeyboardFunc(a_ItemID) - + inline_keyboard = self.GetPayInlineKeyboardFunc(a_ItemID, bd_table.TableFieldDestiny.PHOTO_PAY) + elif new_status == str(orders.OrderStatus.ADDRESS): + inline_keyboard = self.GetPayInlineKeyboardFunc(a_ItemID, bd_table.TableFieldDestiny.ADDRESS) + await self.SendMessageToUser(msg, owner_id, a_GetInlineButtonsFunc = inline_keyboard) def GetStartButtons(self, a_Message, a_UserGroups): diff --git a/bot_modules/orders.py b/bot_modules/orders.py index 41fd866..745ab5c 100644 --- a/bot_modules/orders.py +++ b/bot_modules/orders.py @@ -134,7 +134,7 @@ messages = { ''', mod_table_operate.EditMessage(bd_table.TableFieldDestiny.DESC): f''' Текущее описание заказа: -#{desc_field} +#{desc_field} Введите новое описание заказа: ''', diff --git a/bot_sys/bd_table.py b/bot_sys/bd_table.py index 25c2981..ef523b7 100644 --- a/bot_sys/bd_table.py +++ b/bot_sys/bd_table.py @@ -109,7 +109,9 @@ class Table: result = a_String for i in range(len(self.m_Fields)): f = self.m_Fields[i] - result = result.replace(f'#{f.m_Name}', str(a_BDItem[i])) + name = f'#{f.m_Name}' + result = result.replace('' + name + '', '' + str(a_BDItem[i]).replace('\n', '\n') + '') + result = result.replace(name, str(a_BDItem[i])) return result def ReplaceAllFieldTagsByDict(self, a_String, a_BDItemDict): @@ -168,5 +170,7 @@ def Test(): print(table.GetInitTableRequest()) assert table.GetInitTableRequest() == 'CREATE TABLE IF NOT EXISTS tname(f1 INTEGER PRIMARY KEY, f2 TEXT, f3 TEXT, f4 TEXT, UNIQUE(f1), UNIQUE(f2, f3));' - item = [10, 'i2', 'i3', 'i4'] - assert table.ReplaceAllFieldTags('#f1 #f2 #f3 #f4', item) == '10 i2 i3 i4' + item = [10, 'i2\ni2.1', 'i3', 'i4'] + assert table.ReplaceAllFieldTags('#f1 #f2 #f3 #f4', item) == '10 i2\ni2.1 i3 i4' + + assert table.ReplaceAllFieldTags('#f1 #f2 #f3 #f4', item) == '10 i2\ni2.1 i3 i4', table.ReplaceAllFieldTags('f1 #f2 #f3 #f4', item)