Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
checkmanager.php
1<?php
2
3namespace Bitrix\Sale\Cashbox;
4
11use Bitrix\Main;
14use Bitrix\Sale;
16
17Loc::loadLanguageFile(__FILE__);
18
23final class CheckManager
24{
25 public const EVENT_ON_GET_CUSTOM_CHECK = 'OnGetCustomCheckList';
26 public const EVENT_ON_CHECK_PRINT_SEND = 'OnPrintableCheckSend';
27 public const EVENT_ON_BEFORE_CHECK_ADD_VERIFY = 'OnBeforeCheckAddVerify';
28 public const EVENT_ON_CHECK_PRINT_ERROR = 'OnCheckPrintError';
29 public const EVENT_ON_CHECK_COLLATE_DOCUMENTS = 'OnCheckCollateDocuments';
30 public const EVENT_ON_CHECK_VALIDATION_ERROR = 'OnCheckValidationError';
31 public const MIN_TIME_FOR_SWITCH_CASHBOX = 240;
32
36
43 public static function addByType(array $entities, $type, array $relatedEntities = array())
44 {
45 $result = new Result();
46
47 if ($type === '')
48 {
49 $result->addError(new Error(Loc::getMessage('SALE_CASHBOX_ERROR_EMPTY_CHECK_TYPE')));
50 return $result;
51 }
52
53 $check = self::createByType($type);
54 if (!$check instanceof Check)
55 {
56 $result->addError(new Error(Loc::getMessage('SALE_CASHBOX_ERROR_CHECK')));
57 return $result;
58 }
59
60 $check->setEntities($entities);
61 $check->setRelatedEntities($relatedEntities);
62
63 $cashboxList = Manager::getAvailableCashboxList($check);
64
65 $entity = reset($entities);
66 $order = self::getOrder($entity);
67
68 if (!$cashboxList)
69 {
70 $dbRes = CashboxTable::getList(array('filter' => array('ACTIVE' => 'Y')));
71 if ($dbRes->fetch())
72 $result->addError(new Error(Loc::getMessage('SALE_CASHBOX_NOT_FOUND')));
73
74 return $result;
75 }
76
77 $check->setAvailableCashbox($cashboxList);
78
79 $registry = Sale\Registry::getInstance($check->getField("ENTITY_REGISTRY_TYPE"));
80
81 $validateResult = $check->validate();
82 if (!$validateResult->isSuccess())
83 {
84 if (Main\Loader::includeModule('crm'))
85 {
86 \Bitrix\Crm\Timeline\OrderCheckController::getInstance()->onCheckFailure(
87 [
88 'ORDER_FIELDS' => $order->getFieldValues(),
89 'SETTINGS' => [
90 'FAILURE' => 'Y',
91 'PRINTED' => 'N',
92 ],
93 'BINDINGS' => \Bitrix\Crm\Order\BindingsMaker\TimelineBindingsMaker::makeByOrder($order),
94 ]
95 );
96 }
97
98 $notifyClassName = $registry->getNotifyClassName();
99 $notifyClassName::callNotify($order, Sale\EventActions::EVENT_ON_CHECK_VALIDATION_ERROR);
100 $result->addErrors($validateResult->getErrors());
101
102 $event = new Main\Event('sale', self::EVENT_ON_CHECK_VALIDATION_ERROR, $check->getDataForCheck());
103 $event->send();
104
105 return $result;
106 }
107
108 $saveResult = $check->save();
109 if ($saveResult->isSuccess())
110 {
111 $checkId = $saveResult->getId();
112 $order->addPrintedCheck($check);
113
114 $enabledImmediateCashboxList = array();
115 foreach ($cashboxList as $item)
116 {
117 if ($item['ENABLED'] === 'Y')
118 {
119 $cashbox = Cashbox::create($item);
120 if ($cashbox instanceof IPrintImmediately)
121 {
122 $enabledImmediateCashboxList[$item['ID']] = $cashbox;
123 }
124 }
125 }
126
127 if ($enabledImmediateCashboxList)
128 {
129 $cashboxId = Manager::chooseCashbox(array_keys($enabledImmediateCashboxList));
131 $cashbox = $enabledImmediateCashboxList[$cashboxId];
132
133 CashboxCheckTable::update(
134 $checkId,
135 array(
136 'STATUS' => 'P',
137 'DATE_PRINT_START' => new Type\DateTime(),
138 'CASHBOX_ID' => $cashbox->getField('ID')
139 )
140 );
141
142 $printResult = $cashbox->printImmediately($check);
143 if ($printResult->isSuccess())
144 {
145 $data = $printResult->getData();
146 if ($data)
147 {
148 CashboxCheckTable::update($checkId, ['EXTERNAL_UUID' => $data['UUID']]);
149 }
150 }
151 else
152 {
153 self::savePrintResult(
154 $checkId,
155 [
156 'ID' => $checkId,
157 'ERROR' => [
158 'TYPE' => Errors\Error::TYPE,
159 'MESSAGE' => implode("\n", $printResult->getErrorMessages())
160 ]
161 ]
162 );
163 }
164
165 $result->setId($checkId);
166
167 return $result;
168 }
169
170 global $CACHE_MANAGER;
171 foreach ($cashboxList as $cashbox)
172 {
173 $CACHE_MANAGER->Read(CACHED_b_sale_order, 'sale_checks_'.$cashbox['ID']);
174 $CACHE_MANAGER->SetImmediate('sale_checks_'.$cashbox['ID'], true);
175 }
176 }
177 else
178 {
179 $result->addErrors($saveResult->getErrors());
180 }
181
182 return $result;
183 }
184
188 public static function isAvailableCorrection() : bool
189 {
190 foreach (Manager::getListFromCache() as $item)
191 {
192 if ($item['ACTIVE'] !== 'Y')
193 {
194 continue;
195 }
196
197 $cashbox = Manager::getObjectById($item['ID']);
198 if ($cashbox && $cashbox->isCorrection())
199 {
200 return true;
201 }
202 }
203
204 return false;
205 }
206
207 public static function addCorrection($type, $cashboxId, array $correction)
208 {
209 $result = new Result();
210
211 if (!self::isAvailableCorrection())
212 {
213 return $result->addError(
214 new Error(
215 Loc::getMessage('SALE_CASHBOX_CHECK_CORRECTION_NOT_AVAILABLE')
216 )
217 );
218 }
219
221 $check = self::createByType($type);
222 if (!$check instanceof CorrectionCheck)
223 {
224 $result->addError(new Error(Loc::getMessage('SALE_CASHBOX_ERROR_CHECK')));
225 return $result;
226 }
227
228 $check->setField('CASHBOX_ID', $cashboxId);
229 $check->setAvailableCashbox([
231 ]);
232
233 $check->setCorrectionFields($correction);
234
235 $r = $check->save();
236 if ($r->isSuccess())
237 {
238 $result->setId($check->getField('ID'));
239
240 $cashbox = Manager::getObjectById($cashboxId);
241 if ($cashbox->isCorrection())
242 {
243 CashboxCheckTable::update(
244 $check->getField('ID'),
245 [
246 'STATUS' => 'P', 'DATE_PRINT_START' => new Type\DateTime()
247 ]
248 );
249
250 $printResult = $cashbox->printCorrectionImmediately($check);
251 if ($printResult->isSuccess())
252 {
253 $data = $printResult->getData();
254 CashboxCheckTable::update($check->getField('ID'), ['EXTERNAL_UUID' => $data['UUID']]);
255 }
256 else
257 {
258 self::savePrintResult(
259 $check->getField('ID'),
260 [
261 'ID' => $check->getField('ID'),
262 'ERROR' => [
263 'TYPE' => Errors\Error::TYPE,
264 'MESSAGE' => implode("\n", $printResult->getErrorMessages())
265 ]
266 ]
267 );
268 }
269
270 global $CACHE_MANAGER;
271 $CACHE_MANAGER->Read(CACHED_b_sale_order, 'sale_checks_'.$cashboxId);
272 $CACHE_MANAGER->SetImmediate('sale_checks_'.$cashboxId, true);
273 }
274 }
275 else
276 {
277 $result->addErrors($r->getErrors());
278 }
279
280 return $result;
281 }
282
294 public static function savePrintResult($checkId, array $data)
295 {
296 $result = new Result();
297
298 if ($checkId <= 0)
299 {
300 $result->addError(new Error(Loc::getMessage('SALE_CASHBOX_ERROR_CHECK_ID')));
301 return $result;
302 }
303
304 $order = null;
305 $payment = null;
306 $shipment = null;
307
308 $dbRes = self::getList(array('select' => array('*'), 'filter' => array('ID' => $checkId)));
309 $check = $dbRes->fetch();
310 if (!$check)
311 {
312 $result->addError(new Error(Loc::getMessage('SALE_CASHBOX_ERROR_CHECK_NOT_FOUND', array('#CHECK_ID#' => $checkId))));
313 return $result;
314 }
315
316 if ($check['STATUS'] === 'Y')
317 return $result;
318
319 $registry = Sale\Registry::getInstance($check['ENTITY_REGISTRY_TYPE']);
320
321 if ($check['ORDER_ID'] > 0)
322 {
324 $orderClassName = $registry->getOrderClassName();
325 $order = $orderClassName::load($check['ORDER_ID']);
326 if ($order === null)
327 {
328 $result->addError(new Error(Loc::getMessage('SALE_CASHBOX_ERROR_CHECK_ORDER_LOAD')));
329 return $result;
330 }
331
332 $paymentCollection = $order->getPaymentCollection();
333 if ($check['PAYMENT_ID'] > 0)
334 {
335 $payment = $paymentCollection->getItemById($check['PAYMENT_ID']);
336 if ($payment === null)
337 {
338 $result->addError(new Error(Loc::getMessage('SALE_CASHBOX_ERROR_CHECK_PAYMENT_LOAD')));
339 return $result;
340 }
341 }
342
343 $shipmentCollection = $order->getShipmentCollection();
344 if ($check['SHIPMENT_ID'] > 0)
345 {
346 $shipment = $shipmentCollection->getItemById($check['SHIPMENT_ID']);
347 if ($shipment === null)
348 {
349 $result->addError(new Error(Loc::getMessage('SALE_CASHBOX_ERROR_CHECK_SHIPMENT_LOAD')));
350 return $result;
351 }
352 }
353 }
354
355 if (isset($data['ERROR']))
356 {
357 $errorMessage = Loc::getMessage('SALE_CASHBOX_ERROR_CHECK_PRINT', array('#CHECK_ID#' => $checkId));
358 if ($data['ERROR']['MESSAGE'])
359 $errorMessage .= ': '.$data['ERROR']['MESSAGE'];
360
361 if ($data['ERROR']['TYPE'] === Errors\Warning::TYPE)
362 {
363 if ($check['CNT_FAIL_PRINT'] >= 3)
364 {
365 $data['ERROR']['TYPE'] = Errors\Error::TYPE;
366 }
367 else
368 {
369 CashboxCheckTable::update($checkId, array('CNT_FAIL_PRINT' => $check['CNT_FAIL_PRINT'] + 1));
370 $result->addError(new Errors\Warning($errorMessage));
371 return $result;
372 }
373 }
374
375 if ($data['ERROR']['TYPE'] === Errors\Error::TYPE)
376 {
377 $updatedFields = [
378 'STATUS' => 'E',
379 'DATE_PRINT_END' => new Main\Type\DateTime(),
380 'ERROR_MESSAGE' => $data['ERROR']['MESSAGE']
381 ];
382 if ((int)$check['CNT_FAIL_PRINT'] === 0)
383 $updatedFields['CNT_FAIL_PRINT'] = 1;
384
385 CashboxCheckTable::update($checkId, $updatedFields);
386
388 self::addTimelineCheckEntryOnCreateToOrder($order, $checkId, ['PRINTED' => 'N']);
389
390 if ($order !== null
391 && (
392 $payment !== null
393 || $shipment !== null
394 )
395 )
396 {
397 $r = new Result();
398 $errorCode = isset($data['ERROR']['CODE']) ? $data['ERROR']['CODE'] : 0;
399 $r->addWarning(new Main\Error($errorMessage, $errorCode));
400
402 $markerClassName = $registry->getEntityMarkerClassName();
403
404 if ($payment !== null)
405 {
406 $markerClassName::addMarker($order, $payment, $r);
407 $payment->setField('MARKED', 'Y');
408
410 $notifyClassName = $registry->getNotifyClassName();
411 $notifyClassName::callNotify($payment, Sale\EventActions::EVENT_ON_CHECK_PRINT_ERROR);
412 }
413 elseif ($shipment !== null)
414 {
415 $markerClassName::addMarker($order, $shipment, $r);
416 $shipment->setField('MARKED', 'Y');
417
419 $notifyClassName = $registry->getNotifyClassName();
420 $notifyClassName::callNotify($shipment, Sale\EventActions::EVENT_ON_CHECK_PRINT_ERROR);
421 }
422
423 $order->save();
424 }
425
426 $error = new Errors\Error($errorMessage);
427 Logger::addError($error->getMessage(), $check['CASHBOX_ID']);
428 }
429 else
430 {
431 $error = new Errors\Warning($errorMessage);
432 Logger::addWarning($error->getMessage(), $check['CASHBOX_ID']);
433 }
434
435 $event = new Main\Event('sale', self::EVENT_ON_CHECK_PRINT_ERROR, array($data));
436 $event->send();
437
438 $result->addError($error);
439 }
440 else
441 {
442 $updateParams = [
443 'STATUS' => 'Y',
444 'LINK_PARAMS' => $data['LINK_PARAMS'],
445 'DATE_PRINT_END' => new Main\Type\DateTime(),
446 ];
447
448 if (isset($data['EXTERNAL_UUID']))
449 {
450 $updateParams['EXTERNAL_UUID'] = $data['EXTERNAL_UUID'];
451 }
452
453 $updateResult = CashboxCheckTable::update($checkId, $updateParams);
454
455 if ($updateResult->isSuccess())
456 {
457 self::addStatisticOnSuccessCheckPrint($checkId);
458
459 self::addTimelineCheckEntryOnCreateToOrder($order, $checkId, ['PRINTED' => 'Y']);
460
461 $isSend = false;
462 $event = new Main\Event(
463 'sale',
464 self::EVENT_ON_CHECK_PRINT_SEND,
465 array('PAYMENT' => $payment, 'SHIPMENT' => $shipment, 'CHECK' => $check)
466 );
467 $event->send();
468
469 $eventResults = $event->getResults();
471 foreach($eventResults as $eventResult)
472 {
473 if($eventResult->getType() == Main\EventResult::SUCCESS)
474 $isSend = true;
475 }
476
477 if (!$isSend)
478 {
479 if ($payment !== null)
480 {
482 $notifyClassName = $registry->getNotifyClassName();
483 $notifyClassName::callNotify($payment, Sale\EventActions::EVENT_ON_CHECK_PRINT);
484 }
485 elseif ($shipment !== null)
486 {
488 $notifyClassName = $registry->getNotifyClassName();
489 $notifyClassName::callNotify($shipment, Sale\EventActions::EVENT_ON_CHECK_PRINT);
490 }
491 }
492 }
493 else
494 {
495 $result->addErrors($updateResult->getErrors());
496 }
497 }
498
499 return $result;
500 }
501
502 private static function addStatisticOnSuccessCheckPrint($checkId)
503 {
504 $check = self::getObjectById($checkId);
505
506 $cashbox = Manager::getObjectById($check->getField('CASHBOX_ID'));
507 if ($cashbox)
508 {
509 AddEventToStatFile('sale', 'checkPrint', $checkId, $cashbox::getCode());
510 }
511 }
512
513 private static function addTimelineCheckEntryOnCreateToOrder($order, $checkId, $params)
514 {
515 if ($order && Main\Loader::includeModule('crm'))
516 {
517 \Bitrix\Crm\Timeline\OrderCheckController::getInstance()->onPrintCheck(
518 $checkId,
519 [
520 'ORDER_FIELDS' => $order->getFieldValues(),
521 'SETTINGS' => $params,
522 'BINDINGS' => \Bitrix\Crm\Order\BindingsMaker\TimelineBindingsMaker::makeByOrder($order),
523 ]
524 );
525 }
526 }
527
534 public static function delete($id)
535 {
536 $r = CashboxCheckTable::delete($id);
537 if ($r->isSuccess())
538 {
539 $dbRes = Sale\Cashbox\Internals\Check2CashboxTable::query()
540 ->addSelect('ID')
541 ->where('CHECK_ID', $id);
542
543 while ($link = $dbRes->fetchObject())
544 {
545 $link->delete();
546 }
547 }
548 }
549
554 public static function addChecks(array $entities)
555 {
556 $result = new Result();
557
558 $map = self::collateDocuments($entities);
559 foreach ($map as $check)
560 {
561 $isCorrect = true;
562
563 $event = new Main\Event('sale', self::EVENT_ON_BEFORE_CHECK_ADD_VERIFY, array($check));
564 $event->send();
565
566 if ($event->getResults())
567 {
569 foreach ($event->getResults() as $eventResult)
570 {
571 if ($eventResult->getType() !== Main\EventResult::ERROR)
572 {
573 $isCorrect = (bool)$eventResult->getParameters();
574 }
575 }
576 }
577
578 if ($isCorrect)
579 {
580 $addResult = self::addByType($check["ENTITIES"], $check["TYPE"], $check["RELATED_ENTITIES"]);
581 if (!$addResult->isSuccess())
582 {
583 $result->addErrors($addResult->getErrors());
584 }
585 }
586 }
587
588 return $result;
589 }
590
596 public static function getOrder($entity)
597 {
598 $order = null;
599
600 if ($entity instanceof Sale\Payment)
601 {
603 $col = $entity->getCollection();
604 $order = $col->getOrder();
605 }
606 elseif ($entity instanceof Sale\Shipment)
607 {
609 $col = $entity->getCollection();
610 $order = $col->getOrder();
611 }
612 else
613 {
614 throw new Main\ArgumentTypeException("entities");
615 }
616
617 return $order;
618 }
619
623 private static function getBuildInCheckList()
624 {
625 $checkList = array(
626 '\Bitrix\Sale\Cashbox\SellCheck',
627 '\Bitrix\Sale\Cashbox\SellReturnCashCheck',
628 '\Bitrix\Sale\Cashbox\SellReturnCheck'
629 );
630
631 if (Manager::isSupportedFFD105())
632 {
633 $checkList = array_merge(
634 $checkList,
635 array(
636 '\Bitrix\Sale\Cashbox\CorrectionSellCheck',
637 '\Bitrix\Sale\Cashbox\CorrectionBuyCheck',
638 '\Bitrix\Sale\Cashbox\AdvancePaymentCheck',
639 '\Bitrix\Sale\Cashbox\AdvanceReturnCheck',
640 '\Bitrix\Sale\Cashbox\AdvanceReturnCashCheck',
641 '\Bitrix\Sale\Cashbox\CreditPaymentCheck',
642 '\Bitrix\Sale\Cashbox\CreditPaymentReturnCheck',
643 '\Bitrix\Sale\Cashbox\CreditPaymentReturnCashCheck',
644 '\Bitrix\Sale\Cashbox\CreditCheck',
645 '\Bitrix\Sale\Cashbox\CreditReturnCheck',
646 '\Bitrix\Sale\Cashbox\PrepaymentCheck',
647 '\Bitrix\Sale\Cashbox\PrepaymentReturnCheck',
648 '\Bitrix\Sale\Cashbox\PrepaymentReturnCashCheck',
649 '\Bitrix\Sale\Cashbox\FullPrepaymentCheck',
650 '\Bitrix\Sale\Cashbox\FullPrepaymentReturnCheck',
651 '\Bitrix\Sale\Cashbox\FullPrepaymentReturnCashCheck',
652 )
653 );
654 }
655
656 return $checkList;
657 }
658
662 private static function getUserCheckList()
663 {
664 $checkList = array();
665
666 $event = new Main\Event('sale', self::EVENT_ON_GET_CUSTOM_CHECK);
667 $event->send();
668 $resultList = $event->getResults();
669
670 if (is_array($resultList) && !empty($resultList))
671 {
672 foreach ($resultList as $eventResult)
673 {
675 if ($eventResult->getType() === Main\EventResult::SUCCESS)
676 {
677 $params = $eventResult->getParameters();
678 if (!empty($params) && is_array($params))
679 $checkList = array_merge($checkList, $params);
680 }
681 }
682 }
683
684 return $checkList;
685 }
686
690 public static function init()
691 {
692 static $isInit = false;
693
694 if ($isInit === false)
695 {
696 $handlers = self::getUserCheckList();
697 Main\Loader::registerAutoLoadClasses(null, $handlers);
698 $isInit = true;
699 }
700 }
701
705 public static function getCheckList()
706 {
707 static $checkList = array();
708 if (!$checkList)
709 {
710 $checkList = array_merge(
711 self::getBuildInCheckList(),
712 array_keys(self::getUserCheckList())
713 );
714 }
715
716 return $checkList;
717 }
718
719 public static function getSalesCheckList()
720 {
721 return array_filter(
722 self::getCheckList(),
723 function ($value)
724 {
725 return is_subclass_of($value, Check::class);
726 }
727 );
728 }
729
733 public static function getCheckTypeMap()
734 {
735 self::init();
736
737 $result = array();
738 $checkMap = self::getCheckList();
739
741 foreach ($checkMap as $className)
742 {
743 if (class_exists($className))
744 {
745 $result[$className::getType()] = $className;
746 }
747 }
748
749 return $result;
750 }
751
756 public static function createByType($type)
757 {
758 self::init();
759
760 $typeMap = self::getCheckTypeMap();
761 $handler = $typeMap[$type];
762
763 return Check::create($handler);
764 }
765
771 public static function collateDocuments(array $entities)
772 {
773 $map = [];
774
775 $event = new Main\Event('sale', self::EVENT_ON_CHECK_COLLATE_DOCUMENTS, [
776 'ENTITIES' => $entities
777 ]);
778 $event->send();
779 $eventResults = $event->getResults();
780 if ($eventResults != null)
781 {
782 foreach ($eventResults as $eventResult)
783 {
784 if ($eventResult->getType() === Main\EventResult::SUCCESS)
785 {
786 $d = $eventResult->getParameters();
787 if (!is_array($d))
788 throw new Main\NotSupportedException("OnCheckCollateDocuments event result");
789
790 $map = array_merge($map, $d);
791 }
792 else if ($eventResult->getType() === Main\EventResult::ERROR)
793 {
794 return $map;
795 }
796 }
797
798 if (count($map) > 0)
799 {
800 return $map;
801 }
802 }
803
804 $existingChecks = null;
805 $order = null;
806
808 foreach ($entities as $entity)
809 {
810 // load existing checks
811 if ($existingChecks === null)
812 {
813 $existingChecks = [];
814 $order = self::getOrder($entity);
815
816 $filter = [
817 'ORDER_ID' => $order->getId(),
818 'ENTITY_REGISTRY_TYPE' => $entity::getRegistryType()
819 ];
820 if ($entity instanceof Sale\Payment)
821 {
822 $filter["PAYMENT_ID"] = $entity->getId();
823 }
824 elseif ($entity instanceof Sale\Shipment)
825 {
826 $filter["SHIPMENT_ID"] = $entity->getId();
827 }
828
829 $db = self::getList([
830 "filter" => $filter,
831 "select" => ["ID", "PAYMENT_ID", "SHIPMENT_ID", "TYPE", "STATUS"]
832 ]);
833 while ($ar = $db->fetch())
834 {
835 if (intval($ar["PAYMENT_ID"]) > 0)
836 {
837 $existingChecks["P"][ $ar["PAYMENT_ID"] ][] = $ar;
838 }
839
840 if (intval($ar["SHIPMENT_ID"]) > 0)
841 {
842 $existingChecks["S"][ $ar["SHIPMENT_ID"] ][] = $ar;
843 }
844 }
845 }
846
847 // analysing
848 // we should allow users to implement their own algorithms
849 if (count($existingChecks) <= 0)
850 {
851 if (self::isAutomaticEnabled($order))
852 {
853 if (Manager::isSupportedFFD105())
854 {
856 {
857 $result = self::collatePaySystemWithFFD105($entity);
858 }
859 else
860 {
861 $result = self::collateWithFFD105($entity);
862 }
863 }
864 else
865 {
866 $result = self::collate($entity);
867 }
868
869 if ($result)
870 {
871 $map = array_merge($map, $result);
872 }
873 }
874 }
875 }
876
877 return $map;
878 }
879
886 private static function isAutomaticEnabled(Sale\Order $order)
887 {
888 $shipmentCollection = $order->getShipmentCollection();
889 if (
890 (
891 $shipmentCollection->count() > 2
892 && $shipmentCollection->isExistsSystemShipment()
893 )
894 ||
895 (
896 $shipmentCollection->count() > 1
897 && !$shipmentCollection->isExistsSystemShipment()
898 )
899 )
900 {
901 return false;
902 }
903
904 $paymentCollection = $order->getPaymentCollection();
905 if (
906 (
907 $paymentCollection->isExistsInnerPayment()
908 && $paymentCollection->count() > 2
909 )
910 ||
911 (
912 !$paymentCollection->isExistsInnerPayment()
913 && $paymentCollection->count() > 1
914 )
915 )
916 {
917 return false;
918 }
919
920 return true;
921 }
922
930 private static function collate($entity)
931 {
932 $map = array();
933
934 if ($entity instanceof Sale\Payment)
935 {
936 $order = self::getOrder($entity);
937
939 $service = $entity->getPaySystem();
940 if ($entity->isPaid() &&
941 ($service->getField("CAN_PRINT_CHECK") == "Y") &&
942 ($entity->getSum() == $order->getPrice())
943 )
944 {
945 $checkEntities[] = $entity;
946
947 $shipmentCollection = $order->getShipmentCollection();
949 foreach ($shipmentCollection as $shipment)
950 {
951 if (!$shipment->isSystem())
952 $checkEntities[] = $shipment;
953 }
954
955 $map[] = array("TYPE" => SellCheck::getType(), "ENTITIES" => $checkEntities, "RELATED_ENTITIES" => array());
956 }
957 }
958
959 return $map;
960 }
961
971 private static function collateWithFFD105($entity)
972 {
973 $map = array();
974
975 $order = self::getOrder($entity);
976 if (!self::canPrintCheck($order))
977 {
978 return $map;
979 }
980
981 $entities = array();
982 $relatedEntities = array();
983 if ($entity instanceof Sale\Payment)
984 {
985 if ($entity->isInner() || !$entity->isPaid())
986 return $map;
987
988 $service = $entity->getPaySystem();
989 $type = $service->getField('IS_CASH') === 'Y' ? Check::PAYMENT_TYPE_CASHLESS : Check::PAYMENT_TYPE_CASH;
990 $entities[$type] = $entity;
991
992 $fields = $order->getFields();
993 $originalFields = $fields->getOriginalValues();
994 if (!isset($originalFields['DEDUCTED']))
995 $originalFields['DEDUCTED'] = $order->getField('DEDUCTED');
996
997 $paymentCollection = $order->getPaymentCollection();
998 if ($order->getField('DEDUCTED') === 'Y' && $originalFields['DEDUCTED'] === 'Y')
999 {
1000 if ($paymentCollection->isExistsInnerPayment())
1001 {
1002 $relatedEntities[Check::PAYMENT_TYPE_ADVANCE][] = $paymentCollection->getInnerPayment();
1003 }
1004
1005 $map[] = array("TYPE" => CreditPaymentCheck::getType(), "ENTITIES" => $entities, "RELATED_ENTITIES" => $relatedEntities);
1006 }
1007 else
1008 {
1009 $option = Main\Config\Option::get('sale', 'check_type_on_pay', 'sell');
1010 if ($option === 'prepayment')
1011 {
1012 $checkType = ($entity->getSum() == $entity->getOrder()->getPrice()) ? FullPrepaymentCheck::getType() : PrepaymentCheck::getType();
1013
1014 $shipmentCollection = $order->getShipmentCollection()->getNotSystemItems();
1016 foreach ($shipmentCollection as $shipment)
1017 {
1018 $relatedEntities[Check::SHIPMENT_TYPE_NONE][] = $shipment;
1019 }
1020
1021 $map[] = array("TYPE" => $checkType, "ENTITIES" => $entities, "RELATED_ENTITIES" => $relatedEntities);
1022 }
1023 elseif ($option === 'advance')
1024 {
1025 $map[] = array("TYPE" => AdvancePaymentCheck::getType(), "ENTITIES" => $entities, "RELATED_ENTITIES" => $relatedEntities);
1026 }
1027 else
1028 {
1029 if ($paymentCollection->isExistsInnerPayment())
1030 {
1031 $map[] = array("TYPE" => AdvancePaymentCheck::getType(), "ENTITIES" => $entities, "RELATED_ENTITIES" => $relatedEntities);
1032 }
1033 else
1034 {
1035 $shipmentCollection = $order->getShipmentCollection()->getNotSystemItems();
1037 foreach ($shipmentCollection as $shipment)
1038 {
1039 $relatedEntities[Check::SHIPMENT_TYPE_NONE][] = $shipment;
1040 }
1041
1042 $map[] = array("TYPE" => SellCheck::getType(), "ENTITIES" => $entities, "RELATED_ENTITIES" => $relatedEntities);
1043 }
1044 }
1045 }
1046 }
1047 elseif ($entity instanceof Sale\Shipment)
1048 {
1049 if ($entity->getField('DEDUCTED') !== 'Y')
1050 return $map;
1051
1052 $entities[] = $entity;
1053 if ($order->isPaid())
1054 {
1055 if (Main\Config\Option::get('sale', 'check_type_on_pay', 'sell') === 'sell')
1056 {
1057 return $map;
1058 }
1059
1060 $paymentCollection = $order->getPaymentCollection();
1061 foreach ($paymentCollection as $payment)
1062 {
1063 $relatedEntities[Check::PAYMENT_TYPE_ADVANCE][] = $payment;
1064 }
1065
1066 $map[] = array("TYPE" => SellCheck::getType(), "ENTITIES" => $entities, "RELATED_ENTITIES" => $relatedEntities);
1067 }
1068 else
1069 {
1070 $map[] = array("TYPE" => CreditCheck::getType(), "ENTITIES" => $entities, "RELATED_ENTITIES" => $relatedEntities);
1071 }
1072 }
1073 else
1074 {
1075 throw new Main\NotSupportedException();
1076 }
1077
1078 return $map;
1079 }
1080
1088 private static function collatePaySystemWithFFD105($entity): array
1089 {
1090 $map = [];
1091 $entities = [];
1092 $relatedEntities = [];
1093 $type = SellCheck::getType();
1094
1095 $option = Main\Config\Option::get('sale', 'check_type_on_pay', 'sell');
1096
1097 if ($entity instanceof Sale\Payment)
1098 {
1099 $fields = $entity->getFields();
1100 $originalFields = $fields->getOriginalValues();
1101 if ($originalFields['PAID'] === 'Y' || $fields->get('IS_RETURN') === 'Y')
1102 {
1103 return $map;
1104 }
1105
1106 $order = $entity->getOrder();
1107
1108 $entities[] = $entity;
1109
1110 $isShipped = false;
1112 foreach ($order->getShipmentCollection()->getNotSystemItems() as $shipment)
1113 {
1114 $isShipped = $shipment->isShipped();
1115 if (!$isShipped)
1116 {
1117 $relatedEntities = [];
1118 break;
1119 }
1120
1121 $relatedEntities[Check::SHIPMENT_TYPE_NONE][] = $shipment;
1122 }
1123
1124 if (!$isShipped)
1125 {
1126 $order = $entity->getOrder();
1127 if ($option === 'prepayment')
1128 {
1129 $type = (Sale\PriceMaths::roundPrecision($entity->getSum()) === Sale\PriceMaths::roundPrecision($order->getPrice()))
1132
1133 $shipmentCollection = $order->getShipmentCollection()->getNotSystemItems();
1135 foreach ($shipmentCollection as $shipment)
1136 {
1137 $relatedEntities[Check::SHIPMENT_TYPE_NONE][] = $shipment;
1138 }
1139 }
1140 elseif ($option === 'advance')
1141 {
1143 }
1144 else
1145 {
1146 $shipmentCollection = $order->getShipmentCollection()->getNotSystemItems();
1148 foreach ($shipmentCollection as $shipment)
1149 {
1150 $relatedEntities[Check::SHIPMENT_TYPE_NONE][] = $shipment;
1151 }
1152 }
1153 }
1154 }
1155 elseif ($entity instanceof Sale\Shipment)
1156 {
1157 $fields = $entity->getFields();
1158 $originalFields = $fields->getOriginalValues();
1159 if ($originalFields['DEDUCTED'] === 'Y' || $fields->get('DEDUCTED') !== 'Y')
1160 {
1161 return $map;
1162 }
1163
1164 $order = $entity->getOrder();
1165 if ($order->isPaid() && $entity->isShipped())
1166 {
1167 if ($option === 'sell')
1168 {
1169 return $map;
1170 }
1171
1172 $entities[] = $entity;
1173
1175 foreach ($order->getPaymentCollection() as $payment)
1176 {
1177 if ($payment->isInner())
1178 {
1179 continue;
1180 }
1181
1182 $relatedEntities[Check::PAYMENT_TYPE_CASHLESS][] = $payment;
1183 }
1184 }
1185 }
1186
1187 if ($entities)
1188 {
1189 $map[] = [
1190 'TYPE' => $type,
1191 'ENTITIES' => $entities,
1192 'RELATED_ENTITIES' => $relatedEntities,
1193 ];
1194 }
1195
1196 return $map;
1197 }
1198
1203 private static function canPrintCheck(Sale\Order $order)
1204 {
1205 $paymentCollection = $order->getPaymentCollection();
1206 if ($paymentCollection->isEmpty())
1207 {
1208 return false;
1209 }
1210
1212 foreach ($paymentCollection as $payment)
1213 {
1214 if ($payment->isInner())
1215 continue;
1216
1217 $service = $payment->getPaySystem();
1218 if ($service === null
1219 || $service->getField("CAN_PRINT_CHECK") !== 'Y'
1220 )
1221 {
1222 return false;
1223 }
1224 }
1225
1226 return true;
1227 }
1228
1239 public static function getPrintableChecks(array $cashboxIds, array $orderIds = array())
1240 {
1241 $result = array();
1242
1243 $con = Main\Application::getConnection();
1244 $dbLocRes = $con->query("SELECT GET_LOCK('get_check_list', 0) as L");
1245 $locResult = $dbLocRes->fetch();
1246 if ($locResult["L"] == "0")
1247 {
1248 return $result;
1249 }
1250
1251 $filter = array(
1252 'LINK_PARAMS' => '',
1253 'CHECK2CASHBOX.CASHBOX_ID' => $cashboxIds,
1254 array(
1255 'LOGIC' => 'OR',
1256 array(
1257 '=STATUS' => 'N',
1258 'DATE_PRINT_START' => ''
1259 ),
1260 array(
1261 '=STATUS' => 'P',
1262 '<MAX_DT_REPEAT_CHECK' => new Type\DateTime()
1263 )
1264 )
1265 );
1266
1267 if ($orderIds)
1268 {
1269 $filter['ORDER_ID'] = $orderIds;
1270 }
1271
1272 $limit = count($cashboxIds)*self::CHECK_LIMIT_RECORDS;
1273 $dbRes = self::getList(
1274 array(
1275 'select' => array('*', 'AVAILABLE_CASHBOX_ID' => 'CHECK2CASHBOX.CASHBOX_ID'),
1276 'filter' => $filter,
1277 'limit' => $limit,
1278 'runtime' => array(
1279 new Main\Entity\ExpressionField(
1280 'MAX_DT_REPEAT_CHECK',
1281 'DATE_ADD(DATE_PRINT_START, INTERVAL '.self::CHECK_RESENDING_TIME.' MINUTE)',
1282 null,
1283 array(
1284 'data_type' => 'datetime'
1285 )
1286 )
1287 )
1288 )
1289 );
1290
1291 if ($data = $dbRes->fetch())
1292 {
1293 $i = 0;
1294 do
1295 {
1296 if (!isset($result[$data['ID']]))
1297 {
1298 $i++;
1299 if ($i > self::CHECK_LIMIT_RECORDS)
1300 break;
1301
1302 $result[$data['ID']] = $data;
1303 $result[$data['ID']]['CASHBOX_LIST'] = array();
1304 }
1305
1306 $result[$data['ID']]['CASHBOX_LIST'][] = $data['AVAILABLE_CASHBOX_ID'];
1307 }
1308 while ($data = $dbRes->fetch());
1309
1310 foreach ($result as $checkId => $item)
1311 {
1312 if ($item['STATUS'] === 'P')
1313 {
1314 $now = new Type\DateTime();
1315 $nowTs = $now->getTimestamp();
1316
1318 $dateStartPrint = $item['DATE_PRINT_START'];
1319 $dateStartPrintTs = $dateStartPrint->getTimestamp();
1320
1321 if ($nowTs - $dateStartPrintTs > self::MIN_TIME_FOR_SWITCH_CASHBOX)
1322 {
1323 $availableCashboxIds = array_diff($item['CASHBOX_LIST'], array($item['CASHBOX_ID']));
1324 if ($availableCashboxIds)
1325 {
1326 $result[$checkId]['CASHBOX_ID'] = Manager::chooseCashbox($availableCashboxIds);
1327 CashboxCheckTable::update($checkId, array('CASHBOX_ID' => $result[$checkId]['CASHBOX_ID']));
1328 }
1329 }
1330 else
1331 {
1332 if ($item['CASHBOX_ID'] > 0 && !in_array($item['CASHBOX_ID'], $cashboxIds))
1333 unset($result[$checkId]);
1334 }
1335
1336 continue;
1337 }
1338
1339 $result[$checkId]['CASHBOX_ID'] = Manager::chooseCashbox($item['CASHBOX_LIST']);
1340 CashboxCheckTable::update($checkId, array('STATUS' => 'P', 'DATE_PRINT_START' => new Type\DateTime(), 'CASHBOX_ID' => $result[$checkId]['CASHBOX_ID']));
1341 }
1342 }
1343
1344 $con->query("SELECT RELEASE_LOCK('get_check_list')");
1345
1346 return $result;
1347 }
1348
1353 public static function create(array $settings)
1354 {
1355 $check = CheckManager::createByType($settings['TYPE']);
1356 if ($check)
1357 $check->init($settings);
1358
1359 return $check;
1360 }
1361
1368 public static function getCheckInfo(Sale\Internals\CollectableEntity $entity)
1369 {
1370 $filter = array();
1371 if ($entity->getId() > 0)
1372 {
1373 if ($entity instanceof Sale\Payment)
1374 {
1375 $filter['ENTITY_REGISTRY_TYPE'] = $entity::getRegistryType();
1376 $filter['PAYMENT_ID'] = $entity->getId();
1377 }
1378 elseif ($entity instanceof Sale\Shipment)
1379 {
1380 $filter['ENTITY_REGISTRY_TYPE'] = $entity::getRegistryType();
1381 $filter['SHIPMENT_ID'] = $entity->getId();
1382 }
1383
1384 return self::collectInfo($filter);
1385 }
1386
1387 return array();
1388 }
1389
1395 public static function getLastPrintableCheckInfo(Sale\Internals\CollectableEntity $entity)
1396 {
1397 if (!($entity instanceof Sale\Payment)
1398 && !($entity instanceof Sale\Shipment)
1399 )
1400 {
1401 return array();
1402 }
1403
1404 $filter = array(
1405 'STATUS' => 'Y',
1406 'ENTITY_REGISTRY_TYPE' => $entity::getRegistryType()
1407 );
1408 if ($entity instanceof Sale\Payment)
1409 {
1410 $filter['PAYMENT_ID'] = $entity->getId();
1411 }
1412 elseif ($entity instanceof Sale\Shipment)
1413 {
1414 $filter['SHIPMENT_ID'] = $entity->getId();
1415 }
1416
1417 $dbRes = self::getList(
1418 array(
1419 'select' => array('*'),
1420 'filter' => $filter,
1421 'order' => array('DATE_PRINT_END' => 'DESC'),
1422 'limit' => 1
1423 )
1424 );
1425
1426 if ($data = $dbRes->fetch())
1427 {
1428 $data['LINK'] = '';
1429 if (!empty($data['LINK_PARAMS']))
1430 {
1431 $cashbox = Manager::getObjectById($data['CASHBOX_ID']);
1432 if ($cashbox)
1433 $data['LINK'] = $cashbox->getCheckLink($data['LINK_PARAMS']);
1434 }
1435
1436 return $data;
1437 }
1438
1439 return array();
1440 }
1441
1448 public static function collectInfo(array $filter = array())
1449 {
1450 $result = array();
1451
1452 $typeMap = CheckManager::getCheckTypeMap();
1453
1454 $dbRes = self::getList(
1455 array(
1456 'select' => array('*'),
1457 'filter' => $filter
1458 )
1459 );
1460
1461 while ($data = $dbRes->fetch())
1462 {
1463 $data['LINK'] = '';
1464 if (!empty($data['LINK_PARAMS']))
1465 {
1466 $cashbox = Manager::getObjectById($data['CASHBOX_ID']);
1467 if ($cashbox)
1468 {
1469 $data['LINK'] = $cashbox->getCheckLink($data['LINK_PARAMS']);
1470 }
1471 }
1472
1474 $type = $typeMap[$data['TYPE']];
1475 if (class_exists($type))
1476 {
1477 $data['TYPE_NAME'] = $type::getName();
1478 }
1479
1480 $result[$data['ID']] = $data;
1481 }
1482
1483 return $result;
1484 }
1485
1491 public static function getCheckInfoByExternalUuid($uuid)
1492 {
1493 $dbRes = self::getList(array('filter' => array('EXTERNAL_UUID' => $uuid)));
1494 return $dbRes->fetch();
1495 }
1496
1504 public static function getObjectById($id)
1505 {
1506 if ($id <= 0)
1507 return null;
1508
1509 $dbRes = CashboxCheckTable::getById($id);
1510 if ($checkInfo = $dbRes->fetch())
1511 {
1512 $check = self::createByType($checkInfo['TYPE']);
1513 if ($check)
1514 {
1515 $check->init($checkInfo);
1516 return $check;
1517 }
1518 }
1519
1520 return null;
1521 }
1522
1528 public static function getList(array $parameters = array())
1529 {
1530 return CashboxCheckTable::getList($parameters);
1531 }
1532
1541 public static function getRelatedEntitiesForPayment($checkType, $paymentId, $registryType = Sale\Registry::REGISTRY_TYPE_ORDER)
1542 {
1543 $result = array();
1544
1545 $check = self::createByType($checkType);
1546 if ($check === null)
1547 {
1548 throw new Main\ArgumentTypeException($checkType);
1549 }
1550
1551 $registry = Sale\Registry::getInstance($registryType);
1553 $paymentClassName = $registry->getPaymentClassName();
1554
1555 $dbRes = $paymentClassName::getList(array(
1556 'select' => array('ORDER_ID'),
1557 'filter' => array('=ID' => $paymentId)
1558 ));
1559
1560 $paymentData = $dbRes->fetch();
1561 if (!$paymentData)
1562 {
1563 return $result;
1564 }
1565
1566 if ($check::getSupportedRelatedEntityType() === Check::SUPPORTED_ENTITY_TYPE_PAYMENT
1567 || $check::getSupportedRelatedEntityType() === Check::SUPPORTED_ENTITY_TYPE_ALL
1568 )
1569 {
1570 if (Manager::isSupportedFFD105())
1571 {
1572 $dbRes = $paymentClassName::getList(array(
1573 'select' => array('ID', 'ACCOUNT_NUMBER', 'SUM', 'CURRENCY', 'NAME' => 'PAY_SYSTEM.NAME'),
1574 'filter' => array(
1575 '!ID' => $paymentId,
1576 '=ORDER_ID' => $paymentData['ORDER_ID']
1577 )
1578 ));
1579
1580 while ($data = $dbRes->fetch())
1581 {
1582 $data['PAYMENT_TYPES'] = array(
1583 array(
1584 'CODE' => Sale\Cashbox\Check::PAYMENT_TYPE_ADVANCE,
1585 'NAME' => Loc::getMessage('SALE_CASHBOX_CHECK_ADVANCE'),
1586 ),
1587 array(
1588 'CODE' => Sale\Cashbox\Check::PAYMENT_TYPE_CREDIT,
1589 'NAME' => Loc::getMessage('SALE_CASHBOX_CHECK_CREDIT'),
1590 )
1591 );
1592
1593 $result['PAYMENTS'][$data['ID']] = $data;
1594 }
1595 }
1596 }
1597 if ($check::getSupportedRelatedEntityType() === Check::SUPPORTED_ENTITY_TYPE_SHIPMENT
1598 || $check::getSupportedRelatedEntityType() === Check::SUPPORTED_ENTITY_TYPE_ALL
1599 )
1600 {
1602 $shipmentClassName = $registry->getShipmentClassName();
1603 $dbRes = $shipmentClassName::getList(array(
1604 'select' => array('ID', 'ACCOUNT_NUMBER', 'PRICE_DELIVERY', 'CURRENCY', 'NAME' => 'DELIVERY.NAME'),
1605 'filter' => array(
1606 '=ORDER_ID' => $paymentData['ORDER_ID'],
1607 'SYSTEM' => 'N'
1608 )
1609 ));
1610
1611 while ($data = $dbRes->fetch())
1612 {
1613 $result['SHIPMENTS'][$data['ID']] = $data;
1614 }
1615 }
1616
1617 return $result;
1618 }
1619
1628 public static function getRelatedEntitiesForShipment($checkType, $shipmentId, $registryType = Sale\Registry::REGISTRY_TYPE_ORDER)
1629 {
1630 $result = array();
1631
1632 if (!Manager::isSupportedFFD105())
1633 {
1634 return $result;
1635 }
1636
1637 $check = self::createByType($checkType);
1638 if ($check === null)
1639 {
1640 throw new Main\ArgumentTypeException($checkType);
1641 }
1642
1643 $registry = Sale\Registry::getInstance($registryType);
1645 $shipmentClassName = $registry->getShipmentClassName();
1646
1647 $dbRes = $shipmentClassName::getList(array(
1648 'select' => array('ORDER_ID'),
1649 'filter' => array('=ID' => $shipmentId)
1650 ));
1651
1652 $shipmentData = $dbRes->fetch();
1653 if (!$shipmentData)
1654 {
1655 return $result;
1656 }
1657
1658 if ($check::getSupportedRelatedEntityType() === Check::SUPPORTED_ENTITY_TYPE_SHIPMENT
1659 || $check::getSupportedRelatedEntityType() === Check::SUPPORTED_ENTITY_TYPE_ALL
1660 )
1661 {
1662 $dbRes = $shipmentClassName::getList(array(
1663 'select' => array('ID', 'ACCOUNT_NUMBER', 'PRICE_DELIVERY', 'CURRENCY', 'NAME' => 'DELIVERY.NAME'),
1664 'filter' => array(
1665 '!ID' => $shipmentId,
1666 '=ORDER_ID' => $shipmentData['ORDER_ID'],
1667 'SYSTEM' => 'N'
1668 )
1669 ));
1670
1671 while ($data = $dbRes->fetch())
1672 {
1673 $result['SHIPMENTS'][$data['ID']] = $data;
1674 }
1675 }
1676
1677 if ($check::getSupportedRelatedEntityType() === Check::SUPPORTED_ENTITY_TYPE_PAYMENT
1678 || $check::getSupportedRelatedEntityType() === Check::SUPPORTED_ENTITY_TYPE_ALL
1679 )
1680 {
1682 $paymentClassName = $registry->getPaymentClassName();
1683 $dbRes = $paymentClassName::getList(array(
1684 'select' => array('ID', 'ACCOUNT_NUMBER', 'SUM', 'CURRENCY', 'NAME' => 'PAY_SYSTEM.NAME'),
1685 'filter' => array(
1686 '=ORDER_ID' => $shipmentData['ORDER_ID']
1687 )
1688 ));
1689
1690 while ($data = $dbRes->fetch())
1691 {
1692 $data['PAYMENT_TYPES'] = array(
1693 array(
1694 'CODE' => Sale\Cashbox\Check::PAYMENT_TYPE_ADVANCE,
1695 'NAME' => Loc::getMessage('SALE_CASHBOX_CHECK_ADVANCE'),
1696 ),
1697 array(
1698 'CODE' => Sale\Cashbox\Check::PAYMENT_TYPE_CREDIT,
1699 'NAME' => Loc::getMessage('SALE_CASHBOX_CHECK_CREDIT'),
1700 )
1701 );
1702
1703 $result['PAYMENTS'][$data['ID']] = $data;
1704 }
1705 }
1706
1707 return $result;
1708 }
1709
1716 public static function getPaymentByCheck(Check $check): ?Sale\Payment
1717 {
1718 $payment = null;
1719
1720 $entities = $check->getEntities();
1721 foreach ($entities as $entity)
1722 {
1723 if ($entity instanceof Sale\Payment)
1724 {
1725 $payment = $entity;
1726 }
1727 }
1728
1729 if (!$payment)
1730 {
1731 $relatedEntities = $check->getRelatedEntities();
1732 foreach ($relatedEntities as $relatedEntityCollection)
1733 {
1734 foreach ($relatedEntityCollection as $relatedEntity)
1735 {
1736 if ($relatedEntity instanceof Sale\Payment)
1737 {
1738 $payment = $relatedEntity;
1739 }
1740 }
1741 }
1742 }
1743
1744 return $payment;
1745 }
1746}
create()
static loadLanguageFile($file, $language=null, $normalize=true)
Definition loc.php:224
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29
static getLastPrintableCheckInfo(Sale\Internals\CollectableEntity $entity)
static getCheckInfo(Sale\Internals\CollectableEntity $entity)
static getPaymentByCheck(Check $check)
static getList(array $parameters=array())
static create(array $settings)
static addWarning(?string $message, $cashboxId=null)
Definition logger.php:34
static addError(?string $message, $cashboxId=null)
Definition logger.php:25
static getAvailableCashboxList(Check $check)
Definition manager.php:85
static getCashboxFromCache($cashboxId)
Definition manager.php:268
static chooseCashbox($cashboxList)
Definition manager.php:198