</actions>
</permacrud>
</class>
- <class id="bren" controller="open-ils.cstore" oils_obj:fieldmapper="biblio::record_note" oils_persist:tablename="biblio.record_note" reporter:label="Bib Record Note">
+ <class id="bren" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="biblio::record_note" oils_persist:tablename="biblio.record_note" reporter:label="Bib Record Note" oils_persist:field_safe="true">
<fields oils_persist:primary="id" oils_persist:sequence="biblio.record_note_id_seq">
- <field name="create_date" reporter:datatype="timestamp"/>
- <field name="creator" reporter:datatype="link"/>
- <field name="edit_date" reporter:datatype="timestamp"/>
- <field name="editor" reporter:datatype="link"/>
- <field name="id" reporter:datatype="id" />
- <field name="pub" reporter:datatype="bool"/>
- <field name="record" reporter:datatype="link"/>
- <field name="value" reporter:datatype="text"/>
+ <field reporter:label="Creation Date" name="create_date" reporter:datatype="timestamp"/>
+ <field reporter:label="Creator" name="creator" reporter:datatype="link"/>
+ <field reporter:label="Last Edit Date" name="edit_date" reporter:datatype="timestamp"/>
+ <field reporter:label="Editor" name="editor" reporter:datatype="link"/>
+ <field reporter:label="Note ID" name="id" reporter:datatype="id" />
+ <field reporter:label="Public" name="pub" reporter:datatype="bool"/>
+ <field reporter:label="Bib Record" name="record" reporter:datatype="link"/>
+ <field reporter:label="Note" name="value" reporter:datatype="text"/>
+ <field reporter:label="Deleted" name="deleted" reporter:datatype="bool"/>
</fields>
<links>
<link field="creator" reltype="has_a" key="id" map="" class="au"/>
<link field="editor" reltype="has_a" key="id" map="" class="au"/>
<link field="record" reltype="has_a" key="id" map="" class="bre"/>
</links>
+ <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+ <actions>
+ <create permission="CREATE_RECORD_NOTE" global_required="true"/>
+ <retrieve/>
+ <update permission="UPDATE_RECORD_NOTE" global_required="true"/>
+ <delete permission="DELETE_RECORD_NOTE" global_required="true"/>
+ </actions>
+ </permacrud>
</class>
<class id="mucs" controller="open-ils.cstore" oils_obj:fieldmapper="money::user_circulation_summary" oils_persist:tablename="money.usr_circulation_summary" reporter:label="User Circulation Summary">
<fields oils_persist:primary="usr" oils_persist:sequence="">
import {BasketActionsComponent} from './basket-actions.component';
import {HoldComponent} from './hold/hold.component';
import {PartsComponent} from './record/parts.component';
+import {NotesComponent} from './record/notes.component';
import {AddToCarouselDialogComponent} from './record/add-to-carousel-dialog.component';
import {PartMergeDialogComponent} from './record/part-merge-dialog.component';
import {BrowseComponent} from './browse.component';
BasketActionsComponent,
HoldComponent,
PartsComponent,
+ NotesComponent,
AddToCarouselDialogComponent,
PartMergeDialogComponent,
BrowseComponent,
--- /dev/null
+<div class="mt-3">
+
+ <eg-grid #notesGrid idlClass="bren" [dataSource]="gridDataSource"
+ [sortable]="true" persistKey="catalog.record.notes"
+ showFields="value,create_date" class="mt-3">
+ <eg-grid-toolbar-button [disabled]="!permissions.CREATE_RECORD_NOTE"
+ label="New Record Note" i18n-label [action]="createNew">
+ </eg-grid-toolbar-button>
+ <eg-grid-toolbar-action label="Delete Selected" i18n-label [action]="deleteSelected">
+ </eg-grid-toolbar-action>
+ </eg-grid>
+
+ <eg-fm-record-editor #editDialog idlClass="bren"
+ readonlyFields="id,create_date,edit_date,creator,editor"
+ hiddenFields="record,deleted">
+ </eg-fm-record-editor>
+
+</div>
--- /dev/null
+import {Component, OnInit, Input, ViewChild} from '@angular/core';
+import {IdlService, IdlObject} from '@eg/core/idl.service';
+import {PcrudService} from '@eg/core/pcrud.service';
+import {Pager} from '@eg/share/util/pager';
+import {OrgService} from '@eg/core/org.service';
+import {PermService} from '@eg/core/perm.service';
+import {GridDataSource} from '@eg/share/grid/grid';
+import {GridComponent} from '@eg/share/grid/grid.component';
+import {FmRecordEditorComponent} from '@eg/share/fm-editor/fm-editor.component';
+
+@Component({
+ selector: 'eg-catalog-record-notes',
+ templateUrl: 'notes.component.html'
+})
+export class NotesComponent implements OnInit {
+
+ recId: number;
+ gridDataSource: GridDataSource;
+ initDone: boolean;
+ @ViewChild('notesGrid', { static: true }) notesGrid: GridComponent;
+ @ViewChild('editDialog', { static: true }) editDialog: FmRecordEditorComponent;
+
+ canCreate: boolean;
+ canDelete: boolean;
+ createNew: () => void;
+ deleteSelected: (rows: IdlObject[]) => void;
+ permissions: {[name: string]: boolean};
+
+ @Input() set recordId(id: number) {
+ this.recId = id;
+ // Only force new data collection when recordId()
+ // is invoked after ngInit() has already run.
+ if (this.initDone) {
+ this.notesGrid.reload();
+ }
+ }
+
+ get recordId(): number {
+ return this.recId;
+ }
+
+ constructor(
+ private idl: IdlService,
+ private org: OrgService,
+ private pcrud: PcrudService,
+ private perm: PermService
+ ) {
+ this.permissions = {};
+ this.gridDataSource = new GridDataSource();
+ }
+
+ ngOnInit() {
+ this.initDone = true;
+
+ // Load edit perms
+ this.perm.hasWorkPermHere([
+ 'CREATE_RECORD_NOTE',
+ 'UPDATE_RECORD_NOTE',
+ 'DELETE_RECORD_NOTE'
+ ]).then(perms => this.permissions = perms);
+
+ this.gridDataSource.getRows = (pager: Pager, sort: any[]) => {
+ const orderBy: any = {};
+
+ if (sort.length) { // Sort provided by grid.
+ orderBy.bren = sort[0].name + ' ' + sort[0].dir;
+ } else {
+ orderBy.bren = 'edit_date';
+ }
+
+ const searchOps = {
+ offset: pager.offset,
+ limit: pager.limit,
+ order_by: orderBy
+ };
+
+ return this.pcrud.search('bren',
+ {record: this.recId, deleted: 'f'}, searchOps);
+ };
+
+ this.notesGrid.onRowActivate.subscribe(
+ (note: IdlObject) => {
+ this.editDialog.mode = 'update';
+ this.editDialog.recordId = note.id();
+ this.editDialog.open()
+ .subscribe(ok => this.notesGrid.reload());
+ }
+ );
+
+ this.createNew = () => {
+
+ const note = this.idl.create('bren');
+ note.record(this.recordId);
+ this.editDialog.record = note;
+
+ this.editDialog.mode = 'create';
+ this.editDialog.open().subscribe(ok => this.notesGrid.reload());
+ };
+
+ this.deleteSelected = (notes: IdlObject[]) => {
+ notes.forEach(note => note.isdeleted(true));
+ this.pcrud.autoApply(notes).subscribe(
+ val => console.debug('deleted: ' + val),
+ err => {},
+ () => this.notesGrid.reload()
+ );
+ };
+ }
+}
+
<eg-marc-html [recordId]="recordId" recordType="bib"></eg-marc-html>
</ng-template>
</ngb-tab>
+ <ngb-tab title="Record Notes" i18n-title id="bibnotes">
+ <ng-template ngbTabContent>
+ <eg-catalog-record-notes [recordId]="recordId">
+ </eg-catalog-record-notes>
+ </ng-template>
+ </ngb-tab>
<ngb-tab title="View Holds" i18n-title id="holds">
<ng-template ngbTabContent>
<eg-holds-grid [recordId]="recordId"
creator INT NOT NULL DEFAULT 1,
editor INT NOT NULL DEFAULT 1,
pub BOOL NOT NULL DEFAULT FALSE,
+ deleted BOOL NOT NULL DEFAULT FALSE,
create_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
edit_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now()
);
'Administer geographic location services', 'ppl', 'description')),
( 632, 'UPDATE_USER_PHOTO_URL', oils_i18n_gettext(632,
'Update the user photo url field in patron registration and editor', 'ppl', 'description'))
+ ( 633, 'CREATE_RECORD_NOTE', oils_i18n_gettext(633,
+ 'Allow the user to create a record note', 'ppl', 'description')),
+ ( 634, 'UPDATE_RECORD_NOTE', oils_i18n_gettext(634,
+ 'Allow the user to update a record note', 'ppl', 'description')),
+ ( 635, 'DELETE_RECORD_NOTE', oils_i18n_gettext(635,
+ 'Allow the user to delete a record note', 'ppl', 'description'))
;
'VIEW_AUTHORITY_RECORD_NOTES',
'CREATE_AUTHORITY_RECORD',
'DELETE_AUTHORITY_RECORD',
- 'UPDATE_AUTHORITY_RECORD');
+ 'UPDATE_AUTHORITY_RECORD',
+ 'CREATE_RECORD_NOTE',
+ 'UPDATE_RECORD_NOTE',
+ 'DELETE_RECORD_NOTE');
INSERT INTO permission.grp_perm_map (grp, perm, depth, grantable)
SELECT
--- /dev/null
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('xxxx', :eg_version);
+
+
+ALTER TABLE biblio.record_note ADD COLUMN deleted BOOLEAN DEFAULT FALSE;
+
+INSERT INTO permission.perm_list ( id, code, description ) VALUES
+( 633, 'CREATE_RECORD_NOTE', oils_i18n_gettext(633,
+ 'Allow the user to create a record note', 'ppl', 'description')),
+( 634, 'UPDATE_RECORD_NOTE', oils_i18n_gettext(634,
+ 'Allow the user to update a record note', 'ppl', 'description')),
+( 635, 'DELETE_RECORD_NOTE', oils_i18n_gettext(635,
+ 'Allow the user to delete a record note', 'ppl', 'description'));
+
+COMMIT;