Skip to content

Commit

Permalink
Respect publish_status in the SOAP API.
Browse files Browse the repository at this point in the history
When creating new stories or media via the SOAP interface, no longer force the
publish status to be set to false, but set it to true if the the publish date
is set or the publish status is true in the XML. In such cases, also set the
published version number to version 1. This is to make it easier for one to
migrate documents from one Bricolage instance to another without having to
edit the XML to set the publish status to a true value.

While at it, fix a bug where the SOAP interface was not setting the published
version to the new version of a story or media document that is being updated
by XML that says the document is published and where the published version was
not previously set.
  • Loading branch information
theory committed Mar 30, 2010
1 parent 050debc commit 425f09b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 20 deletions.
16 changes: 16 additions & 0 deletions lib/Bric/Changes.pod
Expand Up @@ -103,6 +103,16 @@ contributor type proile, the cursor displays as a "move" cursor, to indicate
that one can drag the field names in order to change their order. This
corresponds to the interface for reordering fields in documents. [David]

=item *

When creating new stories or media via the SOAP interface, Bricolage no longer
forces the publish status to be set to false, but sets it to true if the the
publish date is set or the publish status is true in the XML. In such cases,
it will also set the published version number to version 1. This is to make it
easier for one to migrate documents from one Bricolage instance to another
without having to edit the XML to set the publish status to a true value.
[David]

=back

=head2 Bug Fixes
Expand Down Expand Up @@ -239,6 +249,12 @@ When relating a story or media document, clicking a column header in the
search results in the related search popup no longer throws an error. Thanks
to Phillip for the report (Bug #149). [David]

=item *

The SOAP interface now sets the published version to the new version of a
story or media document that is being updated by XML that says the document is
published and where the published version was not previously set. [David]

=back

=head1 Version 1.11.3 (2010-01-28)
Expand Down
17 changes: 7 additions & 10 deletions lib/Bric/SOAP/Media.pm
Expand Up @@ -809,16 +809,13 @@ sub load_asset {
$media->_set(\@simple_fields, [ @{$mdata}{@simple_fields} ]);

# almost totally ignoring whatever publish_status is set to
if ($update) {
if ($media->get_publish_date or $media->get_first_publish_date) {
# some publish date is set, so it must've been published
$media->set_publish_status(1);
} else {
$media->set_publish_status($mdata->{publish_status});
}
} else {
# creating, so can't have published it yet
$media->set_publish_status(0);
$media->set_publish_status(
$media->get_publish_date ? 1 : $mdata->{publish_status} || 0
);

# Set published version if it's not set.
if ($media->get_publish_status && !$media->get_published_version) {
$media->set_published_version($media->get_current_version + 1);
}

# remove all contributors if updating
Expand Down
17 changes: 7 additions & 10 deletions lib/Bric/SOAP/Story.pm
Expand Up @@ -928,16 +928,13 @@ sub load_asset {
}

# almost totally ignoring whatever publish_status is set to
if ($update) {
if ($story->get_publish_date or $story->get_first_publish_date) {
# some publish date is set, so it must've been published
$story->set_publish_status(1);
} else {
$story->set_publish_status($sdata->{publish_status});
}
} else {
# creating, so can't have published it yet
$story->set_publish_status(0);
$story->set_publish_status(
$story->get_publish_date ? 1 : $sdata->{publish_status} || 0
);

# Set published version if it's not set.
if ($story->get_publish_status && !$story->get_published_version) {
$story->set_published_version($story->get_current_version + 1);
}

# remove all categories if updating
Expand Down

0 comments on commit 425f09b

Please sign in to comment.