arjen Posted February 14, 2017 Posted February 14, 2017 We needed an option to determine whether 0 or empty should be regarderd as equivalent. I copied the method + config from FieldTypeFloat. In my testing it seems to work fine. I would be cool if someone can test this too. Thanks! See: https://github.com/sforsman/FieldtypeDecimal/pull/2
szabesz Posted September 9, 2017 Posted September 9, 2017 Hi @arjen Does the module work without issues with PW 3.x? I'm planning to use your fork: https://github.com/arjenblokzijl/FieldtypeDecimal I'm wondering if you are willing to add PW namespace so that it does not need the compiler anymore (people can still download old version for PW 2.x from GitHub). Also, you might want to take over maintenance as @sforsman does not seem to be doing it anymore. What do you think?
arjen Posted September 12, 2017 Posted September 12, 2017 We are using it on one ProcessWire install which is used heavily. We have around 20 Decimal fields with over 200k+ pages with all kinds of automated calculations (thanks @Martijn Geerts). Still working fine ... I haven't tried it on other installs, so I would really like to see @sforsman giving his blessing. You might want to test it out yourself. If it works for you I can cover the maintenance, no worries. 2
szabesz Posted September 12, 2017 Posted September 12, 2017 (edited) Thanks for your detailed answer! 14 minutes ago, arjen said: You might want to test it out yourself. If it works for you I can cover the maintenance, no worries. You are being very generous, thank you! In the meantime I did install your fork and did not run into any issues. This filed should be in the core, btw... Let's see what @sforsman has to say. He has not logged in for a while, but one never knows Edited September 12, 2017 by szabesz He has not logged in for a while: not true... sorry 1
szabesz Posted October 25, 2017 Posted October 25, 2017 I submitted a request to include it in the core: https://github.com/processwire/processwire-requests/issues/126 3 1
Kiwi Chris Posted December 15, 2017 Posted December 15, 2017 @szabesz any progress on this? Decimal is a fundamental data type of most dialects of SQL for the reasons that have been outlined in this thread. Over three years and it's still not in the core seems to be a rather long time for what should be a standard fieldtype. It's great someone has done a third-party module, but it would be nice if it were in the core. 2
szabesz Posted December 16, 2017 Posted December 16, 2017 I'm not aware of any additional work on this. Please give it a thumbs up at my GitHub request and you might also want to express why. New features are often added to ProcessWire when it is asked by lots of us... 2
apeisa Posted December 22, 2017 Posted December 22, 2017 Hi guys As a @sforsman's coworker I'll let him know about this. We do use namespaced version of this module ourselves. 4
NorbertH Posted December 10, 2018 Posted December 10, 2018 How can i convert a float field to decimal , decimal does not show up in select list for change fieldtype ?
flydev Posted December 13, 2018 Posted December 13, 2018 On 12/10/2018 at 2:04 PM, NorbertH said: How can i convert a float field to decimal , decimal does not show up in select list for change fieldtype ? In admin.php file : /** * Hook : * Add FieldtypeDecimal to compatible fieldtypes of * a FieldtypeFloat when a superuser need to change the type * of a float field. * * https://modules.processwire.com/modules/fieldtype-decimal/ * https://processwire.com/talk/topic/7542-development-fieldtypefloat-fieldtypedecimal/ * */ $wire->addHookAfter('FieldtypeFloat::getCompatibleFieldtypes', function($event) { if(!$this->modules->isInstalled('FieldtypeDecimal') || !$this->user->isSuperuser()) return; $return = $event->return; $return->set('FieldtypeDecimal', $this->modules->get('FieldtypeDecimal')); $event->return = $return; }); 3
adrian Posted December 13, 2018 Posted December 13, 2018 Or change it in the database - via the link to Adminer in the RequestInfo panel in Tracy is a nice shortcut, but however you get there is fine. 4
flydev Posted December 13, 2018 Posted December 13, 2018 lol so easy @adrian I missed this feature ? edit-ot: really.. what a crazzy job with tracy... 1
stuartsa Posted June 24, 2019 Posted June 24, 2019 Would it be possible to set up a number spinner with the currently advised fieldtype (FieldtypeDecimal/Float)? I can see plenty of situations where that would be helpful. It is not too far off the mark, either, for we already have to set the precision for a "float" (actually a fixed-point number). Suppose I set a precision value k. Then the default value of the spinner step would be 10^-k. However, it could be changed to any number with the precision k. So, for example, I could have a float with the precision 2 and the spinner step set to 0.25. In my experience, while education and leave hours are reported as decimals, they are doled out only in quarter- or half-hours. Thank you!
Robin S Posted June 25, 2019 Posted June 25, 2019 @stuartsa, you can achieve a step setting for InputfieldInteger / InputfieldFloat / InputfieldDecimal by a couple of hooks in /site/ready.php: // Add a step setting to InputfieldInteger / InputfieldFloat / InputfieldDecimal $wire->addHookAfter('Inputfield(className=InputfieldInteger|InputfieldFloat|InputfieldDecimal)::getConfigInputfields', function(HookEvent $event) { $inputfield = $event->object; $field = $inputfield->hasField; if(!$field) return; /* @var InputfieldWrapper $wrapper */ $wrapper = $event->return; /* @var InputfieldText $f */ $f = $event->wire('modules')->InputfieldText; $f->name = 'step'; $f->label = 'Step'; $f->value = $field->step; $f->showIf = 'inputType=number'; $wrapper->add($f); }); // Add step attribute to InputfieldInteger / InputfieldFloat / InputfieldDecimal $wire->addHookBefore('Inputfield(className=InputfieldInteger|InputfieldFloat|InputfieldDecimal)::render', function(HookEvent $event) { /* @var Inputfield $inputfield */ $inputfield = $event->object; $field = $inputfield->hasField; if(!$field || !$field->step || $field->inputType !== 'number') return; $inputfield->attr('step', $field->step); }); 3
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now