Skip to content
This repository was archived by the owner on Aug 26, 2025. It is now read-only.

Commit fae267e

Browse files
Stable
1 parent 6111c07 commit fae267e

File tree

5 files changed

+391
-28
lines changed

5 files changed

+391
-28
lines changed

api/webservice/Portal/PrivilegeQuery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public static function getConditions(\App\Db\Query $query, string $moduleName, $
5353
return;
5454
}
5555
$where = ['and'];
56-
$where[] = [$fieldInfo['tablename'] . '.' . $fieldInfo['columnname'] => 1];
56+
$where[] = [$fieldInfo['tablename'] . '.' . $fieldInfo['columnname'] => 1];
5757
$parentModule = \App\Record::getType($parentId);
5858
$fields = \App\Field::getRelatedFieldForModule($moduleName);
5959
$foundField = true;

app/Map/Routing/Yours.php

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<?php
2+
/**
3+
* Connector to find routing. Connector based on service YOURS.
4+
*
5+
* @package App
6+
*
7+
* @copyright YetiForce Sp. z o.o
8+
* @license YetiForce Public License 3.0 (licenses/LicenseEN.txt or yetiforce.com)
9+
* @author Mariusz Krzaczkowski <m.krzaczkowski@yetiforce.com>
10+
*
11+
* @see https://wiki.openstreetmap.org/wiki/YOURS
12+
*/
13+
14+
namespace App\Map\Routing;
15+
16+
/**
17+
* Connector for service YOURS to get routing.
18+
*/
19+
class Yours extends Base
20+
{
21+
/**
22+
* {@inheritdoc}
23+
*/
24+
public function calculate()
25+
{
26+
if (!\App\RequestUtil::isNetConnection()) {
27+
throw new \App\Exceptions\AppException('ERR_NO_INTERNET_CONNECTION');
28+
}
29+
$coordinates = [];
30+
$travel = $distance = 0;
31+
$description = '';
32+
foreach ($this->parsePoints() as $track) {
33+
$url = $this->url . '?format=geojson&flat=' . $track['startLat'] . '&flon=' . $track['startLon'] . '&tlat=' . $track['endLat'] . '&tlon=' . $track['endLon'] . '&lang=' . \App\Language::getLanguage() . '&instructions=1';
34+
\App\Log::beginProfile("GET|Yours::calculate|{$url}", __NAMESPACE__);
35+
$response = (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->request('GET', $url, [
36+
'timeout' => 60,
37+
'http_errors' => false,
38+
]);
39+
\App\Log::endProfile("GET|Yours::calculate|{$url}", __NAMESPACE__);
40+
if (200 === $response->getStatusCode()) {
41+
$json = \App\Json::decode($response->getBody());
42+
} else {
43+
throw new \App\Exceptions\AppException('Error with connection |' . $response->getReasonPhrase() . '|' . $response->getBody());
44+
}
45+
$coordinates = array_merge($coordinates, $json['coordinates']);
46+
$description .= $json['properties']['description'];
47+
$travel += $json['properties']['traveltime'];
48+
$distance += $json['properties']['distance'];
49+
}
50+
$this->geoJson = [
51+
'type' => 'LineString',
52+
'coordinates' => $coordinates,
53+
];
54+
$this->travelTime = $travel;
55+
$this->distance = $distance;
56+
$this->description = $description;
57+
}
58+
59+
/**
60+
* {@inheritdoc}
61+
*/
62+
public function parsePoints(): array
63+
{
64+
$tracks = [];
65+
$startLat = $this->start['lat'];
66+
$startLon = $this->start['lon'];
67+
if (!empty($this->indirectPoints)) {
68+
foreach ($this->indirectPoints as $tempLon) {
69+
$endLon = $tempLon['lon'];
70+
$endLat = $tempLon['lat'];
71+
$tracks[] = [
72+
'startLat' => $startLat,
73+
'startLon' => $startLon,
74+
'endLat' => $endLat,
75+
'endLon' => $endLon,
76+
];
77+
$startLat = $endLat;
78+
$startLon = $endLon;
79+
}
80+
}
81+
$tracks[] = [
82+
'startLat' => $startLat,
83+
'startLon' => $startLon,
84+
'endLat' => $this->end['lat'],
85+
'endLon' => $this->end['lon']
86+
];
87+
return $tracks;
88+
}
89+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
/**
3+
* YetiForce shop PremiumSupport file.
4+
*
5+
* @package App
6+
*
7+
* @copyright YetiForce Sp. z o.o
8+
* @license YetiForce Public License 3.0 (licenses/LicenseEN.txt or yetiforce.com)
9+
* @author Mariusz Krzaczkowski <m.krzaczkowski@yetiforce.com>
10+
*/
11+
12+
namespace App\YetiForce\Shop\Product;
13+
14+
/**
15+
* YetiForce shop PremiumSupport class.
16+
*/
17+
class YetiForceHelp extends \App\YetiForce\Shop\AbstractBaseProduct
18+
{
19+
/** {@inheritdoc} */
20+
public $label = 'YetiForce Help';
21+
22+
/** {@inheritdoc} */
23+
public $category = 'Support';
24+
25+
/** {@inheritdoc} */
26+
public $website = 'https://yetiforce.com/en/marketplace/support';
27+
28+
/** {@inheritdoc} */
29+
public $prices = [
30+
'Micro' => 50,
31+
'Small' => 80,
32+
'Medium' => 200,
33+
'Large' => 400,
34+
'Corporation' => 800
35+
];
36+
/** {@inheritdoc} */
37+
public $featured = true;
38+
39+
/** {@inheritdoc} */
40+
public function getAdditionalButtons(): array
41+
{
42+
return [
43+
\Vtiger_Link_Model::getInstanceFromValues([
44+
'linklabel' => 'Website',
45+
'relatedModuleName' => '_Base',
46+
'linkicon' => 'fas fa-globe',
47+
'linkhref' => true,
48+
'linkExternal' => true,
49+
'linktarget' => '_blank',
50+
'linkurl' => $this->website,
51+
'linkclass' => 'btn-info',
52+
'showLabel' => 1,
53+
]),
54+
];
55+
}
56+
}

0 commit comments

Comments
 (0)