{"action":"created","comment":{"url":"https://api.github.com/repos/civicrm/civicrm-core/pulls/comments/73545911","id":73545911,"diff_hunk":"@@ -33,6 +33,23 @@\n  */\n \n /**\n+ * Adjust Metadata for Delete action.\n+ *\n+ * The metadata is used for setting defaults, documentation & validation.\n+ *\n+ * @param array $params\n+ *   Array of parameters determined by getfields.\n+ */\n+function _civicrm_api3_membership_delete_spec(&$params) {\n+  $params['preserve_contribution'] = array(\n+    'api.required' => 0,\n+    'title' => 'Preserve Contribution',\n+    'description' => 'By default this is 0, or 0 if not set. Set to 1 to preserve the associated contribution record when membership is deleted.',","path":"api/v3/Membership.php","position":15,"original_position":15,"commit_id":"0a97a05227b4a8abe7659a3cc23fa2ee38fe2338","original_commit_id":"0a97a05227b4a8abe7659a3cc23fa2ee38fe2338","user":{"login":"joseltorres","id":11579459,"avatar_url":"https://avatars.githubusercontent.com/u/11579459?v=3","gravatar_id":"","url":"https://api.github.com/users/joseltorres","html_url":"https://github.com/joseltorres","followers_url":"https://api.github.com/users/joseltorres/followers","following_url":"https://api.github.com/users/joseltorres/following{/other_user}","gists_url":"https://api.github.com/users/joseltorres/gists{/gist_id}","starred_url":"https://api.github.com/users/joseltorres/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joseltorres/subscriptions","organizations_url":"https://api.github.com/users/joseltorres/orgs","repos_url":"https://api.github.com/users/joseltorres/repos","events_url":"https://api.github.com/users/joseltorres/events{/privacy}","received_events_url":"https://api.github.com/users/joseltorres/received_events","type":"User","site_admin":false},"body":"My concern with @eileenmcnaughton suggestion is that it changes the current behavior. If someone has existing code that deletes a membership with an associated contribution, they will be expecting that contribution to also be deleted. I can see preserving the contribution being a desired behavior, but only if this were a new API or BAO action. My goal was to add this improvement without changing the way any existing calls this this API or BAO behave. ","created_at":"2016-08-04T15:34:20Z","updated_at":"2016-08-04T15:34:20Z","html_url":"https://github.com/civicrm/civicrm-core/pull/8813#discussion_r73545911","pull_request_url":"https://api.github.com/repos/civicrm/civicrm-core/pulls/8813","_links":{"self":{"href":"https://api.github.com/repos/civicrm/civicrm-core/pulls/comments/73545911"},"html":{"href":"https://github.com/civicrm/civicrm-core/pull/8813#discussion_r73545911"},"pull_request":{"href":"https://api.github.com/repos/civicrm/civicrm-core/pulls/8813"}}},"pull_request":{"url":"https://api.github.com/repos/civicrm/civicrm-core/pulls/8813","id":79938847,"html_url":"https://github.com/civicrm/civicrm-core/pull/8813","diff_url":"https://github.com/civicrm/civicrm-core/pull/8813.diff","patch_url":"https://github.com/civicrm/civicrm-core/pull/8813.patch","issue_url":"https://api.github.com/repos/civicrm/civicrm-core/issues/8813","number":8813,"state":"open","locked":false,"title":"crm-19150 Preserve contribution when associated membership is deleted…","user":{"login":"joseltorres","id":11579459,"avatar_url":"https://avatars.githubusercontent.com/u/11579459?v=3","gravatar_id":"","url":"https://api.github.com/users/joseltorres","html_url":"https://github.com/joseltorres","followers_url":"https://api.github.com/users/joseltorres/followers","following_url":"https://api.github.com/users/joseltorres/following{/other_user}","gists_url":"https://api.github.com/users/joseltorres/gists{/gist_id}","starred_url":"https://api.github.com/users/joseltorres/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joseltorres/subscriptions","organizations_url":"https://api.github.com/users/joseltorres/orgs","repos_url":"https://api.github.com/users/joseltorres/repos","events_url":"https://api.github.com/users/joseltorres/events{/privacy}","received_events_url":"https://api.github.com/users/joseltorres/received_events","type":"User","site_admin":false},"body":"Currently when a membership is deleted, if there is an associated contribution then the contribution also gets deleted. This adds the option to preserve the contrition. I suggest this be completed in two steps: 1) The ability the preserver the contribution through code (API and BAO) and 2) UI change to allow front-end users to check a box to preserve the associated contribution. This is step 1.\r\n\r\nhttps://issues.civicrm.org/jira/browse/CRM-19150","created_at":"2016-08-03T16:39:57Z","updated_at":"2016-08-04T15:34:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ad7a92d44c4be9ff3d1e5439557a7fc105af552d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/civicrm/civicrm-core/pulls/8813/commits","review_comments_url":"https://api.github.com/repos/civicrm/civicrm-core/pulls/8813/comments","review_comment_url":"https://api.github.com/repos/civicrm/civicrm-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/civicrm/civicrm-core/issues/8813/comments","statuses_url":"https://api.github.com/repos/civicrm/civicrm-core/statuses/0a97a05227b4a8abe7659a3cc23fa2ee38fe2338","head":{"label":"joseltorres:master","ref":"master","sha":"0a97a05227b4a8abe7659a3cc23fa2ee38fe2338","user":{"login":"joseltorres","id":11579459,"avatar_url":"https://avatars.githubusercontent.com/u/11579459?v=3","gravatar_id":"","url":"https://api.github.com/users/joseltorres","html_url":"https://github.com/joseltorres","followers_url":"https://api.github.com/users/joseltorres/followers","following_url":"https://api.github.com/users/joseltorres/following{/other_user}","gists_url":"https://api.github.com/users/joseltorres/gists{/gist_id}","starred_url":"https://api.github.com/users/joseltorres/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joseltorres/subscriptions","organizations_url":"https://api.github.com/users/joseltorres/orgs","repos_url":"https://api.github.com/users/joseltorres/repos","events_url":"https://api.github.com/users/joseltorres/events{/privacy}","received_events_url":"https://api.github.com/users/joseltorres/received_events","type":"User","site_admin":false},"repo":{"id":64861289,"name":"civicrm-core","full_name":"joseltorres/civicrm-core","owner":{"login":"joseltorres","id":11579459,"avatar_url":"https://avatars.githubusercontent.com/u/11579459?v=3","gravatar_id":"","url":"https://api.github.com/users/joseltorres","html_url":"https://github.com/joseltorres","followers_url":"https://api.github.com/users/joseltorres/followers","following_url":"https://api.github.com/users/joseltorres/following{/other_user}","gists_url":"https://api.github.com/users/joseltorres/gists{/gist_id}","starred_url":"https://api.github.com/users/joseltorres/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joseltorres/subscriptions","organizations_url":"https://api.github.com/users/joseltorres/orgs","repos_url":"https://api.github.com/users/joseltorres/repos","events_url":"https://api.github.com/users/joseltorres/events{/privacy}","received_events_url":"https://api.github.com/users/joseltorres/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/joseltorres/civicrm-core","description":"CiviCRM (Core Application and Framework)","fork":true,"url":"https://api.github.com/repos/joseltorres/civicrm-core","forks_url":"https://api.github.com/repos/joseltorres/civicrm-core/forks","keys_url":"https://api.github.com/repos/joseltorres/civicrm-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/joseltorres/civicrm-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/joseltorres/civicrm-core/teams","hooks_url":"https://api.github.com/repos/joseltorres/civicrm-core/hooks","issue_events_url":"https://api.github.com/repos/joseltorres/civicrm-core/issues/events{/number}","events_url":"https://api.github.com/repos/joseltorres/civicrm-core/events","assignees_url":"https://api.github.com/repos/joseltorres/civicrm-core/assignees{/user}","branches_url":"https://api.github.com/repos/joseltorres/civicrm-core/branches{/branch}","tags_url":"https://api.github.com/repos/joseltorres/civicrm-core/tags","blobs_url":"https://api.github.com/repos/joseltorres/civicrm-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/joseltorres/civicrm-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/joseltorres/civicrm-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/joseltorres/civicrm-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/joseltorres/civicrm-core/statuses/{sha}","languages_url":"https://api.github.com/repos/joseltorres/civicrm-core/languages","stargazers_url":"https://api.github.com/repos/joseltorres/civicrm-core/stargazers","contributors_url":"https://api.github.com/repos/joseltorres/civicrm-core/contributors","subscribers_url":"https://api.github.com/repos/joseltorres/civicrm-core/subscribers","subscription_url":"https://api.github.com/repos/joseltorres/civicrm-core/subscription","commits_url":"https://api.github.com/repos/joseltorres/civicrm-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/joseltorres/civicrm-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/joseltorres/civicrm-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/joseltorres/civicrm-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/joseltorres/civicrm-core/contents/{+path}","compare_url":"https://api.github.com/repos/joseltorres/civicrm-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/joseltorres/civicrm-core/merges","archive_url":"https://api.github.com/repos/joseltorres/civicrm-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/joseltorres/civicrm-core/downloads","issues_url":"https://api.github.com/repos/joseltorres/civicrm-core/issues{/number}","pulls_url":"https://api.github.com/repos/joseltorres/civicrm-core/pulls{/number}","milestones_url":"https://api.github.com/repos/joseltorres/civicrm-core/milestones{/number}","notifications_url":"https://api.github.com/repos/joseltorres/civicrm-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/joseltorres/civicrm-core/labels{/name}","releases_url":"https://api.github.com/repos/joseltorres/civicrm-core/releases{/id}","deployments_url":"https://api.github.com/repos/joseltorres/civicrm-core/deployments","created_at":"2016-08-03T16:25:43Z","updated_at":"2016-08-03T16:25:57Z","pushed_at":"2016-08-04T00:10:00Z","git_url":"git://github.com/joseltorres/civicrm-core.git","ssh_url":"git@github.com:joseltorres/civicrm-core.git","clone_url":"https://github.com/joseltorres/civicrm-core.git","svn_url":"https://github.com/joseltorres/civicrm-core","homepage":null,"size":127528,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"civicrm:master","ref":"master","sha":"49d5668c6812be278858e2c9e0daf2b3735cf542","user":{"login":"civicrm","id":136373,"avatar_url":"https://avatars.githubusercontent.com/u/136373?v=3","gravatar_id":"","url":"https://api.github.com/users/civicrm","html_url":"https://github.com/civicrm","followers_url":"https://api.github.com/users/civicrm/followers","following_url":"https://api.github.com/users/civicrm/following{/other_user}","gists_url":"https://api.github.com/users/civicrm/gists{/gist_id}","starred_url":"https://api.github.com/users/civicrm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/civicrm/subscriptions","organizations_url":"https://api.github.com/users/civicrm/orgs","repos_url":"https://api.github.com/users/civicrm/repos","events_url":"https://api.github.com/users/civicrm/events{/privacy}","received_events_url":"https://api.github.com/users/civicrm/received_events","type":"Organization","site_admin":false},"repo":{"id":8495499,"name":"civicrm-core","full_name":"civicrm/civicrm-core","owner":{"login":"civicrm","id":136373,"avatar_url":"https://avatars.githubusercontent.com/u/136373?v=3","gravatar_id":"","url":"https://api.github.com/users/civicrm","html_url":"https://github.com/civicrm","followers_url":"https://api.github.com/users/civicrm/followers","following_url":"https://api.github.com/users/civicrm/following{/other_user}","gists_url":"https://api.github.com/users/civicrm/gists{/gist_id}","starred_url":"https://api.github.com/users/civicrm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/civicrm/subscriptions","organizations_url":"https://api.github.com/users/civicrm/orgs","repos_url":"https://api.github.com/users/civicrm/repos","events_url":"https://api.github.com/users/civicrm/events{/privacy}","received_events_url":"https://api.github.com/users/civicrm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/civicrm/civicrm-core","description":"CiviCRM (Core Application and Framework)","fork":false,"url":"https://api.github.com/repos/civicrm/civicrm-core","forks_url":"https://api.github.com/repos/civicrm/civicrm-core/forks","keys_url":"https://api.github.com/repos/civicrm/civicrm-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/civicrm/civicrm-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/civicrm/civicrm-core/teams","hooks_url":"https://api.github.com/repos/civicrm/civicrm-core/hooks","issue_events_url":"https://api.github.com/repos/civicrm/civicrm-core/issues/events{/number}","events_url":"https://api.github.com/repos/civicrm/civicrm-core/events","assignees_url":"https://api.github.com/repos/civicrm/civicrm-core/assignees{/user}","branches_url":"https://api.github.com/repos/civicrm/civicrm-core/branches{/branch}","tags_url":"https://api.github.com/repos/civicrm/civicrm-core/tags","blobs_url":"https://api.github.com/repos/civicrm/civicrm-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/civicrm/civicrm-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/civicrm/civicrm-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/civicrm/civicrm-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/civicrm/civicrm-core/statuses/{sha}","languages_url":"https://api.github.com/repos/civicrm/civicrm-core/languages","stargazers_url":"https://api.github.com/repos/civicrm/civicrm-core/stargazers","contributors_url":"https://api.github.com/repos/civicrm/civicrm-core/contributors","subscribers_url":"https://api.github.com/repos/civicrm/civicrm-core/subscribers","subscription_url":"https://api.github.com/repos/civicrm/civicrm-core/subscription","commits_url":"https://api.github.com/repos/civicrm/civicrm-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/civicrm/civicrm-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/civicrm/civicrm-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/civicrm/civicrm-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/civicrm/civicrm-core/contents/{+path}","compare_url":"https://api.github.com/repos/civicrm/civicrm-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/civicrm/civicrm-core/merges","archive_url":"https://api.github.com/repos/civicrm/civicrm-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/civicrm/civicrm-core/downloads","issues_url":"https://api.github.com/repos/civicrm/civicrm-core/issues{/number}","pulls_url":"https://api.github.com/repos/civicrm/civicrm-core/pulls{/number}","milestones_url":"https://api.github.com/repos/civicrm/civicrm-core/milestones{/number}","notifications_url":"https://api.github.com/repos/civicrm/civicrm-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/civicrm/civicrm-core/labels{/name}","releases_url":"https://api.github.com/repos/civicrm/civicrm-core/releases{/id}","deployments_url":"https://api.github.com/repos/civicrm/civicrm-core/deployments","created_at":"2013-03-01T06:11:56Z","updated_at":"2016-08-01T14:37:57Z","pushed_at":"2016-08-04T12:58:50Z","git_url":"git://github.com/civicrm/civicrm-core.git","ssh_url":"git@github.com:civicrm/civicrm-core.git","clone_url":"https://github.com/civicrm/civicrm-core.git","svn_url":"https://github.com/civicrm/civicrm-core","homepage":null,"size":165489,"stargazers_count":158,"watchers_count":158,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":442,"mirror_url":null,"open_issues_count":108,"forks":442,"open_issues":108,"watchers":158,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/civicrm/civicrm-core/pulls/8813"},"html":{"href":"https://github.com/civicrm/civicrm-core/pull/8813"},"issue":{"href":"https://api.github.com/repos/civicrm/civicrm-core/issues/8813"},"comments":{"href":"https://api.github.com/repos/civicrm/civicrm-core/issues/8813/comments"},"review_comments":{"href":"https://api.github.com/repos/civicrm/civicrm-core/pulls/8813/comments"},"review_comment":{"href":"https://api.github.com/repos/civicrm/civicrm-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/civicrm/civicrm-core/pulls/8813/commits"},"statuses":{"href":"https://api.github.com/repos/civicrm/civicrm-core/statuses/0a97a05227b4a8abe7659a3cc23fa2ee38fe2338"}}}}
{"actor":{"display_login":"joseltorres"}}