Exemplo n.º 1
0
 /**
  * @author Thuanth6589 <*****@*****.**>
  * delete sssale
  */
 public function action_delete()
 {
     if (Input::method() == 'POST') {
         $sssale_id = Input::post('sssale_id');
         $result = 'error-' . Input::post('panel_index');
         $message = \Constants::$message_delete_error;
         if (isset($sssale_id) && ($sssale = \Model_Sssale::find_by_pk($sssale_id))) {
             if ($sssale->delete_data()) {
                 $result = 'success';
                 $message = \Constants::$message_delete_success;
             }
         }
         Session::set_flash($result, $message);
     }
     $url = Session::get('sssale_url') ? Session::get('sssale_url') : Uri::base() . 'master/sslist';
     return Response::redirect($url);
 }
Exemplo n.º 2
0
?>
					</div>
					<div>
						<?php 
if (isset($person->mobile) and $person->mobile != null) {
    echo '(固定)' . $person->mobile;
}
?>
					</div>
				</td>
			</tr>
			<tr>
				<th class="text-right">対象SS</th>
				<td colspan="3">
					<?php 
if (isset($person->sssale_id)) {
    $ss_id = Model_Sssale::find_by_pk($person->sssale_id)->ss_id;
    $partner_code = Model_Mss::find_by_pk($ss_id)->partner_code;
    $m_group_id = Model_Mpartner::find_by_pk($partner_code)->m_group_id;
    $group_name = Model_Mgroups::find_by_pk($m_group_id)->name;
    $partner_name = Model_Mpartner::find_by_pk($partner_code)->branch_name;
    $ss_name = Model_Mss::find_by_pk($ss_id)->ss_name;
    $sssale_name = Model_Sssale::find_by_pk($person->sssale_id)->sale_name;
    echo $group_name . $partner_name . $ss_name . $sssale_name;
}
?>
				</td>
			</tr>
		</table>
	</div>
