-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from AplaProject/develop
Develop
- Loading branch information
Showing
898 changed files
with
17,926 additions
and
7,571 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Shops,Financial and professional services,Restaurants and cafes,Drinking establishments,Hot food takeaways,Drinking establishments with expanded food provision,Business,General industrial,Storage or distribution,Hotels,Residential institutions,Secure Residential Institution,Dwellinghouses,Houses in multiple occupation,Non-residential institutions,Assembly and leisure |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
lr_no_issues,lr_attention_required |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Municipal,Regional,Federal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Inheritance,Partition,Gift,Settlement,Grant,Release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Agriculture,Business,Community services,Construction,Energy production,Fishing,Forestry,Heavy environmental impact,Industry and manufacturing,Mining and quarrying,Recreation / leisure / sport,Residential,Services and residential,Total Land Use,Transport / communication networks / storage,Protective works,Unused and abandoned area |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
No Issues,Title Not Clear,Multiple Owner Claims |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Land registry"}).Vars("app") | ||
SetVar(admin, 0).(bank, 0).(depart2, 0).(depart3, 0) | ||
|
||
If(#role_id# == AppParam(App: #app_id#, Name: "lr_admin_role")){ | ||
SetVar(admin, 1) | ||
} | ||
If(#role_id# == AppParam(App: #app_id#, Name: "lr_bank_role")){ | ||
SetVar(bank, 1) | ||
} | ||
If(#role_id# == AppParam(App: #app_id#, Name: "lr_depart2_role")){ | ||
SetVar(depart2, 1) | ||
} | ||
If(#role_id# == AppParam(App: #app_id#, Name: "lr_depart3_role")){ | ||
SetVar(depart3, 1) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
{ | ||
"name": "Land registry", | ||
"conditions": "ContractConditions(\"AdminCondition\")", | ||
"blocks": [ | ||
{ | ||
"Name": "lr_check_rights", | ||
"Conditions": "ContractConditions(\"AdminCondition\")" | ||
} | ||
], | ||
"contracts": [ | ||
{ | ||
"Name": "LrAdd", | ||
"Conditions": "ContractConditions(\"AdminCondition\")" | ||
}, | ||
{ | ||
"Name": "LrDepartChecks", | ||
"Conditions": "ContractConditions(\"AdminCondition\")" | ||
}, | ||
{ | ||
"Name": "LrDepartRequest", | ||
"Conditions": "ContractConditions(\"AdminCondition\")" | ||
}, | ||
{ | ||
"Name": "LrEdit", | ||
"Conditions": "ContractConditions(\"AdminCondition\")" | ||
}, | ||
{ | ||
"Name": "LrPurchaseSteps", | ||
"Conditions": "ContractConditions(\"AdminCondition\")" | ||
}, | ||
{ | ||
"Name": "LrSettings", | ||
"Conditions": "ContractConditions(\"AdminCondition\")" | ||
} | ||
], | ||
"menus": [ | ||
{ | ||
"Name": "admin_menu", | ||
"Conditions": "ContractConditions(\"AdminCondition\")" | ||
}, | ||
{ | ||
"Name": "default_menu", | ||
"Conditions": "ContractConditions(\"AdminCondition\")" | ||
} | ||
], | ||
"pages": [ | ||
{ | ||
"Name": "lr_add", | ||
"Conditions": "ContractConditions(\"AdminCondition\")", | ||
"Menu": "default_menu" | ||
}, | ||
{ | ||
"Name": "lr_edit", | ||
"Conditions": "ContractConditions(\"AdminCondition\")", | ||
"Menu": "default_menu" | ||
}, | ||
{ | ||
"Name": "lr_list", | ||
"Conditions": "ContractConditions(\"AdminCondition\")", | ||
"Menu": "default_menu" | ||
}, | ||
{ | ||
"Name": "lr_settings", | ||
"Conditions": "ContractConditions(\"AdminCondition\")", | ||
"Menu": "admin_menu" | ||
}, | ||
{ | ||
"Name": "lr_view", | ||
"Conditions": "ContractConditions(\"AdminCondition\")", | ||
"Menu": "default_menu" | ||
} | ||
], | ||
"tables": [ | ||
{ | ||
"Name": "land_registry", | ||
"Conditions": "ContractAccess(\"@1EditTable\")", | ||
"Permissions": "{\"read\": \"true\", \"insert\": \"ContractAccess(\\\"LrAdd\\\")\", \"update\": \"ContractAccess(\\\"LrDepartChecks\\\",\\\"LrEdit\\\",\\\"LrPurchaseSteps\\\")\", \"new_column\": \"ContractConditions(\\\"@1AdminCondition\\\")\"}" | ||
}, | ||
{ | ||
"Name": "land_registry_history", | ||
"Conditions": "ContractAccess(\"@1EditTable\")", | ||
"Permissions": "{\"read\": \"true\", \"insert\": \"ContractAccess(\\\"LrEdit\\\")\", \"update\": \"false\", \"new_column\": \"ContractConditions(\\\"@1AdminCondition\\\")\"}" | ||
} | ||
], | ||
"parameters": [ | ||
{ | ||
"Name": "lr_admin_role", | ||
"Conditions": "ContractConditions(\"AdminCondition\")" | ||
}, | ||
{ | ||
"Name": "lr_bank_role", | ||
"Conditions": "ContractConditions(\"AdminCondition\")" | ||
}, | ||
{ | ||
"Name": "lr_buildings_class", | ||
"Conditions": "ContractConditions(\"AdminCondition\")" | ||
}, | ||
{ | ||
"Name": "lr_depart2_role", | ||
"Conditions": "ContractConditions(\"AdminCondition\")" | ||
}, | ||
{ | ||
"Name": "lr_depart3_role", | ||
"Conditions": "ContractConditions(\"AdminCondition\")" | ||
}, | ||
{ | ||
"Name": "lr_issues", | ||
"Conditions": "ContractConditions(\"AdminCondition\")" | ||
}, | ||
{ | ||
"Name": "lr_land_authority", | ||
"Conditions": "ContractConditions(\"AdminCondition\")" | ||
}, | ||
{ | ||
"Name": "lr_land_type", | ||
"Conditions": "ContractConditions(\"AdminCondition\")" | ||
}, | ||
{ | ||
"Name": "lr_land_use", | ||
"Conditions": "ContractConditions(\"AdminCondition\")" | ||
}, | ||
{ | ||
"Name": "lr_legal_status", | ||
"Conditions": "ContractConditions(\"AdminCondition\")" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
contract LrAdd { | ||
data { | ||
Coords string | ||
LandUse int | ||
LandType int | ||
LandAuthority int | ||
BuildingsUseClass int | ||
RegistrationDate string | ||
Price money | ||
} | ||
|
||
conditions { | ||
$app_id = DBFind("@1applications").Where({"ecosystem": $ecosystem_id, "name": "Land registry"}).One("id") | ||
if $app_id > 0 { | ||
if AppParam(Int($app_id), "lr_depart2_role", $ecosystem_id) == 0 || AppParam(Int($app_id), "lr_depart3_role", $ecosystem_id) == 0 || AppParam(Int($app_id), "lr_bank_role", $ecosystem_id) == 0 || AppParam(Int($app_id), "lr_admin_role", $ecosystem_id) == 0 { | ||
info LangRes("lr_all_roles_needed", "en") | ||
} | ||
} else { | ||
warning LangRes("@1app_not_found", "en") | ||
} | ||
} | ||
|
||
action { | ||
var coords map coordsAddress, area string unixRegDate int | ||
coords = JSONToMap($Coords) | ||
coordsAddress = coords["address"] | ||
area = Sprintf("%.0f", coords["area"]) | ||
unixRegDate = UnixDateTime(Sprintf("%s %s", $RegistrationDate, "00:00:00")) | ||
|
||
var m specifications map objectId int | ||
specifications["address"] = coordsAddress | ||
specifications["area"] = area | ||
specifications["buildings_class"] = $BuildingsUseClass | ||
specifications["map_coords"] = $Coords | ||
specifications["land_use"] = $LandUse | ||
specifications["land_type"] = $LandType | ||
specifications["land_authority"] = $LandAuthority | ||
|
||
m["owner_id"] = $key_id | ||
m["deleted"] = 0 | ||
m["date_created"] = $block_time | ||
m["registration_date"] = unixRegDate | ||
m["modification_date"] = $block_time | ||
m["price"] = $Price | ||
m["specifications"] = specifications | ||
m["buyer_id"] = $key_id | ||
m["step"] = "-1" | ||
|
||
objectId = DBInsert("land_registry", m) | ||
|
||
// notifications to all departments | ||
var depart_map depart2_params depart3_params map | ||
depart2_params["object_id"] = objectId | ||
depart2_params["depart2_requests"] = 1 | ||
|
||
depart_map["Sender"] = 1 | ||
depart_map["Rid"] = Int(AppParam(Int($app_id), "lr_depart2_role", $ecosystem_id)) | ||
depart_map["Page"] = "lr_view" | ||
depart_map["Header"] = LangRes("lr_new_object", "en") | ||
depart_map["Body"] = LangRes("lr_need_processing", "en") | ||
depart_map["Icon"] = "fa fa-bell-o" | ||
depart_map["Closure"] = 1 | ||
depart_map["Popup"] = "true" | ||
depart_map["Params"] = depart2_params | ||
|
||
CallContract("@1NotificationsSend", depart_map) | ||
|
||
depart3_params["object_id"] = objectId | ||
depart3_params["depart3_requests"] = 1 | ||
|
||
depart_map["Rid"] = Int(AppParam(Int($app_id), "lr_depart3_role", $ecosystem_id)) | ||
depart_map["Params"] = depart3_params | ||
|
||
CallContract("@1NotificationsSend", depart_map) | ||
} | ||
} |
114 changes: 114 additions & 0 deletions
114
ecosystem_apps/land_registry/contracts/LrDepartChecks.sim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
contract LrDepartChecks { | ||
data { | ||
ObjectId int | ||
LegalStatus int "optional" | ||
EncumbranceCertificate int "optional" | ||
TaxReceiptAndBills int "optional" | ||
GovernmentPrice money "optional" | ||
MarketPrice money "optional" | ||
RoleId int | ||
} | ||
|
||
conditions { | ||
$app_id = DBFind("@1applications").Where({"ecosystem": $ecosystem_id, "name": "Land registry"}).One("id") | ||
$depart2_role = Int(AppParam(Int($app_id), "lr_depart2_role", $ecosystem_id)) | ||
$depart3_role = Int(AppParam(Int($app_id), "lr_depart3_role", $ecosystem_id)) | ||
|
||
if $app_id > 0 { | ||
if $depart2_role == 0 || $depart3_role == 0 || AppParam(Int($app_id), "lr_admin_role", $ecosystem_id) == 0 || AppParam(Int($app_id), "lr_bank_role", $ecosystem_id) == 0 { | ||
info LangRes("lr_all_roles_needed", "en") | ||
} | ||
} else { | ||
warning LangRes("@1app_not_found", "en") | ||
} | ||
} | ||
|
||
action { | ||
var object status m map | ||
|
||
if $RoleId == $depart2_role { | ||
object = DBFind("land_registry").WhereId($ObjectId).Row() | ||
if object["status"] { | ||
var depart3_status map | ||
depart3_status = JSONDecode(object["status"]) | ||
if depart3_status["tax_receipt_and_bills"] { | ||
status["tax_receipt_and_bills"] = depart3_status["tax_receipt_and_bills"] | ||
} | ||
} | ||
status["legal_status"] = $LegalStatus | ||
status["encumbrance_certificate"] = $EncumbranceCertificate | ||
m["modification_date"] = $block_time | ||
m["status"] = status | ||
DBUpdate("land_registry", $ObjectId, m) | ||
|
||
// closing all opened role notifications | ||
var opened map i int | ||
opened = DBFind("@1notifications").Where({"recipient->role_id": $depart2_role, "page_params->object_id": $ObjectId, "closed": 0, "ecosystem": $ecosystem_id}) | ||
|
||
while i < Len(opened) { | ||
var current map current_id int | ||
current = opened[i] | ||
current_id = Int(current["id"]) | ||
@1NotificationsProcess("NotificId", current_id) | ||
@1NotificationsClose("NotificId", current_id) | ||
i = i + 1 | ||
} | ||
} | ||
if $RoleId == $depart3_role { | ||
object = DBFind("land_registry").WhereId($ObjectId).Row() | ||
if object["status"] { | ||
var depart2_status map | ||
depart2_status = JSONDecode(object["status"]) | ||
if depart2_status["legal_status"] { | ||
status["legal_status"] = depart2_status["legal_status"] | ||
} | ||
if depart2_status["encumbrance_certificate"] { | ||
status["encumbrance_certificate"] = depart2_status["encumbrance_certificate"] | ||
} | ||
} | ||
|
||
status["tax_receipt_and_bills"] = $TaxReceiptAndBills | ||
m["government_price"] = $GovernmentPrice | ||
m["market_price"] = $MarketPrice | ||
m["modification_date"] = $block_time | ||
m["status"] = status | ||
DBUpdate("land_registry", $ObjectId, m) | ||
|
||
// closing all opened role notifications | ||
var opened map i int | ||
opened = DBFind("@1notifications").Where({"recipient->role_id": $depart3_role, "page_params->object_id": $ObjectId, "closed": 0, "ecosystem": $ecosystem_id}) | ||
|
||
while i < Len(opened) { | ||
var current map current_id int | ||
current = opened[i] | ||
current_id = Int(current["id"]) | ||
@1NotificationsProcess("NotificId", current_id) | ||
@1NotificationsClose("NotificId", current_id) | ||
i = i + 1 | ||
} | ||
} | ||
|
||
// checking if the object is ready for sale | ||
object = DBFind("land_registry").WhereId($ObjectId).Row() | ||
if Money(object["price"]) > 0 && Money(object["market_price"]) > 0 && Money(object["government_price"]) > 0 && object["deleted"] != 1 { | ||
var status_map map | ||
status_map = JSONDecode(object["status"]) | ||
if status_map["legal_status"] == 1 && status_map["encumbrance_certificate"] == 1 && status_map["tax_receipt_and_bills"] == 1 { | ||
// notification to the object owner | ||
var n params map | ||
n["Sender"] = 1 | ||
n["Page"] = "lr_view" | ||
n["Icon"] = "fa fa-bell-o" | ||
n["Popup"] = "true" | ||
n["MemberId"] = object["owner_id"] | ||
n["Header"] = LangRes("lr_object_status", "en") | ||
n["Body"] = LangRes("lr_checks_successfull", "en") | ||
params["object_id"] = $ObjectId | ||
params["info_message"] = 1 | ||
params["info_status"] = "success" | ||
n["Params"] = params | ||
CallContract("@1NotificationsSend", n) | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.