ezsystems/ezpublish-legacy — pull request #766 by bdunogier (2013-09-20 14:33:30+00:00)
Title: Fix EZP-21599: remaining transaction from content/publish operation

http://jira.ez.no/browse/EZP-21599

### Situation
When the publish/before trigger interrupts the operation, the transaction counter is still at level 1 instead of 0, because of the extra transaction added to the operation body.

### This patch
This patch will do what we did where the code is called to prevent errors: commit every transaction that was left while the operation was executed.

### Testing
1. Make sure you have a pre-publish workflow with an event that will interrupt publishing (approve, wait-until-date...)
2. Store the content without publishing it
3. Publish it using eZOperationHandler::execute( 'content','publish' ) in a command line script
4. Check eZDB::instance()->transactionCounter after the operation. If it is bigger than it was before running the script, here is the bug.