add search for "between" to varchar-fields

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ctheuring
    Senior Member
    • Oct 2022
    • 138

    add search for "between" to varchar-fields

    Hello,

    I want to add a search with between to postalCode-field (a varchar-field).
    I've done:
    1.) add to Espo/Custom/Resources/i18n/de_DE/Global.json:
    "varcharSearchRanges": {
    "between": "Zwischen"
    },
    2.) create Client/custom/lib/template.tpl with:
    _delimiter_sai2qfjgah
    custom/res/templates/fields/varchar/search.tpl
    <select class="form-control search-type input-sm">
    {{options searchTypeList searchType field='varcharSearchRanges'}}
    </select>
    <input
    type="text"
    class="main-element form-control input-sm"
    data-name="{{name}}"
    value="{{searchData.value}}"
    {{#if params.maxLength}}maxlength="{{params.maxLength}}" {{/if}}
    {{#if params.size}}size="{{params.size}}"{{/if}}
    autocomplete="espo-{{name}}"
    placeholder="{{translate 'Value'}}"
    {{#if noSpellCheck}}
    spellcheck="false"
    {{/if}}
    >
    <input
    type="text"
    class="form-control{{#ifNotEqual searchType 'between'}} hidden{{/ifNotEqual}} additional input-sm"
    data-name="{{name}}-additional"
    value="{{value2}}"
    {{#if params.maxLength}}maxlength="{{params.maxLength}}" {{/if}}
    {{#if params.size}}size="{{params.size}}"{{/if}}
    placeholder="{{translate 'Value'}}"
    autocomplete="espo-{{name}}-additional"
    spellcheck="false"
    >​
    3. expand client/custom/res/templates/fields/varchar/search.tpl to:
    <select class="form-control search-type input-sm">
    {{options searchTypeList searchType field='varcharSearchRanges'}}
    </select>
    <input
    type="text"
    class="main-element form-control input-sm"
    data-name="{{name}}"
    value="{{searchData.value}}"
    {{#if params.maxLength}}maxlength="{{params.maxLength}}" {{/if}}
    {{#if params.size}}size="{{params.size}}"{{/if}}
    autocomplete="espo-{{name}}"
    placeholder="{{translate 'Value'}}"
    {{#if noSpellCheck}}
    spellcheck="false"
    {{/if}}
    >
    <input
    type="text"
    class="form-control{{#ifNotEqual searchType 'between'}} hidden{{/ifNotEqual}} additional input-sm"
    data-name="{{name}}-additional"
    value="{{name2}}""
    {{#if params.maxLength}}maxlength="{{params.maxLength}}" {{/if}}
    {{#if params.size}}size="{{params.size}}"{{/if}}
    placeholder="{{translate 'Value'}}"
    autocomplete="espo-{{name}}-additional"
    spellcheck="false"
    >​
    4.) rebuild system

    1.) is ok - I can translate in administration/.../global
    but
    there is still no choice "between" in search-parameter of field billingAddressPostalCode

    Is one of my path for the expand or created files incorrect?
    Or is there another file I had to create or expand?

    Christoph
    P.S:
    I've checked that MariaDB is able to run selects with between
    Last edited by ctheuring; 12-04-2023, 01:33 PM.
Working...