Commit 962c6929 authored by Shimshock Group's avatar Shimshock Group Committed by Klaus Purer
Browse files

fix(pdf): Fix PHP undefined index notice with date (#2339367 by dzinkevich,...

fix(pdf): Fix PHP undefined index notice with date (#2339367 by dzinkevich, nickonom, zaporylie, ron_s, ShaunLaws, Apfel007, klausi, Anybody)
parent 6f8d1242
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -205,7 +205,10 @@ function commerce_billy_pdf_commerce_order_view($order, $view_mode) {
      '#markup' => isset($settings['invoice_text']) ? $settings['invoice_text'] : '',
    );
    $date_field_name = $view_mode == 'pdf' ? 'field_commerce_billy_i_date' : 'field_commerce_billy_cancel_date';
    $date_formatted = format_date($order->{$date_field_name}[LANGUAGE_NONE][0]['value'], 'custom', $custom_date_format);
    $wrapper = entity_metadata_wrapper('commerce_order', $order);
    $date_field_value = $wrapper->{$date_field_name}->value();
    $date = !empty($date_field_value) ? $date_field_value : $order->created;
    $date_formatted = format_date($date, 'custom', $custom_date_format);
    if (!empty($settings['invoice_location'])) {
      $invoice_header_date_text = t('@location, @date', array('@location' => $settings['invoice_location'], '@date' => $date_formatted));
    }