From 4a3aaac8af896ff6a5d3234ef85dbf235c1cda56 Mon Sep 17 00:00:00 2001 From: james Date: Thu, 27 Sep 2007 15:29:48 +0000 Subject: [PATCH] Properly address french mailing labels to schools --- admin/reports_mailinglabels_generator.php | 19 ++++++++++++++++--- lpdf.php | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/admin/reports_mailinglabels_generator.php b/admin/reports_mailinglabels_generator.php index 39853cfa..0b3ea516 100644 --- a/admin/reports_mailinglabels_generator.php +++ b/admin/reports_mailinglabels_generator.php @@ -61,10 +61,12 @@ if($report) switch($report) { + //IF(schools.sciencehead=\"\",\"Science Department Head\",schools.sciencehead) AS co, case "schools": $q=mysql_query("SELECT schools.school AS name, - IF(schools.sciencehead=\"\",\"Science Department Head\",schools.sciencehead) AS co, + schools.schoollang, + schools.sciencehead AS co, schools.address AS address, schools.city AS city, schools.province_code AS province, @@ -140,14 +142,25 @@ if($report) while($r=mysql_fetch_object($q)) { + //handle C/O differently for schools, becuase, well, french schools are picky! + if($report=="schools") { + if($r->sciencehead) + $coname=$r->sciencehead; + else + $coname=i18n("Science Department Head",array(),array(),$r->schoollang); + + $co=i18n("C/O %1",array($coname),array("Name of person"),$r->schoollang); + } + else $co="C/O $r->co"; + if($type=="pdf") { $rep->newLabel(); - $rep->mailingLabel($r->name,$r->co,$r->address,$r->city,$r->province,$r->postalcode); + $rep->mailingLabel($r->name,$co,$r->address,$r->city,$r->province,$r->postalcode); } else if($type=="csv") { - $table['data'][]=array($r->name,$r->co,$r->address,$r->city,$r->province,$r->postalcode); + $table['data'][]=array($r->name,$co,$r->address,$r->city,$r->province,$r->postalcode); } } diff --git a/lpdf.php b/lpdf.php index 177e0953..272b041d 100644 --- a/lpdf.php +++ b/lpdf.php @@ -212,7 +212,7 @@ class lpdf $tmpY+=($lineheight/72)*$l; if($co) { - $l=$this->addLabelText($tmpY,trim(mb_strtoupper("C/O $co"))); + $l=$this->addLabelText($tmpY,trim(mb_strtoupper($co))); $tmpY+=($lineheight/72)*$l; } if($address[strlen($address)-1]==".") $address=substr($address,0,-1);