Skip to content
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

[bug] Label Printing button in Record Search Queryform does not transfer data to Label Printing Module #2160

Open
mickley opened this issue Jan 29, 2025 · 0 comments

Comments

@mickley
Copy link
Collaborator

mickley commented Jan 29, 2025

In the occurrence editor queryform there is a block of code to add a button to print labels if certain search fields are set (see code below).

if(!$crowdSourceMode){
$qryStr = '';
if($qRecordedBy) $qryStr .= '&recordedby='.$qRecordedBy;
if($qRecordNumber) $qryStr .= '&recordnumber='.$qRecordNumber;
if($qEventDate) $qryStr .= '&eventdate='.$qEventDate;
if($qCatalogNumber) $qryStr .= '&catalognumber='.$qCatalogNumber;
if($qOtherCatalogNumbers) $qryStr .= '&othercatalognumbers='.$qOtherCatalogNumbers;
if($qRecordEnteredBy) $qryStr .= '&recordenteredby='.$qRecordEnteredBy;
if($qDateEntered) $qryStr .= '&dateentered='.$qDateEntered;
if($qDateLastModified) $qryStr .= '&datelastmodified='.$qDateLastModified;
if($qryStr){
?>
<a class="button button-primary icon-button bottom-breathing-room-rel" title="<?php echo $LANG['GO_LABEL_PRINT']; ?>" href="../reports/labelmanager.php?collid=<?php echo htmlspecialchars($collId, ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE) . htmlspecialchars($qryStr, ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE); ?>" target="_blank">
<img src="../../images/list.png" style="width:1.3em" />
</a>

That button is supposed to transfer the contents to the label printing module as a GET link. However, the data variables that the label printing module is checking are not the same as what the queryform sends. The label printing module uses identifier instead of catalognumber or othercatalognumbers, and it has date1 and date2 variables for a range of dates, as well as a datetarget variable (which is only read via POST), to determine whether the date passed is a date entered, date collected, or date modified.

Solution:

  1. Make the following changes to the queryform code:
if($qEventDate) $qryStr .= 'datetarget=eventdate&date1='.$qEventDate;
if($qCatalogNumber) { $qryStr .= '&identifier='.$qCatalogNumber; } 
else if($qOtherCatalogNumbers) {$qryStr .= '&identifier='.$qOtherCatalogNumbers;}
if($qDateEntered) $qryStr .= 'datetarget=dateentered&date1='.$qDateEntered;
if($qDateLastModified) $qryStr .= 'datetarget=datelastmodified&date1='.$qDateLastModified;
  1. Update the <select name="datetarget" id="datetarget"> code in labelmanager.php to use $_REQUEST['datetarget'] instead of $_POST['datetarget']

Related feature enhancement

In the queryform, the label printing button takes up an entire line on its own. Consider moving it down into the fieldGroupDiv below it along with the Display Editor, Display Table buttons. I also think it's much more user-friendly as a button titled Print Labels, instead of an icon. It is not clear what that icon means. See screenshot below.

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant