Reiseland Kontaktdaten, Rabatt API

This commit is contained in:
Kevin Adametz 2019-11-07 17:08:16 +01:00
parent 8f29c15a2b
commit 70704be1ea
30 changed files with 471 additions and 95 deletions

View file

@ -121,7 +121,7 @@ class HTMLHelper
}
public static function getDraftTypes($setId = false){
$options = DraftType::all()->sortByDesc('id');
$options = DraftType::all()->sortByDesc('id')->sortByDesc('pos');
$ret = "";
foreach ($options as $option){
$attr = ($option->id == $setId) ? 'selected="selected"' : '';
@ -165,17 +165,23 @@ class HTMLHelper
}
public static function getTravelCountriesOptions($countryId = false){
$checked = [];
if($countryId){
!is_array($countryId) ? $checked = array($countryId) : $checked = $countryId;
}
$options = TravelCountry::where('active_backend',1)->get();
$ret = '';
foreach ($options as $option){
$attr = ($option->crm_id === $countryId) ? 'selected="selected"' : '';
$attr = (in_array($option->crm_id, $checked)) ? 'selected="selected"' : '';
$ret .= '<option value="'.$option->crm_id.'" '.$attr.'>'.$option->name.'</option>\n';
}
return $ret;
}
public static function getTravelUserOptions($id = false){
$options = TravelUser::all();
public static function getTravelUserOptions($id = false, $order = "ASC"){
$options = TravelUser::orderBy('id', $order)->get();
$ret = '';
foreach ($options as $option){
$attr = ($option->id === $id) ? 'selected="selected"' : '';

View file

@ -35,8 +35,12 @@ class Util
}
public static function _clean_float($value){
$groups = explode(".", preg_replace("/[^0-9.]/", "", str_replace(',', '.', $value)));
$lastGroup = array_pop($groups);
$groups = explode(".", preg_replace("/[^0-9.-]/", "", str_replace(',', '.', $value)));
$lastGroup = 0;
if(count($groups) > 1){
$lastGroup = array_pop($groups);
}
$number = implode('', $groups);
return (strlen($lastGroup) < 3) ? floatval($number.'.'.$lastGroup) : floatval($number.$lastGroup);
}