</div>
Exemplo n.º 3
0
 /**
  * @author NamNT
  * action index
  */
 public function action_index()
 {
     $data = array();
     $is_view = array();
     $model = new \Model_Person();
     $employment = new \Model_Employment();
     $model_job = new \Model_Job();
     $model_order = new \Model_Orders();
     $model_user = new \Model_Muser();
     $sssale_id = null;
     $sssale_id_view = null;
     $order_id = null;
     $post_id = null;
     $data['person_info'] = null;
     $data['edit_person'] = null;
     $data['post_id'] = null;
     $data['job_id'] = $model_job->get_list_id();
     $data['person_id'] = \Input::get('person_id');
     $data['listusers_interview'] = array();
     $data['listusers_agreement'] = array();
     $data['listusers_training'] = array();
     $data['listusers_business'] = array();
     if (\Input::get('order_id')) {
         $order_id = \Input::get('order_id');
         $od = $model_order->get_order_info($order_id);
         $post_id = $od['post_id'];
         $data['post_id'] = $post_id;
         $data['order'] = $od;
         $data['order'] = $model_user->get_user_info_path($od['interview_user_id'], 'interview', $data['order']);
         $data['order'] = $model_user->get_user_info_path($od['agreement_user_id'], 'agreement', $data['order']);
         $data['order'] = $model_user->get_user_info_path($od['training_user_id'], 'training', $data['order']);
     }
     if (\Input::get('person_id')) {
         $person_info = \Model_Person::find(\Input::get('person_id'));
         $data['edit_person'] = $person_info;
         $data['edit_person']['interview_department_id'] = '';
         $data['edit_person']['agreement_department_id'] = '';
         $data['edit_person']['training_department_id'] = '';
         $data['edit_person']['business_department_id'] = '';
         $data['edit_person']['listusers_interview'] = array();
         $data['edit_person']['listusers_agreement'] = array();
         $data['edit_person']['listusers_training'] = array();
         $data['edit_person']['listusers_business'] = array();
         $data['edit_person'] = $model_user->get_user_info_path($person_info->interview_user_id, 'interview', $data['edit_person']);
         $data['edit_person'] = $model_user->get_user_info_path($person_info->agreement_user_id, 'agreement', $data['edit_person']);
         $data['edit_person'] = $model_user->get_user_info_path($person_info->training_user_id, 'training', $data['edit_person']);
         $data['edit_person'] = $model_user->get_user_info_path($person_info->business_user_id, 'business', $data['edit_person']);
         $data['person_info'] = $data['edit_person'];
         if ($edit_data = $person_info->edit_data) {
             $person_info['application_date'] = substr($person_info['application_date'], 0, 16);
             $data['edit_person'] = json_decode($edit_data, true);
             $data['edit_person']['interview_user_id'] = isset($data['edit_person']['interview_user_id']) ? $data['edit_person']['interview_user_id'] : '';
             $data['edit_person']['agreement_user_id'] = isset($data['edit_person']['agreement_user_id']) ? $data['edit_person']['agreement_user_id'] : '';
             $data['edit_person']['training_user_id'] = isset($data['edit_person']['training_user_id']) ? $data['edit_person']['training_user_id'] : '';
             $data['edit_person']['business_user_id'] = isset($data['edit_person']['business_user_id']) ? $data['edit_person']['business_user_id'] : '';
             $data['edit_person']['interview_department_id'] = '';
             $data['edit_person']['agreement_department_id'] = '';
             $data['edit_person']['business_department_id'] = '';
             $data['edit_person']['training_department_id'] = '';
             $data['edit_person']['listusers_interview'] = array();
             $data['edit_person']['listusers_agreement'] = array();
             $data['edit_person']['listusers_training'] = array();
             $data['edit_person']['listusers_business'] = array();
             $data['edit_person'] = $model_user->get_user_info_path($data['edit_person']['interview_user_id'], 'interview', $data['edit_person']);
             $data['edit_person'] = $model_user->get_user_info_path($data['edit_person']['agreement_user_id'], 'agreement', $data['edit_person']);
             $data['edit_person'] = $model_user->get_user_info_path($data['edit_person']['training_user_id'], 'training', $data['edit_person']);
             $data['edit_person'] = $model_user->get_user_info_path($data['edit_person']['business_user_id'], 'business', $data['edit_person']);
             $data['is_view'] = \Utility::compare_json_data($person_info, $edit_data);
         }
     }
     $data_filter['field'] = array('step' => 4, 'type' => 1, 'label' => array('group' => 'グループ', 'partner' => '取引先(受注先)', 'ss' => 'SS', 'sslist' => '売上形態'));
     if ($data['edit_person']) {
         $sssale_id = $data['edit_person']['sssale_id'];
     }
     if ($data['person_info']) {
         $sssale_id_view = $data['person_info']['sssale_id'];
     }
     $data_filter['datafilter'] = \Presenter_Group_Filter::edit($data_filter['field']['step'], $data_filter['field']['type'], $sssale_id, $sssale_id_view);
     if (\Input::method() == 'POST') {
         $datas = array();
         $dataPost = \Input::post();
         $datas = $model->get_person_data($dataPost);
         $action = 'add';
         foreach (\Input::post() as $key => $value) {
             if (\Input::post($key) == '') {
                 $datas[$key] = null;
             }
         }
         if (!\Model_Sssale::find_by_pk($datas['sssale_id'])) {
             Session::set_flash('error', '売上形態は存在しません');
         } else {
             if (\Input::get('person_id')) {
                 $action = 'edit';
                 if (!($model = $model->find(\Input::get('person_id')))) {
                     Session::set_flash('error', '応募者は存在しません');
                     Response::redirect('job/persons');
                 }
                 $model->status = \Constants::$_status_person['pending'];
                 $data_temp = Input::post();
                 if (!$data_temp['business_user_id']) {
                     $data_temp['business_user_id'] = $this->get_default_business_user_id($data_temp['sssale_id']);
                 }
                 if (!$data_temp['interview_user_id']) {
                     $data_temp['interview_user_id'] = $this->get_default_business_user_id($data_temp['sssale_id']);
                 }
                 if (!$data_temp['agreement_user_id']) {
                     $data_temp['agreement_user_id'] = $this->get_default_business_user_id($data_temp['sssale_id']);
                 }
                 $model->edit_data = json_encode($model->get_person_data($data_temp));
                 if ($model->save()) {
                     Session::set_flash('success', \Constants::$message_create_success);
                     Response::redirect(Uri::base() . 'job/persons');
                 }
             } else {
                 $datas['created_at'] = date('Y-m-d H:i:s');
                 if (!$datas['business_user_id']) {
                     $datas['business_user_id'] = $this->get_default_business_user_id($datas['sssale_id']);
                 }
                 if (!$datas['interview_user_id']) {
                     $datas['interview_user_id'] = $this->get_default_business_user_id($datas['sssale_id']);
                 }
                 if (!$datas['agreement_user_id']) {
                     $datas['agreement_user_id'] = $this->get_default_business_user_id($datas['sssale_id']);
                 }
                 $model->set($datas);
                 if ($model->save()) {
                     if ($action == 'add') {
                         $person_obj = $model->find($model->person_id);
                         $sssale_id_mail = $person_obj->sssale_id != '' ? $person_obj->sssale_id : 0;
                         $person_data = $model->get_data_for_mail($sssale_id_mail);
                         if (count($person_data)) {
                             //send mail
                             $model_user = new \Model_Muser();
                             $department_id = $person_data['0']['department_id'] ? $person_data['0']['department_id'] : 0;
                             $list_email_department = $model_user->get_list_mail_department($department_id);
                             $datamail_department = array('m_group' => isset($person_data['0']['name']) ? $person_data['0']['name'] : '', 'branch_name' => isset($person_data['0']['branch_name']) ? $person_data['0']['branch_name'] : '', 'ss_name' => isset($person_data['0']['ss_name']) ? $person_data['0']['ss_name'] : '', 'sale_name' => isset($person_data['0']['sale_name']) ? $person_data['0']['sale_name'] : '', 'list_emails' => $list_email_department, 'last_id' => $model->person_id);
                             $model->sendmail_department($datamail_department);
                         }
                     }
                     Session::set_flash('success', \Constants::$message_create_success);
                 } else {
                     Session::set_flash('error', \Constants::$message_create_error);
                 }
             }
         }
         if (\Fuel\Core\Cookie::get('person_url')) {
             Response::redirect(\Fuel\Core\Cookie::get('person_url'));
         } else {
             Response::redirect('job/persons');
         }
     }
     $this->template->title = 'UOS求人システム';
     $this->template->content = \View::forge('persons/person', $data);
     $this->template->content->filtergroup = \Presenter::forge('group/filter')->set('custom', $data_filter);
 }
