-
Notifications
You must be signed in to change notification settings - Fork 359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bulk favorites save from search results #3960
Merged
demiankatz
merged 9 commits into
vufind-org:dev
from
LuomaJuha:fix-bulkaction-favorites-save
Oct 16, 2024
+92
−48
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
53a0a59
Added checking from query parameters also
LuomaJuha d7358f8
Remove compiled.css
LuomaJuha 05a439c
Adjusted to use forward to and post params.
LuomaJuha 658524a
Removed all get queries when creating list and adding bulk items
LuomaJuha c0dc911
Added form action
LuomaJuha 6ad5888
adjusted record id functionality in forms
LuomaJuha eb445cd
Use template to print out necessary input fields for forms
LuomaJuha 029a39f
Removed this->record as it was not required
LuomaJuha d6f3328
Remove splitting of recordId
LuomaJuha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
themes/bootstrap3/templates/cart/form-record-hidden-inputs.phtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
$recordId = $this->driver?->getUniqueId() ?? $this->recordId ?? false; | ||
$recordSource = $this->driver?->getSourceIdentifier() ?? $this->recordSource ?? DEFAULT_SEARCH_BACKEND; | ||
if ($recordId && str_contains($recordId, '|')) { | ||
[$recordId, $recordSource] = explode('|', $recordId, 2); | ||
} | ||
?> | ||
<?php if ($recordId): ?> | ||
<input type="hidden" name="recordId" value="<?=$this->escapeHtmlAttr($recordId)?>"> | ||
<input type="hidden" name="recordSource" value="<?=$this->escapeHtmlAttr($recordSource)?>"> | ||
<?php return; ?> | ||
<?php endif; ?> | ||
|
||
<?php | ||
if (!isset($this->recordIds)) { | ||
$this->recordIds = array_map( | ||
fn ($record) => $record->getSourceIdentifier() . '|' . $record->getUniqueId(), | ||
$this->records ?? [] | ||
); | ||
} | ||
?> | ||
<?php foreach ($this->recordIds as $current): ?> | ||
<input type="hidden" name="ids[]" value="<?=$this->escapeHtmlAttr($current)?>"> | ||
<?php endforeach; ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
themes/bootstrap5/templates/cart/form-record-hidden-inputs.phtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
$recordId = $this->record?->getUniqueId() ?? $this->driver?->getUniqueId() ?? $this->recordId ?? false; | ||
$recordSource = $this->record?->getSourceIdentifier() ?? $this->driver?->getSourceIdentifier() ?? $this->recordSource ?? DEFAULT_SEARCH_BACKEND; | ||
if ($recordId && str_contains($recordId, '|')) { | ||
[$recordId, $recordSource] = explode('|', $recordId, 2); | ||
} | ||
?> | ||
<?php if ($recordId): ?> | ||
<input type="hidden" name="recordId" value="<?=$this->escapeHtmlAttr($recordId)?>"> | ||
<input type="hidden" name="recordSource" value="<?=$this->escapeHtmlAttr($recordSource)?>"> | ||
<?php return; ?> | ||
<?php endif; ?> | ||
|
||
<?php | ||
if (!isset($this->recordIds)) { | ||
$this->recordIds = array_map( | ||
fn ($record) => $record->getSourceIdentifier() . '|' . $record->getUniqueId(), | ||
$this->records ?? [] | ||
); | ||
} | ||
?> | ||
<?php foreach ($this->recordIds as $current): ?> | ||
<input type="hidden" name="ids[]" value="<?=$this->escapeHtmlAttr($current)?>"> | ||
<?php endforeach; ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm concerned that this could malfunction in multiple ways if an ID contains a pipe character. Is there a safer way to determine when unpacking is required? i.e. do we only unpack recordId if there is no driver and no source set? (I didn't analyze all the code paths to figure out options, but I can try to spend a little time on that if it would help).
Additionally, are the variables reversed? Down below, you construct "source|id" strings, but here you're unpacking it as "id|source".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, missed that... will adjust them also!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, i think it would be safer to leave it out and let the calling templates to give what is needed? I think that part was littlebit of overthinking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, definitely safer this way -- thanks!