Firstly thank you soo much for creating such an awesome module. I think there is a lot of people out there like myself that wanted something like this.
I have a few suggestions that might make this module heaps better.
1. Increment Start Number - It would be great to be able to choose what number you could start from.
2. Prefix or Suffix - The ability to put characters before or after the serial number
3. Re-use Serial - The ability to choose to re-use a serial number after a node has been deleted.
I think thats all I can think of off the top of my head, but double thumbs up for this module!
Regards,
Daimian
Comments
Comment #1
kirsh commentedGood ideas, thanks.
Comment #2
kirsh commentedComment #3
EHA commentedI agree with the ideas here.
Also, in addition to prefix/suffix, there should be a way to "zero-fill" the field to a specified number of digits. Seldom do serial numbers like in invoices or bills show up as variable digit numbers. They are usually fixed at 6 digits or 10 digits or something like that (e.g. 000025).
Looking forward to this. Great module.
Comment #4
mradcliffeThis is a nice module. I'd be willing to write a patch for prefix/suffix and zerofill (number of digits), but this would require a schema update, which would require a lengthy hook_update_N. I don't really have the time for that.
Comment #5
pedrorocha commentedI'm training a team member to develop with Drupal, and his exercise is exactly this "preffix/suffix" patch. I guess this could be done in a week, cause is his first work with Drupal.
About the schema, will be a good training for him..rsrs
Comment #6
mradcliffeI've completed a patch that lets you do the following:
Please review and test the update path on a development environment and not your production environment.
Comment #7
mradcliffeQuick note, things still suffer from performance as in the other issue in this queue.
It would be best to add $sandbox['progress'] capabilities to the upgrade path, fix the form from not updating every node every time when you save the widget/field settings, and when it does update every node make that a batch api like suggested.
Comment #8
kirsh commentedThanks for the patch. I have 2 quick questions:
(1)
It seems that the new allocation algorithm is not atomic anymore (the database serial field was removed) - is it true?
(2)
Why have you changed the schema of the temporary allocation tables? It is only temporary and has nothing to do with the final content that is stored by CCK.
Wouldn't it be better to keep the atomic allocation temporary table schema as is and just alter the stored field content (e.g. in function serial_field)?
Comment #9
acalderon commentedIn my personal experience, the leading zeros can be applied with formatting on the template side. The prefix and suffix can also be set as parameters on the serial's configuration, with no need to change the actual data on the database.
On a different note, to set the start (or next) increment start number would be a great addition.
Comment #10
mradcliffeThat seems kind of hackish to me. If I wanted to setup a view I would need to create a template for the field that did this as well.
I guess this could be out of the scope of a generic serial module although I don't want to create a duplicate module.
@#8
I kind of wanted to keep things consistent with regard to schema for everything. I guess this does not need to be the case. I looked at things from the temporary tables first and kind of just changed it without thinking of any consequences other than consistent data storage.
I guess the temporary tables could store things atomically while the cck field would store as a textfield. This would cut down some code I think.
Comment #11
Architeck commentedPatch from #8 is a great addition, and it works! thanks for the patch
I would like to see a "Set Default Value" or similar option in the future.
Comment #12
peterpoe commentedThis patch creates a block that allows to go to a node entering its serial number:
#740152: Search node by serial block
Comment #13
bocaj commentedLove the module...thanks for your work on this! This is exactly what I was needing for one of my projects. I was using the nid, but since it obviously isn't sequential on a node type level it wasn't real useful.
One thing I would like it see (if it isn't possible already, haven't found it if it is) is to have the option to display the number/label on the page. I am wanting to display the 'issue' (serial) number on the page so that visitors can reference the number directly. I did a work around for this by creating a custom page.tpl.php file for that particular node type, but built-in display, like other CCK fields, would be very nice!
Thanks again for your great work!
Comment #14
killua99 commentedHi, is a great module!
But I want something what I can't get, I'm looking for a same serial nº for each content, but my website is multilingual and I want to share the same serial, is possible make a patch for this 'feature'? also I'm looking if I can make that 'feature'.
If you have a better idea for my problem, tell me.
Regards.
from Madrid, Spain.
Comment #15
killua99 commentedActually see this code I did.
Comment #16
druplicate commented@jacobneher (#13)
You can accomplish this by using the rules module. I populated the node title using the module "node auto title" this way.
See this: http://drupal.org/node/615410
Comment #17
druplicate commentedI would like a feature to reset the counter to zero without uninstalling and reinstalling the serial module.
I have a database that I need to replace with a new one but can't figure out how to reset the counter to zero.
I looked in the DB but couldn't figure it out. I went into the field table entry and set one remaining record to "1" but then when I created a new record of that content type, serial field picked up where it left off (1342) from the old set of records. I had deleted them all previously with a Views Bulk Operations view.
How can I reset the counter?
Comment #18
jolidog commented@killua99
Please don't mark the issue has reviewed and tested if you are the one who created the patch.
Thanks
Comment #19
vicentefoxxx commented@killua99
The patch for multilingual support is not working. First, under the field options i can´t select the Multilingual support. Secondly, every time I create a node i keep getting the same number 20, well, when the node ist created I am gettin 21 but after is translated is 20 and that happens with every single node that I create. So this patch is not working.
I think in Killua99 patch are also included the patch in number 6# and i can confirm that:
specify prefix
specify suffix
specify a minimum length
are working great in my installation and i love that :) but i dont know how to patch :( so i will wait until is added in the new release.
Regards
Comment #20
killua99 commented@Jolidog
Sorry for that, it's not gonna happen again.
@vicentefoxxx
Yes actually my serial.inc is diferent for that I public in the past.
This is my code I use for my website, I change some thing. (maybe this code had bugs or security issue please review)
*****
THIS IS NOT A PATCH
*****
Comment #21
Steel Rat commentedWould love to see the requests at the opening post implemented.
I think this module would go a long way towards universal usefulness if it populated when the node creation form is presented, instead when a node is saved. When creating purchase orders/invoices, the user often needs a PO number to give to a vendor while on the phone, and they may not have created their PO yet. If the field was populated immediately upon hitting create content, then the user would have a PO number immediately available.
Comment #22
pomliane commentedAt first glance, multilingual support is not working here either.
Other new features not tested.
Comment #23
killua99 commentedWell I post a code but it'nt a patch. I'll work this week to make a "version" or something like that to add the "multilingual" support correctly.
Maybe this Wednesday.
Comment #24
pomliane commented@killua99: This would be awesome! I look forward to testing it (and please let me know if I can help).
Comment #25
pomliane commentedI think I've got the first half part(!) of a patch for the multilingual part: it simply checks if the node has a translation source on form validation.
What happens after the creation of a new serial field for a defined content type (the original function counts all the nodes of this content type: sources and translations) is not yet implemented, which is bad — but I'm working on it.
I guess it should probably happen here (in function _serial_init_old_nodes()):
$query = "SELECT DISTINCT nid FROM {node} WHERE type = '%s' ORDER BY nid";With, maybe, something like:
$query = "SELECT DISTINCT nid FROM {node} WHERE type = '%s' AND (tnid = nid OR tnid = 0) ORDER BY nid";There also is no way to choose if once wants to count all node of a type or just one node per translation set, would this be useful to add this option?
Thanks in advance.
EDIT: contrary to the attached file, the multilingual part of the patch is complete and tested as functional here (except there's still no option to choose if once wants to count all node of a type or just one node per translation set, but I'm not sure it's really useful), do you think I'd better open a new issue or post it here?
Comment #26
pomliane commentedComment #27
druplicate commentedAnother possible way around this issue without making code changes:
When the original form is completed and saved, use the Rules module to copy the serial ID to a CCK field, using this technique: #615410: Auto Node-Title cannot use serial field. I am currently using the serial ID in the title using auto-node-title, but you could use any field. That field and assigned ID is then the same for all translations, and can be used for searching with Views, though not sure what would happen if you searched for that ID and were not using the language of the original record. Would the translation system present the correct translation since that ID is the same for three records? I'm assuming it would.
The only other problem is the original record does not have contiguous serial IDs, so for example if the original record has a serial ID of 1000, and there are two translations assigned serial numbers 1001 and 1002, the next original record saved will have an ID of 1003, with translation IDs 1004 and 1005.
This is not a problem for my application, but may be for others.
UPDATE: Oops, this doesn't work - I created a translation of a node and the serial ID/node title did in fact get incremented for each translation. Bummer - should have known better. Have to figure out a way to set a variable that gets stored in the original record, to "0", so that when a translation is saved, that variable is incremented, and subsequently always "1" or greater --> test for that variable when executing the Rules set and not overwrite the node title for translations. I'll work on it and report back.
Comment #28
andypostCode in #20 looks like D7, so maybe better to extend Number module's field Integer? Just a bit to extend widget and add another formatter (could be configurale see #796658: UI for field formatter settings)
By default field should override: multiple disabled so Field Api could store all serial values per table/entity
Removal process should be overriden by the serial modules to leave empty values (for example)
Comment #29
druplicate commentedI tested the code posted in #20, and had to grossly extend the PHP memory and execution time limits but even at that, it never completed after running all night. I have 2,000 existing nodes (but no corresponding translations) that it would have to process, but it never took this long before, so something appears to be stuck.
Once this basic code is proved to be functional, someone needs to integrate the batch api, as the Migrate module did. It's designed expressly for this situation. For those of us with real-world sites and thousands of nodes the batch method of processing is essential. With it you can control how many records you want to process at the outset, and can even arrange for chunks to be processed by CRON.
Add the ability to start the serial field with an offset, i.e. a number other than zero, and we're done!
Comment #30
druplicate commentedAny chance this can get fixed sometime soon?
I really need this to work on a site going to production soon.
My only alternative is to use Rules and some PHP to take the serial ID from the original record and fill in the ID field in the translation when it's saved. That of course wastes the serial ID automatically created by the serial module every time a translation is created, but I could live with that. Maybe there's an easy way to prevent the incrementing of the serial field when a translation node is saved.
Comment #31
pomliane commented@druplicate: Have you tried the patch at #25 ? It does the trick quite well here!
Comment #32
derEremit commentedbtw.
for suffix / prefix you can also combine this module with "computed field"
thats how i did it
Comment #33
webadpro commentedHas the maintainer added any of the features to the module?
Comment #34
kirsh commentedI am closing this thread since it deals with too many different issues.
Prefix / suffix should be discussed on #610152: Prefix / Suffix support.
Sharing serial values between different types should be discussed on #605936: Share serial fields.
Compatibility with multi language should be discussed on #652354: Compatibility for multilanguage.
Initial (starting) serial value should be discussed on #1031542: Option to specify the serial value (initially or later).
Any content in this thread which is still relevant should be posted again to one of the threads above or to a new thread.
Thanks!