From eb0e19d27fef93ef24d5f08ed3a24a1cd4c321a3 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Fri, 4 Oct 2019 02:36:36 +0000 Subject: [PATCH] Add country code prefix to messages. Made the country code a constant. #270 --- src/Controller/CustomerController.php | 4 +++- src/Entity/Customer.php | 10 ++++++---- src/Service/JobOrderHandler/CMBJobOrderHandler.php | 10 ++++++---- src/Service/JobOrderHandler/ResqJobOrderHandler.php | 10 ++++++---- templates/customer/form.html.twig | 8 ++++---- templates/job-order/form.html.twig | 8 ++++---- templates/job-order/form.pdf.html.twig | 4 ++-- templates/search/legacyjo_details.html.twig | 6 +++--- templates/ticket/form.html.twig | 2 +- templates/warranty/form.html.twig | 2 +- translations/cmb.messages.en.yaml | 3 ++- translations/messages.en.yaml | 3 ++- translations/resq.messages.en.yaml | 1 + 13 files changed, 41 insertions(+), 30 deletions(-) diff --git a/src/Controller/CustomerController.php b/src/Controller/CustomerController.php index d03d735a..3323d617 100644 --- a/src/Controller/CustomerController.php +++ b/src/Controller/CustomerController.php @@ -27,6 +27,8 @@ use DateTime; class CustomerController extends Controller { + const COUNTRY_CODE_PREFIX = '+60'; + /** * @Menu(selected="customer_list") */ @@ -588,7 +590,7 @@ class CustomerController extends Controller $cust = $cv->getCustomer(); $vehicles[] = [ 'id' => $cv->getID(), - 'text' => $cv->getPlateNumber() . ' ' . $cust->getFirstName() . ' ' . $cust->getLastName() . ' (+63' . $cust->getPhoneMobile() . ')', + 'text' => $cv->getPlateNumber() . ' ' . $cust->getFirstName() . ' ' . $cust->getLastName() . ' ('. self::COUNTRY_CODE_PREFIX . $cust->getPhoneMobile() . ')', ]; } diff --git a/src/Entity/Customer.php b/src/Entity/Customer.php index 61b0c392..8255d408 100644 --- a/src/Entity/Customer.php +++ b/src/Entity/Customer.php @@ -14,6 +14,8 @@ use App\Ramcar\CustomerClassification; */ class Customer { + const COUNTRY_CODE_PREFIX = '+60'; + // unique id /** * @ORM\Id @@ -258,16 +260,16 @@ class Customer $phones = []; if (!empty($this->phone_mobile)) - $phones[] = '+63' . $this->phone_mobile; + $phones[] = self::COUNTRY_CODE_PREFIX . $this->phone_mobile; if (!empty($this->phone_landline)) - $phones[] = '+63' . $this->phone_landline; + $phones[] = self::COUNTRY_CODE_PREFIX . $this->phone_landline; if (!empty($this->phone_office)) - $phones[] = '+63' . $this->phone_office; + $phones[] = self::COUNTRY_CODE_PREFIX . $this->phone_office; if (!empty($this->phone_fax)) - $phones[] = '+63' . $this->phone_fax; + $phones[] = self::COUNTRY_CODE_PREFIX . $this->phone_fax; return $phones; } diff --git a/src/Service/JobOrderHandler/CMBJobOrderHandler.php b/src/Service/JobOrderHandler/CMBJobOrderHandler.php index 45975fc7..c84f74b7 100644 --- a/src/Service/JobOrderHandler/CMBJobOrderHandler.php +++ b/src/Service/JobOrderHandler/CMBJobOrderHandler.php @@ -53,6 +53,8 @@ use FPDF; class CMBJobOrderHandler implements JobOrderHandlerInterface { + const COUNTRY_CODE_PREFIX = '+60'; + protected $em; protected $ic; protected $security; @@ -1616,7 +1618,7 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface $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() ? self::COUNTRY_CODE_PREFIX . $customer->getPhoneMobile() : '', 0, 'L'); // get Y after right cell $y2 = $pdf->GetY(); @@ -1633,7 +1635,7 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface $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() ? self::COUNTRY_CODE_PREFIX . $customer->getPhoneLandline() : '', 0, 'L'); // get Y after right cell $y2 = $pdf->GetY(); @@ -1643,11 +1645,11 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface $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() ? self::COUNTRY_CODE_PREFIX . $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() ? self::COUNTRY_CODE_PREFIX . $customer->getPhoneFax() : '', 0, 'L'); // insert vehicle info $cv = $obj->getCustomerVehicle(); diff --git a/src/Service/JobOrderHandler/ResqJobOrderHandler.php b/src/Service/JobOrderHandler/ResqJobOrderHandler.php index 1348c80d..66fe482b 100644 --- a/src/Service/JobOrderHandler/ResqJobOrderHandler.php +++ b/src/Service/JobOrderHandler/ResqJobOrderHandler.php @@ -53,6 +53,8 @@ use FPDF; class ResqJobOrderHandler implements JobOrderHandlerInterface { + const COUNTRY_CODE_PREFIX = '+63'; + protected $em; protected $ic; protected $security; @@ -1616,7 +1618,7 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface $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() ? self::COUNTRY_CODE_PREFIX . $customer->getPhoneMobile() : '', 0, 'L'); // get Y after right cell $y2 = $pdf->GetY(); @@ -1633,7 +1635,7 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface $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() ? self::COUNTRY_CODE_PREFIX . $customer->getPhoneLandline() : '', 0, 'L'); // get Y after right cell $y2 = $pdf->GetY(); @@ -1643,11 +1645,11 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface $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() ? self::COUNTRY_CODE_PREFIX . $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() ? self::COUNTRY_CODE_PREFIX . $customer->getPhoneFax() : '', 0, 'L'); // insert vehicle info $cv = $obj->getCustomerVehicle(); diff --git a/templates/customer/form.html.twig b/templates/customer/form.html.twig index 58d35568..4838fffa 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 %}
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/cmb.messages.en.yaml b/translations/cmb.messages.en.yaml index 29a0c3c0..d9162b06 100644 --- a/translations/cmb.messages.en.yaml +++ b/translations/cmb.messages.en.yaml @@ -10,11 +10,12 @@ 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: Res-Q for CMB Job Order +country_code_prefix: '+60' # images image_logo_login: /assets/images/black-text-logo-01.png icon_login: /assets/images/battery-assist-bm-logo-32x32.png icon_base_32x32: /assets/images/black-text-logo-01-32x32.png icon_base_16x16: /assets/images/black-text-logo-01-16x16.png -image_dashboard: /assets/images/battery-assist-bm-logo-50x50.png +image_dashboard: /assets/images/black-text-logo-01-115x115.png image_jo_pdf: /public/assets/images/black-text-logo-01-115x115.png diff --git a/translations/messages.en.yaml b/translations/messages.en.yaml index 29a0c3c0..d9162b06 100644 --- a/translations/messages.en.yaml +++ b/translations/messages.en.yaml @@ -10,11 +10,12 @@ 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: Res-Q for CMB Job Order +country_code_prefix: '+60' # images image_logo_login: /assets/images/black-text-logo-01.png icon_login: /assets/images/battery-assist-bm-logo-32x32.png icon_base_32x32: /assets/images/black-text-logo-01-32x32.png icon_base_16x16: /assets/images/black-text-logo-01-16x16.png -image_dashboard: /assets/images/battery-assist-bm-logo-50x50.png +image_dashboard: /assets/images/black-text-logo-01-115x115.png image_jo_pdf: /public/assets/images/black-text-logo-01-115x115.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