diff --git a/config/services.yaml b/config/services.yaml index b62024ce..c8916c9b 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -11,6 +11,7 @@ parameters: app_acl_file: 'acl.yaml' app_access_key: 'access_keys' cvu_brand_id: "%env(CVU_BRAND_ID)%" + country_code: "%env(COUNTRY_CODE)%" services: # default configuration for services in *this* file diff --git a/src/Controller/CustomerController.php b/src/Controller/CustomerController.php index d03d735a..1f3849ad 100644 --- a/src/Controller/CustomerController.php +++ b/src/Controller/CustomerController.php @@ -584,11 +584,14 @@ class CustomerController extends Controller // build vehicles array $vehicles = []; + // get country code from services.yaml + $country_code = $this->getParameter('country_code'); + foreach ($obj_rows as $cv) { $cust = $cv->getCustomer(); $vehicles[] = [ 'id' => $cv->getID(), - 'text' => $cv->getPlateNumber() . ' ' . $cust->getFirstName() . ' ' . $cust->getLastName() . ' (+63' . $cust->getPhoneMobile() . ')', + 'text' => $cv->getPlateNumber() . ' ' . $cust->getFirstName() . ' ' . $cust->getLastName() . ' (' . $country_code . $cust->getPhoneMobile() . ')', ]; } diff --git a/src/Controller/JobOrderController.php b/src/Controller/JobOrderController.php index d38b7e9c..2036ffe0 100644 --- a/src/Controller/JobOrderController.php +++ b/src/Controller/JobOrderController.php @@ -1977,6 +1977,9 @@ class JobOrderController extends Controller $translated_title = $translator->trans('jo_title_pdf'); $translated_logo = $translator->trans('image_jo_pdf'); + // get the country code from services.yaml + $country_code = $this->getParameter('country_code'); + // generate the pdf $pdf = new FPDF('P', 'mm', 'letter'); $pdf->AddPage(); @@ -2029,7 +2032,7 @@ class JobOrderController extends Controller $pdf->SetXY($col2_x, $y); $pdf->Cell($label_width, $line_height, 'Mobile Phone:'); - $pdf->MultiCell(0, $line_height, $customer && $customer->getPhoneMobile() ? '+63' . $customer->getPhoneMobile() : '', 0, 'L'); + $pdf->MultiCell(0, $line_height, $customer && $customer->getPhoneMobile() ? $country_code . $customer->getPhoneMobile() : '', 0, 'L'); // get Y after right cell $y2 = $pdf->GetY(); @@ -2046,7 +2049,7 @@ class JobOrderController extends Controller $pdf->SetXY($col2_x, $y); $pdf->Cell($label_width, $line_height, 'Landline:'); - $pdf->MultiCell(0, $line_height, $customer && $customer->getPhoneLandline() ? '+63' . $customer->getPhoneLandline() : '', 0, 'L'); + $pdf->MultiCell(0, $line_height, $customer && $customer->getPhoneLandline() ? $country_code . $customer->getPhoneLandline() : '', 0, 'L'); // get Y after right cell $y2 = $pdf->GetY(); @@ -2056,11 +2059,11 @@ class JobOrderController extends Controller $pdf->SetXY($col2_x, $y); $pdf->Cell($label_width, $line_height, 'Office Phone:'); - $pdf->MultiCell(0, $line_height, $customer && $customer->getPhoneOffice() ? '+63' . $customer->getPhoneOffice() : '', 0, 'L'); + $pdf->MultiCell(0, $line_height, $customer && $customer->getPhoneOffice() ? $country_code . $customer->getPhoneOffice() : '', 0, 'L'); $pdf->SetX($col2_x); $pdf->Cell($label_width, $line_height, 'Fax:'); - $pdf->MultiCell($val_width, $line_height, $customer && $customer->getPhoneFax() ? '+63' . $customer->getPhoneFax() : '', 0, 'L'); + $pdf->MultiCell($val_width, $line_height, $customer && $customer->getPhoneFax() ? $country_code . $customer->getPhoneFax() : '', 0, 'L'); // insert vehicle info $cv = $obj->getCustomerVehicle(); diff --git a/src/Entity/Customer.php b/src/Entity/Customer.php index 880f0213..d9dd9b98 100644 --- a/src/Entity/Customer.php +++ b/src/Entity/Customer.php @@ -258,16 +258,16 @@ class Customer $phones = []; if (!empty($this->phone_mobile)) - $phones[] = '+63' . $this->phone_mobile; + $phones[] = $this->phone_mobile; if (!empty($this->phone_landline)) - $phones[] = '+63' . $this->phone_landline; + $phones[] = $this->phone_landline; if (!empty($this->phone_office)) - $phones[] = '+63' . $this->phone_office; + $phones[] = $this->phone_office; if (!empty($this->phone_fax)) - $phones[] = '+63' . $this->phone_fax; + $phones[] = $this->phone_fax; return $phones; } diff --git a/templates/customer/form.html.twig b/templates/customer/form.html.twig index 58d35568..af85fd94 100644 --- a/templates/customer/form.html.twig +++ b/templates/customer/form.html.twig @@ -131,7 +131,7 @@ Mobile Phone
- +63 + {% trans %}country_code_prefix{% endtrans %}
@@ -141,7 +141,7 @@ Landline
- +63 + {% trans %}country_code_prefix{% endtrans %}
@@ -153,7 +153,7 @@ Office Phone
- +63 + {% trans %}country_code_prefix{% endtrans %}
@@ -163,7 +163,7 @@ Fax
- +63 + {% trans %}country_code_prefix{% endtrans %}
@@ -600,7 +600,7 @@ // input mask $("#mobile-number").inputmask("mask", { - mask: "639999999999", + mask: "{% trans %}country_code_prefix{% endtrans %}9999999999", placeholder: "" }); diff --git a/templates/job-order/form.html.twig b/templates/job-order/form.html.twig index 1d3e0275..1914dfe9 100644 --- a/templates/job-order/form.html.twig +++ b/templates/job-order/form.html.twig @@ -110,7 +110,7 @@
- +63 + {% trans %}country_code_prefix{% endtrans %}
@@ -118,7 +118,7 @@
- +63 + {% trans %}country_code_prefix{% endtrans %}
@@ -128,7 +128,7 @@
- +63 + {% trans %}country_code_prefix{% endtrans %}
@@ -136,7 +136,7 @@
- +63 + {% trans %}country_code_prefix{% endtrans %}
diff --git a/templates/job-order/form.pdf.html.twig b/templates/job-order/form.pdf.html.twig index 9944a44c..5499f1fb 100644 --- a/templates/job-order/form.pdf.html.twig +++ b/templates/job-order/form.pdf.html.twig @@ -89,7 +89,7 @@
- +63 + {% trans %}country_code_prefix{% endtrans %}
@@ -97,7 +97,7 @@
- +63 + {% trans %}country_code_prefix{% endtrans %}
diff --git a/templates/search/legacyjo_details.html.twig b/templates/search/legacyjo_details.html.twig index 15b3ea94..bb9d51d6 100644 --- a/templates/search/legacyjo_details.html.twig +++ b/templates/search/legacyjo_details.html.twig @@ -53,7 +53,7 @@
- +63 + {% trans %}country_code_prefix{% endtrans %}
@@ -61,7 +61,7 @@
- +63 + {% trans %}country_code_prefix{% endtrans %}
@@ -71,7 +71,7 @@
- +63 + {% trans %}country_code_prefix{% endtrans %}
diff --git a/templates/ticket/form.html.twig b/templates/ticket/form.html.twig index 1666c59d..84328ab8 100644 --- a/templates/ticket/form.html.twig +++ b/templates/ticket/form.html.twig @@ -71,7 +71,7 @@
- +63 + {% trans %}country_code_prefix{% endtrans %}
diff --git a/templates/warranty/form.html.twig b/templates/warranty/form.html.twig index d99470cb..4af98004 100644 --- a/templates/warranty/form.html.twig +++ b/templates/warranty/form.html.twig @@ -86,7 +86,7 @@ Mobile Phone
- +63 + {% trans %}country_code_prefix{% endtrans %}
diff --git a/translations/messages.en.yaml b/translations/messages.en.yaml index 2ee4305a..a495b2d4 100644 --- a/translations/messages.en.yaml +++ b/translations/messages.en.yaml @@ -10,6 +10,7 @@ battery_size_tradein_premium: Trade-in Premium battery_size_tradein_other: Trade-in Other add_cust_vehicle_battery_info: This vehicle is using a Motolite battery jo_title_pdf: Motolite Res-Q Job Order +country_code_prefix: '+63' # # images image_logo_login: /assets/images/logo-resq.png diff --git a/translations/resq.messages.en.yaml b/translations/resq.messages.en.yaml index babf41d2..966b6fd9 100644 --- a/translations/resq.messages.en.yaml +++ b/translations/resq.messages.en.yaml @@ -10,6 +10,7 @@ battery_size_tradein_premium: Trade-in Premium battery_size_tradein_other: Trade-in Other add_cust_vehicle_battery_info: This vehicle is using a Motolite battery jo_title_pdf: Motolite Res-Q Job Order +country_code_prefix: '+63' # images image_logo_login: /assets/images/logo-resq.png