<?php

namespace backend\models;

use Yii;
use yii\base\Model;
use common\models\Card;
use common\models\Customer;
use common\models\Ticket;
use common\models\Account;
use yii\web\UploadedFile;
use common\models\TicketInstallmentRequest;

/**
 * ContactForm is the model behind the contact form.
 * @property \Yii\web\UploadedFile $file
 */
class TicketInstallmentMarkForSendForm extends Model{
	
	public $items;
	
	public function rules(){
		return [
				['items', 'each', 'rule' => ['integer']],
		];
	}
	
	
	
	public function markForSend(){
		if ( $this->validate() && isset($this->items ) && is_array($this->items ) ){
			$updated = 0;
			$updated = TicketInstallmentRequest::updateAll(['status' => TicketInstallmentRequest::$STATUS_MARKED_TO_SEND ],['in', 'id_ticket_installment_request' , $this->items]);
			\Yii::$app->session->setFlash('success', $updated . " megbízás küldésre jelölve "  );
		}else{
			\Yii::$app->session->setFlash('success',   " Nem történt küldésre jelölés! "  );
		}
	}
	
}