Bug 22784

Summary: Add the ability to archive purchase suggestions
Product: Koha Reporter: Joy Nelson <1joynelson>
Component: AcquisitionsAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: lisettepalouse+koha, magnus, martin.renvoize, nengard, severine.queune, tomascohen, wizzyrea
Version: Main   
Hardware: All   
OS: All   
URL: https://gitlab.com/joubu/Koha/commits/bug_22784
Change sponsored?: Sponsored Patch complexity: Medium patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This enhancements to the suggestions process adds a way to archive completed purchase suggestions.
Version(s) released in:
20.05.00
Circulation function:
Bug Depends on: 23590    
Bug Blocks: 27635, 23591, 27462    
Attachments: Bug 22784: DB Changes
Bug 22784: DBIC Changes
Bug 22784: Add the ability to archive/unarchive a purchase suggestions
Bug 22784: Add a cronjob to archive suggestions given age or status criteria
Bug 22784: Add the ability to archive/unarchive a purchase suggestions
Bug 22784: Bugfix - do not modify #description build Debian packages from a git repository
Bug 22784: Do not display an empty table
Bug 22784: Add a cronjob to archive suggestions given age or status criteria
Bug 22784: DB Changes
Bug 22784: DBIC Changes
Bug 22784: Add the ability to archive/unarchive a purchase suggestions
Bug 22784: Bugfix - do not modify #description build Debian packages from a git repository
Bug 22784: Do not display an empty table
Bug 22784: Add a cronjob to archive suggestions given age or status criteria
Bug 22784: DB Changes
Bug 22784: DBIC Changes
Bug 22784: Add the ability to archive/unarchive a purchase suggestions
Bug 22784: Bugfix - do not modify #description build Debian packages from a git repository
Bug 22784: Do not display an empty table
Bug 22784: Add a cronjob to archive suggestions given age or status criteria
Bug 22784: DB Changes
Bug 22784: DBIC Changes
Bug 22784: Add the ability to archive/unarchive a purchase suggestions
Bug 22784: Bugfix - do not modify #description build Debian packages from a git repository
Bug 22784: Do not display an empty table
Bug 22784: Add a cronjob to archive suggestions given age or status criteria
Bug 22784: DB Changes
Bug 22784: DBIC Changes
Bug 22784: Add the ability to archive/unarchive a purchase suggestions
Bug 22784: Bugfix - do not modify #description build Debian packages from a git repository
Bug 22784: Do not display an empty table
Bug 22784: Add a cronjob to archive suggestions given age or status criteria
Bug 22784: DBIC changes
Bug 22784: Fix small display issue with fa icon in suggestions table
Bug 22784: DB Changes
Bug 22784: Add the ability to archive/unarchive a purchase suggestions
Bug 22784: Bugfix - do not modify #description build Debian packages from a git repository
Bug 22784: Do not display an empty table
Bug 22784: Add a cronjob to archive suggestions given age or status criteria
Bug 22784: DBIC changes
Bug 22784: Fix small display issue with fa icon in suggestions table
Bug 22784: (QA follow-up) booleans should be TINYINT

