Serial field doesn't work properly with node_clone module.
Probably a proper hook should be implemented, since node_clone in clone.pages.inc calls:
drupal_alter('clone_node', $node, $context);

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Melechin_AV’s picture

I have a similar problem (with the serial_field-1.3).
Autoincrement work only when creating a new node. When cloning - number also cloned. In version 1.2 this doesn't happen. I don't want to use a hook and I have to use version 1.2.

This is error or now it will be always?

Thanks in advance for a attention to this issue.

drvdt’s picture

+1

tyrpower’s picture

+1

msti’s picture

If someone wants to use a hook to solve this, here is how it is done:

/**
 * Implements hook_clone_node_alter().
 */
function mymod_clone_node_alter(&$node, $context) {
  if(is_array($node->field_serial_field)){
    unset($node->field_serial_field);
  }
}
GAMe’s picture

I too have the same issue :-/

Melechin_AV’s picture

msti, thanks for help.

<?php
function mymod_clone_node_alter(&$node, $context) {
  if(is_array($node->field_serial_field)){
    unset($node->field_serial_field);
  }
}
?>

- This hook should be inserted into the file /serial/serial.module?

I tried - does not work
And I created a module - item does not work

What am I doing wrong?

msti’s picture

@Melechin_AV

You will have to place this in your custom module.

Replace the 'mymod' in mymod_clone_node_alter with your module name like: MODULE_NAME_clone_node_alter
Check this for help: https://www.drupal.org/developing/modules/7

Melechin_AV’s picture

Module with hook does not give error, but does not work - when cloning the number does not increase.
I hope this function will included in next version serial-field module.

GAMe’s picture

Has any other development been done on this yet? All seems to have gone quiet.

GAMe’s picture

FileSize
1.31 KB

Ok so a big thanks out to msti for his direction. I created a module for this which I have attached as a super quick way for people to get this thing working however you MUST edit the .module file and change the field names to that of your own.

Lets hope this is fixed properly in newer versions of serial field :-)

Melechin_AV’s picture

It work!
I'm slowpoke.
I'm very grateful to msti and GAMe.

BR0kEN’s picture

Assigned: Unassigned » BR0kEN
Status: Active » Needs review
FileSize
658 bytes

Status: Needs review » Needs work

The last submitted patch, 12: serial-node_clone-2144389-12.patch, failed testing.

The last submitted patch, 12: serial-node_clone-2144389-12.patch, failed testing.

The last submitted patch, 12: serial-node_clone-2144389-12.patch, failed testing.

The last submitted patch, 12: serial-node_clone-2144389-12.patch, failed testing.

  • BR0kEN committed ee20f14 on 7.x-1.x
    Issue #2144389 by BR0kEN: Doesn't work with node_clone
    
BR0kEN’s picture

Status: Needs work » Closed (fixed)