Commit e83bcda39a9923e3db687889fa46427a2ee153ea
1 parent
4c64240a
-Replace line breaks
Showing
1 changed file
with
23 additions
and
9 deletions
Show diff stats
controllers/StatisticsController.php
| @@ -8,7 +8,6 @@ | @@ -8,7 +8,6 @@ | ||
| 8 | use yii\data\ActiveDataProvider; | 8 | use yii\data\ActiveDataProvider; |
| 9 | use yii\helpers\ArrayHelper; | 9 | use yii\helpers\ArrayHelper; |
| 10 | use yii\helpers\Html; | 10 | use yii\helpers\Html; |
| 11 | - use yii\helpers\VarDumper; | ||
| 12 | use yii\web\Controller; | 11 | use yii\web\Controller; |
| 13 | use yii\web\Response; | 12 | use yii\web\Response; |
| 14 | 13 | ||
| @@ -246,7 +245,7 @@ | @@ -246,7 +245,7 @@ | ||
| 246 | $i = 0; | 245 | $i = 0; |
| 247 | $products = ''; | 246 | $products = ''; |
| 248 | foreach ($order->products as $product) { | 247 | foreach ($order->products as $product) { |
| 249 | - $i ++; | 248 | + $i++; |
| 250 | $products .= $product->sku; | 249 | $products .= $product->sku; |
| 251 | if (count($order->products) != $i) { | 250 | if (count($order->products) != $i) { |
| 252 | $products .= ' ,'; | 251 | $products .= ' ,'; |
| @@ -259,7 +258,15 @@ | @@ -259,7 +258,15 @@ | ||
| 259 | $line[] = (string) $order->total; | 258 | $line[] = (string) $order->total; |
| 260 | $line[] = empty($order->reason) ? '' : $formatter->asText(Order::REASONS[ $order->reason ]); | 259 | $line[] = empty($order->reason) ? '' : $formatter->asText(Order::REASONS[ $order->reason ]); |
| 261 | $line[] = empty($order->manager) ? '' : $formatter->asText($order->manager->username); | 260 | $line[] = empty($order->manager) ? '' : $formatter->asText($order->manager->username); |
| 262 | - $line[] = (string) $order->body; | 261 | + $line[] = str_replace( |
| 262 | + [ | ||
| 263 | + "\r\n", | ||
| 264 | + "\n", | ||
| 265 | + "\r", | ||
| 266 | + ], | ||
| 267 | + ' ', | ||
| 268 | + $order->body | ||
| 269 | + ); | ||
| 263 | 270 | ||
| 264 | fputcsv($file, $line, ";"); | 271 | fputcsv($file, $line, ";"); |
| 265 | } | 272 | } |
| @@ -267,12 +274,19 @@ | @@ -267,12 +274,19 @@ | ||
| 267 | 274 | ||
| 268 | return [ | 275 | return [ |
| 269 | 'message' => 'Файл успешно сгенерирован', | 276 | 'message' => 'Файл успешно сгенерирован', |
| 270 | - 'button' => Html::a( | ||
| 271 | - Html::tag('i', '', [ | ||
| 272 | - 'class' => 'glyphicon glyphicon-download-alt' | ||
| 273 | - ]) . ' Скачать', '/storage/statistics_export.csv', [ | ||
| 274 | - 'class' => 'btn bg-olive', | ||
| 275 | - ]) | 277 | + 'button' => Html::a( |
| 278 | + Html::tag( | ||
| 279 | + 'i', | ||
| 280 | + '', | ||
| 281 | + [ | ||
| 282 | + 'class' => 'glyphicon glyphicon-download-alt', | ||
| 283 | + ] | ||
| 284 | + ) . ' Скачать', | ||
| 285 | + '/storage/statistics_export.csv', | ||
| 286 | + [ | ||
| 287 | + 'class' => 'btn bg-olive', | ||
| 288 | + ] | ||
| 289 | + ), | ||
| 276 | ]; | 290 | ]; |
| 277 | } | 291 | } |
| 278 | } | 292 | } |