Closed (fixed)
Project:
Money field
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
16 Oct 2008 at 16:04 UTC
Updated:
19 Nov 2008 at 17:24 UTC
Jump to comment: Most recent file
Comments
Comment #1
wim leersSorry, I'm no longer maintaining this module: http://wimleers.com/blog/how-much-is-too-much. Unfortunately, nobody has stepped up yet to maintain it.
Comment #2
ztyx commentedHi, I'm also offering my help in this matter although I need to look into the new CCK API before I know where to begin. Anyone who's got any good resources for CCK (Drupal 6) programming?
Holler if there's anything I can do without CCK knowledge.
Comment #3
ztyx commentedYes, CCK currently lacks documentation there is some information about how to upgrade CCK Fields from 5.x to 6.x and a tutorial on how to create a CCK field in 5.x. They are all part of the CCK documentation. But my best bet is to have a look at the Number and Text modules (in CCK bundle) that are supposed to be thoroughly documented.
Comment #4
wim leersztyx: Awesome! Does this mean you'd like to become the maintainer for this module? :)
Comment #5
ztyx commentedWim: Haha, you're good! :) I will see what I can do with the code. If I manage to port it to D6 I will also consider maintaining it.
Comment #6
ztyx commentednewmediaist: The Currency CCK module also has a lot of comments.
Comment #7
markus_petrux commentedHi all,
I've been talking via emal with Wim, and I'll be porting the module to CCK 2 / Drupal 6. I'm now finishing the code for the Formatted Number CCK module, and then I'll start working on this one. The other module is almost ready. I just need to figure out which is the recommended method to implement field validation, which seems to me a bit inconsistent (ref. #332176: Best practices for implementing validation routines for CCK fields?).
The Money CCK field for CCK 2 / Drupal 6 will also require the Format Number API module, which is a small thing that will offer a consistent method to format number with site/user specified thousands separator and decimal points.
I'll be updaing this issue as progress is being made... and you can also check the commit log... I hope to get soon access to create releases and so on too.
Thanks to Wim for his confidence to me. :)
Cheers
Comment #8
markus_petrux commentedLet me change the issue title. It's easier for me to track it from the "My recent posts" page.
Comment #9
wim leersGo go Markus! :)
Comment #10
ztyx commentedHi again Markus,
It seems you and me are working on the same projects nowadays :-P It's also very funny that I was planning on using Format Number API for this module...
As I am pretty certain you are the better Drupaler and programmer of the two of us I am attaching a patch (
diff -N money money.new) of what I've been working on. The patch contains the code I've changed so far, but also the new filemoney.install(which for some reason could not be attached to my comment).My code is not functional, but who knows, maybe you can use snippets of it. I believe the field part should work and the widget part is the one that needs more attention. I had just figured out pretty much what to do with it, but it'll probably take me a week or two to implement it. Also Format Number needs to be incorporated while removing the old formatting code, but you know all that. ;-)
Good luck,
Jens
Edit: This patch had the wrong (non-unified) format. Have a look this patch instead.
Comment #11
ztyx commentedComment #12
markus_petrux commentedInstall script comitted:
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/money/money...
Though, I locked the installation using hook_requirements('install') until the real coding for the port starts to get into... hopefuly next week.
@Jens: thank you very much, I'll take a look. However, patches need to be generated using unified style. Please, see: http://drupal.org/patch/create
Comment #13
wim leersWow! It's great to see so much interest in this module, and even more to see the community bringing two developers together :)
Rock on, Drupal! :)
Comment #14
ztyx commented@Markus: My apologizes, I forgot the unified flag. I'm attaching a new, correctly formatted, patch.
@Wim: Well, it's a practical module! :)
Comment #15
markus_petrux commentedHi all, :)
DONE:
TODO:
I'm setting this issue as being fixed. It almost is. Please, check out BETA1 and open separate issues for anything that you may find.
Cheers :)
Comment #16
wim leersGreat Markus, thanks :)
Comment #17
markus_petrux commentedYep!
I added/fixed a few things, including the move of allowed currencies option from field settings to widget settings (makes more sense). I tested it all and I feel it's pretty stable, so I released RC1.
Again, please open separate issues for anything that you may wish to get fixed before 1.0 is launched ...with all its underlying consequences. :)
Comment #18
ztyx commented@markus: Did you get an answer to this?
Comment #19
markus_petrux commentedNope. So I had to figure out that myself.
AFAICT, the validation implemented via FAPI is only invoked when FAPI is involved. That is when a form is processed.
CCK invokes hook_field('validation') when a form is processed, but also when a field value is computed programatically. For example, when a default value is generated using PHP code. Another use of this is when nodeapi('validate') is processed, when a "populate a field" action is processed, etc.
So if you implement validation only using FAPI, there may be situations where invalid data gets into the database, which is something that may happen in builtin CCK Number because it validates different things in both validations routines.
Comment #20
wim leersThis is your baby now, but I have to disagree with
Allowed currencies is associated with the field, not with the widget.
The widget is just one of many possible ways for representing the input. Therefore it should be the same for all input representations. Therefore it should be a field setting.
Comment #21
markus_petrux commentedhmm... I haven't used CCK in D5, so I can't tell.
AFAICT, in D6 one of the differences between field settings and widget settings is that the former are global, and the later local. You can create a field for one content type and reuse the field definition across content types. If you do, then CCK creates a separate table for the field, so the field settings should be the same for all content types reusing a particular field.
Moving the allowed currencies option to the widget settings allows you to share a field across multiple content types, but have different options for the widget, including allowed currencies, the format of the select opcions (currency name or currency code), while the internal data format remains the same (which is what's configured in field settings).
If you move the allowed currencies option to field settings, you'll have to create different CCK fields if you need to use a different set of currencies for different content types, and CCK will use different tables for them. That means you'll be limited when using views, where you'll be forced to use more joins, or you'll have to add more conditions to get a list of nodes of different types that have a money field greater than X value, for example.
If you move the allowed currencies option to widget settings, then it's up to the site admin create one single field or more. It gives you more freedom.
Thoughts?
Comment #22
wim leersInteresting, I didn't know about the differences in setting sharing when sharing a field across content types. I'd consider that a bug in CCK. I didn't know that, so you've completely convinced me that this is the best solution for now, i.e. till CCK 3 or so :)
Comment #23
markus_petrux commentedSweet! :)
I agree with you that "allowed currencies" conceptually belongs to field settings, but I opted for the option that offers more freedom to site admins.
Now, if there's no bug in current code, we could release this. Though, we would have to review the information of the module in the project page (requirements, description, differences between D5 -vs- D6, ...). I would, if I could :( (Related request: #332196: Request to take over maintainership of the Money CCK field module).
Comment #24
markus_petrux commented