Пример #1
0
    def handle(self):
        text = self.msg.text.strip().lower()
        if self.user.location_id is None:
            self.respond(NO_SUPPLY_POINT_MESSAGE)
            return True
        sql_loc = SQLLocation.objects.get(location_id=self.user.location_id)
        if text[0] in ['y', 'yes']:
            submitted = True
            response = REQ_SUBMITTED
        else:
            submitted = False
            response = REQ_NOT_SUBMITTED
        if sql_loc.supply_point_id:
            r = RequisitionReport(location_id=sql_loc.supply_point_id, submitted=submitted)
            r.save()

        self.respond(response)
        return True
Пример #2
0
    def handle(self):
        text = self.msg.text.strip().lower()
        if self.user.location_id is None:
            self.respond(NO_SUPPLY_POINT_MESSAGE)
            return True
        sql_loc = SQLLocation.objects.get(location_id=self.user.location_id)
        if text[0] in ['y', 'yes']:
            submitted = True
            response = REQ_SUBMITTED
        else:
            submitted = False
            response = REQ_NOT_SUBMITTED
        if sql_loc.supply_point_id:
            r = RequisitionReport(location_id=sql_loc.supply_point_id, submitted=submitted)
            r.save()

        self.respond(response)
        return True
Пример #3
0
    def handle(self):
        text = self.msg.text.strip().lower()
        if not self.user.domain == 'ilsgateway':
            self.respond(REGISTER_MESSAGE)
            return
        if not self.user.location_id is None:
            self.respond(NO_SUPPLY_POINT_MESSAGE)
            return
        sql_loc = SQLLocation.objects.get(location_id=self.user.location_id)
        if text[0] == 'y':
            submitted = True
            response = REQ_SUBMITTED
        else:
            submitted = False
            response = REQ_NOT_SUBMITTED

        r = RequisitionReport(location_id=sql_loc.supply_point_id, submitted=submitted)
        r.save()

        self.respond(response)