Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function velosurance_quote_multistep_auto_create_bike($type, $bike, $usage, $specials) {
- $node = new stdClass();
- $node->title = $bike['year'] .' '. $bike['make'] . ' ' . $bike['model'];
- $node->type = 'bike';
- $node->created = time();
- $node->status = 1;
- $node->promote = 0;
- $node->sticky = 0;
- $node->uid = 1;
- $node->language = 'en';
- $node->timestamp = time();
- $node->revision = 0;
- $node->runtime = 0;
- $node->active = 1;
- $node->field_bike_year[LANGUAGE_NONE][0]['value'] = $bike['year'];
- $node->field_bike_make[LANGUAGE_NONE][0]['value'] = ucfirst($bike['make']);
- $node->field_bike_model[LANGUAGE_NONE][0]['value'] = ucfirst($bike['model']);
- $node->field_bike_status[LANGUAGE_NONE][0]['value'] = $bike['condition'];
- $node->field_bike_usage[LANGUAGE_NONE][0]['value'] = $usage;
- $node->field_bike_purchase_year[LANGUAGE_NONE][0]['value'] = $bike['purchased_year'] . '-01-01 00:00:00';
- $node->field_bike_current_value[LANGUAGE_NONE][0]['value'] = (int) preg_replace("/[^(\d)\.]/", "", $bike['current_value']);
- $node->field_bike_type[LANGUAGE_NONE][0]['value'] = $bike['bike_type'];
- $node->field_bike_construction[LANGUAGE_NONE][0]['value'] = $bike['construction'];
- $node->field_bike_price[LANGUAGE_NONE][0]['value'] = (int) preg_replace("/[^(\d)\.]/", "", $bike['price']);
- $node->field_deductible[LANGUAGE_NONE][0]['value'] = $bike['deductible'];
- $node->field_roadside_assistance[LANGUAGE_NONE][0]['value'] = $bike['roadside_assist'];
- $node->field_worldwide_covarage[LANGUAGE_NONE][0]['value'] = $bike['wwcoverage'];
- $node->field_liability_limit[LANGUAGE_NONE][0]['value'] = $specials['liability_limit'];
- $node->field_vehicle_contact_protection[LANGUAGE_NONE][0]['value'] = $specials['vehicle_contact_protection'];
- $node->field_medical_payments[LANGUAGE_NONE][0]['value'] = $specials['medical_payments'];
- if ($type == 'basic') {
- $node->field_deductible[LANGUAGE_NONE][0]['value'] = 500;
- $node->field_roadside_assistance[LANGUAGE_NONE][0]['value'] = 0;
- $node->field_worldwide_covarage[LANGUAGE_NONE][0]['value'] = 0;
- $node->field_liability_limit[LANGUAGE_NONE][0]['value'] = 0;
- $node->field_vehicle_contact_protection[LANGUAGE_NONE][0]['value'] = 0;
- $node->field_medical_payments[LANGUAGE_NONE][0]['value'] = 0;
- }
- if ($type == 'plus') {
- $node->field_deductible[LANGUAGE_NONE][0]['value'] = 300;
- $node->field_roadside_assistance[LANGUAGE_NONE][0]['value'] = 0;
- $node->field_worldwide_covarage[LANGUAGE_NONE][0]['value'] = 0;
- $node->field_liability_limit[LANGUAGE_NONE][0]['value'] = 0;
- $node->field_medical_payments[LANGUAGE_NONE][0]['value'] = 0;
- if ($specials['personal_insurance'] == 'No') {
- $node->field_vehicle_contact_protection[LANGUAGE_NONE][0]['value'] = 25000;
- }
- else {
- $node->field_vehicle_contact_protection[LANGUAGE_NONE][0]['value'] = 0;
- }
- }
- node_save($node);
- return $node;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement