Exemplo n.º 1
0
    def gorev_listesi(self):

        if 'personel_id' not in self.current.task_data:
            personel_id = self.current.input["id"]
            self.current.task_data["personel_id"] = personel_id
        else:
            personel_id = self.current.task_data['personel_id']

        kurum_ici_gorevlendirme_bilgileri = KurumIciGorevlendirmeBilgileri.objects.filter(
            personel_id=personel_id)
        kurum_disi_gorevlendirme_bilgileri = KurumDisiGorevlendirmeBilgileri.objects.filter(
            personel_id=personel_id)

        gorevler = [k for k in kurum_ici_gorevlendirme_bilgileri]
        gorevler += [k for k in kurum_disi_gorevlendirme_bilgileri]

        self.form_out(YeniGorevlendirmeEkle(title=__(u"Görevlendirme Listesi")))

        self.output['objects'] = [[_(u'Görev Tipi'), _(u'Başlama Tarihi'), _(u'Bitiş Tarihi')], ]

        for gorev in gorevler:
            item = {
                "fields": ["%s" % gorev.get_gorev_tipi_display(),
                           "%s" % format_date(gorev.baslama_tarihi) if gorev.baslama_tarihi else '',
                           "%s" % format_date(gorev.bitis_tarihi) if gorev.bitis_tarihi else ''],
                "actions": [{'name': _(u'Sil'), 'cmd': 'sil',
                             'show_as': 'button', 'object_key': 'gorev_key'},
                            {'name': _(u'Düzenle'), 'cmd': 'duzenle',
                             'show_as': 'button', 'object_key': 'gorev_key'}],
                "key": gorev.key
            }
            self.output['objects'].append(item)

        self.output['meta']['allow_search'] = False
Exemplo n.º 2
0
    def kayit_bilgisi_ver(self):
        sinav_key = self.current.task_data["sinav_key"]
        sinav = Sinav.objects.get(sinav_key)
        sinav_tarihi = format_date(sinav.tarih)

        self.current.output['msgbox'] = {
            'type': 'info', "title": _(u'Notlar Kaydedildi'),
            "msg": _(u'%(ders)s dersine ait %(tarih)s tarihli sınav notları kaydedildi') % {
            'ders': sinav.ders.ad, 'tarih': sinav_tarihi}}
Exemplo n.º 3
0
    def donem_formu_olustur(self):
        """
        Güz ve Bahar Dönemi Formu oluşturulur.

        """

        _form = DonemForm(current=self.current, title=_(u'Güz ve Bahar Dönemi'))

        son_donem = Donem.son_donem()

        _form.help_text = _(u"""Kayıtlardaki en son donem {donem}
        Başlangıç Tarihi: {baslangic},
        Bitiş Tarihi: {bitis}
        """).format(donem=son_donem.ad,
                    baslangic=format_date(son_donem.baslangic_tarihi),
                    bitis=format_date(son_donem.bitis_tarihi))

        self.form_out(_form)
Exemplo n.º 4
0
    def kayit_bilgisi_ver(self):
        sinav_key = self.current.task_data["sinav_key"]
        sinav = Sinav.objects.get(sinav_key)
        sinav_tarihi = format_date(sinav.tarih)

        self.current.output['msgbox'] = {
            'type': 'info', "title": _(u'Notlar Kaydedildi'),
            "msg": _(u'%(ders)s dersine ait %(tarih)s tarihli sınav notları kaydedildi') % {
            'ders': sinav.ders.ad, 'tarih': sinav_tarihi}}
Exemplo n.º 5
0
    def donem_formu_olustur(self):
        """
        Güz ve Bahar Dönemi Formu oluşturulur.

        """

        _form = DonemForm(current=self.current,
                          title=_(u'Güz ve Bahar Dönemi'))

        son_donem = Donem.son_donem()

        _form.help_text = _(u"""Kayıtlardaki en son donem {donem}
        Başlangıç Tarihi: {baslangic},
        Bitiş Tarihi: {bitis}
        """).format(donem=son_donem.ad,
                    baslangic=format_date(son_donem.baslangic_tarihi),
                    bitis=format_date(son_donem.bitis_tarihi))

        self.form_out(_form)
Exemplo n.º 6
0
    def gorev_suresi_form(self):
        """ 
        Öncelikle anasayfadaki personel seçim formundan seçilen personelin
        id si elde edilir. Personel id ile atama kaydı elde edilir.
        Eğer personel akademik personel değilse hata mesajı görüntülenir.
        Her akademik personele ait sadece bir adet atama kaydı bulunabilir.
        Elde edilen atama nesnesinden çekilen görev süresi bitiş tarihi
        form nesnesi instance üretilirken parametre olarak verilir.
        Son olarak da form görüntülenir.
        """

        try:
            personel = Personel.objects.get(self.current.input["id"])

            if personel.personel_turu == 1:
                if type(personel.gorev_suresi_bitis) is datetime.date:
                    gorev_suresi_bitis = format_date(
                        personel.gorev_suresi_bitis)
                else:
                    gorev_suresi_bitis = None

                _form = GorevSuresiForm(
                    current=self.current,
                    title=_(u"Görev Süresi Uzat"),
                    gorev_suresi_bitis_tarihi=gorev_suresi_bitis,
                    personel_id=personel.key)
                self.form_out(_form)
            else:
                self.current.output['msgbox'] = {
                    'type': 'info',
                    "title": _(u'HATA !'),
                    "msg":
                    _(u'%(ad)s %(soyad)s akademik bir personel değildir.') % {
                        'ad': personel.ad,
                        'soyad': personel.soyad,
                    }
                }

        except ObjectDoesNotExist:
            self.current.output["msgbox"] = {
                'type': "info",
                "title": _(u"HATA !"),
                "msg":
                _(u"%(ad)s %(soyad)s e ait bir atama kaydı bulunamadı") % {
                    'ad': personel.ad,
                    'soyad': personel.soyad,
                }
            }
Exemplo n.º 7
0
def ogrenci_bilgileri(current):
    """Öğrenci Genel Bilgileri

    Öğrenci Genel Bilgileri, öğrencilerin kendi bilgilerini görüntüledikleri
    tek adımlık bir iş akışıdır.

    Bu metod tek adımlık bilgi ekranı hazırlar.

    Args:
        current: wf current nesnesi

    """

    current.output['client_cmd'] = [
        'show',
    ]
    ogrenci = Ogrenci.objects.get(user_id=current.user_id)

    # ordered tablo için OrderedDict kullanılmıştır.
    kimlik_bilgileri = OrderedDict({})
    kimlik_bilgileri.update(
        {_(u'Ad Soyad'): "%s %s" % (ogrenci.ad, ogrenci.soyad)})
    kimlik_bilgileri.update({_(u'Cinsiyet'): ogrenci.cinsiyet})
    kimlik_bilgileri.update({_(u'Kimlik No'): ogrenci.tckn})
    kimlik_bilgileri.update({_(u'Uyruk'): ogrenci.tckn})
    kimlik_bilgileri.update(
        {_(u'Doğum Tarihi'): format_date(ogrenci.dogum_tarihi)})
    kimlik_bilgileri.update({_(u'Doğum Yeri'): ogrenci.dogum_yeri})
    kimlik_bilgileri.update({_(u'Baba Adı'): ogrenci.baba_adi})
    kimlik_bilgileri.update({_(u'Anne Adı'): ogrenci.ana_adi})
    kimlik_bilgileri.update({_(u'Medeni Hali'): ogrenci.medeni_hali})

    iletisim_bilgileri = {
        _(u'Eposta'): ogrenci.e_posta,
        _(u'Telefon'): ogrenci.tel_no,
        _(u'Sitem Kullanıcı Adı'): current.user.username
    }

    current.output['object'] = [{
        "title": _(u"Kimlik Bilgileri"),
        "type": "table",
        "fields": kimlik_bilgileri
    }, {
        "title": _(u"İletişim Bilgileri"),
        "type": "table",
        "fields": iletisim_bilgileri
    }]
