Mehrere Tickets 49, 50, 51, 52, 53
This commit is contained in:
parent
ae70577289
commit
e3495be8b8
61 changed files with 1904 additions and 344 deletions
|
|
@ -6,11 +6,11 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Services\Passolution;
|
||||
use App\Services\Util;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use App\Services\Util;
|
||||
use App\Services\Passolution;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
||||
/**
|
||||
* Class Booking
|
||||
|
|
@ -212,13 +212,13 @@ class Booking extends Model
|
|||
'travelagenda_id' => 'int',
|
||||
'paying_out' => 'int',
|
||||
'hold' => 'int',
|
||||
'airline_id' => 'int',
|
||||
//'airline_id' => 'int',
|
||||
'refund' => 'int',
|
||||
'xx_tkt' => 'int',
|
||||
'is_rail_fly' => 'bool',
|
||||
'comfort' => 'bool'
|
||||
|
||||
|
||||
'comfort' => 'bool',
|
||||
'airline_ids' => 'array',
|
||||
'participant_pass' => 'bool'
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
|
|
@ -255,6 +255,7 @@ class Booking extends Model
|
|||
'participant_firstname',
|
||||
'participant_birthdate',
|
||||
'participant_salutation_id',
|
||||
'participant_pass',
|
||||
'nationality_id',
|
||||
'ev_number',
|
||||
'merlin_knr',
|
||||
|
|
@ -271,7 +272,8 @@ class Booking extends Model
|
|||
'travelagenda_id',
|
||||
'paying_out',
|
||||
'paying_out_status',
|
||||
'airline_id',
|
||||
//'airline_id',
|
||||
'airline_ids',
|
||||
'refund',
|
||||
'refund_date',
|
||||
'lawyer_date',
|
||||
|
|
@ -398,11 +400,12 @@ class Booking extends Model
|
|||
{
|
||||
return $this->belongsTo(TravelAgenda::class, 'travelagenda_id');
|
||||
}
|
||||
|
||||
public function airline()
|
||||
|
||||
/*public function airline()
|
||||
{
|
||||
return $this->belongsTo(Airline::class, 'airline_id');
|
||||
}
|
||||
*/
|
||||
|
||||
public function arrangements()
|
||||
{
|
||||
|
|
@ -540,30 +543,103 @@ class Booking extends Model
|
|||
{
|
||||
return $this->hasOne(BookingStorno::class);
|
||||
}
|
||||
|
||||
|
||||
public function getAirlinesAsNames()
|
||||
{
|
||||
$ret = "";
|
||||
if($this->airline_ids){
|
||||
foreach($this->airline_ids as $airline_id){
|
||||
if($Airline = Airline::find($airline_id)){
|
||||
$ret .= $Airline->name." ";
|
||||
}
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
public function getAirlinesIds()
|
||||
{
|
||||
if($this->airline_ids){
|
||||
return implode('', $this->airline_ids);
|
||||
}
|
||||
return "";
|
||||
|
||||
}
|
||||
public function hasBookingServicesUnchecked(){
|
||||
$country_services = true;
|
||||
$provider_services = true;
|
||||
$company_services = true;
|
||||
if(!$this->booking_country_services->count() || $this->booking_country_services_checked->count() ||
|
||||
|
||||
$has_country_services = false;
|
||||
$has_provider_services = false;
|
||||
$has_company_services = false;
|
||||
|
||||
if($this->travel_country){
|
||||
foreach($this->travel_country->getContactLandsModels() as $TravelCountry){
|
||||
if($TravelCountry->stern_travel_country){
|
||||
if($TravelCountry->stern_travel_country->travel_country_services->count()){
|
||||
$has_country_services = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($has_country_services && !$this->booking_country_services->count() || $this->booking_country_services_checked->count() ||
|
||||
($this->booking_country_services->count() !== TravelCountryService::where('crm_travel_country_id', '=', $this->travel_country_id)->count())){
|
||||
$country_services = false;
|
||||
$country_services = false;
|
||||
|
||||
}
|
||||
|
||||
if(!$this->booking_provider_services->count() || $this->booking_provider_services_checked->count()){
|
||||
$provider_services = false;
|
||||
foreach($this->service_provider_entries as $service_provider_entry){
|
||||
if($service_provider_entry->service_provider && $service_provider_entry->service_provider->service_provider_services->count()){
|
||||
$has_provider_services = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$this->booking_company_services->count() || $this->booking_company_services_checked->count()){
|
||||
$company_services = false;
|
||||
if($has_provider_services && !$this->booking_provider_services->count() || $this->booking_provider_services_checked->count()){
|
||||
if($this->service_provider_entries->count()){
|
||||
$provider_services = false;
|
||||
}
|
||||
}
|
||||
|
||||
if($country_services && $provider_services && $provider_services){
|
||||
foreach($this->booking_service_items as $booking_service_item){
|
||||
if($booking_service_item->travel_company && $booking_service_item->travel_company->travel_company_services->count()){
|
||||
$has_company_services = true;
|
||||
}
|
||||
}
|
||||
if($has_company_services && !$this->booking_company_services->count() || $this->booking_company_services_checked->count()){
|
||||
if($this->booking_service_items->count()){
|
||||
$company_services = false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(!$has_country_services && !$has_provider_services && !$has_company_services){
|
||||
return false;
|
||||
}
|
||||
if($country_services && $provider_services && $company_services){
|
||||
return true;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function hasBookingParticipantsPass(){
|
||||
if($this->participant_firstname){
|
||||
if(!$this->participant_pass){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if($this->participants->count()){
|
||||
foreach($this->participants as $participant){
|
||||
if(!$participant->participant_pass){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function getPassolutionPDF($create = false, $resync = false){
|
||||
|
||||
$nats = [];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue