Merge branch 'master' of gitlab.com:jankstudio/resq into 555-log-warranty-data-sent-via-api

This commit is contained in:
Korina Cordero 2021-04-30 06:34:13 +00:00
commit 42c2b52690
9 changed files with 1524 additions and 2879 deletions

View file

@ -25,6 +25,7 @@
"symfony/flex": "^1.0", "symfony/flex": "^1.0",
"symfony/framework-bundle": "^4.0", "symfony/framework-bundle": "^4.0",
"symfony/maker-bundle": "^1.0", "symfony/maker-bundle": "^1.0",
"symfony/monolog-bundle": "^3.7",
"symfony/orm-pack": "^1.0", "symfony/orm-pack": "^1.0",
"symfony/process": "^4.0", "symfony/process": "^4.0",
"symfony/profiler-pack": "^1.0", "symfony/profiler-pack": "^1.0",

4263
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -14,4 +14,5 @@ return [
Catalyst\APIBundle\CatalystAPIBundle::class => ['all' => true], Catalyst\APIBundle\CatalystAPIBundle::class => ['all' => true],
Catalyst\AuthBundle\CatalystAuthBundle::class => ['all' => true], Catalyst\AuthBundle\CatalystAuthBundle::class => ['all' => true],
Catalyst\MenuBundle\CatalystMenuBundle::class => ['all' => true], Catalyst\MenuBundle\CatalystMenuBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
]; ];

View file

@ -0,0 +1,19 @@
monolog:
handlers:
main:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
channels: ["!event"]
# uncomment to get logging in your browser
# you may have to allow bigger header sizes in your Web server configuration
#firephp:
# type: firephp
# level: info
#chromephp:
# type: chromephp
# level: info
console:
type: console
process_psr_3_messages: false
channels: ["!event", "!doctrine", "!console"]

View file

@ -0,0 +1,8 @@
# As of Symfony 5.1, deprecations are logged in the dedicated "deprecation" channel when it exists
#monolog:
# channels: [deprecation]
# handlers:
# deprecation:
# type: stream
# channels: [deprecation]
# path: php://stderr

View file

@ -0,0 +1,17 @@
monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: nested
excluded_http_codes: [404, 405]
buffer_size: 50 # How many messages should be saved? Prevent memory leaks
nested:
type: stream
path: php://stderr
level: debug
formatter: monolog.formatter.json
console:
type: console
process_psr_3_messages: false
channels: ["!event", "!doctrine"]

View file

@ -0,0 +1,12 @@
monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: nested
excluded_http_codes: [404, 405]
channels: ["!event"]
nested:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug

View file

@ -2977,11 +2977,7 @@ class APIController extends Controller implements LoggedController
} }
$sku = $warr_serial->getSKU(); $sku = $warr_serial->getSKU();
$batt = $em->getRepository(SAPBattery::class)->find($sku);
// check if sku is null
$batt = null;
if ($sku != null)
$batt = $em->getRepository(SAPBattery::class)->find($sku);
// TODO: put this in a config file // TODO: put this in a config file
$image_url = $req->getSchemeAndHttpHost() . '/battery/generic.png'; $image_url = $req->getSchemeAndHttpHost() . '/battery/generic.png';
if ($batt != null) if ($batt != null)
@ -3085,14 +3081,14 @@ class APIController extends Controller implements LoggedController
// $cust = $this->updateCustomerInfo($req, $em); // $cust = $this->updateCustomerInfo($req, $em);
// update warranty // update warranty
$res = $this->updateWarranty($res, $em, $trans, $req, $serial, $inv_filename, $wcard_filename, $rt); $res = $this->updateWarranty($res, $em, $rt, $trans, $req, $serial, $inv_filename, $wcard_filename);
$em->flush(); $em->flush();
return $res->getReturnResponse(); return $res->getReturnResponse();
} }
protected function updateWarranty($res, $em, $trans, $req, $serial, $inv_filename = null, $wcard_filename = null, $rt) protected function updateWarranty($res, $em, $rt, $trans, $req, $serial, $inv_filename = null, $wcard_filename = null)
{ {
// get serial // get serial
$warr_serial = $em->getRepository(WarrantySerial::class)->find($serial); $warr_serial = $em->getRepository(WarrantySerial::class)->find($serial);
@ -3124,7 +3120,7 @@ class APIController extends Controller implements LoggedController
if (!$is_customer_warranty) if (!$is_customer_warranty)
{ {
$res->setError(true) $res->setError(true)
->setErrorMessage('Warranty registered to a vehicle not in your list of vehicles.'); ->setErrorMessage('Warranty registred to a vehicle not in your list of vehicles.');
return $res; return $res;
} }
@ -3136,12 +3132,15 @@ class APIController extends Controller implements LoggedController
$sms_msg = $trans->trans('warranty_register_confirm'); $sms_msg = $trans->trans('warranty_register_confirm');
} }
// check if sku is null
// get sap battery // get sap battery
$sku = $warr_serial->getSKU(); $sku = $warr_serial->getSKU();
$sap_bty = null; $sap_bty = $em->getRepository(SAPBattery::class)->find($sku);
if ($sku != null) if ($sap_bty == null)
$sap_bty = $em->getRepository(SAPBattery::class)->find($sku); {
$res->setError(true)
->setErrorMessage('Could not find battery entry for warranty.');
return $res;
}
// default date purchase to today // default date purchase to today
// NOTE: might need to change this later // NOTE: might need to change this later

