{"action":"created","comment":{"url":"https://api.github.com/repos/xtuple/qt-client/pulls/comments/29450018","id":29450018,"diff_hunk":"@@ -179,39 +179,44 @@ void locations::sFillList()\n                \"FROM location  \"\n                \" JOIN whsinfo ON (location_warehous_id=warehous_id) \"\n                \" LEFT OUTER JOIN whsezone ON (location_whsezone_id=whsezone_id) \"\n-               \" WHERE ( (true)\" );\n+               \" WHERE ( (true)\" \n+               \" <? if exists(\\\"warehous_id\\\") ?>\"\n+               \" AND (warehous_id=<? value(\\\"warehous_id\\\") ?>) \"\n+               \" <? endif ?> \"\n+               \" <? if exists(\\\"zone_id\\\") ?>\"\n+               \" AND (location_whsezone_id=<? value(\\\"zone_id\\\") ?>) \"\n+               \" <? endif ?> ) \"\n+               \"ORDER BY warehous_code, locationname;\");\n+\n+  MetaSQLQuery  mql(sql);\n+  ParameterList params;\n \n   if (_warehouse->isSelected())\n-    sql += \" AND (warehous_id=:warehous_id)\";\n-\n+    params.append(\"warehous_id\", _warehouse->id());\n   if (_zone->id() > 0)\n-    sql += \" AND (location_whsezone_id=:zone_id)\";\n+    params.append(\"zone_id\", _zone->id());\n \n-  sql += \" ) \"\n-         \"ORDER BY warehous_code, locationname;\";\n-\n-  locationsFillList.prepare(sql);\n-  locationsFillList.bindValue(\":warehous_id\", _warehouse->id());\n-  locationsFillList.bindValue(\":zone_id\", _zone->id());\n-  locationsFillList.exec();\n-  _location->populate(locationsFillList);\n+  XSqlQuery locationsFillList = mql.toQuery(params);\n+  if (locationsFillList.first())\n+    _location->populate(locationsFillList);\n }\n \n void locations::updateZoneList()\n {\n-  XSqlQuery zoneFillList;\n   QString zoneSql( \"SELECT whsezone_id, whsezone_name||'-'||whsezone_descrip \"\n              \" FROM whsezone  \"\n-             \" WHERE ((true)  \" );\n-  if (_warehouse->isSelected())\n-    zoneSql += \" AND (whsezone_warehous_id=:warehous_id)\";\n+             \" <? if exists(\\\"warehous_id\\\") ?> \"\n+             \" WHERE (whsezone_warehous_id = <? value(\\\"warehous_id\\\") ?>) \"\n+             \" ORDER BY whsezone_name;\");","path":"guiclient/locations.cpp","position":64,"original_position":64,"commit_id":"9beeec2ba3acfd523468bd73761bd4956a7e2f6c","original_commit_id":"9beeec2ba3acfd523468bd73761bd4956a7e2f6c","user":{"login":"gilmoskowitz","id":704111,"avatar_url":"https://avatars.githubusercontent.com/u/704111?v=3","gravatar_id":"","url":"https://api.github.com/users/gilmoskowitz","html_url":"https://github.com/gilmoskowitz","followers_url":"https://api.github.com/users/gilmoskowitz/followers","following_url":"https://api.github.com/users/gilmoskowitz/following{/other_user}","gists_url":"https://api.github.com/users/gilmoskowitz/gists{/gist_id}","starred_url":"https://api.github.com/users/gilmoskowitz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gilmoskowitz/subscriptions","organizations_url":"https://api.github.com/users/gilmoskowitz/orgs","repos_url":"https://api.github.com/users/gilmoskowitz/repos","events_url":"https://api.github.com/users/gilmoskowitz/events{/privacy}","received_events_url":"https://api.github.com/users/gilmoskowitz/received_events","type":"User","site_admin":false},"body":"Missing `endif`?\r\nAlso, FYI - MetaSQL can handle either single- or double-quotes so there's no need to backslash-\".","created_at":"2015-04-30T17:22:59Z","updated_at":"2015-04-30T17:22:59Z","html_url":"https://github.com/xtuple/qt-client/pull/669#discussion_r29450018","pull_request_url":"https://api.github.com/repos/xtuple/qt-client/pulls/669","_links":{"self":{"href":"https://api.github.com/repos/xtuple/qt-client/pulls/comments/29450018"},"html":{"href":"https://github.com/xtuple/qt-client/pull/669#discussion_r29450018"},"pull_request":{"href":"https://api.github.com/repos/xtuple/qt-client/pulls/669"}}},"pull_request":{"url":"https://api.github.com/repos/xtuple/qt-client/pulls/669","id":34206352,"html_url":"https://github.com/xtuple/qt-client/pull/669","diff_url":"https://github.com/xtuple/qt-client/pull/669.diff","patch_url":"https://github.com/xtuple/qt-client/pull/669.patch","issue_url":"https://api.github.com/repos/xtuple/qt-client/issues/669","number":669,"state":"open","locked":false,"title":"Fix Distribute layout.  Convert locations sql to metaSQL","user":{"login":"andersdd","id":4682742,"avatar_url":"https://avatars.githubusercontent.com/u/4682742?v=3","gravatar_id":"","url":"https://api.github.com/users/andersdd","html_url":"https://github.com/andersdd","followers_url":"https://api.github.com/users/andersdd/followers","following_url":"https://api.github.com/users/andersdd/following{/other_user}","gists_url":"https://api.github.com/users/andersdd/gists{/gist_id}","starred_url":"https://api.github.com/users/andersdd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andersdd/subscriptions","organizations_url":"https://api.github.com/users/andersdd/orgs","repos_url":"https://api.github.com/users/andersdd/repos","events_url":"https://api.github.com/users/andersdd/events{/privacy}","received_events_url":"https://api.github.com/users/andersdd/received_events","type":"User","site_admin":false},"body":"Fixes to Item Distribution Layout.  Update sql in locations screen to metaSQL","created_at":"2015-04-27T20:23:26Z","updated_at":"2015-04-30T17:22:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"38dd3fd3aa2c1ff45c87195b884af3e47ca0f039","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/xtuple/qt-client/pulls/669/commits","review_comments_url":"https://api.github.com/repos/xtuple/qt-client/pulls/669/comments","review_comment_url":"https://api.github.com/repos/xtuple/qt-client/pulls/comments{/number}","comments_url":"https://api.github.com/repos/xtuple/qt-client/issues/669/comments","statuses_url":"https://api.github.com/repos/xtuple/qt-client/statuses/9beeec2ba3acfd523468bd73761bd4956a7e2f6c","head":{"label":"andersdd:25702_location_filter","ref":"25702_location_filter","sha":"9beeec2ba3acfd523468bd73761bd4956a7e2f6c","user":{"login":"andersdd","id":4682742,"avatar_url":"https://avatars.githubusercontent.com/u/4682742?v=3","gravatar_id":"","url":"https://api.github.com/users/andersdd","html_url":"https://github.com/andersdd","followers_url":"https://api.github.com/users/andersdd/followers","following_url":"https://api.github.com/users/andersdd/following{/other_user}","gists_url":"https://api.github.com/users/andersdd/gists{/gist_id}","starred_url":"https://api.github.com/users/andersdd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andersdd/subscriptions","organizations_url":"https://api.github.com/users/andersdd/orgs","repos_url":"https://api.github.com/users/andersdd/repos","events_url":"https://api.github.com/users/andersdd/events{/privacy}","received_events_url":"https://api.github.com/users/andersdd/received_events","type":"User","site_admin":false},"repo":{"id":11227389,"name":"qt-client","full_name":"andersdd/qt-client","owner":{"login":"andersdd","id":4682742,"avatar_url":"https://avatars.githubusercontent.com/u/4682742?v=3","gravatar_id":"","url":"https://api.github.com/users/andersdd","html_url":"https://github.com/andersdd","followers_url":"https://api.github.com/users/andersdd/followers","following_url":"https://api.github.com/users/andersdd/following{/other_user}","gists_url":"https://api.github.com/users/andersdd/gists{/gist_id}","starred_url":"https://api.github.com/users/andersdd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andersdd/subscriptions","organizations_url":"https://api.github.com/users/andersdd/orgs","repos_url":"https://api.github.com/users/andersdd/repos","events_url":"https://api.github.com/users/andersdd/events{/privacy}","received_events_url":"https://api.github.com/users/andersdd/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andersdd/qt-client","description":"Desktop Client and Database","fork":true,"url":"https://api.github.com/repos/andersdd/qt-client","forks_url":"https://api.github.com/repos/andersdd/qt-client/forks","keys_url":"https://api.github.com/repos/andersdd/qt-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andersdd/qt-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andersdd/qt-client/teams","hooks_url":"https://api.github.com/repos/andersdd/qt-client/hooks","issue_events_url":"https://api.github.com/repos/andersdd/qt-client/issues/events{/number}","events_url":"https://api.github.com/repos/andersdd/qt-client/events","assignees_url":"https://api.github.com/repos/andersdd/qt-client/assignees{/user}","branches_url":"https://api.github.com/repos/andersdd/qt-client/branches{/branch}","tags_url":"https://api.github.com/repos/andersdd/qt-client/tags","blobs_url":"https://api.github.com/repos/andersdd/qt-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andersdd/qt-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andersdd/qt-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/andersdd/qt-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andersdd/qt-client/statuses/{sha}","languages_url":"https://api.github.com/repos/andersdd/qt-client/languages","stargazers_url":"https://api.github.com/repos/andersdd/qt-client/stargazers","contributors_url":"https://api.github.com/repos/andersdd/qt-client/contributors","subscribers_url":"https://api.github.com/repos/andersdd/qt-client/subscribers","subscription_url":"https://api.github.com/repos/andersdd/qt-client/subscription","commits_url":"https://api.github.com/repos/andersdd/qt-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/andersdd/qt-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/andersdd/qt-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/andersdd/qt-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/andersdd/qt-client/contents/{+path}","compare_url":"https://api.github.com/repos/andersdd/qt-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andersdd/qt-client/merges","archive_url":"https://api.github.com/repos/andersdd/qt-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andersdd/qt-client/downloads","issues_url":"https://api.github.com/repos/andersdd/qt-client/issues{/number}","pulls_url":"https://api.github.com/repos/andersdd/qt-client/pulls{/number}","milestones_url":"https://api.github.com/repos/andersdd/qt-client/milestones{/number}","notifications_url":"https://api.github.com/repos/andersdd/qt-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andersdd/qt-client/labels{/name}","releases_url":"https://api.github.com/repos/andersdd/qt-client/releases{/id}","created_at":"2013-07-07T02:27:25Z","updated_at":"2014-08-11T22:38:17Z","pushed_at":"2015-04-27T21:15:16Z","git_url":"git://github.com/andersdd/qt-client.git","ssh_url":"git@github.com:andersdd/qt-client.git","clone_url":"https://github.com/andersdd/qt-client.git","svn_url":"https://github.com/andersdd/qt-client","homepage":null,"size":58812,"stargazers_count":0,"watchers_count":0,"language":"C++","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":"xtuple:4_9_x","ref":"4_9_x","sha":"135d7ac945798495dd4e32bd1309839ec9cf2d76","user":{"login":"xtuple","id":703922,"avatar_url":"https://avatars.githubusercontent.com/u/703922?v=3","gravatar_id":"","url":"https://api.github.com/users/xtuple","html_url":"https://github.com/xtuple","followers_url":"https://api.github.com/users/xtuple/followers","following_url":"https://api.github.com/users/xtuple/following{/other_user}","gists_url":"https://api.github.com/users/xtuple/gists{/gist_id}","starred_url":"https://api.github.com/users/xtuple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xtuple/subscriptions","organizations_url":"https://api.github.com/users/xtuple/orgs","repos_url":"https://api.github.com/users/xtuple/repos","events_url":"https://api.github.com/users/xtuple/events{/privacy}","received_events_url":"https://api.github.com/users/xtuple/received_events","type":"Organization","site_admin":false},"repo":{"id":10383821,"name":"qt-client","full_name":"xtuple/qt-client","owner":{"login":"xtuple","id":703922,"avatar_url":"https://avatars.githubusercontent.com/u/703922?v=3","gravatar_id":"","url":"https://api.github.com/users/xtuple","html_url":"https://github.com/xtuple","followers_url":"https://api.github.com/users/xtuple/followers","following_url":"https://api.github.com/users/xtuple/following{/other_user}","gists_url":"https://api.github.com/users/xtuple/gists{/gist_id}","starred_url":"https://api.github.com/users/xtuple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xtuple/subscriptions","organizations_url":"https://api.github.com/users/xtuple/orgs","repos_url":"https://api.github.com/users/xtuple/repos","events_url":"https://api.github.com/users/xtuple/events{/privacy}","received_events_url":"https://api.github.com/users/xtuple/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/xtuple/qt-client","description":"This repository contains the source code for the Desktop client. The Desktop client is built using the Qt framework for C++. The client can be extended or customized using JavaScript. This client is used by all editions of xTuple ERP.","fork":false,"url":"https://api.github.com/repos/xtuple/qt-client","forks_url":"https://api.github.com/repos/xtuple/qt-client/forks","keys_url":"https://api.github.com/repos/xtuple/qt-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xtuple/qt-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xtuple/qt-client/teams","hooks_url":"https://api.github.com/repos/xtuple/qt-client/hooks","issue_events_url":"https://api.github.com/repos/xtuple/qt-client/issues/events{/number}","events_url":"https://api.github.com/repos/xtuple/qt-client/events","assignees_url":"https://api.github.com/repos/xtuple/qt-client/assignees{/user}","branches_url":"https://api.github.com/repos/xtuple/qt-client/branches{/branch}","tags_url":"https://api.github.com/repos/xtuple/qt-client/tags","blobs_url":"https://api.github.com/repos/xtuple/qt-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xtuple/qt-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xtuple/qt-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/xtuple/qt-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xtuple/qt-client/statuses/{sha}","languages_url":"https://api.github.com/repos/xtuple/qt-client/languages","stargazers_url":"https://api.github.com/repos/xtuple/qt-client/stargazers","contributors_url":"https://api.github.com/repos/xtuple/qt-client/contributors","subscribers_url":"https://api.github.com/repos/xtuple/qt-client/subscribers","subscription_url":"https://api.github.com/repos/xtuple/qt-client/subscription","commits_url":"https://api.github.com/repos/xtuple/qt-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/xtuple/qt-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/xtuple/qt-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/xtuple/qt-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/xtuple/qt-client/contents/{+path}","compare_url":"https://api.github.com/repos/xtuple/qt-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xtuple/qt-client/merges","archive_url":"https://api.github.com/repos/xtuple/qt-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xtuple/qt-client/downloads","issues_url":"https://api.github.com/repos/xtuple/qt-client/issues{/number}","pulls_url":"https://api.github.com/repos/xtuple/qt-client/pulls{/number}","milestones_url":"https://api.github.com/repos/xtuple/qt-client/milestones{/number}","notifications_url":"https://api.github.com/repos/xtuple/qt-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xtuple/qt-client/labels{/name}","releases_url":"https://api.github.com/repos/xtuple/qt-client/releases{/id}","created_at":"2013-05-30T13:54:04Z","updated_at":"2015-04-27T17:29:05Z","pushed_at":"2015-04-27T21:16:40Z","git_url":"git://github.com/xtuple/qt-client.git","ssh_url":"git@github.com:xtuple/qt-client.git","clone_url":"https://github.com/xtuple/qt-client.git","svn_url":"https://github.com/xtuple/qt-client","homepage":"","size":93158,"stargazers_count":23,"watchers_count":23,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":95,"mirror_url":null,"open_issues_count":9,"forks":95,"open_issues":9,"watchers":23,"default_branch":"4_9_x"}},"_links":{"self":{"href":"https://api.github.com/repos/xtuple/qt-client/pulls/669"},"html":{"href":"https://github.com/xtuple/qt-client/pull/669"},"issue":{"href":"https://api.github.com/repos/xtuple/qt-client/issues/669"},"comments":{"href":"https://api.github.com/repos/xtuple/qt-client/issues/669/comments"},"review_comments":{"href":"https://api.github.com/repos/xtuple/qt-client/pulls/669/comments"},"review_comment":{"href":"https://api.github.com/repos/xtuple/qt-client/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/xtuple/qt-client/pulls/669/commits"},"statuses":{"href":"https://api.github.com/repos/xtuple/qt-client/statuses/9beeec2ba3acfd523468bd73761bd4956a7e2f6c"}}}}