Pls is there any D7 version for format_number? Thanks

Comments

parka’s picture

It will be great if there's a release for D7

lloydpearsoniv’s picture

+1

yannisc’s picture

+1

SQP’s picture

Status: Active » Needs review
StatusFileSize
new9.74 KB

Here's a first version of the drupal 7 port of the module.

As I didn't played enough with the new fields api, I only ported the core part of the module : the format_number function and the admin + user configuration.
Global config is available at admin/config/regional/format_number

I use it for 2 weeks on my development site without any issues.

Hope it will already help some people.

(the part that still need work start at hook_elements in module file)

Anonymous’s picture

Hi SQP,

I'm trying to install the patch with git, I tried several commands, but I'm unable to get it to work. Could you please tell me what's the correct command line I should use.

I tried git on version 6.x-1.6 and 6.x-1.x-dev and it didn't work.

Help is really appreciated.

Thanks!

sylvanos’s picture

same problem here

SQP’s picture

Hi, thanks for your test. Could you try with those commands

git clone --branch 6.x-1.x http://git.drupal.org/project/format_number.git
cd format_number
wget http://drupal.org/files/issues/format_number_drupal_7_version_api-1091914-4.patch
git apply -v format_number_drupal_7_version_api-1091914-4.patch

Seem to patch well, but didn't retested it yet.

sylvanos’s picture

Thanks, the installation went well for me. Probably me not knowing how the module works, but I've set the Thousands separator to comma (,) and i still can't write a number like 1,200 in a numerical field. Drupal still tells me that only numbers may be written in those fields.

Anonymous’s picture

Thanks! the installation went well for me as well! ^_^

trampjuice’s picture

Fantastic - missed this since upgrading to drupal 7. But after applying the patch as per above i get this;

Warning: Missing argument 4 for format_number_numericfield_process(), called in C:\xampp\htdocs\evictionsfrom10pounds.com\includes\form.inc on line 1748 and defined in format_number_numericfield_process() (line 422 of C:\xampp\htdocs\hhh.com\sites\all\modules\format_number\format_number.module).

when doing this on a form

$form['my_number'] = array(
'#type' => 'numericfield',
'#title' => t('My number'),
'#precision' => 10,
'#decimals' => 2,
'#minimum' => 0,
'#maximum' => 123456.99,
'#default_value' => 0,
);

jonathan_hunt’s picture

FWIW, I migrated my formatted_number fields to D7 number fields by altering the database then using the CCK Content Migration in Drupal 7.
e.g. (substitute your fieldname in the queries below)

drush sqlq "UPDATE {content_node_field} SET type='number_decimal' WHERE field_name='[field_name]';"
drush sqlq "UPDATE {content_node_field} SET module='number' WHERE field_name='[field_name]';"

drush sqlq "UPDATE {content_node_field_instance} SET widget_type='number' WHERE field_name='[field_name]'"
drush sqlq "UPDATE {content_node_field_instance} SET widget_module='number' WHERE field_name='[field_name]'"
Shadlington’s picture

Subbing

jeevajothi’s picture

I installed D7 but i dont' know how to do above work. in which software i have to do it...i need step by step.anybody can please send me..

jeevajothi’s picture

wget not found error in my git.

please help to install format_number api in d7

basicmagic.net’s picture

subscribe

pepemty’s picture

subscribing

tinker’s picture

Thanks @SQP for doing the first conversion to D7. I had the following issues when adding a numericfield form element.

  1. The were errors rendering as reported by @trampjuice which meant the element was visible
  2. The JavaScript did not work because it was not attaching to the element
  3. Used D6 hook_perm

Today is the first time I looked at the new D7 hooks so I welcome a thorough review of my code changes as I may have done something wrong. Saying that everything does appear to be working without errors. I have attached a cumulative patch that can be applied to 6.x-1.x-dev branch source.

Perhaps a committer could open a 7.x-1.x-dev branch so we could appropriately add issues? I would be happy to co maintain the 7.x branch.

I am hoping to use this module as a first wave into extending Drupal's multilingual support of non textual data. The first step would be to add number formats settings per locale [language/country]. See #1345758: META: Provide locale (regional) formats framework for automated translation of non textual data

markus_petrux’s picture

@tinker: I may not have enough time to review/apply patches here. If you wish, I would be glad to grant co-maintainer access to Format Number API (and maybe Formatted Number CCK) to you or someone else involved in #1345758: META: Provide locale (regional) formats framework for automated translation of non textual data .

excel86’s picture

Priority: Normal » Critical

I tried applying the patches to 6.x-1.x-dev, but it came back with errors. I would greatly appreciate it if there is a release for D7. Thank you very much.

tinker’s picture

@markus_petrux, I would be happy to maintain a 7.x-0.x-dev branch so please add me. Do you think GIT only access until somewhat stable?

@excel86, Did you apply just the patch from #17? It is cumulative and includes all changes from #4. Applying both will cause errors. Perhaps you could share the error messages?

markus_petrux’s picture

Category: support » task
Priority: Critical » Normal

@tinker: I have given you access to GIT, but also to project page and releases, just in case. If you also need access to Formatted Number CCK, just ask. Thanks!

I have also contacted cweagans, who recently asked for co-maintainership access to these projects, in case he's been working in the D7 ports, or just to let him know.

PS: Adjusting issue attributes. @excel86: I think 'critical' priority is related to bugs, things that are 'broken'.

excel86’s picture

@tinker, thanks a lot for helping to develop the D7 version, it will be extremely helpful for me. I am still new to all this, so I had some difficulty applying the patches. I did just try to apply the patch from #17 (not #4) but it didn't work for me. I had applied the patch following the above instructions to the 6.x-1.x-dev files which I had saved to my C: drive, then tried to upload that to my Drupal site. Would it work that way?

@markus_petrux, thanks for letting me know that, i'm still new to all this, so my apologies there.

erkiha’s picture

this patch works perfectly for me. Thank you very much. Is there a patched version of this module available somewhere to make the maintenance easier?

markus_petrux’s picture

Status: Needs review » Fixed

@erkiha & all: Thanks a lot for testing and confirming.

@SQP, tinker: Thank you very much for the job.

I have commit a slight variation of the patch in #17:

- http://drupalcode.org/project/format_number.git/commit/e52ee8a46466f4aa7...

I have also created a new dev release for the D7 branch, tha should be available as soon as the Drupal package is built (I think that happens twice a day).

- http://drupal.org/node/1419952

Please, open separate tickets to the D7 for each issue that may still be there. Thanks!

erkiha’s picture

hm, d7 branch does not work at all. I.e. settings appear but when I use numericfield in my custom form, it does not show that fied. Reverted back to patch #17. Is there anything different which I should take into account?

markus_petrux’s picture

Opps, I applied the patch manually, because I wanted to avail the oportunity to practice D6->D7 ports, and forgot to apply one little change in the .module script. Try the following:

Change to file format_number.module

-function format_number_elements() {
+function format_number_element_info() {

Anyway, I have just fixed a couple more issues (coder warnings), and it might be better to wait for the next dev snapshot, which is already visible from the project page.

Apologies for the noise.

erkiha’s picture

Now it works OK, thank you.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.