When a new program is created, genre and url are inserted in the station_program table as expected. But when the program is edited, these fields won't update.

Revisions are turned on; is that the problem?

The code didn't seem to account for that in this:

function station_program_update($node) {
db_query("UPDATE {station_program} SET genre = '%s', url = '%s' WHERE vid = %d", $node->genre, $node->url, $node->vid);
}

Comments

drewish’s picture

Priority: Critical » Normal

yeah that might be the problem... looking at the module there's really only half-way support for revisions. deleting a specific revision isn't supported... eek.

drewish’s picture

"that" meaning enabling revisions

rjleigh’s picture

A quick fix, then:

function station_program_update($node) {
  if ($node->revision){
    db_query("INSERT INTO {station_program} (nid, vid, genre, url) VALUES (%d, %d, '%s', '%s')", $node->nid, $node->vid, $node->genre, $node->url);
  }else{
    db_query("UPDATE {station_program} SET genre = '%s', url = '%s' WHERE vid = %d", $node->genre, $node->url, $node->vid);
  }
}

But, as you said, there's more to it to support revisions cleanly. I like to turn them on to troubleshoot user error reports.

IMO, the best solution would be to just allow designation of a CCK nodetype as the "program" anyway - but I'm not sure how this would effect the rest of the module.

drewish’s picture

want to roll that as a patch?

IMO, the best solution would be to just allow designation of a CCK nodetype as the "program" anyway - but I'm not sure how this would effect the rest of the module.

that had been my intention a while back but once the cck stuff got into core and you can add fields to any node type it fell off my radar. feel free to open a new issue requesting this in HEAD. i've thought about moving the genre and url into CCK fields but i'd need to do it in such a way that it provided an upgrade path for people. that and a way to link program fields to archived audio...

rjleigh’s picture

Status: Active » Needs review
StatusFileSize
new741 bytes

ok, here's the patch.

While it's ok to add to the current method with CCK, there are issues like this, of course. And the funny thing is, I don't even want to use the genre field to sort in the site - I'm using a set taxonomy for that! But people get upset if they fill it out and it doesn't show up.

drewish’s picture

right, it serves a bit of a different role from the taxonomy in that it's free form so people can be more specific than "r&B" or "talk". i'd be into an adding option to hide those two fields if people want to go the cck route.

the reason i wanted this feature request for HEAD is that the daily schedule is now a view so you could display your genre taxonomy there. 1.x is just getting bug fixes at this point.

i'll try to take care of that patch later today.

rjleigh’s picture

agreed. done. see http://drupal.org/node/196477

thanks

drewish’s picture

StatusFileSize
new1.48 KB

this adds support for deleting revisions. mind giving it a test?

drewish’s picture

StatusFileSize
new1.52 KB

committing the attached patch to HEAD.

drewish’s picture

Title: station program update problem » Station Program has incomplete support for versions

better title

rjleigh’s picture

had problems applying the #8 patch to 1.4 version of module.

the code is fine - tested with a manual patch.

drewish’s picture

Status: Needs review » Fixed

great committed to DRUPAL-5.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.