コード例 #1
0
ファイル: report.py プロジェクト: andile2012/logistics
 def _process_give(self):
     words = self.report_data.split(" ")
     # TODO: this is too much copy-paste from the transfer handler
     if len(words) < 3: 
         return self.help()
     hsa_id = words[0]
     remainder = " ".join(words[1:])
     hsa = util.get_hsa(hsa_id)
     if hsa is None:
         self.respond(config.Messages.UNKNOWN_HSA, hsa_id=hsa_id)
     else:
         stock_report = create_stock_report(Reports.GIVE,  
                                            self.hsa.supply_point,
                                            remainder, 
                                            self.msg.logger_msg)
         transfers = StockTransfer.create_from_transfer_report(stock_report, hsa.supply_point)
         send_transfer_responses(self.msg, stock_report, transfers, self.hsa, hsa)
コード例 #2
0
ファイル: transfer.py プロジェクト: andile2012/logistics
 def handle(self, text):
     words = text.split(" ")
     # need at least a keyword and 1 product + amount
     if len(words) < 3: 
         return self.help()
     hsa_id = words[0]
     remainder = " ".join(words[1:])
     hsa = util.get_hsa(hsa_id)
     if hsa is None:
         self.respond(config.Messages.UNKNOWN_HSA, hsa_id=hsa_id)
     else:
         stock_report = create_stock_report(Reports.GIVE,  
                                            self.msg.logistics_contact.supply_point,
                                            remainder, 
                                            self.msg.logger_msg)
         transfers = StockTransfer.create_from_transfer_report(stock_report, hsa.supply_point)
         send_transfer_responses(self.msg, stock_report, transfers, self.msg.logistics_contact, hsa)
コード例 #3
0
ファイル: transfer.py プロジェクト: dslowikowski/logistics
 def handle(self, text):
     words = text.split(" ")
     # need at least a keyword and 1 product + amount
     if len(words) < 3:
         return self.help()
     hsa_id = words[0]
     remainder = " ".join(words[1:])
     hsa = util.get_hsa(hsa_id)
     if hsa is None:
         self.respond(config.Messages.UNKNOWN_HSA, hsa_id=hsa_id)
     else:
         stock_report = create_stock_report(
             Reports.GIVE, self.msg.logistics_contact.supply_point,
             remainder, self.msg.logger_msg)
         transfers = StockTransfer.create_from_transfer_report(
             stock_report, hsa.supply_point)
         send_transfer_responses(self.msg, stock_report, transfers,
                                 self.msg.logistics_contact, hsa)
コード例 #4
0
ファイル: report.py プロジェクト: dslowikowski/logistics
 def _process_give(self):
     words = self.report_data.split(" ")
     # TODO: this is too much copy-paste from the transfer handler
     if len(words) < 3:
         return self.help()
     hsa_id = words[0]
     remainder = " ".join(words[1:])
     hsa = util.get_hsa(hsa_id)
     if hsa is None:
         self.respond(config.Messages.UNKNOWN_HSA, hsa_id=hsa_id)
     else:
         stock_report = create_stock_report(Reports.GIVE,
                                            self.hsa.supply_point,
                                            remainder, self.msg.logger_msg)
         transfers = StockTransfer.create_from_transfer_report(
             stock_report, hsa.supply_point)
         send_transfer_responses(self.msg, stock_report, transfers,
                                 self.hsa, hsa)