Пример #1
0
 def processForm(self, REQUEST, RESPONSE):
     fallid = self.form.get('fallid')
     jahr = today().year
     jghiddel = self.form.get('jghiddel')
     typ = self.form.get('typ')
     if jghiddel and typ == 'jgh' and fallid:
         # alte Statistik auf neue upgraden
         upgrade_jgh(jghiddel, old2new=True)
     if not fallid:
         raise EE('Bundesstatistik nur für einen gültigen Fall')
     fall = Fall(fallid)
     ex_jgh = fall['jgh']
     if ex_jgh:
         raise EE('Bundesstatistik bereits vorhanden.')
     jgh = Jugendhilfestatistik2007()
     jgh['jghid'] = Jugendhilfestatistik2007().getNewId()
     jgh['stz'] = self.stelle['id']
     jgh['file'] = 'jgh07einf'
     jgh['mit_id'] = fall['zustaendig__mit_id']
     #jgh.setDate('bg', fall.getDate('bg'))
     jgh.setDate('bg', fall['leistungsbeginn'])
     jgh['fall_fn'] = fall['fn']
     jgh['fall_id'] = fall['id']
     jgh['jahr'] = jahr
     dmy = [int(e) for e in fall['akte__gb'].split('.')]
     dmy.reverse()
     geburtsdatum = ebapi.Date(*dmy)
     jgh['gey'] = geburtsdatum.year
     jgh['gem'] = geburtsdatum.month
     jgh['gs'] = fall['akte__gs']
     assert isinstance(jgh['gs'], (int, long))
     if config.BERATUNGSKONTAKTE:
         from ebkus.html.beratungskontakt import get_jgh_kontakte
         jgh['nbkakt'], jgh['nbkges'] = get_jgh_kontakte(fall, jahr)
     return self._formular(jgh)