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