public function __construct(NewCustomer $customerToAdd) { if (is_string($customerToAdd->getName()) && strlen(trim($customerToAdd->getName())) > 1) { $this->name = $customerToAdd->getName(); } else { throw new \Toeswade\Exceptions\TooShortCustomerNameException('Name has to be string and at least 2 characters long'); } if (is_string($customerToAdd->getSurname()) && strlen(trim($customerToAdd->getSurname())) > 1) { $this->surname = $customerToAdd->getSurname(); } else { throw new \Toeswade\Exceptions\TooShortCustomerSurnameException('Surname has to be string and at least 2 characters long'); } if (ctype_digit($customerToAdd->getTelephone()) && preg_match_all("/[0-9]/", trim($customerToAdd->getTelephone())) >= 8) { $this->telephone = $customerToAdd->getTelephone(); } else { throw new \Toeswade\Exceptions\WrongCustomerTelephoneException('Telephone is has to be number and at least 8 digits long'); } if (filter_var($customerToAdd->getEmail(), FILTER_VALIDATE_EMAIL)) { $this->email = $customerToAdd->getEmail(); } else { throw new \Toeswade\Exceptions\WrongCustomerEmailException('Email has to be a valid email adress, i.e. name@host.com'); } if ($customerToAdd->getId()) { $this->id = $customerToAdd->getId(); } }
static function CheckCustomerDetWithDate($feasible, $area, $from_date, $to_date, $assign_employee) { $cust_det = DB::table('cust_det')->get(); if ($cust_det) { foreach ($cust_det as $key) { $crf_nos[] = $key->crf_no; } } if ($area[0] == "all") { $customers = DB::table('new_customers')->join('pre_activation_status', 'pre_activation_status.crf_no', '=', 'new_customers.application_no')->whereNotIn('new_customers.application_no', $crf_nos)->where('pre_activation_status.activation', 0)->whereBetween('new_customers.application_date', [$from_date, $to_date])->get(); } else { if ($assign_employee) { $customers = DB::table('new_customers')->join('pre_activation_status', 'pre_activation_status.crf_no', '=', 'new_customers.application_no')->whereNotIn('new_customers.application_no', $crf_nos)->where('pre_activation_status.activation', 0)->whereBetween('new_customers.application_date', [$from_date, $to_date])->where('new_customers.assign_employee', '=', $assign_employee)->get(); } else { $customers = DB::table('new_customers')->join('pre_activation_status', 'pre_activation_status.crf_no', '=', 'new_customers.application_no')->whereNotIn('new_customers.application_no', $crf_nos)->where('pre_activation_status.activation', 0)->whereBetween('new_customers.application_date', [$from_date, $to_date])->whereIn('new_customers.address3', $area)->get(); } } if (count($customers) != 0) { foreach ($customers as $key) { $crf[] = $key->application_no; } } else { $crf = NULL; } if ($feasible) { $pre_activation = NewCustomer::CheckPreActivation($feasible, $crf); } else { $pre_activation = $crf; } return $pre_activation; }
public function store() { $ticket = new Ticket(); $body = Input::get('message'); $ticket->name = Input::get('name'); $ticket->mobile = Input::get('mobile'); $ticket->email = Input::get('email'); $ticket->address = Input::get('address'); $ticket->ticket_type_id = Input::get('ticket_type_id'); $ticket->city_id = 12; $ticket->requirement = Input::get('requirement'); $assigned_to = Input::get('employee_id'); $ticket->assigned_to = $assigned_to; $ticket->assigned_by = Auth::employee()->get()->employee_identity; if (Input::get('crf_no')) { $ticket->crf_no = Input::get('crf_no'); $area = NewCustomer::where('application_no', $ticket->crf_no)->first()->address3; } else { $ticket_open = Ticket::where('account_id', Input::get('account_id'))->where('status_id', 3)->first(); $ticket_process = Ticket::where('account_id', Input::get('account_id'))->where('status_id', 5)->first(); if ($ticket_open || $ticket_process) { Session::flash('message', 'Ticket has been taken which status open'); return Redirect::back(); return Redirect::back()->with('failure', 'Ticket has been taken which status open'); } $ticket->account_id = Input::get('account_id'); $area = CusDet::where('account_id', $ticket->account_id)->first()->address3; } $ticket->area = $area; $ticket->active = 1; $ticket->save(); $ticket->generateTicketNo(); $ticket->updateStatus(); if ($ticket->ticket_type_id == 28) { $team_type = "configuration"; } else { if ($ticket->ticket_type_id == 29) { $team_type = "account"; } else { if ($ticket->ticket_type_id == 41) { $team_type = "Incident"; } else { if ($ticket->ticket_type_id == 27) { $team_type = Masterdata::where('id', Input::get('ticket_type'))->first()->name; } } } } //var_dump($team_type); die; $ticket->AssignUpdate($ticket->requirement, $team_type, 0); $employee = Employee::where('employee_identity', '=', Input::get('employee_id'))->get()->first(); if ($employee) { $senderId = "OODOOS"; $message = 'complaint ' . 'Ticket No ' . $ticket->ticket_no . ' ' . $ticket->name . ' ' . $ticket->account_id . ' ' . $ticket->mobile . ' ' . $ticket->address; $mobileNumber = $employee->mobile; $to_mail = Input::get('email'); app('MailController')->autoMessage($to_mail, '*****@*****.**', 'Ticket Raised', $ticket->ticket_no, $body, $assigned_to); $return = PaymentTransaction::sendsms($mobileNumber, $senderId, $message); } //return Redirect::back()->with('success','Succesfully Created'); Session::flash('message', 'Successfully Created'); return Redirect::back(); }