Exemplo n.º 8
0
def ogrenci_bilgileri(current):
    """Öğrenci Genel Bilgileri

    Öğrenci Genel Bilgileri, öğrencilerin kendi bilgilerini görüntüledikleri
    tek adımlık bir iş akışıdır.

    Bu metod tek adımlık bilgi ekranı hazırlar.

    Args:
        current: wf current nesnesi

    """

    current.output['client_cmd'] = ['show', ]
    ogrenci = Ogrenci.objects.get(user_id=current.user_id)

    # ordered tablo için OrderedDict kullanılmıştır.
    kimlik_bilgileri = OrderedDict({})
    kimlik_bilgileri.update({_(u'Ad Soyad'): "%s %s" % (ogrenci.ad, ogrenci.soyad)})
    kimlik_bilgileri.update({_(u'Cinsiyet'): ogrenci.cinsiyet})
    kimlik_bilgileri.update({_(u'Kimlik No'): ogrenci.tckn})
    kimlik_bilgileri.update({_(u'Uyruk'): ogrenci.tckn})
    kimlik_bilgileri.update({_(u'Doğum Tarihi'): format_date(ogrenci.dogum_tarihi)})
    kimlik_bilgileri.update({_(u'Doğum Yeri'): ogrenci.dogum_yeri})
    kimlik_bilgileri.update({_(u'Baba Adı'): ogrenci.baba_adi})
    kimlik_bilgileri.update({_(u'Anne Adı'): ogrenci.ana_adi})
    kimlik_bilgileri.update({_(u'Medeni Hali'): ogrenci.medeni_hali})

    iletisim_bilgileri = {
        _(u'Eposta'): ogrenci.e_posta,
        _(u'Telefon'): ogrenci.tel_no,
        _(u'Sitem Kullanıcı Adı'): current.user.username
    }

    current.output['object'] = [
        {
            "title": _(u"Kimlik Bilgileri"),
            "type": "table",
            "fields": kimlik_bilgileri
        },
        {
            "title": _(u"İletişim Bilgileri"),
            "type": "table",
            "fields": iletisim_bilgileri
        }
    ]
Exemplo n.º 9
0
    def gorev_suresi_form(self):
        """ 
        Öncelikle anasayfadaki personel seçim formundan seçilen personelin
        id si elde edilir. Personel id ile atama kaydı elde edilir.
        Eğer personel akademik personel değilse hata mesajı görüntülenir.
        Her akademik personele ait sadece bir adet atama kaydı bulunabilir.
        Elde edilen atama nesnesinden çekilen görev süresi bitiş tarihi
        form nesnesi instance üretilirken parametre olarak verilir.
        Son olarak da form görüntülenir.
        """

        try:
            personel = Personel.objects.get(self.current.input["id"])

            if personel.personel_turu == 1:
                if type(personel.gorev_suresi_bitis) is datetime.date:
                    gorev_suresi_bitis = format_date(personel.gorev_suresi_bitis)
                else:
                    gorev_suresi_bitis = None

                _form = GorevSuresiForm(current=self.current, title=_(u"Görev Süresi Uzat"),
                                        gorev_suresi_bitis_tarihi=gorev_suresi_bitis,
                                        personel_id=personel.key)
                self.form_out(_form)
            else:
                self.current.output['msgbox'] = {
                    'type': 'info', "title": _(u'HATA !'),
                    "msg": _(u'%(ad)s %(soyad)s akademik bir personel değildir.') % {
                        'ad': personel.ad,
                        'soyad': personel.soyad,
                    }
                }

        except ObjectDoesNotExist:
            self.current.output["msgbox"] = {
                'type': "info", "title": _(u"HATA !"),
                "msg": _(u"%(ad)s %(soyad)s e ait bir atama kaydı bulunamadı") % {
                    'ad': personel.ad,
                    'soyad': personel.soyad,
                }
            }