Exemplo n.º 4
0
 public function action_index()
 {
     $data = array();
     $ujob_obj = new \Model_Ujob();
     $job_id = \Fuel\Core\Input::get('job_id', '');
     $copy_job_id = \Fuel\Core\Input::get('copy_job_id', '');
     $job_id_get_data = $copy_job_id ? $copy_job_id : $job_id;
     $data_default = $ujob_obj->get_info_job($job_id_get_data);
     if ($data_default['job_id'] == null && $job_id) {
         \Fuel\Core\Response::redirect(\Fuel\Core\Uri::base() . 'job/job');
     }
     if ($copy_job_id) {
         $data_default['edit_data'] = null;
     }
     $data = $data_default;
     $data['old_data'] = $data_default;
     $data['old_data']['job_add'] = array();
     $data['old_data']['job_recruit'] = array();
     $data['old_data']['m_image'] = array();
     $data['job_add'] = array();
     $data['job_recruit'] = array();
     $data['m_image'] = array();
     $label = array('group' => 'グループ', 'partner' => '取引先(受注先)', 'ss' => 'SS', 'sslist' => '売上形態');
     $data_filter['field'] = array('step' => 4, 'type' => 1, 'label' => $label);
     if (\Fuel\Core\Input::method() == 'POST') {
         $data_post = \Fuel\Core\Input::post();
         if (!isset($data_post['employment_mark'])) {
             $data_post['employment_mark'] = array();
         }
         if (!isset($data_post['work_time_view'])) {
             $data_post['work_time_view'] = array();
         }
         if (!isset($data_post['trouble'])) {
             $data_post['trouble'] = array();
         }
         $check = true;
         if (!\Model_Sssale::find_by_pk($data_post['sssale_id'])) {
             \Fuel\Core\Session::set_flash('report', '売上形態は存在しません');
             $check = false;
         }
         foreach ($data_post['media_list'] as $k => $v) {
             if ($v == '') {
                 unset($data_post['media_list'][$k]);
                 continue;
             }
             if (!\Model_Mmedia::find_by_pk($v)) {
                 \Fuel\Core\Session::set_flash('report', '媒体は存在しません');
                 $check = false;
                 break;
             }
         }
         if ($check) {
             $this->save($ujob_obj, $job_id, $data_post);
         }
     }
     if ($data_default['edit_data']) {
         $data = json_decode($data_default['edit_data'], true);
         $data_default_edit = $ujob_obj->get_info_job('');
         $data = $data + $data_default_edit;
         $data = \Utility::set_standard_data_job($data, false);
         $ujob_obj->convert_job_add_recruit($data);
         $data['m_image'] = $ujob_obj->get_list_m_image($data['image_list']);
         /*Get old data*/
         $data['old_data'] = $data_default;
         $data['old_data']['job_add'] = $ujob_obj->get_list_job_add($job_id);
         $data['old_data']['job_recruit'] = $ujob_obj->get_list_job_recruit($job_id);
         $data['old_data']['m_image'] = $ujob_obj->get_list_m_image($data['old_data']['image_list']);
     } else {
         if ($job_id_get_data) {
             $data['job_add'] = $ujob_obj->get_list_job_add($job_id_get_data);
             $data['job_recruit'] = $ujob_obj->get_list_job_recruit($job_id_get_data);
             $data['m_image'] = $ujob_obj->get_list_m_image($data['image_list']);
             $data['old_data']['job_add'] = $data['job_add'];
             $data['old_data']['job_recruit'] = $data['job_recruit'];
             $data['old_data']['m_image'] = $data['m_image'];
         }
     }
     $data['is_show_old'] = array();
     if ($job_id) {
         $data['is_show_old'] = $this->_compare_other_data_json($data['old_data'], $data_default['edit_data']);
     }
     $data_filter['datafilter'] = \Presenter_Group_Filter::edit($data_filter['field']['step'], $data_filter['field']['type'], $data['sssale_id'], $data['old_data']['sssale_id']);
     $data['interview_des'] = '面接は勤務地または近隣にて行います。';
     $data['apply_method'] = '下記のフリーダイヤルまたは「応募する」ボタンより、応募シートに必要事項を入力の上、送信して下さい。※応募書類は返却致しません。ご了承ください。';
     $data['apply_process'] = '追って、こちらからご連絡差し上げます。※ご連絡は平日に致します。★ネット応募は24h受付中!!';
     $this->template->title = 'UOS求人システム';
     $this->template->content = \Fuel\Core\View::forge('job/index', $data);
     $this->template->content->filtergroup = \Presenter::forge('group/filter')->set('custom', $data_filter);
 }
