306 lines
9.5 KiB
Plaintext
306 lines
9.5 KiB
Plaintext
*!* 08.08.2011
|
|
*!* marius.mutu
|
|
*!* dezactiveaza_imagini - am marit distanta dintre imagini - ca sa nu se ingramadeasca textul cu shortcut-ul
|
|
|
|
*!* 09.12.2021
|
|
*!* marius..mutu
|
|
*!* dezactiveaza_meniuri - adaugare meniu Verificare, Import
|
|
**********************************************************************************************
|
|
Procedure verifica_drepturi
|
|
Lparameters tcObiectFundal, tcPageFrame
|
|
citeste_drepturi(gnIdUtil)
|
|
dezactiveaza_obiecte_pageframe(65, tcObiectFundal + [.] + tcPageFrame)
|
|
dezactiveaza_imagini(tcObiectFundal)
|
|
dezactiveaza_meniuri(90)
|
|
Endproc
|
|
**********************************************************************************************
|
|
Procedure citeste_drepturi
|
|
Lparameters tnIdUtil
|
|
|
|
If Used('crsdrepturi')
|
|
Select crsdrepturi
|
|
Locate For id_firma = gnIdFirma
|
|
If Found()
|
|
Return
|
|
Else
|
|
Use In crsdrepturi
|
|
Endif
|
|
Endif
|
|
lcSql = [select cheie,id_firma from contafin_oracle.vdef_util_obiecte ] + ;
|
|
[where id_util = ?gnIdUtil and id_program=?gnIdProgram and id_firma=?gnIdFirma]
|
|
lnSucces = goExecutor.oExecute(lcSql, 'crsdrepturi')
|
|
If lnSucces < 0
|
|
aMESSAGEBOX(goExecutor.cEroare, 0 + 16, 'Eroare')
|
|
Return
|
|
Endif
|
|
|
|
Endproc
|
|
**********************************************************************************************
|
|
Procedure dezactiveaza_imagini
|
|
Lparameters loObiect
|
|
Local i, k, j, l, lnMinLeft
|
|
Dimension laImaginiVizibile(20, 2)
|
|
k = 0
|
|
&& left=3 pentru prima imagine
|
|
With &loObiect
|
|
For i = 1 To .ControlCount
|
|
If Alltrim(Upper(.Objects(i).Class)) = 'IMAGINE'
|
|
lcCheie = .Objects(i).ccod
|
|
If Right(lcCheie, 1) # ';'
|
|
lcCheie = lcCheie + ';'
|
|
Endif
|
|
lnPozitieS = 1
|
|
For j = 1 To Occurs([;], lcCheie)
|
|
lnPozitieF = At([;], lcCheie, j)
|
|
lcCheie2 = Substr(lcCheie, lnPozitieS, lnPozitieF - lnPozitieS)
|
|
lcAcces = []
|
|
Select crsdrepturi
|
|
Locate For Substr(cheie, 1, Len(lcCheie2)) = lcCheie2
|
|
If Found()
|
|
Set Filter To Substr(cheie, 1, Len(lcCheie2)) = lcCheie2
|
|
Scan
|
|
lcAcces = lcAcces + Substr(cheie, Len(lcCheie2) + 1, 1) + [;]
|
|
Endscan
|
|
Set Filter To
|
|
k = k + 1
|
|
If !Empty(lcAcces) And Alltrim(lcAcces) <> [;]
|
|
.Objects(i).coptiuni_active = lcAcces
|
|
Endif
|
|
.Objects(i).Visible = .T.
|
|
laImaginiVizibile(k, 1) = i
|
|
laImaginiVizibile(k, 2) = .Objects(i).Left
|
|
Exit
|
|
Else
|
|
.Objects(i).Visible = .F.
|
|
Endif
|
|
lnPozitieS = lnPozitieF + 1
|
|
Endfor
|
|
Endif
|
|
Endfor
|
|
If k > 0
|
|
lnLungime = .Objects(laImaginiVizibile(1, 1)).Width
|
|
For j = 1 To k - 1
|
|
For l = j + 1 To k
|
|
If laImaginiVizibile(j, 2) > laImaginiVizibile(l, 2)
|
|
lnPozitie = laImaginiVizibile(l, 1)
|
|
lnLeft = laImaginiVizibile(l, 2)
|
|
laImaginiVizibile(l, 1) = laImaginiVizibile(j, 1)
|
|
laImaginiVizibile(l, 2) = laImaginiVizibile(j, 2)
|
|
laImaginiVizibile(j, 1) = lnPozitie
|
|
laImaginiVizibile(j, 2) = lnLeft
|
|
Endif
|
|
Endfor
|
|
Endfor
|
|
For j = 1 To k
|
|
*!* 08.08.2011
|
|
.Objects(laImaginiVizibile(j, 1)).Left = 5 + (j - 1) * (lnLungime + 0)
|
|
*!* 08.08.2011 ^
|
|
Endfor
|
|
Endif
|
|
Endwith
|
|
Endproc
|
|
**********************************************************************************************
|
|
Procedure dezactiveaza_obiecte_pageframe
|
|
Lparameters lnKey, lcPageFrame, lcTata
|
|
Local lcKey, lcProp, lcOptiune, lnPozitie, i, j, k, l, lnObiecteActive
|
|
Store [] To lcKey, lcProp, lcOptiune
|
|
Store 0 To lnNivel, lnPozitie, i, j, k, l
|
|
If Empty(lcTata)
|
|
lcTata = Null
|
|
Endif
|
|
Set Exact On
|
|
With &lcPageFrame
|
|
For i = 1 To .PageCount
|
|
For j = 1 To .PageCount
|
|
If .Pages(j).PageOrder = i
|
|
Exit
|
|
Endif
|
|
Endfor
|
|
With .Pages(j)
|
|
.Enabled = .T.
|
|
lnObiecteActive = 0
|
|
lcKey = Nvl(lcTata, []) + Chr(lnKey)
|
|
If Used('crstotal')
|
|
Use In crstotal
|
|
Endif
|
|
Select Count(*) As Total From crsdrepturi Where Substr(cheie, 1, Len(lcKey)) = lcKey Into Cursor crstotal
|
|
Select crstotal
|
|
lnObiecteActive = Total
|
|
Use In crstotal
|
|
*!* If lnObiecteActive>0
|
|
For l = 1 To .ControlCount
|
|
Do Case
|
|
Case Alltrim(Upper(.Objects(l).Class)) = 'PAGEFRAME'
|
|
lcNume = lcPageFrame + '.' + Alltrim(.Name) + '.' + Alltrim(Upper(.Objects(l).Name))
|
|
dezactiveaza_obiecte_pageframe(65, lcNume, lcKey)
|
|
Case Left(Alltrim(Upper(.Objects(l).Class)), 2) = 'CW'
|
|
lcOptiune = .Objects(l).label_item1.Caption
|
|
lcCheie = lcKey + Padl(Alltrim(Str(.Objects(l).nid_cw)), 2, [0])
|
|
lcAcces = []
|
|
.Objects(l).ccheie = lcCheie
|
|
Select crsdrepturi
|
|
Locate For Substr(cheie, 1, Len(lcCheie)) = lcCheie
|
|
If Found()
|
|
Set Filter To Substr(cheie, 1, Len(lcCheie)) = lcCheie
|
|
Scan
|
|
lcAcces = lcAcces + Substr(cheie, Len(lcCheie) + 1, 1) + [;]
|
|
Endscan
|
|
Set Filter To
|
|
.Objects(l).coptiuni_active = lcAcces
|
|
.Objects(l).activeaza()
|
|
Else
|
|
.Objects(l).dezactiveaza()
|
|
Endif
|
|
Endcase
|
|
Endfor
|
|
*!* Else
|
|
If lnObiecteActive = 0
|
|
.Enabled = .F.
|
|
Endif
|
|
Endwith
|
|
lnKey = lnKey + 1
|
|
Endfor
|
|
Endwith
|
|
*!* Set Exact Off
|
|
Endproc
|
|
**********************************************************************************************
|
|
Procedure dezactiveaza_meniuri()
|
|
Lparameters lnKey
|
|
Local lcKey, lcKey2, i, j, k
|
|
Do Case
|
|
Case gnIdProgram = 2 && ROACONT
|
|
Dimension laPad[5]
|
|
laPad[1] = [initializa]
|
|
laPad[2] = [_1bs12qror]
|
|
laPad[3] = [verificari]
|
|
laPad[4] = [_5100zlkwx]
|
|
laPad[5] = [eFactura]
|
|
Case gnIdProgram = 5 && ROAGEST
|
|
Dimension laPad[1]
|
|
laPad[1] = [actualizar]
|
|
Case gnIdProgram = 8 && ROAAUTO
|
|
Return
|
|
Case gnIdProgram = 7 && ROAMANAGER
|
|
Dimension laPad[3]
|
|
laPad[1] = [optiuni]
|
|
laPad[2] = [vizualizar]
|
|
laPad[3] = [rapoartege]
|
|
Case gnIdProgram = 75 && ROASALSPEC modificare 16.10.2012
|
|
Dimension laPad[2]
|
|
laPad[1] = [_3mm0vdyef]
|
|
laPad[2] = [_3mm0ve0rs]
|
|
Case gnIdProgram = 4 && ROARES
|
|
Dimension laPad[3]
|
|
laPad[1] = [initializa]
|
|
laPad[2] = [configurar]
|
|
laPad[3] = [migrare]
|
|
Otherwise && Restul
|
|
Return
|
|
Endcase
|
|
|
|
lcKey = Chr(lnKey)
|
|
lnKey2 = 65
|
|
For j = 1 To Alen(laPad)
|
|
k = 0
|
|
Try
|
|
If Cntbar(laPad[j]) > 0
|
|
lcKey2 = lcKey + Chr(lnKey2)
|
|
lnKey2 = lnKey2 + 1
|
|
For i = 1 To Cntbar(laPad[j])
|
|
lcOptiune = Prmbar(laPad[j], i)
|
|
If !Empty(lcOptiune)
|
|
k = k + 1
|
|
lcCheie = lcKey2 + Padl(Alltrim(Str(k)), 2, [0])
|
|
Select crsdrepturi
|
|
Locate For Substr(cheie, 1, Len(lcCheie)) = lcCheie
|
|
If Found()
|
|
*!* WAIT WINDOW laPad[j]+" "+lcCheie+" gasita"
|
|
Set Skip Of Bar i Of &laPad[j] .F.
|
|
Else
|
|
*!* WAIT WINDOW laPad[j]+" "+lcCheie+" negasita"
|
|
*!* messagebox(skpbar (laPad[j],i),48,laPad[j]+" "+alltrim(str(i)))
|
|
Set Skip Of Bar i Of &laPad[j] .T.
|
|
*!* messagebox(skpbar (laPad[j],i),48,laPad[j]+" "+alltrim(str(i)))
|
|
Endif
|
|
Endif
|
|
Endfor
|
|
Endif
|
|
Catch
|
|
Endtry
|
|
Endfor
|
|
Endproc
|
|
|
|
**********************************************************************************************
|
|
*** Citeste accesul pentru o optiune dupa cod
|
|
*** Ex. pentru initializarea accesului la lansarea unui formular direct din meniu
|
|
Function GetAccesByCod
|
|
Lparameters tcCod, tcAccesDefault
|
|
* tcCod = codul optiunii din meniu (ex: ZA01/ZA02/ZB01)
|
|
* tcAccesDefault = codul de acces in caz ca nu sunt definite drepturi pe acel cod ("1;2;3;4")
|
|
|
|
Local lcAcces, lcAccesDefault, lcCheie, lcCheie2, lcSelect, lnPozitieF, lnPozitieS, j, k
|
|
lcAccesDefault = Iif(!Empty(m.tcAccesDefault), m.tcAccesDefault, "")
|
|
lcAcces = ""
|
|
|
|
lcSelect = Select()
|
|
|
|
lcCheie = Upper(Alltrim(m.tcCod))
|
|
k = 0
|
|
If Right(lcCheie, 1) # ';'
|
|
lcCheie = lcCheie + ';'
|
|
Endif
|
|
lnPozitieS = 1
|
|
For j = 1 To Occurs([;], lcCheie)
|
|
lnPozitieF = At([;], lcCheie, j)
|
|
lcCheie2 = Substr(lcCheie, lnPozitieS, lnPozitieF - lnPozitieS)
|
|
lcAcces = []
|
|
Select crsdrepturi
|
|
Locate For Substr(cheie, 1, Len(lcCheie2)) = lcCheie2
|
|
If Found()
|
|
Set Filter To Substr(cheie, 1, Len(lcCheie2)) = lcCheie2
|
|
Scan
|
|
lcAcces = lcAcces + Substr(cheie, Len(lcCheie2) + 1, 1) + [;]
|
|
Endscan
|
|
Set Filter To
|
|
k = k + 1
|
|
Exit
|
|
Endif && found
|
|
lnPozitieS = lnPozitieF + 1
|
|
ENDFOR
|
|
IF EMPTY(m.lcAcces) AND !EMPTY(m.lcAccesDefault)
|
|
lcAcces = m.lcAccesDefault
|
|
ENDIF
|
|
|
|
Select (m.lcSelect)
|
|
RETURN m.lcAcces
|
|
ENDFUNC && GetAccesByCod
|
|
|
|
**********************************************************************************************
|
|
Procedure actualizeaza_acces_forma
|
|
Lparameters loObiect, tcAcces
|
|
Local lcProp
|
|
For i = 1 To Len(tcAcces)
|
|
lcProp = 'this.lactiv' + Alltrim(Substr(tcAcces, i, 1))
|
|
&lcProp = .T.
|
|
Endfor
|
|
Endproc
|
|
**********************************************************************************************
|
|
*!* Procedure setari_grupuri
|
|
*!* Private pogrupuri,pcschema1,pcselect1
|
|
*!* Store '' To pogrupuri
|
|
*!* *!* pcschema1=['id_util n(5),utilizator c(30)']
|
|
*!* *!* pcselect1=['select id_util,utilizator from vutil_drept where 1=2']
|
|
*!* *!* pcorder1=[utilizator]
|
|
*!* *!* pcfiltru1=[id_firma=?gnIdFirma and id_prog=?gnIdProgram]
|
|
|
|
*!* pcschema1=['id_grup n(5),grup c(30)']
|
|
*!* pcselect1=['select id_grup,grup from vdef_grup where 1=2']
|
|
*!* pcorder1=[grup]
|
|
*!* pcfiltru1=[2=2]
|
|
*!* llAfiseaza=.F.
|
|
*!* gencursor('pogrupuri','crsgrupuri',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza)
|
|
*!* pogrupuri.ca_baza1.afisare()
|
|
*!* ofrmgrupuri=Createobject('frm_grupuri')
|
|
*!* ofrmgrupuri.Show(1)
|
|
*!* Release pogrupuri
|
|
*!* Endproc |