099 s3_user_filter
This commit is contained in:
+1
-1
@@ -89,7 +89,7 @@
|
||||
|
||||
<!--- global settings --->
|
||||
<!--- *************************************************************************************************** --->
|
||||
<cfset request.APP_VERSION="0.00.098"/> <!--- *********************************************************** --->
|
||||
<cfset request.APP_VERSION="0.00.099"/> <!--- *********************************************************** --->
|
||||
<!--- *************************************************************************************************** --->
|
||||
<cfset request.STAND=getStand()/>
|
||||
<cfset request.RECORDS_PER_PAGE=500/>
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
<!--- version 2.01---><!---15:25 31.01.2019--->
|
||||
<!--- version 2.02---><!---2025-08-04 15:19:34 postgre specific ilike instead of like--->
|
||||
<!--- version 2.03---><!---2026-04-27 ftype=integer support--->
|
||||
<!--- version 2.04---><!---2026-10-28 ATTRIBUTES.target--->
|
||||
<!--- build query filter string --->
|
||||
<!--- пустые и некорректные значения параметров вызвыают пропуск параметра --->
|
||||
<cfparam name="ATTRIBUTES.filter" type="struct"/>
|
||||
<cfparam name="ATTRIBUTES.target" type="string" default="postgresql"/> <!--- патч на случай, если целевая база не поддерживает оператор ILIKE --->
|
||||
|
||||
<cfset likeOp = (ATTRIBUTES.target EQ "postgresql") ? "ILIKE" : "LIKE"/>
|
||||
|
||||
<cfloop collection=#ATTRIBUTES.filter# item="item">
|
||||
<cfsilent>
|
||||
@@ -22,7 +26,7 @@
|
||||
---><cfif i LT #len#><cfqueryparam cfsqltype="#getCfSqLType(fltr.ftype)#" list="#fltr.list#" value="#fltr.prefix##fltr.val##fltr.suffix#"/></cfif><!---
|
||||
---></cfloop><!---
|
||||
---><cfelse><!---
|
||||
---><cfoutput>#fltr.field#</cfoutput><cfswitch expression=#fltr.compare#><cfcase value="EQ"> = </cfcase><cfcase value="NE,NEQ"> <> </cfcase><cfcase value="LE"> <= </cfcase><cfcase value="LT"> < </cfcase><cfcase value="GE"> >= </cfcase><cfcase value="GT"> > </cfcase><cfcase value="LIKE"> ILIKE </cfcase><cfcase value="NOTLIKE"> NOT ILIKE </cfcase><cfcase value="LIKE%"> ILIKE <cfqueryparam cfsqltype=#getCfSqLType(fltr.ftype)# value="%#fltr.val#%"/><cfcontinue/></cfcase><cfcase value="NOTLIKE%"> NOT ILIKE <cfqueryparam cfsqltype=#getCfSqLType(fltr.ftype)# value="%#fltr.val#%"/><cfcontinue/></cfcase><cfcase value="IN"> IN (<cfqueryparam cfsqltype=#getCfSqLType(fltr.ftype)# list="#fltr.list#" value="#fltr.val#"/>)<cfcontinue/></cfcase><cfdefaultcase> = <cfoutput> #fltr.field#</cfoutput><cfcontinue/><!---***криво---></cfdefaultcase></cfswitch><cfqueryparam cfsqltype=#getCfSqLType(fltr.ftype)# value="#fltr.val#"/><cfcontinue/>
|
||||
---><cfoutput>#fltr.field#</cfoutput><cfswitch expression=#fltr.compare#><cfcase value="EQ"> = </cfcase><cfcase value="NE,NEQ"> <> </cfcase><cfcase value="LE"> <= </cfcase><cfcase value="LT"> < </cfcase><cfcase value="GE"> >= </cfcase><cfcase value="GT"> > </cfcase><cfcase value="LIKE"> <cfoutput>#likeOp#</cfoutput> </cfcase><cfcase value="NOTLIKE"> <cfoutput>NOT #likeOp#</cfoutput> </cfcase><cfcase value="LIKE%"> <cfoutput>#likeOp#</cfoutput> <cfqueryparam cfsqltype=#getCfSqLType(fltr.ftype)# value="%#fltr.val#%"/><cfcontinue/></cfcase><cfcase value="NOTLIKE%"> <cfoutput>NOT #likeOp#</cfoutput> <cfqueryparam cfsqltype=#getCfSqLType(fltr.ftype)# value="%#fltr.val#%"/><cfcontinue/></cfcase><cfcase value="IN"> IN (<cfqueryparam cfsqltype=#getCfSqLType(fltr.ftype)# list="#fltr.list#" value="#fltr.val#"/>)<cfcontinue/></cfcase><cfdefaultcase> = <cfoutput> #fltr.field#</cfoutput><cfcontinue/><!---***криво---></cfdefaultcase></cfswitch><cfqueryparam cfsqltype=#getCfSqLType(fltr.ftype)# value="#fltr.val#"/><cfcontinue/>
|
||||
</cfif>
|
||||
</cfloop>
|
||||
|
||||
|
||||
@@ -10,12 +10,8 @@
|
||||
<cfreturn (a GT 0)? a : ""/>
|
||||
</cffunction>
|
||||
|
||||
<m:prepare_ls entity="s3_user" accessObject="" pageInfoOut="pageInfo" trackOut="tr"/>
|
||||
<m:prepare_ls entity="s3_user" settingsKey="s3_user" accessObject="" pageInfoOut="pageInfo" trackOut="tr"/><!--- NB settingsKey --->
|
||||
|
||||
<!--- <m:filter_settings target="#pageInfo.entity#_ls">
|
||||
<m:filterparam filter=#filter# param="quickfilter" ftype="string" prefix="%" suffix="%" expression="((p.project like ?) OR (p.customer like ?) OR (p.customer_alias like ?) OR (p.contragent_class_type like ?) OR (p.division like ?) OR (p.performer_short like ?))" default=""/>
|
||||
</m:filter_settings> --->
|
||||
<!--- <cfset pageInfo.settings.filter=#filter#/> --->
|
||||
|
||||
<!--- <cftry> --->
|
||||
<cfquery name="qS3" datasource="billing-s3">
|
||||
@@ -56,7 +52,7 @@
|
||||
WHERE rn = 1 AND e.service_id=12
|
||||
AND NOT cast(s.instance_data->>'isDeleted' as boolean) /*не вдаваясь в другие статусы*/
|
||||
</cfquery>
|
||||
<!--- <cfdump var=#qRead#/> --->
|
||||
|
||||
|
||||
<!--- <cfcatch type="database">
|
||||
<m:ls_catch catch=#cfcatch# status=#pageInfo.status#/>
|
||||
@@ -101,10 +97,12 @@ select
|
||||
from qS3 s
|
||||
left outer join qContragent c on (s.wz=c.wz)
|
||||
full outer join qS3User u on (s.owner=u.user_id)
|
||||
where 1=1 <m:filter_build filter=#pageInfo.settings.filter#/>
|
||||
where 1=1 <m:filter_build filter=#pageInfo.settings.filter# target="hsql"/>
|
||||
order by <m:order_build sortArray=#pageInfo.settings.sort.sortArray# fieldCount=#fieldCount#/>
|
||||
</cfquery>
|
||||
|
||||
<!--- <cfdump var=#qRead#/> --->
|
||||
|
||||
<cfquery name="qCountTotal" datasource="inmem">
|
||||
select count(*) as cnt
|
||||
from qS3 s
|
||||
@@ -180,7 +178,8 @@ full outer join qS3User u on (s.owner=u.user_id)
|
||||
<td><a href="mailto:#responsible_email#">#responsible_email#</a></td>
|
||||
|
||||
<td class="r">#id#</td>
|
||||
<td<cfif !(isNumeric(owner) AND owner LT 10000)> class="err"</cfif>>#owner#</td>
|
||||
<!--- <td<cfif !(isNumeric(owner) AND owner LT 10000)> class="err"</cfif>>#owner#</td> --->
|
||||
<td>#owner#</td>
|
||||
|
||||
<td class="r">#bucket_cnt#</td>
|
||||
<td class="r">#size_byte#</td>
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
<cfsilent>
|
||||
<cfimport prefix="m" taglib="lib"/>
|
||||
<cfimport prefix="c" taglib="lib/controls"/>
|
||||
<cfimport prefix="d" taglib="lib/data"/>
|
||||
<cfimport prefix="layout" taglib="layout"/>
|
||||
</cfsilent><m:silent silent="No">
|
||||
|
||||
<m:prepare_filter entity="s3_user" accessObject="" lsPage="s3_ls" pageInfoOut="pageInfo" trackOut="tr"/>
|
||||
|
||||
<m:filter_settings target="s3_user">
|
||||
<m:filterparam filter=#filter# param="owner" ftype="string" compare="LIKE%" field="s.owner" default=""/>
|
||||
<m:filterparam filter=#filter# param="display_name" ftype="string" compare="LIKE%" field="u.display_name" default=""/>
|
||||
<m:filterparam filter=#filter# param="contragent" ftype="string" compare="LIKE%" field="c.contragent" default=""/>
|
||||
<!--- <m:filterparam filter=#filter# param="contragent_id" ftype="guid" compare="EQ" field="k.__id" default=""/> --->
|
||||
<m:filterparam filter=#filter# param="wz" ftype="string" compare="LIKE%" field="c.wz" default=""/>
|
||||
<m:filterparam filter=#filter# param="wzs" ftype="string" compare="LIKE%" field="u.wz" default=""/>
|
||||
<m:filterparam filter=#filter# param="external_code" ftype="string" compare="LIKE%" field="u.external_code" default=""/>
|
||||
</m:filter_settings>
|
||||
|
||||
<cfif isDefined("resetAndClose") or isDefined("saveAndClose")>
|
||||
<cflocation url="#tr.backUrl#" addtoken="No"/>
|
||||
</cfif>
|
||||
|
||||
<!--- ЗАСАДА для inmem HSQLDB: не поддерживает ilike --->
|
||||
|
||||
</m:silent><!--- ----------------------------------------------------------------------------
|
||||
---------------------------------------------------------------------------------------------
|
||||
---------------------------------------------------------------------------------------------
|
||||
---><layout:page section="header" pageInfo=#pageInfo#>
|
||||
<layout:attribute name="title"><cfoutput>Учетные записи S3 - фильтр</cfoutput></layout:attribute>
|
||||
</layout:page>
|
||||
|
||||
<!--- <script type="text/javascript"/>
|
||||
$(document).ready(function() {
|
||||
try {
|
||||
$("#contragent_id").searchable({maxMultiMatch: 50});
|
||||
} catch (e) {alert(e)}
|
||||
});
|
||||
</script> --->
|
||||
|
||||
<cfoutput>
|
||||
<input type="hidden" name="track" value="#tr.self#"/>
|
||||
|
||||
<div class="detail">
|
||||
|
||||
<div class="tr">
|
||||
<div class="th"></div>
|
||||
<div class="td">
|
||||
<button type="button" name="reset" onClick="document.location.href='#request.thisPage#?reset=yes&track=#tr.self#'">#i18("Очистить","Clear")#</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- <div class="tr">
|
||||
<div class="th">Номер сделки</div>
|
||||
<div class="td">
|
||||
<input type="text" name="__index" value="#__index#" size="5"/>
|
||||
<i></i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">Название сделки</div>
|
||||
<div class="td">
|
||||
<input type="text" name="__name" value="#__name#" size="50"/>
|
||||
<i>#i18("по вхождению подстроки","by substring")#</i>
|
||||
</div>
|
||||
</div> --->
|
||||
|
||||
<!--- <div class="tr">
|
||||
<div class="th">Контрагент (CMDB)</div>
|
||||
<div class="td" style="vertical-align:top;">
|
||||
<cfquery name="qList">
|
||||
select __id::text as __id, __name, id_klienta
|
||||
from elma.companies
|
||||
order by __name
|
||||
</cfquery>
|
||||
<!--- <cfdump var=#qList#/> --->
|
||||
|
||||
<c:combo
|
||||
query=#qList#
|
||||
combo="contragent_id"
|
||||
id="contragent_id"
|
||||
key="__id"
|
||||
displayf="##__name## ##id_klienta##"
|
||||
selected=#contragent_id#
|
||||
empty=""
|
||||
/>
|
||||
</div>
|
||||
--->
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">Контрагент (CMDB)</div>
|
||||
<div class="td">
|
||||
<input type="text" name="contragent" value="#contragent#" size="50"/>
|
||||
<i>по вхождению подстроки</i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">WZ (по точному совпадению с именем учетки)</div>
|
||||
<div class="td">
|
||||
<input type="text" name="wz" value="#wz#" size="50"/>
|
||||
<i>по вхождению подстроки</i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">WZ (state)</div>
|
||||
<div class="td">
|
||||
<input type="text" name="wzs" value="#wzs#" size="50"/>
|
||||
<i>по вхождению подстроки</i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">WZ (instance)</div>
|
||||
<div class="td">
|
||||
<input type="text" name="external_code" value="#external_code#" size="50"/>
|
||||
<i>по вхождению подстроки</i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">Owner (имя учетки S3)</div>
|
||||
<div class="td">
|
||||
<input type="text" name="owner" value="#owner#" size="50"/>
|
||||
<i>по вхождению подстроки</i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">Display Name экземпляра в CMDB</div>
|
||||
<div class="td">
|
||||
<input type="text" name="display_name" value="#display_name#" size="50"/>
|
||||
<i>по вхождению подстроки</i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</cfoutput>
|
||||
|
||||
<layout:page section="footer" closeForm="Yes"/>
|
||||
<!--- <cfdump var=#filter#> --->
|
||||
Reference in New Issue
Block a user