Finish version/v0.0.75#2
This commit is contained in:
commit
dc993021c7
@ -60,7 +60,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
<div style='border: 1px solid #000; padding: 6px; background-color: #fff;'>
|
<div style='border: 1px solid #000; padding: 6px; background-color: #fff;'>
|
||||||
<?php echo $model->body ?>
|
<?php echo $model->body ?>
|
||||||
</div>
|
</div>
|
||||||
|
<?php /*?>
|
||||||
<h3>
|
<h3>
|
||||||
Teszt üzenet küldése
|
Teszt üzenet küldése
|
||||||
</h3>
|
</h3>
|
||||||
@ -68,10 +68,10 @@ Teszt üzenet küldése
|
|||||||
A küldés gombra kattintva úgy küldünk ki egy darab e-mailt,
|
A küldés gombra kattintva úgy küldünk ki egy darab e-mailt,
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
mintha a megadott vendég lenne a fogadó
|
mintha a megadott előfizető lenne a fogadó
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
viszont a vendég e-mail címe helyett a megadott e-mail címre küldjük
|
viszont az előfizető e-mail címe helyett a megadott e-mail címre küldjük
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</p>
|
</p>
|
||||||
@ -93,3 +93,4 @@ Teszt üzenet küldése
|
|||||||
<?php ActiveForm::end(); ?>
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<?php */ ?>
|
||||||
@ -1,3 +1,5 @@
|
|||||||
|
-0.0.75
|
||||||
|
- add unpaid tickets display
|
||||||
-0.0.74
|
-0.0.74
|
||||||
- add newsletter changes
|
- add newsletter changes
|
||||||
-0.0.73
|
-0.0.73
|
||||||
|
|||||||
@ -397,12 +397,16 @@ class Helper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function getWebUrl(){
|
public static function getWebUrl(){
|
||||||
if ( self::isCompanyMovar()){
|
if ( \Yii::$app->params['development'] == true ){
|
||||||
return "https://fitnessadmin.hu/fitness-web";
|
return "http://localhost/fitness-web";
|
||||||
}else if ( self::isCompanyGyor()){
|
|
||||||
return "https://fitnessadmin.hu/cutler";
|
|
||||||
}else{
|
}else{
|
||||||
return "https://localhost/fitness-web";
|
if ( self::isCompanyMovar()){
|
||||||
|
return "https://fitnessadmin.hu/fitness-web";
|
||||||
|
}else if ( self::isCompanyGyor()){
|
||||||
|
return "https://fitnessadmin.hu/cutler";
|
||||||
|
}else{
|
||||||
|
return "https://localhost/fitness-web";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
return [
|
return [
|
||||||
|
'development' => false,
|
||||||
'adminEmail' => 'rocho02@gmail.com',
|
'adminEmail' => 'rocho02@gmail.com',
|
||||||
'supportEmail' => 'rocho02@gmail.com',
|
'supportEmail' => 'rocho02@gmail.com',
|
||||||
'infoEmail' => 'info@rocho-net.hu',
|
'infoEmail' => 'info@rocho-net.hu',
|
||||||
'user.passwordResetTokenExpire' => 3600,
|
'user.passwordResetTokenExpire' => 3600,
|
||||||
'version' => 'v0.0.74',
|
'version' => 'v0.0.75',
|
||||||
'company' => 'movar',//gyor
|
'company' => 'movar',//gyor
|
||||||
'company_name' => "Freimann Kft.",
|
'company_name' => "Freimann Kft.",
|
||||||
'product_visiblity' => 'account',// on reception which products to display. account or global
|
'product_visiblity' => 'account',// on reception which products to display. account or global
|
||||||
@ -47,6 +48,7 @@ return [
|
|||||||
'day' => 5,
|
'day' => 5,
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'newsletter_from' => 'noreply@fitnessadmin.hu'
|
'newsletter_from' => 'noreply@fitnessadmin.hu',
|
||||||
|
'newsletter_enabled' => false
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
@ -45,6 +45,10 @@ class Log extends BaseFitnessActiveRecord
|
|||||||
public static $TYPE_WASTE = 100;
|
public static $TYPE_WASTE = 100;
|
||||||
public static $TYPE_NEWSLETTER_SUBSCRIBE = 110;
|
public static $TYPE_NEWSLETTER_SUBSCRIBE = 110;
|
||||||
public static $TYPE_NEWSLETTER_UNSUBSCRIBE = 120;
|
public static $TYPE_NEWSLETTER_UNSUBSCRIBE = 120;
|
||||||
|
public static $TYPE_NEWSLETTER_SENT = 130;
|
||||||
|
public static $TYPE_TICKET_EXPIRE_SENT = 140;
|
||||||
|
public static $TYPE_NEWSLETTER_SEND_START = 150;
|
||||||
|
public static $TYPE_NEWSLETTER_SEND_END = 160;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
|
|||||||
85
common/models/Subscriber.php
Normal file
85
common/models/Subscriber.php
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace common\models;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use yii\helpers\ArrayHelper;
|
||||||
|
use yii\behaviors\TimestampBehavior;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the model class for table "subscriber".
|
||||||
|
*
|
||||||
|
* @property integer $id_subscriber
|
||||||
|
* @property string $name
|
||||||
|
* @property string $email
|
||||||
|
* @property integer $status
|
||||||
|
* @property string $token
|
||||||
|
* @property string $created_at
|
||||||
|
* @property string $updated_at
|
||||||
|
*/
|
||||||
|
class Subscriber extends \yii\db\ActiveRecord
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public static function tableName()
|
||||||
|
{
|
||||||
|
return 'subscriber';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function behaviors()
|
||||||
|
{
|
||||||
|
return ArrayHelper::merge( [
|
||||||
|
[
|
||||||
|
'class' => TimestampBehavior::className(),
|
||||||
|
'value' => function(){ return date('Y-m-d H:i:s' ); }
|
||||||
|
],
|
||||||
|
], parent::behaviors());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[['email'], 'email'],
|
||||||
|
[['status','email','name'], 'required'],
|
||||||
|
[['status'], 'integer'],
|
||||||
|
[['name'], 'string', 'max' => 255],
|
||||||
|
['status' ,'validateSubscribe' ,'skipOnEmpty' => false, 'skipOnError' => false ,'on' => 'subscribe']
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function validateSubscribe($attr,$param){
|
||||||
|
if ( $this->status != '1'){
|
||||||
|
$this->addError( "status", "Feliratkozáshoz be kell jelölnie ezt a mezőt!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function attributeLabels()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id_subscriber' => Yii::t('common/subscriber', 'Id Subscriber'),
|
||||||
|
'name' => Yii::t('common/subscriber', 'Név'),
|
||||||
|
'email' => Yii::t('common/subscriber', 'Email'),
|
||||||
|
'status' => Yii::t('common/subscriber', 'Szeretnék hírlevelet kapni'),
|
||||||
|
'token' => Yii::t('common/subscriber', 'Token'),
|
||||||
|
'created_at' => Yii::t('common/subscriber', 'Created At'),
|
||||||
|
'updated_at' => Yii::t('common/subscriber', 'Updated At'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function beforeSave($insert){
|
||||||
|
if ( parent::beforeSave($insert)){
|
||||||
|
$this->token = Yii::$app->security->generateRandomString() . '_' . time();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -124,6 +124,11 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
|
|||||||
public function getCard(){
|
public function getCard(){
|
||||||
return $this->hasOne( Card::className(), ["id_card" =>"id_card" ] );
|
return $this->hasOne( Card::className(), ["id_card" =>"id_card" ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getContract(){
|
||||||
|
return $this->hasOne( Contract::className(), ["id_contract" =>"id_contract" ] );
|
||||||
|
}
|
||||||
|
|
||||||
public function getCardNumber(){
|
public function getCardNumber(){
|
||||||
$result = "";
|
$result = "";
|
||||||
$card = $this->card;
|
$card = $this->card;
|
||||||
@ -217,6 +222,31 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
|
|||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @param common\models\Card $card the card to which we are looking for
|
||||||
|
* */
|
||||||
|
public static function readUnpaid($card){
|
||||||
|
|
||||||
|
if ( $card == null )
|
||||||
|
return [];
|
||||||
|
|
||||||
|
$query = Ticket::find();
|
||||||
|
$query->innerJoin("transfer", "transfer.id_object = ticket.id_ticket ");
|
||||||
|
$today = date('Y-m-d');
|
||||||
|
|
||||||
|
$query->andWhere(['ticket.id_card' => $card->id_card]);
|
||||||
|
$query->andWhere( 'ticket.start <= :today' ,[ 'today' => $today] );
|
||||||
|
$query->andWhere( 'ticket.end >= :today' ,[ 'today' => $today] );
|
||||||
|
$query->andWhere( ['in' ,'ticket.status' ,[ Ticket::STATUS_INACTIVE, Ticket::STATUS_ACTIVE] ]);
|
||||||
|
$query->andWhere( ["transfer.type" => Transfer::TYPE_TICKET] );
|
||||||
|
$query->andWhere( [ "transfer.status" => Transfer::STATUS_NOT_PAID ]);
|
||||||
|
$query->orderBy([ "ticket.created_at" =>SORT_DESC] );
|
||||||
|
|
||||||
|
$result = $query->all();
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function mkStatisticQuery($start,$end,$id_card = null){
|
public static function mkStatisticQuery($start,$end,$id_card = null){
|
||||||
|
|||||||
@ -13,6 +13,7 @@ use common\components\Helper;
|
|||||||
use common\models\Newsletter;
|
use common\models\Newsletter;
|
||||||
use common\models\Log;
|
use common\models\Log;
|
||||||
use yii\helpers\Html;
|
use yii\helpers\Html;
|
||||||
|
use common\models\Subscriber;
|
||||||
|
|
||||||
class TicketController extends Controller {
|
class TicketController extends Controller {
|
||||||
public function actionIndex() {
|
public function actionIndex() {
|
||||||
@ -110,6 +111,12 @@ class TicketController extends Controller {
|
|||||||
->setTo ( $recepientEmail )
|
->setTo ( $recepientEmail )
|
||||||
->setSubject ( "Értesítés - " . Helper::getCompanyName()." - Bérleted ".$dayCount." nap múlva lejár" )
|
->setSubject ( "Értesítés - " . Helper::getCompanyName()." - Bérleted ".$dayCount." nap múlva lejár" )
|
||||||
->send ();
|
->send ();
|
||||||
|
|
||||||
|
Log::logC([
|
||||||
|
'type' => Log::$TYPE_TICKET_EXPIRE_SENT,
|
||||||
|
'message' => "Bérlet lejár üzenet: " . $recepient['customer_name']." [id_customer=". $recepient['customer_id_customer'] ."]",
|
||||||
|
'id_customer' => $recepient['customer_id_customer']
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -129,6 +136,12 @@ class TicketController extends Controller {
|
|||||||
|
|
||||||
public function actionNewsletter(){
|
public function actionNewsletter(){
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
|
|
||||||
|
if ( \Yii::$app->params['newsletter_enabled'] != true ){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$q1 = Newsletter::find();
|
$q1 = Newsletter::find();
|
||||||
$q1->andWhere(['sent' => Newsletter::$SENT_NOT]);
|
$q1->andWhere(['sent' => Newsletter::$SENT_NOT]);
|
||||||
$q1->andWhere(['status' => Newsletter::$STATUS_ACTIVE]);
|
$q1->andWhere(['status' => Newsletter::$STATUS_ACTIVE]);
|
||||||
@ -139,38 +152,32 @@ class TicketController extends Controller {
|
|||||||
\Yii::info("Nincs elküldendő hírlevél");
|
\Yii::info("Nincs elküldendő hírlevél");
|
||||||
}
|
}
|
||||||
|
|
||||||
$q2 = new Query();
|
$subscribers = Subscriber::find()->andWhere(['status' => 1])->all();
|
||||||
$q2->distinct();
|
|
||||||
$q2->select(['customer.email as customer_email','customer.name as customer_name'
|
|
||||||
,'customer.id_customer as customer_id_customer'
|
|
||||||
,'customer.newsletter_token as customer_newsletter_token'
|
|
||||||
]);
|
|
||||||
$q2->from("customer");
|
|
||||||
$q2->innerJoin("ticket","ticket.id_card = customer.id_customer_card");
|
|
||||||
// $q2->andWhere(['status' => Customer::STATUS_ACTIVE ]);
|
|
||||||
$q2->andWhere(['newsletter' => Customer::$ENABLED ]);
|
|
||||||
$q2->andWhere(['>=' ,'ticket.end',new Expression('DATE( DATE_ADD(NOW(),INTERVAL -3 MONTH) )')]);
|
|
||||||
|
|
||||||
|
|
||||||
$customers = $q2->all();
|
|
||||||
|
|
||||||
\Yii::info("Hírlevél küldése " .count($customers) . " vendégnek!" );
|
\Yii::info("Hírlevél küldése " .count($subscribers) . " előfizetőnek!" );
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
foreach ($newsletters as $newsletter ){
|
foreach ($newsletters as $newsletter ){
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($customers as $customer ){
|
Log::logC([
|
||||||
|
'type' => Log::$TYPE_NEWSLETTER_SEND_START,
|
||||||
|
'message' => "Hírlevél küldés indítása[id_newsletter=" . $newsletter->id_newsletter ."]"
|
||||||
|
]);
|
||||||
|
foreach ($subscribers as $subscriber ){
|
||||||
|
|
||||||
try{
|
try{
|
||||||
$log = "Sending Newsletter";
|
$log = "Sending Newsletter";
|
||||||
$log .="[id_newsletter=".$newsletter->id_newsletter ."]";
|
$log .="[id_newsletter=".$newsletter->id_newsletter ."]";
|
||||||
$log .="[customer_email=" . $customer['customer_email'] . "]";
|
$log .="[subscriber_email=" . $subscriber->email . "]";
|
||||||
|
$log .="[subscriber_id=" . $subscriber->id_subscriber . "]";
|
||||||
\Yii::info($log);
|
\Yii::info($log);
|
||||||
$message = \Yii::$app->mailer->compose ( );
|
$message = \Yii::$app->mailer->compose ( );
|
||||||
|
|
||||||
$replacePairs = [
|
$replacePairs = [
|
||||||
'{vendeg_neve}' => $customer['customer_name']
|
'{vendeg_neve}' => $subscriber->name
|
||||||
];
|
];
|
||||||
|
|
||||||
$mailBody = $newsletter->body;
|
$mailBody = $newsletter->body;
|
||||||
@ -178,7 +185,7 @@ class TicketController extends Controller {
|
|||||||
|
|
||||||
$mailBody .="<hr>";
|
$mailBody .="<hr>";
|
||||||
$mailBody .="Leiratkozás hírlevélről:";
|
$mailBody .="Leiratkozás hírlevélről:";
|
||||||
$mailBody .= Html::a("Leiratkozom",Helper::getWebUrl() ."/frontend/web/index.php?r=site/newsletter-unsubscribe&id=".$customer['customer_id_customer']."&token=".$customer['customer_newsletter_token']);
|
$mailBody .= Html::a("Leiratkozom",Helper::getWebUrl() ."/frontend/web/index.php?r=site/newsletter-unsubscribe&id=".$subscriber->id_subscriber."&token=". $subscriber->token );
|
||||||
|
|
||||||
$mailSubject = $newsletter->subject;
|
$mailSubject = $newsletter->subject;
|
||||||
$mailSubject = strtr($mailSubject, $replacePairs );
|
$mailSubject = strtr($mailSubject, $replacePairs );
|
||||||
@ -186,14 +193,19 @@ class TicketController extends Controller {
|
|||||||
$message
|
$message
|
||||||
->setFrom ( [ \Yii::$app->params['newsletter_from'] => Helper::getCompanyName() ])
|
->setFrom ( [ \Yii::$app->params['newsletter_from'] => Helper::getCompanyName() ])
|
||||||
->setTo ( [
|
->setTo ( [
|
||||||
$customer['customer_email']
|
$subscriber->email => $subscriber->name
|
||||||
])
|
])
|
||||||
->setHtmlBody( $mailBody )
|
->setHtmlBody( $mailBody )
|
||||||
->setSubject ( $mailSubject )
|
->setSubject ( $mailSubject )
|
||||||
->send ();
|
->send ();
|
||||||
|
|
||||||
|
Log::logC([
|
||||||
|
'type' => Log::$TYPE_NEWSLETTER_SENT,
|
||||||
|
'message' => "Hírlevél küldés[id_newsletter=" . $newsletter->id_newsletter ."][id_subscriber=" . $subscriber->id_subscriber ."]"
|
||||||
|
]);
|
||||||
|
|
||||||
}catch (\Exception $ex){
|
}catch (\Exception $ex){
|
||||||
\Yii::error("Nem sikerült hírlevelet kikülden: Hírlevél azonosító=" .$newsletter->id_newsletter. ";Vendég azonosító ". $customer['customer_name'] ) ;
|
\Yii::error("Nem sikerült hírlevelet kikülden: Hírlevél azonosító=" .$newsletter->id_newsletter. ";Előfizető azonosító ". $subscriber->id_subscriber ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
@ -202,6 +214,11 @@ class TicketController extends Controller {
|
|||||||
$newsletter->sent_at = Helper::getDateTimeString();
|
$newsletter->sent_at = Helper::getDateTimeString();
|
||||||
$newsletter->save(false);
|
$newsletter->save(false);
|
||||||
|
|
||||||
|
Log::logC([
|
||||||
|
'type' => Log::$TYPE_NEWSLETTER_SEND_END,
|
||||||
|
'message' => "Hírlevél küldés befejezése[id_newsletter=" . $newsletter->id_newsletter ."]"
|
||||||
|
]);
|
||||||
|
|
||||||
// Log::log([
|
// Log::log([
|
||||||
// 'type' =>Log::$TYPE_LOGIN,
|
// 'type' =>Log::$TYPE_LOGIN,
|
||||||
// 'message' => $message
|
// 'message' => $message
|
||||||
|
|||||||
43
console/migrations/m160527_054414_add_table__subscriber.php
Normal file
43
console/migrations/m160527_054414_add_table__subscriber.php
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\db\Schema;
|
||||||
|
use yii\db\Migration;
|
||||||
|
|
||||||
|
class m160527_054414_add_table__subscriber extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$tableOptions = null;
|
||||||
|
if ($this->db->driverName === 'mysql') {
|
||||||
|
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
|
||||||
|
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->createTable('{{%subscriber}}', [
|
||||||
|
'id_subscriber' => $this->primaryKey(),
|
||||||
|
'name' => $this->string(),
|
||||||
|
'email' => $this->text(),
|
||||||
|
'status' => $this->integer(11),
|
||||||
|
'token' => $this->string(),
|
||||||
|
'created_at' => $this->dateTime()->notNull(),
|
||||||
|
'updated_at' => $this->dateTime()->notNull(),
|
||||||
|
], $tableOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Use safeUp/safeDown to run migration code within a transaction
|
||||||
|
public function safeUp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function safeDown()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
@ -18,6 +18,7 @@ use common\models\Log;
|
|||||||
use common\models\Customer;
|
use common\models\Customer;
|
||||||
use yii\web\NotFoundHttpException;
|
use yii\web\NotFoundHttpException;
|
||||||
use frontend\models\SubscribeForm;
|
use frontend\models\SubscribeForm;
|
||||||
|
use common\models\Subscriber;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Site controller
|
* Site controller
|
||||||
@ -100,7 +101,9 @@ class SiteController extends Controller
|
|||||||
$message = "";
|
$message = "";
|
||||||
$user = User::findOne(\Yii::$app->user->id);
|
$user = User::findOne(\Yii::$app->user->id);
|
||||||
if ( isset($geoip)){
|
if ( isset($geoip)){
|
||||||
$message = "Bejelentkezés: " .$user->username. " Ip cím:". $geoip->ip . " Város: " . $geoip->city;
|
$ip = isset( $geoip->ip ) ? $geoip->ip : "";
|
||||||
|
$city = isset( $geoip->city ) ? $geoip->city : "";
|
||||||
|
$message = "Bejelentkezés: " .$user->username. " Ip cím:". $ip . " Város: " . $city;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log::log([
|
Log::log([
|
||||||
@ -185,9 +188,9 @@ class SiteController extends Controller
|
|||||||
|
|
||||||
$this->layout = "main-nologin";
|
$this->layout = "main-nologin";
|
||||||
|
|
||||||
$customer = Customer::find()
|
$customer = Subscriber::find()
|
||||||
->andWhere(['id_customer' => $id ])
|
->andWhere(['id_subscriber' => $id ])
|
||||||
->andWhere(['newsletter_token' => $token])
|
->andWhere(['token' => $token])
|
||||||
->one();
|
->one();
|
||||||
|
|
||||||
|
|
||||||
@ -195,51 +198,32 @@ class SiteController extends Controller
|
|||||||
throw new NotFoundHttpException("Az oldal nem található");
|
throw new NotFoundHttpException("Az oldal nem található");
|
||||||
}
|
}
|
||||||
|
|
||||||
$customer->newsletter = 0;
|
$customer->status = 0;
|
||||||
$customer->newsletter_token = Yii::$app->security->generateRandomString() . '_' . time();
|
$customer->token = Yii::$app->security->generateRandomString() . '_' . time();
|
||||||
$customer->save();
|
$customer->save();
|
||||||
|
|
||||||
Log::logC([
|
Log::logC([
|
||||||
'id_customer' => $customer->id_customer,
|
|
||||||
'type' => Log::$TYPE_NEWSLETTER_UNSUBSCRIBE,
|
'type' => Log::$TYPE_NEWSLETTER_UNSUBSCRIBE,
|
||||||
"message" => "Hírlevél feliratkozás: ". $customer->name
|
"message" => "Hírlevél leiratkozás: ". $customer->name
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
return $this->render("unsubscribe");
|
return $this->render("unsubscribe",['subscriber' => $customer]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function actionNewsletterSubscribe($id,$token)
|
public function actionNewsletterSubscribe()
|
||||||
{
|
{
|
||||||
$this->layout = "main-nologin";
|
$this->layout = "main-nologin";
|
||||||
|
|
||||||
|
$model = new Subscriber(['scenario' => 'subscribe']);
|
||||||
|
|
||||||
|
|
||||||
$customer = Customer::find()
|
if ($model->load(Yii::$app->request->post()) && $model->save() ) {
|
||||||
->andWhere(['id_customer' => $id ])
|
|
||||||
->andWhere(['newsletter_token' => $token])
|
|
||||||
->one();
|
|
||||||
|
|
||||||
if ( !isset($customer)){
|
|
||||||
throw new NotFoundHttpException("Az oldal nem található");
|
|
||||||
}
|
|
||||||
$model = new SubscribeForm([
|
|
||||||
'customer' => $customer
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($model->load(Yii::$app->request->post()) && $model->validate() ) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$customer->newsletter = 1;
|
|
||||||
$customer->newsletter_token = Yii::$app->security->generateRandomString() . '_' . time();
|
|
||||||
$customer->save();
|
|
||||||
|
|
||||||
|
|
||||||
Log::logC([
|
Log::logC([
|
||||||
'id_customer' => $customer->id_customer,
|
|
||||||
'type' => Log::$TYPE_NEWSLETTER_SUBSCRIBE,
|
'type' => Log::$TYPE_NEWSLETTER_SUBSCRIBE,
|
||||||
"message" => "Hírlevél feliratkozás: ". $customer->name ." - " . $customer->email
|
"message" => "Hírlevél feliratkozás: ". $model->name ." - " . $model->email
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $this->redirect(["newsletter-subscribe-success"]);
|
return $this->redirect(["newsletter-subscribe-success"]);
|
||||||
|
|||||||
@ -26,6 +26,7 @@ class ReceptionForm extends Model
|
|||||||
public $card;
|
public $card;
|
||||||
public $customer;
|
public $customer;
|
||||||
public $tickets;
|
public $tickets;
|
||||||
|
public $unpaidTickets;
|
||||||
public $defaultAccount;
|
public $defaultAccount;
|
||||||
public $cardSearchModel;
|
public $cardSearchModel;
|
||||||
public $lastCassaState;
|
public $lastCassaState;
|
||||||
@ -77,6 +78,7 @@ class ReceptionForm extends Model
|
|||||||
if ( $this->card != null ){
|
if ( $this->card != null ){
|
||||||
$this->customer = $this->card->customer;
|
$this->customer = $this->card->customer;
|
||||||
$this->readValidTickets();
|
$this->readValidTickets();
|
||||||
|
$this->readUnpaidTicket();
|
||||||
$this->readAssignedKeys();
|
$this->readAssignedKeys();
|
||||||
$this->readContract();
|
$this->readContract();
|
||||||
}
|
}
|
||||||
@ -183,6 +185,10 @@ class ReceptionForm extends Model
|
|||||||
$this->tickets = Ticket::readActive($this->card);
|
$this->tickets = Ticket::readActive($this->card);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function readUnpaidTicket(){
|
||||||
|
$this->unpaidTickets = Ticket::readUnpaid($this->card);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true , if card found without customer
|
* @return true , if card found without customer
|
||||||
* */
|
* */
|
||||||
|
|||||||
@ -105,4 +105,35 @@ if ( isset($model->contract)){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( isset( $model->unpaidTickets ) ) {
|
||||||
|
if ( count($model->unpaidTickets) > 0){
|
||||||
|
echo Html::beginTag("div",['class'=>"alert alert-warning", "role"=>"alert"]);
|
||||||
|
echo Html::beginTag("strong",[ ]);
|
||||||
|
echo "Fizetetlen bérletek";
|
||||||
|
echo Html::endTag("strong");
|
||||||
|
echo "<ul>";
|
||||||
|
$formatter = \Yii::$app->formatter;
|
||||||
|
foreach ($model->unpaidTickets as $t ){
|
||||||
|
echo Html::beginTag("li",[ ]);
|
||||||
|
$c = $t->contract;
|
||||||
|
if (isset($c)){
|
||||||
|
echo "<b>Szerződéses</b>";
|
||||||
|
}
|
||||||
|
echo $t->getTicketTypeName();
|
||||||
|
|
||||||
|
echo ": ";
|
||||||
|
echo $formatter->asDate($t->start);
|
||||||
|
echo " - " ;
|
||||||
|
echo $formatter->asDate($t->end);
|
||||||
|
echo " (";
|
||||||
|
echo $t->price_brutto;
|
||||||
|
echo " Ft)";
|
||||||
|
echo Html::endTag("li");
|
||||||
|
}
|
||||||
|
echo "</ul>";
|
||||||
|
echo Html::endTag("div");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@ -4,18 +4,6 @@ use yii\helpers\Html;
|
|||||||
use common\components\Helper;
|
use common\components\Helper;
|
||||||
?>
|
?>
|
||||||
<div class="key-form">
|
<div class="key-form">
|
||||||
<p>
|
|
||||||
Kedves <?php echo $model->customer->name ?>!
|
|
||||||
</p>
|
|
||||||
<?php if ( empty($model->customer->email)) {?>
|
|
||||||
<p>
|
|
||||||
Ön nem adott meg e-mail címet. Ha szeretne feliratkozni a hírlevelünkre,
|
|
||||||
kérjük keressen bennünket személyesen valamilyik termünkben.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Köszönettel: <?php echo Helper::getCompanyName()?>
|
|
||||||
</p>
|
|
||||||
<?php }else{?>
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Ha Ön is szeretné megkapni a <?php echo Helper::getCompanyName() ?> hírleveleit,
|
Ha Ön is szeretné megkapni a <?php echo Helper::getCompanyName() ?> hírleveleit,
|
||||||
@ -26,7 +14,9 @@ Kedves <?php echo $model->customer->name ?>!
|
|||||||
<?php $form = ActiveForm::begin(); ?>
|
<?php $form = ActiveForm::begin(); ?>
|
||||||
|
|
||||||
|
|
||||||
<?= $form->field($model, 'subscribe')->checkbox([])?>
|
<?= $form->field($model, 'email')->textInput([])?>
|
||||||
|
<?= $form->field($model, 'name')->textInput([])?>
|
||||||
|
<?= $form->field($model, 'status')->checkbox([ 'label' => false ])->label("Szeretnék hírlevelet kapni")?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -35,6 +25,5 @@ Kedves <?php echo $model->customer->name ?>!
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php ActiveForm::end(); ?>
|
<?php ActiveForm::end(); ?>
|
||||||
<?php }?>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
use common\components\Helper;
|
use common\components\Helper;
|
||||||
?>
|
?>
|
||||||
|
<p>
|
||||||
|
Kedves <?php echo $subscriber->name ?>!
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
Ön sikeresen leiratkozott a hírlevelünkről!
|
Ön sikeresen leiratkozott a hírlevelünkről!
|
||||||
|
A leiratkozott e-mail cím : <?php echo $subscriber->email?>
|
||||||
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Köszönettel:
|
Köszönettel:
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
4
update_botond.sh
Normal file
4
update_botond.sh
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
git pull origin master
|
||||||
|
composer install
|
||||||
|
php yii migrate
|
||||||
|
yii migrate --interactive=0
|
||||||
Loading…
Reference in New Issue
Block a user