more tweaks to exists/does not exist
authorGalen Charlton <gmc@equinoxinitiative.org>
Fri, 15 May 2020 18:39:15 +0000 (14:39 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Fri, 15 May 2020 18:39:15 +0000 (14:39 -0400)
* do not display options for ID fields
* add support for not display exists/not exists operators for required fields,
  (but note that IDL for relevant acq tables don't include the required markup)
* make open invoices link is __isnull

Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/eg2/src/app/staff/acq/search/acq-search-form.component.html
Open-ILS/src/eg2/src/app/staff/acq/search/acq-search-form.component.ts
Open-ILS/src/eg2/src/app/staff/nav.component.html

index 962a10c..20203f2 100644 (file)
@@ -50,8 +50,8 @@
         <option i18n value="__gte" [hidden]="searchTermDatatypes[t.field] != 'timestamp' && !dateLikeSearchFields[t.field]">is on or AFTER</option>
         <option i18n value="__between" [hidden]="searchTermDatatypes[t.field] != 'timestamp'">is BETWEEN</option>
         <option i18n value="__age" [hidden]="searchTermDatatypes[t.field] != 'timestamp'">age (relative date)</option>
-        <option i18n value="__isnotnull">exists</option>
-        <option i18n value="__isnull">does NOT exist</option>
+        <option i18n value="__isnotnull" [hidden]="searchTermDatatypes[t.field] == 'id' || searchTermFieldIsRequired[t.field]">exists</option>
+        <option i18n value="__isnull" [hidden]="searchTermDatatypes[t.field] == 'id' || searchTermFieldIsRequired[t.field]">does NOT exist</option>
         <option i18n value="__in">matches a term from a file</option>
       </select>
     </div>
index 5f0ac6a..afb5adf 100644 (file)
@@ -34,6 +34,7 @@ export class AcqSearchFormComponent implements OnInit, AfterViewInit, OnChanges
     availableSearchFields = {};
     dateLikeSearchFields = {};
     searchTermDatatypes = {};
+    searchTermFieldIsRequired = {};
     searchFieldLinkedClasses = {};
     validSearchTypes = ['lineitems', 'purchaseorders', 'invoices', 'selectionlists'];
     defaultSearchType = 'lineitems';
@@ -71,6 +72,7 @@ export class AcqSearchFormComponent implements OnInit, AfterViewInit, OnChanges
                                     datatype: field.datatype
                                 };
                                 self.searchTermDatatypes[hint + ':' + field.name] = field.datatype;
+                                self.searchTermFieldIsRequired[hint + ':' + field.name] = field.required;
                                 if (field.datatype === 'link') {
                                     self.searchFieldLinkedClasses[hint + ':' + field.name] = field.class;
                                 }
index ad8b89e..90b6056 100644 (file)
           </a>
           <a class="dropdown-item" 
             routerLink="/staff/acq/search/invoices"
-            [queryParams]="{f: ['acqinv:receiver', 'acqinv:close_date'], val1: [ws_ou(), null]}">
+            [queryParams]="{f: ['acqinv:receiver', 'acqinv:close_date'], op: ['', '__isnull'], val1: [ws_ou(), null]}">
             <span class="material-icons">attach_money</span>
             <span i18n>Open Invoices</span>
           </a>