Add translations for the job order in pdf form. #265
This commit is contained in:
parent
da0fde37ef
commit
0fadccc16c
2 changed files with 10 additions and 3 deletions
|
|
@ -42,6 +42,7 @@ use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
use Catalyst\MenuBundle\Annotation\Menu;
|
use Catalyst\MenuBundle\Annotation\Menu;
|
||||||
|
|
||||||
|
|
@ -1918,7 +1919,7 @@ class JobOrderController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function pdfForm(Request $req, $id)
|
public function pdfForm(Request $req, $id, TranslatorInterface $translator)
|
||||||
{
|
{
|
||||||
$this->denyAccessUnlessGranted('jo_pdf.list', null, 'No access.');
|
$this->denyAccessUnlessGranted('jo_pdf.list', null, 'No access.');
|
||||||
|
|
||||||
|
|
@ -1934,10 +1935,14 @@ class JobOrderController extends Controller
|
||||||
// set output filename
|
// set output filename
|
||||||
$filename = 'job-order-' . $obj->getID() . '.pdf';
|
$filename = 'job-order-' . $obj->getID() . '.pdf';
|
||||||
|
|
||||||
|
// translate the title and the logo for the pdf
|
||||||
|
$translated_title = $translator->trans('jo_title_pdf');
|
||||||
|
$translated_logo = $translator->trans('image_jo_pdf');
|
||||||
|
|
||||||
// generate the pdf
|
// generate the pdf
|
||||||
$pdf = new FPDF('P', 'mm', 'letter');
|
$pdf = new FPDF('P', 'mm', 'letter');
|
||||||
$pdf->AddPage();
|
$pdf->AddPage();
|
||||||
$pdf->SetTitle('Motolite Res-Q Job Order #' . $obj->getID());
|
$pdf->setTitle($translated_title . ' #' . $obj->getID());
|
||||||
$pdf->SetFillColor(211, 211, 211);
|
$pdf->SetFillColor(211, 211, 211);
|
||||||
|
|
||||||
// style defaults
|
// style defaults
|
||||||
|
|
@ -1957,7 +1962,7 @@ class JobOrderController extends Controller
|
||||||
$val_width = 60;
|
$val_width = 60;
|
||||||
|
|
||||||
// insert the logo
|
// insert the logo
|
||||||
$image_path = $this->get('kernel')->getProjectDir() . '/public/assets/images/logo-resq.png';
|
$image_path = $this->get('kernel')->getProjectDir() . $translated_logo;
|
||||||
$pdf->Image($image_path, $col1_x, 10);
|
$pdf->Image($image_path, $col1_x, 10);
|
||||||
|
|
||||||
// insert JO number
|
// insert JO number
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,11 @@ alt_image_dashboard: Moogle
|
||||||
copyright: Mognet Central
|
copyright: Mognet Central
|
||||||
battery_size_tradein: Trade-in Moogle
|
battery_size_tradein: Trade-in Moogle
|
||||||
add_cust_vehicle_battery_info: This vehicle is using a Moogle battery
|
add_cust_vehicle_battery_info: This vehicle is using a Moogle battery
|
||||||
|
jo_title_pdf: Moogle Job Order
|
||||||
|
|
||||||
# images
|
# images
|
||||||
image_logo_login: /moogle-assets/74fdd1d049be99432a128ee40e93bff7.png
|
image_logo_login: /moogle-assets/74fdd1d049be99432a128ee40e93bff7.png
|
||||||
icon_login: /moogle-assets/moogleicon.ico
|
icon_login: /moogle-assets/moogleicon.ico
|
||||||
icon_base: /moogle-assets/moogleicon.ico
|
icon_base: /moogle-assets/moogleicon.ico
|
||||||
image_dashboard: /moogle-assets/yello_moogle.ico
|
image_dashboard: /moogle-assets/yello_moogle.ico
|
||||||
|
image_jo_pdf: /public/moogle-assets/74fdd1d049be99432a128ee40e93bff7.png
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue