v.1.7 update
This commit is contained in:
@@ -15,9 +15,22 @@ class CreateClient extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'postcreateclient';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
$group = ClientsGroup::where('id', '=', $input['group_id'])->first();
|
||||
if (isset($input['group_id'])) {
|
||||
$group = ClientsGroup::where('id', '=', $input['group_id'])->first();
|
||||
} else {
|
||||
$group['code'] = 0;
|
||||
}
|
||||
|
||||
if (!isset($input['email'])) {
|
||||
$input['email'] = '';
|
||||
}
|
||||
|
||||
if (!isset($input['address'])) {
|
||||
$input['address'] = '';
|
||||
}
|
||||
|
||||
$total = Client::where('name', '=', $input['name'])->count();
|
||||
if ($input['is_special_price'] == 'true') {
|
||||
if (isset($input['is_special_price']) && $input['is_special_price'] == 'true') {
|
||||
$specialPrice = 1;
|
||||
} else {
|
||||
$specialPrice = 0;
|
||||
@@ -51,23 +64,32 @@ class CreateClient extends HRCCommand implements HRCCommandInterface {
|
||||
$clientPhone->phone = $phone;
|
||||
$clientPhone->client_guid = $client->user_code;
|
||||
|
||||
$clientBarcode = new ClientsBarcode;
|
||||
$clientBarcode->code_id = urldecode($input['barcode']);
|
||||
$clientBarcode->name = '';
|
||||
$clientBarcode->client_guid = $client->user_code;
|
||||
$clientBarcode->value = urldecode($input['barcode']);
|
||||
$clientBarcode->block = 0;
|
||||
$clientBarcode->symptom_block = 0;
|
||||
|
||||
$clientBarcode->save();
|
||||
$clientEmail->save();
|
||||
$clientAddress->save();
|
||||
$client->save();
|
||||
$clientPhone->save();
|
||||
if (isset($input['barcode']) && $input['barcode'] > 0) {
|
||||
$client->barcode_type = 1;
|
||||
$clientBarcode = new ClientsBarcode;
|
||||
$clientBarcode->code_id = urldecode($input['barcode']);
|
||||
$clientBarcode->name = '';
|
||||
$clientBarcode->client_guid = $client->user_code;
|
||||
$clientBarcode->value = urldecode($input['barcode']);
|
||||
$clientBarcode->block = 0;
|
||||
$clientBarcode->symptom_block = 0;
|
||||
$client->save();
|
||||
$clientPhone->save();
|
||||
$clientEmail->save();
|
||||
$clientAddress->save();
|
||||
$clientBarcode->save();
|
||||
} else {
|
||||
$client->barcode_type = 0;
|
||||
$client->save();
|
||||
$clientPhone->save();
|
||||
$clientEmail->save();
|
||||
$clientAddress->save();
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Клиент создан',
|
||||
'client' => $client,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user