public function actionSaveReport()
 {
     $model = new UserReports();
     $model->user_id = (int) Yii::app()->user->id;
     $model->client_id = 0;
     $model->action = 1;
     $model->comment = $_POST['comment'];
     $model->date = date('Y-m-d');
     $model->save();
     $this->render('index');
     Yii::app()->user->setFlash('success', "Запись добавлена в отчет");
     Yii::app()->clientScript->registerScript('myHideEffect', '$(".info").animate({opacity: 1.0}, 30).fadeOut("slow");', CClientScript::POS_READY);
 }
 public function actionSaveSpecOrders()
 {
     $comment = $_POST['comment'];
     if (empty($comment)) {
         echo 'Заполните коментарий';
         return false;
     }
     $model = new UserReports();
     $model->user_id = (int) Yii::app()->user->id;
     $model->client_id = 0;
     $model->action = 5;
     $model->comment = $comment;
     $model->date = date('Y-m-d');
     $r = $model->save();
     if ($r == true) {
         echo 'Запись успешно добавлена в отчет';
     } else {
         echo 'Ошибка в сохранени';
     }
 }
示例#3
0
 public function actionSaveCall()
 {
     $user = User::model()->find('id=:id', array(':id' => Yii::app()->user->id));
     $user_name = $user['first_name'] . ' ' . $user['last_name'];
     $id = $_POST['id'];
     $comment = $_POST['comment'];
     $post = Carrier::model()->findByPk($id);
     $post->Comment = $comment . '( ' . $user_name . ')';
     $post->Last_Activity_Date = date('Y-m-d');
     $post->save();
     $reports = new UserReports();
     $reports->client_id = (int) $id;
     $reports->user_id = (int) Yii::app()->user->id;
     $reports->action = 1;
     $reports->comment = $comment;
     $reports->date = date('Y-m-d');
     $reports->save();
     $model = new Carrier('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Carrier'])) {
         $model->attributes = $_GET['Carrier'];
     }
     $this->render('admin', array('model' => $model));
 }
示例#4
0
 public function actionSetReport()
 {
     $id = $_POST['id'];
     $comment = $_POST['comment'];
     if (empty($comment)) {
         echo 'Комментарий не может быть пустым';
         return;
     }
     $act = $_POST['action'];
     if ($act == 'button_call') {
         $action = 1;
     } elseif ($act == 'button_mail') {
         $action = 6;
     } elseif ($act == 'button_meet') {
         $action = 2;
     } elseif ($act == 'button_agreement') {
         $action = 3;
     } elseif ($act == 'button_other') {
         $action = 4;
     }
     $model = new UserReports();
     $model->client_id = (int) $id;
     $model->user_id = (int) Yii::app()->user->id;
     $model->action = (int) $action;
     $model->comment = $comment;
     $model->date = date('Y-m-d');
     $r = $model->save();
     if ($r == true) {
         echo 'Запись успешно добавлена в отчет';
     } else {
         echo 'Ошибка в сохранени';
     }
 }
 public function actionCreateDirection()
 {
     $Directory = new Direction();
     $Directory->date = $_POST['date'];
     $Directory->comment = $_POST['comment'];
     $Directory->cost = $_POST['cost'];
     $Directory->client = $_POST['client_name'];
     $Directory->Shipping = $_POST['route_name'];
     $Directory->carrier = $_POST['carrier_name'];
     $Directory->client_id = $_POST['client_id'];
     $Directory->carrier_id = $_POST['carrier_id'];
     $Directory->shipping_id = $_POST['route_id'];
     $Directory->manager_id = Yii::app()->user->id;
     $Directory->save();
     if ($Directory->save()) {
         $model = new UserReports();
         $model->user_id = (int) Yii::app()->user->id;
         $model->client_id = $_POST['client_id'];
         $model->action = 3;
         $model->comment = $_POST['comment'];
         $model->date = $_POST['date'];
         $model->save();
     }
     $this->redirect(array('view', 'id' => $Directory->id));
 }
示例#6
0
 public static function saveTasksFilter($request, $filters, $sf_user, $filter_type = 'filter')
 {
     $report_type = Tasks::getReportType($request, $filter_type);
     if ($request->getParameter('update_user_filter') > 0) {
         $r = Doctrine_Core::getTable('UserReports')->createQuery()->addWhere('id=?', $request->getParameter('update_user_filter'))->addWhere('users_id=?', $sf_user->getAttribute('id'))->addWhere('report_type=?', $report_type)->fetchOne();
         if ($r) {
             $r->setName($request->getParameter('name'));
             $r->setIsDefault($request->getParameter('is_default'));
         } else {
             return false;
         }
     } else {
         $r = new UserReports();
         $r->setName($request->getParameter('name'));
         $r->setUsersId($sf_user->getAttribute('id'));
         $r->setReportType($report_type);
         $r->setIsDefault($request->getParameter('is_default'));
     }
     if (!$request->hasParameter('update_user_filter') or $request->hasParameter('update_user_filter') and $request->hasParameter('update_values')) {
         foreach ($filters as $table => $fstr) {
             switch ($table) {
                 case 'TasksPriority':
                     $r->setTasksPriorityId($fstr);
                     break;
                 case 'TasksStatus':
                     $r->setTasksStatusId($fstr);
                     break;
                 case 'TasksTypes':
                     $r->setTasksTypeId($fstr);
                     break;
                 case 'TasksLabels':
                     $r->setTasksLabelId($fstr);
                     break;
                 case 'TasksGroups':
                     $r->setTasksGroupsId($fstr);
                     break;
                 case 'Versions':
                     $r->setVersionsId($fstr);
                     break;
                 case 'ProjectsPhases':
                     $r->setProjectsPhasesId($fstr);
                     break;
                 case 'TasksAssignedTo':
                     $r->setAssignedTo($fstr);
                     break;
                 case 'TasksCreatedBy':
                     $r->setCreatedBy($fstr);
                     break;
                 case 'Projects':
                     $r->setProjectsId($fstr);
                     break;
                 case 'ProjectsPriority':
                     $r->setProjectsPriorityId($fstr);
                     break;
                 case 'ProjectsStatus':
                     $r->setProjectsStatusId($fstr);
                     break;
                 case 'ProjectsTypes':
                     $r->setProjectsTypeId($fstr);
                     break;
                 case 'ProjectsGroups':
                     $r->setProjectsGroupsId($fstr);
                     break;
             }
         }
     }
     $r->save();
     if ($r->getIsDefault() == 1) {
         Doctrine_Query::create()->update('UserReports')->set('is_default', 0)->addWhere('id != ?', $r->getId())->addWhere('report_type=?', $report_type)->execute();
     }
 }