Details:

My project page can be found here: https://www.drupal.org/sandbox/nikunjkotecha/2700951

I have also setup a demo for the same, you can create account (since that is required in functionality) and create content for Addressfield Demo CT to check the functionality on http://sites.nik4u.com/drupal-demo/

Code:

The git clone command would be:

git clone --branch 7.x-1.x http://git.drupal.org/sandbox/nikunjkotecha/2700951.git addressfield_copy

Any comments, suggestions, or advice is welcome.

Pareview result:

http://pareview.sh/pareview/httpgitdrupalorgsandboxnikunjkotecha2700951git
There are some JavaScript issues related to strict standards which I am not sure if I should use (especially ===) as it is for Drupal 7 with jQuery dependency.
Also for using $form_state['input']. comment is added in code to justify the reason for it, which actually is copied from Addressfield module.

Note: I have got one more project application (older) and it's in RTBC as of now but since the code was not enough it was tagged as PAReview: Single project promote, check https://www.drupal.org/node/2693841 for more details.

Comments

nikunjkotecha created an issue. See original summary.

PA robot’s picture

Multiple Applications
It appears that there have been multiple project applications opened under your username:

Project 1: https://www.drupal.org/node/2701025

Project 2: https://www.drupal.org/node/2693841

As successful completion of the project application process results in the applicant being granted the 'Create Full Projects' permission, there is no need to take multiple applications through the process. Once the first application has been successfully approved, then the applicant can promote other projects without review. Because of this, posting multiple applications is not necessary, and results in additional workload for reviewers ... which in turn results in longer wait times for everyone in the queue. With this in mind, your secondary applications have been marked as 'closed(duplicate)', with only one application left open (chosen at random).

If you prefer that we proceed through this review process with a different application than the one which was left open, then feel free to close the 'open' application as a duplicate, and re-open one of the project applications which had been closed.

I'm a robot and this is an automated message from Project Applications Scraper.

PA robot’s picture

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

nikunjkotecha’s picture

In response to https://www.drupal.org/node/2701025#comment-11045065, for the first application, since the code was not enough for review, it was tagged as PAReview: Single project promote, I have enough code and number of functions in this module and hoping for the permission/role to be granted this time.

nikunjkotecha’s picture

Issue summary: View changes
harish b’s picture

Hi nikunjkotecha,

Please check permissions to demo link(http://sites.nik4u.com/drupal-demo/) -- Access Denied for anonymous user.
I installed your module dint went through the code yet, it looks good for me and working properly. Actually it will be very helps to copy existing address fields instead of filling all the time.
My suggestion is : you can label/title for address example : Home, office .. etc.

Issue with addressfield_copy Scenario : I added one address for the first time and saved it. i added one extra field(First Name) to address field form and copied the existing address by clicking on copy button, and added First name field and saved. Instead of updating the existing Address, It is creating new one(Duplicate address). And again if i am trying to copy new address, It is not copying the First Name field.

nikunjkotecha’s picture

@harish:

Thanks for your time and feedback.

For access denied, since it requires an authenticated user, you will need to create an account. You can use mine - user: nikunj / pass: test if you want and feel free to create your own account on the demo site. To reduce spamming I have kept email verification required.

One of the main purpose of the module is not to add a separate entity and keep all the addresses stored separately. Unlike User addressbook where you want the address to change everywhere if you make change in addressbook, this is more like a utility for content creators to copy data from already submitted addresses. Each address will be stored separately and it won't affect already submitted values/entities.

About giving names to addresses like Home/Office/etc., it will make more sense in scenarios where we are storing it as entity. This is for mainly content oriented sites where address is used for location or more generic purposes and not for shipping and re-using. Current scenario: As an admin I need to create multiple events/jobs/etc. where address is required to allow users to know location of event or job location. It may be in same city but just different buidling or may be same location multiple times. I can copy from existing and change any of the data if required.

Let me know if it still doesn't makes sense.

PA robot’s picture

Multiple Applications
It appears that there have been multiple project applications opened under your username:

Project 1: https://www.drupal.org/node/2701025

Project 2: https://www.drupal.org/node/2693841

As successful completion of the project application process results in the applicant being granted the 'Create Full Projects' permission, there is no need to take multiple applications through the process. Once the first application has been successfully approved, then the applicant can promote other projects without review. Because of this, posting multiple applications is not necessary, and results in additional workload for reviewers ... which in turn results in longer wait times for everyone in the queue. With this in mind, your secondary applications have been marked as 'closed(duplicate)', with only one application left open (chosen at random).

If you prefer that we proceed through this review process with a different application than the one which was left open, then feel free to close the 'open' application as a duplicate, and re-open one of the project applications which had been closed.

I'm a robot and this is an automated message from Project Applications Scraper.

ajalan065’s picture

Status: Active » Needs work

Hi nikunjkotecha,
I have not gone through the functionality testing of the project.
However, on having a quick review of the code, I found these issues:
1. README file is empty
2. In the *.module, you have used a function _addressfield_country_options_list(). However, you have not defined it anywhere.
3. In the hook_field_widget_form(), you may just have this check

if(!isset($countries[$address['country']])) {...}

I will do a review again a little later :)
Meanwhile please fix these up.

