After installation of 1.5 version of Serial Field, I have the following problem :
All nodes with automatic nodetitle that use a serial field token are not filled in when the node is created. I have to go to content administration page, and to force an update of the node title, and the node title is then set correctly.

I have installed back version 1.4, and the problem disappears.

Comments

fredo38fr created an issue. See original summary.

fredo38fr’s picture

roald’s picture

I have installed back version 1.4, and the problem disappears.

I have 1.4, but have then the problem that the serial disappears from the node title when updating and saving the node.
Do you have the same problem, @fredo38fr ?

roald’s picture

I have 1.4, but have then the problem that the serial disappears from the node title when updating and saving the node.
Do you have the same problem, @fredo38fr ?

I'm sorry - not my intention to confuse. My problem turned out to be permissions-related.

Any news on 1.5 serial not filling in automatic nodetitle?

Dr.D’s picture

auto_nodetitle evaluates the constant AUTO_NODETITLE_OPTIONAL in the function auto_nodetitle_is_needed which is being called by the newer version of serial in the presave function.

previously, serial was calling using auto_nodetitle_get_settings
there was/is still a constant being used, but as the default return option, it still means "no go"

changing the presave function back fixes it for me.
function serial_node_presave($node) {
if (module_exists('auto_nodetitle') {
auto_nodetitle_get_setting($node->type)

BR0kEN’s picture

Assigned: Unassigned » BR0kEN
Status: Active » Closed (works as designed)

You should configure your content type properly to set titles for nodes automatically (admin/structure/types/manage/<TYPE>).

fredo38fr’s picture

I give some news about my problem (sorry for the delay).

So first, to answer to @br0ken, I have well configured my content type with following value :
'Automatically generate the title and hide the title field' (constant AUTO_NODETITLE_ENABLED in auto_nodetitle.module).

Second, I am in the same situation as @dr.d : If I update to Serial 1.5, the title is not updated correctly. If I go back to Serial 1.4 for function serial_node_presave, it works.

I have to be more precise for my problem : the title is generated by auto_nodetitle, but with the token that uses a serial value not evaluated.
I have put trace to debug in function auto_nodetitle_set_title and I have the following :

1- With Serial 1.4
auto_nodetitle_set_title is called twice. First time, title is set to the value I have configured in my content type, but with the token not evaluated (Example : Info_[node:field_id_article] ).
Second time, title is set correctly with the final value with token evaluated (Example : Info_24 ).

2- With Serial 1.5
auto_nodetitle_set_title is only called once (because the function auto_nodetitle_is_needed returns FALSE), and
the value for title is not correct, with the token not evaluated (Example : Info_[node:field_id_article] ). The only way to have the correct title, is to go to content admin, and to run 'Update automatic nodetitles'.

I have done a test too with a title that uses another token (date token for example), and with Serial 1.5, and the title is correctly set to the good value with the token evaluated on the first call of auto_nodetitle_set_title.

I am a french Drupal beginner, so it's hard for me to figure out where the problem is : Serial module, Auto_Nodetitle module, Token module ?
But the fact is that the modification done in serial_node_presave from version 1.4 to 1.5 has made the problem appear on my site.

Anyone can help ?

BR0kEN’s picture

This is an issue of auto_nodetitle module (http://cgit.drupalcode.org/auto_nodetitle/tree/auto_nodetitle.module?h=7.x-1.0#n57).

Serial module has the same code which will be removed (http://cgit.drupalcode.org/serial/tree/serial.module?id=4f73c53#n109). By that reason the auto_nodetitle_set_title() function invokes twice.

Now about your and Auto Node Title problem. hook_node_presave() calling before the node was saved and node object doesn't contain field values and tokens cannot be replaced.

BR0kEN’s picture

You could try with code snippet below:

/**
 * Implements hook_node_insert().
 */
function HOOK_node_insert(stdClass $node) {
  if (function_exists('auto_nodetitle_node_presave')) {
    $node->auto_nodetitle_applied = FALSE;
    auto_nodetitle_node_presave($node);

    db_update('node')
      ->fields(array('title' => $node->title))
      ->condition('nid', $node->nid)
      ->execute();
  }
}
markabur’s picture

kopeboy’s picture

I confirm it works perfect out of the box with auto_entitytlabel

roald’s picture

I can confirm auto_entitylabel works 99% with serial for the title. The message, noticing the node was created, omits the serial-number. Anyone else seeing that?