Exemplo n.º 10
0
def get_tasks(current):
    """
        List task invitations of current user


        .. code-block:: python

            #  request:
                {
                'view': '_zops_get_tasks',
                'state': string, # one of these:
                                 # "active", "future", "finished", "expired"
                'inverted': boolean, # search on other people's tasks
                'query': string, # optional. for searching on user's tasks
                'wf_type': string, # optional. only show tasks of selected wf_type
                'start_date': datetime, # optional. only show tasks starts after this date
                'finish_date': datetime, # optional. only show tasks should end before this date
                }

            #  response:
                {
                'task_list': [
                    {'token': key, # wf token (key of WFInstance)
                    {'key': key, # wf token (key of TaskInvitation)
                     'title': string,  # name of workflow
                     'wf_type': string,  # unread message count
                     'title': string,  # task title
                     'state': int,  # state of invitation
                                    # zengine.models.workflow_manager.TASK_STATES
                     'start_date': string,  # start date
                     'finish_date': string,  # end date

                     },],
                'active_task_count': int,
                'future_task_count': int,
                'finished_task_count': int,
                'expired_task_count': int,
                }
        """
    # TODO: Also return invitations for user's other roles
    # TODO: Handle automatic role switching

    STATE_DICT = {
        'active': [20, 30],
        'future': 10,
        'finished': 40,
        'expired': 90
    }
    state = STATE_DICT[current.input['state']]
    if isinstance(state, list):
        queryset = TaskInvitation.objects.filter(progress__in=state)
    else:
        queryset = TaskInvitation.objects.filter(progress=state)

    if 'inverted' in current.input:
        # show other user's tasks
        allowed_workflows = [
            bpmn_wf.name for bpmn_wf in BPMNWorkflow.objects.all()
            if current.has_permission(bpmn_wf.name)
        ]
        queryset = queryset.exclude(role_id=current.role_id).filter(
            wf_name__in=allowed_workflows)
    else:
        # show current user's tasks
        queryset = queryset.filter(role_id=current.role_id)

    if 'query' in current.input:
        queryset = queryset.filter(
            search_data__contains=current.input['query'].lower())
    if 'wf_type' in current.input:
        queryset = queryset.filter(wf_name=current.input['wf_type'])
    if 'start_date' in current.input:
        queryset = queryset.filter(start_date__gte=datetime.strptime(
            current.input['start_date'], "%d.%m.%Y"))
    if 'finish_date' in current.input:
        queryset = queryset.filter(finish_date__lte=datetime.strptime(
            current.input['finish_date'], "%d.%m.%Y"))
    current.output['task_list'] = [{
        'token': inv.instance.key,
        'key': inv.key,
        'title': inv.title,
        'wf_type': inv.wf_name,
        'state': inv.progress,
        'start_date': format_date(inv.start_date),
        'finish_date': format_date(inv.finish_date),
        'description': inv.instance.wf.description,
        'status': inv.ownership
    } for inv in queryset]
    task_inv_list = TaskInvitation.objects.filter(role_id=current.role_id)
    current.output['task_count'] = {
        'active':
        task_inv_list.filter(progress__in=STATE_DICT['active']).count(),
        'future': task_inv_list.filter(progress=STATE_DICT['future']).count(),
        'finished':
        task_inv_list.filter(progress=STATE_DICT['finished']).count(),
        'expired':
        task_inv_list.filter(progress=STATE_DICT['expired']).count()
    }
Exemplo n.º 11
0
 def __unicode__(self):
     return '%s %s %s %s' % (self.miktar, self.para_birimi, self.sebep,
                             format_date(self.son_odeme_tarihi))
Exemplo n.º 12
0
 def __unicode__(self):
     return '%s %s %s %s' % (self.miktar, self.para_birimi, self.sebep,
                             format_date(self.son_odeme_tarihi))