View file

@ -44,9 +44,6 @@
"doctrine/dbal": { "doctrine/dbal": {
"version": "v2.6.3" "version": "v2.6.3"
}, },
"doctrine/deprecations": {
"version": "v0.5.3"
},
"doctrine/doctrine-bundle": { "doctrine/doctrine-bundle": {
"version": "1.6", "version": "1.6",
"recipe": { "recipe": {
@ -101,15 +98,9 @@
"doctrine/reflection": { "doctrine/reflection": {
"version": "v1.0.0" "version": "v1.0.0"
}, },
"doctrine/sql-formatter": {
"version": "1.1.1"
},
"edwinhoksberg/php-fcm": { "edwinhoksberg/php-fcm": {
"version": "1.0.0" "version": "1.0.0"
}, },
"friendsofphp/proxy-manager-lts": {
"version": "v1.0.3"
},
"guzzlehttp/guzzle": { "guzzlehttp/guzzle": {
"version": "6.3.0" "version": "6.3.0"
}, },
@ -122,21 +113,15 @@
"jdorn/sql-formatter": { "jdorn/sql-formatter": {
"version": "v1.2.17" "version": "v1.2.17"
}, },
"laminas/laminas-code": {
"version": "3.4.1"
},
"laminas/laminas-eventmanager": {
"version": "3.2.1"
},
"laminas/laminas-zendframework-bridge": {
"version": "1.1.1"
},
"microsoft/azure-storage-blob": { "microsoft/azure-storage-blob": {
"version": "1.5.2" "version": "1.5.2"
}, },
"microsoft/azure-storage-common": { "microsoft/azure-storage-common": {
"version": "1.5.1" "version": "1.5.1"
}, },
"monolog/monolog": {
"version": "2.2.0"
},
"nikic/php-parser": { "nikic/php-parser": {
"version": "v4.1.0" "version": "v4.1.0"
}, },
@ -207,7 +192,7 @@
"version": "v4.0.2" "version": "v4.0.2"
}, },
"symfony/deprecation-contracts": { "symfony/deprecation-contracts": {
"version": "v2.2.0" "version": "v2.4.0"
}, },
"symfony/doctrine-bridge": { "symfony/doctrine-bridge": {
"version": "v4.0.2" "version": "v4.0.2"
@ -248,9 +233,6 @@
"ref": "18f6fdceb63737d991efbb37ae9619a6f6c978c8" "ref": "18f6fdceb63737d991efbb37ae9619a6f6c978c8"
} }
}, },
"symfony/http-client-contracts": {
"version": "v2.3.1"
},
"symfony/http-foundation": { "symfony/http-foundation": {
"version": "v4.0.2" "version": "v4.0.2"
}, },
@ -272,21 +254,33 @@
"symfony/mime": { "symfony/mime": {
"version": "v4.3.0" "version": "v4.3.0"
}, },
"symfony/monolog-bridge": {
"version": "v5.2.5"
},
"symfony/monolog-bundle": {
"version": "3.7",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "3.7",
"ref": "329f6a5ef2e7aa033f802be833ef8d1268dd0848"
},
"files": [
"config/packages/dev/monolog.yaml",
"config/packages/prod/deprecations.yaml",
"config/packages/prod/monolog.yaml",
"config/packages/test/monolog.yaml"
]
},
"symfony/orm-pack": { "symfony/orm-pack": {
"version": "v1.0.5" "version": "v1.0.5"
}, },
"symfony/polyfill-ctype": { "symfony/polyfill-ctype": {
"version": "v1.9.0" "version": "v1.9.0"
}, },
"symfony/polyfill-intl-grapheme": {
"version": "v1.22.1"
},
"symfony/polyfill-intl-idn": { "symfony/polyfill-intl-idn": {
"version": "v1.11.0" "version": "v1.11.0"
}, },
"symfony/polyfill-intl-normalizer": {
"version": "v1.22.1"
},
"symfony/polyfill-mbstring": { "symfony/polyfill-mbstring": {
"version": "v1.6.0" "version": "v1.6.0"
}, },
@ -296,9 +290,6 @@
"symfony/polyfill-php73": { "symfony/polyfill-php73": {
"version": "v1.11.0" "version": "v1.11.0"
}, },
"symfony/polyfill-php80": {
"version": "v1.22.1"
},
"symfony/process": { "symfony/process": {
"version": "v4.4.9" "version": "v4.4.9"
}, },
@ -308,9 +299,6 @@
"symfony/property-access": { "symfony/property-access": {
"version": "v4.0.2" "version": "v4.0.2"
}, },
"symfony/property-info": {
"version": "v5.2.4"
},
"symfony/routing": { "symfony/routing": {
"version": "4.0", "version": "4.0",
"recipe": { "recipe": {
@ -347,9 +335,6 @@
"symfony/stopwatch": { "symfony/stopwatch": {
"version": "v4.0.2" "version": "v4.0.2"
}, },
"symfony/string": {
"version": "v5.2.6"
},
"symfony/thanks": { "symfony/thanks": {
"version": "v1.1.0" "version": "v1.1.0"
}, },