Exemplo n.º 5
0
 /**
  * @author Bui Dang <*****@*****.**>
  * @params: send data edit presenter
  */
 public static function edit($step = null, $type = null, $id = null, $id_label = null)
 {
     $p_partner = new \Model_Mpartner();
     $p_mss = new \Model_Mss();
     $p_sssale_id = new \Model_Sssale();
     if ($order_id = \Fuel\Core\Input::get('order_id') and \Fuel\Core\Uri::current() == \Fuel\Core\Uri::base() . 'job/person') {
         $sssale_id_order = Model_Orders::find_by_pk($order_id)->agreement_type;
         if (!isset($order_id) or $order_id != 0) {
             $ss_id_order = Model_Orders::find_by_pk($order_id)->ss_id;
         }
     }
     switch ($step) {
         case 2:
             $label_arr_id = array();
             $arr_id = array();
             $arr_edit = array();
             $partner_code = $id;
             $label_partner_code = $id_label;
             if (isset($id_label)) {
                 $label_group_id = Model_Mpartner::find_by_pk($label_partner_code)->m_group_id;
                 $label_arr_id = array('label_m_group_id' => $label_group_id, 'label_partner_code' => $label_partner_code);
             }
             if ($m_partner = \Model_Mpartner::find_by_pk($partner_code)) {
                 $group_id = $m_partner->m_group_id;
                 $arr_edit_partner = $p_partner->get_partner_group($group_id, $type);
                 $arr_id = array('m_group_id' => $group_id, 'partner_code' => $partner_code);
                 $arr_edit = array('edit_partner' => $arr_edit_partner);
             }
             return array_merge($arr_id, $arr_edit, $label_arr_id);
             break;
         case 3:
             $label_arr_id = array();
             $arr_id = array();
             $arr_edit = array();
             $label_ss_id = $id_label;
             $ss_id = $id;
             if (!isset($type) || $type == '') {
                 return false;
             }
             if (isset($id_label)) {
                 $label_partner_code = \Model_Mss::find_by_pk($label_ss_id)->partner_code;
                 $label_group_id = Model_Mpartner::find_by_pk($label_partner_code)->m_group_id;
                 $label_arr_id = array('label_ss_id' => $label_ss_id, 'label_m_group_id' => $label_group_id, 'label_partner_code' => $label_partner_code);
             }
             if ($m_ss = \Model_Mss::find_by_pk($ss_id) and $m_group = \Model_Mpartner::find_by_pk($m_ss->partner_code)) {
                 $partner_code = $m_ss->partner_code;
                 $group_id = $m_group->m_group_id;
                 $arr_edit_partner = $p_partner->get_partner_group($group_id, $type);
                 $arr_edit_ss_id = $p_mss->get_ss_partner($partner_code);
                 $arr_id = array('ss_id' => $ss_id, 'partner_code' => $partner_code, 'm_group_id' => $group_id);
                 $arr_edit = array('edit_partner' => $arr_edit_partner, 'edit_ss_id' => $arr_edit_ss_id);
             }
             return array_merge($label_arr_id, $arr_id, $arr_edit);
             break;
         case 4:
             $label_arr_id = array();
             $arr_id = array();
             $arr_edit = array();
             $sssale_id = $id;
             if (!isset($sssale_id) and isset($sssale_id_order) and $sssale_id_order != 0) {
                 $sssale_id = $sssale_id_order;
             }
             $label_sssale_id = $id_label;
             if (!isset($type) || $type == '') {
                 return false;
             }
             if (isset($id_label)) {
                 $label_ss_id = \Model_Sssale::find_by_pk($label_sssale_id)->ss_id;
                 $label_partner_code = \Model_Mss::find_by_pk($label_ss_id)->partner_code;
                 $label_group_id = Model_Mpartner::find_by_pk($label_partner_code)->m_group_id;
                 $label_arr_id = array('label_sssale_id' => $label_sssale_id, 'label_ss_id' => $label_ss_id, 'label_m_group_id' => $label_group_id, 'label_partner_code' => $label_partner_code);
             }
             if ($m_ss_sale = \Model_Sssale::find_by_pk($sssale_id) and $m_ss = \Model_Mss::find_by_pk($m_ss_sale->ss_id) and $m_partner = \Model_Mpartner::find_by_pk($m_ss->partner_code)) {
                 $ss_id = $m_ss_sale->ss_id;
                 $partner_code = $m_ss->partner_code;
                 $group_id = $m_partner->m_group_id;
                 $arr_edit_partner = $p_partner->get_partner_group($group_id, $type);
                 $arr_edit_ss_id = $p_mss->get_ss_partner($partner_code);
                 $arr_edit_ss_sale = $p_sssale_id->get_sssale_ss($ss_id);
                 $arr_id = array('sssale_id' => $sssale_id, 'ss_id' => $ss_id, 'partner_code' => $partner_code, 'm_group_id' => $group_id);
                 $arr_edit = array('edit_partner' => $arr_edit_partner, 'edit_ss_id' => $arr_edit_ss_id, 'edit_ss_sale' => $arr_edit_ss_sale);
             } else {
                 if (isset($ss_id_order) and $m_ss = \Model_Mss::find_by_pk($ss_id_order) and $m_partner = \Model_Mpartner::find_by_pk($m_ss->partner_code)) {
                     $ss_id = $ss_id_order;
                     $partner_code = $m_ss->partner_code;
                     $group_id = $m_partner->m_group_id;
                     $arr_edit_partner = $p_partner->get_partner_group($group_id, $type);
                     $arr_edit_ss_id = $p_mss->get_ss_partner($partner_code);
                     $arr_edit_ss_sale = $p_sssale_id->get_sssale_ss($ss_id);
                     $arr_id = array('sssale_id' => $sssale_id, 'ss_id' => $ss_id, 'partner_code' => $partner_code, 'm_group_id' => $group_id);
                     $arr_edit = array('edit_partner' => $arr_edit_partner, 'edit_ss_id' => $arr_edit_ss_id, 'edit_ss_sale' => $arr_edit_ss_sale);
                 }
             }
             return array_merge($label_arr_id, $arr_id, $arr_edit);
             break;
         default:
             return false;
             break;
     }
 }
