Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
logger.php
1<?php
2
4
7
8Loc::loadMessages(__FILE__);
9
16class Logger
17{
18 private $exportId;
19 private $ritchLog = false;
20
22
27 public function __construct($exportId)
28 {
29 $this->exportId = $exportId;
30 $this->ritchLog = Vk::getInstance()->getRichLog($this->exportId);
31 }
32
41 private function getExistingErrors($errCode = null, $itemId = null)
42 {
43 $result = array();
44
45 $filter = array('=EXPORT_ID' => $this->exportId,);
46 if ($errCode)
47 $filter['=ERROR_CODE'] = $errCode;
48 if ($itemId)
49 $filter['=ITEM_ID'] = $itemId;
50
51 $resExistErrors = LogTable::getList(array(
52 'filter' => $filter,
53 'order' => array('ERROR_CODE' => 'ASC'),
54 ));
55
56 while ($err = $resExistErrors->fetch())
57 {
58 $result[$err['ID']] = $err;
59 }
60
61 return $result;
62 }
63
64
69 public function addLog($itemId = null, $params = null)
70 {
71 if ($this->ritchLog)
72 {
73// print_r to preserve multilevel array error in mysql
74 return $this->addError("LOG", $itemId, print_r($params, true));
75 }
76 }
77
78
90 public function addError($errCode, $itemId = null, $errParams = null)
91 {
92 $errorDescription = $this->getErrorsDescriptions($errCode);
93 $errCode = $errorDescription['CODE'] ? $errorDescription['CODE'] : $errCode;
94// add new error
95 if (!$this->addErrorToTable($errCode, $itemId, $errParams))
96 return false;
97
98// show notify only for critical errors, other message - show only on page
99 if ($errorDescription['CRITICAL'])
100 {
101 throw new ExecuteException($errorDescription["MESSAGE"]);
102 }
103
104 return true;
105 }
106
107
117 private function addErrorToTable($errCode, $itemId = null, $errParams = null)
118 {
119 $fields = array(
120 "EXPORT_ID" => $this->exportId,
121 "ERROR_CODE" => $errCode,
122 );
123// add item if not null
124 if ($itemId)
125 $fields["ITEM_ID"] = $itemId;
126
127// add params for rich log
128 if ($errParams)
129 $fields["ERROR_PARAMS"] = $errParams;
130
131 $resExistError = LogTable::getList(array("filter" => $fields));
132
133 if ($existError = $resExistError->fetch())
134// UPDATE
135 $resDb = LogTable::update($existError["ID"], $fields);
136
137 else
138// ADD
139 $resDb = LogTable::add($fields);
140
141 return $resDb->isSuccess();
142 }
143
144
150 public function clearOneError($errCode)
151 {
152// prepare code from errors list
153 $errorDescription = $this->getErrorsDescriptions($errCode);
154
155// clear all code format: number and string. Need for errors code aliases
156 $errCodes = array();
157 $errCodes[$errorDescription['CODE']] = $errorDescription['CODE'];
158 $errCodes[$errCode] = $errCode;
159
160// remove error from log table
161 $resErrId = LogTable::getList(array('filter' => array("EXPORT_ID" => $this->exportId, "ERROR_CODE" => $errCodes)));
162 while ($err = $resErrId->fetch())
163 {
164 $errId = $err["ID"];
165 LogTable::delete($errId);
166 }
167 }
168
169
176 public function clearLog()
177 {
178// clear errors
179 $existingErrors = $this->getExistingErrors();
180 foreach ($existingErrors as $key => $err)
181 {
182 $resDelete = LogTable::delete($err['ID']);
183 }
184
185 return true;
186 }
187
188
194 public function getErrorsList($flagCritical = false)
195 {
196 $errorsConverted = array();
197 $errorsConvertedStrings = array();
198 $result = '';
199 $errorsExistings = $this->getExistingErrors();
200 $errorsDescriptions = $this->getErrorsDescriptions();
201
202 if ($errorsExistings)
203 {
204 foreach ($errorsExistings as $err)
205 {
206// only described and not ignored errors
207 if (
208 array_key_exists($err['ERROR_CODE'], $errorsDescriptions) &&
209 !$errorsDescriptions[$err['ERROR_CODE']]['IGNORE']
210 )
211 {
212// if first error with this code - create new item
213 $errorsConverted[$err['ERROR_CODE']]['MESSAGE'] = $errorsDescriptions[$err['ERROR_CODE']]['MESSAGE'];
214 if ($err['ITEM_ID'])
215 $errorsConverted[$err['ERROR_CODE']]['ITEMS'][$err['ITEM_ID']] = $err['ITEM_ID'];
216 }
217
218// unknown errors (if not ignored)
219 elseif (!$errorsDescriptions[$err['ERROR_CODE']]['IGNORE'])
220 {
221 $errorsConverted['UNKNOWN']['MESSAGE'] = Loc::getMessage("SALE_VK_ERRORS__UNKNOWN") . '. ' . Loc::getMessage("SALE_VK_ERRORS__ERRORS_CODES");
222// add codes as items to show in future
223 if ($err['ERROR_CODE'])
224 $errorsConverted['UNKNOWN']['ITEMS'][$err['ERROR_CODE']] = $err['ERROR_CODE'];
225 }
226 }
227
228// implode converted errors to one string for showing
229 foreach ($errorsConverted as $errCode => $err)
230 {
231 $errCritical = $errorsDescriptions[$errCode]['CRITICAL'];
232// get errors by CRITICAL flag
233
234 if ($errCritical == $flagCritical)
235 {
236 $itemsConvertedString = '';
237 $itemsConverted = array();
238 $itemsConvertedHide = array();
239// create strings for every item
240 if (array_key_exists('ITEMS', $err) && !empty($err['ITEMS']))
241 {
242 $itemsCount = 0;
243 foreach ($err['ITEMS'] as $item)
244 {
245 $itemConverted = $this->createItemErrorString(
246 $item,
247 $errCode
248 );
249 $itemsCount++;
250
251 if ($itemConverted <> '')
252 if ($itemsCount <= self::MAX_SHOWING_ERRORS_ITEMS)
253 $itemsConverted[] = $itemConverted;
254 else
255 $itemsConvertedHide[] = $itemConverted;
256 }
257 if (!empty($itemsConverted))
258 $itemsConvertedString = ': ' . implode(', ', $itemsConverted);
259 if (!empty($itemsConvertedHide))
260 {
261 $itemsConvertedString .= ',
262 <span class="vk_export_notify__error_normal__hide_elements" style="display:none"
263 id="vk_export_notify__error_normal__hide_elements--' . $errCode . '">' .
264 implode(', ', $itemsConvertedHide) .
265 '.</span>';
266 $itemsConvertedString .= '
267 <span style="text-align: center;">
268 <span style="cursor:pointer; border: 1px dashed; border-width: 0 0 1px 0"
269 onclick = "expandElements(\'' . $errCode . '\');"
270 class="vk_export_notify__error_normal__more_elements" id="vk_export_notify__error_normal__more_elements--' . $errCode . '">' .
271 Loc::getMessage('SALE_VK_ERRORS__MORE_ELEMENTS',
272 array('#C1' => $itemsCount - self::MAX_SHOWING_ERRORS_ITEMS)) .
273 '</span>
274
275 <span style="cursor:pointer; border: 1px dashed; border-width: 0 0 1px 0; display:none;"
276 onclick = "narrowElement(\'' . $errCode . '\');"
277 class="vk_export_notify__error_normal__less_elements" id="vk_export_notify__error_normal__less_elements--' . $errCode . '">' .
278 Loc::getMessage('SALE_VK_ERRORS__LESS_ELEMENTS') .
279 '</span>
280 </span>
281 ';
282 }
283 }
284
285// create common string for one error
286 $errorsConvertedStrings[$errCode] =
287 '<p style="font-weight: normal !important;">' .
288 $err['MESSAGE'] . $itemsConvertedString .
289 '</p>';
290 }
291
292
293// for critical errors show message just once - clean after get message
294 if ($errCritical && $flagCritical)
295 {
296 $criticalErrors = $this->getExistingErrors($errCode);
297 foreach ($criticalErrors as $error)
298 $resDelete = LogTable::delete($error['ID']);
299 }
300 }
301
302 $errorsConvertedString = implode('', $errorsConvertedStrings);
303
304// add intro before errors
305 if ($errorsConvertedString <> '')
306 {
307 $result = $flagCritical ? Loc::getMessage("SALE_VK_ERRORS__INTRO_CRITICAL") : Loc::getMessage("SALE_VK_ERRORS__INTRO_NORMAL");
308 $result .= ':<br>' . $errorsConvertedString;
309 }
310
311// check if need download log file
312 if ($result <> '')
313 {
314 $vk = Vk::getInstance();
315 if ($richLog = $vk->getRichLog($this->exportId))
316 {
317 $href = '/bitrix/admin/sale_vk_export_edit.php' . '?ID=' . $this->exportId . '&lang=' . LANG . '&download_log=Y';
318 $result .= '<br><p>' . Loc::getMessage("SALE_VK_ERRORS__LOG_TITLE") . ': <a href="' . $href . '">' . Loc::getMessage("SALE_VK_ERRORS__LOG_DOWNLOAD") . '</a>.</p>';
319 }
320 }
321
322 return $result;
323 }
324
325// not errors
326 else
327 {
328 return '';
329 }
330 }
331
332
336 public function getErrorExpandScript()
337 {
338 return "
339 <script>
340 function expandElements(code) {
341 BX.adjust(BX('vk_export_notify__error_normal__less_elements--'+code), {style:{display:'inline'}});
342 BX.adjust(BX('vk_export_notify__error_normal__more_elements--'+code), {style:{display:'none'}});
343 BX.adjust(BX('vk_export_notify__error_normal__hide_elements--'+code), {style:{display:'inline'}});
344 }
345
346 function narrowElement(code) {
347 BX.adjust(BX('vk_export_notify__error_normal__more_elements--'+code), {style:{display:'inline'}});
348 BX.adjust(BX('vk_export_notify__error_normal__less_elements--'+code), {style:{display:'none'}});
349 BX.adjust(BX('vk_export_notify__error_normal__hide_elements--'+code), {style:{display:'none'}});
350 }
351 </script>
352 ";
353 }
354
355
356 public static function createLogFileContent($exportId)
357 {
358 $resExistLogs = LogTable::getList(array(
359 'select' => array("ITEM_ID", "ERROR_PARAMS", "TIME"),
360 'filter' => array(
361 '=EXPORT_ID' => $exportId,
362 '=ERROR_CODE' => "LOG",
363 ),
364 'order' => array('TIME' => 'ASC', 'ID' => 'ASC'),
365 ));
366
367 $log = "";
368 while ($record = $resExistLogs->fetch())
369 {
370 $log .= $record["TIME"] . ' - ' . $record["ITEM_ID"] . ".";
371 if (!empty($record["ERROR_PARAMS"]))
372 $log .= " Params: " . print_r($record["ERROR_PARAMS"], true);
373 $log .= "\r\n";
374 }
375
376 return $log;
377 }
378
379
387 private function createItemErrorString($item, $errCode)
388 {
389 $errorsDescriptions = $this->getErrorsDescriptions();
390
391 if (array_key_exists($errCode, $errorsDescriptions) && array_key_exists('ITEMS_TYPE', $errorsDescriptions[$errCode]))
392 {
393 return self::createItemErrorStringByType($item, $errorsDescriptions[$errCode]['ITEMS_TYPE']);
394 }
395
396// if error have format without items - just item ID - for unknown errors
397 else
398 {
399 return $item;
400 }
401 }
402
403
411 private static function createItemErrorStringByType($item, $type)
412 {
413 $result = $item;
414
415 switch ($type)
416 {
417 case 'PRODUCT':
418
419// get iblock id fore create link to edit
420 $resProduct = \CIBlockElement::GetList(array(), array("ID" => $item), false, false, array('IBLOCK_ID', 'NAME'));
421 $resProduct = $resProduct->Fetch();
422 $query = array(
423 "IBLOCK_ID" => $resProduct["IBLOCK_ID"],
424 "type" => "catalog",
425 "ID" => $item,
426 "lang" => LANGUAGE_ID,
427 );
428 $href = "/bitrix/admin/cat_product_edit.php";
429 $result = '<a href="' . $href . '?' . http_build_query($query) . '">' . $resProduct['NAME'] . '</a>';
430 break;
431
432 case 'ALBUM':
433// todo: use link create method from ZZ
434// get iblock id fore create link to edit
435 $resSection = \CIBlockSection::GetList( array(), array("ID" => $item), false, array('IBLOCK_ID', 'NAME'));
436 $resSection = $resSection->Fetch();
437 $query = array(
438 "IBLOCK_ID" => $resSection["IBLOCK_ID"],
439 "type" => "catalog",
440 "ID" => $item,
441 "lang" => LANGUAGE_ID,
442 );
443 $href = "/bitrix/admin/cat_section_edit.php";
444 $result = '<a href="' . $href . '?' . http_build_query($query) . '">' . $resSection['NAME'] . '</a>';
445 break;
446
447 case 'PHOTO':
448 $resFile = \CFile::GetFileArray($item);
449 $result = '<a href="' . $resFile['SRC'] . '">' . $resFile['ORIGINAL_NAME'] . '</a>';
450 break;
451
452 case 'METHODS':
453// do nothing - just print method name
454 break;
455
456 case 'NONE':
457// not need items string
458 return '';
459 break;
460
461 default:
462 $href = '';
463 break;
464 }
465
466 return $result;
467
468 }
469
470
480 private function getErrorsDescriptions($key = null)
481 {
482 $errorsDescriptions = array(
483 //"LOG" using just for write to log some data - f.e. to debug
484 "LOG" => array(
485 "MESSAGE" => 'log',
486 "CODE" => "LOG",
487 'IGNORE' => true,
488 ),
489 "100" => array(
490 "MESSAGE" => Loc::getMessage("SALE_VK_ERROR__CODE_100"),
491 "CODE" => "100",
492 "ITEMS_TYPE" => 'METHODS',
493 // 'IGNORE' => true,
494 "CRITICAL" => true,
495 ),
496 "1" => array(
497 "MESSAGE" => Loc::getMessage("SALE_VK_ERROR__UNKNOWN_VK_ERROR") . ' ' . Loc::getMessage('SALE_VK_ERROR__CODE_1'),
498 "CODE" => "1",
499 "CRITICAL" => true,
500 "ITEMS_TYPE" => 'NONE',
501 ),
502 "7" => array(
503 "MESSAGE" => Loc::getMessage("SALE_VK_ERROR__GROUP_NOT_ACCESS_ERROR"),
504 "CODE" => "7",
505 "CRITICAL" => true,
506 "ITEMS_TYPE" => 'NONE',
507 ),
508 "10" => array(
509 "MESSAGE" => Loc::getMessage("SALE_VK_ERROR__UNKNOWN_VK_ERROR") . ' ' . Loc::getMessage('SALE_VK_ERROR__CODE_10'),
510 "CODE" => "10",
511 "CRITICAL" => true,
512 "ITEMS_TYPE" => 'NONE',
513 ),
514 "13" => array(
515 "MESSAGE" => Loc::getMessage("SALE_VK_ERROR__EXECUTE_ERROR"),
516 "CODE" => "13",
517 "CRITICAL" => true,
518 "ITEMS_TYPE" => 'NONE',
519 ),
520 "15" => array(
521 "MESSAGE" => Loc::getMessage("SALE_VK_ERROR__ACCESS_DENIED"),
522 "CODE" => "15",
523 "CRITICAL" => true,
524 "ITEMS_TYPE" => 'NONE',
525 ),
526 "VK_NOT_AVAILABLE" => array(
527 "MESSAGE" => Loc::getMessage("SALE_VK_ERROR__VK_NOT_AVAILABLE", array(
528 '#A1' => '<a href="http://vk.com">http://vk.com</a>',
529 )),
530 "CRITICAL" => true,
531 "CODE" => "VK_NOT_AVAILABLE",
532 "ITEMS_TYPE" => 'NONE',
533 ),
534 "PRODUCT_SHORT_NAME" => array(
535 "MESSAGE" => Loc::getMessage("SALE_VK_ERROR__PRODUCT_SHORT_NAME"),
536 "CRITICAL" => false,
537 "CODE" => "PRODUCT_SHORT_NAME",
538 "ITEMS_TYPE" => 'PRODUCT',
539 ),
540 "PRODUCT_SHORT_DESCRIPTION" => array(
541 "MESSAGE" => Loc::getMessage("SALE_VK_ERROR__PRODUCT_SHORT_DESCRIPTION"),
542 "CRITICAL" => false,
543 "CODE" => "PRODUCT_SHORT_DESCRIPTION",
544 "ITEMS_TYPE" => 'PRODUCT',
545 ),
546 "PRODUCT_LONG_NAME" => array(
547 "MESSAGE" => Loc::getMessage("SALE_VK_ERROR__PRODUCT_LONG_NAME"),
548 "CRITICAL" => false,
549 "CODE" => "PRODUCT_LONG_NAME",
550 "ITEMS_TYPE" => 'PRODUCT',
551 ),
552 "ALBUM_LONG_TITLE" => array(
553 "MESSAGE" => Loc::getMessage("SALE_VK_ERROR__ALBUM_LONG_TITLE"),
554 "CRITICAL" => false,
555 "CODE" => "ALBUM_LONG_TITLE",
556 "ITEMS_TYPE" => 'ALBUM',
557 ),
558 "ALBUM_EMPTY" => array(
559 "MESSAGE" => Loc::getMessage("SALE_VK_ERROR__ALBUM_EMPTY"),
560 "CRITICAL" => false,
561 "CODE" => "ALBUM_EMPTY",
562 "ITEMS_TYPE" => 'ALBUM',
563 ),
564 "PRODUCT_EMPTY_PRICE" => array(
565 "MESSAGE" => Loc::getMessage("SALE_VK_ERROR__PRODUCT_EMPTY_PRICE"),
566 "CRITICAL" => false,
567 "CODE" => "PRODUCT_EMPTY_PRICE",
568 "ITEMS_TYPE" => 'PRODUCT',
569 ),
570 "5" => array(
571 "MESSAGE" => Loc::getMessage("SALE_VK_ERROR__WRONG_ACCESS_TOKEN", array(
572 '#A1' => '<a href="/bitrix/admin/sale_vk_export_edit.php?ID=' . $this->exportId . '&lang=' . LANG . '&tabControl_active_tab=vk_settings">',
573 '#A2' => '</a>',
574 )),
575 "CRITICAL" => true,
576 "CODE" => "5",
577 "ITEMS_TYPE" => 'NONE',
578 ),
579 "WRONG_ACCESS_TOKEN" => array(
580 "MESSAGE" => Loc::getMessage("SALE_VK_ERROR__WRONG_ACCESS_TOKEN"),
581 "CRITICAL" => true,
582 "CODE" => "5",
583 "ITEMS_TYPE" => 'NONE',
584 ),
585 "CLIENT_SECRET_IS_INCORRECT" => array(
586 "MESSAGE" => Loc::getMessage("SALE_VK_ERROR__CLIENT_SECRET_IS_INCORRECT"),
587 "CRITICAL" => true,
588 "CODE" => "CLIENT_SECRET_IS_INCORRECT",
589 "ITEMS_TYPE" => 'NONE',
590 ),
591 "205" => array(
592 "MESSAGE" => Loc::getMessage("SALE_VK_ERROR__ACCESS_DENIED"),
593 "CRITICAL" => true,
594 "CODE" => "205",
595 "ITEMS_TYPE" => 'NONE',
596 ),
597 // todo: maybe we can recreate elements if 1402 and 1403 errors
598 "1402" => array(
599 'IGNORE' => true,
600 "MESSAGE" => Loc::getMessage("SALE_VK_ERROR__SECTION_NOT_FOUND"),
601 "CRITICAL" => false,
602 "CODE" => "1403",
603 "ITEMS_TYPE" => 'NONE',
604 ),
605 "1403" => array(
606 'IGNORE' => true,
607 "MESSAGE" => Loc::getMessage("SALE_VK_ERROR__PRODUCTS_NOT_FOUND"),
608 "CRITICAL" => false,
609 "CODE" => "1403",
610 "ITEMS_TYPE" => 'NONE',
611 ),
612 '1404' => array(
613 'IGNORE' => true,
614 'MESSAGE' => 'Product already in album',
615 'CODE' => '1404',
616 "ITEMS_TYPE" => 'NONE',
617 ),
618 "1405" => array(
619 "MESSAGE" => Loc::getMessage("SALE_VK_ERROR__PRODUCTS_LIMIT_EXCEED"),
620 "CRITICAL" => true,
621 "CODE" => "1405",
622 "ITEMS_TYPE" => 'NONE',
623 ),
624 "1406" => array(
625 "MESSAGE" => Loc::getMessage("SALE_VK_ERROR__PRODUCTS_IN_ALBUM_LIMIT_EXCEED"),
626 "CRITICAL" => false,
627 "CODE" => "1406",
628 "ITEMS_TYPE" => 'NONE',
629 ),
630 "1407" => array(
631 "MESSAGE" => Loc::getMessage("SALE_VK_ERROR__ALBUMS_LIMIT_EXCEED"),
632 "CRITICAL" => false,
633 "CODE" => "1407",
634 "ITEMS_TYPE" => 'NONE',
635 ),
636 "PRODUCT_WRONG_PHOTOS" => array(
637 "MESSAGE" => Loc::getMessage("SALE_VK_ERRORS__PRODUCT_WRONG_PHOTOS"),
638 "CRITICAL" => false,
639 "CODE" => "PRODUCT_WRONG_PHOTOS",
640 "ITEMS_TYPE" => 'PRODUCT',
641 ),
642 "PRODUCT_PHOTOS_RESIZE_UP" => array(
643 "MESSAGE" => Loc::getMessage("SALE_VK_ERRORS__PRODUCT_PHOTOS_RESIZE_UP"),
644 "CRITICAL" => false,
645 "CODE" => "PRODUCT_PHOTOS_RESIZE_UP",
646 "ITEMS_TYPE" => 'PRODUCT',
647 ),
648 "PRODUCT_PHOTOS_RESIZE_DOWN" => array(
649 "MESSAGE" => Loc::getMessage("SALE_VK_ERRORS__PRODUCT_PHOTOS_RESIZE_DOWN"),
650 "CRITICAL" => false,
651 "CODE" => "PRODUCT_PHOTOS_RESIZE_DOWN",
652 "ITEMS_TYPE" => 'PRODUCT',
653 ),
654 "ALBUM_EMPTY_PHOTOS" => array(
655 "MESSAGE" => Loc::getMessage("SALE_VK_ERRORS__ALBUM_EMPTY_PHOTOS"),
656 "CRITICAL" => false,
657 "CODE" => "ALBUM_EMPTY_PHOTOS",
658 "ITEMS_TYPE" => 'ALBUM',
659 ),
660 "ALBUM_PHOTOS_10" => array(
661 "MESSAGE" => Loc::getMessage("SALE_VK_ERRORS__ALBUM_PHOTOS_RESIZE_UP"),
662 "CRITICAL" => false,
663 "CODE" => "ALBUM_PHOTOS_10",
664 "ITEMS_TYPE" => 'ALBUM',
665 ),
666 "ALBUM_PHOTOS_30" => array(
667 "MESSAGE" => Loc::getMessage("SALE_VK_ERRORS__ALBUM_PHOTOS_RESIZE_DOWN"),
668 "CRITICAL" => false,
669 "CODE" => "ALBUM_PHOTOS_30",
670 "ITEMS_TYPE" => 'ALBUM',
671 ),
672 "ALBUM_PHOTOS_20" => array(
673 "MESSAGE" => Loc::getMessage("SALE_VK_ERRORS__ALBUM_PHOTOS_RESIZE_CROP"),
674 "CRITICAL" => false,
675 "CODE" => "ALBUM_PHOTOS_20",
676 "ITEMS_TYPE" => 'ALBUM',
677 ),
678 "ALBUM_PHOTOS_40" => array(
679 "MESSAGE" => Loc::getMessage("SALE_VK_ERRORS__ALBUM_PHOTOS_RESIZE_CROP"),
680 "CRITICAL" => false,
681 "CODE" => "ALBUM_PHOTOS_40",
682 "ITEMS_TYPE" => 'ALBUM',
683 ),
684
685 "EMPTY_SECTIONS_LIST" => array(
686 "MESSAGE" => Loc::getMessage("SALE_VK_ERRORS__EMPTY_SECTIONS_LIST"),
687 "CRITICAL" => true,
688 "CODE" => "EMPTY_SECTIONS_LIST",
689 "ITEMS_TYPE" => 'NONE',
690 ),
691 "EMPTY_SECTION_PRODUCTS" => array(
692 "MESSAGE" => Loc::getMessage("SALE_VK_ERRORS__EMPTY_SECTION_PRODUCTS"),
693 "CRITICAL" => false,
694 "CODE" => "EMPTY_SECTION_PRODUCTS",
695 "ITEMS_TYPE" => 'NONE',
696 ),
697 "TOO_MANY_SECTIONS_TO_EXPORT" => array(
698 "MESSAGE" => Loc::getMessage("SALE_VK_ERRORS__TOO_MANY_SECTIONS_TO_EXPORT") . ' ' . Vk::MAX_EXECUTION_ITEMS,
699 "CRITICAL" => false,
700 "CODE" => "TOO_MANY_SECTIONS_TO_EXPORT",
701 "ITEMS_TYPE" => 'NONE',
702 ),
703 "TOO_MANY_PRODUCTS_TO_EXPORT" => array(
704 "MESSAGE" => Loc::getMessage("SALE_VK_ERRORS__TOO_MANY_PRODUCTS_TO_EXPORT") . ' ' . Vk::MAX_EXECUTION_ITEMS,
705 "CRITICAL" => false,
706 "CODE" => "TOO_MANY_PRODUCTS_TO_EXPORT",
707 "ITEMS_TYPE" => 'NONE',
708 ),
709// it is not true bad size! Just VK load error
710 "ERR_UPLOAD_BAD_IMAGE_SIZE_ALBUM_PHOTO" => [
711 "MESSAGE" => Loc::getMessage("SALE_VK_ERRORS__ERR_UPLOAD_BAD_IMAGE_SIZE_ALBUM_PHOTO"),
712 "CRITICAL" => false,
713 "CODE" => "ERR_UPLOAD_BAD_IMAGE_SIZE_ALBUM_PHOTO",
714 "ITEMS_TYPE" => 'ALBUM',
715 ],
716 "ERR_UPLOAD_BAD_IMAGE_SIZE_PRODUCT_MAIN_PHOTO" => [
717 "MESSAGE" => Loc::getMessage("SALE_VK_ERRORS__ERR_UPLOAD_BAD_IMAGE_SIZE_PRODUCT_MAIN_PHOTO"),
718 "CRITICAL" => false,
719 "CODE" => "ERR_UPLOAD_BAD_IMAGE_SIZE_PRODUCT_MAIN_PHOTO",
720 "ITEMS_TYPE" => 'PRODUCT',
721 ],
722 "ERR_UPLOAD_BAD_IMAGE_SIZE_PRODUCT_PHOTOS" => [
723 "MESSAGE" => Loc::getMessage("SALE_VK_ERRORS__ERR_UPLOAD_BAD_IMAGE_SIZE_PRODUCT_PHOTOS"),
724 "CRITICAL" => false,
725 "CODE" => "ERR_UPLOAD_BAD_IMAGE_SIZE_PRODUCT_PHOTOS",
726 "ITEMS_TYPE" => 'PHOTO',
727 ],
728 );
729
730// if set key - return one element, else return all array
731 if ($key)
732 {
733 return array_key_exists($key, $errorsDescriptions) ? $errorsDescriptions[$key] : null;
734 }
735 else
736 {
737 return $errorsDescriptions;
738 }
739 }
740}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29
getErrorsList($flagCritical=false)
Definition logger.php:194
addLog($itemId=null, $params=null)
Definition logger.php:69
addError($errCode, $itemId=null, $errParams=null)
Definition logger.php:90