Description Joy Nelson 2019-04-26 15:13:00 UTC
Create a way to archive the 'completed' purchase suggestions on the staff side.
1. Add an 'archived' column to purchase suggestions
2. Add a script to automatically mark suggestions of a certain age and status as archived
3. Add a button on the purchase suggestions page to archive specific suggestions
4. Add a 'view archived suggestions' button to view archived suggestions.  Default view does not display archived suggestions
5. Add 'archived' option to the filters on the purchase suggestions page.
Comment 1 Katrin Fischer 2019-05-04 15:45:10 UTC
*** Bug 1884 has been marked as a duplicate of this bug. ***
Comment 2 Séverine Queune 2019-09-11 13:19:08 UTC
The BULAC (http://www.bulac.fr/) is interested by the behaviours detailed on the first comment, and we’d like to sponsor this development.

An important hope for us, not mentioned above, is to have better performance on the suggestions page loading, for it is now very slow because of the hundreds of suggestions we’ve already got. We hope archiving will settle this.

As long as “Change sponsored?” is set on “Seeking developer”, anyone wanting to quote us for the development of such a feature or just ask for more information is welcome to write to us: <sigb@bulac.fr>.
Comment 3 Jonathan Druart 2019-11-18 11:09:02 UTC
Created attachment 95499 [details] [review]
Bug 22784: DB Changes

Sponsored-by: BULAC - http://www.bulac.fr/
Comment 4 Jonathan Druart 2019-11-18 11:09:05 UTC
Created attachment 95500 [details] [review]
Bug 22784: DBIC Changes

Sponsored-by: BULAC - http://www.bulac.fr/
Comment 5 Jonathan Druart 2019-11-18 11:09:09 UTC
Created attachment 95501 [details] [review]
Bug 22784: Add the ability to archive/unarchive a purchase suggestions

There are performance issues when searching suggestions if there are
thousands of suggestions.
To prevent that we are going to add the ability to archive purchase
suggestions, in order to remove them from the search list (by default).

Test plan:
0. Apply all the patches, execute the updatedatabase.pl script, restart
all
1. Create some suggestions
2. Search for them
3. Use the "Archive" action button for one of them
4. Restart the search
=> The archived suggestion does no longer appear in the list
5. Use the filter "Included archived" in the "Suggestion information"
filter box
=> The archived suggestion is now displayed
6. Use other filters
=> The "archived" filter is kept from one search to another
7. Use one of the action at the bottom of the suggestion list (change
the status for instance)
=> The "archived" filter is still kept

Sponsored-by: BULAC - http://www.bulac.fr/
Comment 6 Jonathan Druart 2019-11-18 11:09:13 UTC
Created attachment 95502 [details] [review]
Bug 22784: Add a cronjob to archive suggestions given age or status criteria

In order to deal automatically with suggestions that need to be
archived, this cronjob will help to add the "archived" flag following
their age or status.

Test plan:
- Execute the script with the --help parameter and read the documentation.
- Does it make sense?
- Use it without the --confirm flag and try several combination

For instance you will want to archive suggestions that have been
rejected for more than a week:
  perl misc/cronjobs/archive_purchase_suggestions.pl
  --age-date-field=rejecteddate --age=weeks:1

or even suggestion that have been suggested for more than a year and
have a ORDERED status:
  perl misc/cronjobs/archive_purchase_suggestions.pl
  --age-date-field=suggesteddate --age=years:1 --status=ORDERED

- Use it with the --confirm flag and make sure the suggestions have been
archived.

Sponsored-by: BULAC - http://www.bulac.fr/
Comment 7 Jonathan Druart 2019-11-18 11:17:43 UTC
(In reply to Joy Nelson from comment #0)
> Create a way to archive the 'completed' purchase suggestions on the staff
> side.
> 1. Add an 'archived' column to purchase suggestions

Done!

> 2. Add a script to automatically mark suggestions of a certain age and
> status as archived

Done!

> 3. Add a button on the purchase suggestions page to archive specific
> suggestions

Were you suggesting 1 new action for the selected suggestions? This patchset only add 1 new action per suggestion.

We could have another action at the bottom of the suggestion list but I am afraid it will become a bit packed and we are going to lose readability, dependent bug reports already add stuff there. I would suggest to deal with that on a separate bug report.

> 4. Add a 'view archived suggestions' button to view archived suggestions. 
> Default view does not display archived suggestions

Not sure it is needed as there is the filter. I am willing to add something after you have tested the patches and can tell me what you have exactly in mind ;)

> 5. Add 'archived' option to the filters on the purchase suggestions page.

Done!
Comment 8 Jonathan Druart 2019-11-18 14:19:34 UTC
Created attachment 95510 [details] [review]
Bug 22784: Add the ability to archive/unarchive a purchase suggestions

There are performance issues when searching suggestions if there are
thousands of suggestions.
To prevent that we are going to add the ability to archive purchase
suggestions, in order to remove them from the search list (by default).

Test plan:
0. Apply all the patches, execute the updatedatabase.pl script, restart
all
1. Create some suggestions
2. Search for them
3. Use the "Archive" action button for one of them
4. Restart the search
=> The archived suggestion does no longer appear in the list
5. Use the filter "Included archived" in the "Suggestion information"
filter box
=> The archived suggestion is now displayed
6. Use other filters
=> The "archived" filter is kept from one search to another
7. Use one of the action at the bottom of the suggestion list (change
the status for instance)
=> The "archived" filter is still kept

Sponsored-by: BULAC - http://www.bulac.fr/
Comment 9 Jonathan Druart 2019-11-18 14:19:38 UTC
Created attachment 95511 [details] [review]
Bug 22784: Bugfix - do not modify #description build Debian packages from a git repository
Comment 10 Jonathan Druart 2019-11-18 14:19:42 UTC
Created attachment 95512 [details] [review]
Bug 22784: Do not display an empty table

This is terrible and highlight that the whole script must be rewrite.
GetDistinctValues does not handle the "archived" flag (and we do not
want to put our hands there), so let's hack that and plan to rewrite the
whole script.
Comment 11 Jonathan Druart 2019-11-18 14:19:46 UTC
Created attachment 95513 [details] [review]
Bug 22784: Add a cronjob to archive suggestions given age or status criteria

In order to deal automatically with suggestions that need to be
archived, this cronjob will help to add the "archived" flag following
their age or status.

Test plan:
- Execute the script with the --help parameter and read the documentation.
- Does it make sense?
- Use it without the --confirm flag and try several combination

For instance you will want to archive suggestions that have been
rejected for more than a week:
  perl misc/cronjobs/archive_purchase_suggestions.pl
  --age-date-field=rejecteddate --age=weeks:1

or even suggestion that have been suggested for more than a year and
have a ORDERED status:
  perl misc/cronjobs/archive_purchase_suggestions.pl
  --age-date-field=suggesteddate --age=years:1 --status=ORDERED

- Use it with the --confirm flag and make sure the suggestions have been
archived.

Sponsored-by: BULAC - http://www.bulac.fr/
Comment 12 Séverine Queune 2019-11-19 09:18:58 UTC
Hi Jonathan, 

This patch doesn't apply on master :

Applying: Bug 22784: DB Changes
Using index info to reconstruct a base tree...
M	Koha/Schema/Result/Suggestion.pm
M	installer/data/mysql/kohastructure.sql
Falling back to patching base and 3-way merge...
Auto-merging installer/data/mysql/kohastructure.sql
Auto-merging Koha/Schema/Result/Suggestion.pm
Applying: Bug 22784: DBIC Changes
Using index info to reconstruct a base tree...
M	Koha/Schema/Result/Suggestion.pm
Falling back to patching base and 3-way merge...
Auto-merging Koha/Schema/Result/Suggestion.pm
CONFLICT (content): Merge conflict in Koha/Schema/Result/Suggestion.pm
Failed to merge in the changes.
Patch failed at 0001 Bug 22784: DBIC Changes
Comment 13 Jonathan Druart 2019-11-19 09:50:03 UTC
Sorry, wrong bug number in the dep list.
Comment 14 Séverine Queune 2019-11-19 10:36:04 UTC
Created attachment 95533 [details] [review]
Bug 22784: DB Changes

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 15 Séverine Queune 2019-11-19 10:36:08 UTC
Created attachment 95534 [details] [review]
Bug 22784: DBIC Changes

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 16 Séverine Queune 2019-11-19 10:36:11 UTC
Created attachment 95535 [details] [review]
Bug 22784: Add the ability to archive/unarchive a purchase suggestions

There are performance issues when searching suggestions if there are
thousands of suggestions.
To prevent that we are going to add the ability to archive purchase
suggestions, in order to remove them from the search list (by default).

Test plan:
0. Apply all the patches, execute the updatedatabase.pl script, restart
all
1. Create some suggestions
2. Search for them
3. Use the "Archive" action button for one of them
4. Restart the search
=> The archived suggestion does no longer appear in the list
5. Use the filter "Included archived" in the "Suggestion information"
filter box
=> The archived suggestion is now displayed
6. Use other filters
=> The "archived" filter is kept from one search to another
7. Use one of the action at the bottom of the suggestion list (change
the status for instance)
=> The "archived" filter is still kept

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 17 Séverine Queune 2019-11-19 10:36:15 UTC
Created attachment 95536 [details] [review]
Bug 22784: Bugfix - do not modify #description build Debian packages from a git repository

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 18 Séverine Queune 2019-11-19 10:36:19 UTC
Created attachment 95537 [details] [review]
Bug 22784: Do not display an empty table

This is terrible and highlight that the whole script must be rewrite.
GetDistinctValues does not handle the "archived" flag (and we do not
want to put our hands there), so let's hack that and plan to rewrite the
whole script.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 19 Séverine Queune 2019-11-19 10:36:23 UTC
Created attachment 95538 [details] [review]
Bug 22784: Add a cronjob to archive suggestions given age or status criteria

In order to deal automatically with suggestions that need to be
archived, this cronjob will help to add the "archived" flag following
their age or status.

Test plan:
- Execute the script with the --help parameter and read the documentation.
- Does it make sense?
- Use it without the --confirm flag and try several combination

For instance you will want to archive suggestions that have been
rejected for more than a week:
  perl misc/cronjobs/archive_purchase_suggestions.pl
  --age-date-field=rejecteddate --age=weeks:1

or even suggestion that have been suggested for more than a year and
have a ORDERED status:
  perl misc/cronjobs/archive_purchase_suggestions.pl
  --age-date-field=suggesteddate --age=years:1 --status=ORDERED

- Use it with the --confirm flag and make sure the suggestions have been
archived.

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 20 Liz Rea 2020-01-03 16:03:15 UTC
This still applies, QA?
Comment 21 Katrin Fischer 2020-01-03 16:17:44 UTC
(In reply to Liz Rea from comment #20)
> This still applies, QA?

Please don't - only person from the QA team seeing this will probably be me and the people who can't QA because they are already on the bug report having worked on it :)
Comment 22 Tomás Cohen Arazi (tcohen) 2020-01-03 16:34:36 UTC
(In reply to Liz Rea from comment #20)
> This still applies, QA?

I can take a look on Monday
Comment 23 ByWater Sandboxes 2020-01-07 15:27:10 UTC
Created attachment 96900 [details] [review]
Bug 22784: DB Changes

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Comment 24 ByWater Sandboxes 2020-01-07 15:27:13 UTC
Created attachment 96901 [details] [review]
Bug 22784: DBIC Changes

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Comment 25 ByWater Sandboxes 2020-01-07 15:27:15 UTC
Created attachment 96902 [details] [review]
Bug 22784: Add the ability to archive/unarchive a purchase suggestions

There are performance issues when searching suggestions if there are
thousands of suggestions.
To prevent that we are going to add the ability to archive purchase
suggestions, in order to remove them from the search list (by default).

Test plan:
0. Apply all the patches, execute the updatedatabase.pl script, restart
all
1. Create some suggestions
2. Search for them
3. Use the "Archive" action button for one of them
4. Restart the search
=> The archived suggestion does no longer appear in the list
5. Use the filter "Included archived" in the "Suggestion information"
filter box
=> The archived suggestion is now displayed
6. Use other filters
=> The "archived" filter is kept from one search to another
7. Use one of the action at the bottom of the suggestion list (change
the status for instance)
=> The "archived" filter is still kept

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Comment 26 ByWater Sandboxes 2020-01-07 15:27:19 UTC
Created attachment 96903 [details] [review]
Bug 22784: Bugfix - do not modify #description build Debian packages from a git repository

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Comment 27 ByWater Sandboxes 2020-01-07 15:27:22 UTC
Created attachment 96904 [details] [review]
Bug 22784: Do not display an empty table

This is terrible and highlight that the whole script must be rewrite.
GetDistinctValues does not handle the "archived" flag (and we do not
want to put our hands there), so let's hack that and plan to rewrite the
whole script.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Comment 28 ByWater Sandboxes 2020-01-07 15:27:26 UTC
Created attachment 96905 [details] [review]
Bug 22784: Add a cronjob to archive suggestions given age or status criteria

In order to deal automatically with suggestions that need to be
archived, this cronjob will help to add the "archived" flag following
their age or status.

Test plan:
- Execute the script with the --help parameter and read the documentation.
- Does it make sense?
- Use it without the --confirm flag and try several combination

For instance you will want to archive suggestions that have been
rejected for more than a week:
  perl misc/cronjobs/archive_purchase_suggestions.pl
  --age-date-field=rejecteddate --age=weeks:1

or even suggestion that have been suggested for more than a year and
have a ORDERED status:
  perl misc/cronjobs/archive_purchase_suggestions.pl
  --age-date-field=suggesteddate --age=years:1 --status=ORDERED

- Use it with the --confirm flag and make sure the suggestions have been
archived.

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Comment 29 Katrin Fischer 2020-02-14 21:59:48 UTC
Currently blocked by dependency bug 23950.
Comment 30 Jonathan Druart 2020-03-16 18:07:15 UTC
Created attachment 100806 [details] [review]
Bug 22784: DB Changes

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 31 Jonathan Druart 2020-03-16 18:07:20 UTC
Created attachment 100807 [details] [review]
Bug 22784: DBIC Changes

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 32 Jonathan Druart 2020-03-16 18:07:25 UTC
Created attachment 100808 [details] [review]
Bug 22784: Add the ability to archive/unarchive a purchase suggestions

There are performance issues when searching suggestions if there are
thousands of suggestions.
To prevent that we are going to add the ability to archive purchase
suggestions, in order to remove them from the search list (by default).

Test plan:
0. Apply all the patches, execute the updatedatabase.pl script, restart
all
1. Create some suggestions
2. Search for them
3. Use the "Archive" action button for one of them
4. Restart the search
=> The archived suggestion does no longer appear in the list
5. Use the filter "Included archived" in the "Suggestion information"
filter box
=> The archived suggestion is now displayed
6. Use other filters
=> The "archived" filter is kept from one search to another
7. Use one of the action at the bottom of the suggestion list (change
the status for instance)
=> The "archived" filter is still kept

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 33 Jonathan Druart 2020-03-16 18:07:29 UTC
Created attachment 100809 [details] [review]
Bug 22784: Bugfix - do not modify #description build Debian packages from a git repository

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 34 Jonathan Druart 2020-03-16 18:07:33 UTC
Created attachment 100810 [details] [review]
Bug 22784: Do not display an empty table

This is terrible and highlight that the whole script must be rewrite.
GetDistinctValues does not handle the "archived" flag (and we do not
want to put our hands there), so let's hack that and plan to rewrite the
whole script.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 35 Jonathan Druart 2020-03-16 18:07:37 UTC
Created attachment 100811 [details] [review]
Bug 22784: Add a cronjob to archive suggestions given age or status criteria

In order to deal automatically with suggestions that need to be
archived, this cronjob will help to add the "archived" flag following
their age or status.

Test plan:
- Execute the script with the --help parameter and read the documentation.
- Does it make sense?
- Use it without the --confirm flag and try several combination

For instance you will want to archive suggestions that have been
rejected for more than a week:
  perl misc/cronjobs/archive_purchase_suggestions.pl
  --age-date-field=rejecteddate --age=weeks:1

or even suggestion that have been suggested for more than a year and
have a ORDERED status:
  perl misc/cronjobs/archive_purchase_suggestions.pl
  --age-date-field=suggesteddate --age=years:1 --status=ORDERED

- Use it with the --confirm flag and make sure the suggestions have been
archived.

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 36 Jonathan Druart 2020-03-17 07:57:38 UTC
Created attachment 100854 [details] [review]
Bug 22784: DB Changes

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 37 Jonathan Druart 2020-03-17 07:57:42 UTC
Created attachment 100855 [details] [review]
Bug 22784: DBIC Changes

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 38 Jonathan Druart 2020-03-17 07:57:45 UTC
Created attachment 100856 [details] [review]
Bug 22784: Add the ability to archive/unarchive a purchase suggestions

There are performance issues when searching suggestions if there are
thousands of suggestions.
To prevent that we are going to add the ability to archive purchase
suggestions, in order to remove them from the search list (by default).

Test plan:
0. Apply all the patches, execute the updatedatabase.pl script, restart
all
1. Create some suggestions
2. Search for them
3. Use the "Archive" action button for one of them
4. Restart the search
=> The archived suggestion does no longer appear in the list
5. Use the filter "Included archived" in the "Suggestion information"
filter box
=> The archived suggestion is now displayed
6. Use other filters
=> The "archived" filter is kept from one search to another
7. Use one of the action at the bottom of the suggestion list (change
the status for instance)
=> The "archived" filter is still kept

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 39 Jonathan Druart 2020-03-17 07:57:49 UTC
Created attachment 100857 [details] [review]
Bug 22784: Bugfix - do not modify #description build Debian packages from a git repository

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 40 Jonathan Druart 2020-03-17 07:57:53 UTC
Created attachment 100858 [details] [review]
Bug 22784: Do not display an empty table

This is terrible and highlight that the whole script must be rewrite.
GetDistinctValues does not handle the "archived" flag (and we do not
want to put our hands there), so let's hack that and plan to rewrite the
whole script.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 41 Jonathan Druart 2020-03-17 07:57:57 UTC
Created attachment 100859 [details] [review]
Bug 22784: Add a cronjob to archive suggestions given age or status criteria

In order to deal automatically with suggestions that need to be
archived, this cronjob will help to add the "archived" flag following
their age or status.

Test plan:
- Execute the script with the --help parameter and read the documentation.
- Does it make sense?
- Use it without the --confirm flag and try several combination

For instance you will want to archive suggestions that have been
rejected for more than a week:
  perl misc/cronjobs/archive_purchase_suggestions.pl
  --age-date-field=rejecteddate --age=weeks:1

or even suggestion that have been suggested for more than a year and
have a ORDERED status:
  perl misc/cronjobs/archive_purchase_suggestions.pl
  --age-date-field=suggesteddate --age=years:1 --status=ORDERED

- Use it with the --confirm flag and make sure the suggestions have been
archived.

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 42 Katrin Fischer 2020-03-26 21:16:53 UTC
Hi Jonathan, can you please rebase?
Comment 43 Jonathan Druart 2020-03-27 06:56:09 UTC
Created attachment 101948 [details] [review]
Bug 22784: DBIC changes
Comment 44 Jonathan Druart 2020-03-27 06:56:23 UTC
(In reply to Katrin Fischer from comment #42)
> Hi Jonathan, can you please rebase?

The patches applied ok. The one that does not it DBIC changes, it can be done this way:
 % git bz apply --skip
 % dbic

That's it :)
Comment 45 Katrin Fischer 2020-03-27 13:43:16 UTC
(In reply to Jonathan Druart from comment #44)
> (In reply to Katrin Fischer from comment #42)
> > Hi Jonathan, can you please rebase?
> 
> The patches applied ok. The one that does not it DBIC changes, it can be
> done this way:
>  % git bz apply --skip
>  % dbic
> 
> That's it :)

I did that on one of Nick's patches recenlty and then he had some thing dependent on it in the ohter patches - thought I'd play it safe here :)
Comment 46 Katrin Fischer 2020-04-12 23:09:23 UTC
Created attachment 102779 [details] [review]
Bug 22784: Fix small display issue with fa icon in suggestions table

The <i> was not closed resulting in the "Archived" displaying in
the wrong font. Might be a browser specific issue, but adding the
closing </i> fixed it and follows the existing pattern.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 47 Katrin Fischer 2020-04-12 23:09:59 UTC
Created attachment 102780 [details] [review]
Bug 22784: DB Changes

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 48 Katrin Fischer 2020-04-12 23:10:04 UTC
Created attachment 102781 [details] [review]
Bug 22784: Add the ability to archive/unarchive a purchase suggestions

There are performance issues when searching suggestions if there are
thousands of suggestions.
To prevent that we are going to add the ability to archive purchase
suggestions, in order to remove them from the search list (by default).

Test plan:
0. Apply all the patches, execute the updatedatabase.pl script, restart
all
1. Create some suggestions
2. Search for them
3. Use the "Archive" action button for one of them
4. Restart the search
=> The archived suggestion does no longer appear in the list
5. Use the filter "Included archived" in the "Suggestion information"
filter box
=> The archived suggestion is now displayed
6. Use other filters
=> The "archived" filter is kept from one search to another
7. Use one of the action at the bottom of the suggestion list (change
the status for instance)
=> The "archived" filter is still kept

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 49 Katrin Fischer 2020-04-12 23:10:08 UTC
Created attachment 102782 [details] [review]
Bug 22784: Bugfix - do not modify #description build Debian packages from a git repository

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 50 Katrin Fischer 2020-04-12 23:10:12 UTC
Created attachment 102783 [details] [review]
Bug 22784: Do not display an empty table

This is terrible and highlight that the whole script must be rewrite.
GetDistinctValues does not handle the "archived" flag (and we do not
want to put our hands there), so let's hack that and plan to rewrite the
whole script.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 51 Katrin Fischer 2020-04-12 23:10:17 UTC
Created attachment 102784 [details] [review]
Bug 22784: Add a cronjob to archive suggestions given age or status criteria

In order to deal automatically with suggestions that need to be
archived, this cronjob will help to add the "archived" flag following
their age or status.

Test plan:
- Execute the script with the --help parameter and read the documentation.
- Does it make sense?
- Use it without the --confirm flag and try several combination

For instance you will want to archive suggestions that have been
rejected for more than a week:
  perl misc/cronjobs/archive_purchase_suggestions.pl
  --age-date-field=rejecteddate --age=weeks:1

or even suggestion that have been suggested for more than a year and
have a ORDERED status:
  perl misc/cronjobs/archive_purchase_suggestions.pl
  --age-date-field=suggesteddate --age=years:1 --status=ORDERED

- Use it with the --confirm flag and make sure the suggestions have been
archived.

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 52 Katrin Fischer 2020-04-12 23:10:21 UTC
Created attachment 102785 [details] [review]
Bug 22784: DBIC changes

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 53 Katrin Fischer 2020-04-12 23:10:26 UTC
Created attachment 102786 [details] [review]
Bug 22784: Fix small display issue with fa icon in suggestions table

The <i> was not closed resulting in the "Archived" displaying in
the wrong font. Might be a browser specific issue, but adding the
closing </i> fixed it and follows the existing pattern.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 54 Katrin Fischer 2020-04-12 23:11:40 UTC
This worked really well in my testing and is a real nice addition to help carefully clean up suggestions without having to delete the data.

The only thing is maybe the way we display archived entries in the suggestions table - I think the icon/message could be better placed somehow, but haven't come up with a good suggestion myself. Definitely not a blocker :)
Comment 55 Martin Renvoize (ashimema) 2020-04-14 16:23:18 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 56 Tomás Cohen Arazi (tcohen) 2020-04-14 20:07:09 UTC
Created attachment 102944 [details] [review]
Bug 22784: (QA follow-up) booleans should be TINYINT

As per the coding guidelines, they should be TINYINT(1).

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 57 Tomás Cohen Arazi (tcohen) 2020-04-14 20:13:02 UTC
We should add that last patch I attached.
Comment 58 Martin Renvoize (ashimema) 2020-04-15 11:23:35 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 59 Martin Renvoize (ashimema) 2020-04-15 11:23:59 UTC
Good catch, thanks Tomas.
Comment 60 Joy Nelson 2020-05-05 21:17:39 UTC
enhancement not backported to 19.11.x