Exemplo n.º 6
0
 /**
  * @author Thuanth6589 <*****@*****.**>
  * create/update sssale
  * @param array $data
  * @return bool
  * @throws Exception
  */
 public function save_data($data = array())
 {
     if (empty($data)) {
         return false;
     }
     $data['updated_at'] = date('Y-m-d H:i:s', time());
     if (!isset($data['sssale_id'])) {
         $data['created_at'] = date('Y-m-d H:i:s', time());
         $sssale = Model_Sssale::forge();
     } else {
         $sssale = Model_Sssale::find_by_pk($data['sssale_id']);
     }
     if (!isset($sssale)) {
         return false;
     }
     $sssale->set($data);
     if ($sssale->save()) {
         return true;
     }
     return false;
 }
Exemplo n.º 7
0
 public function action_update_status()
 {
     if (\Input::method() == 'POST') {
         $status = \Input::post('status');
         $order_id = \Input::post('order_id');
         $reason = \Input::post('reason', null);
         $result = 'error';
         $message = '保存に失敗しました。';
         $model_orders = new \Model_Orders();
         $order_info = \Model_Orders::find_by_pk($order_id);
         if (!$order_info) {
             return 'failed';
         }
         if ($status == 2) {
             if ($user_login = Session::get('login_info')) {
                 $model_orders->order_update(array('order_user_id' => $user_login['user_id']), $order_id);
             }
         }
         $db_status = array('status' => $status);
         if ($model_orders->order_update($db_status, $order_id)) {
             if ($status == 1 || $status == -1) {
                 //get list media
                 $model_media = new \Model_Mmedia();
                 $listmedias = $model_media->get_list_all_media();
                 $media_name = null;
                 if ($order_info->post_id && $listmedias != null) {
                     $listmedias = array_column($listmedias, 'media_name', 'm_media_id');
                     $post_info = \Model_Mpost::find_by_pk($order_info->post_id);
                     if ($post_info) {
                         $media_id = $post_info->m_media_id;
                         $media_name = isset($listmedias[$media_id]) ? $listmedias[$media_id] : null;
                     }
                 }
                 //get list ss
                 $model_ss = new \Model_Mss();
                 $listss = $model_ss->get_list_all_ss();
                 $ssitem = null;
                 if ($order_info->ss_list && $listss != null) {
                     $listss_name = array_column($listss, 'ss_name', 'ss_id');
                     $ss_list_item = explode(',', trim($order_info->ss_list, ','));
                     foreach ($ss_list_item as $key => $value) {
                         if (array_key_exists($value, $listss_name)) {
                             $ssitem .= $listss_name[$value] . ',';
                         }
                     }
                 }
                 $ssitem = trim($ssitem, ',');
                 $agreement_type = null;
                 if ($order_info->agreement_type) {
                     $agreement = \Model_Sssale::find_by_pk($order_info->agreement_type);
                 }
                 $agreement_type = isset($agreement->sale_name) ? $agreement->sale_name : null;
                 if ($order_info->ss_id) {
                     $ss_info = \Model_Mss::find_by_pk($order_info->ss_id);
                     $ss_name = isset($ss_info->ss_name) ? $ss_info->ss_name : null;
                 }
                 $model_user = new \Model_Muser();
                 //user logging
                 $user_login = \Session::get('login_info');
                 $user_id = $user_login['user_id'];
                 $user_info = $model_user->get_user_info($user_id);
                 $department_id = $user_login['department_id'];
                 if ($user_info) {
                     $department_id = $user_info['department_id'];
                 }
                 $list_emails = $model_user->get_list_email_by_departmentid($department_id, $user_id, 1);
                 $maildata = array('order_id' => $order_id, 'list_media_name' => $media_name, 'agreement_type' => $agreement_type, 'ss_name' => $ss_name, 'ss_list_name' => $ssitem, 'reason' => $reason, 'list_emails' => $list_emails);
                 $model_orders->sendmail($status, $maildata, $order_info->create_id);
             }
             $result = 'success';
             switch ($status) {
                 case -1:
                     $message = '非承認しました';
                     break;
                 case 1:
                     $message = '承認しました';
                     break;
                 case 2:
                     $message = '確定しました。';
                     break;
                 case 3:
                     $message = '停止しました。';
                     break;
                 default:
                     $message = '非承認しました';
                     break;
             }
         }
         \Session::set_flash($result, $message);
         return 'true';
     }
 }