nikunjkotecha’s picture

Hi Arpit,

Thanks for your time and feedback.

1. Updated, thanks for reminding on that.
2. _addressfield_country_options_list - this is defined in the dependent module addressfield
3. Majority of this code is copied from addressfield and only required changes are done.

Let me know your thoughts on this and further feedback whenever you get chance.

Thanks,
Nikunj

nikunjkotecha’s picture

Status: Needs work » Needs review
bazaalt.organ’s picture

Hi nikunjkotecha,

In the addressfield_copy.js file you should use var in your loop definition:
for (var i in select_json) {
instead of
for (i in select_json) {
to avoid possible global variable overriding.

nikunjkotecha’s picture

Thanks @bazaalt.organ for the suggestion, I have committed the change.

hesnvabr’s picture

1. Change the git default branch:-
Edit your project
Click the "Default branch" tab
Select the desired branch
Click Save

2. FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
---------------------------------------------------------------------------
106 | WARNING | Do not use the raw $form_state['input'], use
| | $form_state['values'] instead where possible
107 | WARNING | Do not use the raw $form_state['input'], use
| | $form_state['values'] instead where possible

nikunjkotecha’s picture

Thanks @pranavbabbar for the tip to set the default branch.

About point 2 - comments added in code on reason to use this way, and this is copied from addressfield module. Mentioned the same in ticket description as well.

  // If the form has been rebuilt via AJAX, use the form state values.
  // $form_state['values'] is empty because of #limit_validation_errors, so
  // $form_state['input'] needs to be used instead.

Let me know.

harish b’s picture

Hi nikunjkotecha,

Issue with module while testing, I had saved one address on colombia country with particular fields. When i tried to create another entity and copied addressfield using copy button for different country, Fields won't change automatically. I mean fields should automatically change according to saved address fields.

harish b’s picture

Status: Needs review » Needs work
nikunjkotecha’s picture

Status: Needs work » Needs review

Hi @harish,

Good point, it was not originally thought as goal but adding that to future list of enhancements - allow copy across multiple countries.

Problem with that is we could have different fields per country and with the scenarios that originally this was developed with don't cover this one.

Thanks,
Nikunj

hesnvabr’s picture

/var/www/html/d7/addressfield_copy/js (7.x-1.x=) $ cat addressfield_copy.js
In addressfield_copy.js file at if condition i think you need to equal both (type and value)
Therefore use === rather than ==
1). line 15, col 22,
2). line 24, col 15.

nikunjkotecha’s picture

Status: Needs review » Closed (outdated)
apaderno’s picture

Status: Closed (outdated) » Closed (duplicate)
Related issues: +#2907719: [D8] Permanent Cache Bin