Finish version/v.0.0.82
This commit is contained in:
commit
ad3ab64d8e
@ -21,7 +21,8 @@ use common\components\Upload;
|
||||
/**
|
||||
* CardPackageController implements the CRUD actions for CardPackage model.
|
||||
*/
|
||||
class CardPackageController extends \backend\controllers\BackendController {
|
||||
class CardPackageController extends \backend\controllers\BackendController
|
||||
{
|
||||
|
||||
|
||||
public function behaviors()
|
||||
@ -41,12 +42,14 @@ class CardPackageController extends \backend\controllers\BackendController {
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all CardPackage models.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionIndex() {
|
||||
public function actionIndex()
|
||||
{
|
||||
$searchModel = new CardPackageSearch ();
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||
|
||||
@ -62,7 +65,8 @@ class CardPackageController extends \backend\controllers\BackendController {
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionView($id) {
|
||||
public function actionView($id)
|
||||
{
|
||||
$model = $this->findModel($id);
|
||||
|
||||
$query = Card::find();
|
||||
@ -80,7 +84,9 @@ class CardPackageController extends \backend\controllers\BackendController {
|
||||
'dataProvider' => $dataProvider
|
||||
]);
|
||||
}
|
||||
public function actionDownload($id) {
|
||||
|
||||
public function actionDownload($id)
|
||||
{
|
||||
$model = $this->findModel($id);
|
||||
|
||||
$model->updateCounters([
|
||||
@ -109,7 +115,8 @@ class CardPackageController extends \backend\controllers\BackendController {
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionCreate() {
|
||||
public function actionCreate()
|
||||
{
|
||||
$model = new CardPackage ();
|
||||
$model->id_user = \Yii::$app->user->id;
|
||||
$model->printed = 0;
|
||||
@ -163,7 +170,9 @@ class CardPackageController extends \backend\controllers\BackendController {
|
||||
]);
|
||||
}
|
||||
}
|
||||
protected function generateXLS($model, $numbers) {
|
||||
|
||||
protected function generateXLS($model, $numbers)
|
||||
{
|
||||
$objPHPExcel = new \PHPExcel ();
|
||||
|
||||
$sheet = $objPHPExcel->setActiveSheetIndex(0);
|
||||
@ -201,14 +210,15 @@ class CardPackageController extends \backend\controllers\BackendController {
|
||||
$objWriter->save('php://output');
|
||||
exit ();
|
||||
}
|
||||
public function actionImport() {
|
||||
|
||||
public function actionImport()
|
||||
{
|
||||
$model = new CardPackageImportForm ();
|
||||
|
||||
if (Yii::$app->request->isPost) {
|
||||
$model->file = UploadedFile::getInstance($model, 'file');
|
||||
|
||||
|
||||
|
||||
if ($model->validate()) {
|
||||
|
||||
|
||||
@ -230,6 +240,17 @@ class CardPackageController extends \backend\controllers\BackendController {
|
||||
try {
|
||||
$tx = \Yii::$app->db->beginTransaction();
|
||||
|
||||
$rfidIsValid = false;
|
||||
$rfid = $row[2];
|
||||
|
||||
if (isset($rfid) && !empty($rfid) && strlen($rfid) > 8) {
|
||||
$rfidIsValid = true;
|
||||
}
|
||||
|
||||
if ( !$rfidIsValid ){
|
||||
throw new \Exception("Rfid is invalid");
|
||||
}
|
||||
|
||||
$card = Card::find()->andWhere([
|
||||
'number' => $row [0]
|
||||
])->one();
|
||||
@ -241,10 +262,10 @@ class CardPackageController extends \backend\controllers\BackendController {
|
||||
throw new \Exception("Card not found");
|
||||
}
|
||||
|
||||
|
||||
$tx->commit();
|
||||
|
||||
$model->done = $model->done + 1;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$tx->rollBack();
|
||||
$model->failed = $model->failed + 1;
|
||||
@ -273,7 +294,8 @@ class CardPackageController extends \backend\controllers\BackendController {
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionUpdate($id) {
|
||||
public function actionUpdate($id)
|
||||
{
|
||||
$model = $this->findModel($id);
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
@ -295,7 +317,8 @@ class CardPackageController extends \backend\controllers\BackendController {
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionDelete($id) {
|
||||
public function actionDelete($id)
|
||||
{
|
||||
$this->findModel($id)->delete();
|
||||
|
||||
return $this->redirect([
|
||||
@ -311,7 +334,8 @@ class CardPackageController extends \backend\controllers\BackendController {
|
||||
* @return CardPackage the loaded model
|
||||
* @throws NotFoundHttpException if the model cannot be found
|
||||
*/
|
||||
protected function findModel($id) {
|
||||
protected function findModel($id)
|
||||
{
|
||||
if (($model = CardPackage::findOne($id)) !== null) {
|
||||
return $model;
|
||||
} else {
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
-0.0.82
|
||||
- add rfid check to card package import
|
||||
-0.0.81
|
||||
- add comment to transaction/index
|
||||
-0.0.80
|
||||
|
||||
@ -5,7 +5,7 @@ return [
|
||||
'supportEmail' => 'rocho02@gmail.com',
|
||||
'infoEmail' => 'info@rocho-net.hu',
|
||||
'user.passwordResetTokenExpire' => 3600,
|
||||
'version' => 'v0.0.81',
|
||||
'version' => 'v0.0.82',
|
||||
'company' => 'movar',//gyor
|
||||
'company_name' => "Freimann Kft.",
|
||||
'product_visiblity' => 'account',// on reception which products to display. account or global
|
||||
|
||||
Loading…
Reference in New Issue
Block a user