Exemplo n.º 8
0
 public function approve_data($id)
 {
     try {
         $obj = static::forge()->find_by_pk($id);
         $data = array();
         if (count($obj)) {
             $data_old = $obj->_data;
             $data_job_add = array();
             $data_job_rec = array();
             if ($data_old['edit_data']) {
                 $data = json_decode($data_old['edit_data'], true);
                 if (!Model_Sssale::find_by_pk($data['sssale_id'])) {
                     return 0;
                 }
                 $data_job_add = Utility::set_data_job_add_recruit($data, $id);
                 $data_job_rec = Utility::set_data_job_add_recruit($data, $id, 'job_recruit_sub_title', 'job_recruit_text');
                 $data = Utility::set_standard_data_job($data, true, $this->_data_default);
             } else {
                 $data['updated_at'] = date('Y-m-d H:i');
                 $data['status'] = 1;
                 $obj->set($data);
                 $obj->is_new(false);
                 return (bool) $obj->save();
             }
             DB::start_transaction();
             $data['is_available'] = $data_old['is_available'];
             $data['status'] = 1;
             $data['edit_data'] = null;
             $obj->set($data);
             $obj->is_new(false);
             $res = (bool) $obj->save();
             if ($res) {
                 $obj_add = new Model_Jobadd();
                 $obj_rec = new Model_Jobrecruit();
                 $res_flag = false;
                 if ($obj_add->delete_data($id) >= 0) {
                     $res_flag = true;
                 }
                 if ($res_flag && $obj_add->insert_multi_data($data_job_add, $this) === false) {
                     $res_flag = false;
                 }
                 if ($res_flag && $obj_rec->delete_data($id) >= 0) {
                     $res_flag = true;
                 } else {
                     $res_flag = false;
                 }
                 if ($res_flag && $obj_rec->insert_multi_data($data_job_rec, $this) === false) {
                     $res_flag = false;
                 }
                 if ($res_flag) {
                     \DB::commit_transaction();
                     return true;
                 } else {
                     \DB::rollback_transaction();
                     return false;
                 }
             }
             return false;
         }
         return false;
     } catch (Exception $e) {
         \DB::rollback_transaction();
         throw $e;
         return false;
     }
 }
