@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @param string|null $name Name of the controller or "Standard" if null |
| 31 | 31 | * @return \Aimeos\Controller\Jobs\Iface New controller object |
| 32 | 32 | */ |
| 33 | - public static function createController( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null ) |
|
| 33 | + public static function createController(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null) |
|
| 34 | 34 | { |
| 35 | 35 | /** controller/jobs/order/email/payment/name |
| 36 | 36 | * Class name of the used order email payment scheduler controller implementation |
@@ -65,20 +65,20 @@ discard block |
||
| 65 | 65 | * @since 2014.03 |
| 66 | 66 | * @category Developer |
| 67 | 67 | */ |
| 68 | - if( $name === null ) { |
|
| 69 | - $name = $context->getConfig()->get( 'controller/jobs/order/email/payment/name', 'Standard' ); |
|
| 68 | + if ($name === null) { |
|
| 69 | + $name = $context->getConfig()->get('controller/jobs/order/email/payment/name', 'Standard'); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - if( ctype_alnum( $name ) === false ) |
|
| 72 | + if (ctype_alnum($name) === false) |
|
| 73 | 73 | { |
| 74 | - $classname = is_string( $name ) ? '\\Aimeos\\Controller\\Jobs\\Order\\Email\\Payment\\' . $name : '<not a string>'; |
|
| 75 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 74 | + $classname = is_string($name) ? '\\Aimeos\\Controller\\Jobs\\Order\\Email\\Payment\\'.$name : '<not a string>'; |
|
| 75 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | $iface = '\\Aimeos\\Controller\\Jobs\\Iface'; |
| 79 | - $classname = '\\Aimeos\\Controller\\Jobs\\Order\\Email\\Payment\\' . $name; |
|
| 79 | + $classname = '\\Aimeos\\Controller\\Jobs\\Order\\Email\\Payment\\'.$name; |
|
| 80 | 80 | |
| 81 | - $controller = self::createControllerBase( $context, $aimeos, $classname, $iface ); |
|
| 81 | + $controller = self::createControllerBase($context, $aimeos, $classname, $iface); |
|
| 82 | 82 | |
| 83 | 83 | /** controller/jobs/order/email/payment/decorators/excludes |
| 84 | 84 | * Excludes decorators added by the "common" option from the order email payment controllers |
@@ -154,6 +154,6 @@ discard block |
||
| 154 | 154 | * @see controller/jobs/order/email/payment/decorators/excludes |
| 155 | 155 | * @see controller/jobs/order/email/payment/decorators/global |
| 156 | 156 | */ |
| 157 | - return self::addControllerDecorators( $context, $aimeos, $controller, 'order/email/payment' ); |
|
| 157 | + return self::addControllerDecorators($context, $aimeos, $controller, 'order/email/payment'); |
|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | \ No newline at end of file |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public function getName() |
| 31 | 31 | { |
| 32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Order payment related e-mails' ); |
|
| 32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Order payment related e-mails'); |
|
| 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 order confirmation or payment status update e-mails' ); |
|
| 43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Sends order confirmation or payment status update e-mails'); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | |
@@ -57,16 +57,16 @@ discard block |
||
| 57 | 57 | $mailer = $context->getMail(); |
| 58 | 58 | $view = $context->getView(); |
| 59 | 59 | |
| 60 | - $templatePaths = $aimeos->getCustomPaths( 'client/html/templates' ); |
|
| 60 | + $templatePaths = $aimeos->getCustomPaths('client/html/templates'); |
|
| 61 | 61 | |
| 62 | - $helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config ); |
|
| 63 | - $view->addHelper( 'config', $helper ); |
|
| 62 | + $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); |
|
| 63 | + $view->addHelper('config', $helper); |
|
| 64 | 64 | |
| 65 | - $client = \Aimeos\Client\Html\Email\Payment\Factory::createClient( $context, $templatePaths ); |
|
| 65 | + $client = \Aimeos\Client\Html\Email\Payment\Factory::createClient($context, $templatePaths); |
|
| 66 | 66 | |
| 67 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( $context ); |
|
| 68 | - $orderStatusManager = $orderManager->getSubManager( 'status' ); |
|
| 69 | - $orderBaseManager = $orderManager->getSubManager( 'base' ); |
|
| 67 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager($context); |
|
| 68 | + $orderStatusManager = $orderManager->getSubManager('status'); |
|
| 69 | + $orderBaseManager = $orderManager->getSubManager('base'); |
|
| 70 | 70 | |
| 71 | 71 | /** controller/jobs/order/email/payment/standard/limit-days |
| 72 | 72 | * Only send payment e-mails of orders that were created in the past within the configured number of days |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | * @see controller/jobs/order/email/delivery/standard/limit-days |
| 84 | 84 | * @see controller/jobs/service/delivery/process/limit-days |
| 85 | 85 | */ |
| 86 | - $limit = $config->get( 'controller/jobs/order/email/payment/standard/limit-days', 30 ); |
|
| 87 | - $limitDate = date( 'Y-m-d H:i:s', time() - $limit * 86400 ); |
|
| 86 | + $limit = $config->get('controller/jobs/order/email/payment/standard/limit-days', 30); |
|
| 87 | + $limitDate = date('Y-m-d H:i:s', time() - $limit * 86400); |
|
| 88 | 88 | |
| 89 | 89 | $default = array( |
| 90 | 90 | \Aimeos\MShop\Order\Item\Base::PAY_REFUND, |
@@ -116,71 +116,71 @@ discard block |
||
| 116 | 116 | * @see controller/jobs/order/email/delivery/standard/status |
| 117 | 117 | * @see controller/jobs/order/email/payment/standard/limit-days |
| 118 | 118 | */ |
| 119 | - foreach( (array) $config->get( 'controller/jobs/order/email/payment/standard/status', $default ) as $status ) |
|
| 119 | + foreach ((array) $config->get('controller/jobs/order/email/payment/standard/status', $default) as $status) |
|
| 120 | 120 | { |
| 121 | 121 | $orderSearch = $orderManager->createSearch(); |
| 122 | 122 | |
| 123 | - $param = array( \Aimeos\MShop\Order\Item\Status\Base::EMAIL_PAYMENT, $status ); |
|
| 124 | - $orderFunc = $orderSearch->createFunction( 'order.containsStatus', $param ); |
|
| 123 | + $param = array(\Aimeos\MShop\Order\Item\Status\Base::EMAIL_PAYMENT, $status); |
|
| 124 | + $orderFunc = $orderSearch->createFunction('order.containsStatus', $param); |
|
| 125 | 125 | |
| 126 | 126 | $expr = array( |
| 127 | - $orderSearch->compare( '>=', 'order.mtime', $limitDate ), |
|
| 128 | - $orderSearch->compare( '==', 'order.statuspayment', $status ), |
|
| 129 | - $orderSearch->compare( '==', $orderFunc, 0 ), |
|
| 127 | + $orderSearch->compare('>=', 'order.mtime', $limitDate), |
|
| 128 | + $orderSearch->compare('==', 'order.statuspayment', $status), |
|
| 129 | + $orderSearch->compare('==', $orderFunc, 0), |
|
| 130 | 130 | ); |
| 131 | - $orderSearch->setConditions( $orderSearch->combine( '&&', $expr ) ); |
|
| 131 | + $orderSearch->setConditions($orderSearch->combine('&&', $expr)); |
|
| 132 | 132 | |
| 133 | 133 | $start = 0; |
| 134 | 134 | |
| 135 | 135 | do |
| 136 | 136 | { |
| 137 | - $items = $orderManager->searchItems( $orderSearch ); |
|
| 137 | + $items = $orderManager->searchItems($orderSearch); |
|
| 138 | 138 | |
| 139 | - foreach( $items as $id => $item ) |
|
| 139 | + foreach ($items as $id => $item) |
|
| 140 | 140 | { |
| 141 | 141 | try |
| 142 | 142 | { |
| 143 | - $orderBaseItem = $orderBaseManager->load( $item->getBaseId() ); |
|
| 143 | + $orderBaseItem = $orderBaseManager->load($item->getBaseId()); |
|
| 144 | 144 | |
| 145 | - $addr = $orderBaseItem->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT ); |
|
| 145 | + $addr = $orderBaseItem->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT); |
|
| 146 | 146 | |
| 147 | 147 | $view->extAddressItem = $addr; |
| 148 | 148 | $view->extOrderBaseItem = $orderBaseItem; |
| 149 | 149 | $view->extOrderItem = $item; |
| 150 | 150 | |
| 151 | - $helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $context->getI18n( $addr->getLanguageId() ) ); |
|
| 152 | - $view->addHelper( 'translate', $helper ); |
|
| 151 | + $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $context->getI18n($addr->getLanguageId())); |
|
| 152 | + $view->addHelper('translate', $helper); |
|
| 153 | 153 | |
| 154 | 154 | $message = $mailer->createMessage(); |
| 155 | - $helper = new \Aimeos\MW\View\Helper\Mail\Standard( $view, $message ); |
|
| 156 | - $view->addHelper( 'mail', $helper ); |
|
| 155 | + $helper = new \Aimeos\MW\View\Helper\Mail\Standard($view, $message); |
|
| 156 | + $view->addHelper('mail', $helper); |
|
| 157 | 157 | |
| 158 | - $client->setView( $view ); |
|
| 158 | + $client->setView($view); |
|
| 159 | 159 | $client->getHeader(); |
| 160 | 160 | $client->getBody(); |
| 161 | 161 | |
| 162 | - $mailer->send( $message ); |
|
| 162 | + $mailer->send($message); |
|
| 163 | 163 | |
| 164 | 164 | $statusItem = $orderStatusManager->createItem(); |
| 165 | - $statusItem->setParentId( $id ); |
|
| 166 | - $statusItem->setType( \Aimeos\MShop\Order\Item\Status\Base::EMAIL_PAYMENT ); |
|
| 167 | - $statusItem->setValue( $status ); |
|
| 165 | + $statusItem->setParentId($id); |
|
| 166 | + $statusItem->setType(\Aimeos\MShop\Order\Item\Status\Base::EMAIL_PAYMENT); |
|
| 167 | + $statusItem->setValue($status); |
|
| 168 | 168 | |
| 169 | - $orderStatusManager->saveItem( $statusItem ); |
|
| 169 | + $orderStatusManager->saveItem($statusItem); |
|
| 170 | 170 | } |
| 171 | - catch( \Exception $e ) |
|
| 171 | + catch (\Exception $e) |
|
| 172 | 172 | { |
| 173 | 173 | $str = 'Error while trying to send payment e-mail for order ID "%1$s" and status "%2$s": %3$s'; |
| 174 | - $msg = sprintf( $str, $item->getId(), $item->getPaymentStatus(), $e->getMessage() ); |
|
| 175 | - $context->getLogger()->log( $msg ); |
|
| 174 | + $msg = sprintf($str, $item->getId(), $item->getPaymentStatus(), $e->getMessage()); |
|
| 175 | + $context->getLogger()->log($msg); |
|
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - $count = count( $items ); |
|
| 179 | + $count = count($items); |
|
| 180 | 180 | $start += $count; |
| 181 | - $orderSearch->setSlice( $start ); |
|
| 181 | + $orderSearch->setSlice($start); |
|
| 182 | 182 | } |
| 183 | - while( $count >= $orderSearch->getSliceSize() ); |
|
| 183 | + while ($count >= $orderSearch->getSliceSize()); |
|
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @param string|null $name Name of the controller or "Standard" if null |
| 31 | 31 | * @return \Aimeos\Controller\Jobs\Iface New controller object |
| 32 | 32 | */ |
| 33 | - public static function createController( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null ) |
|
| 33 | + public static function createController(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null) |
|
| 34 | 34 | { |
| 35 | 35 | /** controller/jobs/order/email/delivery/name |
| 36 | 36 | * Class name of the used order email delivery scheduler controller implementation |
@@ -65,20 +65,20 @@ discard block |
||
| 65 | 65 | * @since 2014.03 |
| 66 | 66 | * @category Developer |
| 67 | 67 | */ |
| 68 | - if( $name === null ) { |
|
| 69 | - $name = $context->getConfig()->get( 'controller/jobs/order/email/delivery/name', 'Standard' ); |
|
| 68 | + if ($name === null) { |
|
| 69 | + $name = $context->getConfig()->get('controller/jobs/order/email/delivery/name', 'Standard'); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - if( ctype_alnum( $name ) === false ) |
|
| 72 | + if (ctype_alnum($name) === false) |
|
| 73 | 73 | { |
| 74 | - $classname = is_string( $name ) ? '\\Aimeos\\Controller\\Jobs\\Order\\Email\\Delivery\\' . $name : '<not a string>'; |
|
| 75 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 74 | + $classname = is_string($name) ? '\\Aimeos\\Controller\\Jobs\\Order\\Email\\Delivery\\'.$name : '<not a string>'; |
|
| 75 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | $iface = '\\Aimeos\\Controller\\Jobs\\Iface'; |
| 79 | - $classname = '\\Aimeos\\Controller\\Jobs\\Order\\Email\\Delivery\\' . $name; |
|
| 79 | + $classname = '\\Aimeos\\Controller\\Jobs\\Order\\Email\\Delivery\\'.$name; |
|
| 80 | 80 | |
| 81 | - $controller = self::createControllerBase( $context, $aimeos, $classname, $iface ); |
|
| 81 | + $controller = self::createControllerBase($context, $aimeos, $classname, $iface); |
|
| 82 | 82 | |
| 83 | 83 | /** controller/jobs/order/email/delivery/decorators/excludes |
| 84 | 84 | * Excludes decorators added by the "common" option from the order email delivery controllers |
@@ -154,6 +154,6 @@ discard block |
||
| 154 | 154 | * @see controller/jobs/order/email/delivery/decorators/excludes |
| 155 | 155 | * @see controller/jobs/order/email/delivery/decorators/global |
| 156 | 156 | */ |
| 157 | - return self::addControllerDecorators( $context, $aimeos, $controller, 'order/email/delivery' ); |
|
| 157 | + return self::addControllerDecorators($context, $aimeos, $controller, 'order/email/delivery'); |
|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | \ No newline at end of file |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public function getName() |
| 31 | 31 | { |
| 32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Order delivery related e-mails' ); |
|
| 32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Order delivery related e-mails'); |
|
| 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 order delivery status update e-mails' ); |
|
| 43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Sends order delivery status update e-mails'); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | |
@@ -57,16 +57,16 @@ discard block |
||
| 57 | 57 | $mailer = $context->getMail(); |
| 58 | 58 | $view = $context->getView(); |
| 59 | 59 | |
| 60 | - $templatePaths = $aimeos->getCustomPaths( 'client/html/templates' ); |
|
| 60 | + $templatePaths = $aimeos->getCustomPaths('client/html/templates'); |
|
| 61 | 61 | |
| 62 | - $helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config ); |
|
| 63 | - $view->addHelper( 'config', $helper ); |
|
| 62 | + $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); |
|
| 63 | + $view->addHelper('config', $helper); |
|
| 64 | 64 | |
| 65 | - $client = \Aimeos\Client\Html\Email\Delivery\Factory::createClient( $context, $templatePaths ); |
|
| 65 | + $client = \Aimeos\Client\Html\Email\Delivery\Factory::createClient($context, $templatePaths); |
|
| 66 | 66 | |
| 67 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( $context ); |
|
| 68 | - $orderStatusManager = $orderManager->getSubManager( 'status' ); |
|
| 69 | - $orderBaseManager = $orderManager->getSubManager( 'base' ); |
|
| 67 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager($context); |
|
| 68 | + $orderStatusManager = $orderManager->getSubManager('status'); |
|
| 69 | + $orderBaseManager = $orderManager->getSubManager('base'); |
|
| 70 | 70 | |
| 71 | 71 | /** controller/jobs/order/email/delivery/standard/limit-days |
| 72 | 72 | * Only send delivery e-mails of orders that were created in the past within the configured number of days |
@@ -84,8 +84,8 @@ discard block |
||
| 84 | 84 | * @see controller/jobs/order/email/payment/standard/limit-days |
| 85 | 85 | * @see controller/jobs/service/delivery/process/limit-days |
| 86 | 86 | */ |
| 87 | - $limit = $config->get( 'controller/jobs/order/email/delivery/standard/limit-days', 90 ); |
|
| 88 | - $limitDate = date( 'Y-m-d H:i:s', time() - $limit * 86400 ); |
|
| 87 | + $limit = $config->get('controller/jobs/order/email/delivery/standard/limit-days', 90); |
|
| 88 | + $limitDate = date('Y-m-d H:i:s', time() - $limit * 86400); |
|
| 89 | 89 | |
| 90 | 90 | $default = array( |
| 91 | 91 | \Aimeos\MShop\Order\Item\Base::STAT_PROGRESS, |
@@ -118,75 +118,75 @@ discard block |
||
| 118 | 118 | * @see controller/jobs/order/email/payment/standard/status |
| 119 | 119 | * @see controller/jobs/order/email/delivery/standard/limit-days |
| 120 | 120 | */ |
| 121 | - foreach( (array) $config->get( 'controller/jobs/order/email/delivery/standard/status', $default ) as $status ) |
|
| 121 | + foreach ((array) $config->get('controller/jobs/order/email/delivery/standard/status', $default) as $status) |
|
| 122 | 122 | { |
| 123 | 123 | $orderSearch = $orderManager->createSearch(); |
| 124 | 124 | |
| 125 | - $param = array( \Aimeos\MShop\Order\Item\Status\Base::EMAIL_DELIVERY, $status ); |
|
| 126 | - $orderFunc = $orderSearch->createFunction( 'order.containsStatus', $param ); |
|
| 125 | + $param = array(\Aimeos\MShop\Order\Item\Status\Base::EMAIL_DELIVERY, $status); |
|
| 126 | + $orderFunc = $orderSearch->createFunction('order.containsStatus', $param); |
|
| 127 | 127 | |
| 128 | 128 | $expr = array( |
| 129 | - $orderSearch->compare( '>=', 'order.mtime', $limitDate ), |
|
| 130 | - $orderSearch->compare( '==', 'order.statusdelivery', $status ), |
|
| 131 | - $orderSearch->compare( '==', $orderFunc, 0 ), |
|
| 129 | + $orderSearch->compare('>=', 'order.mtime', $limitDate), |
|
| 130 | + $orderSearch->compare('==', 'order.statusdelivery', $status), |
|
| 131 | + $orderSearch->compare('==', $orderFunc, 0), |
|
| 132 | 132 | ); |
| 133 | - $orderSearch->setConditions( $orderSearch->combine( '&&', $expr ) ); |
|
| 133 | + $orderSearch->setConditions($orderSearch->combine('&&', $expr)); |
|
| 134 | 134 | |
| 135 | 135 | $start = 0; |
| 136 | 136 | |
| 137 | 137 | do |
| 138 | 138 | { |
| 139 | - $items = $orderManager->searchItems( $orderSearch ); |
|
| 139 | + $items = $orderManager->searchItems($orderSearch); |
|
| 140 | 140 | |
| 141 | - foreach( $items as $id => $item ) |
|
| 141 | + foreach ($items as $id => $item) |
|
| 142 | 142 | { |
| 143 | 143 | try |
| 144 | 144 | { |
| 145 | - $orderBaseItem = $orderBaseManager->load( $item->getBaseId() ); |
|
| 145 | + $orderBaseItem = $orderBaseManager->load($item->getBaseId()); |
|
| 146 | 146 | |
| 147 | 147 | try { |
| 148 | - $addr = $orderBaseItem->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY ); |
|
| 149 | - } catch( \Exception $e ) { |
|
| 150 | - $addr = $orderBaseItem->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT ); |
|
| 148 | + $addr = $orderBaseItem->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY); |
|
| 149 | + } catch (\Exception $e) { |
|
| 150 | + $addr = $orderBaseItem->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | $view->extAddressItem = $addr; |
| 154 | 154 | $view->extOrderBaseItem = $orderBaseItem; |
| 155 | 155 | $view->extOrderItem = $item; |
| 156 | 156 | |
| 157 | - $helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $context->getI18n( $addr->getLanguageId() ) ); |
|
| 158 | - $view->addHelper( 'translate', $helper ); |
|
| 157 | + $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $context->getI18n($addr->getLanguageId())); |
|
| 158 | + $view->addHelper('translate', $helper); |
|
| 159 | 159 | |
| 160 | 160 | $message = $mailer->createMessage(); |
| 161 | - $helper = new \Aimeos\MW\View\Helper\Mail\Standard( $view, $message ); |
|
| 162 | - $view->addHelper( 'mail', $helper ); |
|
| 161 | + $helper = new \Aimeos\MW\View\Helper\Mail\Standard($view, $message); |
|
| 162 | + $view->addHelper('mail', $helper); |
|
| 163 | 163 | |
| 164 | - $client->setView( $view ); |
|
| 164 | + $client->setView($view); |
|
| 165 | 165 | $client->getHeader(); |
| 166 | 166 | $client->getBody(); |
| 167 | 167 | |
| 168 | - $mailer->send( $message ); |
|
| 168 | + $mailer->send($message); |
|
| 169 | 169 | |
| 170 | 170 | $statusItem = $orderStatusManager->createItem(); |
| 171 | - $statusItem->setParentId( $id ); |
|
| 172 | - $statusItem->setType( \Aimeos\MShop\Order\Item\Status\Base::EMAIL_DELIVERY ); |
|
| 173 | - $statusItem->setValue( $status ); |
|
| 171 | + $statusItem->setParentId($id); |
|
| 172 | + $statusItem->setType(\Aimeos\MShop\Order\Item\Status\Base::EMAIL_DELIVERY); |
|
| 173 | + $statusItem->setValue($status); |
|
| 174 | 174 | |
| 175 | - $orderStatusManager->saveItem( $statusItem ); |
|
| 175 | + $orderStatusManager->saveItem($statusItem); |
|
| 176 | 176 | } |
| 177 | - catch( \Exception $e ) |
|
| 177 | + catch (\Exception $e) |
|
| 178 | 178 | { |
| 179 | 179 | $str = 'Error while trying to send delivery e-mail for order ID "%1$s" and status "%2$s": %3$s'; |
| 180 | - $msg = sprintf( $str, $item->getId(), $item->getDeliveryStatus(), $e->getMessage() ); |
|
| 181 | - $context->getLogger()->log( $msg ); |
|
| 180 | + $msg = sprintf($str, $item->getId(), $item->getDeliveryStatus(), $e->getMessage()); |
|
| 181 | + $context->getLogger()->log($msg); |
|
| 182 | 182 | } |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - $count = count( $items ); |
|
| 185 | + $count = count($items); |
|
| 186 | 186 | $start += $count; |
| 187 | - $orderSearch->setSlice( $start ); |
|
| 187 | + $orderSearch->setSlice($start); |
|
| 188 | 188 | } |
| 189 | - while( $count >= $orderSearch->getSliceSize() ); |
|
| 189 | + while ($count >= $orderSearch->getSliceSize()); |
|
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * @param string|null $name Name of the controller or "Standard" if null |
| 30 | 30 | * @return \Aimeos\Controller\Jobs\Iface New controller object |
| 31 | 31 | */ |
| 32 | - public static function createController( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null ) |
|
| 32 | + public static function createController(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null) |
|
| 33 | 33 | { |
| 34 | 34 | /** controller/jobs/customer/email/account/name |
| 35 | 35 | * Class name of the used product notification e-mail scheduler controller implementation |
@@ -64,20 +64,20 @@ discard block |
||
| 64 | 64 | * @since 2016.04 |
| 65 | 65 | * @category Developer |
| 66 | 66 | */ |
| 67 | - if( $name === null ) { |
|
| 68 | - $name = $context->getConfig()->get( 'controller/jobs/customer/email/account/name', 'Standard' ); |
|
| 67 | + if ($name === null) { |
|
| 68 | + $name = $context->getConfig()->get('controller/jobs/customer/email/account/name', 'Standard'); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if( ctype_alnum( $name ) === false ) |
|
| 71 | + if (ctype_alnum($name) === false) |
|
| 72 | 72 | { |
| 73 | - $classname = is_string( $name ) ? '\\Aimeos\\Controller\\Jobs\\Customer\\Email\\Account\\' . $name : '<not a string>'; |
|
| 74 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 73 | + $classname = is_string($name) ? '\\Aimeos\\Controller\\Jobs\\Customer\\Email\\Account\\'.$name : '<not a string>'; |
|
| 74 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $iface = '\\Aimeos\\Controller\\Jobs\\Iface'; |
| 78 | - $classname = '\\Aimeos\\Controller\\Jobs\\Customer\\Email\\Account\\' . $name; |
|
| 78 | + $classname = '\\Aimeos\\Controller\\Jobs\\Customer\\Email\\Account\\'.$name; |
|
| 79 | 79 | |
| 80 | - $controller = self::createControllerBase( $context, $aimeos, $classname, $iface ); |
|
| 80 | + $controller = self::createControllerBase($context, $aimeos, $classname, $iface); |
|
| 81 | 81 | |
| 82 | 82 | /** controller/jobs/customer/email/account/decorators/excludes |
| 83 | 83 | * Excludes decorators added by the "common" option from the customer email account controllers |
@@ -153,6 +153,6 @@ discard block |
||
| 153 | 153 | * @see controller/jobs/customer/email/account/decorators/excludes |
| 154 | 154 | * @see controller/jobs/customer/email/account/decorators/global |
| 155 | 155 | */ |
| 156 | - return self::addControllerDecorators( $context, $aimeos, $controller, 'customer/email/account' ); |
|
| 156 | + return self::addControllerDecorators($context, $aimeos, $controller, 'customer/email/account'); |
|
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | \ No newline at end of file |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | public function getName() |
| 33 | 33 | { |
| 34 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Customer account e-mails' ); |
|
| 34 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Customer account e-mails'); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | public function getDescription() |
| 44 | 44 | { |
| 45 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Sends e-mails for new customer accounts' ); |
|
| 45 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Sends e-mails for new customer accounts'); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | |
@@ -54,24 +54,24 @@ discard block |
||
| 54 | 54 | public function run() |
| 55 | 55 | { |
| 56 | 56 | $context = $this->getContext(); |
| 57 | - $queue = $context->getMessageQueue( 'mq-email', 'customer/email/account' ); |
|
| 58 | - $custManager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
| 57 | + $queue = $context->getMessageQueue('mq-email', 'customer/email/account'); |
|
| 58 | + $custManager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
| 59 | 59 | |
| 60 | - while( ( $msg = $queue->get() ) !== null ) |
|
| 60 | + while (($msg = $queue->get()) !== null) |
|
| 61 | 61 | { |
| 62 | - if( ( $list = json_decode( $msg->getBody(), true ) ) !== null ) |
|
| 62 | + if (($list = json_decode($msg->getBody(), true)) !== null) |
|
| 63 | 63 | { |
| 64 | 64 | $item = $custManager->createItem(); |
| 65 | - $item->fromArray( $list ); |
|
| 65 | + $item->fromArray($list); |
|
| 66 | 66 | |
| 67 | - $this->sendEmail( $context, $item ); |
|
| 67 | + $this->sendEmail($context, $item); |
|
| 68 | 68 | } |
| 69 | 69 | else |
| 70 | 70 | { |
| 71 | - $context->getLogger()->log( sprintf( 'Invalid JSON encode message: %1$s', $msg->getBody() ) ); |
|
| 71 | + $context->getLogger()->log(sprintf('Invalid JSON encode message: %1$s', $msg->getBody())); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - $queue->del( $msg ); |
|
| 74 | + $queue->del($msg); |
|
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | 77 | |
@@ -82,12 +82,12 @@ discard block |
||
| 82 | 82 | * @param \Aimeos\MShop\Context\Item\Iface $context Context item object |
| 83 | 83 | * @return \Aimeos\Client\Html\Iface Product notification e-mail client |
| 84 | 84 | */ |
| 85 | - protected function getClient( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 85 | + protected function getClient(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 86 | 86 | { |
| 87 | - if( !isset( $this->client ) ) |
|
| 87 | + if (!isset($this->client)) |
|
| 88 | 88 | { |
| 89 | - $templatePaths = $this->getAimeos()->getCustomPaths( 'client/html' ); |
|
| 90 | - $this->client = \Aimeos\Client\Html\Email\Account\Factory::createClient( $context, $templatePaths ); |
|
| 89 | + $templatePaths = $this->getAimeos()->getCustomPaths('client/html'); |
|
| 90 | + $this->client = \Aimeos\Client\Html\Email\Account\Factory::createClient($context, $templatePaths); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | return $this->client; |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * @param \Aimeos\MShop\Context\Item\Iface $context Context item object |
| 101 | 101 | * @param \Aimeos\MShop\Customer\Item\Iface $item Customer item object |
| 102 | 102 | */ |
| 103 | - protected function sendEmail( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $item ) |
|
| 103 | + protected function sendEmail(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $item) |
|
| 104 | 104 | { |
| 105 | 105 | $address = $item->getPaymentAddress(); |
| 106 | 106 | |
@@ -109,20 +109,20 @@ discard block |
||
| 109 | 109 | $view->extAccountCode = $item->getCode(); |
| 110 | 110 | $view->extAccountPassword = $item->getPassword(); |
| 111 | 111 | |
| 112 | - $helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $context->getI18n( $address->getLanguageId() ) ); |
|
| 113 | - $view->addHelper( 'translate', $helper ); |
|
| 112 | + $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $context->getI18n($address->getLanguageId())); |
|
| 113 | + $view->addHelper('translate', $helper); |
|
| 114 | 114 | |
| 115 | 115 | $mailer = $context->getMail(); |
| 116 | 116 | $message = $mailer->createMessage(); |
| 117 | 117 | |
| 118 | - $helper = new \Aimeos\MW\View\Helper\Mail\Standard( $view, $message ); |
|
| 119 | - $view->addHelper( 'mail', $helper ); |
|
| 118 | + $helper = new \Aimeos\MW\View\Helper\Mail\Standard($view, $message); |
|
| 119 | + $view->addHelper('mail', $helper); |
|
| 120 | 120 | |
| 121 | - $client = $this->getClient( $context ); |
|
| 122 | - $client->setView( $view ); |
|
| 121 | + $client = $this->getClient($context); |
|
| 122 | + $client->setView($view); |
|
| 123 | 123 | $client->getHeader(); |
| 124 | 124 | $client->getBody(); |
| 125 | 125 | |
| 126 | - $mailer->send( $message ); |
|
| 126 | + $mailer->send($message); |
|
| 127 | 127 | } |
| 128 | 128 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @param string|null $name Name of the controller or "Standard" if null |
| 31 | 31 | * @return \Aimeos\Controller\Jobs\Iface New controller object |
| 32 | 32 | */ |
| 33 | - public static function createController( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null ) |
|
| 33 | + public static function createController(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null) |
|
| 34 | 34 | { |
| 35 | 35 | /** controller/jobs/customer/email/watch/name |
| 36 | 36 | * Class name of the used product notification e-mail scheduler controller implementation |
@@ -65,20 +65,20 @@ discard block |
||
| 65 | 65 | * @since 2014.03 |
| 66 | 66 | * @category Developer |
| 67 | 67 | */ |
| 68 | - if( $name === null ) { |
|
| 69 | - $name = $context->getConfig()->get( 'controller/jobs/customer/email/watch/name', 'Standard' ); |
|
| 68 | + if ($name === null) { |
|
| 69 | + $name = $context->getConfig()->get('controller/jobs/customer/email/watch/name', 'Standard'); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - if( ctype_alnum( $name ) === false ) |
|
| 72 | + if (ctype_alnum($name) === false) |
|
| 73 | 73 | { |
| 74 | - $classname = is_string( $name ) ? '\\Aimeos\\Controller\\Jobs\\Customer\\Email\\Watch\\' . $name : '<not a string>'; |
|
| 75 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 74 | + $classname = is_string($name) ? '\\Aimeos\\Controller\\Jobs\\Customer\\Email\\Watch\\'.$name : '<not a string>'; |
|
| 75 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | $iface = '\\Aimeos\\Controller\\Jobs\\Iface'; |
| 79 | - $classname = '\\Aimeos\\Controller\\Jobs\\Customer\\Email\\Watch\\' . $name; |
|
| 79 | + $classname = '\\Aimeos\\Controller\\Jobs\\Customer\\Email\\Watch\\'.$name; |
|
| 80 | 80 | |
| 81 | - $controller = self::createControllerBase( $context, $aimeos, $classname, $iface ); |
|
| 81 | + $controller = self::createControllerBase($context, $aimeos, $classname, $iface); |
|
| 82 | 82 | |
| 83 | 83 | /** controller/jobs/customer/email/watch/decorators/excludes |
| 84 | 84 | * Excludes decorators added by the "common" option from the customer email watch controllers |
@@ -154,6 +154,6 @@ discard block |
||
| 154 | 154 | * @see controller/jobs/customer/email/watch/decorators/excludes |
| 155 | 155 | * @see controller/jobs/customer/email/watch/decorators/global |
| 156 | 156 | */ |
| 157 | - return self::addControllerDecorators( $context, $aimeos, $controller, 'customer/email/watch' ); |
|
| 157 | + return self::addControllerDecorators($context, $aimeos, $controller, 'customer/email/watch'); |
|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | \ No newline at end of file |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | public function getName() |
| 35 | 35 | { |
| 36 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Product notification e-mails' ); |
|
| 36 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Product notification e-mails'); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public function getDescription() |
| 46 | 46 | { |
| 47 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Sends e-mails for watched products' ); |
|
| 47 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Sends e-mails for watched products'); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | |
@@ -57,48 +57,48 @@ discard block |
||
| 57 | 57 | { |
| 58 | 58 | $langIds = array(); |
| 59 | 59 | $context = $this->getContext(); |
| 60 | - $typeId = $this->getListTypeItem( 'watch' )->getId(); |
|
| 60 | + $typeId = $this->getListTypeItem('watch')->getId(); |
|
| 61 | 61 | |
| 62 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
| 63 | - $custManager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
| 62 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
| 63 | + $custManager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
| 64 | 64 | |
| 65 | - $localeItems = $localeManager->searchItems( $localeManager->createSearch() ); |
|
| 65 | + $localeItems = $localeManager->searchItems($localeManager->createSearch()); |
|
| 66 | 66 | |
| 67 | - foreach( $localeItems as $localeItem ) |
|
| 67 | + foreach ($localeItems as $localeItem) |
|
| 68 | 68 | { |
| 69 | 69 | $langId = $localeItem->getLanguageId(); |
| 70 | 70 | |
| 71 | - if( isset( $langIds[$langId] ) ) { |
|
| 71 | + if (isset($langIds[$langId])) { |
|
| 72 | 72 | continue; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | $langIds[$langId] = true; |
| 76 | 76 | // fetch language specific text and media items for products |
| 77 | - $context->getLocale()->setLanguageId( $langId ); |
|
| 77 | + $context->getLocale()->setLanguageId($langId); |
|
| 78 | 78 | |
| 79 | - $search = $custManager->createSearch( true ); |
|
| 79 | + $search = $custManager->createSearch(true); |
|
| 80 | 80 | $expr = array( |
| 81 | - $search->compare( '==', 'customer.languageid', $langId ), |
|
| 82 | - $search->compare( '==', 'customer.lists.typeid', $typeId ), |
|
| 83 | - $search->compare( '==', 'customer.lists.domain', 'product' ), |
|
| 81 | + $search->compare('==', 'customer.languageid', $langId), |
|
| 82 | + $search->compare('==', 'customer.lists.typeid', $typeId), |
|
| 83 | + $search->compare('==', 'customer.lists.domain', 'product'), |
|
| 84 | 84 | $search->getConditions(), |
| 85 | 85 | ); |
| 86 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 87 | - $search->setSortations( array( $search->sort( '+', 'customer.id' ) ) ); |
|
| 86 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 87 | + $search->setSortations(array($search->sort('+', 'customer.id'))); |
|
| 88 | 88 | |
| 89 | 89 | $start = 0; |
| 90 | 90 | |
| 91 | 91 | do |
| 92 | 92 | { |
| 93 | - $customers = $custManager->searchItems( $search ); |
|
| 93 | + $customers = $custManager->searchItems($search); |
|
| 94 | 94 | |
| 95 | - $this->execute( $context, $customers, $typeId ); |
|
| 95 | + $this->execute($context, $customers, $typeId); |
|
| 96 | 96 | |
| 97 | - $count = count( $customers ); |
|
| 97 | + $count = count($customers); |
|
| 98 | 98 | $start += $count; |
| 99 | - $search->setSlice( $start ); |
|
| 99 | + $search->setSlice($start); |
|
| 100 | 100 | } |
| 101 | - while( $count >= $search->getSliceSize() ); |
|
| 101 | + while ($count >= $search->getSliceSize()); |
|
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | |
@@ -110,32 +110,32 @@ discard block |
||
| 110 | 110 | * @param array $customers List of customer items implementing \Aimeos\MShop\Customer\Item\Iface |
| 111 | 111 | * @param string $listTypeId Customer list type ID |
| 112 | 112 | */ |
| 113 | - protected function execute( \Aimeos\MShop\Context\Item\Iface $context, array $customers, $listTypeId ) |
|
| 113 | + protected function execute(\Aimeos\MShop\Context\Item\Iface $context, array $customers, $listTypeId) |
|
| 114 | 114 | { |
| 115 | 115 | $prodIds = $custIds = array(); |
| 116 | - $whItem = $this->getWarehouseItem( 'default' ); |
|
| 117 | - $listManager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
| 118 | - $listItems = $this->getListItems( $context, array_keys( $customers ), $listTypeId ); |
|
| 116 | + $whItem = $this->getWarehouseItem('default'); |
|
| 117 | + $listManager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); |
|
| 118 | + $listItems = $this->getListItems($context, array_keys($customers), $listTypeId); |
|
| 119 | 119 | |
| 120 | - foreach( $listItems as $id => $listItem ) |
|
| 120 | + foreach ($listItems as $id => $listItem) |
|
| 121 | 121 | { |
| 122 | 122 | $refId = $listItem->getRefId(); |
| 123 | - $custIds[ $listItem->getParentId() ][$id] = $refId; |
|
| 123 | + $custIds[$listItem->getParentId()][$id] = $refId; |
|
| 124 | 124 | $prodIds[$refId] = $refId; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - $date = date( 'Y-m-d H:i:s' ); |
|
| 128 | - $products = $this->getProducts( $context, $prodIds, $whItem->getId() ); |
|
| 127 | + $date = date('Y-m-d H:i:s'); |
|
| 128 | + $products = $this->getProducts($context, $prodIds, $whItem->getId()); |
|
| 129 | 129 | |
| 130 | - foreach( $custIds as $custId => $list ) |
|
| 130 | + foreach ($custIds as $custId => $list) |
|
| 131 | 131 | { |
| 132 | 132 | $custListItems = $listIds = array(); |
| 133 | 133 | |
| 134 | - foreach( $list as $listId => $prodId ) |
|
| 134 | + foreach ($list as $listId => $prodId) |
|
| 135 | 135 | { |
| 136 | 136 | $listItem = $listItems[$listId]; |
| 137 | 137 | |
| 138 | - if( $listItem->getDateEnd() < $date ) { |
|
| 138 | + if ($listItem->getDateEnd() < $date) { |
|
| 139 | 139 | $listIds[] = $listId; |
| 140 | 140 | } |
| 141 | 141 | |
@@ -144,22 +144,22 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | try |
| 146 | 146 | { |
| 147 | - $custProducts = $this->getListProducts( $custListItems, $products ); |
|
| 147 | + $custProducts = $this->getListProducts($custListItems, $products); |
|
| 148 | 148 | |
| 149 | - if( !empty( $custProducts ) ) |
|
| 149 | + if (!empty($custProducts)) |
|
| 150 | 150 | { |
| 151 | - $this->sendMail( $context, $customers[$custId]->getPaymentAddress(), $custProducts ); |
|
| 152 | - $listIds += array_keys( $custProducts ); |
|
| 151 | + $this->sendMail($context, $customers[$custId]->getPaymentAddress(), $custProducts); |
|
| 152 | + $listIds += array_keys($custProducts); |
|
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | - catch( \Exception $e ) |
|
| 155 | + catch (\Exception $e) |
|
| 156 | 156 | { |
| 157 | 157 | $str = 'Error while trying to send product notification e-mail for customer ID "%1$s": %2$s'; |
| 158 | - $msg = sprintf( $str, $custId, $e->getMessage() ); |
|
| 159 | - $context->getLogger()->log( $msg ); |
|
| 158 | + $msg = sprintf($str, $custId, $e->getMessage()); |
|
| 159 | + $context->getLogger()->log($msg); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - $listManager->deleteItems( $listIds ); |
|
| 162 | + $listManager->deleteItems($listIds); |
|
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | |
@@ -170,12 +170,12 @@ discard block |
||
| 170 | 170 | * @param \Aimeos\MShop\Context\Item\Iface $context Context item object |
| 171 | 171 | * @return \Aimeos\Client\Html\Iface Product notification e-mail client |
| 172 | 172 | */ |
| 173 | - protected function getClient( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 173 | + protected function getClient(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 174 | 174 | { |
| 175 | - if( !isset( $this->client ) ) |
|
| 175 | + if (!isset($this->client)) |
|
| 176 | 176 | { |
| 177 | - $templatePaths = $this->getAimeos()->getCustomPaths( 'client/html' ); |
|
| 178 | - $this->client = \Aimeos\Client\Html\Email\Watch\Factory::createClient( $context, $templatePaths ); |
|
| 177 | + $templatePaths = $this->getAimeos()->getCustomPaths('client/html'); |
|
| 178 | + $this->client = \Aimeos\Client\Html\Email\Watch\Factory::createClient($context, $templatePaths); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | return $this->client; |
@@ -190,20 +190,20 @@ discard block |
||
| 190 | 190 | * @param string $listTypeId Customer list type ID |
| 191 | 191 | * @return array List of customer list items implementing \Aimeos\MShop\Common\Item\Lists\Iface |
| 192 | 192 | */ |
| 193 | - protected function getListItems( \Aimeos\MShop\Context\Item\Iface $context, array $custIds, $listTypeId ) |
|
| 193 | + protected function getListItems(\Aimeos\MShop\Context\Item\Iface $context, array $custIds, $listTypeId) |
|
| 194 | 194 | { |
| 195 | - $listManager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
| 195 | + $listManager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); |
|
| 196 | 196 | |
| 197 | 197 | $search = $listManager->createSearch(); |
| 198 | 198 | $expr = array( |
| 199 | - $search->compare( '==', 'customer.lists.parentid', $custIds ), |
|
| 200 | - $search->compare( '==', 'customer.lists.typeid', $listTypeId ), |
|
| 201 | - $search->compare( '==', 'customer.lists.domain', 'product' ), |
|
| 199 | + $search->compare('==', 'customer.lists.parentid', $custIds), |
|
| 200 | + $search->compare('==', 'customer.lists.typeid', $listTypeId), |
|
| 201 | + $search->compare('==', 'customer.lists.domain', 'product'), |
|
| 202 | 202 | ); |
| 203 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 204 | - $search->setSlice( 0, 0x7fffffff ); |
|
| 203 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 204 | + $search->setSlice(0, 0x7fffffff); |
|
| 205 | 205 | |
| 206 | - return $listManager->searchItems( $search ); |
|
| 206 | + return $listManager->searchItems($search); |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | |
@@ -214,35 +214,35 @@ discard block |
||
| 214 | 214 | * @param array $products List of product items implementing \Aimeos\MShop\Product\Item\Iface |
| 215 | 215 | * @return array Multi-dimensional associative list of list IDs as key and product / price item maps as values |
| 216 | 216 | */ |
| 217 | - protected function getListProducts( array $listItems, array $products ) |
|
| 217 | + protected function getListProducts(array $listItems, array $products) |
|
| 218 | 218 | { |
| 219 | 219 | $result = array(); |
| 220 | - $priceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'price' ); |
|
| 220 | + $priceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'price'); |
|
| 221 | 221 | |
| 222 | - foreach( $listItems as $id => $listItem ) |
|
| 222 | + foreach ($listItems as $id => $listItem) |
|
| 223 | 223 | { |
| 224 | 224 | try |
| 225 | 225 | { |
| 226 | 226 | $refId = $listItem->getRefId(); |
| 227 | 227 | $config = $listItem->getConfig(); |
| 228 | 228 | |
| 229 | - if( isset( $products[$refId] ) ) |
|
| 229 | + if (isset($products[$refId])) |
|
| 230 | 230 | { |
| 231 | - $prices = $products[$refId]->getRefItems( 'price', 'default', 'default' ); |
|
| 232 | - $currencyId = ( isset( $config['currency'] ) ? $config['currency'] : null ); |
|
| 231 | + $prices = $products[$refId]->getRefItems('price', 'default', 'default'); |
|
| 232 | + $currencyId = (isset($config['currency']) ? $config['currency'] : null); |
|
| 233 | 233 | |
| 234 | - $price = $priceManager->getLowestPrice( $prices, 1, $currencyId ); |
|
| 234 | + $price = $priceManager->getLowestPrice($prices, 1, $currencyId); |
|
| 235 | 235 | |
| 236 | - if( isset( $config['stock'] ) && $config['stock'] == 1 || |
|
| 237 | - isset( $config['price'] ) && $config['price'] == 1 && |
|
| 238 | - isset( $config['pricevalue'] ) && $config['pricevalue'] > $price->getValue() |
|
| 236 | + if (isset($config['stock']) && $config['stock'] == 1 || |
|
| 237 | + isset($config['price']) && $config['price'] == 1 && |
|
| 238 | + isset($config['pricevalue']) && $config['pricevalue'] > $price->getValue() |
|
| 239 | 239 | ) { |
| 240 | 240 | $result[$id]['item'] = $products[$refId]; |
| 241 | 241 | $result[$id]['price'] = $price; |
| 242 | 242 | } |
| 243 | 243 | } |
| 244 | 244 | } |
| 245 | - catch( \Exception $e ) { ; } // no price available |
|
| 245 | + catch (\Exception $e) {; } // no price available |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | return $result; |
@@ -256,27 +256,27 @@ discard block |
||
| 256 | 256 | * @param array $prodIds List of product IDs |
| 257 | 257 | * @param string $whId Unique warehouse ID |
| 258 | 258 | */ |
| 259 | - protected function getProducts( \Aimeos\MShop\Context\Item\Iface $context, array $prodIds, $whId ) |
|
| 259 | + protected function getProducts(\Aimeos\MShop\Context\Item\Iface $context, array $prodIds, $whId) |
|
| 260 | 260 | { |
| 261 | - $productManager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
| 262 | - $search = $productManager->createSearch( true ); |
|
| 263 | - $domains = array( 'text', 'price', 'media' ); |
|
| 261 | + $productManager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
| 262 | + $search = $productManager->createSearch(true); |
|
| 263 | + $domains = array('text', 'price', 'media'); |
|
| 264 | 264 | |
| 265 | 265 | $stockExpr = array( |
| 266 | - $search->compare( '==', 'product.stock.stocklevel', null ), |
|
| 267 | - $search->compare( '>', 'product.stock.stocklevel', 0 ), |
|
| 266 | + $search->compare('==', 'product.stock.stocklevel', null), |
|
| 267 | + $search->compare('>', 'product.stock.stocklevel', 0), |
|
| 268 | 268 | ); |
| 269 | 269 | |
| 270 | 270 | $expr = array( |
| 271 | - $search->compare( '==', 'product.id', $prodIds ), |
|
| 271 | + $search->compare('==', 'product.id', $prodIds), |
|
| 272 | 272 | $search->getConditions(), |
| 273 | - $search->compare( '==', 'product.stock.warehouseid', $whId ), |
|
| 274 | - $search->combine( '||', $stockExpr ), |
|
| 273 | + $search->compare('==', 'product.stock.warehouseid', $whId), |
|
| 274 | + $search->combine('||', $stockExpr), |
|
| 275 | 275 | ); |
| 276 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 277 | - $search->setSlice( 0, 0x7fffffff ); |
|
| 276 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 277 | + $search->setSlice(0, 0x7fffffff); |
|
| 278 | 278 | |
| 279 | - return $productManager->searchItems( $search, $domains ); |
|
| 279 | + return $productManager->searchItems($search, $domains); |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | |
@@ -287,16 +287,16 @@ discard block |
||
| 287 | 287 | * @return \Aimeos\MShop\Common\Item\Type\Iface List type item |
| 288 | 288 | * @throws \Aimeos\Controller\Jobs\Exception If the list type item wasn't found |
| 289 | 289 | */ |
| 290 | - protected function getListTypeItem( $code ) |
|
| 290 | + protected function getListTypeItem($code) |
|
| 291 | 291 | { |
| 292 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists/type' ); |
|
| 292 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists/type'); |
|
| 293 | 293 | |
| 294 | - $search = $manager->createSearch( true ); |
|
| 295 | - $search->setConditions( $search->compare( '==', 'customer.lists.type.code', $code ) ); |
|
| 296 | - $result = $manager->searchItems( $search ); |
|
| 294 | + $search = $manager->createSearch(true); |
|
| 295 | + $search->setConditions($search->compare('==', 'customer.lists.type.code', $code)); |
|
| 296 | + $result = $manager->searchItems($search); |
|
| 297 | 297 | |
| 298 | - if( ( $item = reset( $result ) ) === false ) { |
|
| 299 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'List type for domain "%1$s" and code "%2$s" not found', 'customer', $code ) ); |
|
| 298 | + if (($item = reset($result)) === false) { |
|
| 299 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('List type for domain "%1$s" and code "%2$s" not found', 'customer', $code)); |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | return $item; |
@@ -310,21 +310,21 @@ discard block |
||
| 310 | 310 | * @return \Aimeos\MShop\Product\Item\Stock\Warehouse\Iface Warehouse item |
| 311 | 311 | * @throws \Aimeos\Controller\Jobs\Exception If the warehouse item wasn't found |
| 312 | 312 | */ |
| 313 | - protected function getWarehouseItem( $code ) |
|
| 313 | + protected function getWarehouseItem($code) |
|
| 314 | 314 | { |
| 315 | - if( !isset( $this->warehouses ) ) |
|
| 315 | + if (!isset($this->warehouses)) |
|
| 316 | 316 | { |
| 317 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/stock/warehouse' ); |
|
| 318 | - $search = $manager->createSearch( true ); |
|
| 317 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/stock/warehouse'); |
|
| 318 | + $search = $manager->createSearch(true); |
|
| 319 | 319 | |
| 320 | 320 | $this->warehouses = array(); |
| 321 | - foreach( $manager->searchItems( $search ) as $whItem ) { |
|
| 322 | - $this->warehouses[ $whItem->getCode() ] = $whItem; |
|
| 321 | + foreach ($manager->searchItems($search) as $whItem) { |
|
| 322 | + $this->warehouses[$whItem->getCode()] = $whItem; |
|
| 323 | 323 | } |
| 324 | 324 | } |
| 325 | 325 | |
| 326 | - if( !isset( $this->warehouses[$code] ) ) { |
|
| 327 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'No warehouse "%1$s" found', $code ) ); |
|
| 326 | + if (!isset($this->warehouses[$code])) { |
|
| 327 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('No warehouse "%1$s" found', $code)); |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | return $this->warehouses[$code]; |
@@ -338,27 +338,27 @@ discard block |
||
| 338 | 338 | * @param \Aimeos\MShop\Common\Item\Address\Iface $address Payment address of the customer |
| 339 | 339 | * @param array $products List of products a notification should be sent for |
| 340 | 340 | */ |
| 341 | - protected function sendMail( \Aimeos\MShop\Context\Item\Iface $context, |
|
| 342 | - \Aimeos\MShop\Common\Item\Address\Iface $address, array $products ) |
|
| 341 | + protected function sendMail(\Aimeos\MShop\Context\Item\Iface $context, |
|
| 342 | + \Aimeos\MShop\Common\Item\Address\Iface $address, array $products) |
|
| 343 | 343 | { |
| 344 | 344 | $view = $context->getView(); |
| 345 | 345 | $view->extProducts = $products; |
| 346 | 346 | $view->extAddressItem = $address; |
| 347 | 347 | |
| 348 | - $helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $context->getI18n( $address->getLanguageId() ) ); |
|
| 349 | - $view->addHelper( 'translate', $helper ); |
|
| 348 | + $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $context->getI18n($address->getLanguageId())); |
|
| 349 | + $view->addHelper('translate', $helper); |
|
| 350 | 350 | |
| 351 | 351 | $mailer = $context->getMail(); |
| 352 | 352 | $message = $mailer->createMessage(); |
| 353 | 353 | |
| 354 | - $helper = new \Aimeos\MW\View\Helper\Mail\Standard( $view, $message ); |
|
| 355 | - $view->addHelper( 'mail', $helper ); |
|
| 354 | + $helper = new \Aimeos\MW\View\Helper\Mail\Standard($view, $message); |
|
| 355 | + $view->addHelper('mail', $helper); |
|
| 356 | 356 | |
| 357 | - $client = $this->getClient( $context ); |
|
| 358 | - $client->setView( $view ); |
|
| 357 | + $client = $this->getClient($context); |
|
| 358 | + $client->setView($view); |
|
| 359 | 359 | $client->getHeader(); |
| 360 | 360 | $client->getBody(); |
| 361 | 361 | |
| 362 | - $mailer->send( $message ); |
|
| 362 | + $mailer->send($message); |
|
| 363 | 363 | } |
| 364 | 364 | } |
@@ -11,22 +11,22 @@ |
||
| 11 | 11 | * Set error reporting to maximum |
| 12 | 12 | */ |
| 13 | 13 | error_reporting( -1 ); |
| 14 | -ini_set( 'display_errors', '1' ); |
|
| 14 | +ini_set('display_errors', '1'); |
|
| 15 | 15 | |
| 16 | -date_default_timezone_set( 'UTC' ); |
|
| 16 | +date_default_timezone_set('UTC'); |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Set locale settings to reasonable defaults |
| 20 | 20 | */ |
| 21 | -setlocale( LC_ALL, 'en_US.UTF-8' ); |
|
| 22 | -setlocale( LC_NUMERIC, 'POSIX' ); |
|
| 23 | -setlocale( LC_CTYPE, 'en_US.UTF-8' ); |
|
| 24 | -setlocale( LC_TIME, 'POSIX' ); |
|
| 21 | +setlocale(LC_ALL, 'en_US.UTF-8'); |
|
| 22 | +setlocale(LC_NUMERIC, 'POSIX'); |
|
| 23 | +setlocale(LC_CTYPE, 'en_US.UTF-8'); |
|
| 24 | +setlocale(LC_TIME, 'POSIX'); |
|
| 25 | 25 | |
| 26 | 26 | /* |
| 27 | 27 | * Set include path for tests |
| 28 | 28 | */ |
| 29 | -define( 'PATH_TESTS', __DIR__ ); |
|
| 29 | +define('PATH_TESTS', __DIR__); |
|
| 30 | 30 | |
| 31 | 31 | require_once 'TestHelperJobs.php'; |
| 32 | 32 | \TestHelperJobs::bootstrap(); |