Bug 39369

Summary: Button "generate discharge" should not validate again a validated discharge
Product: Koha Reporter: Baptiste Wojtkowski (bwoj) <baptiste.wojtkowski>
Component: PatronsAssignee: Baptiste Wojtkowski (bwoj) <baptiste.wojtkowski>
Status: Needs Signoff --- QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: e.betemps, gmcharlt, kyle.m.hall, sonia.bouis
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 37344    
Bug Blocks:    
Attachments: Bug 39369: Generating a discharge should not validate again a generated discharge
Bug 39369: Generating a discharge should not validate again a generated discharge

Description Baptiste Wojtkowski (bwoj) 2025-03-18 16:05:26 UTC
The button generate discharge fetches all the discharges and puts a validation date to the most recent, regardless its state.
This makes no sense in particular if there are more than one discharges.
Comment 1 Baptiste Wojtkowski (bwoj) 2025-03-18 16:16:06 UTC
Created attachment 179462 [details] [review]
Bug 39369: Generating a discharge should not validate again a generated discharge

Test plan:
1 - Apply Bug 37344
2 - Go on discharge.pl, click on "generate discharge"
3 - Drink a coffee (or do something during 1 min)
4 - Click again on the button - notice the date has changed
5 - Cancel the discharge
6 - Click again on the button - notice the cancelled discharge has been
  updated
7 - Apply patch
8 - Repeat 2 to 6 with following changes:
    4 - Notice you simply print again the discharge
    5 - Notice you create a new discharge
    3 - If your tolerance to caffein is low, drink something else than
      coffee
Comment 2 Baptiste Wojtkowski (bwoj) 2025-03-18 16:18:49 UTC
Created attachment 179463 [details] [review]
Bug 39369: Generating a discharge should not validate again a generated discharge

Test plan:
1 - Apply Bug 37344
2 - Go on discharge.pl, click on "generate discharge"
3 - Drink a coffee (or do something during 1 min)
4 - Click again on the button - notice the date has changed
5 - Cancel the discharge
6 - Click again on the button - notice the cancelled discharge has been
  updated
7 - Apply patch
8 - Repeat 2 to 6 with following changes:
    4 - Notice you simply print again the discharge
    6 - Notice you create a new discharge
    3 - If your tolerance to caffein is low, drink something else than
      coffee
Comment 3 Emmanuel Bétemps 2025-03-31 13:45:31 UTC
Hi,

7th step did'nt go well


Using index info to reconstruct a base tree...
M	Koha/Patron/Discharge.pm
M	installer/data/mysql/kohastructure.sql
M	koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt
M	koha-tmpl/intranet-tmpl/prog/en/modules/members/discharge.tt
M	members/discharge.pl
M	opac/opac-reserve.pl
Falling back to patching base and 3-way merge...
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/members/discharge.tt
CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/modules/members/discharge.tt
Auto-merging installer/data/mysql/kohastructure.sql
CONFLICT (content): Merge conflict in installer/data/mysql/kohastructure.sql
CONFLICT (add/add): Merge conflict in installer/data/mysql/atomicupdate/bug_37344.pl
Auto-merging installer/data/mysql/atomicupdate/bug_37344.pl
error: Failed to merge in the changes.
Patch failed at 0001 Bug 37344: Add a real solution for discharge cancellation
[33mhint: Use 'git am --show-current-patch=diff' to see the failed patch[m
When you have resolved this problem run "git bz apply --continue".
If you would prefer to skip this patch, instead run "git bz apply --skip".
To restore the original branch and stop patching run "git bz apply --abort".
Patch left in /tmp/Bug-37344-Add-a-real-solution-for-discharge-cancel-i1tqnky4.patch

Cannot apply cleanly patches from bug 37344. Everything will be left dirty.
git bz apply --continue will not continue the process if patches from other bug reports need to be applied.

DEV atomic update /kohadevbox/koha/installer/data/mysql/atomicupdate/bug_37344.pl  [13:43:43]
	[31mERROR: {UNKNOWN}: Can't use an undefined value as a subroutine reference at /kohadevbox/koha/C4/Installer.pm line 769. at /kohadevbox/koha/C4/Installer.pm line 771
	[0m