diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 3a377bb2a..9a462d68a 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -1,5 +1,6 @@ 7.8.11 - fixed #11362: Unable to checkout with ITransact plugin + - fixed #11364: Notify About Low Stock workflow activity email is not user friendly 7.8.10 - fixed #11332: Pagination in webgui.org forum urls diff --git a/lib/WebGUI/Workflow/Activity/NotifyAboutLowStock.pm b/lib/WebGUI/Workflow/Activity/NotifyAboutLowStock.pm index ab6dd8eb6..58dc49373 100644 --- a/lib/WebGUI/Workflow/Activity/NotifyAboutLowStock.pm +++ b/lib/WebGUI/Workflow/Activity/NotifyAboutLowStock.pm @@ -92,7 +92,11 @@ See WebGUI::Workflow::Activity::execute() for details. sub execute { my ($self, undef, $instance) = @_; my $session = $self->session; - my $message = $instance->getScratch('LowStockMessage') || ''; + my $messageHeader =< +QuantityProduct +EOHEAD + my $message = $instance->getScratch('LowStockMessage') || $messageHeader; my $counter = $instance->getScratch('LowStockLast') || 0; my $belowThreshold = $instance->getScratch('LowStockBelow') || 0; my $productIterator = WebGUI::Asset::Sku::Product->getIsa($session, $counter); @@ -110,8 +114,10 @@ sub execute { if ($collateral->{quantity} <= $warningLimit) { ##Build message $belowThreshold = 1; - $message .= $product->getUrl(sprintf 'func=editVariant;vid=%s', $collateral->{variantId}) - . "\n"; + $message .= sprintf qq{%d%s\n}, + $collateral->{quantity}, + $session->url->getSiteURL.$session->url->gateway($product->getUrl(sprintf 'func=editVariant;vid=%s', $collateral->{variantId})), + $collateral->{shortdesc}; } } $counter++; @@ -133,6 +139,7 @@ sub execute { $instance->deleteScratch('LowStockLast'); $instance->deleteScratch('LowStockBelow'); if ($belowThreshold) { + $message .= ''; my $inbox = WebGUI::Inbox->new($session); $inbox->addMessage({ status => 'unread', diff --git a/t/Workflow/Activity/NotifyAboutLowStock.t b/t/Workflow/Activity/NotifyAboutLowStock.t index 1361d57bb..909a2caec 100644 --- a/t/Workflow/Activity/NotifyAboutLowStock.t +++ b/t/Workflow/Activity/NotifyAboutLowStock.t @@ -111,9 +111,12 @@ my $message = $messages->[0]; my $body = $message->get('message'); is($message->get('subject'), 'Threshold=15', 'Message has the right subject'); -my @urls = split /\n/, $body; +my @table = split /\n/, $body; +my @urls = @table[2..$#table]; +pop @urls; is (scalar @urls, 1, 'Only one variant is below the threshold'); my $url = pop @urls; +$url =~ s/^.+?href="([^"]+)".+$/$1/; my $uri = URI->new($url); is($uri->path, $posters->getUrl, 'Link in message has correct URL path'); is($uri->query, 'func=editVariant;vid='.$marilynVarId, 'Link in message has function and variant id');