예제 #1
0
파일: biz.py 프로젝트: shon/cowspa
 def new(self, name, email, address=None, city=None, country=None, pincode=None, mobile=None, fax=None, skype=None, sip=None, director_id=None, short_description=None, long_description=None, tags=[], website=None, twitter=None, facebook=None, blog=None, linkedin=None, enabled=True):
     biz_id = self.store.add(name=name, created=datetime.datetime.now(), enabled=enabled)
     biz_ref = self.store.ref(biz_id)
     homephone = None
     contact_id = stores.contactstore.add(biz_ref, email, address, city, country, pincode, homephone, mobile, fax, skype, sip)
     self.store.update(biz_id, contact=contact_id)
     stores.bizprofile_store.add(short_description, long_description, tags, website, twitter, facebook, linkedin, blog)
     if not director_id:
         director_id = env.context.user_id
     signals.send_signal('assign_roles', director_id, biz_id, ['host'])
     return biz_id
예제 #2
0
파일: resource.py 프로젝트: Cowoop/cowspa3
    def new(self, name, short_description, type, owner, default_price=None, enabled=True, calendar=False, host_only=False, long_description=None, calc_mode=CalcMode.monthly, archived=False, picture=None, accnt_code=None):
        #TODO make default_price parameter mandatory post migration
        created = datetime.datetime.now()
        data = dict(name=name, owner=owner, created=created, short_description=short_description, enabled=enabled, calendar=calendar, host_only=host_only, long_description=long_description, type=type, calc_mode=calc_mode, archived=archived, picture=picture, accnt_code=accnt_code)
        res_id = resource_store.add(**data)

        data = dict(id=res_id, name=name, bizplace_name=dbaccess.oid2name(owner), bizplace_id=owner, user_id=env.context.user_id, created=created, type=type)
        if type == 'tariff':
            activity_id = activitylib.add('tariff_management', 'tariff_created', data, created)
        else:
            activity_id = activitylib.add('resource_management', 'resource_created', data, created)

        if default_price is not None:
            default_tariff_id = bizplace_store.get(owner, fields=['default_tariff'], hashrows=False)
            # default_tariff_id would be None when we are creating default_tariff for a new location. This is because we are adding location and there is no default_tariff yet. Now this tariff is a resource so further we need to create pricing for it. In pricing we need to specify some tariff so tariff refers itself as default_tariff.
            if default_tariff_id is None:
                default_tariff_id = res_id

            signals.send_signal('resource_created', res_id, default_tariff_id, None, default_price)
            # TODO this is not right way to send signals

        return res_id
예제 #3
0
파일: requests.py 프로젝트: shon/cowspa
 def approve(self, req):
     signals.send_signal('newbiz_approved', director_id=req.requestor_id, **req.req_data)
     self.set_approved(req)
예제 #4
0
파일: requests.py 프로젝트: shon/cowspa
 def approve(self, req):
     signals.send_signal('plan_approved', req.requestor_id, req.req_data['plan_id'])
     self.set_approved(req)