Bug 39721: Changes suggestion_ref in order to remove it

suggestion_ref is quite messy, it needs to be reworked in order to use
objects in suggestion.pl.

As far as I studied, it is used as
- the whole input from forms,
- the default content to input in a form
- the content that will be amended in order to propose another hash to
  modSuggestion. However, ModSuggestion will be removed so we don't need
  such a hash
- every suggestion that need to be updated using the "change selected
  suggestion" tool
- create the object suggestion_only, whose purpose is still unclear to
  me.

As a result it is created by :
> 25 my $suggestion_ref = { $input->Vars };
And by removing a number of keys depending on the use of suggestion_ref
in the script.

In this patch, we remove every code made to use suggestion_ref as the
source object for form and use another variable, $stored_suggestion which is an object.

In next patch we aim at fully removing $suggestion_ref, which is still
used by ModSuggestion

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Baptiste Wojtkowski 2025-08-08 15:43:50 +02:00 committed by Lucas Gass
parent 1a5bb27e8a
commit ba0b968a5a
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
4 changed files with 207 additions and 199 deletions

View File

@ -170,6 +170,21 @@ sub manager {
return Koha::Patron->_new_from_dbic($manager_rs);
}
=head3 accepter
my $accepter = $suggestion->accepter;
Returns the accepter of the suggestion (Koha::Patron for acceptedby field)
=cut
sub accepter {
my ($self) = @_;
my $manager_rs = $self->_result->acceptedby;
return unless $manager_rs;
return Koha::Patron->_new_from_dbic($manager_rs);
}
=head3 rejecter
my $rejecter = $suggestion->rejecter;

View File

