Mailing List Archive

Desk madness
Hi everybody,

I think I might have a bit of insight into the desk-mismatch problem.
Either that or I'm missing something.

I'm trying to create a story within a template. When the initiating
story contains a "tweet creator" subelement, the tweet creator template
should create the tweet story and put it in workflow.

This happens, and the asset gets its own workflow__id and desk__id
values set correctly, but it does not get put in the relevant asset
groups. So you see the asset in search results, and it increments the
desk's asset count number in the UI, but when you go to the desk itself
the tweet story is not visible.

Below is the code from the tweet creator template. Any idea what else I
could try?

my $workflow = Bric::Biz::Workflow->lookup({name => 'Social'});
my $desk = Bric::Biz::Workflow::Parts::Desk->lookup({name => 'Social
Publish'});

unless ($tweet) {
my %starter_kit = (
'user__id' => $story->get_user__id,
'priority' => $story->get_priority,
'title' => 'Tweet for ' . $story->get_title,
'workflow_id' => $workflow->get_id,
'slug' => $story->get_id,
'element_type' => Bric::Biz::ElementType->lookup({key_name =>
'tweet'}),
'site_id' => $story->get_site_id,
'source__id' => $story->get_source__id,
);

$tweet = Bric::Biz::Asset::Business::Story->new(\%starter_kit);
$tweet->add_categories([$story->get_primary_category->get_id]);
$tweet->set_primary_category($story->get_primary_category->get_id);
$tweet->set_cover_date($story->get_cover_date),
$tweet->save;
$tweet->set_workflow_id($workflow->get_id);
$desk->accept({asset => $tweet});
$desk->checkin($tweet);
$tweet->save;
}


Thanks,

Bret

--
Bret Dawson
Producer
Pectopah Productions Inc.
(416) 895-7635
bret@pectopah.com
www.pectopah.com
Re: Desk madness [ In reply to ]
On 2011-12-07, at 6:54 PM, Bret Dawson wrote:

> Below is the code from the tweet creator template. Any idea what else I
> could try?

Perhaps a missing $desk->save call?

I think the proper order is:

### snip ###
$tweet->set_workflow_id($workflow->get_id);
$tweet->save;
$desk->accept({asset => $tweet});
$desk->save;

$tweet->checkin;
$tweet->save;

HTH,
--Greg
Re: Desk madness [ In reply to ]
Hi Greg,

That was it!


Thanks so much,

Bret


On Wed, 2011-12-07 at 19:36 -0500, Greg Heo wrote:
> On 2011-12-07, at 6:54 PM, Bret Dawson wrote:
>
> > Below is the code from the tweet creator template. Any idea what else I
> > could try?
>
> Perhaps a missing $desk->save call?
>
> I think the proper order is:
>
> ### snip ###
> $tweet->set_workflow_id($workflow->get_id);
> $tweet->save;
> $desk->accept({asset => $tweet});
> $desk->save;
>
> $tweet->checkin;
> $tweet->save;
>
> HTH,
> --Greg
>
>

--
Bret Dawson
Producer
Pectopah Productions Inc.
(416) 895-7635
bret@pectopah.com
www.pectopah.com