[opencourrier-Commits] r1118 - branches/5.1.0/obj

4 views
Skip to first unread message

fray...@hephaestos.ovh.adullact.org

unread,
Jun 12, 2020, 4:12:06 PM6/12/20
to openmairie-...@googlegroups.com
Author: fraynaud
Date: 2020-06-12 22:12:04 +0200 (Fri, 12 Jun 2020)
New Revision: 1118

Modified:
branches/5.1.0/obj/courrier_arrivee.class.php
branches/5.1.0/obj/diffusion.class.php
Log:

version de fpdi compatible avec fpdf 1.8 d om 4.9.2



Modified: branches/5.1.0/obj/courrier_arrivee.class.php
===================================================================
--- branches/5.1.0/obj/courrier_arrivee.class.php 2020-06-12 15:53:34 UTC (rev 1117)
+++ branches/5.1.0/obj/courrier_arrivee.class.php 2020-06-12 20:12:04 UTC (rev 1118)
@@ -54,12 +54,12 @@
}
$dossier = opendir($dir);
$this->nb_scan=0;
- $liste_scan[$nb_scan]="";
+ $liste_scan[$this->nb_scan]="";
while ($entree = readdir($dossier)){
if (substr($entree, -4) <> ".pdf"){
continue;
}else{
- $liste_scan[$nb_scan]=$liste.$entree;
+ $liste_scan[$this->nb_scan]=$liste.$entree;
$this->nb_scan=$this->nb_scan+1;
}
}
@@ -100,18 +100,34 @@
// (FPDF error: This version of PHP is not supported)

if($val["lib_scan_pdf"]!="") {
+
// fichier requis pour ecriture sur le scan pdf
- // $path_fpdf= "../php/fpdf/"; // version 1.8 om 4.9
- $path_fpdf= "../app/fpdf/"; // version 1.6 (om 4.5)
- require_once($path_fpdf.'fpdf.php');
- require_once('../app/pdf/fpdi.php'); // ***
- //require_once('../app/pdf/src/Fpdi.php');
+
+ /* test passage version 1.3.1 (opencourrier 5.0.0) vers 1.6.2
+ // VERSION fpdf_1.8 fpdi_1.3.1 (om4.9) non ok
+ // incompatibilité dans la fonction addPage de pdf/fpdf_tpl et fpdf
+ require_once('../php/fpdf/fpdf.php');
+ require_once('../app/fpdi-1.3.1/fpdi.php');
+ // VERSION fpdf_1.8 fpdi_2.3 (om4.9) non ok
+ // pb avec use ?
+ use \setasign\Fpdi\Fpdi;
+ require_once('../php/fpdf/fpdf.php');
+ require_once('../app/fpdi-2.3/autoload.php');
+ */
+
+ // VERSION fpdf_1.8 fpdi_1.6.2 (om4.9)
+ // mais ""Cannot access protected property FPDI::$y "" methode setXY -> corrigé y
+ require_once('../php/fpdf/fpdf.php');
+ require_once('../app/fpdi-1.6.2/fpdi.php');
+
+ //
+
$pdf = new FPDI();
$pagecount = $pdf->setSourceFile($val["lib_scan_pdf"]);
// cas de plusieurs pages
for ($d=1; $d <= $pagecount; $d++) {
$tplidx = $pdf->ImportPage($d);
- $pdf->AddPage();
+ $pdf->AddPage($orientation = '', $format = ''); // facon fpdi
$pdf->useTemplate($tplidx,0,0,210);
if ($d==1){
$pdf->SetY(5);
@@ -118,15 +134,15 @@
$pdf->SetFont("helvetica","B",8);
$pdf->SetTextColor(254,0,0);
$pdf->SetFillColor(254,0,0); //fond
- // setdisplaymode zoom pdf
- $axe_x=170;
- $axe_y=0;
- $retour=3;
- $pdf->SetXY($axe_x , $pdf->y+$axe_y);
+ // position du cachet
+ $axe_x=170; // x
+ $axe_y=10; // y
+ $retour=3; // interligne
+ $pdf->SetXY($axe_x , $axe_y);
$pdf->Cell(0, 6, "Le ".date('d/m/Y'));
- $pdf->SetXY($axe_x, $pdf->y+$retour);
+ $pdf->SetXY($axe_x, $axe_y+$retour);
$pdf->Cell(0, 6, "Registre : ".$this->valF['registre']);
- $pdf->SetXY($axe_x, $pdf->y+$retour);
+ $pdf->SetXY($axe_x, $axe_y+$retour*2);
$pdf->Cell(0, 6, "service courrier");
//$pdf->Write(0, "c est le write"); //test
}

Modified: branches/5.1.0/obj/diffusion.class.php
===================================================================
--- branches/5.1.0/obj/diffusion.class.php 2020-06-12 15:53:34 UTC (rev 1117)
+++ branches/5.1.0/obj/diffusion.class.php 2020-06-12 20:12:04 UTC (rev 1118)
@@ -386,7 +386,7 @@
// dossier arrive
$sql="select dossier from ".DB_PREFIXE."dossier where courrier = ".$id.
" and type_dossier =".$nature;
- $dossier_diffusion = $db->getOne($sql);
+ $dossier_diffusion = $this->f->db->getOne($sql);
if (database::isError($dossier_diffusion)) die($dossier_diffusion->getMessage().$sql);
$this->addToLog("diffusion.class/diffusion_dossier: db->query(\"".$sql."\");",VERBOSE_MODE);
return $dossier_diffusion;

Reply all
Reply to author
Forward
0 new messages