-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #904 from inbaz/develop
added payment reminder
- Loading branch information
Showing
33 changed files
with
89 additions
and
38 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -423,15 +423,31 @@ public function sendPaymentReminderAction() { | |
$em = $this->getServiceLocator() | ||
->get('Doctrine\ORM\EntityManager'); | ||
|
||
$qb1 = $em->getRepository('ErsBase\Entity\Order')->createQueryBuilder('o'); | ||
$qb1->where($qb1->expr()->isNull('o.payment_reminder_status')); | ||
|
||
$correctOrders = $qb1->getQuery()->getResult(); | ||
|
||
echo "found ".count($correctOrders)." orders to correct".PHP_EOL; | ||
foreach($correctOrders as $o) { | ||
$o->setPaymentReminderStatus(0); | ||
$em->persist($o); | ||
} | ||
$em->flush(); | ||
|
||
#$limit = 3; | ||
$qb = $em->getRepository('ErsBase\Entity\Order')->createQueryBuilder('o'); | ||
$qb->join('o.status', 's'); | ||
$qb->where($qb->expr()->eq('s.value', ':status')); | ||
$qb->andWhere($qb->expr()->lt('o.created', ':paymentTarget')); | ||
$qb->andWhere($qb->expr()->eq('o.payment_reminder_status', ':prstatus')); | ||
$qb->setParameter('status', 'ordered'); | ||
$paymentTarget = new \DateTime; | ||
#$paymentTarget->modify( '-'.(date('d')-5).' day' ); | ||
$paymentTarget->modify( '-5 days' ); | ||
$qb->setParameter('paymentTarget', $paymentTarget); | ||
$qb->setParameter('prstatus', '0'); | ||
#$qb->setFirstResult( $offset ) | ||
#$qb->setMaxResults( $limit ); | ||
|
||
$notPaidOrders = $qb->getQuery()->getResult(); | ||
echo count($notPaidOrders)." not paid orders found from before ".$paymentTarget->format('d.m.Y').".".PHP_EOL; | ||
|
@@ -454,18 +470,21 @@ public function sendPaymentReminderAction() { | |
|
||
foreach($notPaidOrders as $order) { | ||
# prepare email (participant, buyer) | ||
#$emailService = new Service\EmailService(); | ||
$emailService = $this->getServiceLocator() | ||
->get('ErsBase\Service\EmailService'); | ||
$config = $this->getServiceLocator() | ||
->get('config'); | ||
$emailService->setFrom($config['ERS']['info_mail']); | ||
|
||
/*** real buyer ***/ | ||
$buyer = $order->getBuyer(); | ||
$emailService->addTo($buyer); | ||
/*$user = new Entity\User(); | ||
$user->setEmail('[email protected]'); | ||
$emailService->addTo($user);*/ | ||
/***/ | ||
/*** test buyer ** | ||
$user = new Entity\User(); | ||
$user->setEmail('andi'.$order->getCode()->getValue().'@inbaz.org'); | ||
$emailService->addTo($user); | ||
/***/ | ||
|
||
$bcc = new Entity\User(); | ||
$bcc->setEmail($config['ERS']['info_mail']); | ||
|
@@ -485,6 +504,10 @@ public function sendPaymentReminderAction() { | |
|
||
$emailService->send(); | ||
|
||
$order->setPaymentReminderStatus($order->getPaymentReminderStatus()+1); | ||
$em->persist($order); | ||
$em->flush(); | ||
|
||
echo "sent payment reminder for order ".$order->getCode()->getValue().PHP_EOL; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.