Skip to content

Commit

Permalink
Merge pull request #2430 from phili67/phili67-fundraiser-report-bug-res
Browse files Browse the repository at this point in the history
Fundraiser report bug resolution
  • Loading branch information
phili67 committed Jun 9, 2023
2 parents a1ebb03 + 00b31f2 commit 31cd807
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 101 deletions.
34 changes: 0 additions & 34 deletions src/EcclesiaCRM/Reports/PDF_CertificatesReport.php

This file was deleted.

65 changes: 65 additions & 0 deletions src/EcclesiaCRM/Reports/PDF_FundRaiserReport.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php

namespace EcclesiaCRM\Reports;

class PDF_FRReport extends ChurchInfoReportTCPDF
{
public $leftX = 10;
public $orientation = 10;
public $format = 10;
public $fr_title = 'Voila';
public $fr_description = 'coucou';
public $curY = 0;

public function __construct($fundTitle, $fundDescription)
{
parent::__construct('P', 'mm', $this->paperFormat);
$this->leftX = 10;
$this->SetFont('Times', '', 10);
$this->SetMargins(10, 20);

$this->fr_title = $fundTitle;
$this->fr_description = $fundDescription;

$this->AddCustomPage();
$this->SetAutoPageBreak(true, 25);
}

public function AddCustomPage()
{
parent::AddPage();

$this->SetFont('Times', 'B', 16);
$this->Write(8, $this->fr_title."\n");
$this->curY += 8;
$this->Write(8, $this->fr_description."\n\n");
$this->curY += 8;
$this->SetFont('Times', '', 12);
}
}

class PDF_FRCatalogReport extends PDF_FRReport
{
}

class PDF_CertificatesReport extends PDF_FRReport
{
public function AddCustomPage()
{
parent::AddPage();

$this->SetFont('Times', 'B', 16);
$this->Write(8, $this->fr_title."\n");
$this->curY += 8;
$this->Write(8, $this->fr_description."\n\n");
$this->curY += 8;
$this->SetFont('Times', 'B', 36);
$this->Write(8, _('Certificate of Ownership')."\n\n");
$this->curY += 8;
$this->SetFont('Times', '', 10);
}
}

class PDF_FRBidSheetsReport extends PDF_FRReport
{
}
37 changes: 6 additions & 31 deletions src/Reports/FRBidSheets.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
require '../Include/Functions.php';

use EcclesiaCRM\dto\SystemConfig;
use EcclesiaCRM\Reports\ChurchInfoReportTCPDF;

use EcclesiaCRM\Reports\PDF_FRBidSheetsReport;

use EcclesiaCRM\Utils\OutputUtils;

Expand All @@ -25,40 +26,14 @@

$iCurrentFundraiser = $_GET['CurrentFundraiser'];

class PDF_FRBidSheetsReport extends ChurchInfoReportTCPDF
{
private $fundraiser = null;

// Constructor
public function __construct($fundraiser)
{
parent::__construct('P', 'mm', $this->paperFormat);
$this->fundraiser = $fundraiser;
$this->leftX = 10;
$this->SetFont('Times', '', 10);
$this->SetMargins(15, 25);

$this->SetAutoPageBreak(true, 25);
}

public function AddPage($orientation = '', $format = '')
{
parent::AddPage($orientation, $format);

//$this->SetFont("Times",'B',16);
//$this->Write (8, $this->fundraiser->getTitle()."\n");
//$curY += 8;
//$this->Write (8, $this->fundraiser->getDescription()."\n\n");
//$curY += 8;
//$this->SetFont("Times",'',10);
}
}

$currency = SystemConfig::getValue("sCurrency");

// Get the information about this fundraiser
$thisFRORM = FundRaiserQuery::create()->findOneById($iCurrentFundraiser);

$fundTitle = $thisFRORM->getTitle();
$fundDescription = $thisFRORM->getDescription();

// Get all the donated items
$ormItems = DonatedItemQuery::create()
->addJoin(DonatedItemTableMap::COL_DI_DONOR_ID, PersonTableMap::COL_PER_ID, Criteria::LEFT_JOIN)
Expand All @@ -72,7 +47,7 @@ public function AddPage($orientation = '', $format = '')
->orderBy('cri3')
->findByFrId($iCurrentFundraiser);

$pdf = new PDF_FRBidSheetsReport($thisFRORM);
$pdf = new PDF_FRBidSheetsReport($fundTitle, $fundDescription);
$pdf->SetTitle($thisFRORM->getTitle());

// Loop through items
Expand Down
47 changes: 12 additions & 35 deletions src/Reports/FRCatalog.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
require '../Include/Functions.php';