Exemplo n.º 9
0
 public function csv_process($list_orders)
 {
     if (empty($list_orders)) {
         return array();
     }
     $csv_all_data = array();
     $stt = 0;
     foreach ($list_orders as $order) {
         $csv_data = array();
         $total_price = 0;
         $order_ss_list = trim($order['ss_list'], ',');
         $ss_list = explode(',', $order_ss_list);
         //get media info
         $price_int = $price_blance = '';
         if ($order['post_id']) {
             $post = \Model_Mpost::find_by_pk($order['post_id']);
             if ($post) {
                 $media = \Model_Mmedia::find_by_pk($post->m_media_id);
                 if ($media) {
                     if ($media->type == 1) {
                         $type = '自力';
                     }
                     if ($media->type == 2) {
                         $type = '他力';
                     }
                     if ($media->budget_type == 1) {
                         $budget_type = '求人費';
                     }
                     if ($media->budget_type == 2) {
                         $budget_type = '販促費';
                     }
                     if ($media->is_web_reprint == 1) {
                         $is_web_reprint = 'あり';
                     }
                     if ($media->is_web_reprint == 0) {
                         $is_web_reprint = 'なし';
                     }
                     $classification = isset(\Constants::$media_classification[$media->classification]) ? \Constants::$media_classification[$media->classification] : '';
                     $partner = \Model_Mpartner::find_by_pk($media->partner_code);
                     $media_name = $media->media_name;
                     $total_ss = 1 + count($ss_list);
                     if ($media->is_web_reprint == 1) {
                         $total_ss = (1 + count($ss_list)) * 2;
                     }
                     $post_price = $post->price != null ? $post->price : 0;
                     $price = $post_price / $total_ss;
                     $price_int = (int) $price;
                     $price_blance = $price_int + $post_price % $total_ss;
                 }
             }
         }
         //get partner and group by ss_id
         $data_ss = $this->get_ss_info($order['ss_id']);
         //ss_sale info
         if ($order['agreement_type']) {
             $ss_sale = \Model_Sssale::find_by_pk($order['agreement_type']);
             if ($ss_sale) {
                 $sale_name = $ss_sale->sale_name;
                 if ($ss_sale->sale_name == null) {
                     $sale_name = isset(\Constants::$sale_type[$ss_sale->sale_type]) ? \Constants::$sale_type[$ss_sale->sale_type] : '';
                 }
             }
         }
         $csv_data[$order['order_id']][] = array($order['order_id'], $data_ss['group_info_name'], $data_ss['ss_partner_name'], $data_ss['ss_info_ss_name'], $data_ss['department_name'], $data_ss['department_id'], $data_ss['user_info_name'], isset($sale_name) ? $sale_name : '', $order['request_date'] != null ? date('Y/m/d', strtotime($order['request_date'])) : '', $order['post_date'] != null ? date('Y/m/d', strtotime($order['post_date'])) : '', isset($type) ? $type : '', isset($budget_type) ? $budget_type : '', isset($classification) ? $classification : '', isset($is_web_reprint) ? $is_web_reprint : '', isset($media->m_media_id) ? $media->m_media_id : '', 'media_name' => isset($media_name) ? $media_name : '', isset($media->media_version_name) ? $media->media_version_name : '', isset($post->name) ? $post->name : '', isset($partner->branch_name) ? $partner->branch_name : '', 'price' => $stt == 0 ? $price_blance : $price_int, isset($post_price) ? $post_price : 0, $order['notes']);
         //if ss_list
         if ($order['ss_list']) {
             $order_ss_list = trim($order['ss_list'], ',');
             $ss_list = explode(',', $order_ss_list);
             foreach ($ss_list as $ss_key => $ss_item_id) {
                 $data_ss_id = $this->get_ss_info($ss_item_id);
                 $csv_data[$order['order_id']][] = array($order['order_id'], $data_ss_id['group_info_name'], $data_ss_id['ss_partner_name'], $data_ss_id['ss_info_ss_name'], $data_ss_id['department_name'], $data_ss_id['department_id'], $data_ss_id['user_info_name'], isset($sale_name) ? $sale_name : '', $order['request_date'] != null ? date('Y/m/d', strtotime($order['request_date'])) : '', $order['post_date'] != null ? date('Y/m/d', strtotime($order['post_date'])) : '', isset($type) ? $type : '', isset($budget_type) ? $budget_type : '', isset($classification) ? $classification : '', isset($is_web_reprint) ? $is_web_reprint : '', isset($media->m_media_id) ? $media->m_media_id : '', 'media_name' => isset($media_name) ? $media_name : '', isset($media->media_version_name) ? $media->media_version_name : '', isset($post->name) ? $post->name : '', isset($partner->branch_name) ? $partner->branch_name : '', 'price' => isset($price_int) ? $price_int : '', isset($post_price) ? $post_price : 0, $order['notes']);
             }
         }
         if (isset($media->is_web_reprint) && $media->is_web_reprint == 1) {
             foreach ($csv_data as $key => $val) {
                 foreach ($val as $k => $v) {
                     $v['media_name'] = $v['media_name'] . '(WEB転載)';
                     $csv_data[$key][] = $v;
                 }
             }
             foreach ($csv_data as $key => $val) {
                 $blance_2 = count($val) / 2;
                 $csv_data[$key][$blance_2]['price'] = $price_int;
             }
         }
         $csv_all_data[$order['order_id']] = $csv_data;
         $stt++;
     }
     return $csv_all_data;
 }
Exemplo n.º 10
0
                $sale_type = '';
            }
            $arr_ss_sale[$ss_sale['sssale_id']] = Constants::$sale_type[$sale_type] . ' ' . $ss_sale['sale_name'];
        }
        $arr_ss_sale = $default_ss_sale + $arr_ss_sale;
    }
    ?>
	<?php 
    echo Form::select('sssale_id', isset($customdata['sssale_id']) ? $customdata['sssale_id'] : '', $arr_ss_sale, array('class' => 'form-control'));
    ?>
		<?php 
    if ($is_diff_ss && isset($customdata['label_sssale_id'])) {
        ?>
			<span class="edit-before edit-before-ss">
			<?php 
        echo Constants::$sale_type[Model_Sssale::find_by_pk($customdata['label_sssale_id'])->sale_type] . ' ' . Model_Sssale::find_by_pk($customdata['label_sssale_id'])->sale_name;
        ?>
		</span>
		<?php 
    }
}
?>
</div>

<script type="text/javascript">
    /*get type if type = 1 ss, type = 2 media*/
    var type = <?php 
echo $type;
?>
     /*Custom label*/
    var l_group = '<?php