@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function getName() |
30 | 30 | { |
31 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Subscription process start' ); |
|
31 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Subscription process start'); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function getDescription() |
41 | 41 | { |
42 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Process subscriptions initially' ); |
|
42 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Process subscriptions initially'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @see controller/common/subscription/process/payment-status |
68 | 68 | * @see controller/common/subscription/process/payment-days |
69 | 69 | */ |
70 | - $names = (array) $config->get( 'controller/common/subscription/process/processors', [] ); |
|
70 | + $names = (array) $config->get('controller/common/subscription/process/processors', []); |
|
71 | 71 | |
72 | 72 | /** controller/common/subscription/process/payment-status |
73 | 73 | * Minimum payment status that will activate the subscription |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @see controller/common/subscription/process/payment-days |
87 | 87 | */ |
88 | 88 | $status = \Aimeos\MShop\Order\Item\Base::PAY_AUTHORIZED; |
89 | - $status = $config->get( 'controller/common/subscription/process/payment-status', $status ); |
|
89 | + $status = $config->get('controller/common/subscription/process/payment-status', $status); |
|
90 | 90 | |
91 | 91 | /** controller/common/subscription/process/payment-days |
92 | 92 | * Number of days to wait for the payment until subscription is removed |
@@ -104,74 +104,74 @@ discard block |
||
104 | 104 | * @see controller/common/subscription/process/processors |
105 | 105 | * @see controller/common/subscription/process/payment-status |
106 | 106 | */ |
107 | - $days = (float) $config->get( 'controller/common/subscription/process/payment-days', 3 ); |
|
107 | + $days = (float) $config->get('controller/common/subscription/process/payment-days', 3); |
|
108 | 108 | |
109 | 109 | |
110 | - $processors = $this->getProcessors( $names ); |
|
111 | - $orderManager = \Aimeos\MShop::create( $context, 'order' ); |
|
112 | - $manager = \Aimeos\MShop::create( $context, 'subscription' ); |
|
110 | + $processors = $this->getProcessors($names); |
|
111 | + $orderManager = \Aimeos\MShop::create($context, 'order'); |
|
112 | + $manager = \Aimeos\MShop::create($context, 'subscription'); |
|
113 | 113 | |
114 | - $search = $manager->createSearch( true ); |
|
114 | + $search = $manager->createSearch(true); |
|
115 | 115 | $expr = [ |
116 | - $search->compare( '==', 'subscription.datenext', null ), |
|
116 | + $search->compare('==', 'subscription.datenext', null), |
|
117 | 117 | $search->getConditions(), |
118 | 118 | ]; |
119 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
120 | - $search->setSortations( [$search->sort( '+', 'subscription.id' )] ); |
|
119 | + $search->setConditions($search->combine('&&', $expr)); |
|
120 | + $search->setSortations([$search->sort('+', 'subscription.id')]); |
|
121 | 121 | |
122 | - $date = date( 'Y-m-d H:i:s', time() - 86400 * $days ); |
|
122 | + $date = date('Y-m-d H:i:s', time() - 86400 * $days); |
|
123 | 123 | $start = 0; |
124 | 124 | |
125 | 125 | do |
126 | 126 | { |
127 | 127 | $ordBaseIds = $payStatus = []; |
128 | 128 | |
129 | - $search->setSlice( $start, 100 ); |
|
130 | - $items = $manager->searchItems( $search ); |
|
129 | + $search->setSlice($start, 100); |
|
130 | + $items = $manager->searchItems($search); |
|
131 | 131 | |
132 | - foreach( $items as $item ) { |
|
132 | + foreach ($items as $item) { |
|
133 | 133 | $ordBaseIds[] = $item->getOrderBaseId(); |
134 | 134 | } |
135 | 135 | |
136 | - $orderSearch = $orderManager->createSearch()->setSlice( 0, $search->getSliceSize() ); |
|
137 | - $orderSearch->setConditions( $orderSearch->compare( '==', 'order.base.id', $ordBaseIds ) ); |
|
138 | - $orderSearch->setSortations( [$orderSearch->sort( '+', 'order.id' )] ); |
|
136 | + $orderSearch = $orderManager->createSearch()->setSlice(0, $search->getSliceSize()); |
|
137 | + $orderSearch->setConditions($orderSearch->compare('==', 'order.base.id', $ordBaseIds)); |
|
138 | + $orderSearch->setSortations([$orderSearch->sort('+', 'order.id')]); |
|
139 | 139 | |
140 | - foreach( $orderManager->searchItems( $orderSearch ) as $orderItem ) { |
|
140 | + foreach ($orderManager->searchItems($orderSearch) as $orderItem) { |
|
141 | 141 | $payStatus[$orderItem->getBaseId()] = $orderItem->getPaymentStatus(); |
142 | 142 | } |
143 | 143 | |
144 | - foreach( $items as $item ) |
|
144 | + foreach ($items as $item) |
|
145 | 145 | { |
146 | 146 | try |
147 | 147 | { |
148 | - if( isset( $payStatus[$item->getOrderBaseId()] ) && $payStatus[$item->getOrderBaseId()] >= $status ) |
|
148 | + if (isset($payStatus[$item->getOrderBaseId()]) && $payStatus[$item->getOrderBaseId()] >= $status) |
|
149 | 149 | { |
150 | - foreach( $processors as $processor ) { |
|
151 | - $processor->begin( $item ); |
|
150 | + foreach ($processors as $processor) { |
|
151 | + $processor->begin($item); |
|
152 | 152 | } |
153 | 153 | |
154 | - $interval = new \DateInterval( $item->getInterval() ); |
|
155 | - $item->setDateNext( date_create( $item->getTimeCreated() )->add( $interval )->format( 'Y-m-d' ) ); |
|
154 | + $interval = new \DateInterval($item->getInterval()); |
|
155 | + $item->setDateNext(date_create($item->getTimeCreated())->add($interval)->format('Y-m-d')); |
|
156 | 156 | } |
157 | - elseif( $item->getTimeCreated() < $date ) |
|
157 | + elseif ($item->getTimeCreated() < $date) |
|
158 | 158 | { |
159 | - $item->setStatus( 0 ); |
|
159 | + $item->setStatus(0); |
|
160 | 160 | } |
161 | 161 | |
162 | - $manager->saveItem( $item ); |
|
162 | + $manager->saveItem($item); |
|
163 | 163 | } |
164 | - catch( \Exception $e ) |
|
164 | + catch (\Exception $e) |
|
165 | 165 | { |
166 | 166 | $msg = 'Unable to process subscription with ID "%1$S": %2$s'; |
167 | - $logger->log( sprintf( $msg, $item->getId(), $e->getMessage() ) ); |
|
168 | - $logger->log( $e->getTraceAsString() ); |
|
167 | + $logger->log(sprintf($msg, $item->getId(), $e->getMessage())); |
|
168 | + $logger->log($e->getTraceAsString()); |
|
169 | 169 | } |
170 | 170 | } |
171 | 171 | |
172 | - $count = count( $items ); |
|
172 | + $count = count($items); |
|
173 | 173 | $start += $count; |
174 | 174 | } |
175 | - while( $count === $search->getSliceSize() ); |
|
175 | + while ($count === $search->getSliceSize()); |
|
176 | 176 | } |
177 | 177 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function getName() |
31 | 31 | { |
32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Removes unfinished orders' ); |
|
32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Removes unfinished orders'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function getDescription() |
42 | 42 | { |
43 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Deletes unfinished orders an makes their products and coupon codes available again' ); |
|
43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Deletes unfinished orders an makes their products and coupon codes available again'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | public function run() |
53 | 53 | { |
54 | 54 | $context = $this->getContext(); |
55 | - $controller = \Aimeos\Controller\Common\Order\Factory::createController( $context ); |
|
56 | - $baseManager = \Aimeos\MShop::create( $context, 'order/base' ); |
|
57 | - $manager = \Aimeos\MShop::create( $context, 'order' ); |
|
55 | + $controller = \Aimeos\Controller\Common\Order\Factory::createController($context); |
|
56 | + $baseManager = \Aimeos\MShop::create($context, 'order/base'); |
|
57 | + $manager = \Aimeos\MShop::create($context, 'order'); |
|
58 | 58 | |
59 | 59 | /** controller/jobs/order/cleanup/unfinished/keep-hours |
60 | 60 | * Release the ordered products after the configured time if no payment was confirmed |
@@ -74,35 +74,35 @@ discard block |
||
74 | 74 | * @since 2014.07 |
75 | 75 | * @category User |
76 | 76 | */ |
77 | - $hours = $context->getConfig()->get( 'controller/jobs/order/cleanup/unfinished/keep-hours', 24 ); |
|
78 | - $limit = date( 'Y-m-d H:i:s', time() - 3600 * $hours ); |
|
77 | + $hours = $context->getConfig()->get('controller/jobs/order/cleanup/unfinished/keep-hours', 24); |
|
78 | + $limit = date('Y-m-d H:i:s', time() - 3600 * $hours); |
|
79 | 79 | |
80 | 80 | $search = $manager->createSearch(); |
81 | 81 | $expr = array( |
82 | - $search->compare( '<', 'order.mtime', $limit ), |
|
83 | - $search->compare( '==', 'order.statuspayment', \Aimeos\MShop\Order\Item\Base::PAY_UNFINISHED ), |
|
82 | + $search->compare('<', 'order.mtime', $limit), |
|
83 | + $search->compare('==', 'order.statuspayment', \Aimeos\MShop\Order\Item\Base::PAY_UNFINISHED), |
|
84 | 84 | ); |
85 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
85 | + $search->setConditions($search->combine('&&', $expr)); |
|
86 | 86 | |
87 | 87 | $start = 0; |
88 | 88 | |
89 | 89 | do |
90 | 90 | { |
91 | 91 | $baseIds = []; |
92 | - $items = $manager->searchItems( $search ); |
|
92 | + $items = $manager->searchItems($search); |
|
93 | 93 | |
94 | - foreach( $items as $item ) |
|
94 | + foreach ($items as $item) |
|
95 | 95 | { |
96 | - $controller->unblock( $item ); |
|
96 | + $controller->unblock($item); |
|
97 | 97 | $baseIds[] = $item->getBaseId(); |
98 | 98 | } |
99 | 99 | |
100 | - $baseManager->deleteItems( $baseIds ); |
|
100 | + $baseManager->deleteItems($baseIds); |
|
101 | 101 | |
102 | - $count = count( $items ); |
|
102 | + $count = count($items); |
|
103 | 103 | $start += $count; |
104 | - $search->setSlice( $start ); |
|
104 | + $search->setSlice($start); |
|
105 | 105 | } |
106 | - while( $count >= $search->getSliceSize() ); |
|
106 | + while ($count >= $search->getSliceSize()); |
|
107 | 107 | } |
108 | 108 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function getName() |
31 | 31 | { |
32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Removes unpaid orders' ); |
|
32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Removes unpaid orders'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function getDescription() |
42 | 42 | { |
43 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Deletes unpaid orders to keep the database clean' ); |
|
43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Deletes unpaid orders to keep the database clean'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | public function run() |
53 | 53 | { |
54 | 54 | $context = $this->getContext(); |
55 | - $controller = \Aimeos\Controller\Common\Order\Factory::createController( $context ); |
|
56 | - $baseManager = \Aimeos\MShop::create( $context, 'order/base' ); |
|
57 | - $manager = \Aimeos\MShop::create( $context, 'order' ); |
|
55 | + $controller = \Aimeos\Controller\Common\Order\Factory::createController($context); |
|
56 | + $baseManager = \Aimeos\MShop::create($context, 'order/base'); |
|
57 | + $manager = \Aimeos\MShop::create($context, 'order'); |
|
58 | 58 | |
59 | 59 | /** controller/jobs/order/cleanup/unpaid/keep-days |
60 | 60 | * Removes all orders from the database that are unpaid |
@@ -71,35 +71,35 @@ discard block |
||
71 | 71 | * @since 2014.07 |
72 | 72 | * @category User |
73 | 73 | */ |
74 | - $days = $context->getConfig()->get( 'controller/jobs/order/cleanup/unpaid/keep-days', 3 ); |
|
75 | - $limit = date( 'Y-m-d H:i:s', time() - 86400 * $days ); |
|
74 | + $days = $context->getConfig()->get('controller/jobs/order/cleanup/unpaid/keep-days', 3); |
|
75 | + $limit = date('Y-m-d H:i:s', time() - 86400 * $days); |
|
76 | 76 | |
77 | 77 | $search = $manager->createSearch(); |
78 | 78 | $expr = array( |
79 | - $search->compare( '<', 'order.mtime', $limit ), |
|
80 | - $search->compare( '<', 'order.statuspayment', \Aimeos\MShop\Order\Item\Base::PAY_REFUND ), |
|
79 | + $search->compare('<', 'order.mtime', $limit), |
|
80 | + $search->compare('<', 'order.statuspayment', \Aimeos\MShop\Order\Item\Base::PAY_REFUND), |
|
81 | 81 | ); |
82 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
82 | + $search->setConditions($search->combine('&&', $expr)); |
|
83 | 83 | |
84 | 84 | $start = 0; |
85 | 85 | |
86 | 86 | do |
87 | 87 | { |
88 | 88 | $baseIds = []; |
89 | - $items = $manager->searchItems( $search ); |
|
89 | + $items = $manager->searchItems($search); |
|
90 | 90 | |
91 | - foreach( $items as $item ) |
|
91 | + foreach ($items as $item) |
|
92 | 92 | { |
93 | - $controller->unblock( $item ); |
|
93 | + $controller->unblock($item); |
|
94 | 94 | $baseIds[] = $item->getBaseId(); |
95 | 95 | } |
96 | 96 | |
97 | - $baseManager->deleteItems( $baseIds ); |
|
97 | + $baseManager->deleteItems($baseIds); |
|
98 | 98 | |
99 | - $count = count( $items ); |
|
99 | + $count = count($items); |
|
100 | 100 | $start += $count; |
101 | - $search->setSlice( $start ); |
|
101 | + $search->setSlice($start); |
|
102 | 102 | } |
103 | - while( $count >= $search->getSliceSize() ); |
|
103 | + while ($count >= $search->getSliceSize()); |
|
104 | 104 | } |
105 | 105 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function getName() |
31 | 31 | { |
32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Process order delivery services' ); |
|
32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Process order delivery services'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function getDescription() |
42 | 42 | { |
43 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Sends paid orders to the ERP system or logistic partner' ); |
|
43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Sends paid orders to the ERP system or logistic partner'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | * @see controller/jobs/order/email/delivery/standard/limit-days |
70 | 70 | * @see controller/jobs/order/service/delivery/batch-max |
71 | 71 | */ |
72 | - $days = $context->getConfig()->get( 'controller/jobs/order/service/delivery/limit-days', 90 ); |
|
73 | - $date = date( 'Y-m-d 00:00:00', time() - 86400 * $days ); |
|
72 | + $days = $context->getConfig()->get('controller/jobs/order/service/delivery/limit-days', 90); |
|
73 | + $date = date('Y-m-d 00:00:00', time() - 86400 * $days); |
|
74 | 74 | |
75 | 75 | /** controller/jobs/order/service/delivery/batch-max |
76 | 76 | * Maximum number of orders processed at once by the delivery service provider |
@@ -85,71 +85,71 @@ discard block |
||
85 | 85 | * @category Developer |
86 | 86 | * @see controller/jobs/order/service/delivery/limit-days |
87 | 87 | */ |
88 | - $maxItems = $context->getConfig()->get( 'controller/jobs/order/service/delivery/batch-max', 100 ); |
|
88 | + $maxItems = $context->getConfig()->get('controller/jobs/order/service/delivery/batch-max', 100); |
|
89 | 89 | |
90 | 90 | |
91 | - $serviceManager = \Aimeos\MShop\Service\Manager\Factory::create( $context ); |
|
91 | + $serviceManager = \Aimeos\MShop\Service\Manager\Factory::create($context); |
|
92 | 92 | $serviceSearch = $serviceManager->createSearch(); |
93 | - $serviceSearch->setConditions( $serviceSearch->compare( '==', 'service.type', 'delivery' ) ); |
|
93 | + $serviceSearch->setConditions($serviceSearch->compare('==', 'service.type', 'delivery')); |
|
94 | 94 | |
95 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::create( $context ); |
|
95 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::create($context); |
|
96 | 96 | $orderSearch = $orderManager->createSearch(); |
97 | 97 | |
98 | 98 | $start = 0; |
99 | 99 | |
100 | 100 | do |
101 | 101 | { |
102 | - $serviceItems = $serviceManager->searchItems( $serviceSearch ); |
|
102 | + $serviceItems = $serviceManager->searchItems($serviceSearch); |
|
103 | 103 | |
104 | - foreach( $serviceItems as $serviceItem ) |
|
104 | + foreach ($serviceItems as $serviceItem) |
|
105 | 105 | { |
106 | 106 | try |
107 | 107 | { |
108 | - $serviceProvider = $serviceManager->getProvider( $serviceItem, $serviceItem->getType() ); |
|
108 | + $serviceProvider = $serviceManager->getProvider($serviceItem, $serviceItem->getType()); |
|
109 | 109 | |
110 | 110 | $expr = array( |
111 | - $orderSearch->compare( '>', 'order.datepayment', $date ), |
|
112 | - $orderSearch->compare( '>', 'order.statuspayment', \Aimeos\MShop\Order\Item\Base::PAY_PENDING ), |
|
113 | - $orderSearch->compare( '==', 'order.statusdelivery', \Aimeos\MShop\Order\Item\Base::STAT_UNFINISHED ), |
|
114 | - $orderSearch->compare( '==', 'order.base.service.code', $serviceItem->getCode() ), |
|
115 | - $orderSearch->compare( '==', 'order.base.service.type', 'delivery' ), |
|
111 | + $orderSearch->compare('>', 'order.datepayment', $date), |
|
112 | + $orderSearch->compare('>', 'order.statuspayment', \Aimeos\MShop\Order\Item\Base::PAY_PENDING), |
|
113 | + $orderSearch->compare('==', 'order.statusdelivery', \Aimeos\MShop\Order\Item\Base::STAT_UNFINISHED), |
|
114 | + $orderSearch->compare('==', 'order.base.service.code', $serviceItem->getCode()), |
|
115 | + $orderSearch->compare('==', 'order.base.service.type', 'delivery'), |
|
116 | 116 | ); |
117 | - $orderSearch->setConditions( $orderSearch->combine( '&&', $expr ) ); |
|
117 | + $orderSearch->setConditions($orderSearch->combine('&&', $expr)); |
|
118 | 118 | |
119 | 119 | $orderStart = 0; |
120 | 120 | |
121 | 121 | do |
122 | 122 | { |
123 | - $orderSearch->setSlice( $orderStart, $maxItems ); |
|
124 | - $orderItems = $orderManager->searchItems( $orderSearch ); |
|
123 | + $orderSearch->setSlice($orderStart, $maxItems); |
|
124 | + $orderItems = $orderManager->searchItems($orderSearch); |
|
125 | 125 | |
126 | 126 | try |
127 | 127 | { |
128 | - $serviceProvider->processBatch( $orderItems ); |
|
129 | - $orderManager->saveItems( $orderItems ); |
|
128 | + $serviceProvider->processBatch($orderItems); |
|
129 | + $orderManager->saveItems($orderItems); |
|
130 | 130 | } |
131 | - catch( \Exception $e ) |
|
131 | + catch (\Exception $e) |
|
132 | 132 | { |
133 | 133 | $str = 'Error while processing orders by delivery service "%1$s": %2$s'; |
134 | - $context->getLogger()->log( sprintf( $str, $serviceItem->getLabel(), $e->getMessage() ) ); |
|
134 | + $context->getLogger()->log(sprintf($str, $serviceItem->getLabel(), $e->getMessage())); |
|
135 | 135 | } |
136 | 136 | |
137 | - $orderCount = count( $orderItems ); |
|
137 | + $orderCount = count($orderItems); |
|
138 | 138 | $orderStart += $orderCount; |
139 | 139 | } |
140 | - while( $orderCount >= $orderSearch->getSliceSize() ); |
|
140 | + while ($orderCount >= $orderSearch->getSliceSize()); |
|
141 | 141 | } |
142 | - catch( \Exception $e ) |
|
142 | + catch (\Exception $e) |
|
143 | 143 | { |
144 | 144 | $str = 'Error while processing service with ID "%1$s": %2$s'; |
145 | - $context->getLogger()->log( sprintf( $str, $serviceItem->getId(), $e->getMessage() ) ); |
|
145 | + $context->getLogger()->log(sprintf($str, $serviceItem->getId(), $e->getMessage())); |
|
146 | 146 | } |
147 | 147 | } |
148 | 148 | |
149 | - $count = count( $serviceItems ); |
|
149 | + $count = count($serviceItems); |
|
150 | 150 | $start += $count; |
151 | - $serviceSearch->setSlice( $start ); |
|
151 | + $serviceSearch->setSlice($start); |
|
152 | 152 | } |
153 | - while( $count >= $serviceSearch->getSliceSize() ); |
|
153 | + while ($count >= $serviceSearch->getSliceSize()); |
|
154 | 154 | } |
155 | 155 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function getName() |
31 | 31 | { |
32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Batch update of payment/delivery status' ); |
|
32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Batch update of payment/delivery status'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function getDescription() |
42 | 42 | { |
43 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Executes payment or delivery service providers that uses batch updates' ); |
|
43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Executes payment or delivery service providers that uses batch updates'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -52,32 +52,32 @@ discard block |
||
52 | 52 | public function run() |
53 | 53 | { |
54 | 54 | $context = $this->getContext(); |
55 | - $serviceManager = \Aimeos\MShop::create( $context, 'service' ); |
|
55 | + $serviceManager = \Aimeos\MShop::create($context, 'service'); |
|
56 | 56 | |
57 | 57 | $search = $serviceManager->createSearch(); |
58 | 58 | $start = 0; |
59 | 59 | |
60 | 60 | do |
61 | 61 | { |
62 | - $serviceItems = $serviceManager->searchItems( $search ); |
|
62 | + $serviceItems = $serviceManager->searchItems($search); |
|
63 | 63 | |
64 | - foreach( $serviceItems as $serviceItem ) |
|
64 | + foreach ($serviceItems as $serviceItem) |
|
65 | 65 | { |
66 | 66 | try |
67 | 67 | { |
68 | - $serviceManager->getProvider( $serviceItem, $serviceItem->getType() )->updateAsync(); |
|
68 | + $serviceManager->getProvider($serviceItem, $serviceItem->getType())->updateAsync(); |
|
69 | 69 | } |
70 | - catch( \Exception $e ) |
|
70 | + catch (\Exception $e) |
|
71 | 71 | { |
72 | 72 | $msg = 'Executing updateAsyc() of "%1$s" failed: %2$s'; |
73 | - $context->getLogger()->log( sprintf( $msg, $serviceItem->getProvider(), $e->getMessage() ) ); |
|
73 | + $context->getLogger()->log(sprintf($msg, $serviceItem->getProvider(), $e->getMessage())); |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
77 | - $count = count( $serviceItems ); |
|
77 | + $count = count($serviceItems); |
|
78 | 78 | $start += $count; |
79 | - $search->setSlice( $start ); |
|
79 | + $search->setSlice($start); |
|
80 | 80 | } |
81 | - while( $count >= $search->getSliceSize() ); |
|
81 | + while ($count >= $search->getSliceSize()); |
|
82 | 82 | } |
83 | 83 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function getName() |
31 | 31 | { |
32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Capture authorized payments' ); |
|
32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Capture authorized payments'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function getDescription() |
42 | 42 | { |
43 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Authorized payments of orders will be captured after dispatching or after a configurable amount of time' ); |
|
43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Authorized payments of orders will be captured after dispatching or after a configurable amount of time'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | * @category User |
69 | 69 | * @category Developer |
70 | 70 | */ |
71 | - $days = $config->get( 'controller/jobs/order/service/payment/limit-days', 90 ); |
|
72 | - $date = date( 'Y-m-d 00:00:00', time() - 86400 * $days ); |
|
71 | + $days = $config->get('controller/jobs/order/service/payment/limit-days', 90); |
|
72 | + $date = date('Y-m-d 00:00:00', time() - 86400 * $days); |
|
73 | 73 | |
74 | 74 | /** controller/jobs/order/service/payment/capture-days |
75 | 75 | * Automatically capture payments after the configured amount of days |
@@ -84,90 +84,90 @@ discard block |
||
84 | 84 | * @category User |
85 | 85 | * @category Developer |
86 | 86 | */ |
87 | - $capDays = $config->get( 'controller/jobs/order/service/payment/capture-days', null ); |
|
87 | + $capDays = $config->get('controller/jobs/order/service/payment/capture-days', null); |
|
88 | 88 | |
89 | 89 | |
90 | - $serviceManager = \Aimeos\MShop::create( $context, 'service' ); |
|
90 | + $serviceManager = \Aimeos\MShop::create($context, 'service'); |
|
91 | 91 | $serviceSearch = $serviceManager->createSearch(); |
92 | - $serviceSearch->setConditions( $serviceSearch->compare( '==', 'service.type', 'payment' ) ); |
|
92 | + $serviceSearch->setConditions($serviceSearch->compare('==', 'service.type', 'payment')); |
|
93 | 93 | |
94 | - $orderManager = \Aimeos\MShop::create( $context, 'order' ); |
|
94 | + $orderManager = \Aimeos\MShop::create($context, 'order'); |
|
95 | 95 | $orderSearch = $orderManager->createSearch(); |
96 | 96 | |
97 | - $status = array( \Aimeos\MShop\Order\Item\Base::STAT_DISPATCHED, \Aimeos\MShop\Order\Item\Base::STAT_DELIVERED ); |
|
97 | + $status = array(\Aimeos\MShop\Order\Item\Base::STAT_DISPATCHED, \Aimeos\MShop\Order\Item\Base::STAT_DELIVERED); |
|
98 | 98 | $start = 0; |
99 | 99 | |
100 | 100 | do |
101 | 101 | { |
102 | - $serviceItems = $serviceManager->searchItems( $serviceSearch ); |
|
102 | + $serviceItems = $serviceManager->searchItems($serviceSearch); |
|
103 | 103 | |
104 | - foreach( $serviceItems as $serviceItem ) |
|
104 | + foreach ($serviceItems as $serviceItem) |
|
105 | 105 | { |
106 | 106 | try |
107 | 107 | { |
108 | - $serviceProvider = $serviceManager->getProvider( $serviceItem, $serviceItem->getType() ); |
|
108 | + $serviceProvider = $serviceManager->getProvider($serviceItem, $serviceItem->getType()); |
|
109 | 109 | |
110 | - if( !$serviceProvider->isImplemented( \Aimeos\MShop\Service\Provider\Payment\Base::FEAT_CAPTURE ) ) { |
|
110 | + if (!$serviceProvider->isImplemented(\Aimeos\MShop\Service\Provider\Payment\Base::FEAT_CAPTURE)) { |
|
111 | 111 | continue; |
112 | 112 | } |
113 | 113 | |
114 | 114 | |
115 | 115 | $expr = []; |
116 | - $expr[] = $orderSearch->compare( '>', 'order.datepayment', $date ); |
|
116 | + $expr[] = $orderSearch->compare('>', 'order.datepayment', $date); |
|
117 | 117 | |
118 | - if( $capDays !== null ) |
|
118 | + if ($capDays !== null) |
|
119 | 119 | { |
120 | - $capdate = date( 'Y-m-d 00:00:00', time() - 86400 * $capDays ); |
|
121 | - $expr[] = $orderSearch->compare( '<=', 'order.datepayment', $capdate ); |
|
120 | + $capdate = date('Y-m-d 00:00:00', time() - 86400 * $capDays); |
|
121 | + $expr[] = $orderSearch->compare('<=', 'order.datepayment', $capdate); |
|
122 | 122 | } |
123 | 123 | else |
124 | 124 | { |
125 | - $expr[] = $orderSearch->compare( '==', 'order.statusdelivery', $status ); |
|
125 | + $expr[] = $orderSearch->compare('==', 'order.statusdelivery', $status); |
|
126 | 126 | } |
127 | 127 | |
128 | - $expr[] = $orderSearch->compare( '==', 'order.statuspayment', \Aimeos\MShop\Order\Item\Base::PAY_AUTHORIZED ); |
|
129 | - $expr[] = $orderSearch->compare( '==', 'order.base.service.code', $serviceItem->getCode() ); |
|
130 | - $expr[] = $orderSearch->compare( '==', 'order.base.service.type', 'payment' ); |
|
128 | + $expr[] = $orderSearch->compare('==', 'order.statuspayment', \Aimeos\MShop\Order\Item\Base::PAY_AUTHORIZED); |
|
129 | + $expr[] = $orderSearch->compare('==', 'order.base.service.code', $serviceItem->getCode()); |
|
130 | + $expr[] = $orderSearch->compare('==', 'order.base.service.type', 'payment'); |
|
131 | 131 | |
132 | - $orderSearch->setConditions( $orderSearch->combine( '&&', $expr ) ); |
|
132 | + $orderSearch->setConditions($orderSearch->combine('&&', $expr)); |
|
133 | 133 | |
134 | 134 | |
135 | 135 | $orderStart = 0; |
136 | 136 | |
137 | 137 | do |
138 | 138 | { |
139 | - $orderItems = $orderManager->searchItems( $orderSearch ); |
|
139 | + $orderItems = $orderManager->searchItems($orderSearch); |
|
140 | 140 | |
141 | - foreach( $orderItems as $orderItem ) |
|
141 | + foreach ($orderItems as $orderItem) |
|
142 | 142 | { |
143 | 143 | try |
144 | 144 | { |
145 | - $serviceProvider->capture( $orderItem ); |
|
145 | + $serviceProvider->capture($orderItem); |
|
146 | 146 | } |
147 | - catch( \Exception $e ) |
|
147 | + catch (\Exception $e) |
|
148 | 148 | { |
149 | 149 | $str = 'Error while capturing payment for order with ID "%1$s": %2$s'; |
150 | - $context->getLogger()->log( sprintf( $str, $orderItem->getId(), $e->getMessage() ) ); |
|
150 | + $context->getLogger()->log(sprintf($str, $orderItem->getId(), $e->getMessage())); |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
154 | - $orderCount = count( $orderItems ); |
|
154 | + $orderCount = count($orderItems); |
|
155 | 155 | $orderStart += $orderCount; |
156 | - $orderSearch->setSlice( $orderStart ); |
|
156 | + $orderSearch->setSlice($orderStart); |
|
157 | 157 | } |
158 | - while( $orderCount >= $orderSearch->getSliceSize() ); |
|
158 | + while ($orderCount >= $orderSearch->getSliceSize()); |
|
159 | 159 | } |
160 | - catch( \Exception $e ) |
|
160 | + catch (\Exception $e) |
|
161 | 161 | { |
162 | 162 | $str = 'Error while capturing payments for service with ID "%1$s": %2$s'; |
163 | - $context->getLogger()->log( sprintf( $str, $serviceItem->getId(), $e->getMessage() ) ); |
|
163 | + $context->getLogger()->log(sprintf($str, $serviceItem->getId(), $e->getMessage())); |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | |
167 | - $count = count( $serviceItems ); |
|
167 | + $count = count($serviceItems); |
|
168 | 168 | $start += $count; |
169 | - $serviceSearch->setSlice( $start ); |
|
169 | + $serviceSearch->setSlice($start); |
|
170 | 170 | } |
171 | - while( $count >= $serviceSearch->getSliceSize() ); |
|
171 | + while ($count >= $serviceSearch->getSliceSize()); |
|
172 | 172 | } |
173 | 173 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function getName() |
30 | 30 | { |
31 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Order export CSV' ); |
|
31 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Order export CSV'); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function getDescription() |
41 | 41 | { |
42 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Exports orders to CSV file' ); |
|
42 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Exports orders to CSV file'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @category Developer |
74 | 74 | * @see controller/common/order/export/csv/max-size |
75 | 75 | */ |
76 | - $mappings = $config->get( 'controller/common/order/export/csv/mapping', $mappings ); |
|
76 | + $mappings = $config->get('controller/common/order/export/csv/mapping', $mappings); |
|
77 | 77 | |
78 | 78 | /** controller/jobs/order/export/csv/mapping |
79 | 79 | * List of mappings between the position in the CSV file and item keys |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @category Developer |
89 | 89 | * @see controller/common/order/export/csv/max-size |
90 | 90 | */ |
91 | - $mappings = $config->get( 'controller/jobs/order/export/csv/mapping', $mappings ); |
|
91 | + $mappings = $config->get('controller/jobs/order/export/csv/mapping', $mappings); |
|
92 | 92 | |
93 | 93 | |
94 | 94 | /** controller/common/order/export/csv/max-size |
@@ -106,29 +106,29 @@ discard block |
||
106 | 106 | * @category Developer |
107 | 107 | * @see controller/common/order/export/csv/mapping |
108 | 108 | */ |
109 | - $maxcnt = (int) $config->get( 'controller/common/order/export/csv/max-size', 1000 ); |
|
109 | + $maxcnt = (int) $config->get('controller/common/order/export/csv/max-size', 1000); |
|
110 | 110 | |
111 | 111 | |
112 | - $processors = $this->getProcessors( $mappings ); |
|
113 | - $mq = $context->getMessageQueueManager()->get( 'mq-admin' )->getQueue( 'order-export' ); |
|
112 | + $processors = $this->getProcessors($mappings); |
|
113 | + $mq = $context->getMessageQueueManager()->get('mq-admin')->getQueue('order-export'); |
|
114 | 114 | |
115 | - while( ( $msg = $mq->get() ) !== null ) |
|
115 | + while (($msg = $mq->get()) !== null) |
|
116 | 116 | { |
117 | 117 | try |
118 | 118 | { |
119 | - if( ( $data = json_decode( $msg->getBody(), true ) ) === null ) { |
|
120 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid message: %1$s', $msg->getBody() ) ); |
|
119 | + if (($data = json_decode($msg->getBody(), true)) === null) { |
|
120 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid message: %1$s', $msg->getBody())); |
|
121 | 121 | } |
122 | 122 | |
123 | - $this->export( $processors, $data, $maxcnt ); |
|
123 | + $this->export($processors, $data, $maxcnt); |
|
124 | 124 | } |
125 | - catch( \Exception $e ) |
|
125 | + catch (\Exception $e) |
|
126 | 126 | { |
127 | - $logger->log( 'Order export error: ' . $e->getMessage() ); |
|
128 | - $logger->log( $e->getTraceAsString() ); |
|
127 | + $logger->log('Order export error: ' . $e->getMessage()); |
|
128 | + $logger->log($e->getTraceAsString()); |
|
129 | 129 | } |
130 | 130 | |
131 | - $mq->del( $msg ); |
|
131 | + $mq->del($msg); |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | |
@@ -139,15 +139,15 @@ discard block |
||
139 | 139 | * @param \Aimeos\MShop\Context\Item\Iface $context Context item |
140 | 140 | * @param string $path Absolute path to the exported file |
141 | 141 | */ |
142 | - protected function addJob( $context, $path ) |
|
142 | + protected function addJob($context, $path) |
|
143 | 143 | { |
144 | - $manager = \Aimeos\MAdmin::create( $context, 'job' ); |
|
144 | + $manager = \Aimeos\MAdmin::create($context, 'job'); |
|
145 | 145 | |
146 | 146 | $item = $manager->createItem(); |
147 | - $item->setResult( ['file' => $path] ); |
|
148 | - $item->setLabel( $path ); |
|
147 | + $item->setResult(['file' => $path]); |
|
148 | + $item->setLabel($path); |
|
149 | 149 | |
150 | - $manager->saveItem( $item, false ); |
|
150 | + $manager->saveItem($item, false); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | * @see controller/jobs/order/export/csv/container/content |
178 | 178 | * @see controller/jobs/order/export/csv/container/options |
179 | 179 | */ |
180 | - $location = $config->get( 'controller/jobs/order/export/csv/location', sys_get_temp_dir() ); |
|
180 | + $location = $config->get('controller/jobs/order/export/csv/location', sys_get_temp_dir()); |
|
181 | 181 | |
182 | 182 | /** controller/jobs/order/export/csv/container/type |
183 | 183 | * Nave of the container type to read the data from |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * @see controller/jobs/order/export/csv/container/content |
201 | 201 | * @see controller/jobs/order/export/csv/container/options |
202 | 202 | */ |
203 | - $container = $config->get( 'controller/jobs/order/export/csv/container/type', 'Directory' ); |
|
203 | + $container = $config->get('controller/jobs/order/export/csv/container/type', 'Directory'); |
|
204 | 204 | |
205 | 205 | /** controller/jobs/order/export/csv/container/content |
206 | 206 | * Name of the content type inside the container to read the data from |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * @see controller/jobs/order/export/csv/container/type |
222 | 222 | * @see controller/jobs/order/export/csv/container/options |
223 | 223 | */ |
224 | - $content = $config->get( 'controller/jobs/order/export/csv/container/content', 'CSV' ); |
|
224 | + $content = $config->get('controller/jobs/order/export/csv/container/content', 'CSV'); |
|
225 | 225 | |
226 | 226 | /** controller/jobs/order/export/csv/container/options |
227 | 227 | * List of file container options for the order export files |
@@ -239,9 +239,9 @@ discard block |
||
239 | 239 | * @see controller/jobs/order/export/csv/container/content |
240 | 240 | * @see controller/jobs/order/export/csv/container/type |
241 | 241 | */ |
242 | - $options = $config->get( 'controller/jobs/order/export/csv/container/options', [] ); |
|
242 | + $options = $config->get('controller/jobs/order/export/csv/container/options', []); |
|
243 | 243 | |
244 | - return \Aimeos\MW\Container\Factory::getContainer( $location, $container, $content, $options ); |
|
244 | + return \Aimeos\MW\Container\Factory::getContainer($location, $container, $content, $options); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | |
@@ -253,56 +253,56 @@ discard block |
||
253 | 253 | * @param integer $maxcnt Maximum number of retrieved orders at once |
254 | 254 | * @return string Path of the file containing the exported data |
255 | 255 | */ |
256 | - protected function export( array $processors, $msg, $maxcnt ) |
|
256 | + protected function export(array $processors, $msg, $maxcnt) |
|
257 | 257 | { |
258 | - $lcontext = $this->getLocaleContext( $msg ); |
|
258 | + $lcontext = $this->getLocaleContext($msg); |
|
259 | 259 | $baseRef = ['order/base/address', 'order/base/coupon', 'order/base/product', 'order/base/service']; |
260 | 260 | |
261 | - $manager = \Aimeos\MShop::create( $lcontext, 'order' ); |
|
262 | - $baseManager = \Aimeos\MShop::create( $lcontext, 'order/base' ); |
|
261 | + $manager = \Aimeos\MShop::create($lcontext, 'order'); |
|
262 | + $baseManager = \Aimeos\MShop::create($lcontext, 'order/base'); |
|
263 | 263 | |
264 | 264 | $container = $this->getContainer(); |
265 | - $content = $container->create( 'order-export_' . date( 'Y-m-d_H-i-s' ) ); |
|
266 | - $search = $this->initCriteria( $manager->createSearch()->setSlice( 0, 0x7fffffff ), $msg ); |
|
265 | + $content = $container->create('order-export_' . date('Y-m-d_H-i-s')); |
|
266 | + $search = $this->initCriteria($manager->createSearch()->setSlice(0, 0x7fffffff), $msg); |
|
267 | 267 | $start = 0; |
268 | 268 | |
269 | 269 | do |
270 | 270 | { |
271 | 271 | $baseIds = []; |
272 | - $search->setSlice( $start, $maxcnt ); |
|
273 | - $items = $manager->searchItems( $search ); |
|
272 | + $search->setSlice($start, $maxcnt); |
|
273 | + $items = $manager->searchItems($search); |
|
274 | 274 | |
275 | - foreach( $items as $item ) { |
|
275 | + foreach ($items as $item) { |
|
276 | 276 | $baseIds[] = $item->getBaseId(); |
277 | 277 | } |
278 | 278 | |
279 | 279 | $baseSearch = $baseManager->createSearch(); |
280 | - $baseSearch->setConditions( $baseSearch->compare( '==', 'order.base.id', $baseIds ) ); |
|
281 | - $baseSearch->setSlice( 0, count( $baseIds ) ); |
|
280 | + $baseSearch->setConditions($baseSearch->compare('==', 'order.base.id', $baseIds)); |
|
281 | + $baseSearch->setSlice(0, count($baseIds)); |
|
282 | 282 | |
283 | - $baseItems = $baseManager->searchItems( $baseSearch, $baseRef ); |
|
283 | + $baseItems = $baseManager->searchItems($baseSearch, $baseRef); |
|
284 | 284 | |
285 | - foreach( $items as $id => $item ) |
|
285 | + foreach ($items as $id => $item) |
|
286 | 286 | { |
287 | - foreach( $processors as $type => $processor ) |
|
287 | + foreach ($processors as $type => $processor) |
|
288 | 288 | { |
289 | - foreach( $processor->process( $item, $baseItems[$item->getBaseId()] ) as $line ) { |
|
290 | - $content->add( [0 => $type, 1 => $id] + $line ); |
|
289 | + foreach ($processor->process($item, $baseItems[$item->getBaseId()]) as $line) { |
|
290 | + $content->add([0 => $type, 1 => $id] + $line); |
|
291 | 291 | } |
292 | 292 | } |
293 | 293 | } |
294 | 294 | |
295 | - $count = count( $items ); |
|
295 | + $count = count($items); |
|
296 | 296 | $start += $count; |
297 | 297 | } |
298 | - while( $count === $search->getSliceSize() ); |
|
298 | + while ($count === $search->getSliceSize()); |
|
299 | 299 | |
300 | 300 | $path = $content->getResource(); |
301 | - $container->add( $content ); |
|
301 | + $container->add($content); |
|
302 | 302 | $container->close(); |
303 | 303 | |
304 | - $path = $this->moveFile( $lcontext, $path ); |
|
305 | - $this->addJob( $lcontext, $path ); |
|
304 | + $path = $this->moveFile($lcontext, $path); |
|
305 | + $this->addJob($lcontext, $path); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | |
@@ -312,15 +312,15 @@ discard block |
||
312 | 312 | * @param array $msg Message data including a "sitecode" value |
313 | 313 | * @return \Aimeos\MShop\Context\Item\Iface New context item with updated locale |
314 | 314 | */ |
315 | - protected function getLocaleContext( array $msg ) |
|
315 | + protected function getLocaleContext(array $msg) |
|
316 | 316 | { |
317 | 317 | $lcontext = clone $this->getContext(); |
318 | - $manager = \Aimeos\MShop::create( $lcontext, 'locale' ); |
|
318 | + $manager = \Aimeos\MShop::create($lcontext, 'locale'); |
|
319 | 319 | |
320 | - $sitecode = ( isset( $msg['sitecode'] ) ? $msg['sitecode'] : 'default' ); |
|
321 | - $localeItem = $manager->bootstrap( $sitecode, '', '', false, \Aimeos\MShop\Locale\Manager\Base::SITE_PATH ); |
|
320 | + $sitecode = (isset($msg['sitecode']) ? $msg['sitecode'] : 'default'); |
|
321 | + $localeItem = $manager->bootstrap($sitecode, '', '', false, \Aimeos\MShop\Locale\Manager\Base::SITE_PATH); |
|
322 | 322 | |
323 | - return $lcontext->setLocale( $localeItem ); |
|
323 | + return $lcontext->setLocale($localeItem); |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | |
@@ -331,14 +331,14 @@ discard block |
||
331 | 331 | * @param array $msg Message data |
332 | 332 | * @return \Aimeos\MW\Criteria\Iface Initialized criteria object |
333 | 333 | */ |
334 | - protected function initCriteria( \Aimeos\MW\Criteria\Iface $criteria, array $msg ) |
|
334 | + protected function initCriteria(\Aimeos\MW\Criteria\Iface $criteria, array $msg) |
|
335 | 335 | { |
336 | - if( isset( $msg['filter'] ) ) { |
|
337 | - $criteria->setConditions( $criteria->toConditions( $msg['filter'] ) ); |
|
336 | + if (isset($msg['filter'])) { |
|
337 | + $criteria->setConditions($criteria->toConditions($msg['filter'])); |
|
338 | 338 | } |
339 | 339 | |
340 | - if( isset( $msg['sort'] ) ) { |
|
341 | - $criteria->setSortations( $criteria->toSortations( $msg['sort'] ) ); |
|
340 | + if (isset($msg['sort'])) { |
|
341 | + $criteria->setSortations($criteria->toSortations($msg['sort'])); |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | return $criteria; |
@@ -352,12 +352,12 @@ discard block |
||
352 | 352 | * @param string $path Absolute path to the exported file |
353 | 353 | * @return string Relative path of the file in the storage |
354 | 354 | */ |
355 | - protected function moveFile( $context, $path ) |
|
355 | + protected function moveFile($context, $path) |
|
356 | 356 | { |
357 | - $filename = basename( $path ); |
|
358 | - $context->getFileSystemManager()->get( 'fs-admin' )->writef( $filename, $path ); |
|
357 | + $filename = basename($path); |
|
358 | + $context->getFileSystemManager()->get('fs-admin')->writef($filename, $path); |
|
359 | 359 | |
360 | - unlink( $path ); |
|
360 | + unlink($path); |
|
361 | 361 | return $filename; |
362 | 362 | } |
363 | 363 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function getName() |
31 | 31 | { |
32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Cache cleanup' ); |
|
32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Cache cleanup'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function getDescription() |
42 | 42 | { |
43 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Removes the expired entries from the cache' ); |
|
43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Removes the expired entries from the cache'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -51,6 +51,6 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function run() |
53 | 53 | { |
54 | - \Aimeos\MAdmin\Cache\Manager\Factory::create( $this->getContext() )->getCache()->cleanup(); |
|
54 | + \Aimeos\MAdmin\Cache\Manager\Factory::create($this->getContext())->getCache()->cleanup(); |
|
55 | 55 | } |
56 | 56 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function getName() |
31 | 31 | { |
32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Log cleanup' ); |
|
32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Log cleanup'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function getDescription() |
42 | 42 | { |
43 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Removes the old log entries from the database and archives them (optional)' ); |
|
43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Removes the old log entries from the database and archives them (optional)'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | * @see controller/jobs/admin/log/standard/container/format |
72 | 72 | * @see controller/jobs/admin/log/standard/container/options |
73 | 73 | */ |
74 | - $limit = $config->get( 'controller/jobs/admin/log/standard/limit-days', 30 ); |
|
75 | - $limitDate = date( 'Y-m-d H:i:s', time() - $limit * 86400 ); |
|
74 | + $limit = $config->get('controller/jobs/admin/log/standard/limit-days', 30); |
|
75 | + $limitDate = date('Y-m-d H:i:s', time() - $limit * 86400); |
|
76 | 76 | |
77 | 77 | /** controller/jobs/admin/log/standard/path |
78 | 78 | * Path to a writable directory where the log archive files should be stored |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @see controller/jobs/admin/log/standard/container/options |
102 | 102 | * @see controller/jobs/admin/log/standard/limit-days |
103 | 103 | */ |
104 | - if( ( $path = $config->get( 'controller/jobs/admin/log/standard/path', null ) ) !== null ) |
|
104 | + if (($path = $config->get('controller/jobs/admin/log/standard/path', null)) !== null) |
|
105 | 105 | { |
106 | 106 | /** controller/jobs/admin/log/standard/container/type |
107 | 107 | * Container file type storing all coupon code files to import |
@@ -175,19 +175,19 @@ discard block |
||
175 | 175 | * @see controller/jobs/admin/log/standard/limit-days |
176 | 176 | */ |
177 | 177 | |
178 | - $type = $config->get( 'controller/jobs/admin/log/standard/container/type', 'Zip' ); |
|
179 | - $format = $config->get( 'controller/jobs/admin/log/standard/container/format', 'CSV' ); |
|
180 | - $options = $config->get( 'controller/jobs/admin/log/standard/container/options', [] ); |
|
178 | + $type = $config->get('controller/jobs/admin/log/standard/container/type', 'Zip'); |
|
179 | + $format = $config->get('controller/jobs/admin/log/standard/container/format', 'CSV'); |
|
180 | + $options = $config->get('controller/jobs/admin/log/standard/container/options', []); |
|
181 | 181 | |
182 | - $path .= DIRECTORY_SEPARATOR . str_replace( ' ', '_', $limitDate ); |
|
183 | - $container = \Aimeos\MW\Container\Factory::getContainer( $path, $type, $format, $options ); |
|
182 | + $path .= DIRECTORY_SEPARATOR . str_replace(' ', '_', $limitDate); |
|
183 | + $container = \Aimeos\MW\Container\Factory::getContainer($path, $type, $format, $options); |
|
184 | 184 | } |
185 | 185 | |
186 | - $manager = \Aimeos\MAdmin::create( $context, 'log' ); |
|
186 | + $manager = \Aimeos\MAdmin::create($context, 'log'); |
|
187 | 187 | |
188 | 188 | $search = $manager->createSearch(); |
189 | - $search->setConditions( $search->compare( '<=', 'log.timestamp', $limitDate ) ); |
|
190 | - $search->setSortations( array( $search->sort( '+', 'log.timestamp' ) ) ); |
|
189 | + $search->setConditions($search->compare('<=', 'log.timestamp', $limitDate)); |
|
190 | + $search->setSortations(array($search->sort('+', 'log.timestamp'))); |
|
191 | 191 | |
192 | 192 | $start = 0; |
193 | 193 | $contents = []; |
@@ -195,37 +195,37 @@ discard block |
||
195 | 195 | do |
196 | 196 | { |
197 | 197 | $ids = []; |
198 | - $items = $manager->searchItems( $search ); |
|
198 | + $items = $manager->searchItems($search); |
|
199 | 199 | |
200 | - foreach( $items as $id => $item ) |
|
200 | + foreach ($items as $id => $item) |
|
201 | 201 | { |
202 | - if( $container !== null ) |
|
202 | + if ($container !== null) |
|
203 | 203 | { |
204 | 204 | $facility = $item->getFacility(); |
205 | 205 | |
206 | - if( !isset( $contents[$facility] ) ) { |
|
207 | - $contents[$facility] = $container->create( $facility ); |
|
206 | + if (!isset($contents[$facility])) { |
|
207 | + $contents[$facility] = $container->create($facility); |
|
208 | 208 | } |
209 | 209 | |
210 | - $contents[$facility]->add( $item->toArray() ); |
|
210 | + $contents[$facility]->add($item->toArray()); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | $ids[] = $id; |
214 | 214 | } |
215 | 215 | |
216 | - $manager->deleteItems( $ids ); |
|
216 | + $manager->deleteItems($ids); |
|
217 | 217 | |
218 | - $count = count( $items ); |
|
218 | + $count = count($items); |
|
219 | 219 | $start += $count; |
220 | - $search->setSlice( $start ); |
|
220 | + $search->setSlice($start); |
|
221 | 221 | } |
222 | - while( $count >= $search->getSliceSize() ); |
|
222 | + while ($count >= $search->getSliceSize()); |
|
223 | 223 | |
224 | 224 | |
225 | - if( $container !== null && !empty( $contents ) ) |
|
225 | + if ($container !== null && !empty($contents)) |
|
226 | 226 | { |
227 | - foreach( $contents as $content ) { |
|
228 | - $container->add( $content ); |
|
227 | + foreach ($contents as $content) { |
|
228 | + $container->add($content); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | $container->close(); |