Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I've started drupal 7 version but can't find solution to make the field storage per entity because mysql does not allow more then one autoincrement field per table
Comment | File | Size | Author |
---|---|---|---|
#11 | serial.zip | 11.18 KB | kirsh |
#9 | serial.zip | 11.14 KB | kirsh |
serial.zip | 4.53 KB | andypost |
Comments
Comment #1
kirsh CreditAttribution: kirsh commentedThe same limitation of MySQL exists also when using Drupal 6.
The trick is to use a separate temporary table for every field - for the serial allocation.
Then, to copy the allocated value from that temporary table to the real CCK field.
Comment #2
derEremit CreditAttribution: derEremit commentedSo, is there already someone working on a Port to 7?
Comment #3
KirstenLangholz CreditAttribution: KirstenLangholz commentedI am also looking for a Drupal 7 version of the module as it is one of the main features for this catalog website...
Comment #4
theroyal CreditAttribution: theroyal commentedSubscribing
I am using this module on my website,
how can I migrate to D7 without it ?
please port a version for D7
Comment #5
waltf CreditAttribution: waltf commentedsubscribing
Comment #6
hgurol CreditAttribution: hgurol commentedI, also, would love to see a D7 version of this module...
Comment #7
andypostI this we should decide on storage for sequeces. D7 has db_sequence()... maybe better use 'serial' for field but what to do with fieldAPI multiple values - mySQL allows only one autoincrement field per table!!!
Comment #8
hgurol CreditAttribution: hgurol commented@andypost
I dont understand the problem.
Why would I want two autoincrement fields in a table?
Comment #9
kirsh CreditAttribution: kirsh commentedThe D7 version is attached.
If it works for others it could be released as version 7.x-1.0.
Comment #10
hgurol CreditAttribution: hgurol commentedThanks kirsh....
I havent used this module before, so I dont know how to fully test it but...
It installs without problems and straight forward usage works well.
Using it together with auto-path and auto-nodetitles doesnt work but now I have seen on the readme file that this is not supported for D7 yet.
However, I can not reach the Serial Field values thru views. I dont know if this is a problem with views or serial field, or something by design. I dont know how to troubleshoot, debug the problem further.
Comment #11
kirsh CreditAttribution: kirsh commentedApparently a hook that is needed by D7 views was missing.
Thank you for your report. Attached a new version.
Comment #12
andypost_serial_get_table_schema() definition still describing NID field but now we operate by entities
So this table should be changed to (sid, entity_id) with description and changed upgrade path
Comment #13
kirsh CreditAttribution: kirsh commentedHi andypost,
I don't know how exactly entity_id is managed in D7. Could you write a patch?
Upgrade should only add a field to the table, because nid is used temporarily and old values are irrelevant.
Comment #14
andypost@kirsh I mean to add db_change_field() into next hook_update_N() and introduce upgrade path
serial.inc
serial.install
Comment #15
kirsh CreditAttribution: kirsh commentedThanks.
I have another idea - replacing the nid or entity_id with a unique random ID (e.g. uniqid).
Since currently nid is only used temporarily to prevent retrieving the same serial ID by 2 concurrent threads.
By using nid or entity_id serial is limited to allocation only after the entity is saved.
Moving to uniqid will enable earlier serial number allocation in next versions of this module.
What do you think? How the new field should be defined in this case? string instead of int?
Comment #16
waltf CreditAttribution: waltf commentedI'm having some problems that i didn't encounter in the drupal 6 version.
In the 6 version i could change the numbers in phpmyadmin, eg to 2011001, and serial would start to count from that number. In the current version this doesnt seem possible.
Any ideas? Thank u by the way!
Comment #17
kirsh CreditAttribution: kirsh commentedChanging the sequence value directly in the database has never been supported.
Maybe it works with MySQL MyISAM tables (which are used by default in D6) but not in InnoDB tables (which are used by default in D7).
Anyway, nothing was changed in the serial module itself in this aspect.
Comment #18
waltf CreditAttribution: waltf commentedThank u for the quick answer, greatly appreciated.
So is there any way i can define a starting number?
I'm using serial to number invoices. Every year the number changes, but the invoices have to keep their number.
2010001-2010002 then jump to 2011001.
Comment #19
hgurol CreditAttribution: hgurol commented@waltf
with the #11, views problem is solved. I guess your using the older version..
Comment #20
waltf CreditAttribution: waltf commentedindeed, works now. Great!
Comment #21
theroyal CreditAttribution: theroyal commentedGuys someone clear that for me, am an admin more than a developer
I am using serial in my D6 website
so I think I need 2 things to move to D7
1- a patch for the migration.
2- a D7 version to continue the same job.
am I right? , or this feature is already built in D7 core ?
someone clear that up for me please.
Comment #22
kirsh CreditAttribution: kirsh commentedComment #23
kirsh CreditAttribution: kirsh commentedComment #24
PepeMty CreditAttribution: PepeMty commentedsubs
Comment #25
Rix-1 CreditAttribution: Rix-1 commentedHave tested and this works great (so far!) I used the most recent zip file you supplied. The site I have used it on is a Drupal 7 site with only views, chaos tools and serial installed with no conflicts.
Two quick requests / questions:
1. How do I start the auto-number in the format 1001 instead of just 1?
This is important because users who search for a serial number and type in "1" in search it would actually bring up every node with a "1" in it (comments, titles, fields, etc)! If it was 1001 onwards this would seriously limit the results.
2. What is the maximum serial number? 9,999? Can it go higher?
PS - Thanks for all your work on this - great job!
Comment #26
Rix-1 CreditAttribution: Rix-1 commentedAny movement on this? Happy to paypal donate if it speeds up development.
Comment #27
kirshi CreditAttribution: kirshi commentedHi Rix,
Thanks, but that will not be necessary.
You can use the Computed Field module to define another field that will be based on serial field + 1000, etc.
I believe serial fields are not limited to 9999.
Comment #28
yugongtian CreditAttribution: yugongtian commented+1
Comment #29
Rix-1 CreditAttribution: Rix-1 commentedThanks for the response, I have tried to use it but can't work out the steps to do it - I'm sure it's simple enough. Help anyone?
Comment #30
enjaygee CreditAttribution: enjaygee commentedI get the following error when installing:
Call to undefined function db_rewrite_sql() in serial.inc on line 55
db_rewrite_sql() is for versions prior to D7.
hook_query_alter() is apparently the way to go now
(see http://api.drupal.org/api/drupal/includes--database.inc/function/db_rewr...)
Comment #31
enjaygee CreditAttribution: enjaygee commentedWas receiving the following message:
Notice: Undefined property: stdClass::$old_type in serial.module (line 101). Was able to deal with this by checking if the value was set:
function serial_node_type_update($info) {
// Handle content type rename:
if(isset($info->old_type)) {
if($info->old_type != $info->type) {
module_load_include('inc', 'serial');
_serial_rename_tables($info->old_type, $info->type);
}
}
}
Comment #32
Ollie222 CreditAttribution: Ollie222 commentedUsing Drupal 7 when I set the display to hidden instead of 9999 it shows an blue ring (autocomplete style) which just stays on the screen. If I press save it just reverts back to the 9999 format.
Does anyone else have this issue?
Comment #33
lightstring CreditAttribution: lightstring commentedSubscribing
Comment #34
TommyChrissubscribe
Comment #35
alexmoreno CreditAttribution: alexmoreno commentedhi,
after installing the versión 3 (posted in #11), i get this error every time i try to submit a new node with this field:
Notice: Undefined property: stdClass::$field_serial en locale_field_node_form_submit() (línea 409 de /var/www/facturacion/modules/locale/locale.module).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '17' for key 'nid': INSERT INTO {serial_factura_cliente_field_serial} (nid) VALUES(:nid); Array ( [nid] => 17 ) en _serial_generate_value() (línea 139 de /var/www/facturacion/sites/all/modules/serial/serial.inc).
any idea?
Thanks.
Comment #36
alexmoreno CreditAttribution: alexmoreno commentedchecked the versions in dev and rc1 with same results
Comment #37
Yuri CreditAttribution: Yuri commentedsubscribing
Comment #38
leszek.hanusz CreditAttribution: leszek.hanusz commentedsubscribing
Comment #39
hubrt CreditAttribution: hubrt commentedsubscribed
Comment #40
JohnnyX CreditAttribution: JohnnyX commentedAlso problems after install...
Subscribe
Comment #41
rreimche CreditAttribution: rreimche commentedsubscribing
Comment #42
montchr CreditAttribution: montchr commentedsubscribe
Comment #43
wizian CreditAttribution: wizian commentedsubscribe
Comment #44
david.riches CreditAttribution: david.riches commentedsubscribe
Comment #45
colanIt would seem as though users are experiencing problems.
Comment #46
westbywest CreditAttribution: westbywest commentedsubscribing
Comment #47
field4000 CreditAttribution: field4000 commentedSubscribing.
Comment #48
TommyChrisRenamed issue.
Comment #49
toomanypets CreditAttribution: toomanypets commentedsubscribe -- anyone have any leads on a similar module that is being actively maintained?
Comment #50
colanThere is now a release for D7. Some problems here already exist as other issues. If you can't find your problem in the queue, please create a new issue, but make sure you try the dev version first.
Comment #51
alex.barylski CreditAttribution: alex.barylski commentedNevermind...figured it out...my bad :)