From 015c74bd50d6ae5a89f4238c6dc030376ae33b1e Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 7 Apr 2023 14:50:11 +0200 Subject: [PATCH] Bug 30708: Vue app Content-Type: text/plain; charset=utf-8 This commit contains the main commit message The description of the original need is described in documents attached by the sponsor on the bug report specifically "[En] Preservation module - Main principles". The idea is to develop a whole new module to track the status of the documents that are sent for processings/treatments in order to preserve them (eg. covering). This is a first step, more are certainly coming later. The author and sponsors have worked for several months before providing this MVP version. The different discussion and needs can be found at https://tree.taiga.io/project/joubu-koha-preservation-module/kanban Some ideas of the next steps are also listed. The first iterations have been done using the classic .pl/.tt Koha style but we finally switched to a new Vue module, for more fun. These patches made the following main changes: New files * Koha objects under Koha/Preservation * REST API controllers under Koha/REST/V1/Preservation * preservation/home.pl and preservation/home.tt * Vue components under js/vue/components/Preservation * tests under t/db_dependent/Koha/Preservation and t/db_dependent/api/v1/preservation_* * Cypress tests under t/cypress/integration/Preservation DB: * 3 new sysprefs PreservationModule, PreservationNotForLoanWaitingListIn, PreservationNotForLoanDefaultTrainIn * 1 new permission "preservation" (will be split into subpermissions later) * 5 new tables: - preservation_processings - preservation_trains - preservation_processing_attributes - preservation_trains_items - preservation_processing_attributes_items Terminology and workflow: *Processings* are the different treatments an item can receive during its stay in the preservation module A *processing* is defined by a list of *attributes*. To make the module as easy to use for the librarians in charge of the preservation area a list of processings will be defined when the module will be set up. An *attribute* is a name and a value. That's it. However it also has a type, to define what the value is coming from: *free text*, *authorised value* or *database column*. For instance if you are defining a processing that will handling the book cover you could have 3 *attributes*: - first named "Barcode" that will be automatically filled with "items.barcode" (type *database column*" - second attribute named "color" linked with a new PRES_COLOR authorised value category you would have previously defined with "red", "blue", "green", etc. (type *authorised value*) - third attribute named "notes", because librarians like notes (type *free text*) Important: Even if the attribute is linked with a DB column or AV category, the value will be automatically pre filled but will stay editable (could be a config option to restrict the edition, later, if needed). The *status* of an item will change during the preservation process. First it will arrive in the preservation area and be on a *waiting list*. It is not processed already but is not available anymore for the patrons of the library. That's why we are going to use the "not for loan" (items.notforloan) value for this. This *waiting list* is a fictional concept, it simply lists all the items in the library with a specific *status*. A *train* is... how they call that at the BULAC, a train (same in French!). And we quite like the word so we kept it. It is what it is: a list of items/waggons, one after each other. We could have picked "cart", "list", but the concepts were already used in different places. We are not strongly attached to the term and it can be modified (but it's spread all over the code already and will be tedious to modify!) if you have a very good suggestion :) So, a *train* is where items are going after they have been sent to the waiting list. It's a stack of items that will be sent to a provider. When you create a new train you will be asked for the "Status for item added to this train", that will be the "not for loan" value to set to the items added to this train, and a "Default processing" that will be the processing used. But keep in mind that a train can have items that have different processings (specific case, will see later). When all items have been added to a *train*, you can *close* it. You cannot add items anymore to it! Then you can *send* it, and finally *receive* it. They are just statuses to keep track of the dates, and filter trains by status. However when a train is received you can *copy* an item to another (opened) train. It means that you have the item on hand but something went wrong, you are not happy with the work done by the supplier and want to send it back, so you create a new train (that can have different items, and it is the case where you will have items in a train that don't all have the same processing!). Test plan: A. Prerequisites 0. Just `reset_all` and jump to B, or: 1. Apache configuration You will need to edit /etc/koha/apache-shared-intranet-git.conf and add the following lines after the RewriteRule for erm (line.24?) RewriteCond %{REQUEST_URI} !^/cgi-bin/koha/preservation/.*.pl$ RewriteRule ^/cgi-bin/koha/preservation/.*$ /cgi-bin/koha/preservation/home.pl [PT] The RewriteCond is only useful if you are testing the "print slips" bugs as well, but it cannot hurt to have it! 2. `yarn js:build` to regenerate the Vue app for the preservation module 3. `updatedatabase` 4. `restart_all` B. Settings 0. Create 2 different values for NOTLOAN, eg. 'In preservation' and 'In preservation external' Create different authorised values for a new category, eg. PRES_COLORS: RED, BLUE, GREEN. Feel free to create more categories. 1. You can turn on the "PreservationModule" syspref and go to the Koha homepage to see a new "Preservation" link 2. You landed on the empty home page of the preservation, no worry! We need to fill this page with useful information! (see #2 on the kanban) 3. Go to settings 4. Set "Status for item added to waiting list" to "In preservation" and "Default status for item added to train": "In preservation external" Create a new processing and define some attributes. Ideally at least one of each type. 5. Go to "Waiting list" and add some items 6. Go to "Trains" and create several trains (at least 2). Notice that the "Status for item added to this train" value is set to the value defined in the settings, but can be modified. Notice that this status can be set when a train is created but it won't be possible to edit later. 7. Add items to a train. You can only add items that are already in the waiting list. Add values for the attributes. Notice that the attributes linked with a database column are automatically pre filled. Notice that attributes linked with an authorised value are displayed with a dropdown list but that a different value can be set (remember, this is a feature!). Notice that attributes can be multivalued. 8. Add other items to the waiting list, notice the "Add last X items to a train" link at the top of the waiting list table, click it 9. You can now add several items to a train, directly (for instance if you don't really need to pass through the waiting list). Values can be set for the batch, but attributes linked with a database column are not editable (they will be prefilled automatically) 10. Once you have a train with several items, look at the "show train" view and notice the item list. If all of them are using the same processing then a table is displayed, one column per attribute. However if at least one item of the train has a different processing then the items are not listed in a table. 11. Edit items and confirm that the values are correctly saved. 12. Close, send and receive a train 13. Once a train is closed you can no longer add items to it 14. Once a train is received notice that you can "copy" an item to another (opened) train QA notes: The patch is huge! New enhancements and improvements have been moved to separate bug reports but this cannot be split. We need a ground base to build on top. The size is mainly coming from Vue components, Koha::Objects, REST API controllers and specs, and tests. Nothing hard ;) More to come: - See the kanban! - Print slips (bug 33547 and bug 34030) - Put something on the landing page! - Link with the acquisition module (suppliers, funds, etc.) Sponsored-by: BULAC - http://www.bulac.fr/ Signed-off-by: BULAC - http://www.bulac.fr/ Signed-off-by: Heather Hernandez Signed-off-by: Laurence Rault Signed-off-by: Marcel de Rooy --- .../prog/js/vue/components/KohaTable.vue | 6 + .../js/vue/components/Preservation/Home.vue | 11 + .../js/vue/components/Preservation/Main.vue | 194 +++++++ .../vue/components/Preservation/Settings.vue | 130 +++++ .../Preservation/SettingsProcessings.vue | 110 ++++ .../SettingsProcessingsFormAdd.vue | 286 +++++++++ .../Preservation/SettingsProcessingsShow.vue | 151 +++++ .../components/Preservation/TrainsFormAdd.vue | 196 +++++++ .../Preservation/TrainsFormAddItem.vue | 327 +++++++++++ .../components/Preservation/TrainsList.vue | 270 +++++++++ .../components/Preservation/TrainsShow.vue | 548 ++++++++++++++++++ .../components/Preservation/TrainsToolbar.vue | 16 + .../components/Preservation/WaitingList.vue | 344 +++++++++++ .../prog/js/vue/fetch/api-client.js | 2 + .../vue/fetch/authorised-values-api-client.js | 4 + .../js/vue/fetch/preservation-api-client.js | 184 ++++++ .../prog/js/vue/modules/preservation.ts | 74 +++ .../prog/js/vue/routes/preservation.js | 220 +++++++ .../prog/js/vue/stores/authorised-values.js | 1 + .../prog/js/vue/stores/preservation.js | 10 + webpack.config.js | 1 + 21 files changed, 3085 insertions(+) create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/Home.vue create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/Main.vue create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/Settings.vue create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/SettingsProcessings.vue create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/SettingsProcessingsFormAdd.vue create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/SettingsProcessingsShow.vue create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsFormAdd.vue create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsFormAddItem.vue create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsList.vue create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsShow.vue create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsToolbar.vue create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/WaitingList.vue create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/fetch/preservation-api-client.js create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/modules/preservation.ts create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/routes/preservation.js create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/stores/preservation.js diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue index 0e27318e6a..740953ccb4 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue @@ -105,6 +105,12 @@ export default { this.$__("Delete") + "" ) + } else if (action == "remove") { + content.push( + ' ' + + this.$__("Remove") + + "" + ) } }) return content.join(" ") diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/Home.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/Home.vue new file mode 100644 index 0000000000..e924a04a2b --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/Home.vue @@ -0,0 +1,11 @@ + + + diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/Main.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/Main.vue new file mode 100644 index 0000000000..07794196f2 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/Main.vue @@ -0,0 +1,194 @@ + + + + + diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/Settings.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/Settings.vue new file mode 100644 index 0000000000..a093bef9fa --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/Settings.vue @@ -0,0 +1,130 @@ + + + diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/SettingsProcessings.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/SettingsProcessings.vue new file mode 100644 index 0000000000..ac7e54d7aa --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/SettingsProcessings.vue @@ -0,0 +1,110 @@ + + + + + diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/SettingsProcessingsFormAdd.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/SettingsProcessingsFormAdd.vue new file mode 100644 index 0000000000..14b29cd639 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/SettingsProcessingsFormAdd.vue @@ -0,0 +1,286 @@ + + + diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/SettingsProcessingsShow.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/SettingsProcessingsShow.vue new file mode 100644 index 0000000000..25a34781f3 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/SettingsProcessingsShow.vue @@ -0,0 +1,151 @@ + + + + diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsFormAdd.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsFormAdd.vue new file mode 100644 index 0000000000..001e13f2c1 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsFormAdd.vue @@ -0,0 +1,196 @@ +