use EcclesiaCRM\dto\SystemConfig;
use EcclesiaCRM\Reports\ChurchInfoReportTCPDF;
use EcclesiaCRM\Utils\OutputUtils;

use EcclesiaCRM\FundRaiserQuery;
Expand All @@ -21,44 +20,20 @@
use EcclesiaCRM\Map\PersonTableMap;
use EcclesiaCRM\Map\DonatedItemTableMap;

use EcclesiaCRM\Reports\PDF_FRCatalogReport;

use Propel\Runtime\ActiveQuery\Criteria;

$iCurrentFundraiser = $_GET['CurrentFundraiser'];

$curY = 0;

class PDF_FRCatalogReport extends ChurchInfoReportTCPDF
{
// Constructor
public function __construct()
{
parent::__construct('P', 'mm', $this->paperFormat);
$this->leftX = 10;
$this->SetFont('Times', '', 10);
$this->SetMargins(10, 20);

$this->AddPage();
$this->SetAutoPageBreak(true, 25);
}

public function AddPage($orientation = '', $format = '')
{
global $fr_title, $fr_description, $curY;

parent::AddPage($orientation, $format);

$this->SetFont('Times', 'B', 16);
$this->Write(8, $fr_title."\n");
$curY += 8;
$this->Write(8, $fr_description."\n\n");
$curY += 8;
$this->SetFont('Times', '', 12);
}
}

// Get the information about this fundraiser
$thisFRORM = FundRaiserQuery::create()->findOneById($iCurrentFundraiser);

$fundTitle = $thisFRORM->getTitle();
$fundDescription = $thisFRORM->getDescription();

$currency = SystemConfig::getValue("sCurrency");

// Get all the donated items
Expand All @@ -74,8 +49,8 @@ public function AddPage($orientation = '', $format = '')
->orderBy('cri3')
->findByFrId($iCurrentFundraiser);

$pdf = new PDF_FRCatalogReport();
$pdf->SetTitle($thisFRORM->getTitle());
$pdf = new PDF_FRCatalogReport($fundTitle, $fundDescription);
$pdf->SetTitle($fundTitle);

// Loop through items
$idFirstChar = '';
Expand All @@ -97,9 +72,11 @@ public function AddPage($orientation = '', $format = '')

if ($item->getPicture() != '' && strlen($item->getPicture()) > 5) {
$s = getimagesize($item->getPicture());
$h = (100.0 / $s[0]) * $s[1];
$pdf->Image($item->getPicture(), $pdf->GetX(), $pdf->GetY(), 100.0, $h);
$pdf->SetY($pdf->GetY() + $h);
if ($s[0]>0) {
$h = (100.0 / $s[0]) * $s[1];
$pdf->Image($item->getPicture(), $pdf->GetX(), $pdf->GetY(), 100.0, $h);
$pdf->SetY($pdf->GetY() + $h);
}
}

$pdf->SetFont('Times', '', 12);
Expand Down
6 changes: 5 additions & 1 deletion src/Reports/FRCertificates.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
// Get the information about this fundraiser
$thisFRORM = FundRaiserQuery::create()->findOneById($iCurrentFundraiser);

$fundTitle = $thisFRORM->getTitle();
$fundDescription = $thisFRORM->getDescription();


// Get all the donated items
$ormItems = DonatedItemQuery::create()
->addJoin(DonatedItemTableMap::COL_DI_DONOR_ID, PersonTableMap::COL_PER_ID, Criteria::LEFT_JOIN)
Expand All @@ -35,7 +39,7 @@
->orderByItem()
->findByFrId($iCurrentFundraiser);

$pdf = new PDF_CertificatesReport();
$pdf = new PDF_CertificatesReport($fundTitle, $fundDescription);
$pdf->SetTitle($thisFRORM->getTitle());

$currency = SystemConfig::getValue("sCurrency");
Expand Down
2 changes: 2 additions & 0 deletions src/mysql/upgrade/8.0.0-upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@
unlink(SystemURLs::getDocumentRoot()."/ManageEnvelopes.php");
unlink(SystemURLs::getDocumentRoot()."/FinancialReports.php");

unlink(SystemURLs::getDocumentRoot()."/EcclesiaCRM/Reports/PDF_CertificatesReport.php");

// 2023-06-08
unlink(SystemURLs::getDocumentRoot()."/FundRaiserEditor.php");
unlink(SystemURLs::getDocumentRoot()."/GroupPropsEditor.php");
Expand Down

0 comments on commit 31cd807

Please sign in to comment.