@ -13,7 +13,7 @@
<title
>[% FILTER collapse %]
[% IF op == 'save' %]
[% IF ( suggestionid ) %]
[% IF ( suggestion.suggestionid ) %]
[% tx("Edit suggestion #{suggestion_number}", { suggestion_number = suggestionid }) | html %]
&rsaquo;
[% ELSE %]
@ -74,9 +74,9 @@
[% END %]
[% END %]
[% IF op == 'save' %]
[% IF ( suggestionid ) %]
[% IF ( suggestion.suggestionid ) %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
<span>Edit suggestion #[% suggestionid | html %]</span>
<span>Edit suggestion #[% suggestion.suggestionid | html %]</span>
[% END %]
[% ELSE %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
@ -85,7 +85,7 @@
[% END %]
[% ELSIF ( op == 'show' ) %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
<span>Show suggestion #[% suggestionid | html %]</span>
<span>Show suggestion #[% suggestion.suggestionid | html %]</span>
[% END %]
[% ELSE %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
@ -103,13 +103,13 @@
<div id="toolbar" class="btn-toolbar">
[% IF CAN_user_suggestions_suggestions_manage %]
<a class="btn btn-default" id="editsuggestion" href="suggestion.pl?op=edit_form&amp;suggestionid=[% suggestionid | html %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
<a class="btn btn-default" id="editsuggestion" href="suggestion.pl?op=edit_form&amp;suggestionid=[% suggestion.suggestionid | html %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
[% END %]
[% IF CAN_user_suggestions_suggestions_delete %]
<form class="delete_form" method="post" action="/cgi-bin/koha/suggestion/suggestion.pl">
[% INCLUDE 'csrf-token.inc' %]
<input type="hidden" name="op" value="cud-delete" />
<input type="hidden" name="suggestionid" value="[% suggestionid | html %]" />
<input type="hidden" name="suggestionid" value="[% suggestion.suggestionid | html %]" />
<button type="submit" class="btn btn-default deletesuggestion"><i class="fa fa-trash-can"></i> Delete</button>
</form>
[% END %]
@ -118,78 +118,78 @@
<fieldset class="rows">
<legend>Bibliographic information</legend>
<ol>
[% IF ( title ) %]
[% IF ( suggestion.title ) %]
<li>
<span class="label">Title:</span>
[% IF suggestion.biblionumber %]
<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% suggestion.biblionumber | uri %]">[% suggestion.title | html %]</a>
[% ELSE %]
[% title | html %]
[% suggestion.title | html %]
[% END %]
</li>
[% END %]
[% IF ( author ) %]
[% IF ( suggestion.author ) %]
<li>
<span class="label">Author:</span>
[% author | html %]
[% suggestion.author | html %]
</li>
[% END %]
[% IF ( copyrightdate ) %]
[% IF ( suggestion.copyrightdate ) %]
<li>
<span class="label">Copyright date:</span>
[% copyrightdate | html %]
[% suggestion.copyrightdate | html %]
</li>
[% END %]
[% IF ( isbn ) %]
[% IF ( suggestion.isbn ) %]
<li>
<span class="label">ISBN or ISSN or other standard number:</span>
[% isbn | html %]
[% suggestion.isbn | html %]
</li>
[% END %]
[% IF ( publishercode ) %]
[% IF ( suggestion.publishercode ) %]
<li>
<span class="label">Publisher:</span>
[% publishercode | html %]
[% suggestion.publishercode | html %]
</li>
[% END %]
[% IF ( place ) %]
[% IF ( suggestion.place ) %]
<li>
<span class="label">Publication place:</span>
[% place | html %]
[% suggestion.place | html %]
</li>
[% END %]
[% IF ( collectiontitle ) %]
[% IF ( suggestion.collectiontitle ) %]
<li>
<span class="label">Collection title:</span>
[% collectiontitle | html %]
[% suggestion.collectiontitle | html %]
</li>
[% END %]
[% IF ( itemtype ) %]
[% IF ( suggestion.itemtype ) %]
<li>
<span class="label">Document type:</span>
[% AuthorisedValues.GetByCode( 'SUGGEST_FORMAT', itemtype, 0 ) | html %]
[% AuthorisedValues.GetByCode( 'SUGGEST_FORMAT', suggestion.itemtype, 0 ) | html %]
</li>
[% END %]
[% IF ( patron_reason_loop ) %]
<li>
<span class="label">Reason for suggestion: </span>
[% FOREACH patron_reason_loo IN patron_reason_loop %]
[% IF patron_reason_loo.authorised_value == patronreason %]
[% IF patron_reason_loo.authorised_value == suggestion.patronreason %]
[% patron_reason_loo.lib | html %]
[% END %]
[% END %]
</li>
[% END %]
[% IF ( note ) %]
[% IF ( suggestion.note ) %]
<li>
<span class="label">Notes:</span>
[% note | html %]
[% suggestion.note | html %]
</li>
[% END %]
[% IF ( staff_note ) %]
[% IF ( suggestion.staff_note ) %]
<li>
<span class="label">Notes:</span>
[% staff_note | html %]
[% suggestion.staff_note | html %]
</li>
[% END %]
</ol>
@ -201,27 +201,27 @@
<li>
<span class="label">Status:</span>
[% SET status_found = 0 %]
[% IF ( STATUS == 'ASKED' ) %]
[% IF ( suggestion.STATUS == 'ASKED' ) %]
<span>Pending</span>
[% SET status_found = 1 %]
[% ELSIF ( STATUS == 'ACCEPTED' ) %]
[% ELSIF ( suggestion.STATUS == 'ACCEPTED' ) %]
<span>Accepted</span>
[% SET status_found = 1 %]
[% ELSIF ( STATUS == 'CHECKED' ) %]
[% ELSIF ( suggestion.STATUS == 'CHECKED' ) %]
<span>Checked</span>
[% SET status_found = 1 %]
[% ELSIF ( STATUS == 'REJECTED' ) %]
[% ELSIF ( suggestion.STATUS == 'REJECTED' ) %]
<span>Rejected</span>
[% SET status_found = 1 %]
[% ELSIF ( STATUS == 'ORDERED' ) %]
[% ELSIF ( suggestion.STATUS == 'ORDERED' ) %]
<span>Ordered</span>
[% SET status_found = 1 %]
[% ELSIF ( STATUS == 'AVAILABLE' ) %]
[% ELSIF ( suggestion.STATUS == 'AVAILABLE' ) %]
<span>Available</span>
[% SET status_found = 1 %]
[% ELSE %]
[% FOREACH s IN SuggestionStatuses %]
[% IF STATUS == s.authorised_value %]
[% IF suggestion.STATUS == s.authorised_value %]
[% s.lib | html %]
[% SET status_found = 1 %]
[% END %]
@ -247,49 +247,49 @@
<tbody>
<tr>
<th>[% tp('purchase suggestion created by', 'Created by:') | html %]</th>
<td>[% suggesteddate | $KohaDates %]</td>
<td>[% suggestion.suggesteddate | $KohaDates %]</td>
<td>
[% IF ( suggestedby_patron.borrowernumber ) %]
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_patron.borrowernumber | uri %]"
>[% suggestedby_patron.surname | html %], [% suggestedby_patron.firstname | html %] ([% suggestedby_patron.cardnumber | html %])</a
[% IF ( suggestion.suggester.borrowernumber ) %]
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestion.suggester.borrowernumber | uri %]"
>[% suggestion.suggester.surname | html %], [% suggestion.suggester.firstname | html %] ([% suggestion.suggester.cardnumber | html %])</a
>
[% Branches.GetName( suggestedby_patron.branchcode ) | html %] ([% suggestedby_patron.category.description | html %])
[% Branches.GetName( suggestion.suggester.branchcode ) | html %] ([% suggestion.suggester.category.description | html %])
[% END %]
</td>
</tr>
<tr>
<th>Managed by:</th>
<td>[% manageddate | $KohaDates %]</td>
<td>[% suggestion.manageddate | $KohaDates %]</td>
<td>
[% IF ( managedby_patron.borrowernumber ) %]
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_patron.borrowernumber | uri %]"
>[% managedby_patron.surname | html %], [% managedby_patron.firstname | html %] ([% managedby_patron.cardnumber | html %])</a
[% IF ( suggestion.manager.borrowernumber ) %]
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestion.manager.borrowernumber | uri %]"
>[% suggestion.manager.surname | html %], [% suggestion.manager.firstname | html %] ([% suggestion.manager.cardnumber | html %])</a
>
[% Branches.GetName( managedby_patron.branchcode ) | html %] ([% managedby_patron.category.description | html %])
[% Branches.GetName( suggestion.manager.branchcode ) | html %] ([% suggestion.manager.category.description | html %])
[% END %]
</td>
</tr>
<tr>
<th>Accepted on:</th>
<td>[% accepteddate | $KohaDates %]</td>
<td>[% suggestion.accepteddate | $KohaDates %]</td>
<td>
[% IF ( acceptedby_patron.borrowernumber ) %]
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_patron.borrowernumber | uri %]"
>[% acceptedby_patron.surname | html %], [% acceptedby_patron.firstname | html %] ([% acceptedby_patron.cardnumber | html %])</a
[% IF ( suggestion.accepter.borrowernumber ) %]
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestion.accepter.borrowernumber | uri %]"
>[% suggestion.accepter.surname | html %], [% suggestion.accepter.firstname | html %] ([% suggestion.accepter.cardnumber | html %])</a
>
[% Branches.GetName( acceptedby_patron.branchcode ) | html %] ([% acceptedby_patron.category.description | html %])
[% Branches.GetName( suggestion.accepter.branchcode ) | html %] ([% suggestion.accepter.category.description | html %])
[% END %]
</td>
</tr>
<tr>
<th>Last modification on:</th>
<td>[% lastmodificationdate | $KohaDates %]</td>
<td>[% suggestion.lastmodificationdate | $KohaDates %]</td>
<td>
[% IF ( lastmodificationby_patron.borrowernumber ) %]
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% lastmodificationby_patron.borrowernumber | uri %]"
>[% lastmodificationby_patron.surname | html %], [% lastmodificationby_patron.firstname | html %] ([% lastmodificationby_patron.cardnumber | html %])</a
[% IF ( suggestion.last_modifier.borrowernumber ) %]
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestion.last_modifier.borrowernumber | uri %]"
>[% suggestion.last_modifier.surname | html %], [% suggestion.last_modifier.firstname | html %] ([% suggestion.last_modifier.cardnumber | html %])</a
>
[% Branches.GetName( lastmodificationby_patron.branchcode ) | html %] ([% lastmodificationby_patron.category.description | html %])
[% Branches.GetName( suggestion.last_modifier.branchcode ) | html %] ([% suggestion.last_modifier.category.description | html %])
[% END %]
</td>
</tr>
@ -302,27 +302,27 @@
<ol>
<li>
<span class="label">Library:</span>
[% Branches.GetName( branchcode ) | html %]
[% Branches.GetName( suggestion.branchcode ) | html %]
</li>
<li>
<span class="label">Fund:</span>
[% budgetname | html %]
[% suggestion.fund.budget_name | html %]
</li>
<li>
<span class="label">Copies:</span>
[% quantity | html %]
[% suggestion.quantity | html %]
</li>
<li>
<span class="label">Currency:</span>
[% currency | html %]
[% suggestion.currency | html %]
</li>
<li>
<span class="label">Price:</span>
[% price | $Price %]
[% suggestion.price | $Price %]
</li>
<li>
<span class="label">Total</span>
[% total | $Price %]
[% suggestion.total | $Price %]
</li>
</ol>
</fieldset>
@ -373,9 +373,9 @@
[% INCLUDE 'csrf-token.inc' %]
<input type="hidden" name="redirect" id="redirect" value="[% redirect | html %]" />
<input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber | html %]" />
[% IF ( suggestionid ) %]
<h1>Edit purchase suggestion #[% suggestionid | html %]</h1>
<input type="hidden" name="suggestionid" value="[% suggestionid | html %]" />
[% IF ( suggestion.suggestionid ) %]
<h1>Edit purchase suggestion #[% suggestion.suggestionid | html %]</h1>
<input type="hidden" name="suggestionid" value="[% suggestion.suggestionid | html %]" />
[% ELSE %]
<h1>Enter a new purchase suggestion</h1>
[% END %]
@ -385,36 +385,36 @@
<ol>
<li>
<label for="title" class="required">Title:</label>
<input type="text" id="title" name="title" size="80" maxlength="255" value="[% title | html %]" required="required" class="required" />
<input type="text" id="title" name="title" size="80" maxlength="255" value="[% suggestion.title | html %]" required="required" class="required" />
<span class="required">Required</span>
</li>
<li>
<label for="author">Author:</label>
<input type="text" id="author" name="author" size="50" maxlength="80" value="[% author | html %]" />
<input type="text" id="author" name="author" size="50" maxlength="80" value="[% suggestion.author | html %]" />
</li>
<li>
<label for="copyrightdate">Copyright date:</label>
<input type="text" id="copyrightdate" name="copyrightdate" size="4" maxlength="4" value="[% copyrightdate | html %]" />
<input type="text" id="copyrightdate" name="copyrightdate" size="4" maxlength="4" value="[% suggestion.copyrightdate | html %]" />
</li>
<li>
<label for="isbn">ISBN or ISSN or other standard number:</label>
<input type="text" id="isbn" name="isbn" size="50" maxlength="80" value="[% isbn | html %]" />
<input type="text" id="isbn" name="isbn" size="50" maxlength="80" value="[% suggestion.isbn | html %]" />
</li>
<li>
<label for="publishercode">Publisher:</label>
<input type="text" id="publishercode" name="publishercode" size="50" maxlength="80" value="[% publishercode | html %]" />
<input type="text" id="publishercode" name="publishercode" size="50" maxlength="80" value="[% suggestion.publishercode | html %]" />
</li>
<li>
<label for="place">Publication place:</label>
<input type="text" id="place" name="place" size="50" maxlength="80" value="[% place | html %]" />
<input type="text" id="place" name="place" size="50" maxlength="80" value="[% suggestion.place | html %]" />
</li>
<li>
<label for="collectiontitle">Collection title:</label>
<input type="text" id="collectiontitle" name="collectiontitle" size="50" maxlength="80" value="[% collectiontitle | html %]" />
<input type="text" id="collectiontitle" name="collectiontitle" size="50" maxlength="80" value="[% suggestion.collectiontitle | html %]" />
</li>
<li>
<label for="itemtype">Document type:</label>
[% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size=20, default=itemtype, empty=1 %]
[% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size=20, default=suggestion.itemtype, empty=1 %]
</li>
[% IF patron_reason_loop %]
<li>
@ -422,7 +422,7 @@
<select name="patronreason" id="patronreason">
<option value=""> -- Choose -- </option>
[% FOREACH patron_reason_loo IN patron_reason_loop %]
[% IF patron_reason_loo.authorised_value == patronreason %]
[% IF patron_reason_loo.authorised_value == suggestion.patronreason %]
<option value="[% patron_reason_loo.authorised_value | html %]" selected="selected">[% patron_reason_loo.lib | html %]</option>
[% ELSE %]
<option value="[% patron_reason_loo.authorised_value | html %]">[% patron_reason_loo.lib | html %]</option>
@ -433,11 +433,11 @@
[% END # /IF patron_reason_loop %]
<li>
<label for="note">Notes:</label>
<textarea name="note" id="note" rows="5" cols="40">[% note | html %]</textarea>
<textarea name="note" id="note" rows="5" cols="40">[% suggestion.note | html %]</textarea>
</li>
<li>
<label for="note">Non-public notes:</label>
<textarea name="staff_note" id="staff_note" rows="5" cols="40">[% staff_note | html %]</textarea>
<textarea name="staff_note" id="staff_note" rows="5" cols="40">[% suggestion.staff_note | html %]</textarea>
</li>
</ol>
</fieldset>
@ -445,7 +445,7 @@
<fieldset class="rows">
<legend>Suggestion management</legend>
<ol>
[% IF ( suggestionid ) %]
[% IF ( suggestion.suggestionid ) %]
<li>
<label for="STATUS">Status:</label>
<select id="STATUS" name="STATUS">
@ -500,7 +500,7 @@
<label for="reason">Reason:</label>
<select class="select-reason" id="reason" name="reason">
<option value=""> -- Choose a reason -- </option>
[% FOREACH reasonsloo IN suggestion.reasonsloop %]
[% FOREACH reasonsloo IN reasonsloop %]
[% IF (reasonsloo.lib == suggestion.reason) %]
<option value="[% reasonsloo.lib | html %]" selected="selected">[% reasonsloo.lib | html %]</option>
[% ELSE %]
@ -535,14 +535,30 @@
<th>
<label for="suggesteddate">[% tp('purchase suggestion created by', 'Created by:') | html %]</label>
</th>
<td> <input type="text" id="suggesteddate" name="suggesteddate" class="flatpickr" size="10" maxlength="10" value="[% suggesteddate | html %]" /> [% INCLUDE 'date-format.inc' %] </td>
<td>
<input
type="text"
id="suggesteddate"
name="suggesteddate"
class="flatpickr"
size="10"
maxlength="10"
value="[% default_suggesteddate ? default_suggesteddate : suggestion.suggesteddate | html %]"
/>
[% INCLUDE 'date-format.inc' %]
</td>
<td id="tdsuggestedby">
<input type="hidden" id="suggestedby" name="suggestedby" value="[% suggestedby | html %]" />
[% IF ( suggestedby_patron.borrowernumber ) %]
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_patron.borrowernumber | uri %]"
>[% suggestedby_patron.surname | html %], [% suggestedby_patron.firstname | html %] ([% suggestedby_patron.cardnumber | html %])</a
<input type="hidden" id="suggestedby" name="suggestedby" value="[% suggestion.suggestedby | html %]" />
[% IF ( suggestion.suggester.borrowernumber ) %]
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestion.suggester.borrowernumber | uri %]"
>[% suggestion.suggester.surname | html %], [% suggestion.suggester.firstname | html %] ([% suggestion.suggester.cardnumber | html %])</a
>
[% Branches.GetName( suggestedby_patron.branchcode ) | html %] ([% suggestedby_patron.category.description | html %])
[% Branches.GetName( suggestion.suggester.branchcode ) | html %] ([% suggestion.suggester.category.description | html %])
[% ELSIF ( default_suggester ) %]
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% default_suggester.borrowernumber | uri %]"
>[% default_suggester.surname | html %], [% default_suggester.firstname | html %] ([% default_suggester.cardnumber | html %])</a
>
[% Branches.GetName( default_suggester.branchcode ) | html %] ([% default_suggester.category.description | html %])
[% END %]
</td>
<td>
@ -553,14 +569,14 @@
<th>
<label for="accepteddate">Accepted on:</label>
</th>
<td> <input type="text" id="accepteddate" name="accepteddate" class="flatpickr" size="10" maxlength="10" value="[% accepteddate | html %]" />[% INCLUDE 'date-format.inc' %] </td>
<td> <input type="text" id="accepteddate" name="accepteddate" class="flatpickr" size="10" maxlength="10" value="[% suggestion.accepteddate | html %]" />[% INCLUDE 'date-format.inc' %] </td>
<td>
<input type="hidden" id="acceptedby" name="acceptedby" value="[% acceptedby | html %]" />
[% IF ( acceptedby_patron.borrowernumber ) %]
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_patron.borrowernumber | uri %]"
>[% acceptedby_patron.surname | html %], [% acceptedby_patron.firstname | html %] ([% acceptedby_patron.cardnumber | html %])</a
<input type="hidden" id="acceptedby" name="acceptedby" value="[% suggestion.acceptedby | html %]" />
[% IF ( suggestion.accepter.borrowernumber ) %]
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestion.accepter.borrowernumber | uri %]"
>[% suggestion.accepter.surname | html %], [% suggestion.accepter.firstname | html %] ([% suggestion.accepter.cardnumber | html %])</a
>
[% Branches.GetName( acceptedby_patron.branchcode ) | html %] ([% acceptedby_patron.category.description | html %])
[% Branches.GetName( suggestion.accepter.branchcode ) | html %] ([% suggestion.accepter.category.description | html %])
[% END %]
</td>
<td></td>
@ -569,12 +585,12 @@
<th>
<label for="lastmodificationdate">Last modification on:</label>
</th>
<td> [% lastmodificationdate | $KohaDates %] </td>
<td> [% suggestion.lastmodificationdate | $KohaDates %] </td>
<td>
[% IF lastmodificationby_patron %]
[% INCLUDE 'patron-title.inc' patron=lastmodificationby_patron hide_patron_infos_if_needed=1 %]
[% Branches.GetName( lastmodificationby_patron.branchcode ) | html %]
([% lastmodificationby_patron.category.description | html %])
[% IF suggestion.last_modifier %]
[% INCLUDE 'patron-title.inc' patron=suggestion.last_modifier hide_patron_infos_if_needed=1 %]
[% Branches.GetName( suggestion.last_modifier.branchcode ) | html %]
([% suggestion.last_modifier.category.description | html %])
[% END %]
</td>
<td></td>
@ -584,7 +600,7 @@
</li>
<li>
<label for="managedon">Managed on:</label>
<input type="text" id="managedon" name="manageddate" class="flatpickr" size="10" maxlength="10" value="[% manageddate | html %]" />[% INCLUDE 'date-format.inc' %]
<input type="text" id="managedon" name="manageddate" class="flatpickr" size="10" maxlength="10" value="[% default_manageddate | html %]" />[% INCLUDE 'date-format.inc' %]
</li>
<li>
<label for="managedby_name">by:</label>
@ -596,13 +612,13 @@
Nobody
[% END %]
</span>
[% IF managedby_patron.borrowernumber && logged_in_user.borrowernumber != managedby_patron.borrowernumber %]
| Previously was [% INCLUDE 'patron-title.inc' patron=managedby_patron hide_patron_infos_if_needed=1 %] [% Branches.GetName( managedby_patron.branchcode ) | html %]
([% managedby_patron.category.description | html %])
[% IF suggestion.manager.borrowernumber && logged_in_user.borrowernumber != suggestion.manager.borrowernumber %]
| Previously was [% INCLUDE 'patron-title.inc' patron=suggestion.manager hide_patron_infos_if_needed=1 %] [% Branches.GetName( suggestion.manager.branchcode ) | html %]
([% suggestion.manager.category.description | html %])
[% END %]
<br />
<a href="#patron_search_modal_manager" id="edit_manager" data-bs-toggle="modal"><i class="fa fa-search"></i> Select manager</a>
[% IF managedby_patron.borrowernumber && logged_in_user.borrowernumber != managedby_patron.borrowernumber %]
[% IF suggestion.manager.borrowernumber && logged_in_user.borrowernumber != suggestion.manager.borrowernumber %]
<a id="restore_previous_manager" href="#"><i class="fa fa-trash-can"></i> Keep existing manager</a>
[% END %]
[% IF CAN_user_suggestions_suggestions_manage %]
@ -632,13 +648,13 @@
<label for="branchcode">Library:</label>
<select name="branchcode" id="branchcode">
<option value="">Any</option>
[% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
[% PROCESS options_for_libraries libraries => Branches.all( selected => suggestion.branchcode ) %]
</select>
</li>
<li> [% PROCESS funds_dropdown %] </li>
<li>
<label for="quantity">Copies:</label>
<input type="text" size="10" id="quantity" name="quantity" value="[% quantity | html %]" />
<input type="text" size="10" id="quantity" name="quantity" value="[% suggestion.quantity | html %]" />
</li>
<li>
<label for="currency">Currency:</label>
@ -648,7 +664,7 @@
[% END %]
<select name="currency" id="currency">
[% FOREACH c IN currencies %]
[% IF suggestionid and suggestion.currency == c.currency or not suggestionid and c.active %]
[% IF suggestion.suggestionid and suggestion.currency == c.currency or not suggestion.suggestionid and c.active %]
<option value="[% c.currency | html %]" selected="selected">[% c.currency | html %]</option>
[% ELSIF not c.archived %]
<option value="[% c.currency | html %]">[% c.currency | html %]</option>
@ -658,11 +674,11 @@
</li>
<li>
<label for="price">Price:</label>
<input class="decimal" type="text" size="20" name="price" id="price" value="[% price | $Price on_editing => 1 %]" />
<input class="decimal" type="text" size="20" name="price" id="price" value="[% suggestion.price | $Price on_editing => 1 %]" />
</li>
<li>
<label for="total">Total: </label>
<input type="text" readonly="readonly" id="total" name="total" size="10" value="[% total | html %]" />
<input type="text" readonly="readonly" id="total" name="total" size="10" value="[% suggestion.total | html %]" />
</li>
</ol>
</fieldset>
@ -670,7 +686,7 @@
<fieldset class="action">
<input type="hidden" id="returnsuggested" name="returnsuggested" value="[% IF ( returnsuggestedby ) %][% returnsuggestedby | html %][% ELSE %]no_one[% END %]" />
[% IF ( suggestionid ) %]
[% IF ( suggestion.suggestionid ) %]
<input type="hidden" name="op" value="cud-save" />
[% IF ( need_confirm ) %]
<input type="hidden" name="save_confirmed" value="1" />
@ -698,7 +714,7 @@
[% IF op == 'else' %]
<div id="toolbar" class="btn-toolbar">
[% IF CAN_user_suggestions_suggestions_create %]
<a class="btn btn-default" id="newsuggestion" href="suggestion.pl?op=add_form&branchcode=[% branchcode | uri %]"><i class="fa fa-plus"></i> New purchase suggestion</a>
<a class="btn btn-default" id="newsuggestion" href="suggestion.pl?op=add_form&branchcode=[% suggestion.branchcode | uri %]"><i class="fa fa-plus"></i> New purchase suggestion</a>
[% END %]
</div>
@ -862,7 +878,7 @@
<label for="choosereason-[% suggestion.suggestiontype | html %]">with this reason:</label>
<select name="reason" id="choosereason-[% suggestion.suggestiontype | html %]">
<option value=""> -- Choose a reason -- </option>
[% FOREACH reasonsloo IN suggestion.reasonsloop %]
[% FOREACH reasonsloo IN reasonsloop %]
<option value="[% reasonsloo.lib | html %]">[% reasonsloo.lib | html %]</option>
[% END %]
<option value="other">Others...</option>
@ -972,7 +988,7 @@
<li>
<label for="displayby" class="sr-only">Organize by: </label>
<select name="displayby" id="displayby">
[% IF ( displayby == "STATUS" ) %]
[% IF ( displayby == "suggestion.STATUS" ) %]
<option value="STATUS" selected="selected">Status</option>
[% ELSE %]
<option value="STATUS">Status</option>
@ -1015,27 +1031,27 @@
<ol>
<li>
<label for="title"> Title:</label>
<input type="text" id="title" name="title" value="[% title | html %]" />
<input type="text" id="title" name="title" value="[% suggestion.title | html %]" />
</li>
<li>
<label for="author"> Author:</label>
<input type="text" id="author" name="author" value="[% author | html %]" />
<input type="text" id="author" name="author" value="[% suggestion.author | html %]" />
</li>
<li>
<label for="isbn"> ISBN:</label>
<input type="text" id="isbn" name="isbn" value="[% isbn | html %]" />
<input type="text" id="isbn" name="isbn" value="[% suggestion.isbn | html %]" />
</li>
<li>
<label for="publishercode"> Publisher:</label>
<input type="text" id="publishercode" name="publishercode" value="[% publishercode | html %]" />
<input type="text" id="publishercode" name="publishercode" value="[% suggestion.publishercode | html %]" />
</li>
<li>
<label for="copyrightdate_filter"> Copyright date:</label>
<input type="text" id="copyrightdate_filter" name="copyrightdate" value="[% copyrightdate | html %]" />
<input type="text" id="copyrightdate_filter" name="copyrightdate" value="[% suggestion.copyrightdate | html %]" />
</li>
<li>
<label for="collectiontitle"> Collection title:</label>
<input type="text" id="collectiontitle" name="collectiontitle" value="[% collectiontitle | html %]" />
<input type="text" id="collectiontitle" name="collectiontitle" value="[% suggestion.collectiontitle | html %]" />
</li>
</ol>
</fieldset>
@ -1106,11 +1122,11 @@
</li>
<li>
<label for="suggesteddate_from">Suggested date from:</label>
<input type="text" id="suggesteddate_from" size="10" name="suggesteddate_from" value="[% suggesteddate_from | html %]" data-date_to="suggesteddate_to" class="flatpickr" />
<input type="text" id="suggesteddate_from" size="10" name="suggesteddate_from" value="[% suggestion.suggesteddate_from | html %]" data-date_to="suggesteddate_to" class="flatpickr" />
</li>
<li>
<label for="suggesteddate_to">To:</label>
<input type="text" id="suggesteddate_to" size="10" name="suggesteddate_to" value="[% suggesteddate_to | html %]" class="flatpickr" />
<input type="text" id="suggesteddate_to" size="10" name="suggesteddate_to" value="[% suggestion.suggesteddate_to | html %]" class="flatpickr" />
</li>
<li>
<label for="managedby"> Managed by:</label>
@ -1213,7 +1229,7 @@
[% UNLESS op == 'save' %]
<option value="">Any</option>
[% END %]
[% IF budgetid == '__NONE__' %]
[% IF suggestion.budgetid == '__NONE__' %]
<option value="__NONE__" selected="selected">None</option>
[% ELSE %]
<option value="__NONE__">None</option>
@ -1259,8 +1275,8 @@
[% IF op == "save" %]
var notify = $('#notify');
if ( notify.length ) {
[% IF managedby_patron %]
if ( borrowernumber == [% logged_in_user.borrowernumber | html %] || borrowernumber == [% managedby_patron.borrowernumber | html %] ) {
[% IF suggestion.manager %]
if ( borrowernumber == [% logged_in_user.borrowernumber | html %] || borrowernumber == [% suggestion.manager.borrowernumber | html %] ) {
[% ELSE %]
if ( borrowernumber == [% logged_in_user.borrowernumber | html %] ) {
[% END %]
@ -1666,12 +1682,12 @@
$("#managedby_name").empty();
$("#managedby").val('');
var borrowername = "[% managedby_patron.firstname | html %] [% managedby_patron.surname | html %]";
var borrowername = "[% suggestion.manager.firstname | html %] [% suggestion.manager.surname | html %]";
var managerlink = '<a href="/cgi-bin/koha/members/moremember.pl'
+ '?borrowernumber=[% managedby_patron.borrowernumber | html %]">'
+ '?borrowernumber=[% suggestion.manager.borrowernumber | html %]">'
+ borrowername + '</a>';
$('#managedby_name').html(managerlink);
$('#managedby').val([% managedby_patron.borrowernumber | html %]);
$('#managedby').val([% suggestion.manager.borrowernumber | html %]);
$('#notify').prop('checked', false).prop('disabled', true);
});

View File

@ -37,24 +37,6 @@ use Koha::Token;
use URI::Escape qw( uri_escape );
sub Init {
my $suggestion = shift @_;
# "Managed by" is used only when a suggestion is being edited (not when created)
if ( $suggestion->{'suggesteddate'} eq "" ) {
# new suggestion
$suggestion->{suggesteddate} = dt_from_string;
$suggestion->{'suggestedby'} = C4::Context->userenv->{"number"} unless ( $suggestion->{'suggestedby'} );
} else {
# editing of an existing suggestion
$suggestion->{manageddate} = dt_from_string;
$suggestion->{'managedby'} = C4::Context->userenv->{"number"} unless ( $suggestion->{'managedby'} );
}
$suggestion->{'branchcode'} = C4::Context->userenv->{"branch"} unless ( $suggestion->{'branchcode'} );
}
sub GetCriteriumDesc {
my ( $criteriumvalue, $displayby ) = @_;
if ( $displayby =~ /status/i ) {
@ -118,6 +100,11 @@ if ( !$valid_displayby{$displayby} ) {
my $reasonsloop = GetAuthorisedValues("SUGGEST");
my $suggestion_ref = { $input->Vars };
my $stored_suggestion;
unless ( $op eq "cud-update_status" ) {
$stored_suggestion = Koha::Suggestions->find( $input->param('suggestionid') ) if $input->param('suggestionid');
}
delete $suggestion_ref->{$_} for qw(csrf_token suggestion_itemtype suggestion_managedby table_1_length);
# get only the columns of Suggestion
@ -134,6 +121,7 @@ foreach my $key ( keys %$suggestion_ref ) {
delete $suggestion_ref->{$key} if ( !$suggestion_ref->{$key} && ( $op eq 'else' ) );
delete $suggestion_ref->{$key} if $key =~ m{^DataTables_acqui_suggestions_suggestions};
}
delete $suggestion_only->{branchcode} if $suggestion_only->{branchcode} eq '__ANY__';
delete $suggestion_only->{budgetid} if $suggestion_only->{budgetid} eq '__ANY__';
@ -183,10 +171,6 @@ if ( $op =~ /cud-save/ ) {
$template->param(
messages => \@messages,
);
delete $suggestion_ref->{suggesteddate};
delete $suggestion_ref->{manageddate};
delete $suggestion_ref->{managedby};
Init($suggestion_ref);
} elsif ( !$suggestion_only->{suggestionid}
&& ( my ( $duplicatebiblionumber, $duplicatetitle ) = FindDuplicate($biblio) )
&& !$save_confirmed )
@ -197,9 +181,6 @@ if ( $op =~ /cud-save/ ) {
messages => \@messages,
need_confirm => 1
);
delete $suggestion_ref->{suggesteddate};
delete $suggestion_ref->{manageddate};
Init($suggestion_ref);
$op = 'save';
} else {
@ -296,23 +277,27 @@ if ( $op =~ /cud-save/ ) {
}
} elsif ( $op eq 'add_form' ) {
#Adds suggestion
Init($suggestion_ref);
$template->param(
default_suggester => $librarian,
default_suggesteddate => dt_from_string,
default_branch => C4::Context->userenv->{"branch"},
);
$op = 'save';
} elsif ( $op eq 'edit_form' ) {
#Edit suggestion
$suggestion_ref = Koha::Suggestions->find( $suggestion_ref->{suggestionid} )->unblessed();
$suggestion_ref->{reasonsloop} = $reasonsloop;
my $other_reason = 1;
foreach my $reason ( @{$reasonsloop} ) {
if ( $suggestion_ref->{reason} eq $reason->{lib} ) {
if ( $stored_suggestion->reason eq $reason->{lib} ) {
$other_reason = 0;
}
}
$other_reason = 0 unless $suggestion_ref->{reason};
$template->param( other_reason => $other_reason );
Init($suggestion_ref);
$other_reason = 0 unless $stored_suggestion->reason;
$template->param(
other_reason => $other_reason,
default_manageddate => dt_from_string,
default_branch => C4::Context->userenv->{"branch"},
);
$op = 'save';
} elsif ( $op eq "cud-update_status" ) {
my $suggestion;
@ -394,11 +379,6 @@ if ( $op =~ /cud-save/ ) {
push @messages, { type => 'error', code => 'no_manage_permission' };
$template->param( messages => \@messages, );
}
} elsif ( $op eq 'show' ) {
$suggestion_ref = Koha::Suggestions->find( $suggestion_ref->{suggestionid} )->unblessed();
my $budget = GetBudget $$suggestion_ref{budgetid};
$$suggestion_ref{budgetname} = $$budget{budget_name};
Init($suggestion_ref);
}
if ( $op eq 'else' ) {
@ -518,7 +498,6 @@ if ( $op eq 'else' ) {
{
"suggestiontype" => $criteriumvalue || "suggest",
"suggestiontypelabel" => GetCriteriumDesc( $criteriumvalue, $displayby ) || "",
'reasonsloop' => $reasonsloop,
'search_params' => $criterium_search_params,
'tab_count' => $tab_counts->{$criteriumvalue},
}
@ -534,13 +513,11 @@ if ( $op eq 'else' ) {
);
}
$template->param( "${_}_patron" => scalar Koha::Patrons->find( $suggestion_ref->{$_} ) )
for qw(managedby suggestedby acceptedby lastmodificationby);
$template->param(
%$suggestion_ref,
suggestion => $stored_suggestion,
filter_archived => $filter_archived,
"op" => $op,
reasonsloop => $reasonsloop,
);
if ( defined($returnsuggested) and $returnsuggested ne "no_one" ) {
@ -584,7 +561,7 @@ if ( $suggestion_ref->{STATUS} ) {
my $currencies = Koha::Acquisition::Currencies->search;
$template->param(
currencies => $currencies,
suggestion => $suggestion_ref,
suggestion => $stored_suggestion,
price => sprintf( "%.2f", $$suggestion_ref{'price'} || 0 ),
total => sprintf( "%.2f", $$suggestion_ref{'total'} || 0 ),
);

View File

@ -177,16 +177,16 @@ isnt( $my_suggestionid, 0, 'Suggestion is correctly saved' );
my $my_suggestion_with_budget_object = Koha::Suggestion->new($my_suggestion_with_budget)->store;
my $my_suggestionid_with_budget = $my_suggestion_with_budget_object->id;
my $suggestion = Koha::Suggestions->find($my_suggestionid)->unblessed();
is( $suggestion->{title}, $my_suggestion->{title}, 'Suggestion stores the title correctly' );
is( $suggestion->{author}, $my_suggestion->{author}, 'Suggestion stores the author correctly' );
is( $suggestion->{publishercode}, $my_suggestion->{publishercode}, 'Suggestion stores the publishercode correctly' );
is( $suggestion->{suggestedby}, $my_suggestion->{suggestedby}, 'Suggestion stores the borrower number correctly' );
is( $suggestion->{biblionumber}, $my_suggestion->{biblionumber}, 'Suggestion stores the biblio number correctly' );
is( $suggestion->{STATUS}, 'ASKED', 'Suggestion stores a suggestion with the status ASKED by default' );
is( $suggestion->{managedby}, undef, 'Suggestion stores empty string as undef for non existent foreign key (integer)' );
is( $suggestion->{manageddate}, undef, 'Suggestion stores empty string as undef for date' );
is( $suggestion->{budgetid}, undef, 'Suggestion should set budgetid to NULL if not given' );
my $suggestion = Koha::Suggestions->find($my_suggestionid);
is( $suggestion->title, $my_suggestion->{title}, 'Suggestion stores the title correctly' );
is( $suggestion->author, $my_suggestion->{author}, 'Suggestion stores the author correctly' );
is( $suggestion->publishercode, $my_suggestion->{publishercode}, 'Suggestion stores the publishercode correctly' );
is( $suggestion->suggestedby, $my_suggestion->{suggestedby}, 'Suggestion stores the borrower number correctly' );
is( $suggestion->biblionumber, $my_suggestion->{biblionumber}, 'Suggestion stores the biblio number correctly' );
is( $suggestion->STATUS, 'ASKED', 'Suggestion stores a suggestion with the status ASKED by default' );
is( $suggestion->managedby, undef, 'Suggestion stores empty string as undef for non existent foreign key (integer)' );
is( $suggestion->manageddate, undef, 'Suggestion stores empty string as undef for date' );
is( $suggestion->budgetid, undef, 'Suggestion should set budgetid to NULL if not given' );
is( ModSuggestion(), undef, 'ModSuggestion without the suggestion returns undef' );
my $mod_suggestion1 = {
@ -202,20 +202,20 @@ is( $status, undef, 'ModSuggestion without the suggestion id returns undef' );
$mod_suggestion1->{suggestionid} = $my_suggestionid;
$status = ModSuggestion($mod_suggestion1);
is( $status, 1, 'ModSuggestion modifies one entry' );
$suggestion = Koha::Suggestions->find($my_suggestionid)->unblessed();
is( $suggestion->{title}, $mod_suggestion1->{title}, 'ModSuggestion modifies the title correctly' );
is( $suggestion->{author}, $mod_suggestion1->{author}, 'ModSuggestion modifies the author correctly' );
$suggestion = Koha::Suggestions->find($my_suggestionid);
is( $suggestion->title, $mod_suggestion1->{title}, 'ModSuggestion modifies the title correctly' );
is( $suggestion->author, $mod_suggestion1->{author}, 'ModSuggestion modifies the author correctly' );
is(
$suggestion->{publishercode}, $mod_suggestion1->{publishercode},
$suggestion->publishercode, $mod_suggestion1->{publishercode},
'ModSuggestion modifies the publishercode correctly'
);
is(
$suggestion->{managedby}, undef,
$suggestion->managedby, undef,
'ModSuggestion stores empty string as undef for non existent foreign key (integer)'
);
is( $suggestion->{manageddate}, undef, 'ModSuggestion stores empty string as undef for date' );
isnt( $suggestion->{accepteddate}, undef, 'ModSuggestion does not update a non given date value' );
is( $suggestion->{note}, 'my note', 'ModSuggestion should not erase data if not given' );
is( $suggestion->manageddate, undef, 'ModSuggestion stores empty string as undef for date' );
isnt( $suggestion->accepteddate, undef, 'ModSuggestion does not update a non given date value' );
is( $suggestion->note, 'my note', 'ModSuggestion should not erase data if not given' );
my $messages = C4::Letters::GetQueuedMessages( { borrowernumber => $borrowernumber } );
is( @$messages, 0, 'ModSuggestions does not send an email if the status is not updated' );
@ -246,8 +246,8 @@ my $mod_suggestion3 = {
t::lib::Mocks::mock_preference( 'FallbackToSMSIfNoEmail', 0 );
$status = ModSuggestion($mod_suggestion3);
is( $status, 1, 'ModSuggestion modifies one entry' );
$suggestion = Koha::Suggestions->find($my_suggestionid)->unblessed();
is( $suggestion->{STATUS}, $mod_suggestion3->{STATUS}, 'ModSuggestion modifies the status correctly' );
$suggestion = Koha::Suggestions->find($my_suggestionid);
is( $suggestion->STATUS, $mod_suggestion3->{STATUS}, 'ModSuggestion modifies the status correctly' );
$messages = C4::Letters::GetQueuedMessages( { borrowernumber => $borrowernumber } );
is( @$messages, 1, 'ModSuggestion sends an email if the status is updated' );
is(
@ -437,9 +437,9 @@ is( ConnectSuggestionAndBiblio(), '0E0', 'ConnectSuggestionAndBiblio without arg
my $biblio_2 = $builder->build_object( { class => 'Koha::Biblios' } );
my $connect_suggestion_and_biblio = ConnectSuggestionAndBiblio( $my_suggestionid, $biblio_2->biblionumber );
is( $connect_suggestion_and_biblio, '1', 'ConnectSuggestionAndBiblio returns 1' );
$suggestion = Koha::Suggestions->find($my_suggestionid)->unblessed();
$suggestion = Koha::Suggestions->find($my_suggestionid);
is(
$suggestion->{biblionumber}, $biblio_2->biblionumber,
$suggestion->biblionumber, $biblio_2->biblionumber,
'ConnectSuggestionAndBiblio updates the biblio number correctly'
);
@ -468,13 +468,13 @@ is( $suggestions->[1]->{title}, $del_suggestion->{title}, 'DelSuggestion deletes
$my_suggestion->{budgetid} = ''; # If budgetid == '', NULL should be set in DB
my $my_suggestionid_test_budget_object = Koha::Suggestion->new($my_suggestion)->store;
my $my_suggestionid_test_budgetid = $my_suggestionid_test_budget_object->id;
$suggestion = Koha::Suggestions->find($my_suggestionid_test_budgetid)->unblessed();
is( $suggestion->{budgetid}, undef, 'Suggestion Should set budgetid to NULL if equals an empty string' );
$suggestion = Koha::Suggestions->find($my_suggestionid_test_budgetid);
is( $suggestion->budgetid, undef, 'Suggestion Should set budgetid to NULL if equals an empty string' );
$my_suggestion->{budgetid} = ''; # If budgetid == '', NULL should be set in DB
ModSuggestion($my_suggestion);
$suggestion = Koha::Suggestions->find($my_suggestionid_test_budgetid)->unblessed();
is( $suggestion->{budgetid}, undef, 'Suggestion Should set budgetid to NULL if equals an empty string' );
$suggestion = Koha::Suggestions->find($my_suggestionid_test_budgetid);
is( $suggestion->budgetid, undef, 'Suggestion Should set budgetid to NULL if equals an empty string' );
my $suggestion2 = {
title => "Cuisine d'automne",
@ -510,11 +510,11 @@ subtest 'GetUnprocessedSuggestions' => sub {
'GetUnprocessedSuggestions should return 0 if a suggestion has been processed but not linked to a fund'
);
my $status = ModSuggestion($mod_suggestion1);
my $suggestion = Koha::Suggestions->find($my_suggestionid)->unblessed();
is( $suggestion->{budgetid}, undef, 'ModSuggestion should set budgetid to NULL if not given' );
my $suggestion = Koha::Suggestions->find($my_suggestionid);
is( $suggestion->budgetid, undef, 'ModSuggestion should set budgetid to NULL if not given' );
ModSuggestion( { suggestionid => $my_suggestionid, budgetid => $budget_id } );
$suggestion = Koha::Suggestions->find($my_suggestionid)->unblessed();
is( $suggestion->{budgetid}, $budget_id, 'ModSuggestion should modify budgetid if given' );
$suggestion = Koha::Suggestions->find($my_suggestionid);
is( $suggestion->budgetid, $budget_id, 'ModSuggestion should modify budgetid if given' );
$unprocessed_suggestions = C4::Suggestions::GetUnprocessedSuggestions;
is(
@ -733,8 +733,8 @@ subtest 'ModSuggestion should work on suggestions without a suggester' => sub {
$dbh->do(q|DELETE FROM suggestions|);
my $my_suggestionid = Koha::Suggestion->new($my_suggestion_without_suggestedby)->store()->id;
$suggestion = Koha::Suggestions->find($my_suggestionid)->unblessed();
is( $suggestion->{suggestedby}, undef, "Suggestedby is undef" );
$suggestion = Koha::Suggestions->find($my_suggestionid);
is( $suggestion->suggestedby, undef, "Suggestedby is undef" );
ModSuggestion(
{
@ -743,9 +743,9 @@ subtest 'ModSuggestion should work on suggestions without a suggester' => sub {
note => "Test note"
}
);
$suggestion = Koha::Suggestions->find($my_suggestionid)->unblessed();
$suggestion = Koha::Suggestions->find($my_suggestionid);
is( $suggestion->{note}, "Test note", "ModSuggestion works on suggestions without a suggester" );
is( $suggestion->note, "Test note", "ModSuggestion works on suggestions without a suggester" );
};
subtest 'place_hold tests' => sub {