From 313e1ac313b57883b9d8fccad20c2fd9a67d579f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 5 Jan 2009 00:35:20 +0000 Subject: [PATCH] Removed deprecated files --- htdocs/adherents/cartes/carte.php | 1 - htdocs/adherents/cartes/etiquette.php | 1 - htdocs/admin/barcode.php | 117 +----- htdocs/conf/conf.class.php | 3 +- .../barcode/php-barcode/php-barcode.php | 11 +- htdocs/includes/dolibarr_changes.txt | 20 +- .../fpdf/DolibarrPdfBarCode.class.php | 353 ------------------ htdocs/includes/fpdf/fpdf_html.php | 104 ------ htdocs/includes/fpdf/fpdf_indexes.php | 206 ---------- htdocs/includes/fpdf/fpdf_label.php | 186 --------- .../includes/modules/action/rapport.pdf.php | 2 - .../modules/barcode/phpbarcode.modules.php | 34 +- .../pdf/ModelePdfExpedition.class.php | 6 +- .../pdf/pdf_expedition_rouget.modules.php | 12 +- 14 files changed, 72 insertions(+), 984 deletions(-) delete mode 100644 htdocs/includes/fpdf/DolibarrPdfBarCode.class.php delete mode 100644 htdocs/includes/fpdf/fpdf_html.php delete mode 100644 htdocs/includes/fpdf/fpdf_indexes.php delete mode 100644 htdocs/includes/fpdf/fpdf_label.php diff --git a/htdocs/adherents/cartes/carte.php b/htdocs/adherents/cartes/carte.php index 4f16ca7d2c9..6f64e9cb091 100755 --- a/htdocs/adherents/cartes/carte.php +++ b/htdocs/adherents/cartes/carte.php @@ -70,7 +70,6 @@ if (! file_exists($dir)) } } -//$pdf = new PDF_Label(array('name'=>'perso1', 'marginLeft'=>1, 'marginTop'=>1, 'NX'=>2, 'NY'=>7, 'SpaceX'=>0, 'SpaceY'=>0, 'width'=>99.1, 'height'=>'38.1', 'metric'=>'mm', 'font-size'=>14), 1, 2); $pdf = new PDF_card('CARD', 1, 1); $pdf->Open(); diff --git a/htdocs/adherents/cartes/etiquette.php b/htdocs/adherents/cartes/etiquette.php index ae776b44522..41eaf032383 100755 --- a/htdocs/adherents/cartes/etiquette.php +++ b/htdocs/adherents/cartes/etiquette.php @@ -52,7 +52,6 @@ if (! file_exists($dir)) -//$pdf = new PDF_Label(array('name'=>'perso1', 'marginLeft'=>1, 'marginTop'=>1, 'NX'=>2, 'NY'=>7, 'SpaceX'=>0, 'SpaceY'=>0, 'width'=>99.1, 'height'=>'38.1', 'metric'=>'mm', 'font-size'=>14), 1, 2); //$pdf = new PDF_card('CARD', 1, 1); if (defined("ADHERENT_ETIQUETTE_TYPE") && ADHERENT_ETIQUETTE_TYPE !=''){ $pdf = new PDF_card(ADHERENT_ETIQUETTE_TYPE, 1, 1); diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index 57393943104..1fe69a47488 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -160,6 +160,10 @@ if ($resql) if ($module->encodingIsSupported($obj->encoding)) { + // Build barcode on disk + $result=$module->writeBarCode($obj->example,$obj->encoding,'Y'); + + // Output files with barcode generators $url=DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($obj->coder).'&code='.urlencode($obj->example).'&encoding='.urlencode($obj->encoding); //print $url; print ''; @@ -257,119 +261,6 @@ if ($conf->produit->enabled) print ''; -/* - //EAN13 - $var=!$var; - print ''; - print "EAN13"; - print "\n"; - - print "L'EAN se compose de 13 caract�res, 12 chiffres plus une cl� de contr�le. Il fonctionne de la m�me mani�re que l'UPC, avec lequel il est compatible.
"; - print "L'utilisation des symbologies EAN13 impose la souscription et l'abonnement aupr�s d'organisme tel que GENCOD.
"; - print "Codes num�riques utilis�s exclusivement � l'identification des produits susceptibles d'�tre vendus au grand public."; - print ''; - - // Affiche exemple - print ''; - - print ''; - print $formbarcode->setBarcodeEncoder('EAN13','form'.$i); - print "\n"; - $i++; - - //UPC - $var=!$var; - print ''; - print "UPC"; - print "\n"; - print "L'UPC est l'�quivalent de l'EAN8/13 pour des pays codificateurs autre que l'Europe.
"; - print "Il ne comporte que 11 chiffres plus la cl�.
"; - print "C'est en r�alit� un code EAN13 dont le premier chiffre serait z�ro et dont la pr�sentation serait l�g�rement diff�rente.
"; - print "Codes num�riques utilis�s exclusivement � l'identification des produits susceptibles d'�tre vendus au grand public."; - print ''; - - // Affiche exemple - print ''; - - print ''; - print $formbarcode->setBarcodeEncoder('UPC','form'.$i); - print "\n"; - $i++; - - //ISBN - $var=!$var; - print ''; - print "ISBN"; - print "\n"; - print "Le code ISBN est un code d�di� au milieu de la presse �crite."; - print ''; - - // Affiche exemple - print ''; - - print ''; - print $formbarcode->setBarcodeEncoder('ISBN','form'.$i); - print "\n"; - $i++; - - //code 39 - $var=!$var; - print ''; - print "Code 39"; - print "\n"; - print "Premier code alpha num�rique utilis� massivement dans l'Industrie pour sa capacit� d'encodage (chiffres et lettres)
"; - print "ainsi que par son degr� de s�curit� � l'encodage (clef de contr�le).
"; - print "Il met a disposition les 10 chiffres, les 26 lettres de l'alphabet et sept symboles.
"; - print "l'ast�risque (*) sert de caract�re de bornage. La lecture est bidirectionnelle.
"; - print "La longueur est variable mais en g�n�ral ne d�passe pas 32 caract�res."; - print ''; - - // Affiche exemple - print ''; - - print ''; - print $formbarcode->setBarcodeEncoder('C39','form'.$i); - print "\n"; - $i++; - - - //code 128 - $var=!$var; - print ''; - print "Code 128"; - print "\n"; - print "Ce code \"derni�re g�n�ration\" alpha num�rique est susceptible d'encoder les 128 caract�res de la table ASCII ( chiffres + lettres + symboles ).
"; - print "Le code 128 poss�de des algorithmes de cryptage s�curis�s assez avanc�s.
"; - print "C'est le plus complet des codes � barres, il propose 3 jeux de 128 caract�res.
"; - print "La lecture est bidirectionnelle.
"; - print "La longueur est variable mais en g�n�ral ne d�passe pas 20 caract�res."; - print ''; - - // Affiche exemple - print ''; - - print ''; - print $formbarcode->setBarcodeEncoder('C128','form'.$i); - print "\n"; - $i++; - - //I25 - $var=!$var; - print ''; - print "I25"; - print "\n"; - print "information"; - print ''; - - // Affiche exemple - print ''; - - print ''; - print $formbarcode->setBarcodeEncoder('I25','form'.$i); - print "\n"; - $i++; - */ - print "
"; $db->close(); diff --git a/htdocs/conf/conf.class.php b/htdocs/conf/conf.class.php index c2e028865f4..4b24b868cf4 100644 --- a/htdocs/conf/conf.class.php +++ b/htdocs/conf/conf.class.php @@ -282,7 +282,8 @@ class Conf // Module oscommerce 1 $this->boutique->livre->enabled=defined("BOUTIQUE_LIVRE")?BOUTIQUE_LIVRE:0; $this->boutique->album->enabled=defined("BOUTIQUE_ALBUM")?BOUTIQUE_ALBUM:0; - + // Module Barcode + $this->barcode->dir_temp=DOL_DATA_ROOT."/barcode/temp"; /* * Modification de quelques variable de conf en fonction des Constantes diff --git a/htdocs/includes/barcode/php-barcode/php-barcode.php b/htdocs/includes/barcode/php-barcode/php-barcode.php index 75407e2d42b..dba19e1159b 100644 --- a/htdocs/includes/barcode/php-barcode/php-barcode.php +++ b/htdocs/includes/barcode/php-barcode/php-barcode.php @@ -207,6 +207,9 @@ function barcode_outimage($text, $bars, $scale = 1, $mode = "png", } } + // DOLCHANGE LDR + global $filebarcode; + /* output the image */ $mode=strtolower($mode); if ($mode=='jpg' || $mode=='jpeg'){ @@ -215,11 +218,17 @@ function barcode_outimage($text, $bars, $scale = 1, $mode = "png", } else if ($mode=='gif'){ header("Content-Type: image/gif; name=\"barcode.gif\""); imagegif($im); + + // Begin DOLCHANGE LDR + } else if (! empty($filebarcode)) + { + imagepng($im,$filebarcode); + // End DOLCHANGE LDR + } else { header("Content-Type: image/png; name=\"barcode.png\""); imagepng($im); } - } /* diff --git a/htdocs/includes/dolibarr_changes.txt b/htdocs/includes/dolibarr_changes.txt index df066fc11f6..de18114f22d 100644 --- a/htdocs/includes/dolibarr_changes.txt +++ b/htdocs/includes/dolibarr_changes.txt @@ -3,9 +3,27 @@ This file describe changes made on external library after beeing included in Dolibarr root. +PHP-BARCODE: +------------ +If files are replaced by new version, following changes must be done: + +* Add lines into barcode_outimage function +******************************************* + // DOLCHANGE LDR + global $filebarcode; + + + // Begin DOLCHANGE LDR + } else if (! empty($filebarcode)) + { + imagepng($im,$filebarcode); + // End DOLCHANGE LDR + + + FCKEDITOR: ---------- -If fckeditor files are replaced by new version, following changes must be done: +If files are replaced by new version, following changes must be done: * Edit file fckeditor/editor/filemanager/browser/default/browser.css ********************************************************** diff --git a/htdocs/includes/fpdf/DolibarrPdfBarCode.class.php b/htdocs/includes/fpdf/DolibarrPdfBarCode.class.php deleted file mode 100644 index 08a959ea75f..00000000000 --- a/htdocs/includes/fpdf/DolibarrPdfBarCode.class.php +++ /dev/null @@ -1,353 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - */ -require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php'); - - -class DolibarrPdfBarCode extends FPDF { - - /* Author Olivier PLATHEY - * Licence Freeware see : http://fpdf.org/fr/script/script5.php - */ - function EAN13($x,$y,$barcode,$h=16,$w=.35) - { - $this->Barcode($x,$y,$barcode,$h,$w,13); - } - - function UPC_A($x,$y,$barcode,$h=16,$w=.35) - { - $this->Barcode($x,$y,$barcode,$h,$w,12); - } - - function GetCheckDigit($barcode) - { - //Calcule le chiffre de contrôle - $sum=0; - for($i=1;$i<=11;$i+=2) - $sum+=3*$barcode{$i}; - for($i=0;$i<=10;$i+=2) - $sum+=$barcode{$i}; - $r=$sum%10; - if($r>0) - $r=10-$r; - return $r; - } - - function TestCheckDigit($barcode) - { - //Vérifie le chiffre de contrôle - $sum=0; - for($i=1;$i<=11;$i+=2) - $sum+=3*$barcode{$i}; - for($i=0;$i<=10;$i+=2) - $sum+=$barcode{$i}; - return ($sum+$barcode{12})%10==0; - } - - function Barcode($x,$y,$barcode,$h,$w,$len) - { - //Ajoute des 0 si nécessaire - $barcode=str_pad($barcode,$len-1,'0',STR_PAD_LEFT); - if($len==12) - $barcode='0'.$barcode; - //Ajoute ou teste le chiffre de contrôle - if(strlen($barcode)==12) - $barcode.=$this->GetCheckDigit($barcode); - elseif(!$this->TestCheckDigit($barcode)) - $this->Error('Incorrect check digit'); - //Convertit les chiffres en barres - $codes=array( - 'A'=>array( - '0'=>'0001101','1'=>'0011001','2'=>'0010011','3'=>'0111101','4'=>'0100011', - '5'=>'0110001','6'=>'0101111','7'=>'0111011','8'=>'0110111','9'=>'0001011'), - 'B'=>array( - '0'=>'0100111','1'=>'0110011','2'=>'0011011','3'=>'0100001','4'=>'0011101', - '5'=>'0111001','6'=>'0000101','7'=>'0010001','8'=>'0001001','9'=>'0010111'), - 'C'=>array( - '0'=>'1110010','1'=>'1100110','2'=>'1101100','3'=>'1000010','4'=>'1011100', - '5'=>'1001110','6'=>'1010000','7'=>'1000100','8'=>'1001000','9'=>'1110100') - ); - $parities=array( - '0'=>array('A','A','A','A','A','A'), - '1'=>array('A','A','B','A','B','B'), - '2'=>array('A','A','B','B','A','B'), - '3'=>array('A','A','B','B','B','A'), - '4'=>array('A','B','A','A','B','B'), - '5'=>array('A','B','B','A','A','B'), - '6'=>array('A','B','B','B','A','A'), - '7'=>array('A','B','A','B','A','B'), - '8'=>array('A','B','A','B','B','A'), - '9'=>array('A','B','B','A','B','A') - ); - $code='101'; - $p=$parities[$barcode{0}]; - for($i=1;$i<=6;$i++) - $code.=$codes[$p[$i-1]][$barcode{$i}]; - $code.='01010'; - for($i=7;$i<=12;$i++) - $code.=$codes['C'][$barcode{$i}]; - $code.='101'; - //Dessine les barres - for($i=0;$iRect($x+$i*$w,$y,$w,$h,'F'); - } - //Imprime le texte sous le code-barres - $this->SetFont('Arial','',12); - $this->Text($x,$y+$h+11/$this->k,substr($barcode,-$len)); -} - - /* - * Licence See i25/info.htm - */ - - function i25($xpos, $ypos, $code, $basewidth=1, $height=10){ - - $wide = $basewidth; - $narrow = $basewidth / 3 ; - - // wide/narrow codes for the digits - $barChar['0'] = 'nnwwn'; - $barChar['1'] = 'wnnnw'; - $barChar['2'] = 'nwnnw'; - $barChar['3'] = 'wwnnn'; - $barChar['4'] = 'nnwnw'; - $barChar['5'] = 'wnwnn'; - $barChar['6'] = 'nwwnn'; - $barChar['7'] = 'nnnww'; - $barChar['8'] = 'wnnwn'; - $barChar['9'] = 'nwnwn'; - $barChar['A'] = 'nn'; - $barChar['Z'] = 'wn'; - - // add leading zero if code-length is odd - if(strlen($code) % 2 != 0){ - $code = '0' . $code; - } - - $this->SetFont('Arial','',10); - $this->Text($xpos, $ypos + $height + 4, $code); - $this->SetFillColor(0); - - // add start and stop codes - $code = 'AA'.strtolower($code).'ZA'; - - for($i=0; $iError('Invalid character in barcode: '.$charBar); - } - if(!isset($barChar[$charSpace])) - { - $this->Error('Invalid character in barcode: '.$charSpace); - } - // create a wide/narrow-sequence (first digit=bars, second digit=spaces) - $seq = ''; - for($s=0; $sRect($xpos, $ypos, $lineWidth, $height, 'F'); - } - $xpos += $lineWidth; - } - } - } - - - /* - * Copyright ehavet@yahoo.fr - * Emmanuel Havet - * License: Freeware - * - */ - - function Code39($x, $y, $code, $ext = true, $cks = false, $w = 0.4, $h = 20, $wide = true) - { - //Display code - $this->SetFont('Arial', '', 10); - $this->Text($x, $y+$h+4, $code); - $this->SetFillColor(0,0,0); - - if($ext) - { - //Extended encoding - $code = $this->encode_code39_ext($code); - } - else - { - //Convert to upper case - $code = strtoupper($code); - //Check validity - if(!preg_match('|^[0-9A-Z. $/+%-]*$|', $code)) - $this->Error('Invalid barcode value: '.$code); - } - - //Compute checksum - if ($cks) - $code .= $this->checksum_code39($code); - - //Add start and stop characters - $code = '*'.$code.'*'; - - //Conversion tables - $narrow_encoding = array ( - '0' => '101001101101', '1' => '110100101011', '2' => '101100101011', - '3' => '110110010101', '4' => '101001101011', '5' => '110100110101', - '6' => '101100110101', '7' => '101001011011', '8' => '110100101101', - '9' => '101100101101', 'A' => '110101001011', 'B' => '101101001011', - 'C' => '110110100101', 'D' => '101011001011', 'E' => '110101100101', - 'F' => '101101100101', 'G' => '101010011011', 'H' => '110101001101', - 'I' => '101101001101', 'J' => '101011001101', 'K' => '110101010011', - 'L' => '101101010011', 'M' => '110110101001', 'N' => '101011010011', - 'O' => '110101101001', 'P' => '101101101001', 'Q' => '101010110011', - 'R' => '110101011001', 'S' => '101101011001', 'T' => '101011011001', - 'U' => '110010101011', 'V' => '100110101011', 'W' => '110011010101', - 'X' => '100101101011', 'Y' => '110010110101', 'Z' => '100110110101', - '-' => '100101011011', '.' => '110010101101', ' ' => '100110101101', - '*' => '100101101101', '$' => '100100100101', '/' => '100100101001', - '+' => '100101001001', '%' => '101001001001' ); - - $wide_encoding = array ( - '0' => '101000111011101', '1' => '111010001010111', '2' => '101110001010111', - '3' => '111011100010101', '4' => '101000111010111', '5' => '111010001110101', - '6' => '101110001110101', '7' => '101000101110111', '8' => '111010001011101', - '9' => '101110001011101', 'A' => '111010100010111', 'B' => '101110100010111', - 'C' => '111011101000101', 'D' => '101011100010111', 'E' => '111010111000101', - 'F' => '101110111000101', 'G' => '101010001110111', 'H' => '111010100011101', - 'I' => '101110100011101', 'J' => '101011100011101', 'K' => '111010101000111', - 'L' => '101110101000111', 'M' => '111011101010001', 'N' => '101011101000111', - 'O' => '111010111010001', 'P' => '101110111010001', 'Q' => '101010111000111', - 'R' => '111010101110001', 'S' => '101110101110001', 'T' => '101011101110001', - 'U' => '111000101010111', 'V' => '100011101010111', 'W' => '111000111010101', - 'X' => '100010111010111', 'Y' => '111000101110101', 'Z' => '100011101110101', - '-' => '100010101110111', '.' => '111000101011101', ' ' => '100011101011101', - '*' => '100010111011101', '$' => '100010001000101', '/' => '100010001010001', - '+' => '100010100010001', '%' => '101000100010001'); - - $encoding = $wide ? $wide_encoding : $narrow_encoding; - - //Inter-character spacing - $gap = ($w > 0.29) ? '00' : '0'; - - //Convert to bars - $encode = ''; - for ($i = 0; $i< strlen($code); $i++) - $encode .= $encoding[$code{$i}].$gap; - - //Draw bars - $this->draw_code39($encode, $x, $y, $w, $h); - } - - function checksum_code39($code) { - - //Compute the modulo 43 checksum - - $chars = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', - 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', - 'W', 'X', 'Y', 'Z', '-', '.', ' ', '$', '/', '+', '%'); - $sum = 0; - for ($i=0 ; $i '%U', chr(1) => '$A', chr(2) => '$B', chr(3) => '$C', - chr(4) => '$D', chr(5) => '$E', chr(6) => '$F', chr(7) => '$G', - chr(8) => '$H', chr(9) => '$I', chr(10) => '$J', chr(11) => '£K', - chr(12) => '$L', chr(13) => '$M', chr(14) => '$N', chr(15) => '$O', - chr(16) => '$P', chr(17) => '$Q', chr(18) => '$R', chr(19) => '$S', - chr(20) => '$T', chr(21) => '$U', chr(22) => '$V', chr(23) => '$W', - chr(24) => '$X', chr(25) => '$Y', chr(26) => '$Z', chr(27) => '%A', - chr(28) => '%B', chr(29) => '%C', chr(30) => '%D', chr(31) => '%E', - chr(32) => ' ', chr(33) => '/A', chr(34) => '/B', chr(35) => '/C', - chr(36) => '/D', chr(37) => '/E', chr(38) => '/F', chr(39) => '/G', - chr(40) => '/H', chr(41) => '/I', chr(42) => '/J', chr(43) => '/K', - chr(44) => '/L', chr(45) => '-', chr(46) => '.', chr(47) => '/O', - chr(48) => '0', chr(49) => '1', chr(50) => '2', chr(51) => '3', - chr(52) => '4', chr(53) => '5', chr(54) => '6', chr(55) => '7', - chr(56) => '8', chr(57) => '9', chr(58) => '/Z', chr(59) => '%F', - chr(60) => '%G', chr(61) => '%H', chr(62) => '%I', chr(63) => '%J', - chr(64) => '%V', chr(65) => 'A', chr(66) => 'B', chr(67) => 'C', - chr(68) => 'D', chr(69) => 'E', chr(70) => 'F', chr(71) => 'G', - chr(72) => 'H', chr(73) => 'I', chr(74) => 'J', chr(75) => 'K', - chr(76) => 'L', chr(77) => 'M', chr(78) => 'N', chr(79) => 'O', - chr(80) => 'P', chr(81) => 'Q', chr(82) => 'R', chr(83) => 'S', - chr(84) => 'T', chr(85) => 'U', chr(86) => 'V', chr(87) => 'W', - chr(88) => 'X', chr(89) => 'Y', chr(90) => 'Z', chr(91) => '%K', - chr(92) => '%L', chr(93) => '%M', chr(94) => '%N', chr(95) => '%O', - chr(96) => '%W', chr(97) => '+A', chr(98) => '+B', chr(99) => '+C', - chr(100) => '+D', chr(101) => '+E', chr(102) => '+F', chr(103) => '+G', - chr(104) => '+H', chr(105) => '+I', chr(106) => '+J', chr(107) => '+K', - chr(108) => '+L', chr(109) => '+M', chr(110) => '+N', chr(111) => '+O', - chr(112) => '+P', chr(113) => '+Q', chr(114) => '+R', chr(115) => '+S', - chr(116) => '+T', chr(117) => '+U', chr(118) => '+V', chr(119) => '+W', - chr(120) => '+X', chr(121) => '+Y', chr(122) => '+Z', chr(123) => '%P', - chr(124) => '%Q', chr(125) => '%R', chr(126) => '%S', chr(127) => '%T'); - - $code_ext = ''; - for ($i = 0 ; $i 127) - $this->Error('Invalid character: '.$code{$i}); - $code_ext .= $encode[$code{$i}]; - } - return $code_ext; - } - - function draw_code39($code, $x, $y, $w, $h) - { - //Draw bars - - for($i=0; $iRect($x+$i*$w, $y, $w, $h, 'F'); - } - } -} diff --git a/htdocs/includes/fpdf/fpdf_html.php b/htdocs/includes/fpdf/fpdf_html.php deleted file mode 100644 index 41974667315..00000000000 --- a/htdocs/includes/fpdf/fpdf_html.php +++ /dev/null @@ -1,104 +0,0 @@ -FPDF($orientation,$unit,$format); - //Initialisation - $this->B=0; - $this->I=0; - $this->U=0; - $this->HREF=''; - } - - function WriteHTML($html) - { - //Parseur HTML - $html=str_replace("\n",' ',$html); - $a=preg_split('/<(.*)>/U',$html,-1,PREG_SPLIT_DELIM_CAPTURE); - foreach($a as $i=>$e) - { - if($i%2==0) - { - //Texte - if($this->HREF) - $this->PutLink($this->HREF,$e); - else - $this->Write(5,$e); - } - else - { - //Balise - if($e{0}=='/') - $this->CloseTag(strtoupper(substr($e,1))); - else - { - //Extraction des attributs - $a2=explode(' ',$e); - $tag=strtoupper(array_shift($a2)); - $attr=array(); - foreach($a2 as $v) - if(ereg('^([^=]*)=["\']?([^"\']*)["\']?$',$v,$a3)) - $attr[strtoupper($a3[1])]=$a3[2]; - $this->OpenTag($tag,$attr); - } - } - } - } - - function OpenTag($tag,$attr) - { - //Balise ouvrante - if($tag=='B' or $tag=='I' or $tag=='U') - $this->SetStyle($tag,true); - if($tag=='A') - $this->HREF=$attr['HREF']; - if($tag=='BR') - $this->Ln(5); - } - - function CloseTag($tag) - { - //Balise fermante - if($tag=='B' or $tag=='I' or $tag=='U') - $this->SetStyle($tag,false); - if($tag=='A') - $this->HREF=''; - } - - function SetStyle($tag,$enable) - { - //Modifie le style et sélectionne la police correspondante - $this->$tag+=($enable ? 1 : -1); - $style=''; - foreach(array('B','I','U') as $s) - if($this->$s>0) - $style.=$s; - $this->SetFont('',$style); - } - - function PutLink($URL,$txt) - { - //Place un hyperlien - $this->SetTextColor(0,0,255); - $this->SetStyle('U',true); - $this->Write(5,$txt,$URL); - $this->SetStyle('U',false); - $this->SetTextColor(0); - } -} -?> diff --git a/htdocs/includes/fpdf/fpdf_indexes.php b/htdocs/includes/fpdf/fpdf_indexes.php deleted file mode 100644 index e672a9042fc..00000000000 --- a/htdocs/includes/fpdf/fpdf_indexes.php +++ /dev/null @@ -1,206 +0,0 @@ -Reference[$index]); - - //Search the reference in the array - for ($i=0;$i<$size;$i++) - { - if ($this->Reference[$index][$i]['t']==$txt) - { - $Present=1; - $this->Reference[$index][$i]['p'].=','.$this->PageNo(); - } - } - - //If not found, add it - if ($Present==0) - { - $this->Reference[$index][]=array('t'=>$txt,'p'=>$this->PageNo()); - } - } - - function ReferenceNewPage($link='') - { - $this->AddPage(); - if ($link) - { - $this->SetLink($link); - } - $this->SetFont('Arial','',15); - $this->SetXY(10,10); - $this->MultiCell(190,12, $this->IndexesName[$this->IndexName], 1 ,'C', 0); - $this->y0 = $this->GetY() + 2; - $this->SetY($this->y0); - $this->SetFontSize(8); - } - - function ReferencePrintSection() - { - $this->SetY($this->GetY() + 2); - - if ($this->GetY() > $this->YMax) - { - $this->ReferenceNewPage(); - } - if ( $this->ReferenceNextSection == $this->ReferenceCurrentSection) - { - $this->SetFontSize(9); - $this->MultiCell(90, 4, $this->ReferenceCurrentSection ,0,1,'L'); - $this->SetFontSize(8); - } - } - - function CreateReference($NbCol, $index, $link='') - { - $this->YMax = 270; - $this->NbCol = $NbCol; - $this->SetCol(0); - $this->IndexName = $index; - $page = 1; - // New Page - $page = $this->ReferenceNewPage($link); - - //Initialization - $this->SetFontSize(8); - - $size = sizeof($this->Reference[$index]); - $PageWidth = $this->w - $this->lMargin - $this->rMargin; - $last = ''; - for ($i=0 ; $i < $size ; $i++) - { - $this->ReferenceNextSection = $this->Reference[$index][$i]['t'][0]; - - if ($this->GetY() > $this->YMax) - { - $this->ReferenceNextCol(); - } - // - // Section Break - // - if ($last <> $this->Reference[$index][$i]['t'][0]) - { - $last = $this->Reference[$index][$i]['t'][0]; - $this->ReferenceCurrentSection = $last; - $this->ReferencePrintSection(); - } - - //LibelleLabel - if (is_array($this->Reference[$index][$i]['t'])) - { - $str= " ".$this->Reference[$index][$i]['t'][1]; - } - else - { - $str= $this->Reference[$index][$i]['t']; - } - - $strsize=$this->GetStringWidth($str); - - $this->Cell($strsize+2,$this->FontSize+2,$str,0,0,'R'); - - //Dots - //Computes the widths - $ColWidth = ($PageWidth/$NbCol)-2; - $w=$ColWidth-$this->GetStringWidth($this->Reference[$index][$i]['p'])-($strsize+4); - if ($w<15) - $w=15; - $nb=$w/$this->GetStringWidth('.'); - $dots=str_repeat('.',$nb-2); - $this->Cell($w,$this->FontSize+2,$dots,0,0,'L'); - - //Page number - $Largeur=$ColWidth-$strsize-$w; - $this->MultiCell($Largeur,$this->FontSize+1,$this->Reference[$index][$i]['p'],0,1,'R'); - } - } - - function SetCol($col) - { - //Set position on a column - $this->col=$col; - $x=$this->rMargin+$col*($this->w-$this->rMargin-$this->rMargin)/$this->NbCol; - $this->SetLeftMargin($x); - $this->SetX($x); - } - - function ReferenceNextCol() - { - if($this->col < $this->NbCol-1) - { - //Go to the next column - $this->SetCol($this->col+1); - $this->SetY($this->y0); - $this->ReferencePrintSection(); - //Stay on the page - return false; - } - else - { - //Go back to the first column - $this->SetCol(0); - $this->ReferenceNewPage(); - $this->ReferencePrintSection(); - //Page break - return true; - } - } - /* - * - * - */ - function SortReference($index) - { - $ar = $this->Reference[$index]; - - $size=sizeof($this->Reference[$index]); - $cats = array(); - $last = ''; - for ($i=0;$i<$size;$i++) - { - //print $ar[$i]['t'][0] . "
"; - $cat = $ar[$i]['t'][0]; - if (! array_key_exists($cat, $cats)) - { - $cats[$cat] = array(); - } - array_push($cats[$cat], array($ar[$i]['t'][1], $ar[$i]['p'])); - } - - ksort($cats); - //var_dump($cats); - $i = 0; - foreach ($cats as $key => $value) - { - foreach ($value as $skey => $svalue) - { - $this->Reference[$index][$i]['t'][0] = $key; - $this->Reference[$index][$i]['t'][1] = $svalue[0]; - $this->Reference[$index][$i]['p'] = $svalue[1]; - $i++; - } - - } - - } - -} -?> diff --git a/htdocs/includes/fpdf/fpdf_label.php b/htdocs/includes/fpdf/fpdf_label.php deleted file mode 100644 index 3f3ee526c94..00000000000 --- a/htdocs/includes/fpdf/fpdf_label.php +++ /dev/null @@ -1,186 +0,0 @@ - Now, just modify the size of the font -// = : Set_Char_Size renamed to Set_Font_Size -//////////////////////////////////////////////////// - -/** - * Modifié par Regis Houssin - * PDF_Label - PDF label editing - * @package PDF_Label - * @author Laurent PASSEBECQ - * @copyright 2003 Laurent PASSEBECQ - * $Id$ - * $Source$ -**/ - -require_once(FPDF_PATH."fpdf.php"); - -class PDF_Label extends FPDF { - - // Propriétés privées - var $_Avery_Name = ''; // Nom du format de l'étiquette - var $_Margin_Left = 0; // Marge de gauche de l'étiquette - var $_Margin_Top = 0; // marge en haut de la page avant la première étiquette - var $_X_Space = 0; // Espace horizontal entre 2 bandes d'étiquettes - var $_Y_Space = 0; // Espace vertical entre 2 bandes d'étiquettes - var $_X_Number = 0; // Nombre d'étiquettes sur la largeur de la page - var $_Y_Number = 0; // Nombre d'étiquettes sur la hauteur de la page - var $_Width = 0; // Largeur de chaque étiquette - var $_Height = 0; // Hauteur de chaque étiquette - var $_Char_Size = 10; // Hauteur des caractères - var $_Line_Height = 10; // Hauteur par défaut d'une ligne - var $_Metric = 'mm'; // Type of metric for labels.. Will help to calculate good values - var $_Metric_Doc = 'mm'; // Type of metric for the document - var $_Font_Name = 'Arial'; // Name of the font - - var $_COUNTX = 1; - var $_COUNTY = 1; - - - // Listing of labels size - var $_Avery_Labels = array ( - '5160'=>array('name'=>'5160', 'paper-size'=>'letter', 'metric'=>'mm', 'marginLeft'=>1.762, 'marginTop'=>10.7, 'NX'=>3, 'NY'=>10, 'SpaceX'=>3.175, 'SpaceY'=>0, 'width'=>66.675, 'height'=>25.4, 'font-size'=>8), - '5161'=>array('name'=>'5161', 'paper-size'=>'letter', 'metric'=>'mm', 'marginLeft'=>0.967, 'marginTop'=>10.7, 'NX'=>2, 'NY'=>10, 'SpaceX'=>3.967, 'SpaceY'=>0, 'width'=>101.6, 'height'=>25.4, 'font-size'=>8), - '5162'=>array('name'=>'5162', 'paper-size'=>'letter', 'metric'=>'mm', 'marginLeft'=>0.97, 'marginTop'=>20.224, 'NX'=>2, 'NY'=>7, 'SpaceX'=>4.762, 'SpaceY'=>0, 'width'=>100.807, 'height'=>35.72, 'font-size'=>8), - '5163'=>array('name'=>'5163', 'paper-size'=>'letter', 'metric'=>'mm', 'marginLeft'=>1.762, 'marginTop'=>10.7, 'NX'=>2, 'NY'=>5, 'SpaceX'=>3.175, 'SpaceY'=>0, 'width'=>101.6, 'height'=>50.8, 'font-size'=>8), - '5164'=>array('name'=>'5164', 'paper-size'=>'letter', 'metric'=>'in', 'marginLeft'=>0.148, 'marginTop'=>0.5, 'NX'=>2, 'NY'=>3, 'SpaceX'=>0.2031, 'SpaceY'=>0, 'width'=>4.0, 'height'=>3.33, 'font-size'=>12), - '8600'=>array('name'=>'8600', 'paper-size'=>'letter', 'metric'=>'mm', 'marginLeft'=>7.1, 'marginTop'=>19, 'NX'=>3, 'NY'=>10, 'SpaceX'=>9.5, 'SpaceY'=>3.1, 'width'=>66.6, 'height'=>25.4, 'font-size'=>8), - 'L7163'=>array('name'=>'L7163', 'paper-size'=>'A4', 'metric'=>'mm', 'marginLeft'=>5, 'marginTop'=>15, 'NX'=>2, 'NY'=>7, 'SpaceX'=>25, 'SpaceY'=>0, 'width'=>99.1, 'height'=>38.1, 'font-size'=>9) - ); - - // convert units (in to mm, mm to in) - // $src and $dest must be 'in' or 'mm' - function _Convert_Metric ($value, $src, $dest) { - if ($src != $dest) { - $tab['in'] = 39.37008; - $tab['mm'] = 1000; - return $value * $tab[$dest] / $tab[$src]; - } else { - return $value; - } - } - - // Give the height for a char size given. - function _Get_Height_Chars($pt) { - // Tableau de concordance entre la hauteur des caractères et de l'espacement entre les lignes - $_Table_Hauteur_Chars = array(6=>2, 7=>2.5, 8=>3, 9=>4, 10=>5, 11=>6, 12=>7, 13=>8, 14=>9, 15=>10); - if (in_array($pt, array_keys($_Table_Hauteur_Chars))) { - return $_Table_Hauteur_Chars[$pt]; - } else { - return 100; // There is a prob.. - } - } - - function _Set_Format($format) { - $this->_Metric = $format['metric']; - $this->_Avery_Name = $format['name']; - $this->_Margin_Left = $this->_Convert_Metric ($format['marginLeft'], $this->_Metric, $this->_Metric_Doc); - $this->_Margin_Top = $this->_Convert_Metric ($format['marginTop'], $this->_Metric, $this->_Metric_Doc); - $this->_X_Space = $this->_Convert_Metric ($format['SpaceX'], $this->_Metric, $this->_Metric_Doc); - $this->_Y_Space = $this->_Convert_Metric ($format['SpaceY'], $this->_Metric, $this->_Metric_Doc); - $this->_X_Number = $format['NX']; - $this->_Y_Number = $format['NY']; - $this->_Width = $this->_Convert_Metric ($format['width'], $this->_Metric, $this->_Metric_Doc); - $this->_Height = $this->_Convert_Metric ($format['height'], $this->_Metric, $this->_Metric_Doc); - $this->Set_Font_Size($format['font-size']); - } - - function PDF_Label ($format, $unit='mm', $posX=1, $posY=1) { - if (is_array($format)) { - // Si c'est un format personnel alors on maj les valeurs - $Tformat = $format; - } else { - // Si c'est un format avery on stocke le nom de ce format selon la norme Avery. - // Permettra d'aller récupérer les valeurs dans le tableau _Avery_Labels - $Tformat = $this->_Avery_Labels[$format]; - } - - parent::FPDF('P', $Tformat['metric'], $Tformat['paper-size']); - $this->_Set_Format($Tformat); - $this->Set_Font_Name('Arial'); - $this->SetMargins(0,0); - $this->SetAutoPageBreak(false); - - $this->_Metric_Doc = $unit; - // Permet de commencer l'impression à l'étiquette désirée dans le cas où la page a déjà servi - if ($posX > 1) $posX--; else $posX=0; - if ($posY > 1) $posY--; else $posY=0; - if ($posX >= $this->_X_Number) $posX = $this->_X_Number-1; - if ($posY >= $this->_Y_Number) $posY = $this->_Y_Number-1; - $this->_COUNTX = $posX; - $this->_COUNTY = $posY; - } - - // Méthode qui permet de modifier la taille des caractères - // Cela modifiera aussi l'espace entre chaque ligne - function Set_Font_Size($pt) { - if ($pt > 3) { - $this->_Char_Size = $pt; - $this->_Line_Height = $this->_Get_Height_Chars($pt); - $this->SetFontSize($this->_Char_Size); - } - } - - // Method to change font name - function Set_Font_Name($fontname) { - if ($fontname != '') { - $this->_Font_Name = $fontname; - $this->SetFont($this->_Font_Name); - } - } - - // On imprime une étiqette - function Add_PDF_Label($texte) { - // We are in a new page, then we must add a page - if (($this->_COUNTX ==0) and ($this->_COUNTY==0)) { - $this->AddPage(); - } - - $_PosX = $this->_Margin_Left+($this->_COUNTX*($this->_Width+$this->_X_Space)); - $_PosY = $this->_Margin_Top+($this->_COUNTY*($this->_Height+$this->_Y_Space)); - $this->SetXY($_PosX+3, $_PosY+3); - $this->MultiCell($this->_Width, $this->_Line_Height, $texte); - $this->_COUNTY++; - - if ($this->_COUNTY == $this->_Y_Number) { - // Si on est en bas de page, on remonte le 'curseur' de position - $this->_COUNTX++; - $this->_COUNTY=0; - } - - if ($this->_COUNTX == $this->_X_Number) { - // Si on est en bout de page, alors on repart sur une nouvelle page - $this->_COUNTX=0; - $this->_COUNTY=0; - } - } - -} -?> diff --git a/htdocs/includes/modules/action/rapport.pdf.php b/htdocs/includes/modules/action/rapport.pdf.php index 7261108b260..76779fa2e94 100644 --- a/htdocs/includes/modules/action/rapport.pdf.php +++ b/htdocs/includes/modules/action/rapport.pdf.php @@ -26,8 +26,6 @@ */ require_once(FPDFI_PATH.'fpdi_protection.php'); -require_once(DOL_DOCUMENT_ROOT ."/includes/fpdf/fpdf_indexes.php"); -require_once(DOL_DOCUMENT_ROOT ."/includes/fpdf/fpdf_html.php"); require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); /** diff --git a/htdocs/includes/modules/barcode/phpbarcode.modules.php b/htdocs/includes/modules/barcode/phpbarcode.modules.php index de7c694a184..aca30751573 100644 --- a/htdocs/includes/modules/barcode/phpbarcode.modules.php +++ b/htdocs/includes/modules/barcode/phpbarcode.modules.php @@ -16,15 +16,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * or see http://www.gnu.org/ - * - * $Id$ */ /** \file htdocs/includes/modules/barcode/phpbarcode.modules.php \ingroup facture \brief Fichier contenant la classe du modèle de generation code barre phpbarcode - \version $Revision$ + \version $Id$ */ require_once(DOL_DOCUMENT_ROOT ."/includes/modules/barcode/modules_barcode.php"); @@ -84,10 +82,10 @@ class modPhpbarcode extends ModeleBarCode } /** - \brief Retourne fichier image - \param $code Valeur numérique a coder - \param $encoding Mode de codage - \param $readable Code lisible + * \brief Return an image file on output + * \param $code Valeur numérique a coder + * \param $encoding Mode de codage + * \param $readable Code lisible */ function buildBarCode($code,$encoding,$readable='Y') { @@ -112,7 +110,27 @@ class modPhpbarcode extends ModeleBarCode return 1; } - + + /** + * \brief Save an image file on disk + * \param $code Valeur numérique a coder + * \param $encoding Mode de codage + * \param $readable Code lisible + */ + function writeBarCode($code,$encoding,$readable='Y') + { + global $conf,$filebarcode; + + create_exdir($conf->barcode->dir_temp); + + $file=$conf->barcode->dir_temp.'/barcode_'.$code.'_'.$encoding.'.png'; + + $filebarcode=$file; // global var to be used in buildBarCode + $result=$this->buildBarCode($code,$encoding,$readable); + + return $result; + } + } ?> diff --git a/htdocs/includes/modules/expedition/pdf/ModelePdfExpedition.class.php b/htdocs/includes/modules/expedition/pdf/ModelePdfExpedition.class.php index 1e055c3abef..dfc4e1fe651 100644 --- a/htdocs/includes/modules/expedition/pdf/ModelePdfExpedition.class.php +++ b/htdocs/includes/modules/expedition/pdf/ModelePdfExpedition.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2007 Laurent Destailleur + * Copyright (C) 2005-2009 Laurent Destailleur * Copyright (C) 2005 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -27,7 +27,7 @@ */ require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php'); -require_once DOL_DOCUMENT_ROOT.'/includes/fpdf/DolibarrPdfBarCode.class.php'; +require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php'); /** @@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/includes/fpdf/DolibarrPdfBarCode.class.php'; * \brief Parent class of ssending receipts models */ -class ModelePdfExpedition extends DolibarrPdfBarCode +class ModelePdfExpedition extends FPDF { var $error=''; diff --git a/htdocs/includes/modules/expedition/pdf/pdf_expedition_rouget.modules.php b/htdocs/includes/modules/expedition/pdf/pdf_expedition_rouget.modules.php index cb10ce43611..d8a779898fe 100644 --- a/htdocs/includes/modules/expedition/pdf/pdf_expedition_rouget.modules.php +++ b/htdocs/includes/modules/expedition/pdf/pdf_expedition_rouget.modules.php @@ -87,9 +87,11 @@ Class pdf_expedition_rouget extends ModelePdfExpedition $pdf->Rect($this->marge_gauche, $this->marge_haute, $this->page_largeur-$this->marge_gauche-$this->marge_droite, 30); - if ($this->barcode->enabled) + if ($conf->barcode->enabled) { - $pdf->Code39($this->marge_gauche+3, $this->marge_haute+3, $this->expe->ref); + // TODO Build code bar with function writeBarCode of barcode module for sending ref $this->expe->ref + //$pdf->SetXY($this->marge_gauche+3, $this->marge_haute+3); + //$pdf->Image($logo,10, 5, 0, 24); } $pdf->SetDrawColor(128,128,128); @@ -100,9 +102,11 @@ Class pdf_expedition_rouget extends ModelePdfExpedition $pdf->Text($posx, 28, $outputlangs->transnoentities("Date")." : ".dolibarr_print_date($this->expe->date,"%d %b %Y",false,$outputlangs)); $pdf->Text($posx, 34, $outputlangs->transnoentities("Page")." : ".$pdf->PageNo() ."/{nb}", 0); - if ($this->barcode->enabled) + if ($conf->barcode->enabled) { - $pdf->Code39($this->marge_gauche+3, 44, $this->expe->commande->ref); + // TODO Build code bar with function writeBarCode of barcode module for sending ref $this->expe->ref + //$pdf->SetXY($this->marge_gauche+3, $this->marge_haute+3); + //$pdf->Image($logo,10, 5, 0, 24); } $pdf->SetFont('Arial','', 14);