Skip to content

Commit

Permalink
Merge pull request #904 from inbaz/develop
Browse files Browse the repository at this point in the history
added payment reminder
  • Loading branch information
BigAndini authored Oct 25, 2016
2 parents ded3293 + de53c75 commit 9191476
Show file tree
Hide file tree
Showing 33 changed files with 89 additions and 38 deletions.
Binary file modified data/ers.mwb
Binary file not shown.
33 changes: 28 additions & 5 deletions module/Admin/src/Admin/Controller/CronController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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']);
Expand All @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/Agegroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-06-07 09:27:21.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-10-25 09:20:27.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/BankAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-06-07 09:27:21.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-10-25 09:20:27.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/BankAccountCsv.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-06-07 09:27:21.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-10-25 09:20:27.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/BankStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-06-07 09:27:21.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-10-25 09:20:27.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-06-07 09:27:21.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-10-25 09:20:27.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/Code.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-06-07 09:27:21.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-10-25 09:20:27.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/Counter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-06-07 09:27:21.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-10-25 09:20:27.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/Country.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-06-07 09:27:21.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-10-25 09:20:27.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/Currency.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-06-07 09:27:21.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-10-25 09:20:27.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/Deadline.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-06-07 09:27:21.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-10-25 09:20:27.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-06-07 09:27:21.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-10-25 09:20:27.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/ItemPackage.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-06-07 09:27:21.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-10-25 09:20:27.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/ItemVariant.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-06-07 09:27:21.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-10-25 09:20:27.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/Language.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-06-07 09:27:21.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-10-25 09:20:27.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-06-07 09:27:21.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-10-25 09:20:27.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/Match.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-06-07 09:27:21.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-10-25 09:20:27.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
34 changes: 31 additions & 3 deletions module/ErsBase/src/ErsBase/Entity/Base/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-06-07 09:27:21.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-10-25 09:20:27.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down Expand Up @@ -63,6 +63,11 @@ class Order
*/
protected $payment_status;

/**
* @ORM\Column(type="integer", nullable=true)
*/
protected $payment_reminder_status;

/**
* @ORM\Column(type="float", nullable=true)
*/
Expand Down Expand Up @@ -347,6 +352,29 @@ public function getPaymentStatus()
return $this->payment_status;
}

/**
* Set the value of payment_reminder_status.
*
* @param integer $payment_reminder_status
* @return \ErsBase\Entity\Base\Order
*/
public function setPaymentReminderStatus($payment_reminder_status)
{
$this->payment_reminder_status = $payment_reminder_status;

return $this;
}

/**
* Get the value of payment_reminder_status.
*
* @return integer
*/
public function getPaymentReminderStatus()
{
return $this->payment_reminder_status;
}

/**
* Set the value of order_sum.
*
Expand Down Expand Up @@ -728,7 +756,7 @@ public function populate(array $data = array())
*/
public function getArrayCopy(array $fields = array())
{
$dataFields = array('id', 'code_id', 'status_id', 'buyer_id', 'payment_type_id', 'hashkey', 'invoice_detail', 'payment_status', 'order_sum', 'total_sum', 'refund_sum', 'updated', 'created');
$dataFields = array('id', 'code_id', 'status_id', 'buyer_id', 'payment_type_id', 'hashkey', 'invoice_detail', 'payment_status', 'payment_reminder_status', 'order_sum', 'total_sum', 'refund_sum', 'updated', 'created');
$relationFields = array('user', 'paymentType', 'status', 'code');
$copiedFields = array();
foreach ($relationFields as $relationField) {
Expand Down Expand Up @@ -761,6 +789,6 @@ public function getArrayCopy(array $fields = array())

public function __sleep()
{
return array('id', 'code_id', 'status_id', 'buyer_id', 'payment_type_id', 'hashkey', 'invoice_detail', 'payment_status', 'order_sum', 'total_sum', 'refund_sum', 'updated', 'created');
return array('id', 'code_id', 'status_id', 'buyer_id', 'payment_type_id', 'hashkey', 'invoice_detail', 'payment_status', 'payment_reminder_status', 'order_sum', 'total_sum', 'refund_sum', 'updated', 'created');
}
}
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/Package.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-06-07 09:27:21.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-10-25 09:20:27.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/PackageStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-06-07 09:27:21.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-10-25 09:20:28.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/PaymentDetail.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-06-07 09:27:21.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-10-25 09:20:28.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/PaymentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-06-07 09:27:21.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-10-25 09:20:28.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-06-07 09:27:21.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-10-25 09:20:28.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/ProductPackage.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-06-07 09:27:21.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-10-25 09:20:28.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/ProductPrice.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-06-07 09:27:21.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-10-25 09:20:28.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/ProductVariant.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-06-07 09:27:21.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-10-25 09:20:28.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-06-07 09:27:21.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-10-25 09:20:28.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-06-07 09:27:21.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-10-25 09:20:28.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/Setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-06-07 09:27:21.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-10-25 09:20:28.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/Status.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-06-07 09:27:21.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-10-25 09:20:28.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/Tax.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-06-07 09:27:21.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2016-10-25 09:20:28.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
Loading

0 comments on commit 9191476

Please sign in to comment.