Jump to content

Zenmaster

New Member
  • Content Count

    3
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Zenmaster

  • Rank
    Junior Member
  1. I've put it above the "for each" because that's what I understood from what's posted in the thread.. I tried the if but it still shows the first the pay-to settings details and then the condition details... It's like it gets the details from the settings somewhere.. The code is: # Company Details $pdf->SetXY(15, 42); $pdf->SetFont($pdfFont, '', 13); if (date('Y-m-d', strtotime(str_replace('/', '-', $datecreated))) <= '2020-09-08') { $companyaddress[] = 'Company details old'; $companyaddress[] = '1'; $companyaddress[] = '2'; $companyaddress[] = '3'; $companyaddress[] = '4'; } else { $companyaddress[] = 'Company details new'; $companyaddress[] = '1'; $companyaddress[] = '2'; $companyaddress[] = '3'; $companyaddress[] = '4'; } foreach ($companyaddress as $addressLine) { $pdf->Cell(180, 4, trim($addressLine), 0, 1, 'R'); $pdf->SetFont($pdfFont, '', 9); } $pdf->Ln(5);
  2. Thanks for the help! I'm in the same situation. In invoicepdf.tpl I've added the code before the foreach, but no matter what I try it displayed both the set pay-to text address and after it the address from the condition. I've also tried the following as my dev suggested: # Conditional Company Details if (date('Y-m-d', strtotime(str_replace('/', '-', $datecreated))) <= '2020-09-08') { $companyaddress[] = '1'; $companyaddress[] = '2'; $companyaddress[] = '3'; $companyaddress[] = '4'; $companyaddress[] = '5'; } but no luck.. still shows both address one below the other. Any idea? -- Regarding the hook for viewinvoice, I've managed to make it work but I had to tweak it to: add_hook('ClientAreaPageViewInvoice', 1, function($vars) { $invoice = Capsule::table('tblinvoices')->where('id', $vars['invoiceid'])->first(); if ($invoice && $invoice->date <= '2020-09-08') { // Company Details for all invoices/proformas issued until 2016-12-31 return array('payto' => 'company<br>details.'); } }); Just posting it here in case it would help someone in the future..
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated