On the Workflow actions page (e.g. admin/build/workflow/actions/1) actions are always assigned to the first transition shown on the list. This doesn't have to be necessarily the transition with the lowest tid or weight - it's always the first in the list. Therefore this should be a bug in the form code.

Comments

pancho’s picture

Adding an action also doesn't trigger a drupal_set_message notification.

MrGer’s picture

Solution :


function workflow_actions_form($wid, $tid, $available_options) {
  $form['tid'] = array('#type' => 'hidden','#value' => $tid);
  $form['#multistep'] = 1;
  // get and list the actions that are already assigned to this transition
  $actions_this_tid = workflow_get_actions($tid);
  foreach ($actions_this_tid as $aid => $act_name)
  {
    $form['remove'][$aid] = array(
      '#type' => 'item',
      '#title' => $act_name,
      '#value' => l(t('remove'), "admin/build/workflow/actions/remove/$wid/$tid/$aid"),
    );
    unset($available_options[md5($aid)]);
  }

  // list possible actions that may be assigned
  if (count($available_options) > 1)
  {
    $form['action'] = array(
      '#type' => 'select',
      '#options' => $available_options,
    );
    $form['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Add')
    );
  }
  return $form;
}

pancho’s picture

StatusFileSize
new738 bytes

Wow, German!

Your first contribution, and it works smoothly... A heartly welcome in the Drupal community!

Added German's modification as a small two-lines patch against HEAD.

Pancho

pancho’s picture

Status: Active » Reviewed & tested by the community
StatusFileSize
new738 bytes

Wow, German!

Your first contribution, and it works smoothly... A heartly welcome in the Drupal community!

Added German's modification as a small two-lines patch against HEAD.

Pancho

pancho’s picture

Whoops, duplicate... :)

tostinni’s picture

The patch works fine for me.

Gman’s picture

Yep. Works for me too. Glad you all are working on this. I was going to hunt that bug down since this will be a key module for our next site. -G

pancho’s picture

Hmmmm... how come all these issues (even those with patches) don't receive a response by one of the maintainers? Is there everybody on vacation? This is important for non-dev users, as the current release of workflow doesn't work at all!

mfredrickson’s picture

My bad. I should give feedback.

Pancho, et al- You're doing a fabulous job finding and patching bugs. Expect a big round of commits this weekend.

Going forward, I can't make any promises on how available any developers will be to review and commit, but I'll try to at least add a "+1" type comment on a more regular basis.

Thanks for your interest in workflow!

Yours in the public service,
-Mark

mfredrickson’s picture

Fixed. Thanks for the patch.

I'm curious: what led you to the #multistep fix? This would have never occurred to me (and in some ways still feels like a hack!). But I like working code more!

Cheers,
-Mark

mfredrickson’s picture

Status: Reviewed & tested by the community » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)
BenGman’s picture

Status: Closed (fixed) » Closed (won't fix)

Hello,

I am using Drupal 5.1, Workflow 5.x-1.1 (workflow.module v1.54.2.6), Actions 5.x-1.x-dev, Windows Server 2003 SP2. PHP 5.2.3 and MySQL 5.0.27 and I am still getting this same error that Actions are being placed at the top of the transistions and that no action is performed when the workflow state of a node is changed.

I tried the patch, and reverting to workflow.module v1.54.2.4 but am still experiencing the same error.

Is there another patch that is to be released soon to fix this?

Thank you in advance!

hydrian’s picture

Status: Closed (won't fix) » Needs work

I am also still having problems. I was running Workflow 1.1 with Worflow access. I'm using actions module dev as of June07. I upgraded to HEAD and added the patch. I am still having issues. The issue seam to be just the UI not adding the entries correctly. I added them manually to the database, and they are show up fine.

I am currently Running D5.1, mysql 5.016, PHP 5.2.2 (CGI)

emdalton’s picture

I have Workflow 5.x.1.1, which was released after this patch. I am still seeing the problem. I tried applying this patch anyway and got "Hunk 1 FAILED at 1325" (possibly because I was trying to apply it from within the workflow directory... it doesn't say where it needs to be applied from.)

I was able to work around this problem by using SQL. I'm including a couple of sample SQL statements here, in case it helps someone else while we're waiting for a fix, but really, this needs prompt attention.

To see your actions with descriptions:

SELECT aid, description FROM actions;

Make a note of the numbers of the actions you want to use. The first few actions are predefined by the system and have names instead of numbers.

Now, get your states:

SELECT * FROM workflow_states;

Decide what sort of actions you want to attach to which transitions. You're going to refer to the transitions by their state number (sid) and/or their target state number (target_sid).

Use something like this:

INSERT INTO workflow_actions (tid) (SELECT tid FROM workflow_transitions WHERE target_sid=1);

This would put an entry into the workflow_actions for each item in workflow_transitions that lands on state 1, whatever that is in your state model. Then, RIGHT AWAY,

UPDATE workflow_actions SET aid=1 WHERE aid=0 AND aid<>"action_node_unpublish" AND aid<>"action_node_publish";

This sets all the new workflow actions you just created, that don't actually have an action defined yet, to action 1. If you have any transitions set to other predefined actions (those in the system already, with text instead of numbers in the first SQL statement), you may need to modify this statement a bit.

I was able to successfully implement workflow actions on my system using this method, though it's tedious, and a lot needs to be fiddled with if you then add another state in later. Hopefully this bug will be fixed soon.

Bastlynn’s picture

Status: Needs work » Closed (won't fix)

Hi,

With the release of Drupal 7, Drupal 5 is no longer receiving security updates, reviews, or development from many contributed modules. Since 5 is now considered a depreciated version, you really should seriously look into upgrading to Drupal 6 or 7. The newer versions of Drupal work better, have more support, and will be safer (literally! security patches!) for your website. We are currently working on a new release for Workflow to Drupal 7. In light of that, further support for Drupal 5 issues is infeasible at the moment. Please consider upgrading to Drupal 6 or 7 in the near future - you'll be glad you did.

- Bastlynn