@@ -24,19 +24,19 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | // Dolibarr environment |
| 26 | 26 | $res = @include("../../main.inc.php"); // From htdocs directory |
| 27 | -if (! $res) { |
|
| 27 | +if (!$res) { |
|
| 28 | 28 | $res = @include("../../../main.inc.php"); // From "custom" directory |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | // Libraries |
| 32 | -require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php"; |
|
| 32 | +require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; |
|
| 33 | 33 | require_once '../lib/subtotal.lib.php'; |
| 34 | 34 | |
| 35 | 35 | // Translations |
| 36 | 36 | $langs->load("subtotal@subtotal"); |
| 37 | 37 | |
| 38 | 38 | // Access control |
| 39 | -if (! $user->admin) { |
|
| 39 | +if (!$user->admin) { |
|
| 40 | 40 | accessforbidden(); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -47,8 +47,8 @@ discard block |
||
| 47 | 47 | llxHeader('', $langs->trans($page_name)); |
| 48 | 48 | |
| 49 | 49 | // Subheader |
| 50 | -$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' |
|
| 51 | - . $langs->trans("BackToModuleList") . '</a>'; |
|
| 50 | +$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php">' |
|
| 51 | + . $langs->trans("BackToModuleList").'</a>'; |
|
| 52 | 52 | print_fiche_titre($langs->trans($page_name), $linkback); |
| 53 | 53 | |
| 54 | 54 | // Configuration header |
@@ -1,8 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | |
| 4 | - if(is_file('../main.inc.php'))$dir = '../'; |
|
| 5 | - else if(is_file('../../../main.inc.php'))$dir = '../../../'; |
|
| 4 | + if (is_file('../main.inc.php'))$dir = '../'; |
|
| 5 | + else if (is_file('../../../main.inc.php'))$dir = '../../../'; |
|
| 6 | 6 | else $dir = '../../'; |
| 7 | 7 | |
| 8 | 8 | include($dir."main.inc.php"); |
@@ -42,12 +42,12 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | $res = $db->query("SELECT DISTINCT(fk_propal) as fk_propal FROM ".MAIN_DB_PREFIX."propaldet WHERE special_code=104777"); |
| 45 | - while($obj = $db->fetch_object($res)) { |
|
| 45 | + while ($obj = $db->fetch_object($res)) { |
|
| 46 | 46 | $resLine = $db->query("SELECT rowid FROM ".MAIN_DB_PREFIX."propaldet WHERE fk_propal=".$obj->fk_propal." ORDER BY rang "); |
| 47 | 47 | $k = 1; |
| 48 | - while($objLine = $db->fetch_object($resLine)) { |
|
| 48 | + while ($objLine = $db->fetch_object($resLine)) { |
|
| 49 | 49 | |
| 50 | - $sql="UPDATE ".MAIN_DB_PREFIX."propaldet SET rang=".$k.",fk_parent_line=NULL WHERE rowid=".$objLine->rowid; |
|
| 50 | + $sql = "UPDATE ".MAIN_DB_PREFIX."propaldet SET rang=".$k.",fk_parent_line=NULL WHERE rowid=".$objLine->rowid; |
|
| 51 | 51 | |
| 52 | 52 | print $sql.";<br />"; |
| 53 | 53 | $k++; |
@@ -57,12 +57,12 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | |
| 59 | 59 | $res = $db->query("SELECT DISTINCT(fk_facture) as fk_facture FROM ".MAIN_DB_PREFIX."facturedet WHERE special_code=104777"); |
| 60 | - while($obj = $db->fetch_object($res)) { |
|
| 60 | + while ($obj = $db->fetch_object($res)) { |
|
| 61 | 61 | $resLine = $db->query("SELECT rowid FROM ".MAIN_DB_PREFIX."facturedet WHERE fk_facture=".$obj->fk_propal." ORDER BY rang "); |
| 62 | 62 | $k = 1; |
| 63 | - while($objLine = $db->fetch_object($resLine)) { |
|
| 63 | + while ($objLine = $db->fetch_object($resLine)) { |
|
| 64 | 64 | |
| 65 | - $sql="UPDATE ".MAIN_DB_PREFIX."facturedet SET rang=".$k.",fk_parent_line=NULL WHERE rowid=".$objLine->rowid; |
|
| 65 | + $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet SET rang=".$k.",fk_parent_line=NULL WHERE rowid=".$objLine->rowid; |
|
| 66 | 66 | |
| 67 | 67 | print $sql.";<br />"; |
| 68 | 68 | $k++; |
@@ -71,12 +71,12 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | $res = $db->query("SELECT DISTINCT(fk_commande) as fk_commande FROM ".MAIN_DB_PREFIX."commandedet WHERE special_code=104777"); |
| 74 | - while($obj = $db->fetch_object($res)) { |
|
| 74 | + while ($obj = $db->fetch_object($res)) { |
|
| 75 | 75 | $resLine = $db->query("SELECT rowid FROM ".MAIN_DB_PREFIX."commandedet WHERE fk_commande=".$obj->fk_propal." ORDER BY rang "); |
| 76 | 76 | $k = 1; |
| 77 | - while($objLine = $db->fetch_object($resLine)) { |
|
| 77 | + while ($objLine = $db->fetch_object($resLine)) { |
|
| 78 | 78 | |
| 79 | - $sql="UPDATE ".MAIN_DB_PREFIX."commandedet SET rang=".$k.",fk_parent_line=NULL WHERE rowid=".$objLine->rowid; |
|
| 79 | + $sql = "UPDATE ".MAIN_DB_PREFIX."commandedet SET rang=".$k.",fk_parent_line=NULL WHERE rowid=".$objLine->rowid; |
|
| 80 | 80 | |
| 81 | 81 | print $sql.";<br />"; |
| 82 | 82 | $k++; |
@@ -39,36 +39,36 @@ discard block |
||
| 39 | 39 | * @param Translate $outputlangs Output lang to use to autodetect output format if setup not done |
| 40 | 40 | * @return array Array('width'=>w,'height'=>h,'unit'=>u); |
| 41 | 41 | */ |
| 42 | -function pdf_getFormat($outputlangs='') |
|
| 42 | +function pdf_getFormat($outputlangs = '') |
|
| 43 | 43 | { |
| 44 | - global $conf,$db; |
|
| 44 | + global $conf, $db; |
|
| 45 | 45 | |
| 46 | 46 | // Default value if setup was not done and/or entry into c_paper_format not defined |
| 47 | - $width=210; $height=297; $unit='mm'; |
|
| 47 | + $width = 210; $height = 297; $unit = 'mm'; |
|
| 48 | 48 | |
| 49 | 49 | if (empty($conf->global->MAIN_PDF_FORMAT)) |
| 50 | 50 | { |
| 51 | 51 | include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
| 52 | - $pdfformat=dol_getDefaultFormat($outputlangs); |
|
| 52 | + $pdfformat = dol_getDefaultFormat($outputlangs); |
|
| 53 | 53 | } |
| 54 | - else $pdfformat=$conf->global->MAIN_PDF_FORMAT; |
|
| 54 | + else $pdfformat = $conf->global->MAIN_PDF_FORMAT; |
|
| 55 | 55 | |
| 56 | - $sql="SELECT code, label, width, height, unit FROM ".MAIN_DB_PREFIX."c_paper_format"; |
|
| 57 | - $sql.=" WHERE code = '".$pdfformat."'"; |
|
| 58 | - $resql=$db->query($sql); |
|
| 56 | + $sql = "SELECT code, label, width, height, unit FROM ".MAIN_DB_PREFIX."c_paper_format"; |
|
| 57 | + $sql .= " WHERE code = '".$pdfformat."'"; |
|
| 58 | + $resql = $db->query($sql); |
|
| 59 | 59 | if ($resql) |
| 60 | 60 | { |
| 61 | - $obj=$db->fetch_object($resql); |
|
| 61 | + $obj = $db->fetch_object($resql); |
|
| 62 | 62 | if ($obj) |
| 63 | 63 | { |
| 64 | - $width=(int) $obj->width; |
|
| 65 | - $height=(int) $obj->height; |
|
| 66 | - $unit=$obj->unit; |
|
| 64 | + $width = (int) $obj->width; |
|
| 65 | + $height = (int) $obj->height; |
|
| 66 | + $unit = $obj->unit; |
|
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | //print "pdfformat=".$pdfformat." width=".$width." height=".$height." unit=".$unit; |
| 71 | - return array('width'=>$width,'height'=>$height,'unit'=>$unit); |
|
| 71 | + return array('width'=>$width, 'height'=>$height, 'unit'=>$unit); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | * @param string $pagetype 'P' or 'l' |
| 80 | 80 | * @return TPDF PDF object |
| 81 | 81 | */ |
| 82 | -function pdf_getInstance($format='',$metric='mm',$pagetype='P') |
|
| 82 | +function pdf_getInstance($format = '', $metric = 'mm', $pagetype = 'P') |
|
| 83 | 83 | { |
| 84 | 84 | global $conf; |
| 85 | 85 | |
| 86 | 86 | // Define constant for TCPDF |
| 87 | - if (! defined('K_TCPDF_EXTERNAL_CONFIG')) |
|
| 87 | + if (!defined('K_TCPDF_EXTERNAL_CONFIG')) |
|
| 88 | 88 | { |
| 89 | - define('K_TCPDF_EXTERNAL_CONFIG',1); // this avoid using tcpdf_config file |
|
| 89 | + define('K_TCPDF_EXTERNAL_CONFIG', 1); // this avoid using tcpdf_config file |
|
| 90 | 90 | define('K_PATH_CACHE', DOL_DATA_ROOT.'/admin/temp/'); |
| 91 | 91 | define('K_PATH_URL_CACHE', DOL_DATA_ROOT.'/admin/temp/'); |
| 92 | 92 | dol_mkdir(K_PATH_CACHE); |
@@ -113,13 +113,13 @@ discard block |
||
| 113 | 113 | define('HEAD_MAGNIFICATION', 1.1); |
| 114 | 114 | define('K_CELL_HEIGHT_RATIO', 1.25); |
| 115 | 115 | define('K_TITLE_MAGNIFICATION', 1.3); |
| 116 | - define('K_SMALL_RATIO', 2/3); |
|
| 116 | + define('K_SMALL_RATIO', 2 / 3); |
|
| 117 | 117 | define('K_THAI_TOPCHARS', true); |
| 118 | 118 | define('K_TCPDF_CALLS_IN_HTML', true); |
| 119 | 119 | define('K_TCPDF_THROW_EXCEPTION_ERROR', false); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - if (! empty($conf->global->MAIN_USE_FPDF) && ! empty($conf->global->MAIN_DISABLE_FPDI)) |
|
| 122 | + if (!empty($conf->global->MAIN_USE_FPDF) && !empty($conf->global->MAIN_DISABLE_FPDI)) |
|
| 123 | 123 | return "Error MAIN_USE_FPDF and MAIN_DISABLE_FPDI can't be set together"; |
| 124 | 124 | |
| 125 | 125 | // We use by default TCPDF else FPDF |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | //$metric=$arrayformat['unit']; |
| 136 | 136 | |
| 137 | 137 | // Protection and encryption of pdf |
| 138 | - if (empty($conf->global->MAIN_USE_FPDF) && ! empty($conf->global->PDF_SECURITY_ENCRYPTION)) |
|
| 138 | + if (empty($conf->global->MAIN_USE_FPDF) && !empty($conf->global->PDF_SECURITY_ENCRYPTION)) |
|
| 139 | 139 | { |
| 140 | 140 | /* Permission supported by TCPDF |
| 141 | 141 | - print : Print the document; |
@@ -148,25 +148,25 @@ discard block |
||
| 148 | 148 | - print-high : Print the document to a representation from which a faithful digital copy of the PDF content could be generated. When this is not set, printing is limited to a low-level representation of the appearance, possibly of degraded quality. |
| 149 | 149 | - owner : (inverted logic - only for public-key) when set permits change of encryption and enables all other permissions. |
| 150 | 150 | */ |
| 151 | - if (class_exists('TCPDI')) $pdf = new TCPDI($pagetype,$metric,$format); |
|
| 152 | - else if (class_exists('FPDI')) $pdf = new FPDI($pagetype,$metric,$format); |
|
| 153 | - else $pdf = new TCPDF($pagetype,$metric,$format); |
|
| 151 | + if (class_exists('TCPDI')) $pdf = new TCPDI($pagetype, $metric, $format); |
|
| 152 | + else if (class_exists('FPDI')) $pdf = new FPDI($pagetype, $metric, $format); |
|
| 153 | + else $pdf = new TCPDF($pagetype, $metric, $format); |
|
| 154 | 154 | // For TCPDF, we specify permission we want to block |
| 155 | - $pdfrights = array('modify','copy'); |
|
| 155 | + $pdfrights = array('modify', 'copy'); |
|
| 156 | 156 | |
| 157 | 157 | $pdfuserpass = ''; // Password for the end user |
| 158 | 158 | $pdfownerpass = NULL; // Password of the owner, created randomly if not defined |
| 159 | - $pdf->SetProtection($pdfrights,$pdfuserpass,$pdfownerpass); |
|
| 159 | + $pdf->SetProtection($pdfrights, $pdfuserpass, $pdfownerpass); |
|
| 160 | 160 | } |
| 161 | 161 | else |
| 162 | 162 | { |
| 163 | - if (class_exists('TCPDI')) $pdf = new TCPDI($pagetype,$metric,$format); |
|
| 164 | - else if (class_exists('FPDI')) $pdf = new FPDI($pagetype,$metric,$format); |
|
| 165 | - else $pdf = new TCPDF($pagetype,$metric,$format); |
|
| 163 | + if (class_exists('TCPDI')) $pdf = new TCPDI($pagetype, $metric, $format); |
|
| 164 | + else if (class_exists('FPDI')) $pdf = new FPDI($pagetype, $metric, $format); |
|
| 165 | + else $pdf = new TCPDF($pagetype, $metric, $format); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | // If we use FPDF class, we may need to add method writeHTMLCell |
| 169 | - if (! empty($conf->global->MAIN_USE_FPDF) && ! method_exists($pdf, 'writeHTMLCell')) |
|
| 169 | + if (!empty($conf->global->MAIN_USE_FPDF) && !method_exists($pdf, 'writeHTMLCell')) |
|
| 170 | 170 | { |
| 171 | 171 | // Declare here a class to overwrite FPDI to add method writeHTMLCell |
| 172 | 172 | /** |
@@ -207,17 +207,17 @@ discard block |
||
| 207 | 207 | */ |
| 208 | 208 | public function writeHTMLCell($w, $h, $x, $y, $html = '', $border = 0, $ln = 0, $fill = false, $reseth = true, $align = '', $autopadding = true) |
| 209 | 209 | { |
| 210 | - $this->SetXY($x,$y); |
|
| 211 | - $val=str_replace('<br>',"\n",$html); |
|
| 210 | + $this->SetXY($x, $y); |
|
| 211 | + $val = str_replace('<br>', "\n", $html); |
|
| 212 | 212 | //$val=dol_string_nohtmltag($val,false,'ISO-8859-1'); |
| 213 | - $val=dol_string_nohtmltag($val,false,'UTF-8'); |
|
| 214 | - $this->MultiCell($w,$h,$val,$border,$align,$fill); |
|
| 213 | + $val = dol_string_nohtmltag($val, false, 'UTF-8'); |
|
| 214 | + $this->MultiCell($w, $h, $val, $border, $align, $fill); |
|
| 215 | 215 | } |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - $pdf2=new FPDI_DolExtended($pagetype,$metric,$format); |
|
| 218 | + $pdf2 = new FPDI_DolExtended($pagetype, $metric, $format); |
|
| 219 | 219 | unset($pdf); |
| 220 | - $pdf=$pdf2; |
|
| 220 | + $pdf = $pdf2; |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | return $pdf; |
@@ -234,14 +234,14 @@ discard block |
||
| 234 | 234 | { |
| 235 | 235 | global $conf; |
| 236 | 236 | |
| 237 | - if (! empty($conf->global->MAIN_PDF_FORCE_FONT)) return $conf->global->MAIN_PDF_FORCE_FONT; |
|
| 237 | + if (!empty($conf->global->MAIN_PDF_FORCE_FONT)) return $conf->global->MAIN_PDF_FORCE_FONT; |
|
| 238 | 238 | |
| 239 | - $font='Helvetica'; // By default, for FPDI, or ISO language on TCPDF |
|
| 239 | + $font = 'Helvetica'; // By default, for FPDI, or ISO language on TCPDF |
|
| 240 | 240 | if (class_exists('TCPDF')) // If TCPDF on, we can use an UTF8 one like DejaVuSans if required (slower) |
| 241 | 241 | { |
| 242 | - if ($outputlangs->trans('FONTFORPDF')!='FONTFORPDF') |
|
| 242 | + if ($outputlangs->trans('FONTFORPDF') != 'FONTFORPDF') |
|
| 243 | 243 | { |
| 244 | - $font=$outputlangs->trans('FONTFORPDF'); |
|
| 244 | + $font = $outputlangs->trans('FONTFORPDF'); |
|
| 245 | 245 | } |
| 246 | 246 | } |
| 247 | 247 | return $font; |
@@ -255,10 +255,10 @@ discard block |
||
| 255 | 255 | */ |
| 256 | 256 | function pdf_getPDFFontSize($outputlangs) |
| 257 | 257 | { |
| 258 | - $size=10; // By default, for FPDI or ISO language on TCPDF |
|
| 258 | + $size = 10; // By default, for FPDI or ISO language on TCPDF |
|
| 259 | 259 | if (class_exists('TCPDF')) // If TCPDF on, we can use an UTF8 one like DejaVuSans if required (slower) |
| 260 | 260 | { |
| 261 | - if ($outputlangs->trans('FONTSIZEFORPDF')!='FONTSIZEFORPDF') |
|
| 261 | + if ($outputlangs->trans('FONTSIZEFORPDF') != 'FONTSIZEFORPDF') |
|
| 262 | 262 | { |
| 263 | 263 | $size = (int) $outputlangs->trans('FONTSIZEFORPDF'); |
| 264 | 264 | } |
@@ -277,14 +277,14 @@ discard block |
||
| 277 | 277 | function pdf_getHeightForLogo($logo, $url = false) |
| 278 | 278 | { |
| 279 | 279 | global $conf; |
| 280 | - $height=(empty($conf->global->MAIN_DOCUMENTS_LOGO_HEIGHT)?22:$conf->global->MAIN_DOCUMENTS_LOGO_HEIGHT); |
|
| 281 | - $maxwidth=130; |
|
| 280 | + $height = (empty($conf->global->MAIN_DOCUMENTS_LOGO_HEIGHT) ? 22 : $conf->global->MAIN_DOCUMENTS_LOGO_HEIGHT); |
|
| 281 | + $maxwidth = 130; |
|
| 282 | 282 | include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; |
| 283 | - $tmp=dol_getImageSize($logo, $url); |
|
| 283 | + $tmp = dol_getImageSize($logo, $url); |
|
| 284 | 284 | if ($tmp['height']) |
| 285 | 285 | { |
| 286 | - $width=round($height*$tmp['width']/$tmp['height']); |
|
| 287 | - if ($width > $maxwidth) $height=$height*$maxwidth/$width; |
|
| 286 | + $width = round($height * $tmp['width'] / $tmp['height']); |
|
| 287 | + if ($width > $maxwidth) $height = $height * $maxwidth / $width; |
|
| 288 | 288 | } |
| 289 | 289 | //print $tmp['width'].' '.$tmp['height'].' '.$width; exit; |
| 290 | 290 | return $height; |
@@ -328,36 +328,36 @@ discard block |
||
| 328 | 328 | * @param int $mode Address type ('source', 'target', 'targetwithdetails') |
| 329 | 329 | * @return string String with full address |
| 330 | 330 | */ |
| 331 | -function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$targetcontact='',$usecontact=0,$mode='source') |
|
| 331 | +function pdf_build_address($outputlangs, $sourcecompany, $targetcompany = '', $targetcontact = '', $usecontact = 0, $mode = 'source') |
|
| 332 | 332 | { |
| 333 | 333 | global $conf; |
| 334 | 334 | $stringaddress = ''; |
| 335 | 335 | |
| 336 | - if ($mode == 'source' && ! is_object($sourcecompany)) return -1; |
|
| 337 | - if ($mode == 'target' && ! is_object($targetcompany)) return -1; |
|
| 338 | - if ($mode == 'delivery' && ! is_object($deliverycompany)) return -1; |
|
| 336 | + if ($mode == 'source' && !is_object($sourcecompany)) return -1; |
|
| 337 | + if ($mode == 'target' && !is_object($targetcompany)) return -1; |
|
| 338 | + if ($mode == 'delivery' && !is_object($deliverycompany)) return -1; |
|
| 339 | 339 | |
| 340 | - if (! empty($sourcecompany->state_id) && empty($sourcecompany->departement)) $sourcecompany->departement=getState($sourcecompany->state_id); //TODO: Deprecated |
|
| 341 | - if (! empty($sourcecompany->state_id) && empty($sourcecompany->state)) $sourcecompany->state=getState($sourcecompany->state_id); |
|
| 342 | - if (! empty($targetcompany->state_id) && empty($targetcompany->departement)) $targetcompany->departement=getState($targetcompany->state_id); |
|
| 340 | + if (!empty($sourcecompany->state_id) && empty($sourcecompany->departement)) $sourcecompany->departement = getState($sourcecompany->state_id); //TODO: Deprecated |
|
| 341 | + if (!empty($sourcecompany->state_id) && empty($sourcecompany->state)) $sourcecompany->state = getState($sourcecompany->state_id); |
|
| 342 | + if (!empty($targetcompany->state_id) && empty($targetcompany->departement)) $targetcompany->departement = getState($targetcompany->state_id); |
|
| 343 | 343 | |
| 344 | 344 | if ($mode == 'source') |
| 345 | 345 | { |
| 346 | 346 | $withCountry = 0; |
| 347 | 347 | if (!empty($sourcecompany->country_code) && ($targetcompany->country_code != $sourcecompany->country_code)) $withCountry = 1; |
| 348 | 348 | |
| 349 | - $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($sourcecompany, $withCountry, "\n", $outputlangs))."\n"; |
|
| 349 | + $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset(dol_format_address($sourcecompany, $withCountry, "\n", $outputlangs))."\n"; |
|
| 350 | 350 | |
| 351 | 351 | if (empty($conf->global->MAIN_PDF_DISABLESOURCEDETAILS)) |
| 352 | 352 | { |
| 353 | 353 | // Phone |
| 354 | - if ($sourcecompany->phone) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("PhoneShort").": ".$outputlangs->convToOutputCharset($sourcecompany->phone); |
|
| 354 | + if ($sourcecompany->phone) $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("PhoneShort").": ".$outputlangs->convToOutputCharset($sourcecompany->phone); |
|
| 355 | 355 | // Fax |
| 356 | - if ($sourcecompany->fax) $stringaddress .= ($stringaddress ? ($sourcecompany->phone ? " - " : "\n") : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($sourcecompany->fax); |
|
| 356 | + if ($sourcecompany->fax) $stringaddress .= ($stringaddress ? ($sourcecompany->phone ? " - " : "\n") : '').$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($sourcecompany->fax); |
|
| 357 | 357 | |
| 358 | - if ($sourcecompany->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($sourcecompany->email); |
|
| 358 | + if ($sourcecompany->email) $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($sourcecompany->email); |
|
| 359 | 359 | // Web |
| 360 | - if ($sourcecompany->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($sourcecompany->url); |
|
| 360 | + if ($sourcecompany->url) $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($sourcecompany->url); |
|
| 361 | 361 | } |
| 362 | 362 | } |
| 363 | 363 | |
@@ -365,88 +365,88 @@ discard block |
||
| 365 | 365 | { |
| 366 | 366 | if ($usecontact) |
| 367 | 367 | { |
| 368 | - $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset($targetcontact->getFullName($outputlangs,1)); |
|
| 368 | + $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset($targetcontact->getFullName($outputlangs, 1)); |
|
| 369 | 369 | |
| 370 | 370 | if (!empty($targetcontact->address)) { |
| 371 | - $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcontact))."\n"; |
|
| 372 | - }else { |
|
| 373 | - $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcompany))."\n"; |
|
| 371 | + $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset(dol_format_address($targetcontact))."\n"; |
|
| 372 | + } else { |
|
| 373 | + $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset(dol_format_address($targetcompany))."\n"; |
|
| 374 | 374 | } |
| 375 | 375 | // Country |
| 376 | 376 | if (!empty($targetcontact->country_code) && $targetcontact->country_code != $sourcecompany->country_code) { |
| 377 | - $stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcontact->country_code))."\n"; |
|
| 377 | + $stringaddress .= $outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcontact->country_code))."\n"; |
|
| 378 | 378 | } |
| 379 | 379 | else if (empty($targetcontact->country_code) && !empty($targetcompany->country_code) && ($targetcompany->country_code != $sourcecompany->country_code)) { |
| 380 | - $stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code))."\n"; |
|
| 380 | + $stringaddress .= $outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code))."\n"; |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | - if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails') |
|
| 383 | + if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails') |
|
| 384 | 384 | { |
| 385 | 385 | // Phone |
| 386 | - if (! empty($targetcontact->phone_pro) || ! empty($targetcontact->phone_mobile)) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": "; |
|
| 387 | - if (! empty($targetcontact->phone_pro)) $stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_pro); |
|
| 388 | - if (! empty($targetcontact->phone_pro) && ! empty($targetcontact->phone_mobile)) $stringaddress .= " / "; |
|
| 389 | - if (! empty($targetcontact->phone_mobile)) $stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_mobile); |
|
| 386 | + if (!empty($targetcontact->phone_pro) || !empty($targetcontact->phone_mobile)) $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Phone").": "; |
|
| 387 | + if (!empty($targetcontact->phone_pro)) $stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_pro); |
|
| 388 | + if (!empty($targetcontact->phone_pro) && !empty($targetcontact->phone_mobile)) $stringaddress .= " / "; |
|
| 389 | + if (!empty($targetcontact->phone_mobile)) $stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_mobile); |
|
| 390 | 390 | // Fax |
| 391 | - if ($targetcontact->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcontact->fax); |
|
| 391 | + if ($targetcontact->fax) $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcontact->fax); |
|
| 392 | 392 | |
| 393 | - if ($targetcontact->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcontact->email); |
|
| 393 | + if ($targetcontact->email) $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcontact->email); |
|
| 394 | 394 | // Web |
| 395 | - if ($targetcontact->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcontact->url); |
|
| 395 | + if ($targetcontact->url) $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcontact->url); |
|
| 396 | 396 | } |
| 397 | 397 | } |
| 398 | 398 | else |
| 399 | 399 | { |
| 400 | - $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcompany))."\n"; |
|
| 400 | + $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset(dol_format_address($targetcompany))."\n"; |
|
| 401 | 401 | // Country |
| 402 | - if (!empty($targetcompany->country_code) && $targetcompany->country_code != $sourcecompany->country_code) $stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code))."\n"; |
|
| 402 | + if (!empty($targetcompany->country_code) && $targetcompany->country_code != $sourcecompany->country_code) $stringaddress .= $outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code))."\n"; |
|
| 403 | 403 | |
| 404 | - if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails') |
|
| 404 | + if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails') |
|
| 405 | 405 | { |
| 406 | 406 | // Phone |
| 407 | - if (! empty($targetcompany->phone) || ! empty($targetcompany->phone_mobile)) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": "; |
|
| 408 | - if (! empty($targetcompany->phone)) $stringaddress .= $outputlangs->convToOutputCharset($targetcompany->phone); |
|
| 409 | - if (! empty($targetcompany->phone) && ! empty($targetcompany->phone_mobile)) $stringaddress .= " / "; |
|
| 410 | - if (! empty($targetcompany->phone_mobile)) $stringaddress .= $outputlangs->convToOutputCharset($targetcompany->phone_mobile); |
|
| 407 | + if (!empty($targetcompany->phone) || !empty($targetcompany->phone_mobile)) $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Phone").": "; |
|
| 408 | + if (!empty($targetcompany->phone)) $stringaddress .= $outputlangs->convToOutputCharset($targetcompany->phone); |
|
| 409 | + if (!empty($targetcompany->phone) && !empty($targetcompany->phone_mobile)) $stringaddress .= " / "; |
|
| 410 | + if (!empty($targetcompany->phone_mobile)) $stringaddress .= $outputlangs->convToOutputCharset($targetcompany->phone_mobile); |
|
| 411 | 411 | // Fax |
| 412 | - if ($targetcompany->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcompany->fax); |
|
| 412 | + if ($targetcompany->fax) $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcompany->fax); |
|
| 413 | 413 | |
| 414 | - if ($targetcompany->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcompany->email); |
|
| 414 | + if ($targetcompany->email) $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcompany->email); |
|
| 415 | 415 | // Web |
| 416 | - if ($targetcompany->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcompany->url); |
|
| 416 | + if ($targetcompany->url) $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcompany->url); |
|
| 417 | 417 | } |
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | // Intra VAT |
| 421 | 421 | if (empty($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS)) |
| 422 | 422 | { |
| 423 | - if ($targetcompany->tva_intra) $stringaddress.="\n".$outputlangs->transnoentities("VATIntraShort").': '.$outputlangs->convToOutputCharset($targetcompany->tva_intra); |
|
| 423 | + if ($targetcompany->tva_intra) $stringaddress .= "\n".$outputlangs->transnoentities("VATIntraShort").': '.$outputlangs->convToOutputCharset($targetcompany->tva_intra); |
|
| 424 | 424 | } |
| 425 | 425 | |
| 426 | 426 | // Professionnal Ids |
| 427 | - if (! empty($conf->global->MAIN_PROFID1_IN_ADDRESS) && ! empty($targetcompany->idprof1)) |
|
| 427 | + if (!empty($conf->global->MAIN_PROFID1_IN_ADDRESS) && !empty($targetcompany->idprof1)) |
|
| 428 | 428 | { |
| 429 | - $tmp=$outputlangs->transcountrynoentities("ProfId1",$targetcompany->country_code); |
|
| 430 | - if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1]; |
|
| 431 | - $stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof1); |
|
| 429 | + $tmp = $outputlangs->transcountrynoentities("ProfId1", $targetcompany->country_code); |
|
| 430 | + if (preg_match('/\((.+)\)/', $tmp, $reg)) $tmp = $reg[1]; |
|
| 431 | + $stringaddress .= "\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof1); |
|
| 432 | 432 | } |
| 433 | - if (! empty($conf->global->MAIN_PROFID2_IN_ADDRESS) && ! empty($targetcompany->idprof2)) |
|
| 433 | + if (!empty($conf->global->MAIN_PROFID2_IN_ADDRESS) && !empty($targetcompany->idprof2)) |
|
| 434 | 434 | { |
| 435 | - $tmp=$outputlangs->transcountrynoentities("ProfId2",$targetcompany->country_code); |
|
| 436 | - if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1]; |
|
| 437 | - $stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof2); |
|
| 435 | + $tmp = $outputlangs->transcountrynoentities("ProfId2", $targetcompany->country_code); |
|
| 436 | + if (preg_match('/\((.+)\)/', $tmp, $reg)) $tmp = $reg[1]; |
|
| 437 | + $stringaddress .= "\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof2); |
|
| 438 | 438 | } |
| 439 | - if (! empty($conf->global->MAIN_PROFID3_IN_ADDRESS) && ! empty($targetcompany->idprof3)) |
|
| 439 | + if (!empty($conf->global->MAIN_PROFID3_IN_ADDRESS) && !empty($targetcompany->idprof3)) |
|
| 440 | 440 | { |
| 441 | - $tmp=$outputlangs->transcountrynoentities("ProfId3",$targetcompany->country_code); |
|
| 442 | - if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1]; |
|
| 443 | - $stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof3); |
|
| 441 | + $tmp = $outputlangs->transcountrynoentities("ProfId3", $targetcompany->country_code); |
|
| 442 | + if (preg_match('/\((.+)\)/', $tmp, $reg)) $tmp = $reg[1]; |
|
| 443 | + $stringaddress .= "\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof3); |
|
| 444 | 444 | } |
| 445 | - if (! empty($conf->global->MAIN_PROFID4_IN_ADDRESS) && ! empty($targetcompany->idprof4)) |
|
| 445 | + if (!empty($conf->global->MAIN_PROFID4_IN_ADDRESS) && !empty($targetcompany->idprof4)) |
|
| 446 | 446 | { |
| 447 | - $tmp=$outputlangs->transcountrynoentities("ProfId4",$targetcompany->country_code); |
|
| 448 | - if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1]; |
|
| 449 | - $stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof4); |
|
| 447 | + $tmp = $outputlangs->transcountrynoentities("ProfId4", $targetcompany->country_code); |
|
| 448 | + if (preg_match('/\((.+)\)/', $tmp, $reg)) $tmp = $reg[1]; |
|
| 449 | + $stringaddress .= "\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof4); |
|
| 450 | 450 | } |
| 451 | 451 | } |
| 452 | 452 | |
@@ -462,16 +462,16 @@ discard block |
||
| 462 | 462 | * @param int $page_height Height of page |
| 463 | 463 | * @return void |
| 464 | 464 | */ |
| 465 | -function pdf_pagehead(&$pdf,$outputlangs,$page_height) |
|
| 465 | +function pdf_pagehead(&$pdf, $outputlangs, $page_height) |
|
| 466 | 466 | { |
| 467 | 467 | global $conf; |
| 468 | 468 | |
| 469 | 469 | // Add a background image on document |
| 470 | - if (! empty($conf->global->MAIN_USE_BACKGROUND_ON_PDF)) // Warning, this option make TCPDF generation beeing crazy and some content disappeared behin the image |
|
| 470 | + if (!empty($conf->global->MAIN_USE_BACKGROUND_ON_PDF)) // Warning, this option make TCPDF generation beeing crazy and some content disappeared behin the image |
|
| 471 | 471 | { |
| 472 | - $pdf->SetAutoPageBreak(0,0); // Disable auto pagebreak before adding image |
|
| 473 | - $pdf->Image($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_USE_BACKGROUND_ON_PDF, (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_X)?$conf->global->MAIN_USE_BACKGROUND_ON_PDF_X:0), (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y)?$conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y:0), 0, $page_height); |
|
| 474 | - $pdf->SetAutoPageBreak(1,0); // Restore pagebreak |
|
| 472 | + $pdf->SetAutoPageBreak(0, 0); // Disable auto pagebreak before adding image |
|
| 473 | + $pdf->Image($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_USE_BACKGROUND_ON_PDF, (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_X) ? $conf->global->MAIN_USE_BACKGROUND_ON_PDF_X : 0), (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y) ? $conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y : 0), 0, $page_height); |
|
| 474 | + $pdf->SetAutoPageBreak(1, 0); // Restore pagebreak |
|
| 475 | 475 | } |
| 476 | 476 | } |
| 477 | 477 | |
@@ -489,29 +489,29 @@ discard block |
||
| 489 | 489 | function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text) |
| 490 | 490 | { |
| 491 | 491 | // Print Draft Watermark |
| 492 | - if ($unit=='pt') $k=1; |
|
| 493 | - elseif ($unit=='mm') $k=72/25.4; |
|
| 494 | - elseif ($unit=='cm') $k=72/2.54; |
|
| 495 | - elseif ($unit=='in') $k=72; |
|
| 496 | - |
|
| 497 | - $savx=$pdf->getX(); $savy=$pdf->getY(); |
|
| 498 | - |
|
| 499 | - $watermark_angle=atan($h/$w)/2; |
|
| 500 | - $watermark_x_pos=0; |
|
| 501 | - $watermark_y_pos=$h/3; |
|
| 502 | - $watermark_x=$w/2; |
|
| 503 | - $watermark_y=$h/3; |
|
| 504 | - $pdf->SetFont('','B',40); |
|
| 505 | - $pdf->SetTextColor(255,192,203); |
|
| 492 | + if ($unit == 'pt') $k = 1; |
|
| 493 | + elseif ($unit == 'mm') $k = 72 / 25.4; |
|
| 494 | + elseif ($unit == 'cm') $k = 72 / 2.54; |
|
| 495 | + elseif ($unit == 'in') $k = 72; |
|
| 496 | + |
|
| 497 | + $savx = $pdf->getX(); $savy = $pdf->getY(); |
|
| 498 | + |
|
| 499 | + $watermark_angle = atan($h / $w) / 2; |
|
| 500 | + $watermark_x_pos = 0; |
|
| 501 | + $watermark_y_pos = $h / 3; |
|
| 502 | + $watermark_x = $w / 2; |
|
| 503 | + $watermark_y = $h / 3; |
|
| 504 | + $pdf->SetFont('', 'B', 40); |
|
| 505 | + $pdf->SetTextColor(255, 192, 203); |
|
| 506 | 506 | //rotate |
| 507 | - $pdf->_out(sprintf('q %.5F %.5F %.5F %.5F %.2F %.2F cm 1 0 0 1 %.2F %.2F cm',cos($watermark_angle),sin($watermark_angle),-sin($watermark_angle),cos($watermark_angle),$watermark_x*$k,($h-$watermark_y)*$k,-$watermark_x*$k,-($h-$watermark_y)*$k)); |
|
| 507 | + $pdf->_out(sprintf('q %.5F %.5F %.5F %.5F %.2F %.2F cm 1 0 0 1 %.2F %.2F cm', cos($watermark_angle), sin($watermark_angle), -sin($watermark_angle), cos($watermark_angle), $watermark_x * $k, ($h - $watermark_y) * $k, -$watermark_x * $k, -($h - $watermark_y) * $k)); |
|
| 508 | 508 | //print watermark |
| 509 | - $pdf->SetXY($watermark_x_pos,$watermark_y_pos); |
|
| 510 | - $pdf->Cell($w-20,25,$outputlangs->convToOutputCharset($text),"",2,"C",0); |
|
| 509 | + $pdf->SetXY($watermark_x_pos, $watermark_y_pos); |
|
| 510 | + $pdf->Cell($w - 20, 25, $outputlangs->convToOutputCharset($text), "", 2, "C", 0); |
|
| 511 | 511 | //antirotate |
| 512 | 512 | $pdf->_out('Q'); |
| 513 | 513 | |
| 514 | - $pdf->SetXY($savx,$savy); |
|
| 514 | + $pdf->SetXY($savx, $savy); |
|
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | |
@@ -527,41 +527,41 @@ discard block |
||
| 527 | 527 | * @param int $default_font_size Default font size |
| 528 | 528 | * @return float The Y PDF position |
| 529 | 529 | */ |
| 530 | -function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default_font_size=10) |
|
| 530 | +function pdf_bank(&$pdf, $outputlangs, $curx, $cury, $account, $onlynumber = 0, $default_font_size = 10) |
|
| 531 | 531 | { |
| 532 | 532 | global $mysoc, $conf; |
| 533 | 533 | |
| 534 | - $diffsizetitle=(empty($conf->global->PDF_DIFFSIZE_TITLE)?3:$conf->global->PDF_DIFFSIZE_TITLE); |
|
| 535 | - $diffsizecontent=(empty($conf->global->PDF_DIFFSIZE_CONTENT)?4:$conf->global->PDF_DIFFSIZE_CONTENT); |
|
| 534 | + $diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE); |
|
| 535 | + $diffsizecontent = (empty($conf->global->PDF_DIFFSIZE_CONTENT) ? 4 : $conf->global->PDF_DIFFSIZE_CONTENT); |
|
| 536 | 536 | $pdf->SetXY($curx, $cury); |
| 537 | 537 | |
| 538 | 538 | if (empty($onlynumber)) |
| 539 | 539 | { |
| 540 | - $pdf->SetFont('','B',$default_font_size - $diffsizetitle); |
|
| 540 | + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); |
|
| 541 | 541 | $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByTransferOnThisBankAccount').':', 0, 'L', 0); |
| 542 | - $cury+=4; |
|
| 542 | + $cury += 4; |
|
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | $outputlangs->load("banks"); |
| 546 | 546 | |
| 547 | 547 | // Use correct name of bank id according to country |
| 548 | - $bickey="BICNumber"; |
|
| 549 | - if ($account->getCountryCode() == 'IN') $bickey="SWIFT"; |
|
| 548 | + $bickey = "BICNumber"; |
|
| 549 | + if ($account->getCountryCode() == 'IN') $bickey = "SWIFT"; |
|
| 550 | 550 | |
| 551 | 551 | // Get format of bank account according to its country |
| 552 | - $usedetailedbban=$account->useDetailedBBAN(); |
|
| 552 | + $usedetailedbban = $account->useDetailedBBAN(); |
|
| 553 | 553 | |
| 554 | 554 | //$onlynumber=0; $usedetailedbban=1; // For tests |
| 555 | 555 | if ($usedetailedbban) |
| 556 | 556 | { |
| 557 | - $savcurx=$curx; |
|
| 557 | + $savcurx = $curx; |
|
| 558 | 558 | |
| 559 | 559 | if (empty($onlynumber)) |
| 560 | 560 | { |
| 561 | - $pdf->SetFont('','',$default_font_size - $diffsizecontent); |
|
| 561 | + $pdf->SetFont('', '', $default_font_size - $diffsizecontent); |
|
| 562 | 562 | $pdf->SetXY($curx, $cury); |
| 563 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Bank").': ' . $outputlangs->convToOutputCharset($account->bank), 0, 'L', 0); |
|
| 564 | - $cury+=3; |
|
| 563 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Bank").': '.$outputlangs->convToOutputCharset($account->bank), 0, 'L', 0); |
|
| 564 | + $cury += 3; |
|
| 565 | 565 | } |
| 566 | 566 | |
| 567 | 567 | /* |
@@ -632,69 +632,69 @@ discard block |
||
| 632 | 632 | } |
| 633 | 633 | else |
| 634 | 634 | { |
| 635 | - $pdf->SetFont('','B',$default_font_size - $diffsizecontent); |
|
| 635 | + $pdf->SetFont('', 'B', $default_font_size - $diffsizecontent); |
|
| 636 | 636 | $pdf->SetXY($curx, $cury); |
| 637 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Bank").': ' . $outputlangs->convToOutputCharset($account->bank), 0, 'L', 0); |
|
| 638 | - $cury+=3; |
|
| 637 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Bank").': '.$outputlangs->convToOutputCharset($account->bank), 0, 'L', 0); |
|
| 638 | + $cury += 3; |
|
| 639 | 639 | |
| 640 | - $pdf->SetFont('','B',$default_font_size - $diffsizecontent); |
|
| 640 | + $pdf->SetFont('', 'B', $default_font_size - $diffsizecontent); |
|
| 641 | 641 | $pdf->SetXY($curx, $cury); |
| 642 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("BankAccountNumber").': ' . $outputlangs->convToOutputCharset($account->number), 0, 'L', 0); |
|
| 643 | - $cury+=3; |
|
| 642 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("BankAccountNumber").': '.$outputlangs->convToOutputCharset($account->number), 0, 'L', 0); |
|
| 643 | + $cury += 3; |
|
| 644 | 644 | |
| 645 | - if ($diffsizecontent <= 2) $cury+=1; |
|
| 645 | + if ($diffsizecontent <= 2) $cury += 1; |
|
| 646 | 646 | } |
| 647 | 647 | |
| 648 | - $pdf->SetFont('','',$default_font_size - $diffsizecontent); |
|
| 648 | + $pdf->SetFont('', '', $default_font_size - $diffsizecontent); |
|
| 649 | 649 | |
| 650 | - if (empty($onlynumber) && ! empty($account->domiciliation)) |
|
| 650 | + if (empty($onlynumber) && !empty($account->domiciliation)) |
|
| 651 | 651 | { |
| 652 | 652 | $pdf->SetXY($curx, $cury); |
| 653 | - $val=$outputlangs->transnoentities("Residence").': ' . $outputlangs->convToOutputCharset($account->domiciliation); |
|
| 653 | + $val = $outputlangs->transnoentities("Residence").': '.$outputlangs->convToOutputCharset($account->domiciliation); |
|
| 654 | 654 | $pdf->MultiCell(100, 3, $val, 0, 'L', 0); |
| 655 | 655 | //$nboflines=dol_nboflines_bis($val,120); |
| 656 | 656 | //$cury+=($nboflines*3)+2; |
| 657 | - $tmpy=$pdf->getStringHeight(100, $val); |
|
| 658 | - $cury+=$tmpy; |
|
| 657 | + $tmpy = $pdf->getStringHeight(100, $val); |
|
| 658 | + $cury += $tmpy; |
|
| 659 | 659 | } |
| 660 | 660 | |
| 661 | - if (! empty($account->proprio)) |
|
| 661 | + if (!empty($account->proprio)) |
|
| 662 | 662 | { |
| 663 | 663 | $pdf->SetXY($curx, $cury); |
| 664 | - $val=$outputlangs->transnoentities("BankAccountOwner").': ' . $outputlangs->convToOutputCharset($account->proprio); |
|
| 664 | + $val = $outputlangs->transnoentities("BankAccountOwner").': '.$outputlangs->convToOutputCharset($account->proprio); |
|
| 665 | 665 | $pdf->MultiCell(100, 3, $val, 0, 'L', 0); |
| 666 | - $tmpy=$pdf->getStringHeight(100, $val); |
|
| 667 | - $cury+=$tmpy; |
|
| 666 | + $tmpy = $pdf->getStringHeight(100, $val); |
|
| 667 | + $cury += $tmpy; |
|
| 668 | 668 | } |
| 669 | 669 | |
| 670 | - else if (! $usedetailedbban) $cury+=1; |
|
| 670 | + else if (!$usedetailedbban) $cury += 1; |
|
| 671 | 671 | |
| 672 | 672 | // Use correct name of bank id according to country |
| 673 | - $ibankey="IBANNumber"; |
|
| 674 | - if ($account->getCountryCode() == 'IN') $ibankey="IFSC"; |
|
| 675 | - if (! empty($account->iban)) |
|
| 673 | + $ibankey = "IBANNumber"; |
|
| 674 | + if ($account->getCountryCode() == 'IN') $ibankey = "IFSC"; |
|
| 675 | + if (!empty($account->iban)) |
|
| 676 | 676 | { |
| 677 | 677 | //Remove whitespaces to ensure we are dealing with the format we expect |
| 678 | 678 | $ibanDisplay_temp = str_replace(' ', '', $outputlangs->convToOutputCharset($account->iban)); |
| 679 | 679 | $ibanDisplay = ""; |
| 680 | 680 | |
| 681 | - for($i = 0; $i < dol_strlen($ibanDisplay_temp); $i++) |
|
| 681 | + for ($i = 0; $i < dol_strlen($ibanDisplay_temp); $i++) |
|
| 682 | 682 | { |
| 683 | 683 | $ibanDisplay .= $ibanDisplay_temp[$i]; |
| 684 | - if($i%4 == 3 && $i > 0) $ibanDisplay .= " "; |
|
| 684 | + if ($i % 4 == 3 && $i > 0) $ibanDisplay .= " "; |
|
| 685 | 685 | } |
| 686 | 686 | |
| 687 | - $pdf->SetFont('','B',$default_font_size - 3); |
|
| 687 | + $pdf->SetFont('', 'B', $default_font_size - 3); |
|
| 688 | 688 | $pdf->SetXY($curx, $cury); |
| 689 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities($ibankey).': ' . $ibanDisplay, 0, 'L', 0); |
|
| 690 | - $cury+=3; |
|
| 689 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities($ibankey).': '.$ibanDisplay, 0, 'L', 0); |
|
| 690 | + $cury += 3; |
|
| 691 | 691 | } |
| 692 | 692 | |
| 693 | - if (! empty($account->bic)) |
|
| 693 | + if (!empty($account->bic)) |
|
| 694 | 694 | { |
| 695 | - $pdf->SetFont('','B',$default_font_size - 3); |
|
| 695 | + $pdf->SetFont('', 'B', $default_font_size - 3); |
|
| 696 | 696 | $pdf->SetXY($curx, $cury); |
| 697 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities($bickey).': ' . $outputlangs->convToOutputCharset($account->bic), 0, 'L', 0); |
|
| 697 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities($bickey).': '.$outputlangs->convToOutputCharset($account->bic), 0, 'L', 0); |
|
| 698 | 698 | } |
| 699 | 699 | |
| 700 | 700 | return $pdf->getY(); |
@@ -715,76 +715,76 @@ discard block |
||
| 715 | 715 | * @param int $hidefreetext 1=Hide free text, 0=Show free text |
| 716 | 716 | * @return int Return height of bottom margin including footer text |
| 717 | 717 | */ |
| 718 | -function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_basse,$marge_gauche,$page_hauteur,$object,$showdetails=0,$hidefreetext=0) |
|
| 718 | +function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_basse, $marge_gauche, $page_hauteur, $object, $showdetails = 0, $hidefreetext = 0) |
|
| 719 | 719 | { |
| 720 | - global $conf,$user; |
|
| 720 | + global $conf, $user; |
|
| 721 | 721 | |
| 722 | 722 | $outputlangs->load("dict"); |
| 723 | - $line=''; |
|
| 723 | + $line = ''; |
|
| 724 | 724 | |
| 725 | - $dims=$pdf->getPageDimensions(); |
|
| 725 | + $dims = $pdf->getPageDimensions(); |
|
| 726 | 726 | |
| 727 | 727 | // Line of free text |
| 728 | - if (empty($hidefreetext) && ! empty($conf->global->$paramfreetext)) |
|
| 728 | + if (empty($hidefreetext) && !empty($conf->global->$paramfreetext)) |
|
| 729 | 729 | { |
| 730 | 730 | // Make substitution |
| 731 | - $substitutionarray=array( |
|
| 731 | + $substitutionarray = array( |
|
| 732 | 732 | '__FROM_NAME__' => $fromcompany->name, |
| 733 | 733 | '__FROM_EMAIL__' => $fromcompany->email, |
| 734 | 734 | '__TOTAL_TTC__' => $object->total_ttc, |
| 735 | 735 | '__TOTAL_HT__' => $object->total_ht, |
| 736 | 736 | '__TOTAL_VAT__' => $object->total_vat |
| 737 | 737 | ); |
| 738 | - complete_substitutions_array($substitutionarray,$outputlangs,$object); |
|
| 739 | - $newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray); |
|
| 740 | - $line.=$outputlangs->convToOutputCharset($newfreetext); |
|
| 738 | + complete_substitutions_array($substitutionarray, $outputlangs, $object); |
|
| 739 | + $newfreetext = make_substitutions($conf->global->$paramfreetext, $substitutionarray); |
|
| 740 | + $line .= $outputlangs->convToOutputCharset($newfreetext); |
|
| 741 | 741 | } |
| 742 | 742 | |
| 743 | 743 | // First line of company infos |
| 744 | - $line1=""; $line2=""; $line3=""; $line4=""; |
|
| 744 | + $line1 = ""; $line2 = ""; $line3 = ""; $line4 = ""; |
|
| 745 | 745 | |
| 746 | 746 | if ($showdetails) |
| 747 | 747 | { |
| 748 | 748 | // Company name |
| 749 | 749 | if ($fromcompany->name) |
| 750 | 750 | { |
| 751 | - $line1.=($line1?" - ":"").$outputlangs->transnoentities("RegisteredOffice").": ".$fromcompany->name; |
|
| 751 | + $line1 .= ($line1 ? " - " : "").$outputlangs->transnoentities("RegisteredOffice").": ".$fromcompany->name; |
|
| 752 | 752 | } |
| 753 | 753 | // Address |
| 754 | 754 | if ($fromcompany->address) |
| 755 | 755 | { |
| 756 | - $line1.=($line1?" - ":"").$fromcompany->address; |
|
| 756 | + $line1 .= ($line1 ? " - " : "").$fromcompany->address; |
|
| 757 | 757 | } |
| 758 | 758 | // Zip code |
| 759 | 759 | if ($fromcompany->zip) |
| 760 | 760 | { |
| 761 | - $line1.=($line1?" - ":"").$fromcompany->zip; |
|
| 761 | + $line1 .= ($line1 ? " - " : "").$fromcompany->zip; |
|
| 762 | 762 | } |
| 763 | 763 | // Town |
| 764 | 764 | if ($fromcompany->town) |
| 765 | 765 | { |
| 766 | - $line1.=($line1?" ":"").$fromcompany->town; |
|
| 766 | + $line1 .= ($line1 ? " " : "").$fromcompany->town; |
|
| 767 | 767 | } |
| 768 | 768 | // Phone |
| 769 | 769 | if ($fromcompany->phone) |
| 770 | 770 | { |
| 771 | - $line1.=($line1?" - ":"").$outputlangs->transnoentities("Phone").": ".$fromcompany->phone; |
|
| 771 | + $line1 .= ($line1 ? " - " : "").$outputlangs->transnoentities("Phone").": ".$fromcompany->phone; |
|
| 772 | 772 | } |
| 773 | 773 | // Fax |
| 774 | 774 | if ($fromcompany->fax) |
| 775 | 775 | { |
| 776 | - $line1.=($line1?" - ":"").$outputlangs->transnoentities("Fax").": ".$fromcompany->fax; |
|
| 776 | + $line1 .= ($line1 ? " - " : "").$outputlangs->transnoentities("Fax").": ".$fromcompany->fax; |
|
| 777 | 777 | } |
| 778 | 778 | |
| 779 | 779 | // URL |
| 780 | 780 | if ($fromcompany->url) |
| 781 | 781 | { |
| 782 | - $line2.=($line2?" - ":"").$fromcompany->url; |
|
| 782 | + $line2 .= ($line2 ? " - " : "").$fromcompany->url; |
|
| 783 | 783 | } |
| 784 | 784 | |
| 785 | 785 | if ($fromcompany->email) |
| 786 | 786 | { |
| 787 | - $line2.=($line2?" - ":"").$fromcompany->email; |
|
| 787 | + $line2 .= ($line2 ? " - " : "").$fromcompany->email; |
|
| 788 | 788 | } |
| 789 | 789 | } |
| 790 | 790 | if ($showdetails || ($fromcompany->country_code == 'DE')) |
@@ -792,7 +792,7 @@ discard block |
||
| 792 | 792 | // Managers |
| 793 | 793 | if ($fromcompany->managers) |
| 794 | 794 | { |
| 795 | - $line2.=($line2?" - ":"").$fromcompany->managers; |
|
| 795 | + $line2 .= ($line2 ? " - " : "").$fromcompany->managers; |
|
| 796 | 796 | } |
| 797 | 797 | } |
| 798 | 798 | |
@@ -800,114 +800,114 @@ discard block |
||
| 800 | 800 | // Juridical status |
| 801 | 801 | if ($fromcompany->forme_juridique_code) |
| 802 | 802 | { |
| 803 | - $line3.=($line3?" - ":"").$outputlangs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code)); |
|
| 803 | + $line3 .= ($line3 ? " - " : "").$outputlangs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code)); |
|
| 804 | 804 | } |
| 805 | 805 | // Capital |
| 806 | 806 | if ($fromcompany->capital) |
| 807 | 807 | { |
| 808 | 808 | $tmpamounttoshow = price2num($fromcompany->capital); // This field is a free string |
| 809 | - if (is_numeric($tmpamounttoshow) && $tmpamounttoshow > 0) $line3.=($line3?" - ":"").$outputlangs->transnoentities("CapitalOf",price($tmpamounttoshow, 0, $outputlangs, 0, 0, 0, $conf->currency)); |
|
| 810 | - else $line3.=($line3?" - ":"").$outputlangs->transnoentities("CapitalOf",$tmpamounttoshow,$outputlangs); |
|
| 809 | + if (is_numeric($tmpamounttoshow) && $tmpamounttoshow > 0) $line3 .= ($line3 ? " - " : "").$outputlangs->transnoentities("CapitalOf", price($tmpamounttoshow, 0, $outputlangs, 0, 0, 0, $conf->currency)); |
|
| 810 | + else $line3 .= ($line3 ? " - " : "").$outputlangs->transnoentities("CapitalOf", $tmpamounttoshow, $outputlangs); |
|
| 811 | 811 | } |
| 812 | 812 | // Prof Id 1 |
| 813 | - if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || ! $fromcompany->idprof2)) |
|
| 813 | + if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || !$fromcompany->idprof2)) |
|
| 814 | 814 | { |
| 815 | - $field=$outputlangs->transcountrynoentities("ProfId1",$fromcompany->country_code); |
|
| 816 | - if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; |
|
| 817 | - $line3.=($line3?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof1); |
|
| 815 | + $field = $outputlangs->transcountrynoentities("ProfId1", $fromcompany->country_code); |
|
| 816 | + if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1]; |
|
| 817 | + $line3 .= ($line3 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof1); |
|
| 818 | 818 | } |
| 819 | 819 | // Prof Id 2 |
| 820 | 820 | if ($fromcompany->idprof2) |
| 821 | 821 | { |
| 822 | - $field=$outputlangs->transcountrynoentities("ProfId2",$fromcompany->country_code); |
|
| 823 | - if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; |
|
| 824 | - $line3.=($line3?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof2); |
|
| 822 | + $field = $outputlangs->transcountrynoentities("ProfId2", $fromcompany->country_code); |
|
| 823 | + if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1]; |
|
| 824 | + $line3 .= ($line3 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof2); |
|
| 825 | 825 | } |
| 826 | 826 | |
| 827 | 827 | // Line 4 of company infos |
| 828 | 828 | // Prof Id 3 |
| 829 | 829 | if ($fromcompany->idprof3) |
| 830 | 830 | { |
| 831 | - $field=$outputlangs->transcountrynoentities("ProfId3",$fromcompany->country_code); |
|
| 832 | - if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; |
|
| 833 | - $line4.=($line4?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof3); |
|
| 831 | + $field = $outputlangs->transcountrynoentities("ProfId3", $fromcompany->country_code); |
|
| 832 | + if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1]; |
|
| 833 | + $line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof3); |
|
| 834 | 834 | } |
| 835 | 835 | // Prof Id 4 |
| 836 | 836 | if ($fromcompany->idprof4) |
| 837 | 837 | { |
| 838 | - $field=$outputlangs->transcountrynoentities("ProfId4",$fromcompany->country_code); |
|
| 839 | - if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; |
|
| 840 | - $line4.=($line4?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof4); |
|
| 838 | + $field = $outputlangs->transcountrynoentities("ProfId4", $fromcompany->country_code); |
|
| 839 | + if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1]; |
|
| 840 | + $line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof4); |
|
| 841 | 841 | } |
| 842 | 842 | // IntraCommunautary VAT |
| 843 | 843 | if ($fromcompany->tva_intra != '') |
| 844 | 844 | { |
| 845 | - $line4.=($line4?" - ":"").$outputlangs->transnoentities("VATIntraShort").": ".$outputlangs->convToOutputCharset($fromcompany->tva_intra); |
|
| 845 | + $line4 .= ($line4 ? " - " : "").$outputlangs->transnoentities("VATIntraShort").": ".$outputlangs->convToOutputCharset($fromcompany->tva_intra); |
|
| 846 | 846 | } |
| 847 | 847 | |
| 848 | - $pdf->SetFont('','',7); |
|
| 849 | - $pdf->SetDrawColor(224,224,224); |
|
| 848 | + $pdf->SetFont('', '', 7); |
|
| 849 | + $pdf->SetDrawColor(224, 224, 224); |
|
| 850 | 850 | |
| 851 | 851 | // The start of the bottom of this page footer is positioned according to # of lines |
| 852 | - $freetextheight=0; |
|
| 852 | + $freetextheight = 0; |
|
| 853 | 853 | if ($line) // Free text |
| 854 | 854 | { |
| 855 | - $width=20000; $align='L'; // By default, ask a manual break: We use a large value 20000, to not have automatic wrap. This make user understand, he need to add CR on its text. |
|
| 856 | - if (! empty($conf->global->MAIN_USE_AUTOWRAP_ON_FREETEXT)) { |
|
| 857 | - $width=200; $align='C'; |
|
| 855 | + $width = 20000; $align = 'L'; // By default, ask a manual break: We use a large value 20000, to not have automatic wrap. This make user understand, he need to add CR on its text. |
|
| 856 | + if (!empty($conf->global->MAIN_USE_AUTOWRAP_ON_FREETEXT)) { |
|
| 857 | + $width = 200; $align = 'C'; |
|
| 858 | 858 | } |
| 859 | - $freetextheight=$pdf->getStringHeight($width,$line); |
|
| 859 | + $freetextheight = $pdf->getStringHeight($width, $line); |
|
| 860 | 860 | } |
| 861 | 861 | |
| 862 | - $marginwithfooter=$marge_basse + $freetextheight + (! empty($line1)?3:0) + (! empty($line2)?3:0) + (! empty($line3)?3:0) + (! empty($line4)?3:0); |
|
| 863 | - $posy=$marginwithfooter+0; |
|
| 862 | + $marginwithfooter = $marge_basse + $freetextheight + (!empty($line1) ? 3 : 0) + (!empty($line2) ? 3 : 0) + (!empty($line3) ? 3 : 0) + (!empty($line4) ? 3 : 0); |
|
| 863 | + $posy = $marginwithfooter + 0; |
|
| 864 | 864 | |
| 865 | 865 | if ($line) // Free text |
| 866 | 866 | { |
| 867 | - $pdf->SetXY($dims['lm'],-$posy); |
|
| 867 | + $pdf->SetXY($dims['lm'], -$posy); |
|
| 868 | 868 | $pdf->MultiCell(0, 3, $line, 0, $align, 0); |
| 869 | - $posy-=$freetextheight; |
|
| 869 | + $posy -= $freetextheight; |
|
| 870 | 870 | } |
| 871 | 871 | |
| 872 | 872 | $pdf->SetY(-$posy); |
| 873 | - $pdf->line($dims['lm'], $dims['hk']-$posy, $dims['wk']-$dims['rm'], $dims['hk']-$posy); |
|
| 873 | + $pdf->line($dims['lm'], $dims['hk'] - $posy, $dims['wk'] - $dims['rm'], $dims['hk'] - $posy); |
|
| 874 | 874 | $posy--; |
| 875 | 875 | |
| 876 | - if (! empty($line1)) |
|
| 876 | + if (!empty($line1)) |
|
| 877 | 877 | { |
| 878 | - $pdf->SetFont('','B',7); |
|
| 879 | - $pdf->SetXY($dims['lm'],-$posy); |
|
| 880 | - $pdf->MultiCell($dims['wk']-$dims['rm'], 2, $line1, 0, 'C', 0); |
|
| 881 | - $posy-=3; |
|
| 882 | - $pdf->SetFont('','',7); |
|
| 878 | + $pdf->SetFont('', 'B', 7); |
|
| 879 | + $pdf->SetXY($dims['lm'], -$posy); |
|
| 880 | + $pdf->MultiCell($dims['wk'] - $dims['rm'], 2, $line1, 0, 'C', 0); |
|
| 881 | + $posy -= 3; |
|
| 882 | + $pdf->SetFont('', '', 7); |
|
| 883 | 883 | } |
| 884 | 884 | |
| 885 | - if (! empty($line2)) |
|
| 885 | + if (!empty($line2)) |
|
| 886 | 886 | { |
| 887 | - $pdf->SetFont('','B',7); |
|
| 888 | - $pdf->SetXY($dims['lm'],-$posy); |
|
| 889 | - $pdf->MultiCell($dims['wk']-$dims['rm'], 2, $line2, 0, 'C', 0); |
|
| 890 | - $posy-=3; |
|
| 891 | - $pdf->SetFont('','',7); |
|
| 887 | + $pdf->SetFont('', 'B', 7); |
|
| 888 | + $pdf->SetXY($dims['lm'], -$posy); |
|
| 889 | + $pdf->MultiCell($dims['wk'] - $dims['rm'], 2, $line2, 0, 'C', 0); |
|
| 890 | + $posy -= 3; |
|
| 891 | + $pdf->SetFont('', '', 7); |
|
| 892 | 892 | } |
| 893 | 893 | |
| 894 | - if (! empty($line3)) |
|
| 894 | + if (!empty($line3)) |
|
| 895 | 895 | { |
| 896 | - $pdf->SetXY($dims['lm'],-$posy); |
|
| 897 | - $pdf->MultiCell($dims['wk']-$dims['rm'], 2, $line3, 0, 'C', 0); |
|
| 896 | + $pdf->SetXY($dims['lm'], -$posy); |
|
| 897 | + $pdf->MultiCell($dims['wk'] - $dims['rm'], 2, $line3, 0, 'C', 0); |
|
| 898 | 898 | } |
| 899 | 899 | |
| 900 | - if (! empty($line4)) |
|
| 900 | + if (!empty($line4)) |
|
| 901 | 901 | { |
| 902 | - $posy-=3; |
|
| 903 | - $pdf->SetXY($dims['lm'],-$posy); |
|
| 904 | - $pdf->MultiCell($dims['wk']-$dims['rm'], 2, $line4, 0, 'C', 0); |
|
| 902 | + $posy -= 3; |
|
| 903 | + $pdf->SetXY($dims['lm'], -$posy); |
|
| 904 | + $pdf->MultiCell($dims['wk'] - $dims['rm'], 2, $line4, 0, 'C', 0); |
|
| 905 | 905 | } |
| 906 | 906 | |
| 907 | 907 | // Show page nb only on iso languages (so default Helvetica font) |
| 908 | 908 | if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica') |
| 909 | 909 | { |
| 910 | - $pdf->SetXY(-20,-$posy); |
|
| 910 | + $pdf->SetXY(-20, -$posy); |
|
| 911 | 911 | //print 'xxx'.$pdf->PageNo().'-'.$pdf->getAliasNbPages().'-'.$pdf->getAliasNumPage();exit; |
| 912 | 912 | if (empty($conf->global->MAIN_USE_FPDF)) $pdf->MultiCell(13, 2, $pdf->PageNo().'/'.$pdf->getAliasNbPages(), 0, 'R', 0); |
| 913 | 913 | else $pdf->MultiCell(13, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0); |
@@ -930,22 +930,22 @@ discard block |
||
| 930 | 930 | * @param string $default_font_size Font size |
| 931 | 931 | * @return float The Y PDF position |
| 932 | 932 | */ |
| 933 | -function pdf_writeLinkedObjects(&$pdf,$object,$outputlangs,$posx,$posy,$w,$h,$align,$default_font_size) |
|
| 933 | +function pdf_writeLinkedObjects(&$pdf, $object, $outputlangs, $posx, $posy, $w, $h, $align, $default_font_size) |
|
| 934 | 934 | { |
| 935 | - $linkedobjects = pdf_getLinkedObjects($object,$outputlangs); |
|
| 936 | - if (! empty($linkedobjects)) |
|
| 935 | + $linkedobjects = pdf_getLinkedObjects($object, $outputlangs); |
|
| 936 | + if (!empty($linkedobjects)) |
|
| 937 | 937 | { |
| 938 | - foreach($linkedobjects as $linkedobject) |
|
| 938 | + foreach ($linkedobjects as $linkedobject) |
|
| 939 | 939 | { |
| 940 | - $posy+=3; |
|
| 941 | - $pdf->SetXY($posx,$posy); |
|
| 942 | - $pdf->SetFont('','', $default_font_size - 2); |
|
| 940 | + $posy += 3; |
|
| 941 | + $pdf->SetXY($posx, $posy); |
|
| 942 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
| 943 | 943 | $pdf->MultiCell($w, $h, $linkedobject["ref_title"].' : '.$linkedobject["ref_value"], '', $align); |
| 944 | 944 | |
| 945 | - if (! empty($linkedobject["date_title"]) && ! empty($linkedobject["date_value"])) |
|
| 945 | + if (!empty($linkedobject["date_title"]) && !empty($linkedobject["date_value"])) |
|
| 946 | 946 | { |
| 947 | - $posy+=3; |
|
| 948 | - $pdf->SetXY($posx,$posy); |
|
| 947 | + $posy += 3; |
|
| 948 | + $pdf->SetXY($posx, $posy); |
|
| 949 | 949 | $pdf->MultiCell($w, $h, $linkedobject["date_title"].' : '.$linkedobject["date_value"], '', $align); |
| 950 | 950 | } |
| 951 | 951 | } |
@@ -970,24 +970,24 @@ discard block |
||
| 970 | 970 | * @param int $issupplierline Is it a line for a supplier object ? |
| 971 | 971 | * @return string|null |
| 972 | 972 | */ |
| 973 | -function pdf_writelinedesc(&$pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy,$hideref=0,$hidedesc=0,$issupplierline=0) |
|
| 973 | +function pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $posy, $hideref = 0, $hidedesc = 0, $issupplierline = 0) |
|
| 974 | 974 | { |
| 975 | 975 | global $db, $conf, $langs, $hookmanager; |
| 976 | 976 | |
| 977 | - $reshook=0; |
|
| 978 | - if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) ) |
|
| 977 | + $reshook = 0; |
|
| 978 | + if (is_object($hookmanager) && ((isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || !empty($object->lines[$i]->fk_parent_line))) |
|
| 979 | 979 | { |
| 980 | 980 | $special_code = $object->lines[$i]->special_code; |
| 981 | - if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); |
|
| 982 | - $parameters = array('pdf'=>$pdf,'i'=>$i,'outputlangs'=>$outputlangs,'w'=>$w,'h'=>$h,'posx'=>$posx,'posy'=>$posy,'hideref'=>$hideref,'hidedesc'=>$hidedesc,'issupplierline'=>$issupplierline,'special_code'=>$special_code); |
|
| 983 | - $action=''; |
|
| 984 | - $reshook=$hookmanager->executeHooks('pdf_writelinedesc',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
| 981 | + if (!empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); |
|
| 982 | + $parameters = array('pdf'=>$pdf, 'i'=>$i, 'outputlangs'=>$outputlangs, 'w'=>$w, 'h'=>$h, 'posx'=>$posx, 'posy'=>$posy, 'hideref'=>$hideref, 'hidedesc'=>$hidedesc, 'issupplierline'=>$issupplierline, 'special_code'=>$special_code); |
|
| 983 | + $action = ''; |
|
| 984 | + $reshook = $hookmanager->executeHooks('pdf_writelinedesc', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 985 | 985 | } |
| 986 | 986 | if (empty($reshook)) |
| 987 | 987 | { |
| 988 | - $labelproductservice=pdf_getlinedesc($object,$i,$outputlangs,$hideref,$hidedesc,$issupplierline); |
|
| 988 | + $labelproductservice = pdf_getlinedesc($object, $i, $outputlangs, $hideref, $hidedesc, $issupplierline); |
|
| 989 | 989 | // Description |
| 990 | - $pdf->writeHTMLCell($w, $h, $posx, $posy, $outputlangs->convToOutputCharset($labelproductservice), 0, 1, false, true, 'J',true); |
|
| 990 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $outputlangs->convToOutputCharset($labelproductservice), 0, 1, false, true, 'J', true); |
|
| 991 | 991 | return $labelproductservice; |
| 992 | 992 | } |
| 993 | 993 | } |
@@ -1003,16 +1003,16 @@ discard block |
||
| 1003 | 1003 | * @param int $issupplierline Is it a line for a supplier object ? |
| 1004 | 1004 | * @return string String with line |
| 1005 | 1005 | */ |
| 1006 | -function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issupplierline=0) |
|
| 1006 | +function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $issupplierline = 0) |
|
| 1007 | 1007 | { |
| 1008 | 1008 | global $db, $conf, $langs; |
| 1009 | 1009 | |
| 1010 | - $idprod=(! empty($object->lines[$i]->fk_product)?$object->lines[$i]->fk_product:false); |
|
| 1011 | - $label=(! empty($object->lines[$i]->label)?$object->lines[$i]->label:(! empty($object->lines[$i]->product_label)?$object->lines[$i]->product_label:'')); |
|
| 1012 | - $desc=(! empty($object->lines[$i]->desc)?$object->lines[$i]->desc:(! empty($object->lines[$i]->description)?$object->lines[$i]->description:'')); |
|
| 1013 | - $ref_supplier=(! empty($object->lines[$i]->ref_supplier)?$object->lines[$i]->ref_supplier:(! empty($object->lines[$i]->ref_fourn)?$object->lines[$i]->ref_fourn:'')); // TODO Not yet saved for supplier invoices, only supplier orders |
|
| 1014 | - $note=(! empty($object->lines[$i]->note)?$object->lines[$i]->note:''); |
|
| 1015 | - $dbatch=(! empty($object->lines[$i]->detail_batch)?$object->lines[$i]->detail_batch:false); |
|
| 1010 | + $idprod = (!empty($object->lines[$i]->fk_product) ? $object->lines[$i]->fk_product : false); |
|
| 1011 | + $label = (!empty($object->lines[$i]->label) ? $object->lines[$i]->label : (!empty($object->lines[$i]->product_label) ? $object->lines[$i]->product_label : '')); |
|
| 1012 | + $desc = (!empty($object->lines[$i]->desc) ? $object->lines[$i]->desc : (!empty($object->lines[$i]->description) ? $object->lines[$i]->description : '')); |
|
| 1013 | + $ref_supplier = (!empty($object->lines[$i]->ref_supplier) ? $object->lines[$i]->ref_supplier : (!empty($object->lines[$i]->ref_fourn) ? $object->lines[$i]->ref_fourn : '')); // TODO Not yet saved for supplier invoices, only supplier orders |
|
| 1014 | + $note = (!empty($object->lines[$i]->note) ? $object->lines[$i]->note : ''); |
|
| 1015 | + $dbatch = (!empty($object->lines[$i]->detail_batch) ? $object->lines[$i]->detail_batch : false); |
|
| 1016 | 1016 | |
| 1017 | 1017 | if ($issupplierline) $prodser = new ProductFournisseur($db); |
| 1018 | 1018 | else $prodser = new Product($db); |
@@ -1021,9 +1021,9 @@ discard block |
||
| 1021 | 1021 | { |
| 1022 | 1022 | $prodser->fetch($idprod); |
| 1023 | 1023 | // If a predefined product and multilang and on other lang, we renamed label with label translated |
| 1024 | - if (! empty($conf->global->MAIN_MULTILANGS) && ($outputlangs->defaultlang != $langs->defaultlang)) |
|
| 1024 | + if (!empty($conf->global->MAIN_MULTILANGS) && ($outputlangs->defaultlang != $langs->defaultlang)) |
|
| 1025 | 1025 | { |
| 1026 | - $translatealsoifmodified=(! empty($conf->global->MAIN_MULTILANG_TRANSLATE_EVEN_IF_MODIFIED)); // By default if value was modified manually, we keep it (no translation because we don't have it) |
|
| 1026 | + $translatealsoifmodified = (!empty($conf->global->MAIN_MULTILANG_TRANSLATE_EVEN_IF_MODIFIED)); // By default if value was modified manually, we keep it (no translation because we don't have it) |
|
| 1027 | 1027 | |
| 1028 | 1028 | // TODO Instead of making a compare to see if param was modified, check that content contains reference translation. If yes, add the added part to the new translation |
| 1029 | 1029 | // ($textwasmodified is replaced with $textwasmodifiedorcompleted and we add completion). |
@@ -1031,59 +1031,59 @@ discard block |
||
| 1031 | 1031 | // Set label |
| 1032 | 1032 | // If we want another language, and if label is same than default language (we did force it to a specific value), we can use translation. |
| 1033 | 1033 | //var_dump($outputlangs->defaultlang.' - '.$langs->defaultlang.' - '.$label.' - '.$prodser->label);exit; |
| 1034 | - $textwasmodified=($label == $prodser->label); |
|
| 1035 | - if (! empty($prodser->multilangs[$outputlangs->defaultlang]["label"]) && ($textwasmodified || $translatealsoifmodified)) $label=$prodser->multilangs[$outputlangs->defaultlang]["label"]; |
|
| 1034 | + $textwasmodified = ($label == $prodser->label); |
|
| 1035 | + if (!empty($prodser->multilangs[$outputlangs->defaultlang]["label"]) && ($textwasmodified || $translatealsoifmodified)) $label = $prodser->multilangs[$outputlangs->defaultlang]["label"]; |
|
| 1036 | 1036 | |
| 1037 | 1037 | // Set desc |
| 1038 | 1038 | // Manage HTML entities description test because $prodser->description is store with htmlentities but $desc no |
| 1039 | - $textwasmodified=false; |
|
| 1039 | + $textwasmodified = false; |
|
| 1040 | 1040 | if (!empty($desc) && dol_textishtml($desc) && !empty($prodser->description) && dol_textishtml($prodser->description)) { |
| 1041 | - $textwasmodified=(strpos(dol_html_entity_decode($desc,ENT_QUOTES | ENT_HTML401),dol_html_entity_decode($prodser->description,ENT_QUOTES | ENT_HTML401))!==false); |
|
| 1041 | + $textwasmodified = (strpos(dol_html_entity_decode($desc, ENT_QUOTES | ENT_HTML401), dol_html_entity_decode($prodser->description, ENT_QUOTES | ENT_HTML401)) !== false); |
|
| 1042 | 1042 | } else { |
| 1043 | - $textwasmodified=($desc == $prodser->description); |
|
| 1043 | + $textwasmodified = ($desc == $prodser->description); |
|
| 1044 | 1044 | } |
| 1045 | - if (! empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && ($textwasmodified || $translatealsoifmodified)) $desc=$prodser->multilangs[$outputlangs->defaultlang]["description"]; |
|
| 1045 | + if (!empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && ($textwasmodified || $translatealsoifmodified)) $desc = $prodser->multilangs[$outputlangs->defaultlang]["description"]; |
|
| 1046 | 1046 | |
| 1047 | 1047 | // Set note |
| 1048 | - $textwasmodified=($note == $prodser->note); |
|
| 1049 | - if (! empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && ($textwasmodified || $translatealsoifmodified)) $note=$prodser->multilangs[$outputlangs->defaultlang]["note"]; |
|
| 1048 | + $textwasmodified = ($note == $prodser->note); |
|
| 1049 | + if (!empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && ($textwasmodified || $translatealsoifmodified)) $note = $prodser->multilangs[$outputlangs->defaultlang]["note"]; |
|
| 1050 | 1050 | } |
| 1051 | 1051 | } |
| 1052 | 1052 | |
| 1053 | 1053 | // Description short of product line |
| 1054 | - $libelleproduitservice=$label; |
|
| 1054 | + $libelleproduitservice = $label; |
|
| 1055 | 1055 | |
| 1056 | 1056 | // Description long of product line |
| 1057 | - if (! empty($desc) && ($desc != $label)) |
|
| 1057 | + if (!empty($desc) && ($desc != $label)) |
|
| 1058 | 1058 | { |
| 1059 | 1059 | if ($libelleproduitservice && empty($hidedesc)) |
| 1060 | 1060 | { |
| 1061 | - $libelleproduitservice.='__N__'; |
|
| 1061 | + $libelleproduitservice .= '__N__'; |
|
| 1062 | 1062 | } |
| 1063 | 1063 | |
| 1064 | 1064 | if ($desc == '(CREDIT_NOTE)' && $object->lines[$i]->fk_remise_except) |
| 1065 | 1065 | { |
| 1066 | - $discount=new DiscountAbsolute($db); |
|
| 1066 | + $discount = new DiscountAbsolute($db); |
|
| 1067 | 1067 | $discount->fetch($object->lines[$i]->fk_remise_except); |
| 1068 | - $libelleproduitservice=$outputlangs->transnoentitiesnoconv("DiscountFromCreditNote",$discount->ref_facture_source); |
|
| 1068 | + $libelleproduitservice = $outputlangs->transnoentitiesnoconv("DiscountFromCreditNote", $discount->ref_facture_source); |
|
| 1069 | 1069 | } |
| 1070 | 1070 | elseif ($desc == '(DEPOSIT)' && $object->lines[$i]->fk_remise_except) |
| 1071 | 1071 | { |
| 1072 | - $discount=new DiscountAbsolute($db); |
|
| 1072 | + $discount = new DiscountAbsolute($db); |
|
| 1073 | 1073 | $discount->fetch($object->lines[$i]->fk_remise_except); |
| 1074 | - $libelleproduitservice=$outputlangs->transnoentitiesnoconv("DiscountFromDeposit",$discount->ref_facture_source); |
|
| 1074 | + $libelleproduitservice = $outputlangs->transnoentitiesnoconv("DiscountFromDeposit", $discount->ref_facture_source); |
|
| 1075 | 1075 | // Add date of deposit |
| 1076 | - if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec,'day','',$outputlangs).')'; |
|
| 1076 | + if (!empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec, 'day', '', $outputlangs).')'; |
|
| 1077 | 1077 | } |
| 1078 | 1078 | else |
| 1079 | 1079 | { |
| 1080 | 1080 | if ($idprod) |
| 1081 | 1081 | { |
| 1082 | - if (empty($hidedesc)) $libelleproduitservice.=$desc; |
|
| 1082 | + if (empty($hidedesc)) $libelleproduitservice .= $desc; |
|
| 1083 | 1083 | } |
| 1084 | 1084 | else |
| 1085 | 1085 | { |
| 1086 | - $libelleproduitservice.=$desc; |
|
| 1086 | + $libelleproduitservice .= $desc; |
|
| 1087 | 1087 | } |
| 1088 | 1088 | } |
| 1089 | 1089 | } |
@@ -1096,7 +1096,7 @@ discard block |
||
| 1096 | 1096 | { |
| 1097 | 1097 | $prefix_prodserv = ""; |
| 1098 | 1098 | $ref_prodserv = ""; |
| 1099 | - if (! empty($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS)) // In standard mode, we do not show this |
|
| 1099 | + if (!empty($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS)) // In standard mode, we do not show this |
|
| 1100 | 1100 | { |
| 1101 | 1101 | if ($prodser->isservice()) |
| 1102 | 1102 | { |
@@ -1110,71 +1110,71 @@ discard block |
||
| 1110 | 1110 | |
| 1111 | 1111 | if (empty($hideref)) |
| 1112 | 1112 | { |
| 1113 | - if ($issupplierline) $ref_prodserv = $prodser->ref.($ref_supplier ? ' ('.$outputlangs->transnoentitiesnoconv("SupplierRef").' '.$ref_supplier.')' : ''); // Show local ref and supplier ref |
|
| 1113 | + if ($issupplierline) $ref_prodserv = $prodser->ref.($ref_supplier ? ' ('.$outputlangs->transnoentitiesnoconv("SupplierRef").' '.$ref_supplier.')' : ''); // Show local ref and supplier ref |
|
| 1114 | 1114 | else $ref_prodserv = $prodser->ref; // Show local ref only |
| 1115 | 1115 | |
| 1116 | - if (! empty($libelleproduitservice)) $ref_prodserv .= " - "; |
|
| 1116 | + if (!empty($libelleproduitservice)) $ref_prodserv .= " - "; |
|
| 1117 | 1117 | } |
| 1118 | 1118 | |
| 1119 | - $libelleproduitservice=$prefix_prodserv.$ref_prodserv.$libelleproduitservice; |
|
| 1119 | + $libelleproduitservice = $prefix_prodserv.$ref_prodserv.$libelleproduitservice; |
|
| 1120 | 1120 | } |
| 1121 | 1121 | } |
| 1122 | 1122 | |
| 1123 | 1123 | // Add an additional description for the category products |
| 1124 | - if (! empty($conf->global->CATEGORY_ADD_DESC_INTO_DOC) && $idprod && ! empty($conf->categorie->enabled)) |
|
| 1124 | + if (!empty($conf->global->CATEGORY_ADD_DESC_INTO_DOC) && $idprod && !empty($conf->categorie->enabled)) |
|
| 1125 | 1125 | { |
| 1126 | 1126 | include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
| 1127 | - $categstatic=new Categorie($db); |
|
| 1127 | + $categstatic = new Categorie($db); |
|
| 1128 | 1128 | // recovering the list of all the categories linked to product |
| 1129 | - $tblcateg=$categstatic->containing($idprod, Categorie::TYPE_PRODUCT); |
|
| 1129 | + $tblcateg = $categstatic->containing($idprod, Categorie::TYPE_PRODUCT); |
|
| 1130 | 1130 | foreach ($tblcateg as $cate) |
| 1131 | 1131 | { |
| 1132 | 1132 | // Adding the descriptions if they are filled |
| 1133 | - $desccateg=$cate->add_description; |
|
| 1133 | + $desccateg = $cate->add_description; |
|
| 1134 | 1134 | if ($desccateg) |
| 1135 | - $libelleproduitservice.='__N__'.$desccateg; |
|
| 1135 | + $libelleproduitservice .= '__N__'.$desccateg; |
|
| 1136 | 1136 | } |
| 1137 | 1137 | } |
| 1138 | 1138 | |
| 1139 | - if (! empty($object->lines[$i]->date_start) || ! empty($object->lines[$i]->date_end)) |
|
| 1139 | + if (!empty($object->lines[$i]->date_start) || !empty($object->lines[$i]->date_end)) |
|
| 1140 | 1140 | { |
| 1141 | - $format='day'; |
|
| 1141 | + $format = 'day'; |
|
| 1142 | 1142 | // Show duration if exists |
| 1143 | 1143 | if ($object->lines[$i]->date_start && $object->lines[$i]->date_end) |
| 1144 | 1144 | { |
| 1145 | - $period='('.$outputlangs->transnoentitiesnoconv('DateFromTo',dol_print_date($object->lines[$i]->date_start, $format, false, $outputlangs),dol_print_date($object->lines[$i]->date_end, $format, false, $outputlangs)).')'; |
|
| 1145 | + $period = '('.$outputlangs->transnoentitiesnoconv('DateFromTo', dol_print_date($object->lines[$i]->date_start, $format, false, $outputlangs), dol_print_date($object->lines[$i]->date_end, $format, false, $outputlangs)).')'; |
|
| 1146 | 1146 | } |
| 1147 | - if ($object->lines[$i]->date_start && ! $object->lines[$i]->date_end) |
|
| 1147 | + if ($object->lines[$i]->date_start && !$object->lines[$i]->date_end) |
|
| 1148 | 1148 | { |
| 1149 | - $period='('.$outputlangs->transnoentitiesnoconv('DateFrom',dol_print_date($object->lines[$i]->date_start, $format, false, $outputlangs)).')'; |
|
| 1149 | + $period = '('.$outputlangs->transnoentitiesnoconv('DateFrom', dol_print_date($object->lines[$i]->date_start, $format, false, $outputlangs)).')'; |
|
| 1150 | 1150 | } |
| 1151 | - if (! $object->lines[$i]->date_start && $object->lines[$i]->date_end) |
|
| 1151 | + if (!$object->lines[$i]->date_start && $object->lines[$i]->date_end) |
|
| 1152 | 1152 | { |
| 1153 | - $period='('.$outputlangs->transnoentitiesnoconv('DateUntil',dol_print_date($object->lines[$i]->date_end, $format, false, $outputlangs)).')'; |
|
| 1153 | + $period = '('.$outputlangs->transnoentitiesnoconv('DateUntil', dol_print_date($object->lines[$i]->date_end, $format, false, $outputlangs)).')'; |
|
| 1154 | 1154 | } |
| 1155 | 1155 | //print '>'.$outputlangs->charset_output.','.$period; |
| 1156 | - $libelleproduitservice.="__N__".$period; |
|
| 1156 | + $libelleproduitservice .= "__N__".$period; |
|
| 1157 | 1157 | //print $libelleproduitservice; |
| 1158 | 1158 | } |
| 1159 | 1159 | |
| 1160 | 1160 | if ($dbatch) |
| 1161 | 1161 | { |
| 1162 | - $format='day'; |
|
| 1162 | + $format = 'day'; |
|
| 1163 | 1163 | foreach ($dbatch as $detail) |
| 1164 | 1164 | { |
| 1165 | - $dte=array(); |
|
| 1166 | - if ($detail->eatby) $dte[]=$outputlangs->transnoentitiesnoconv('printEatby',dol_print_date($detail->eatby, $format, false, $outputlangs)); |
|
| 1167 | - if ($detail->sellby) $dte[]=$outputlangs->transnoentitiesnoconv('printSellby',dol_print_date($detail->sellby, $format, false, $outputlangs)); |
|
| 1168 | - if ($detail->batch) $dte[]=$outputlangs->transnoentitiesnoconv('printBatch',$detail->batch); |
|
| 1169 | - $dte[]=$outputlangs->transnoentitiesnoconv('printQty',$detail->dluo_qty); |
|
| 1170 | - $libelleproduitservice.= "__N__ ".implode($dte,"-"); |
|
| 1165 | + $dte = array(); |
|
| 1166 | + if ($detail->eatby) $dte[] = $outputlangs->transnoentitiesnoconv('printEatby', dol_print_date($detail->eatby, $format, false, $outputlangs)); |
|
| 1167 | + if ($detail->sellby) $dte[] = $outputlangs->transnoentitiesnoconv('printSellby', dol_print_date($detail->sellby, $format, false, $outputlangs)); |
|
| 1168 | + if ($detail->batch) $dte[] = $outputlangs->transnoentitiesnoconv('printBatch', $detail->batch); |
|
| 1169 | + $dte[] = $outputlangs->transnoentitiesnoconv('printQty', $detail->dluo_qty); |
|
| 1170 | + $libelleproduitservice .= "__N__ ".implode($dte, "-"); |
|
| 1171 | 1171 | } |
| 1172 | 1172 | } |
| 1173 | 1173 | |
| 1174 | 1174 | // Now we convert \n into br |
| 1175 | - if (dol_textishtml($libelleproduitservice)) $libelleproduitservice=preg_replace('/__N__/','<br>',$libelleproduitservice); |
|
| 1176 | - else $libelleproduitservice=preg_replace('/__N__/',"\n",$libelleproduitservice); |
|
| 1177 | - $libelleproduitservice=dol_htmlentitiesbr($libelleproduitservice,1); |
|
| 1175 | + if (dol_textishtml($libelleproduitservice)) $libelleproduitservice = preg_replace('/__N__/', '<br>', $libelleproduitservice); |
|
| 1176 | + else $libelleproduitservice = preg_replace('/__N__/', "\n", $libelleproduitservice); |
|
| 1177 | + $libelleproduitservice = dol_htmlentitiesbr($libelleproduitservice, 1); |
|
| 1178 | 1178 | |
| 1179 | 1179 | return $libelleproduitservice; |
| 1180 | 1180 | } |
@@ -1188,14 +1188,14 @@ discard block |
||
| 1188 | 1188 | * @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines) |
| 1189 | 1189 | * @return null|string |
| 1190 | 1190 | */ |
| 1191 | -function pdf_getlinenum($object,$i,$outputlangs,$hidedetails=0) |
|
| 1191 | +function pdf_getlinenum($object, $i, $outputlangs, $hidedetails = 0) |
|
| 1192 | 1192 | { |
| 1193 | 1193 | global $hookmanager; |
| 1194 | 1194 | |
| 1195 | - if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line))) |
|
| 1195 | + if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || !empty($object->lines[$i]->fk_parent_line))) |
|
| 1196 | 1196 | { |
| 1197 | 1197 | $special_code = $object->lines[$i]->special_code; |
| 1198 | - if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); |
|
| 1198 | + if (!empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); |
|
| 1199 | 1199 | // TODO add hook function |
| 1200 | 1200 | } |
| 1201 | 1201 | else |
@@ -1214,14 +1214,14 @@ discard block |
||
| 1214 | 1214 | * @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines) |
| 1215 | 1215 | * @return null|string |
| 1216 | 1216 | */ |
| 1217 | -function pdf_getlineref($object,$i,$outputlangs,$hidedetails=0) |
|
| 1217 | +function pdf_getlineref($object, $i, $outputlangs, $hidedetails = 0) |
|
| 1218 | 1218 | { |
| 1219 | 1219 | global $hookmanager; |
| 1220 | 1220 | |
| 1221 | - if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line))) |
|
| 1221 | + if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || !empty($object->lines[$i]->fk_parent_line))) |
|
| 1222 | 1222 | { |
| 1223 | 1223 | $special_code = $object->lines[$i]->special_code; |
| 1224 | - if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); |
|
| 1224 | + if (!empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); |
|
| 1225 | 1225 | // TODO add hook function |
| 1226 | 1226 | } |
| 1227 | 1227 | else |
@@ -1239,14 +1239,14 @@ discard block |
||
| 1239 | 1239 | * @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines) |
| 1240 | 1240 | * @return null|string |
| 1241 | 1241 | */ |
| 1242 | -function pdf_getlineref_supplier($object,$i,$outputlangs,$hidedetails=0) |
|
| 1242 | +function pdf_getlineref_supplier($object, $i, $outputlangs, $hidedetails = 0) |
|
| 1243 | 1243 | { |
| 1244 | 1244 | global $hookmanager; |
| 1245 | 1245 | |
| 1246 | - if (is_object($hookmanager) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) ) |
|
| 1246 | + if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || !empty($object->lines[$i]->fk_parent_line))) |
|
| 1247 | 1247 | { |
| 1248 | 1248 | $special_code = $object->lines[$i]->special_code; |
| 1249 | - if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); |
|
| 1249 | + if (!empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); |
|
| 1250 | 1250 | // TODO add hook function |
| 1251 | 1251 | } |
| 1252 | 1252 | else |
@@ -1264,24 +1264,24 @@ discard block |
||
| 1264 | 1264 | * @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines) |
| 1265 | 1265 | * @return string |
| 1266 | 1266 | */ |
| 1267 | -function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0) |
|
| 1267 | +function pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails = 0) |
|
| 1268 | 1268 | { |
| 1269 | 1269 | global $hookmanager; |
| 1270 | 1270 | |
| 1271 | - if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line))) |
|
| 1271 | + if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || !empty($object->lines[$i]->fk_parent_line))) |
|
| 1272 | 1272 | { |
| 1273 | 1273 | $special_code = $object->lines[$i]->special_code; |
| 1274 | - if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); |
|
| 1275 | - $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code); |
|
| 1276 | - $action=''; |
|
| 1277 | - $reshook = $hookmanager->executeHooks('pdf_getlinevatrate',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
| 1274 | + if (!empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); |
|
| 1275 | + $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); |
|
| 1276 | + $action = ''; |
|
| 1277 | + $reshook = $hookmanager->executeHooks('pdf_getlinevatrate', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 1278 | 1278 | |
| 1279 | - if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint; |
|
| 1279 | + if (!empty($hookmanager->resPrint)) return $hookmanager->resPrint; |
|
| 1280 | 1280 | else return $reshook; |
| 1281 | 1281 | } |
| 1282 | 1282 | else |
| 1283 | 1283 | { |
| 1284 | - if (empty($hidedetails) || $hidedetails > 1) return vatrate($object->lines[$i]->tva_tx,1,$object->lines[$i]->info_bits,1); |
|
| 1284 | + if (empty($hidedetails) || $hidedetails > 1) return vatrate($object->lines[$i]->tva_tx, 1, $object->lines[$i]->info_bits, 1); |
|
| 1285 | 1285 | } |
| 1286 | 1286 | } |
| 1287 | 1287 | |
@@ -1294,22 +1294,22 @@ discard block |
||
| 1294 | 1294 | * @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines) |
| 1295 | 1295 | * @return string |
| 1296 | 1296 | */ |
| 1297 | -function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0) |
|
| 1297 | +function pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails = 0) |
|
| 1298 | 1298 | { |
| 1299 | 1299 | global $conf, $hookmanager; |
| 1300 | 1300 | |
| 1301 | - $sign=1; |
|
| 1302 | - if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; |
|
| 1301 | + $sign = 1; |
|
| 1302 | + if (isset($object->type) && $object->type == 2 && !empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign = -1; |
|
| 1303 | 1303 | |
| 1304 | - if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line))) |
|
| 1304 | + if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || !empty($object->lines[$i]->fk_parent_line))) |
|
| 1305 | 1305 | { |
| 1306 | 1306 | $special_code = $object->lines[$i]->special_code; |
| 1307 | - if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); |
|
| 1308 | - $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code); |
|
| 1309 | - $action=''; |
|
| 1310 | - $reshook = $hookmanager->executeHooks('pdf_getlineupexcltax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
| 1307 | + if (!empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); |
|
| 1308 | + $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); |
|
| 1309 | + $action = ''; |
|
| 1310 | + $reshook = $hookmanager->executeHooks('pdf_getlineupexcltax', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 1311 | 1311 | |
| 1312 | - if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint; |
|
| 1312 | + if (!empty($hookmanager->resPrint)) return $hookmanager->resPrint; |
|
| 1313 | 1313 | else return $reshook; |
| 1314 | 1314 | } |
| 1315 | 1315 | else |
@@ -1327,22 +1327,22 @@ discard block |
||
| 1327 | 1327 | * @param int $hidedetails Hide value (0 = no, 1 = yes, 2 = just special lines) |
| 1328 | 1328 | * @return void |
| 1329 | 1329 | */ |
| 1330 | -function pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails=0) |
|
| 1330 | +function pdf_getlineupwithtax($object, $i, $outputlangs, $hidedetails = 0) |
|
| 1331 | 1331 | { |
| 1332 | 1332 | global $hookmanager; |
| 1333 | 1333 | |
| 1334 | - if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line))) |
|
| 1334 | + if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || !empty($object->lines[$i]->fk_parent_line))) |
|
| 1335 | 1335 | { |
| 1336 | 1336 | $special_code = $object->lines[$i]->special_code; |
| 1337 | - if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); |
|
| 1338 | - foreach($object->hooks as $modules) |
|
| 1337 | + if (!empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); |
|
| 1338 | + foreach ($object->hooks as $modules) |
|
| 1339 | 1339 | { |
| 1340 | - if (method_exists($modules[$special_code],'pdf_getlineupwithtax')) return $modules[$special_code]->pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails); |
|
| 1340 | + if (method_exists($modules[$special_code], 'pdf_getlineupwithtax')) return $modules[$special_code]->pdf_getlineupwithtax($object, $i, $outputlangs, $hidedetails); |
|
| 1341 | 1341 | } |
| 1342 | 1342 | } |
| 1343 | 1343 | else |
| 1344 | 1344 | { |
| 1345 | - if (empty($hidedetails) || $hidedetails > 1) return price(($object->lines[$i]->subprice) + ($object->lines[$i]->subprice)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs); |
|
| 1345 | + if (empty($hidedetails) || $hidedetails > 1) return price(($object->lines[$i]->subprice) + ($object->lines[$i]->subprice) * ($object->lines[$i]->tva_tx) / 100, 0, $outputlangs); |
|
| 1346 | 1346 | } |
| 1347 | 1347 | } |
| 1348 | 1348 | |
@@ -1355,21 +1355,21 @@ discard block |
||
| 1355 | 1355 | * @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines) |
| 1356 | 1356 | * @return string |
| 1357 | 1357 | */ |
| 1358 | -function pdf_getlineqty($object,$i,$outputlangs,$hidedetails=0) |
|
| 1358 | +function pdf_getlineqty($object, $i, $outputlangs, $hidedetails = 0) |
|
| 1359 | 1359 | { |
| 1360 | 1360 | global $hookmanager; |
| 1361 | 1361 | |
| 1362 | 1362 | if ($object->lines[$i]->special_code != 3) |
| 1363 | 1363 | { |
| 1364 | - if (is_object($hookmanager) && (( $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) ) |
|
| 1364 | + if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || !empty($object->lines[$i]->fk_parent_line))) |
|
| 1365 | 1365 | { |
| 1366 | 1366 | $special_code = $object->lines[$i]->special_code; |
| 1367 | - if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); |
|
| 1368 | - $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code); |
|
| 1369 | - $action=''; |
|
| 1370 | - $reshook = $hookmanager->executeHooks('pdf_getlineqty',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
| 1367 | + if (!empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); |
|
| 1368 | + $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); |
|
| 1369 | + $action = ''; |
|
| 1370 | + $reshook = $hookmanager->executeHooks('pdf_getlineqty', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 1371 | 1371 | |
| 1372 | - if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint; |
|
| 1372 | + if (!empty($hookmanager->resPrint)) return $hookmanager->resPrint; |
|
| 1373 | 1373 | else return $reshook; |
| 1374 | 1374 | |
| 1375 | 1375 | } |
@@ -1389,21 +1389,21 @@ discard block |
||
| 1389 | 1389 | * @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines) |
| 1390 | 1390 | * @return string |
| 1391 | 1391 | */ |
| 1392 | -function pdf_getlineqty_asked($object,$i,$outputlangs,$hidedetails=0) |
|
| 1392 | +function pdf_getlineqty_asked($object, $i, $outputlangs, $hidedetails = 0) |
|
| 1393 | 1393 | { |
| 1394 | 1394 | global $hookmanager; |
| 1395 | 1395 | |
| 1396 | 1396 | if ($object->lines[$i]->special_code != 3) |
| 1397 | 1397 | { |
| 1398 | - if (is_object($hookmanager) && (( $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) ) |
|
| 1398 | + if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || !empty($object->lines[$i]->fk_parent_line))) |
|
| 1399 | 1399 | { |
| 1400 | 1400 | $special_code = $object->lines[$i]->special_code; |
| 1401 | - if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); |
|
| 1402 | - $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code); |
|
| 1403 | - $action=''; |
|
| 1404 | - $reshook = $hookmanager->executeHooks('pdf_getlineqty_asked',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
| 1401 | + if (!empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); |
|
| 1402 | + $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); |
|
| 1403 | + $action = ''; |
|
| 1404 | + $reshook = $hookmanager->executeHooks('pdf_getlineqty_asked', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 1405 | 1405 | |
| 1406 | - if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint; |
|
| 1406 | + if (!empty($hookmanager->resPrint)) return $hookmanager->resPrint; |
|
| 1407 | 1407 | else return $reshook; |
| 1408 | 1408 | } |
| 1409 | 1409 | else |
@@ -1422,21 +1422,21 @@ discard block |
||
| 1422 | 1422 | * @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines) |
| 1423 | 1423 | * @return string |
| 1424 | 1424 | */ |
| 1425 | -function pdf_getlineqty_shipped($object,$i,$outputlangs,$hidedetails=0) |
|
| 1425 | +function pdf_getlineqty_shipped($object, $i, $outputlangs, $hidedetails = 0) |
|
| 1426 | 1426 | { |
| 1427 | 1427 | global $hookmanager; |
| 1428 | 1428 | |
| 1429 | 1429 | if ($object->lines[$i]->special_code != 3) |
| 1430 | 1430 | { |
| 1431 | - if (is_object($hookmanager) && (( $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) ) |
|
| 1431 | + if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || !empty($object->lines[$i]->fk_parent_line))) |
|
| 1432 | 1432 | { |
| 1433 | 1433 | $special_code = $object->lines[$i]->special_code; |
| 1434 | - if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); |
|
| 1435 | - $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code); |
|
| 1436 | - $action=''; |
|
| 1437 | - $reshook = $hookmanager->executeHooks('pdf_getlineqty_shipped',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
| 1434 | + if (!empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); |
|
| 1435 | + $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); |
|
| 1436 | + $action = ''; |
|
| 1437 | + $reshook = $hookmanager->executeHooks('pdf_getlineqty_shipped', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 1438 | 1438 | |
| 1439 | - if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint; |
|
| 1439 | + if (!empty($hookmanager->resPrint)) return $hookmanager->resPrint; |
|
| 1440 | 1440 | else return $reshook; |
| 1441 | 1441 | } |
| 1442 | 1442 | else |
@@ -1455,21 +1455,21 @@ discard block |
||
| 1455 | 1455 | * @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines) |
| 1456 | 1456 | * @return void |
| 1457 | 1457 | */ |
| 1458 | -function pdf_getlineqty_keeptoship($object,$i,$outputlangs,$hidedetails=0) |
|
| 1458 | +function pdf_getlineqty_keeptoship($object, $i, $outputlangs, $hidedetails = 0) |
|
| 1459 | 1459 | { |
| 1460 | 1460 | global $hookmanager; |
| 1461 | 1461 | |
| 1462 | 1462 | if ($object->lines[$i]->special_code != 3) |
| 1463 | 1463 | { |
| 1464 | - if (is_object($hookmanager) && (( $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) ) |
|
| 1464 | + if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || !empty($object->lines[$i]->fk_parent_line))) |
|
| 1465 | 1465 | { |
| 1466 | 1466 | $special_code = $object->lines[$i]->special_code; |
| 1467 | - if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); |
|
| 1468 | - $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code); |
|
| 1469 | - $action=''; |
|
| 1470 | - $reshook = $hookmanager->executeHooks('pdf_getlineqty_keeptoship',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
| 1467 | + if (!empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); |
|
| 1468 | + $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); |
|
| 1469 | + $action = ''; |
|
| 1470 | + $reshook = $hookmanager->executeHooks('pdf_getlineqty_keeptoship', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 1471 | 1471 | |
| 1472 | - if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint; |
|
| 1472 | + if (!empty($hookmanager->resPrint)) return $hookmanager->resPrint; |
|
| 1473 | 1473 | else return $reshook; |
| 1474 | 1474 | } |
| 1475 | 1475 | else |
@@ -1506,9 +1506,9 @@ discard block |
||
| 1506 | 1506 | ); |
| 1507 | 1507 | $action = ''; |
| 1508 | 1508 | $reshook = $hookmanager->executeHooks('pdf_getlineunit', $parameters, $object, |
| 1509 | - $action); // Note that $action and $object may have been modified by some hooks |
|
| 1509 | + $action); // Note that $action and $object may have been modified by some hooks |
|
| 1510 | 1510 | |
| 1511 | - if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint; |
|
| 1511 | + if (!empty($hookmanager->resPrint)) return $hookmanager->resPrint; |
|
| 1512 | 1512 | else return $reshook; |
| 1513 | 1513 | |
| 1514 | 1514 | } else { |
@@ -1529,7 +1529,7 @@ discard block |
||
| 1529 | 1529 | * @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines) |
| 1530 | 1530 | * @return string |
| 1531 | 1531 | */ |
| 1532 | -function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0) |
|
| 1532 | +function pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails = 0) |
|
| 1533 | 1533 | { |
| 1534 | 1534 | global $hookmanager; |
| 1535 | 1535 | |
@@ -1537,20 +1537,20 @@ discard block |
||
| 1537 | 1537 | |
| 1538 | 1538 | if ($object->lines[$i]->special_code != 3) |
| 1539 | 1539 | { |
| 1540 | - if (is_object($hookmanager) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) ) |
|
| 1540 | + if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || !empty($object->lines[$i]->fk_parent_line))) |
|
| 1541 | 1541 | { |
| 1542 | 1542 | $special_code = $object->lines[$i]->special_code; |
| 1543 | - if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); |
|
| 1544 | - $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code); |
|
| 1545 | - $action=''; |
|
| 1546 | - $reshook = $hookmanager->executeHooks('pdf_getlineremisepercent',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
| 1543 | + if (!empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); |
|
| 1544 | + $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); |
|
| 1545 | + $action = ''; |
|
| 1546 | + $reshook = $hookmanager->executeHooks('pdf_getlineremisepercent', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 1547 | 1547 | |
| 1548 | - if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint; |
|
| 1548 | + if (!empty($hookmanager->resPrint)) return $hookmanager->resPrint; |
|
| 1549 | 1549 | else return $reshook; |
| 1550 | 1550 | } |
| 1551 | 1551 | else |
| 1552 | 1552 | { |
| 1553 | - if (empty($hidedetails) || $hidedetails > 1) return dol_print_reduction($object->lines[$i]->remise_percent,$outputlangs); |
|
| 1553 | + if (empty($hidedetails) || $hidedetails > 1) return dol_print_reduction($object->lines[$i]->remise_percent, $outputlangs); |
|
| 1554 | 1554 | } |
| 1555 | 1555 | } |
| 1556 | 1556 | } |
@@ -1575,12 +1575,12 @@ discard block |
||
| 1575 | 1575 | if (!empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); |
| 1576 | 1576 | $parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code); |
| 1577 | 1577 | $action = ''; |
| 1578 | - $reshook = $hookmanager->executeHooks('pdf_getlineprogress', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 1578 | + $reshook = $hookmanager->executeHooks('pdf_getlineprogress', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 1579 | 1579 | |
| 1580 | - if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint; |
|
| 1580 | + if (!empty($hookmanager->resPrint)) return $hookmanager->resPrint; |
|
| 1581 | 1581 | else return $reshook; |
| 1582 | 1582 | } else { |
| 1583 | - if (empty($hidedetails) || $hidedetails > 1) return $object->lines[$i]->situation_percent . '%'; |
|
| 1583 | + if (empty($hidedetails) || $hidedetails > 1) return $object->lines[$i]->situation_percent.'%'; |
|
| 1584 | 1584 | } |
| 1585 | 1585 | } |
| 1586 | 1586 | } |
@@ -1594,12 +1594,12 @@ discard block |
||
| 1594 | 1594 | * @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines) |
| 1595 | 1595 | * @return string Return total of line excl tax |
| 1596 | 1596 | */ |
| 1597 | -function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0) |
|
| 1597 | +function pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails = 0) |
|
| 1598 | 1598 | { |
| 1599 | 1599 | global $conf, $hookmanager; |
| 1600 | 1600 | |
| 1601 | - $sign=1; |
|
| 1602 | - if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; |
|
| 1601 | + $sign = 1; |
|
| 1602 | + if (isset($object->type) && $object->type == 2 && !empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign = -1; |
|
| 1603 | 1603 | |
| 1604 | 1604 | if ($object->lines[$i]->special_code == 3) |
| 1605 | 1605 | { |
@@ -1607,15 +1607,15 @@ discard block |
||
| 1607 | 1607 | } |
| 1608 | 1608 | else |
| 1609 | 1609 | { |
| 1610 | - if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line))) |
|
| 1610 | + if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || !empty($object->lines[$i]->fk_parent_line))) |
|
| 1611 | 1611 | { |
| 1612 | 1612 | $special_code = $object->lines[$i]->special_code; |
| 1613 | - if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); |
|
| 1614 | - $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code); |
|
| 1615 | - $action=''; |
|
| 1616 | - $reshook = $hookmanager->executeHooks('pdf_getlinetotalexcltax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
| 1613 | + if (!empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); |
|
| 1614 | + $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); |
|
| 1615 | + $action = ''; |
|
| 1616 | + $reshook = $hookmanager->executeHooks('pdf_getlinetotalexcltax', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 1617 | 1617 | |
| 1618 | - if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint; |
|
| 1618 | + if (!empty($hookmanager->resPrint)) return $hookmanager->resPrint; |
|
| 1619 | 1619 | else return $reshook; |
| 1620 | 1620 | } |
| 1621 | 1621 | else |
@@ -1635,7 +1635,7 @@ discard block |
||
| 1635 | 1635 | * @param int $hidedetails Hide value (0 = no, 1 = yes, 2 = just special lines) |
| 1636 | 1636 | * @return string Return total of line incl tax |
| 1637 | 1637 | */ |
| 1638 | -function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0) |
|
| 1638 | +function pdf_getlinetotalwithtax($object, $i, $outputlangs, $hidedetails = 0) |
|
| 1639 | 1639 | { |
| 1640 | 1640 | global $hookmanager; |
| 1641 | 1641 | |
@@ -1645,20 +1645,20 @@ discard block |
||
| 1645 | 1645 | } |
| 1646 | 1646 | else |
| 1647 | 1647 | { |
| 1648 | - if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line))) |
|
| 1648 | + if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || !empty($object->lines[$i]->fk_parent_line))) |
|
| 1649 | 1649 | { |
| 1650 | 1650 | $special_code = $object->lines[$i]->special_code; |
| 1651 | - if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); |
|
| 1652 | - $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code); |
|
| 1653 | - $action=''; |
|
| 1654 | - $reshook = $hookmanager->executeHooks('pdf_getlinetotalwithtax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
| 1651 | + if (!empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); |
|
| 1652 | + $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); |
|
| 1653 | + $action = ''; |
|
| 1654 | + $reshook = $hookmanager->executeHooks('pdf_getlinetotalwithtax', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 1655 | 1655 | |
| 1656 | - if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint; |
|
| 1656 | + if (!empty($hookmanager->resPrint)) return $hookmanager->resPrint; |
|
| 1657 | 1657 | else return $reshook; |
| 1658 | 1658 | } |
| 1659 | 1659 | else |
| 1660 | 1660 | { |
| 1661 | - if (empty($hidedetails) || $hidedetails > 1) return price(($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs); |
|
| 1661 | + if (empty($hidedetails) || $hidedetails > 1) return price(($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht) * ($object->lines[$i]->tva_tx) / 100, 0, $outputlangs); |
|
| 1662 | 1662 | } |
| 1663 | 1663 | } |
| 1664 | 1664 | return ''; |
@@ -1672,33 +1672,33 @@ discard block |
||
| 1672 | 1672 | * @param Translate $outputlangs Object langs for output |
| 1673 | 1673 | * @return integer |
| 1674 | 1674 | */ |
| 1675 | -function pdf_getTotalQty($object,$type,$outputlangs) |
|
| 1675 | +function pdf_getTotalQty($object, $type, $outputlangs) |
|
| 1676 | 1676 | { |
| 1677 | 1677 | global $hookmanager; |
| 1678 | 1678 | |
| 1679 | - $total=0; |
|
| 1680 | - $nblignes=count($object->lines); |
|
| 1679 | + $total = 0; |
|
| 1680 | + $nblignes = count($object->lines); |
|
| 1681 | 1681 | |
| 1682 | 1682 | // Loop on each lines |
| 1683 | - for ($i = 0 ; $i < $nblignes ; $i++) |
|
| 1683 | + for ($i = 0; $i < $nblignes; $i++) |
|
| 1684 | 1684 | { |
| 1685 | 1685 | if ($object->lines[$i]->special_code != 3) |
| 1686 | 1686 | { |
| 1687 | - if ($type=='all') |
|
| 1687 | + if ($type == 'all') |
|
| 1688 | 1688 | { |
| 1689 | 1689 | $total += $object->lines[$i]->qty; |
| 1690 | 1690 | } |
| 1691 | - else if ($type==9 && is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line))) |
|
| 1691 | + else if ($type == 9 && is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || !empty($object->lines[$i]->fk_parent_line))) |
|
| 1692 | 1692 | { |
| 1693 | 1693 | $special_code = $object->lines[$i]->special_code; |
| 1694 | - if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); |
|
| 1694 | + if (!empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); |
|
| 1695 | 1695 | // TODO add hook function |
| 1696 | 1696 | } |
| 1697 | - else if ($type==0 && $object->lines[$i]->product_type == 0) |
|
| 1697 | + else if ($type == 0 && $object->lines[$i]->product_type == 0) |
|
| 1698 | 1698 | { |
| 1699 | 1699 | $total += $object->lines[$i]->qty; |
| 1700 | 1700 | } |
| 1701 | - else if ($type==1 && $object->lines[$i]->product_type == 1) |
|
| 1701 | + else if ($type == 1 && $object->lines[$i]->product_type == 1) |
|
| 1702 | 1702 | { |
| 1703 | 1703 | $total += $object->lines[$i]->qty; |
| 1704 | 1704 | } |
@@ -1715,74 +1715,74 @@ discard block |
||
| 1715 | 1715 | * @param Translate $outputlangs Object lang for output |
| 1716 | 1716 | * @return array Linked objects |
| 1717 | 1717 | */ |
| 1718 | -function pdf_getLinkedObjects($object,$outputlangs) |
|
| 1718 | +function pdf_getLinkedObjects($object, $outputlangs) |
|
| 1719 | 1719 | { |
| 1720 | 1720 | global $hookmanager; |
| 1721 | 1721 | |
| 1722 | - $linkedobjects=array(); |
|
| 1722 | + $linkedobjects = array(); |
|
| 1723 | 1723 | |
| 1724 | 1724 | $object->fetchObjectLinked(); |
| 1725 | 1725 | |
| 1726 | - foreach($object->linkedObjects as $objecttype => $objects) |
|
| 1726 | + foreach ($object->linkedObjects as $objecttype => $objects) |
|
| 1727 | 1727 | { |
| 1728 | 1728 | if ($objecttype == 'propal') |
| 1729 | 1729 | { |
| 1730 | 1730 | $outputlangs->load('propal'); |
| 1731 | 1731 | |
| 1732 | - foreach($objects as $elementobject) |
|
| 1732 | + foreach ($objects as $elementobject) |
|
| 1733 | 1733 | { |
| 1734 | 1734 | $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefProposal"); |
| 1735 | 1735 | $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref); |
| 1736 | 1736 | $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DatePropal"); |
| 1737 | - $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date,'day','',$outputlangs); |
|
| 1737 | + $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date, 'day', '', $outputlangs); |
|
| 1738 | 1738 | } |
| 1739 | 1739 | } |
| 1740 | 1740 | else if ($objecttype == 'commande') |
| 1741 | 1741 | { |
| 1742 | 1742 | $outputlangs->load('orders'); |
| 1743 | - foreach($objects as $elementobject) |
|
| 1743 | + foreach ($objects as $elementobject) |
|
| 1744 | 1744 | { |
| 1745 | 1745 | $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder"); |
| 1746 | - $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref) . ($elementobject->ref_client ? ' ('.$elementobject->ref_client.')' : ''); |
|
| 1746 | + $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref).($elementobject->ref_client ? ' ('.$elementobject->ref_client.')' : ''); |
|
| 1747 | 1747 | $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate"); |
| 1748 | - $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date,'day','',$outputlangs); |
|
| 1748 | + $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date, 'day', '', $outputlangs); |
|
| 1749 | 1749 | } |
| 1750 | 1750 | } |
| 1751 | 1751 | else if ($objecttype == 'contrat') |
| 1752 | 1752 | { |
| 1753 | 1753 | $outputlangs->load('contracts'); |
| 1754 | - foreach($objects as $elementobject) |
|
| 1754 | + foreach ($objects as $elementobject) |
|
| 1755 | 1755 | { |
| 1756 | 1756 | $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefContract"); |
| 1757 | 1757 | $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref); |
| 1758 | 1758 | $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DateContract"); |
| 1759 | - $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date_contrat,'day','',$outputlangs); |
|
| 1759 | + $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date_contrat, 'day', '', $outputlangs); |
|
| 1760 | 1760 | } |
| 1761 | 1761 | } |
| 1762 | 1762 | else if ($objecttype == 'shipping') |
| 1763 | 1763 | { |
| 1764 | 1764 | $outputlangs->load('orders'); |
| 1765 | 1765 | $outputlangs->load('sendings'); |
| 1766 | - foreach($objects as $elementobject) |
|
| 1766 | + foreach ($objects as $elementobject) |
|
| 1767 | 1767 | { |
| 1768 | 1768 | $elementobject->fetchObjectLinked(); |
| 1769 | 1769 | $order = $elementobject->linkedObjects['commande'][0]; |
| 1770 | 1770 | |
| 1771 | - if (! empty($object->linkedObjects['commande'])) // There is already a link to order so we show only info of shipment |
|
| 1771 | + if (!empty($object->linkedObjects['commande'])) // There is already a link to order so we show only info of shipment |
|
| 1772 | 1772 | { |
| 1773 | 1773 | $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefSending"); |
| 1774 | - $linkedobjects[$objecttype]['ref_value'].= $outputlangs->transnoentities($elementobject->ref); |
|
| 1774 | + $linkedobjects[$objecttype]['ref_value'] .= $outputlangs->transnoentities($elementobject->ref); |
|
| 1775 | 1775 | $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DateSending"); |
| 1776 | - $linkedobjects[$objecttype]['date_value'].= dol_print_date($elementobject->date_delivery,'day','',$outputlangs); |
|
| 1776 | + $linkedobjects[$objecttype]['date_value'] .= dol_print_date($elementobject->date_delivery, 'day', '', $outputlangs); |
|
| 1777 | 1777 | } |
| 1778 | 1778 | else // We show both info of order and shipment |
| 1779 | 1779 | { |
| 1780 | - $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder") . ' / ' . $outputlangs->transnoentities("RefSending"); |
|
| 1781 | - $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($order->ref) . ($order->ref_client ? ' ('.$order->ref_client.')' : ''); |
|
| 1782 | - $linkedobjects[$objecttype]['ref_value'].= ' / ' . $outputlangs->transnoentities($elementobject->ref); |
|
| 1783 | - $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate") . ' / ' . $outputlangs->transnoentities("DateSending"); |
|
| 1784 | - $linkedobjects[$objecttype]['date_value'] = dol_print_date($order->date,'day','',$outputlangs); |
|
| 1785 | - $linkedobjects[$objecttype]['date_value'].= ' / ' . dol_print_date($elementobject->date_delivery,'day','',$outputlangs); |
|
| 1780 | + $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder").' / '.$outputlangs->transnoentities("RefSending"); |
|
| 1781 | + $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($order->ref).($order->ref_client ? ' ('.$order->ref_client.')' : ''); |
|
| 1782 | + $linkedobjects[$objecttype]['ref_value'] .= ' / '.$outputlangs->transnoentities($elementobject->ref); |
|
| 1783 | + $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate").' / '.$outputlangs->transnoentities("DateSending"); |
|
| 1784 | + $linkedobjects[$objecttype]['date_value'] = dol_print_date($order->date, 'day', '', $outputlangs); |
|
| 1785 | + $linkedobjects[$objecttype]['date_value'] .= ' / '.dol_print_date($elementobject->date_delivery, 'day', '', $outputlangs); |
|
| 1786 | 1786 | } |
| 1787 | 1787 | } |
| 1788 | 1788 | } |
@@ -1792,9 +1792,9 @@ discard block |
||
| 1792 | 1792 | if (is_object($hookmanager)) |
| 1793 | 1793 | { |
| 1794 | 1794 | $parameters = array('linkedobjects' => $linkedobjects, 'outputlangs'=>$outputlangs); |
| 1795 | - $action=''; |
|
| 1796 | - $hookmanager->executeHooks('pdf_getLinkedObjects',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
| 1797 | - if (! empty($hookmanager->resArray)) $linkedobjects = $hookmanager->resArray; |
|
| 1795 | + $action = ''; |
|
| 1796 | + $hookmanager->executeHooks('pdf_getLinkedObjects', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 1797 | + if (!empty($hookmanager->resArray)) $linkedobjects = $hookmanager->resArray; |
|
| 1798 | 1798 | } |
| 1799 | 1799 | |
| 1800 | 1800 | return $linkedobjects; |
@@ -1811,23 +1811,23 @@ discard block |
||
| 1811 | 1811 | { |
| 1812 | 1812 | global $conf; |
| 1813 | 1813 | |
| 1814 | - $maxwidth=(empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); |
|
| 1815 | - $maxheight=(empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_HEIGHT)?32:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_HEIGHT); |
|
| 1814 | + $maxwidth = (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); |
|
| 1815 | + $maxheight = (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_HEIGHT) ? 32 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_HEIGHT); |
|
| 1816 | 1816 | include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; |
| 1817 | - $tmp=dol_getImageSize($realpath); |
|
| 1817 | + $tmp = dol_getImageSize($realpath); |
|
| 1818 | 1818 | if ($tmp['height']) |
| 1819 | 1819 | { |
| 1820 | - $width=(int) round($maxheight*$tmp['width']/$tmp['height']); // I try to use maxheight |
|
| 1820 | + $width = (int) round($maxheight * $tmp['width'] / $tmp['height']); // I try to use maxheight |
|
| 1821 | 1821 | if ($width > $maxwidth) // Pb with maxheight, so i use maxwidth |
| 1822 | 1822 | { |
| 1823 | - $width=$maxwidth; |
|
| 1824 | - $height=(int) round($maxwidth*$tmp['height']/$tmp['width']); |
|
| 1823 | + $width = $maxwidth; |
|
| 1824 | + $height = (int) round($maxwidth * $tmp['height'] / $tmp['width']); |
|
| 1825 | 1825 | } |
| 1826 | 1826 | else // No pb with maxheight |
| 1827 | 1827 | { |
| 1828 | - $height=$maxheight; |
|
| 1828 | + $height = $maxheight; |
|
| 1829 | 1829 | } |
| 1830 | 1830 | } |
| 1831 | - return array('width'=>$width,'height'=>$height); |
|
| 1831 | + return array('width'=>$width, 'height'=>$height); |
|
| 1832 | 1832 | } |
| 1833 | 1833 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | var $description; |
| 44 | 44 | var $type; |
| 45 | 45 | |
| 46 | - var $phpmin = array(4,3,0); // Minimum version of PHP required by module |
|
| 46 | + var $phpmin = array(4, 3, 0); // Minimum version of PHP required by module |
|
| 47 | 47 | var $version = 'dolibarr'; |
| 48 | 48 | |
| 49 | 49 | var $page_largeur; |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | var $marge_haute; |
| 55 | 55 | var $marge_basse; |
| 56 | 56 | |
| 57 | - var $emetteur; // Objet societe qui emet |
|
| 57 | + var $emetteur; // Objet societe qui emet |
|
| 58 | 58 | |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | function __construct($db) |
| 66 | 66 | { |
| 67 | - global $conf,$langs,$mysoc; |
|
| 67 | + global $conf, $langs, $mysoc; |
|
| 68 | 68 | |
| 69 | 69 | $langs->load("main"); |
| 70 | 70 | $langs->load("bills"); |
@@ -76,56 +76,56 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | // Dimension page pour format A4 |
| 78 | 78 | $this->type = 'pdf'; |
| 79 | - $formatarray=pdf_getFormat(); |
|
| 79 | + $formatarray = pdf_getFormat(); |
|
| 80 | 80 | $this->page_largeur = $formatarray['width']; |
| 81 | 81 | $this->page_hauteur = $formatarray['height']; |
| 82 | - $this->format = array($this->page_largeur,$this->page_hauteur); |
|
| 83 | - $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10; |
|
| 84 | - $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10; |
|
| 85 | - $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10; |
|
| 86 | - $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10; |
|
| 87 | - |
|
| 88 | - $this->option_logo = 1; // Affiche logo |
|
| 89 | - $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION |
|
| 90 | - $this->option_modereg = 1; // Affiche mode reglement |
|
| 91 | - $this->option_condreg = 1; // Affiche conditions reglement |
|
| 92 | - $this->option_codeproduitservice = 1; // Affiche code produit-service |
|
| 93 | - $this->option_multilang = 1; // Dispo en plusieurs langues |
|
| 94 | - $this->option_escompte = 1; // Affiche si il y a eu escompte |
|
| 95 | - $this->option_credit_note = 1; // Support credit notes |
|
| 96 | - $this->option_freetext = 1; // Support add of a personalised text |
|
| 97 | - $this->option_draft_watermark = 1; // Support add of a watermark on drafts |
|
| 98 | - |
|
| 99 | - $this->franchise=!$mysoc->tva_assuj; |
|
| 82 | + $this->format = array($this->page_largeur, $this->page_hauteur); |
|
| 83 | + $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; |
|
| 84 | + $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; |
|
| 85 | + $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; |
|
| 86 | + $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; |
|
| 87 | + |
|
| 88 | + $this->option_logo = 1; // Affiche logo |
|
| 89 | + $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION |
|
| 90 | + $this->option_modereg = 1; // Affiche mode reglement |
|
| 91 | + $this->option_condreg = 1; // Affiche conditions reglement |
|
| 92 | + $this->option_codeproduitservice = 1; // Affiche code produit-service |
|
| 93 | + $this->option_multilang = 1; // Dispo en plusieurs langues |
|
| 94 | + $this->option_escompte = 1; // Affiche si il y a eu escompte |
|
| 95 | + $this->option_credit_note = 1; // Support credit notes |
|
| 96 | + $this->option_freetext = 1; // Support add of a personalised text |
|
| 97 | + $this->option_draft_watermark = 1; // Support add of a watermark on drafts |
|
| 98 | + |
|
| 99 | + $this->franchise = !$mysoc->tva_assuj; |
|
| 100 | 100 | |
| 101 | 101 | // Get source company |
| 102 | - $this->emetteur=$mysoc; |
|
| 103 | - if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if was not defined |
|
| 102 | + $this->emetteur = $mysoc; |
|
| 103 | + if (empty($this->emetteur->country_code)) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined |
|
| 104 | 104 | |
| 105 | 105 | // Define position of columns |
| 106 | - $this->posxdesc=$this->marge_gauche+1; |
|
| 107 | - $this->posxtva=112; |
|
| 108 | - $this->posxup=126; |
|
| 109 | - $this->posxqty=145; |
|
| 110 | - $this->posxdiscount=162; |
|
| 111 | - $this->postotalht=174; |
|
| 112 | - if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup; |
|
| 113 | - $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images |
|
| 106 | + $this->posxdesc = $this->marge_gauche + 1; |
|
| 107 | + $this->posxtva = 112; |
|
| 108 | + $this->posxup = 126; |
|
| 109 | + $this->posxqty = 145; |
|
| 110 | + $this->posxdiscount = 162; |
|
| 111 | + $this->postotalht = 174; |
|
| 112 | + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva = $this->posxup; |
|
| 113 | + $this->posxpicture = $this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images |
|
| 114 | 114 | if ($this->page_largeur < 210) // To work with US executive format |
| 115 | 115 | { |
| 116 | - $this->posxpicture-=20; |
|
| 117 | - $this->posxtva-=20; |
|
| 118 | - $this->posxup-=20; |
|
| 119 | - $this->posxqty-=20; |
|
| 120 | - $this->posxdiscount-=20; |
|
| 121 | - $this->postotalht-=20; |
|
| 116 | + $this->posxpicture -= 20; |
|
| 117 | + $this->posxtva -= 20; |
|
| 118 | + $this->posxup -= 20; |
|
| 119 | + $this->posxqty -= 20; |
|
| 120 | + $this->posxdiscount -= 20; |
|
| 121 | + $this->postotalht -= 20; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - $this->tva=array(); |
|
| 125 | - $this->localtax1=array(); |
|
| 126 | - $this->localtax2=array(); |
|
| 127 | - $this->atleastoneratenotnull=0; |
|
| 128 | - $this->atleastonediscount=0; |
|
| 124 | + $this->tva = array(); |
|
| 125 | + $this->localtax1 = array(); |
|
| 126 | + $this->localtax2 = array(); |
|
| 127 | + $this->atleastoneratenotnull = 0; |
|
| 128 | + $this->atleastonediscount = 0; |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | |
@@ -140,13 +140,13 @@ discard block |
||
| 140 | 140 | * @param int $hideref Do not show ref |
| 141 | 141 | * @return int 1=OK, 0=KO |
| 142 | 142 | */ |
| 143 | - function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) |
|
| 143 | + function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) |
|
| 144 | 144 | { |
| 145 | - global $user,$langs,$conf,$mysoc,$db,$hookmanager; |
|
| 145 | + global $user, $langs, $conf, $mysoc, $db, $hookmanager; |
|
| 146 | 146 | |
| 147 | - if (! is_object($outputlangs)) $outputlangs=$langs; |
|
| 147 | + if (!is_object($outputlangs)) $outputlangs = $langs; |
|
| 148 | 148 | // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO |
| 149 | - if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; |
|
| 149 | + if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1'; |
|
| 150 | 150 | |
| 151 | 151 | $outputlangs->load("main"); |
| 152 | 152 | $outputlangs->load("dict"); |
@@ -157,37 +157,37 @@ discard block |
||
| 157 | 157 | $nblignes = count($object->lines); |
| 158 | 158 | |
| 159 | 159 | // Loop on each lines to detect if there is at least one image to show |
| 160 | - $realpatharray=array(); |
|
| 161 | - if (! empty($conf->global->MAIN_GENERATE_INVOICES_WITH_PICTURE)) |
|
| 160 | + $realpatharray = array(); |
|
| 161 | + if (!empty($conf->global->MAIN_GENERATE_INVOICES_WITH_PICTURE)) |
|
| 162 | 162 | { |
| 163 | - for ($i = 0 ; $i < $nblignes ; $i++) |
|
| 163 | + for ($i = 0; $i < $nblignes; $i++) |
|
| 164 | 164 | { |
| 165 | 165 | if (empty($object->lines[$i]->fk_product)) continue; |
| 166 | 166 | |
| 167 | 167 | $objphoto = new Product($this->db); |
| 168 | 168 | $objphoto->fetch($object->lines[$i]->fk_product); |
| 169 | 169 | |
| 170 | - $pdir = get_exdir($object->lines[$i]->fk_product,2) . $object->lines[$i]->fk_product ."/photos/"; |
|
| 170 | + $pdir = get_exdir($object->lines[$i]->fk_product, 2).$object->lines[$i]->fk_product."/photos/"; |
|
| 171 | 171 | $dir = $conf->product->dir_output.'/'.$pdir; |
| 172 | 172 | |
| 173 | - $realpath=''; |
|
| 174 | - foreach ($objphoto->liste_photos($dir,1) as $key => $obj) |
|
| 173 | + $realpath = ''; |
|
| 174 | + foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) |
|
| 175 | 175 | { |
| 176 | - $filename=$obj['photo']; |
|
| 176 | + $filename = $obj['photo']; |
|
| 177 | 177 | //if ($obj['photo_vignette']) $filename='thumbs/'.$obj['photo_vignette']; |
| 178 | 178 | $realpath = $dir.$filename; |
| 179 | 179 | break; |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - if ($realpath) $realpatharray[$i]=$realpath; |
|
| 182 | + if ($realpath) $realpatharray[$i] = $realpath; |
|
| 183 | 183 | } |
| 184 | 184 | } |
| 185 | - if (count($realpatharray) == 0) $this->posxpicture=$this->posxtva; |
|
| 185 | + if (count($realpatharray) == 0) $this->posxpicture = $this->posxtva; |
|
| 186 | 186 | |
| 187 | 187 | if ($conf->facture->dir_output) |
| 188 | 188 | { |
| 189 | 189 | $object->fetch_thirdparty(); |
| 190 | - if(!empty($object->client) ){ |
|
| 190 | + if (!empty($object->client)) { |
|
| 191 | 191 | $object->thirdparty = $object->client; |
| 192 | 192 | } |
| 193 | 193 | $deja_regle = $object->getSommePaiement(); |
@@ -198,19 +198,19 @@ discard block |
||
| 198 | 198 | if ($object->specimen) |
| 199 | 199 | { |
| 200 | 200 | $dir = $conf->facture->dir_output; |
| 201 | - $file = $dir . "/SPECIMEN.pdf"; |
|
| 201 | + $file = $dir."/SPECIMEN.pdf"; |
|
| 202 | 202 | } |
| 203 | 203 | else |
| 204 | 204 | { |
| 205 | 205 | $objectref = dol_sanitizeFileName($object->ref); |
| 206 | - $dir = $conf->facture->dir_output . "/" . $objectref; |
|
| 207 | - $file = $dir . "/" . $objectref . ".pdf"; |
|
| 206 | + $dir = $conf->facture->dir_output."/".$objectref; |
|
| 207 | + $file = $dir."/".$objectref.".pdf"; |
|
| 208 | 208 | } |
| 209 | - if (! file_exists($dir)) |
|
| 209 | + if (!file_exists($dir)) |
|
| 210 | 210 | { |
| 211 | 211 | if (dol_mkdir($dir) < 0) |
| 212 | 212 | { |
| 213 | - $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); |
|
| 213 | + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); |
|
| 214 | 214 | return 0; |
| 215 | 215 | } |
| 216 | 216 | } |
@@ -218,23 +218,23 @@ discard block |
||
| 218 | 218 | if (file_exists($dir)) |
| 219 | 219 | { |
| 220 | 220 | // Add pdfgeneration hook |
| 221 | - if (! is_object($hookmanager)) |
|
| 221 | + if (!is_object($hookmanager)) |
|
| 222 | 222 | { |
| 223 | 223 | include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
| 224 | - $hookmanager=new HookManager($this->db); |
|
| 224 | + $hookmanager = new HookManager($this->db); |
|
| 225 | 225 | } |
| 226 | 226 | $hookmanager->initHooks(array('pdfgeneration')); |
| 227 | - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); |
|
| 227 | + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); |
|
| 228 | 228 | global $action; |
| 229 | - $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
| 229 | + $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 230 | 230 | |
| 231 | 231 | // Create pdf instance |
| 232 | - $pdf=pdf_getInstance($this->format); |
|
| 233 | - $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
| 234 | - $heightforinfotot = 50; // Height reserved to output the info and total part |
|
| 235 | - $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page |
|
| 236 | - $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
| 237 | - $pdf->SetAutoPageBreak(1,0); |
|
| 232 | + $pdf = pdf_getInstance($this->format); |
|
| 233 | + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
| 234 | + $heightforinfotot = 50; // Height reserved to output the info and total part |
|
| 235 | + $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page |
|
| 236 | + $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
| 237 | + $pdf->SetAutoPageBreak(1, 0); |
|
| 238 | 238 | |
| 239 | 239 | if (class_exists('TCPDF')) |
| 240 | 240 | { |
@@ -244,27 +244,27 @@ discard block |
||
| 244 | 244 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
| 245 | 245 | |
| 246 | 246 | // Set path to the background PDF File |
| 247 | - if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
| 247 | + if (empty($conf->global->MAIN_DISABLE_FPDI) && !empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
| 248 | 248 | { |
| 249 | 249 | $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); |
| 250 | 250 | $tplidx = $pdf->importPage(1); |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | $pdf->Open(); |
| 254 | - $pagenb=0; |
|
| 255 | - $pdf->SetDrawColor(128,128,128); |
|
| 254 | + $pagenb = 0; |
|
| 255 | + $pdf->SetDrawColor(128, 128, 128); |
|
| 256 | 256 | |
| 257 | 257 | $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); |
| 258 | 258 | $pdf->SetSubject($outputlangs->transnoentities("Invoice")); |
| 259 | 259 | $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
| 260 | 260 | $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
| 261 | 261 | $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Invoice")); |
| 262 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 262 | + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 263 | 263 | |
| 264 | - $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
|
| 264 | + $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
|
| 265 | 265 | |
| 266 | 266 | // Positionne $this->atleastonediscount si on a au moins une remise |
| 267 | - for ($i = 0 ; $i < $nblignes ; $i++) |
|
| 267 | + for ($i = 0; $i < $nblignes; $i++) |
|
| 268 | 268 | { |
| 269 | 269 | if ($object->lines[$i]->remise_percent) |
| 270 | 270 | { |
@@ -273,61 +273,61 @@ discard block |
||
| 273 | 273 | } |
| 274 | 274 | if (empty($this->atleastonediscount)) |
| 275 | 275 | { |
| 276 | - $this->posxpicture+=($this->postotalht - $this->posxdiscount); |
|
| 277 | - $this->posxtva+=($this->postotalht - $this->posxdiscount); |
|
| 278 | - $this->posxup+=($this->postotalht - $this->posxdiscount); |
|
| 279 | - $this->posxqty+=($this->postotalht - $this->posxdiscount); |
|
| 280 | - $this->posxdiscount+=($this->postotalht - $this->posxdiscount); |
|
| 276 | + $this->posxpicture += ($this->postotalht - $this->posxdiscount); |
|
| 277 | + $this->posxtva += ($this->postotalht - $this->posxdiscount); |
|
| 278 | + $this->posxup += ($this->postotalht - $this->posxdiscount); |
|
| 279 | + $this->posxqty += ($this->postotalht - $this->posxdiscount); |
|
| 280 | + $this->posxdiscount += ($this->postotalht - $this->posxdiscount); |
|
| 281 | 281 | //$this->postotalht; |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | // New page |
| 285 | 285 | $pdf->AddPage(); |
| 286 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 286 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 287 | 287 | $pagenb++; |
| 288 | 288 | |
| 289 | 289 | $this->_pagehead($pdf, $object, 1, $outputlangs); |
| 290 | - $pdf->SetFont('','', $default_font_size - 1); |
|
| 291 | - $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
| 292 | - $pdf->SetTextColor(0,0,0); |
|
| 290 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 291 | + $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
| 292 | + $pdf->SetTextColor(0, 0, 0); |
|
| 293 | 293 | |
| 294 | 294 | $tab_top = 90; |
| 295 | - $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); |
|
| 295 | + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10); |
|
| 296 | 296 | $tab_height = 130; |
| 297 | 297 | $tab_height_newpage = 150; |
| 298 | 298 | |
| 299 | 299 | // Affiche notes |
| 300 | - $notetoshow=empty($object->note_public)?'':$object->note_public; |
|
| 301 | - if (! empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) |
|
| 300 | + $notetoshow = empty($object->note_public) ? '' : $object->note_public; |
|
| 301 | + if (!empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) |
|
| 302 | 302 | { |
| 303 | 303 | // Get first sale rep |
| 304 | 304 | if (is_object($object->thirdparty)) |
| 305 | 305 | { |
| 306 | - $salereparray=$object->thirdparty->getSalesRepresentatives($user); |
|
| 307 | - $salerepobj=new User($this->db); |
|
| 306 | + $salereparray = $object->thirdparty->getSalesRepresentatives($user); |
|
| 307 | + $salerepobj = new User($this->db); |
|
| 308 | 308 | $salerepobj->fetch($salereparray[0]['id']); |
| 309 | - if (! empty($salerepobj->signature)) $notetoshow=dol_concatdesc($notetoshow, $salerepobj->signature); |
|
| 309 | + if (!empty($salerepobj->signature)) $notetoshow = dol_concatdesc($notetoshow, $salerepobj->signature); |
|
| 310 | 310 | } |
| 311 | 311 | } |
| 312 | 312 | if ($notetoshow) |
| 313 | 313 | { |
| 314 | 314 | $tab_top = 88; |
| 315 | 315 | |
| 316 | - $pdf->SetFont('','', $default_font_size - 1); |
|
| 317 | - $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1); |
|
| 316 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 317 | + $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1); |
|
| 318 | 318 | $nexY = $pdf->GetY(); |
| 319 | - $height_note=$nexY-$tab_top; |
|
| 319 | + $height_note = $nexY - $tab_top; |
|
| 320 | 320 | |
| 321 | 321 | // Rect prend une longueur en 3eme param |
| 322 | - $pdf->SetDrawColor(192,192,192); |
|
| 323 | - $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1); |
|
| 322 | + $pdf->SetDrawColor(192, 192, 192); |
|
| 323 | + $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1); |
|
| 324 | 324 | |
| 325 | 325 | $tab_height = $tab_height - $height_note; |
| 326 | - $tab_top = $nexY+6; |
|
| 326 | + $tab_top = $nexY + 6; |
|
| 327 | 327 | } |
| 328 | 328 | else |
| 329 | 329 | { |
| 330 | - $height_note=0; |
|
| 330 | + $height_note = 0; |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | $iniY = $tab_top + 7; |
@@ -404,91 +404,91 @@ discard block |
||
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | $curY = $nexY; |
| 407 | - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage |
|
| 408 | - $pdf->SetTextColor(0,0,0); |
|
| 407 | + $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage |
|
| 408 | + $pdf->SetTextColor(0, 0, 0); |
|
| 409 | 409 | |
| 410 | 410 | // Define size of image if we need it |
| 411 | - $imglinesize=array(); |
|
| 412 | - if (! empty($realpatharray[$i])) $imglinesize=pdf_getSizeForImage($realpatharray[$i]); |
|
| 411 | + $imglinesize = array(); |
|
| 412 | + if (!empty($realpatharray[$i])) $imglinesize = pdf_getSizeForImage($realpatharray[$i]); |
|
| 413 | 413 | |
| 414 | 414 | $pdf->setTopMargin($tab_top_newpage); |
| 415 | - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
|
| 416 | - $pageposbefore=$pdf->getPage(); |
|
| 415 | + $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
|
| 416 | + $pageposbefore = $pdf->getPage(); |
|
| 417 | 417 | |
| 418 | - $showpricebeforepagebreak=1; |
|
| 419 | - $posYAfterImage=0; |
|
| 420 | - $posYAfterDescription=0; |
|
| 418 | + $showpricebeforepagebreak = 1; |
|
| 419 | + $posYAfterImage = 0; |
|
| 420 | + $posYAfterDescription = 0; |
|
| 421 | 421 | |
| 422 | 422 | // We start with Photo of product line |
| 423 | - if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur-($heightforfooter+$heightforfreetext+$heightforinfotot))) // If photo too high, we moved completely on new page |
|
| 423 | + if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // If photo too high, we moved completely on new page |
|
| 424 | 424 | { |
| 425 | - $pdf->AddPage('','',true); |
|
| 426 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 425 | + $pdf->AddPage('', '', true); |
|
| 426 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 427 | 427 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
| 428 | - $pdf->setPage($pageposbefore+1); |
|
| 428 | + $pdf->setPage($pageposbefore + 1); |
|
| 429 | 429 | |
| 430 | 430 | $curY = $tab_top_newpage; |
| 431 | - $showpricebeforepagebreak=0; |
|
| 431 | + $showpricebeforepagebreak = 0; |
|
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | if (isset($imglinesize['width']) && isset($imglinesize['height'])) |
| 435 | 435 | { |
| 436 | - $curX = $this->posxpicture-1; |
|
| 437 | - $pdf->Image($realpatharray[$i], $curX + (($this->posxtva-$this->posxpicture-$imglinesize['width'])/2), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi |
|
| 436 | + $curX = $this->posxpicture - 1; |
|
| 437 | + $pdf->Image($realpatharray[$i], $curX + (($this->posxtva - $this->posxpicture - $imglinesize['width']) / 2), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi |
|
| 438 | 438 | // $pdf->Image does not increase value return by getY, so we save it manually |
| 439 | - $posYAfterImage=$curY+$imglinesize['height']; |
|
| 439 | + $posYAfterImage = $curY + $imglinesize['height']; |
|
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | // Description of product line |
| 443 | - $curX = $this->posxdesc-1; |
|
| 443 | + $curX = $this->posxdesc - 1; |
|
| 444 | 444 | |
| 445 | 445 | $pdf->startTransaction(); |
| 446 | - pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc); |
|
| 447 | - $pageposafter=$pdf->getPage(); |
|
| 446 | + pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxpicture - $curX, 3, $curX, $curY, $hideref, $hidedesc); |
|
| 447 | + $pageposafter = $pdf->getPage(); |
|
| 448 | 448 | if ($pageposafter > $pageposbefore) // There is a pagebreak |
| 449 | 449 | { |
| 450 | 450 | $pdf->rollbackTransaction(true); |
| 451 | - $pageposafter=$pageposbefore; |
|
| 451 | + $pageposafter = $pageposbefore; |
|
| 452 | 452 | //print $pageposafter.'-'.$pageposbefore;exit; |
| 453 | - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
| 454 | - pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc); |
|
| 455 | - $pageposafter=$pdf->getPage(); |
|
| 456 | - $posyafter=$pdf->GetY(); |
|
| 453 | + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
| 454 | + pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxpicture - $curX, 3, $curX, $curY, $hideref, $hidedesc); |
|
| 455 | + $pageposafter = $pdf->getPage(); |
|
| 456 | + $posyafter = $pdf->GetY(); |
|
| 457 | 457 | //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; |
| 458 | - if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text |
|
| 458 | + if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // There is no space left for total+free text |
|
| 459 | 459 | { |
| 460 | - if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page |
|
| 460 | + if ($i == ($nblignes - 1)) // No more lines, and no space left to show total, so we create a new page |
|
| 461 | 461 | { |
| 462 | - $pdf->AddPage('','',true); |
|
| 463 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 462 | + $pdf->AddPage('', '', true); |
|
| 463 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 464 | 464 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
| 465 | - $pdf->setPage($pageposafter+1); |
|
| 465 | + $pdf->setPage($pageposafter + 1); |
|
| 466 | 466 | } |
| 467 | 467 | } |
| 468 | 468 | else |
| 469 | 469 | { |
| 470 | 470 | // We found a page break |
| 471 | - $showpricebeforepagebreak=0; |
|
| 471 | + $showpricebeforepagebreak = 0; |
|
| 472 | 472 | } |
| 473 | 473 | } |
| 474 | 474 | else // No pagebreak |
| 475 | 475 | { |
| 476 | 476 | $pdf->commitTransaction(); |
| 477 | 477 | } |
| 478 | - $posYAfterDescription=$pdf->GetY(); |
|
| 478 | + $posYAfterDescription = $pdf->GetY(); |
|
| 479 | 479 | |
| 480 | 480 | $nexY = $pdf->GetY(); |
| 481 | - $pageposafter=$pdf->getPage(); |
|
| 481 | + $pageposafter = $pdf->getPage(); |
|
| 482 | 482 | $pdf->setPage($pageposbefore); |
| 483 | 483 | $pdf->setTopMargin($this->marge_haute); |
| 484 | - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
| 484 | + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
| 485 | 485 | |
| 486 | 486 | // We suppose that a too long description or photo were moved completely on next page |
| 487 | 487 | if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { |
| 488 | 488 | $pdf->setPage($pageposafter); $curY = $tab_top_newpage; |
| 489 | 489 | } |
| 490 | 490 | |
| 491 | - $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut |
|
| 491 | + $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut |
|
| 492 | 492 | |
| 493 | 493 | // VAT Rate |
| 494 | 494 | if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) |
@@ -501,7 +501,7 @@ discard block |
||
| 501 | 501 | } |
| 502 | 502 | |
| 503 | 503 | $pdf->SetXY($this->posxtva, $curY); |
| 504 | - $pdf->MultiCell($this->posxup-$this->posxtva-0.8, 3, $vat_rate, 0, 'R'); |
|
| 504 | + $pdf->MultiCell($this->posxup - $this->posxtva - 0.8, 3, $vat_rate, 0, 'R'); |
|
| 505 | 505 | } |
| 506 | 506 | |
| 507 | 507 | // Unit price before discount |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | } |
| 513 | 513 | |
| 514 | 514 | $pdf->SetXY($this->posxup, $curY); |
| 515 | - $pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, $up_excl_tax, 0, 'R', 0); |
|
| 515 | + $pdf->MultiCell($this->posxqty - $this->posxup - 0.8, 3, $up_excl_tax, 0, 'R', 0); |
|
| 516 | 516 | |
| 517 | 517 | // Quantity |
| 518 | 518 | // Affichage de la quantité sur les lignes de total si la conf l'indique |
@@ -533,14 +533,14 @@ discard block |
||
| 533 | 533 | } |
| 534 | 534 | |
| 535 | 535 | $pdf->SetXY($this->posxqty, $curY); |
| 536 | - $pdf->MultiCell($this->posxdiscount-$this->posxqty-0.8, 3, $qty, 0, 'R'); // Enough for 6 chars |
|
| 536 | + $pdf->MultiCell($this->posxdiscount - $this->posxqty - 0.8, 3, $qty, 0, 'R'); // Enough for 6 chars |
|
| 537 | 537 | |
| 538 | 538 | // Discount on line |
| 539 | 539 | if ($object->lines[$i]->remise_percent) |
| 540 | 540 | { |
| 541 | - $pdf->SetXY($this->posxdiscount-2, $curY); |
|
| 541 | + $pdf->SetXY($this->posxdiscount - 2, $curY); |
|
| 542 | 542 | $remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails); |
| 543 | - $pdf->MultiCell($this->postotalht-$this->posxdiscount+2, 3, $remise_percent, 0, 'R'); |
|
| 543 | + $pdf->MultiCell($this->postotalht - $this->posxdiscount + 2, 3, $remise_percent, 0, 'R'); |
|
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | // Total HT line |
@@ -551,40 +551,40 @@ discard block |
||
| 551 | 551 | } |
| 552 | 552 | |
| 553 | 553 | $pdf->SetXY($this->postotalht, $curY); |
| 554 | - $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0); |
|
| 554 | + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, $total_excl_tax, 0, 'R', 0); |
|
| 555 | 555 | |
| 556 | 556 | // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva |
| 557 | - $tvaligne=$object->lines[$i]->total_tva; |
|
| 558 | - $localtax1ligne=$object->lines[$i]->total_localtax1; |
|
| 559 | - $localtax2ligne=$object->lines[$i]->total_localtax2; |
|
| 560 | - $localtax1_rate=$object->lines[$i]->localtax1_tx; |
|
| 561 | - $localtax2_rate=$object->lines[$i]->localtax2_tx; |
|
| 562 | - $localtax1_type=$object->lines[$i]->localtax1_type; |
|
| 563 | - $localtax2_type=$object->lines[$i]->localtax2_type; |
|
| 557 | + $tvaligne = $object->lines[$i]->total_tva; |
|
| 558 | + $localtax1ligne = $object->lines[$i]->total_localtax1; |
|
| 559 | + $localtax2ligne = $object->lines[$i]->total_localtax2; |
|
| 560 | + $localtax1_rate = $object->lines[$i]->localtax1_tx; |
|
| 561 | + $localtax2_rate = $object->lines[$i]->localtax2_tx; |
|
| 562 | + $localtax1_type = $object->lines[$i]->localtax1_type; |
|
| 563 | + $localtax2_type = $object->lines[$i]->localtax2_type; |
|
| 564 | 564 | |
| 565 | - if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100; |
|
| 566 | - if ($object->remise_percent) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100; |
|
| 567 | - if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100; |
|
| 565 | + if ($object->remise_percent) $tvaligne -= ($tvaligne * $object->remise_percent) / 100; |
|
| 566 | + if ($object->remise_percent) $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100; |
|
| 567 | + if ($object->remise_percent) $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100; |
|
| 568 | 568 | |
| 569 | - $vatrate=(string) $object->lines[$i]->tva_tx; |
|
| 569 | + $vatrate = (string) $object->lines[$i]->tva_tx; |
|
| 570 | 570 | |
| 571 | 571 | // Retrieve type from database for backward compatibility with old records |
| 572 | - if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined |
|
| 573 | - && (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax |
|
| 572 | + if ((!isset($localtax1_type) || $localtax1_type == '' || !isset($localtax2_type) || $localtax2_type == '') // if tax type not defined |
|
| 573 | + && (!empty($localtax1_rate) || !empty($localtax2_rate))) // and there is local tax |
|
| 574 | 574 | { |
| 575 | - $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0, $object->thirdparty, $mysoc); |
|
| 575 | + $localtaxtmp_array = getLocalTaxesFromRate($vatrate, 0, $object->thirdparty, $mysoc); |
|
| 576 | 576 | $localtax1_type = $localtaxtmp_array[0]; |
| 577 | 577 | $localtax2_type = $localtaxtmp_array[2]; |
| 578 | 578 | } |
| 579 | 579 | |
| 580 | 580 | // retrieve global local tax |
| 581 | 581 | if ($localtax1_type && $localtax1ligne != 0) |
| 582 | - $this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne; |
|
| 582 | + $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne; |
|
| 583 | 583 | if ($localtax2_type && $localtax2ligne != 0) |
| 584 | - $this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne; |
|
| 584 | + $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne; |
|
| 585 | 585 | |
| 586 | - if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*'; |
|
| 587 | - if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=''; |
|
| 586 | + if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate .= '*'; |
|
| 587 | + if (!isset($this->tva[$vatrate])) $this->tva[$vatrate] = ''; |
|
| 588 | 588 | |
| 589 | 589 | if (!empty($object->lines[$i]->TTotal_tva)) |
| 590 | 590 | { |
@@ -598,19 +598,19 @@ discard block |
||
| 598 | 598 | $this->tva[$vatrate] += $tvaligne; |
| 599 | 599 | } |
| 600 | 600 | |
| 601 | - if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage; |
|
| 601 | + if ($posYAfterImage > $posYAfterDescription) $nexY = $posYAfterImage; |
|
| 602 | 602 | |
| 603 | 603 | // Add line |
| 604 | - if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) |
|
| 604 | + if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) |
|
| 605 | 605 | { |
| 606 | 606 | $pdf->setPage($pageposafter); |
| 607 | - $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210))); |
|
| 607 | + $pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(210, 210, 210))); |
|
| 608 | 608 | //$pdf->SetDrawColor(190,190,200); |
| 609 | - $pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1); |
|
| 609 | + $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1); |
|
| 610 | 610 | $pdf->SetLineStyle(array('dash'=>0)); |
| 611 | 611 | } |
| 612 | 612 | |
| 613 | - $nexY+=2; // Passe espace entre les lignes |
|
| 613 | + $nexY += 2; // Passe espace entre les lignes |
|
| 614 | 614 | |
| 615 | 615 | // Detect if some page were added automatically and output _tableau for past pages |
| 616 | 616 | while ($pagenb < $pageposafter) |
@@ -624,13 +624,13 @@ discard block |
||
| 624 | 624 | { |
| 625 | 625 | $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); |
| 626 | 626 | } |
| 627 | - $this->_pagefoot($pdf,$object,$outputlangs,1); |
|
| 627 | + $this->_pagefoot($pdf, $object, $outputlangs, 1); |
|
| 628 | 628 | $pagenb++; |
| 629 | 629 | $pdf->setPage($pagenb); |
| 630 | - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
| 630 | + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
| 631 | 631 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
| 632 | 632 | } |
| 633 | - if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) |
|
| 633 | + if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) |
|
| 634 | 634 | { |
| 635 | 635 | if ($pagenb == 1) |
| 636 | 636 | { |
@@ -640,10 +640,10 @@ discard block |
||
| 640 | 640 | { |
| 641 | 641 | $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); |
| 642 | 642 | } |
| 643 | - $this->_pagefoot($pdf,$object,$outputlangs,1); |
|
| 643 | + $this->_pagefoot($pdf, $object, $outputlangs, 1); |
|
| 644 | 644 | // New page |
| 645 | 645 | $pdf->AddPage(); |
| 646 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 646 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 647 | 647 | $pagenb++; |
| 648 | 648 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
| 649 | 649 | } |
@@ -653,60 +653,60 @@ discard block |
||
| 653 | 653 | if ($pagenb == 1) |
| 654 | 654 | { |
| 655 | 655 | $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); |
| 656 | - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
|
| 656 | + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
|
| 657 | 657 | } |
| 658 | 658 | else |
| 659 | 659 | { |
| 660 | 660 | $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); |
| 661 | - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
|
| 661 | + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
|
| 662 | 662 | } |
| 663 | 663 | |
| 664 | 664 | // Affiche zone infos |
| 665 | - $posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs); |
|
| 665 | + $posy = $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs); |
|
| 666 | 666 | |
| 667 | 667 | if (!$conf->global->SUBTOTAL_HIDE_DOCUMENT_TOTAL) { |
| 668 | 668 | // Affiche zone totaux |
| 669 | - $posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); |
|
| 669 | + $posy = $this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); |
|
| 670 | 670 | } |
| 671 | 671 | |
| 672 | 672 | // Affiche zone versements |
| 673 | 673 | if ($deja_regle || $amount_credit_notes_included || $amount_deposits_included) |
| 674 | 674 | { |
| 675 | - $posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs); |
|
| 675 | + $posy = $this->_tableau_versements($pdf, $object, $posy, $outputlangs); |
|
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | // Pied de page |
| 679 | - $this->_pagefoot($pdf,$object,$outputlangs); |
|
| 680 | - if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); |
|
| 679 | + $this->_pagefoot($pdf, $object, $outputlangs); |
|
| 680 | + if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); |
|
| 681 | 681 | |
| 682 | 682 | $pdf->Close(); |
| 683 | 683 | |
| 684 | - $pdf->Output($file,'F'); |
|
| 684 | + $pdf->Output($file, 'F'); |
|
| 685 | 685 | |
| 686 | 686 | // Add pdfgeneration hook |
| 687 | 687 | $hookmanager->initHooks(array('pdfgeneration')); |
| 688 | - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); |
|
| 688 | + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); |
|
| 689 | 689 | global $action; |
| 690 | - $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
|
| 690 | + $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
| 691 | 691 | |
| 692 | - if (! empty($conf->global->MAIN_UMASK)) |
|
| 692 | + if (!empty($conf->global->MAIN_UMASK)) |
|
| 693 | 693 | @chmod($file, octdec($conf->global->MAIN_UMASK)); |
| 694 | 694 | |
| 695 | - return 1; // Pas d'erreur |
|
| 695 | + return 1; // Pas d'erreur |
|
| 696 | 696 | } |
| 697 | 697 | else |
| 698 | 698 | { |
| 699 | - $this->error=$langs->trans("ErrorCanNotCreateDir",$dir); |
|
| 699 | + $this->error = $langs->trans("ErrorCanNotCreateDir", $dir); |
|
| 700 | 700 | return 0; |
| 701 | 701 | } |
| 702 | 702 | } |
| 703 | 703 | else |
| 704 | 704 | { |
| 705 | - $this->error=$langs->trans("ErrorConstantNotDefined","FAC_OUTPUTDIR"); |
|
| 705 | + $this->error = $langs->trans("ErrorConstantNotDefined", "FAC_OUTPUTDIR"); |
|
| 706 | 706 | return 0; |
| 707 | 707 | } |
| 708 | - $this->error=$langs->trans("ErrorUnknown"); |
|
| 709 | - return 0; // Erreur par defaut |
|
| 708 | + $this->error = $langs->trans("ErrorUnknown"); |
|
| 709 | + return 0; // Erreur par defaut |
|
| 710 | 710 | } |
| 711 | 711 | |
| 712 | 712 | |
@@ -723,8 +723,8 @@ discard block |
||
| 723 | 723 | { |
| 724 | 724 | global $conf; |
| 725 | 725 | |
| 726 | - $sign=1; |
|
| 727 | - if ($object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; |
|
| 726 | + $sign = 1; |
|
| 727 | + if ($object->type == 2 && !empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign = -1; |
|
| 728 | 728 | |
| 729 | 729 | $tab3_posx = 120; |
| 730 | 730 | $tab3_top = $posy + 8; |
@@ -737,109 +737,109 @@ discard block |
||
| 737 | 737 | |
| 738 | 738 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
| 739 | 739 | |
| 740 | - $title=$outputlangs->transnoentities("PaymentsAlreadyDone"); |
|
| 741 | - if ($object->type == 2) $title=$outputlangs->transnoentities("PaymentsBackAlreadyDone"); |
|
| 740 | + $title = $outputlangs->transnoentities("PaymentsAlreadyDone"); |
|
| 741 | + if ($object->type == 2) $title = $outputlangs->transnoentities("PaymentsBackAlreadyDone"); |
|
| 742 | 742 | |
| 743 | - $pdf->SetFont('','', $default_font_size - 3); |
|
| 743 | + $pdf->SetFont('', '', $default_font_size - 3); |
|
| 744 | 744 | $pdf->SetXY($tab3_posx, $tab3_top - 4); |
| 745 | 745 | $pdf->MultiCell(60, 3, $title, 0, 'L', 0); |
| 746 | 746 | |
| 747 | - $pdf->line($tab3_posx, $tab3_top, $tab3_posx+$tab3_width, $tab3_top); |
|
| 747 | + $pdf->line($tab3_posx, $tab3_top, $tab3_posx + $tab3_width, $tab3_top); |
|
| 748 | 748 | |
| 749 | - $pdf->SetFont('','', $default_font_size - 4); |
|
| 749 | + $pdf->SetFont('', '', $default_font_size - 4); |
|
| 750 | 750 | $pdf->SetXY($tab3_posx, $tab3_top); |
| 751 | 751 | $pdf->MultiCell(20, 3, $outputlangs->transnoentities("Payment"), 0, 'L', 0); |
| 752 | - $pdf->SetXY($tab3_posx+21, $tab3_top); |
|
| 752 | + $pdf->SetXY($tab3_posx + 21, $tab3_top); |
|
| 753 | 753 | $pdf->MultiCell(20, 3, $outputlangs->transnoentities("Amount"), 0, 'L', 0); |
| 754 | - $pdf->SetXY($tab3_posx+40, $tab3_top); |
|
| 754 | + $pdf->SetXY($tab3_posx + 40, $tab3_top); |
|
| 755 | 755 | $pdf->MultiCell(20, 3, $outputlangs->transnoentities("Type"), 0, 'L', 0); |
| 756 | - $pdf->SetXY($tab3_posx+58, $tab3_top); |
|
| 756 | + $pdf->SetXY($tab3_posx + 58, $tab3_top); |
|
| 757 | 757 | $pdf->MultiCell(20, 3, $outputlangs->transnoentities("Num"), 0, 'L', 0); |
| 758 | 758 | |
| 759 | - $pdf->line($tab3_posx, $tab3_top-1+$tab3_height, $tab3_posx+$tab3_width, $tab3_top-1+$tab3_height); |
|
| 759 | + $pdf->line($tab3_posx, $tab3_top - 1 + $tab3_height, $tab3_posx + $tab3_width, $tab3_top - 1 + $tab3_height); |
|
| 760 | 760 | |
| 761 | - $y=0; |
|
| 761 | + $y = 0; |
|
| 762 | 762 | |
| 763 | - $pdf->SetFont('','', $default_font_size - 4); |
|
| 763 | + $pdf->SetFont('', '', $default_font_size - 4); |
|
| 764 | 764 | |
| 765 | 765 | // Loop on each deposits and credit notes included |
| 766 | 766 | $sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,"; |
| 767 | - $sql.= " re.description, re.fk_facture_source,"; |
|
| 768 | - $sql.= " f.type, f.datef"; |
|
| 769 | - $sql.= " FROM ".MAIN_DB_PREFIX ."societe_remise_except as re, ".MAIN_DB_PREFIX ."facture as f"; |
|
| 770 | - $sql.= " WHERE re.fk_facture_source = f.rowid AND re.fk_facture = ".$object->id; |
|
| 771 | - $resql=$this->db->query($sql); |
|
| 767 | + $sql .= " re.description, re.fk_facture_source,"; |
|
| 768 | + $sql .= " f.type, f.datef"; |
|
| 769 | + $sql .= " FROM ".MAIN_DB_PREFIX."societe_remise_except as re, ".MAIN_DB_PREFIX."facture as f"; |
|
| 770 | + $sql .= " WHERE re.fk_facture_source = f.rowid AND re.fk_facture = ".$object->id; |
|
| 771 | + $resql = $this->db->query($sql); |
|
| 772 | 772 | if ($resql) |
| 773 | 773 | { |
| 774 | 774 | $num = $this->db->num_rows($resql); |
| 775 | - $i=0; |
|
| 776 | - $invoice=new Facture($this->db); |
|
| 775 | + $i = 0; |
|
| 776 | + $invoice = new Facture($this->db); |
|
| 777 | 777 | while ($i < $num) |
| 778 | 778 | { |
| 779 | - $y+=3; |
|
| 779 | + $y += 3; |
|
| 780 | 780 | $obj = $this->db->fetch_object($resql); |
| 781 | 781 | |
| 782 | - if ($obj->type == 2) $text=$outputlangs->trans("CreditNote"); |
|
| 783 | - elseif ($obj->type == 3) $text=$outputlangs->trans("Deposit"); |
|
| 784 | - else $text=$outputlangs->trans("UnknownType"); |
|
| 782 | + if ($obj->type == 2) $text = $outputlangs->trans("CreditNote"); |
|
| 783 | + elseif ($obj->type == 3) $text = $outputlangs->trans("Deposit"); |
|
| 784 | + else $text = $outputlangs->trans("UnknownType"); |
|
| 785 | 785 | |
| 786 | 786 | $invoice->fetch($obj->fk_facture_source); |
| 787 | 787 | |
| 788 | - $pdf->SetXY($tab3_posx, $tab3_top+$y); |
|
| 789 | - $pdf->MultiCell(20, 3, dol_print_date($obj->datef,'day',false,$outputlangs,true), 0, 'L', 0); |
|
| 790 | - $pdf->SetXY($tab3_posx+21, $tab3_top+$y); |
|
| 788 | + $pdf->SetXY($tab3_posx, $tab3_top + $y); |
|
| 789 | + $pdf->MultiCell(20, 3, dol_print_date($obj->datef, 'day', false, $outputlangs, true), 0, 'L', 0); |
|
| 790 | + $pdf->SetXY($tab3_posx + 21, $tab3_top + $y); |
|
| 791 | 791 | $pdf->MultiCell(20, 3, price($obj->amount_ttc, 0, $outputlangs), 0, 'L', 0); |
| 792 | - $pdf->SetXY($tab3_posx+40, $tab3_top+$y); |
|
| 792 | + $pdf->SetXY($tab3_posx + 40, $tab3_top + $y); |
|
| 793 | 793 | $pdf->MultiCell(20, 3, $text, 0, 'L', 0); |
| 794 | - $pdf->SetXY($tab3_posx+58, $tab3_top+$y); |
|
| 794 | + $pdf->SetXY($tab3_posx + 58, $tab3_top + $y); |
|
| 795 | 795 | $pdf->MultiCell(20, 3, $invoice->ref, 0, 'L', 0); |
| 796 | 796 | |
| 797 | - $pdf->line($tab3_posx, $tab3_top+$y+3, $tab3_posx+$tab3_width, $tab3_top+$y+3); |
|
| 797 | + $pdf->line($tab3_posx, $tab3_top + $y + 3, $tab3_posx + $tab3_width, $tab3_top + $y + 3); |
|
| 798 | 798 | |
| 799 | 799 | $i++; |
| 800 | 800 | } |
| 801 | 801 | } |
| 802 | 802 | else |
| 803 | 803 | { |
| 804 | - $this->error=$this->db->lasterror(); |
|
| 804 | + $this->error = $this->db->lasterror(); |
|
| 805 | 805 | return -1; |
| 806 | 806 | } |
| 807 | 807 | |
| 808 | 808 | // Loop on each payment |
| 809 | 809 | $sql = "SELECT p.datep as date, p.fk_paiement as type, p.num_paiement as num, pf.amount as amount,"; |
| 810 | - $sql.= " cp.code"; |
|
| 811 | - $sql.= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p"; |
|
| 812 | - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id"; |
|
| 813 | - $sql.= " WHERE pf.fk_paiement = p.rowid AND pf.fk_facture = ".$object->id; |
|
| 814 | - $sql.= " ORDER BY p.datep"; |
|
| 815 | - $resql=$this->db->query($sql); |
|
| 810 | + $sql .= " cp.code"; |
|
| 811 | + $sql .= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p"; |
|
| 812 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id"; |
|
| 813 | + $sql .= " WHERE pf.fk_paiement = p.rowid AND pf.fk_facture = ".$object->id; |
|
| 814 | + $sql .= " ORDER BY p.datep"; |
|
| 815 | + $resql = $this->db->query($sql); |
|
| 816 | 816 | if ($resql) |
| 817 | 817 | { |
| 818 | 818 | $num = $this->db->num_rows($resql); |
| 819 | - $i=0; |
|
| 819 | + $i = 0; |
|
| 820 | 820 | while ($i < $num) { |
| 821 | - $y+=3; |
|
| 821 | + $y += 3; |
|
| 822 | 822 | $row = $this->db->fetch_object($resql); |
| 823 | 823 | |
| 824 | - $pdf->SetXY($tab3_posx, $tab3_top+$y); |
|
| 825 | - $pdf->MultiCell(20, 3, dol_print_date($this->db->jdate($row->date),'day',false,$outputlangs,true), 0, 'L', 0); |
|
| 826 | - $pdf->SetXY($tab3_posx+21, $tab3_top+$y); |
|
| 824 | + $pdf->SetXY($tab3_posx, $tab3_top + $y); |
|
| 825 | + $pdf->MultiCell(20, 3, dol_print_date($this->db->jdate($row->date), 'day', false, $outputlangs, true), 0, 'L', 0); |
|
| 826 | + $pdf->SetXY($tab3_posx + 21, $tab3_top + $y); |
|
| 827 | 827 | $pdf->MultiCell(20, 3, price($sign * $row->amount, 0, $outputlangs), 0, 'L', 0); |
| 828 | - $pdf->SetXY($tab3_posx+40, $tab3_top+$y); |
|
| 829 | - $oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort" . $row->code); |
|
| 828 | + $pdf->SetXY($tab3_posx + 40, $tab3_top + $y); |
|
| 829 | + $oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort".$row->code); |
|
| 830 | 830 | |
| 831 | 831 | $pdf->MultiCell(20, 3, $oper, 0, 'L', 0); |
| 832 | - $pdf->SetXY($tab3_posx+58, $tab3_top+$y); |
|
| 832 | + $pdf->SetXY($tab3_posx + 58, $tab3_top + $y); |
|
| 833 | 833 | $pdf->MultiCell(30, 3, $row->num, 0, 'L', 0); |
| 834 | 834 | |
| 835 | - $pdf->line($tab3_posx, $tab3_top+$y+3, $tab3_posx+$tab3_width, $tab3_top+$y+3); |
|
| 835 | + $pdf->line($tab3_posx, $tab3_top + $y + 3, $tab3_posx + $tab3_width, $tab3_top + $y + 3); |
|
| 836 | 836 | |
| 837 | 837 | $i++; |
| 838 | 838 | } |
| 839 | 839 | } |
| 840 | 840 | else |
| 841 | 841 | { |
| 842 | - $this->error=$this->db->lasterror(); |
|
| 842 | + $this->error = $this->db->lasterror(); |
|
| 843 | 843 | return -1; |
| 844 | 844 | } |
| 845 | 845 | |
@@ -861,35 +861,35 @@ discard block |
||
| 861 | 861 | |
| 862 | 862 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
| 863 | 863 | |
| 864 | - $pdf->SetFont('','', $default_font_size - 1); |
|
| 864 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 865 | 865 | |
| 866 | 866 | // If France, show VAT mention if not applicable |
| 867 | 867 | if ($this->emetteur->country_code == 'FR' && $this->franchise == 1) |
| 868 | 868 | { |
| 869 | - $pdf->SetFont('','B', $default_font_size - 2); |
|
| 869 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
| 870 | 870 | $pdf->SetXY($this->marge_gauche, $posy); |
| 871 | 871 | $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); |
| 872 | 872 | |
| 873 | - $posy=$pdf->GetY()+4; |
|
| 873 | + $posy = $pdf->GetY() + 4; |
|
| 874 | 874 | } |
| 875 | 875 | |
| 876 | - $posxval=52; |
|
| 876 | + $posxval = 52; |
|
| 877 | 877 | |
| 878 | 878 | // Show payments conditions |
| 879 | 879 | if ($object->type != 2 && ($object->cond_reglement_code || $object->cond_reglement)) |
| 880 | 880 | { |
| 881 | - $pdf->SetFont('','B', $default_font_size - 2); |
|
| 881 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
| 882 | 882 | $pdf->SetXY($this->marge_gauche, $posy); |
| 883 | 883 | $titre = $outputlangs->transnoentities("PaymentConditions").':'; |
| 884 | 884 | $pdf->MultiCell(80, 4, $titre, 0, 'L'); |
| 885 | 885 | |
| 886 | - $pdf->SetFont('','', $default_font_size - 2); |
|
| 886 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
| 887 | 887 | $pdf->SetXY($posxval, $posy); |
| 888 | - $lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement_doc); |
|
| 889 | - $lib_condition_paiement=str_replace('\n',"\n",$lib_condition_paiement); |
|
| 890 | - $pdf->MultiCell(80, 4, $lib_condition_paiement,0,'L'); |
|
| 888 | + $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc); |
|
| 889 | + $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement); |
|
| 890 | + $pdf->MultiCell(80, 4, $lib_condition_paiement, 0, 'L'); |
|
| 891 | 891 | |
| 892 | - $posy=$pdf->GetY()+3; |
|
| 892 | + $posy = $pdf->GetY() + 3; |
|
| 893 | 893 | } |
| 894 | 894 | |
| 895 | 895 | if ($object->type != 2) |
@@ -908,13 +908,13 @@ discard block |
||
| 908 | 908 | $outputlangs->load("errors"); |
| 909 | 909 | |
| 910 | 910 | $pdf->SetXY($this->marge_gauche, $posy); |
| 911 | - $pdf->SetTextColor(200,0,0); |
|
| 912 | - $pdf->SetFont('','B', $default_font_size - 2); |
|
| 913 | - $this->error = $outputlangs->transnoentities("ErrorPaymentModeDefinedToWithoutSetup",$object->mode_reglement_code); |
|
| 914 | - $pdf->MultiCell(80, 3, $this->error,0,'L',0); |
|
| 915 | - $pdf->SetTextColor(0,0,0); |
|
| 911 | + $pdf->SetTextColor(200, 0, 0); |
|
| 912 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
| 913 | + $this->error = $outputlangs->transnoentities("ErrorPaymentModeDefinedToWithoutSetup", $object->mode_reglement_code); |
|
| 914 | + $pdf->MultiCell(80, 3, $this->error, 0, 'L', 0); |
|
| 915 | + $pdf->SetTextColor(0, 0, 0); |
|
| 916 | 916 | |
| 917 | - $posy=$pdf->GetY()+1; |
|
| 917 | + $posy = $pdf->GetY() + 1; |
|
| 918 | 918 | } |
| 919 | 919 | |
| 920 | 920 | // Show payment mode |
@@ -922,26 +922,26 @@ discard block |
||
| 922 | 922 | && $object->mode_reglement_code != 'CHQ' |
| 923 | 923 | && $object->mode_reglement_code != 'VIR') |
| 924 | 924 | { |
| 925 | - $pdf->SetFont('','B', $default_font_size - 2); |
|
| 925 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
| 926 | 926 | $pdf->SetXY($this->marge_gauche, $posy); |
| 927 | 927 | $titre = $outputlangs->transnoentities("PaymentMode").':'; |
| 928 | 928 | $pdf->MultiCell(80, 5, $titre, 0, 'L'); |
| 929 | 929 | |
| 930 | - $pdf->SetFont('','', $default_font_size - 2); |
|
| 930 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
| 931 | 931 | $pdf->SetXY($posxval, $posy); |
| 932 | - $lib_mode_reg=$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code)!=('PaymentType'.$object->mode_reglement_code)?$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code):$outputlangs->convToOutputCharset($object->mode_reglement); |
|
| 933 | - $pdf->MultiCell(80, 5, $lib_mode_reg,0,'L'); |
|
| 932 | + $lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement); |
|
| 933 | + $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L'); |
|
| 934 | 934 | |
| 935 | - $posy=$pdf->GetY()+2; |
|
| 935 | + $posy = $pdf->GetY() + 2; |
|
| 936 | 936 | } |
| 937 | 937 | |
| 938 | 938 | // Show payment mode CHQ |
| 939 | 939 | if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') |
| 940 | 940 | { |
| 941 | 941 | // Si mode reglement non force ou si force a CHQ |
| 942 | - if (! empty($conf->global->FACTURE_CHQ_NUMBER)) |
|
| 942 | + if (!empty($conf->global->FACTURE_CHQ_NUMBER)) |
|
| 943 | 943 | { |
| 944 | - $diffsizetitle=(empty($conf->global->PDF_DIFFSIZE_TITLE)?3:$conf->global->PDF_DIFFSIZE_TITLE); |
|
| 944 | + $diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE); |
|
| 945 | 945 | |
| 946 | 946 | if ($conf->global->FACTURE_CHQ_NUMBER > 0) |
| 947 | 947 | { |
@@ -949,31 +949,31 @@ discard block |
||
| 949 | 949 | $account->fetch($conf->global->FACTURE_CHQ_NUMBER); |
| 950 | 950 | |
| 951 | 951 | $pdf->SetXY($this->marge_gauche, $posy); |
| 952 | - $pdf->SetFont('','B', $default_font_size - $diffsizetitle); |
|
| 953 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$account->proprio),0,'L',0); |
|
| 954 | - $posy=$pdf->GetY()+1; |
|
| 952 | + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); |
|
| 953 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $account->proprio), 0, 'L', 0); |
|
| 954 | + $posy = $pdf->GetY() + 1; |
|
| 955 | 955 | |
| 956 | 956 | if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) |
| 957 | 957 | { |
| 958 | 958 | $pdf->SetXY($this->marge_gauche, $posy); |
| 959 | - $pdf->SetFont('','', $default_font_size - $diffsizetitle); |
|
| 959 | + $pdf->SetFont('', '', $default_font_size - $diffsizetitle); |
|
| 960 | 960 | $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0); |
| 961 | - $posy=$pdf->GetY()+2; |
|
| 961 | + $posy = $pdf->GetY() + 2; |
|
| 962 | 962 | } |
| 963 | 963 | } |
| 964 | 964 | if ($conf->global->FACTURE_CHQ_NUMBER == -1) |
| 965 | 965 | { |
| 966 | 966 | $pdf->SetXY($this->marge_gauche, $posy); |
| 967 | - $pdf->SetFont('','B', $default_font_size - $diffsizetitle); |
|
| 968 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$this->emetteur->name),0,'L',0); |
|
| 969 | - $posy=$pdf->GetY()+1; |
|
| 967 | + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); |
|
| 968 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $this->emetteur->name), 0, 'L', 0); |
|
| 969 | + $posy = $pdf->GetY() + 1; |
|
| 970 | 970 | |
| 971 | 971 | if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) |
| 972 | 972 | { |
| 973 | 973 | $pdf->SetXY($this->marge_gauche, $posy); |
| 974 | - $pdf->SetFont('','', $default_font_size - $diffsizetitle); |
|
| 974 | + $pdf->SetFont('', '', $default_font_size - $diffsizetitle); |
|
| 975 | 975 | $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0); |
| 976 | - $posy=$pdf->GetY()+2; |
|
| 976 | + $posy = $pdf->GetY() + 2; |
|
| 977 | 977 | } |
| 978 | 978 | } |
| 979 | 979 | } |
@@ -982,18 +982,18 @@ discard block |
||
| 982 | 982 | // If payment mode not forced or forced to VIR, show payment with BAN |
| 983 | 983 | if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') |
| 984 | 984 | { |
| 985 | - if (! empty($object->fk_bank) || ! empty($conf->global->FACTURE_RIB_NUMBER)) |
|
| 985 | + if (!empty($object->fk_bank) || !empty($conf->global->FACTURE_RIB_NUMBER)) |
|
| 986 | 986 | { |
| 987 | - $bankid=(empty($object->fk_bank)?$conf->global->FACTURE_RIB_NUMBER:$object->fk_bank); |
|
| 987 | + $bankid = (empty($object->fk_bank) ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_bank); |
|
| 988 | 988 | $account = new Account($this->db); |
| 989 | 989 | $account->fetch($bankid); |
| 990 | 990 | |
| 991 | - $curx=$this->marge_gauche; |
|
| 992 | - $cury=$posy; |
|
| 991 | + $curx = $this->marge_gauche; |
|
| 992 | + $cury = $posy; |
|
| 993 | 993 | |
| 994 | - $posy=pdf_bank($pdf,$outputlangs,$curx,$cury,$account,0,$default_font_size); |
|
| 994 | + $posy = pdf_bank($pdf, $outputlangs, $curx, $cury, $account, 0, $default_font_size); |
|
| 995 | 995 | |
| 996 | - $posy+=2; |
|
| 996 | + $posy += 2; |
|
| 997 | 997 | } |
| 998 | 998 | } |
| 999 | 999 | } |
@@ -1014,43 +1014,43 @@ discard block |
||
| 1014 | 1014 | */ |
| 1015 | 1015 | function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) |
| 1016 | 1016 | { |
| 1017 | - global $conf,$mysoc; |
|
| 1017 | + global $conf, $mysoc; |
|
| 1018 | 1018 | |
| 1019 | - $sign=1; |
|
| 1020 | - if ($object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; |
|
| 1019 | + $sign = 1; |
|
| 1020 | + if ($object->type == 2 && !empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign = -1; |
|
| 1021 | 1021 | |
| 1022 | 1022 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
| 1023 | 1023 | |
| 1024 | 1024 | $tab2_top = $posy; |
| 1025 | 1025 | $tab2_hl = 4; |
| 1026 | - $pdf->SetFont('','', $default_font_size - 1); |
|
| 1026 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 1027 | 1027 | |
| 1028 | 1028 | // Tableau total |
| 1029 | 1029 | $col1x = 120; $col2x = 170; |
| 1030 | 1030 | if ($this->page_largeur < 210) // To work with US executive format |
| 1031 | 1031 | { |
| 1032 | - $col2x-=20; |
|
| 1032 | + $col2x -= 20; |
|
| 1033 | 1033 | } |
| 1034 | 1034 | $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x); |
| 1035 | 1035 | |
| 1036 | - $useborder=0; |
|
| 1036 | + $useborder = 0; |
|
| 1037 | 1037 | $index = 0; |
| 1038 | 1038 | |
| 1039 | 1039 | // Total HT |
| 1040 | - $pdf->SetFillColor(255,255,255); |
|
| 1040 | + $pdf->SetFillColor(255, 255, 255); |
|
| 1041 | 1041 | $pdf->SetXY($col1x, $tab2_top + 0); |
| 1042 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); |
|
| 1042 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); |
|
| 1043 | 1043 | $pdf->SetXY($col2x, $tab2_top + 0); |
| 1044 | - $pdf->MultiCell($largcol2, $tab2_hl, price($sign * ($object->total_ht + (! empty($object->remise)?$object->remise:0)), 0, $outputlangs), 0, 'R', 1); |
|
| 1044 | + $pdf->MultiCell($largcol2, $tab2_hl, price($sign * ($object->total_ht + (!empty($object->remise) ? $object->remise : 0)), 0, $outputlangs), 0, 'R', 1); |
|
| 1045 | 1045 | |
| 1046 | 1046 | // Show VAT by rates and total |
| 1047 | - $pdf->SetFillColor(248,248,248); |
|
| 1047 | + $pdf->SetFillColor(248, 248, 248); |
|
| 1048 | 1048 | |
| 1049 | - $this->atleastoneratenotnull=0; |
|
| 1049 | + $this->atleastoneratenotnull = 0; |
|
| 1050 | 1050 | if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) |
| 1051 | 1051 | { |
| 1052 | - $tvaisnull=((! empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false); |
|
| 1053 | - if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_ISNULL) && $tvaisnull) |
|
| 1052 | + $tvaisnull = ((!empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false); |
|
| 1053 | + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_ISNULL) && $tvaisnull) |
|
| 1054 | 1054 | { |
| 1055 | 1055 | // Nothing to do |
| 1056 | 1056 | } |
@@ -1059,29 +1059,29 @@ discard block |
||
| 1059 | 1059 | //Local tax 1 before VAT |
| 1060 | 1060 | //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') |
| 1061 | 1061 | //{ |
| 1062 | - foreach( $this->localtax1 as $localtax_type => $localtax_rate ) |
|
| 1062 | + foreach ($this->localtax1 as $localtax_type => $localtax_rate) |
|
| 1063 | 1063 | { |
| 1064 | - if (in_array((string) $localtax_type, array('1','3','5'))) continue; |
|
| 1064 | + if (in_array((string) $localtax_type, array('1', '3', '5'))) continue; |
|
| 1065 | 1065 | |
| 1066 | - foreach( $localtax_rate as $tvakey => $tvaval ) |
|
| 1066 | + foreach ($localtax_rate as $tvakey => $tvaval) |
|
| 1067 | 1067 | { |
| 1068 | - if ($tvakey!=0) // On affiche pas taux 0 |
|
| 1068 | + if ($tvakey != 0) // On affiche pas taux 0 |
|
| 1069 | 1069 | { |
| 1070 | 1070 | //$this->atleastoneratenotnull++; |
| 1071 | 1071 | |
| 1072 | 1072 | $index++; |
| 1073 | 1073 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 1074 | 1074 | |
| 1075 | - $tvacompl=''; |
|
| 1076 | - if (preg_match('/\*/',$tvakey)) |
|
| 1075 | + $tvacompl = ''; |
|
| 1076 | + if (preg_match('/\*/', $tvakey)) |
|
| 1077 | 1077 | { |
| 1078 | - $tvakey=str_replace('*','',$tvakey); |
|
| 1078 | + $tvakey = str_replace('*', '', $tvakey); |
|
| 1079 | 1079 | $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; |
| 1080 | 1080 | } |
| 1081 | 1081 | |
| 1082 | - $totalvat = $outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code).' '; |
|
| 1083 | - $totalvat.=vatrate(abs($tvakey),1).$tvacompl; |
|
| 1084 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 1082 | + $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; |
|
| 1083 | + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; |
|
| 1084 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 1085 | 1085 | |
| 1086 | 1086 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 1087 | 1087 | $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); |
@@ -1092,13 +1092,13 @@ discard block |
||
| 1092 | 1092 | //Local tax 2 before VAT |
| 1093 | 1093 | //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') |
| 1094 | 1094 | //{ |
| 1095 | - foreach( $this->localtax2 as $localtax_type => $localtax_rate ) |
|
| 1095 | + foreach ($this->localtax2 as $localtax_type => $localtax_rate) |
|
| 1096 | 1096 | { |
| 1097 | - if (in_array((string) $localtax_type, array('1','3','5'))) continue; |
|
| 1097 | + if (in_array((string) $localtax_type, array('1', '3', '5'))) continue; |
|
| 1098 | 1098 | |
| 1099 | - foreach( $localtax_rate as $tvakey => $tvaval ) |
|
| 1099 | + foreach ($localtax_rate as $tvakey => $tvaval) |
|
| 1100 | 1100 | { |
| 1101 | - if ($tvakey!=0) // On affiche pas taux 0 |
|
| 1101 | + if ($tvakey != 0) // On affiche pas taux 0 |
|
| 1102 | 1102 | { |
| 1103 | 1103 | //$this->atleastoneratenotnull++; |
| 1104 | 1104 | |
@@ -1107,15 +1107,15 @@ discard block |
||
| 1107 | 1107 | $index++; |
| 1108 | 1108 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 1109 | 1109 | |
| 1110 | - $tvacompl=''; |
|
| 1111 | - if (preg_match('/\*/',$tvakey)) |
|
| 1110 | + $tvacompl = ''; |
|
| 1111 | + if (preg_match('/\*/', $tvakey)) |
|
| 1112 | 1112 | { |
| 1113 | - $tvakey=str_replace('*','',$tvakey); |
|
| 1113 | + $tvakey = str_replace('*', '', $tvakey); |
|
| 1114 | 1114 | $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; |
| 1115 | 1115 | } |
| 1116 | - $totalvat = $outputlangs->transcountrynoentities("TotalLT2",$mysoc->country_code).' '; |
|
| 1117 | - $totalvat.=vatrate(abs($tvakey),1).$tvacompl; |
|
| 1118 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 1116 | + $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; |
|
| 1117 | + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; |
|
| 1118 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 1119 | 1119 | |
| 1120 | 1120 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 1121 | 1121 | $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); |
@@ -1125,7 +1125,7 @@ discard block |
||
| 1125 | 1125 | } |
| 1126 | 1126 | //} |
| 1127 | 1127 | // VAT |
| 1128 | - foreach($this->tva as $tvakey => $tvaval) |
|
| 1128 | + foreach ($this->tva as $tvakey => $tvaval) |
|
| 1129 | 1129 | { |
| 1130 | 1130 | if ($tvakey > 0) // On affiche pas taux 0 |
| 1131 | 1131 | { |
@@ -1134,15 +1134,15 @@ discard block |
||
| 1134 | 1134 | $index++; |
| 1135 | 1135 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 1136 | 1136 | |
| 1137 | - $tvacompl=''; |
|
| 1138 | - if (preg_match('/\*/',$tvakey)) |
|
| 1137 | + $tvacompl = ''; |
|
| 1138 | + if (preg_match('/\*/', $tvakey)) |
|
| 1139 | 1139 | { |
| 1140 | - $tvakey=str_replace('*','',$tvakey); |
|
| 1140 | + $tvakey = str_replace('*', '', $tvakey); |
|
| 1141 | 1141 | $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; |
| 1142 | 1142 | } |
| 1143 | - $totalvat =$outputlangs->transnoentities("TotalVAT").' '; |
|
| 1144 | - $totalvat.=vatrate($tvakey,1).$tvacompl; |
|
| 1145 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 1143 | + $totalvat = $outputlangs->transnoentities("TotalVAT").' '; |
|
| 1144 | + $totalvat .= vatrate($tvakey, 1).$tvacompl; |
|
| 1145 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 1146 | 1146 | |
| 1147 | 1147 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 1148 | 1148 | $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); |
@@ -1152,11 +1152,11 @@ discard block |
||
| 1152 | 1152 | //Local tax 1 after VAT |
| 1153 | 1153 | //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') |
| 1154 | 1154 | //{ |
| 1155 | - foreach( $this->localtax1 as $localtax_type => $localtax_rate ) |
|
| 1155 | + foreach ($this->localtax1 as $localtax_type => $localtax_rate) |
|
| 1156 | 1156 | { |
| 1157 | - if (in_array((string) $localtax_type, array('2','4','6'))) continue; |
|
| 1157 | + if (in_array((string) $localtax_type, array('2', '4', '6'))) continue; |
|
| 1158 | 1158 | |
| 1159 | - foreach( $localtax_rate as $tvakey => $tvaval ) |
|
| 1159 | + foreach ($localtax_rate as $tvakey => $tvaval) |
|
| 1160 | 1160 | { |
| 1161 | 1161 | if ($tvakey != 0) // On affiche pas taux 0 |
| 1162 | 1162 | { |
@@ -1165,16 +1165,16 @@ discard block |
||
| 1165 | 1165 | $index++; |
| 1166 | 1166 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 1167 | 1167 | |
| 1168 | - $tvacompl=''; |
|
| 1169 | - if (preg_match('/\*/',$tvakey)) |
|
| 1168 | + $tvacompl = ''; |
|
| 1169 | + if (preg_match('/\*/', $tvakey)) |
|
| 1170 | 1170 | { |
| 1171 | - $tvakey=str_replace('*','',$tvakey); |
|
| 1171 | + $tvakey = str_replace('*', '', $tvakey); |
|
| 1172 | 1172 | $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; |
| 1173 | 1173 | } |
| 1174 | - $totalvat = $outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code).' '; |
|
| 1175 | - $totalvat.=vatrate(abs($tvakey),1).$tvacompl; |
|
| 1174 | + $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; |
|
| 1175 | + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; |
|
| 1176 | 1176 | |
| 1177 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 1177 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 1178 | 1178 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 1179 | 1179 | $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); |
| 1180 | 1180 | } |
@@ -1184,11 +1184,11 @@ discard block |
||
| 1184 | 1184 | //Local tax 2 after VAT |
| 1185 | 1185 | //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') |
| 1186 | 1186 | //{ |
| 1187 | - foreach( $this->localtax2 as $localtax_type => $localtax_rate ) |
|
| 1187 | + foreach ($this->localtax2 as $localtax_type => $localtax_rate) |
|
| 1188 | 1188 | { |
| 1189 | - if (in_array((string) $localtax_type, array('2','4','6'))) continue; |
|
| 1189 | + if (in_array((string) $localtax_type, array('2', '4', '6'))) continue; |
|
| 1190 | 1190 | |
| 1191 | - foreach( $localtax_rate as $tvakey => $tvaval ) |
|
| 1191 | + foreach ($localtax_rate as $tvakey => $tvaval) |
|
| 1192 | 1192 | { |
| 1193 | 1193 | // retrieve global local tax |
| 1194 | 1194 | if ($tvakey != 0) // On affiche pas taux 0 |
@@ -1198,16 +1198,16 @@ discard block |
||
| 1198 | 1198 | $index++; |
| 1199 | 1199 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 1200 | 1200 | |
| 1201 | - $tvacompl=''; |
|
| 1202 | - if (preg_match('/\*/',$tvakey)) |
|
| 1201 | + $tvacompl = ''; |
|
| 1202 | + if (preg_match('/\*/', $tvakey)) |
|
| 1203 | 1203 | { |
| 1204 | - $tvakey=str_replace('*','',$tvakey); |
|
| 1204 | + $tvakey = str_replace('*', '', $tvakey); |
|
| 1205 | 1205 | $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; |
| 1206 | 1206 | } |
| 1207 | - $totalvat = $outputlangs->transcountrynoentities("TotalLT2",$mysoc->country_code).' '; |
|
| 1207 | + $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; |
|
| 1208 | 1208 | |
| 1209 | - $totalvat.=vatrate(abs($tvakey),1).$tvacompl; |
|
| 1210 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 1209 | + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; |
|
| 1210 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 1211 | 1211 | |
| 1212 | 1212 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 1213 | 1213 | $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); |
@@ -1221,7 +1221,7 @@ discard block |
||
| 1221 | 1221 | { |
| 1222 | 1222 | $index++; |
| 1223 | 1223 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 1224 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("RevenueStamp"), $useborder, 'L', 1); |
|
| 1224 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("RevenueStamp"), $useborder, 'L', 1); |
|
| 1225 | 1225 | |
| 1226 | 1226 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 1227 | 1227 | $pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->revenuestamp), $useborder, 'R', 1); |
@@ -1230,29 +1230,29 @@ discard block |
||
| 1230 | 1230 | // Total TTC |
| 1231 | 1231 | $index++; |
| 1232 | 1232 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 1233 | - $pdf->SetTextColor(0,0,60); |
|
| 1234 | - $pdf->SetFillColor(224,224,224); |
|
| 1235 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); |
|
| 1233 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1234 | + $pdf->SetFillColor(224, 224, 224); |
|
| 1235 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); |
|
| 1236 | 1236 | |
| 1237 | 1237 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 1238 | 1238 | $pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->total_ttc, 0, $outputlangs), $useborder, 'R', 1); |
| 1239 | 1239 | } |
| 1240 | 1240 | } |
| 1241 | 1241 | |
| 1242 | - $pdf->SetTextColor(0,0,0); |
|
| 1242 | + $pdf->SetTextColor(0, 0, 0); |
|
| 1243 | 1243 | |
| 1244 | - $creditnoteamount=$object->getSumCreditNotesUsed(); |
|
| 1245 | - $depositsamount=$object->getSumDepositsUsed(); |
|
| 1244 | + $creditnoteamount = $object->getSumCreditNotesUsed(); |
|
| 1245 | + $depositsamount = $object->getSumDepositsUsed(); |
|
| 1246 | 1246 | //print "x".$creditnoteamount."-".$depositsamount;exit; |
| 1247 | 1247 | $resteapayer = price2num($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT'); |
| 1248 | - if ($object->paye) $resteapayer=0; |
|
| 1248 | + if ($object->paye) $resteapayer = 0; |
|
| 1249 | 1249 | |
| 1250 | 1250 | if ($deja_regle > 0 || $creditnoteamount > 0 || $depositsamount > 0) |
| 1251 | 1251 | { |
| 1252 | 1252 | // Already paid + Deposits |
| 1253 | 1253 | $index++; |
| 1254 | 1254 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 1255 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("Paid"), 0, 'L', 0); |
|
| 1255 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("Paid"), 0, 'L', 0); |
|
| 1256 | 1256 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 1257 | 1257 | $pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle + $depositsamount, 0, $outputlangs), 0, 'R', 0); |
| 1258 | 1258 | |
@@ -1261,7 +1261,7 @@ discard block |
||
| 1261 | 1261 | { |
| 1262 | 1262 | $index++; |
| 1263 | 1263 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 1264 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("CreditNotes"), 0, 'L', 0); |
|
| 1264 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("CreditNotes"), 0, 'L', 0); |
|
| 1265 | 1265 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 1266 | 1266 | $pdf->MultiCell($largcol2, $tab2_hl, price($creditnoteamount, 0, $outputlangs), 0, 'R', 0); |
| 1267 | 1267 | } |
@@ -1270,26 +1270,26 @@ discard block |
||
| 1270 | 1270 | if ($object->close_code == 'discount_vat') |
| 1271 | 1271 | { |
| 1272 | 1272 | $index++; |
| 1273 | - $pdf->SetFillColor(255,255,255); |
|
| 1273 | + $pdf->SetFillColor(255, 255, 255); |
|
| 1274 | 1274 | |
| 1275 | 1275 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 1276 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("EscompteOffered"), $useborder, 'L', 1); |
|
| 1276 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("EscompteOffered"), $useborder, 'L', 1); |
|
| 1277 | 1277 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 1278 | 1278 | $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 0, $outputlangs), $useborder, 'R', 1); |
| 1279 | 1279 | |
| 1280 | - $resteapayer=0; |
|
| 1280 | + $resteapayer = 0; |
|
| 1281 | 1281 | } |
| 1282 | 1282 | |
| 1283 | 1283 | $index++; |
| 1284 | - $pdf->SetTextColor(0,0,60); |
|
| 1285 | - $pdf->SetFillColor(224,224,224); |
|
| 1284 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1285 | + $pdf->SetFillColor(224, 224, 224); |
|
| 1286 | 1286 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 1287 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1); |
|
| 1287 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1); |
|
| 1288 | 1288 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 1289 | 1289 | $pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer, 0, $outputlangs), $useborder, 'R', 1); |
| 1290 | 1290 | |
| 1291 | - $pdf->SetFont('','', $default_font_size - 1); |
|
| 1292 | - $pdf->SetTextColor(0,0,0); |
|
| 1291 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 1292 | + $pdf->SetTextColor(0, 0, 0); |
|
| 1293 | 1293 | } |
| 1294 | 1294 | |
| 1295 | 1295 | $index++; |
@@ -1308,47 +1308,47 @@ discard block |
||
| 1308 | 1308 | * @param int $hidebottom Hide bottom bar of array |
| 1309 | 1309 | * @return void |
| 1310 | 1310 | */ |
| 1311 | - function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0) |
|
| 1311 | + function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0) |
|
| 1312 | 1312 | { |
| 1313 | 1313 | global $conf; |
| 1314 | 1314 | |
| 1315 | 1315 | // Force to disable hidetop and hidebottom |
| 1316 | - $hidebottom=0; |
|
| 1317 | - if ($hidetop) $hidetop=-1; |
|
| 1316 | + $hidebottom = 0; |
|
| 1317 | + if ($hidetop) $hidetop = -1; |
|
| 1318 | 1318 | |
| 1319 | 1319 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
| 1320 | 1320 | |
| 1321 | 1321 | // Amount in (at tab_top - 1) |
| 1322 | - $pdf->SetTextColor(0,0,0); |
|
| 1323 | - $pdf->SetFont('','', $default_font_size - 2); |
|
| 1322 | + $pdf->SetTextColor(0, 0, 0); |
|
| 1323 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
| 1324 | 1324 | |
| 1325 | 1325 | if (empty($hidetop)) |
| 1326 | 1326 | { |
| 1327 | - $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency)); |
|
| 1328 | - $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4); |
|
| 1327 | + $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$conf->currency)); |
|
| 1328 | + $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4); |
|
| 1329 | 1329 | $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); |
| 1330 | 1330 | |
| 1331 | 1331 | //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; |
| 1332 | - if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); |
|
| 1332 | + if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); |
|
| 1333 | 1333 | } |
| 1334 | 1334 | |
| 1335 | - $pdf->SetDrawColor(128,128,128); |
|
| 1336 | - $pdf->SetFont('','', $default_font_size - 1); |
|
| 1335 | + $pdf->SetDrawColor(128, 128, 128); |
|
| 1336 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 1337 | 1337 | |
| 1338 | 1338 | // Output Rect |
| 1339 | - $this->printRect($pdf,$this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param |
|
| 1339 | + $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param |
|
| 1340 | 1340 | |
| 1341 | 1341 | if (empty($hidetop)) |
| 1342 | 1342 | { |
| 1343 | - $pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); // line prend une position y en 2eme param et 4eme param |
|
| 1343 | + $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5); // line prend une position y en 2eme param et 4eme param |
|
| 1344 | 1344 | |
| 1345 | - $pdf->SetXY($this->posxdesc-1, $tab_top+1); |
|
| 1346 | - $pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L'); |
|
| 1345 | + $pdf->SetXY($this->posxdesc - 1, $tab_top + 1); |
|
| 1346 | + $pdf->MultiCell(108, 2, $outputlangs->transnoentities("Designation"), '', 'L'); |
|
| 1347 | 1347 | } |
| 1348 | 1348 | |
| 1349 | - if (! empty($conf->global->MAIN_GENERATE_INVOICES_WITH_PICTURE)) |
|
| 1349 | + if (!empty($conf->global->MAIN_GENERATE_INVOICES_WITH_PICTURE)) |
|
| 1350 | 1350 | { |
| 1351 | - $pdf->line($this->posxpicture-1, $tab_top, $this->posxpicture-1, $tab_top + $tab_height); |
|
| 1351 | + $pdf->line($this->posxpicture - 1, $tab_top, $this->posxpicture - 1, $tab_top + $tab_height); |
|
| 1352 | 1352 | if (empty($hidetop)) |
| 1353 | 1353 | { |
| 1354 | 1354 | //$pdf->SetXY($this->posxpicture-1, $tab_top+1); |
@@ -1358,35 +1358,35 @@ discard block |
||
| 1358 | 1358 | |
| 1359 | 1359 | if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) |
| 1360 | 1360 | { |
| 1361 | - $pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height); |
|
| 1361 | + $pdf->line($this->posxtva - 1, $tab_top, $this->posxtva - 1, $tab_top + $tab_height); |
|
| 1362 | 1362 | if (empty($hidetop)) |
| 1363 | 1363 | { |
| 1364 | - $pdf->SetXY($this->posxtva-3, $tab_top+1); |
|
| 1365 | - $pdf->MultiCell($this->posxup-$this->posxtva+3,2, $outputlangs->transnoentities("VAT"),'','C'); |
|
| 1364 | + $pdf->SetXY($this->posxtva - 3, $tab_top + 1); |
|
| 1365 | + $pdf->MultiCell($this->posxup - $this->posxtva + 3, 2, $outputlangs->transnoentities("VAT"), '', 'C'); |
|
| 1366 | 1366 | } |
| 1367 | 1367 | } |
| 1368 | 1368 | |
| 1369 | - $pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height); |
|
| 1369 | + $pdf->line($this->posxup - 1, $tab_top, $this->posxup - 1, $tab_top + $tab_height); |
|
| 1370 | 1370 | if (empty($hidetop)) |
| 1371 | 1371 | { |
| 1372 | - $pdf->SetXY($this->posxup-1, $tab_top+1); |
|
| 1373 | - $pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceUHT"),'','C'); |
|
| 1372 | + $pdf->SetXY($this->posxup - 1, $tab_top + 1); |
|
| 1373 | + $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities("PriceUHT"), '', 'C'); |
|
| 1374 | 1374 | } |
| 1375 | 1375 | |
| 1376 | - $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); |
|
| 1376 | + $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height); |
|
| 1377 | 1377 | if (empty($hidetop)) |
| 1378 | 1378 | { |
| 1379 | - $pdf->SetXY($this->posxqty-1, $tab_top+1); |
|
| 1380 | - $pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C'); |
|
| 1379 | + $pdf->SetXY($this->posxqty - 1, $tab_top + 1); |
|
| 1380 | + $pdf->MultiCell($this->posxdiscount - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C'); |
|
| 1381 | 1381 | } |
| 1382 | 1382 | |
| 1383 | - $pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height); |
|
| 1383 | + $pdf->line($this->posxdiscount - 1, $tab_top, $this->posxdiscount - 1, $tab_top + $tab_height); |
|
| 1384 | 1384 | if (empty($hidetop)) |
| 1385 | 1385 | { |
| 1386 | 1386 | if ($this->atleastonediscount) |
| 1387 | 1387 | { |
| 1388 | - $pdf->SetXY($this->posxdiscount-1, $tab_top+1); |
|
| 1389 | - $pdf->MultiCell($this->postotalht-$this->posxdiscount+1,2, $outputlangs->transnoentities("ReductionShort"),'','C'); |
|
| 1388 | + $pdf->SetXY($this->posxdiscount - 1, $tab_top + 1); |
|
| 1389 | + $pdf->MultiCell($this->postotalht - $this->posxdiscount + 1, 2, $outputlangs->transnoentities("ReductionShort"), '', 'C'); |
|
| 1390 | 1390 | } |
| 1391 | 1391 | } |
| 1392 | 1392 | if ($this->atleastonediscount) |
@@ -1395,8 +1395,8 @@ discard block |
||
| 1395 | 1395 | } |
| 1396 | 1396 | if (empty($hidetop)) |
| 1397 | 1397 | { |
| 1398 | - $pdf->SetXY($this->postotalht-1, $tab_top+1); |
|
| 1399 | - $pdf->MultiCell(30,2, $outputlangs->transnoentities("TotalHT"),'','C'); |
|
| 1398 | + $pdf->SetXY($this->postotalht - 1, $tab_top + 1); |
|
| 1399 | + $pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHT"), '', 'C'); |
|
| 1400 | 1400 | } |
| 1401 | 1401 | } |
| 1402 | 1402 | |
@@ -1411,7 +1411,7 @@ discard block |
||
| 1411 | 1411 | */ |
| 1412 | 1412 | function _pagehead(&$pdf, $object, $showaddress, $outputlangs) |
| 1413 | 1413 | { |
| 1414 | - global $conf,$langs; |
|
| 1414 | + global $conf, $langs; |
|
| 1415 | 1415 | |
| 1416 | 1416 | $outputlangs->load("main"); |
| 1417 | 1417 | $outputlangs->load("bills"); |
@@ -1420,127 +1420,127 @@ discard block |
||
| 1420 | 1420 | |
| 1421 | 1421 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
| 1422 | 1422 | |
| 1423 | - pdf_pagehead($pdf,$outputlangs,$this->page_hauteur); |
|
| 1423 | + pdf_pagehead($pdf, $outputlangs, $this->page_hauteur); |
|
| 1424 | 1424 | |
| 1425 | 1425 | // Show Draft Watermark |
| 1426 | - if($object->statut==0 && (! empty($conf->global->FACTURE_DRAFT_WATERMARK)) ) |
|
| 1426 | + if ($object->statut == 0 && (!empty($conf->global->FACTURE_DRAFT_WATERMARK))) |
|
| 1427 | 1427 | { |
| 1428 | - pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->FACTURE_DRAFT_WATERMARK); |
|
| 1428 | + pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->FACTURE_DRAFT_WATERMARK); |
|
| 1429 | 1429 | } |
| 1430 | 1430 | |
| 1431 | - $pdf->SetTextColor(0,0,60); |
|
| 1432 | - $pdf->SetFont('','B', $default_font_size + 3); |
|
| 1431 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1432 | + $pdf->SetFont('', 'B', $default_font_size + 3); |
|
| 1433 | 1433 | |
| 1434 | - $posy=$this->marge_haute; |
|
| 1435 | - $posx=$this->page_largeur-$this->marge_droite-100; |
|
| 1434 | + $posy = $this->marge_haute; |
|
| 1435 | + $posx = $this->page_largeur - $this->marge_droite - 100; |
|
| 1436 | 1436 | |
| 1437 | - $pdf->SetXY($this->marge_gauche,$posy); |
|
| 1437 | + $pdf->SetXY($this->marge_gauche, $posy); |
|
| 1438 | 1438 | |
| 1439 | 1439 | // Logo |
| 1440 | - $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; |
|
| 1440 | + $logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; |
|
| 1441 | 1441 | if ($this->emetteur->logo) |
| 1442 | 1442 | { |
| 1443 | 1443 | if (is_readable($logo)) |
| 1444 | 1444 | { |
| 1445 | - $height=pdf_getHeightForLogo($logo); |
|
| 1446 | - $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
| 1445 | + $height = pdf_getHeightForLogo($logo); |
|
| 1446 | + $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
| 1447 | 1447 | } |
| 1448 | 1448 | else |
| 1449 | 1449 | { |
| 1450 | - $pdf->SetTextColor(200,0,0); |
|
| 1451 | - $pdf->SetFont('','B',$default_font_size - 2); |
|
| 1452 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L'); |
|
| 1450 | + $pdf->SetTextColor(200, 0, 0); |
|
| 1451 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
| 1452 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); |
|
| 1453 | 1453 | $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); |
| 1454 | 1454 | } |
| 1455 | 1455 | } |
| 1456 | 1456 | else |
| 1457 | 1457 | { |
| 1458 | - $text=$this->emetteur->name; |
|
| 1458 | + $text = $this->emetteur->name; |
|
| 1459 | 1459 | $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); |
| 1460 | 1460 | } |
| 1461 | 1461 | |
| 1462 | - $pdf->SetFont('','B', $default_font_size + 3); |
|
| 1463 | - $pdf->SetXY($posx,$posy); |
|
| 1464 | - $pdf->SetTextColor(0,0,60); |
|
| 1465 | - $title=$outputlangs->transnoentities("Invoice"); |
|
| 1466 | - if ($object->type == 1) $title=$outputlangs->transnoentities("InvoiceReplacement"); |
|
| 1467 | - if ($object->type == 2) $title=$outputlangs->transnoentities("InvoiceAvoir"); |
|
| 1468 | - if ($object->type == 3) $title=$outputlangs->transnoentities("InvoiceDeposit"); |
|
| 1469 | - if ($object->type == 4) $title=$outputlangs->transnoentities("InvoiceProFormat"); |
|
| 1462 | + $pdf->SetFont('', 'B', $default_font_size + 3); |
|
| 1463 | + $pdf->SetXY($posx, $posy); |
|
| 1464 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1465 | + $title = $outputlangs->transnoentities("Invoice"); |
|
| 1466 | + if ($object->type == 1) $title = $outputlangs->transnoentities("InvoiceReplacement"); |
|
| 1467 | + if ($object->type == 2) $title = $outputlangs->transnoentities("InvoiceAvoir"); |
|
| 1468 | + if ($object->type == 3) $title = $outputlangs->transnoentities("InvoiceDeposit"); |
|
| 1469 | + if ($object->type == 4) $title = $outputlangs->transnoentities("InvoiceProFormat"); |
|
| 1470 | 1470 | $pdf->MultiCell(100, 3, $title, '', 'R'); |
| 1471 | 1471 | |
| 1472 | - $pdf->SetFont('','B',$default_font_size); |
|
| 1472 | + $pdf->SetFont('', 'B', $default_font_size); |
|
| 1473 | 1473 | |
| 1474 | - $posy+=5; |
|
| 1475 | - $pdf->SetXY($posx,$posy); |
|
| 1476 | - $pdf->SetTextColor(0,0,60); |
|
| 1477 | - $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : " . $outputlangs->convToOutputCharset($object->ref), '', 'R'); |
|
| 1474 | + $posy += 5; |
|
| 1475 | + $pdf->SetXY($posx, $posy); |
|
| 1476 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1477 | + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($object->ref), '', 'R'); |
|
| 1478 | 1478 | |
| 1479 | - $posy+=1; |
|
| 1480 | - $pdf->SetFont('','', $default_font_size - 2); |
|
| 1479 | + $posy += 1; |
|
| 1480 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
| 1481 | 1481 | |
| 1482 | 1482 | if ($object->ref_client) |
| 1483 | 1483 | { |
| 1484 | - $posy+=4; |
|
| 1485 | - $pdf->SetXY($posx,$posy); |
|
| 1486 | - $pdf->SetTextColor(0,0,60); |
|
| 1487 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : " . $outputlangs->convToOutputCharset($object->ref_client), '', 'R'); |
|
| 1484 | + $posy += 4; |
|
| 1485 | + $pdf->SetXY($posx, $posy); |
|
| 1486 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1487 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R'); |
|
| 1488 | 1488 | } |
| 1489 | 1489 | |
| 1490 | - $objectidnext=$object->getIdReplacingInvoice('validated'); |
|
| 1490 | + $objectidnext = $object->getIdReplacingInvoice('validated'); |
|
| 1491 | 1491 | if ($object->type == 0 && $objectidnext) |
| 1492 | 1492 | { |
| 1493 | - $objectreplacing=new Facture($this->db); |
|
| 1493 | + $objectreplacing = new Facture($this->db); |
|
| 1494 | 1494 | $objectreplacing->fetch($objectidnext); |
| 1495 | 1495 | |
| 1496 | - $posy+=3; |
|
| 1497 | - $pdf->SetXY($posx,$posy); |
|
| 1498 | - $pdf->SetTextColor(0,0,60); |
|
| 1496 | + $posy += 3; |
|
| 1497 | + $pdf->SetXY($posx, $posy); |
|
| 1498 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1499 | 1499 | $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ReplacementByInvoice").' : '.$outputlangs->convToOutputCharset($objectreplacing->ref), '', 'R'); |
| 1500 | 1500 | } |
| 1501 | 1501 | if ($object->type == 1) |
| 1502 | 1502 | { |
| 1503 | - $objectreplaced=new Facture($this->db); |
|
| 1503 | + $objectreplaced = new Facture($this->db); |
|
| 1504 | 1504 | $objectreplaced->fetch($object->fk_facture_source); |
| 1505 | 1505 | |
| 1506 | - $posy+=4; |
|
| 1507 | - $pdf->SetXY($posx,$posy); |
|
| 1508 | - $pdf->SetTextColor(0,0,60); |
|
| 1506 | + $posy += 4; |
|
| 1507 | + $pdf->SetXY($posx, $posy); |
|
| 1508 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1509 | 1509 | $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ReplacementInvoice").' : '.$outputlangs->convToOutputCharset($objectreplaced->ref), '', 'R'); |
| 1510 | 1510 | } |
| 1511 | 1511 | if ($object->type == 2) |
| 1512 | 1512 | { |
| 1513 | - $objectreplaced=new Facture($this->db); |
|
| 1513 | + $objectreplaced = new Facture($this->db); |
|
| 1514 | 1514 | $objectreplaced->fetch($object->fk_facture_source); |
| 1515 | 1515 | |
| 1516 | - $posy+=3; |
|
| 1517 | - $pdf->SetXY($posx,$posy); |
|
| 1518 | - $pdf->SetTextColor(0,0,60); |
|
| 1516 | + $posy += 3; |
|
| 1517 | + $pdf->SetXY($posx, $posy); |
|
| 1518 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1519 | 1519 | $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CorrectionInvoice").' : '.$outputlangs->convToOutputCharset($objectreplaced->ref), '', 'R'); |
| 1520 | 1520 | } |
| 1521 | 1521 | |
| 1522 | - $posy+=4; |
|
| 1523 | - $pdf->SetXY($posx,$posy); |
|
| 1524 | - $pdf->SetTextColor(0,0,60); |
|
| 1525 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateInvoice")." : " . dol_print_date($object->date,"day",false,$outputlangs), '', 'R'); |
|
| 1522 | + $posy += 4; |
|
| 1523 | + $pdf->SetXY($posx, $posy); |
|
| 1524 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1525 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateInvoice")." : ".dol_print_date($object->date, "day", false, $outputlangs), '', 'R'); |
|
| 1526 | 1526 | |
| 1527 | 1527 | if ($object->type != 2) |
| 1528 | 1528 | { |
| 1529 | - $posy+=3; |
|
| 1530 | - $pdf->SetXY($posx,$posy); |
|
| 1531 | - $pdf->SetTextColor(0,0,60); |
|
| 1532 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateEcheance")." : " . dol_print_date($object->date_lim_reglement,"day",false,$outputlangs,true), '', 'R'); |
|
| 1529 | + $posy += 3; |
|
| 1530 | + $pdf->SetXY($posx, $posy); |
|
| 1531 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1532 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateEcheance")." : ".dol_print_date($object->date_lim_reglement, "day", false, $outputlangs, true), '', 'R'); |
|
| 1533 | 1533 | } |
| 1534 | 1534 | |
| 1535 | 1535 | if ($object->thirdparty->code_client) |
| 1536 | 1536 | { |
| 1537 | - $posy+=3; |
|
| 1538 | - $pdf->SetXY($posx,$posy); |
|
| 1539 | - $pdf->SetTextColor(0,0,60); |
|
| 1540 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); |
|
| 1537 | + $posy += 3; |
|
| 1538 | + $pdf->SetXY($posx, $posy); |
|
| 1539 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1540 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); |
|
| 1541 | 1541 | } |
| 1542 | 1542 | |
| 1543 | - $posy+=1; |
|
| 1543 | + $posy += 1; |
|
| 1544 | 1544 | |
| 1545 | 1545 | // Show list of linked objects |
| 1546 | 1546 | $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size); |
@@ -1551,84 +1551,84 @@ discard block |
||
| 1551 | 1551 | $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty); |
| 1552 | 1552 | |
| 1553 | 1553 | // Show sender |
| 1554 | - $posy=42; |
|
| 1555 | - $posx=$this->marge_gauche; |
|
| 1556 | - if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80; |
|
| 1557 | - $hautcadre=40; |
|
| 1554 | + $posy = 42; |
|
| 1555 | + $posx = $this->marge_gauche; |
|
| 1556 | + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80; |
|
| 1557 | + $hautcadre = 40; |
|
| 1558 | 1558 | |
| 1559 | 1559 | // Show sender frame |
| 1560 | - $pdf->SetTextColor(0,0,0); |
|
| 1561 | - $pdf->SetFont('','', $default_font_size - 2); |
|
| 1562 | - $pdf->SetXY($posx,$posy-5); |
|
| 1563 | - $pdf->MultiCell(66,5, $outputlangs->transnoentities("BillFrom").":", 0, 'L'); |
|
| 1564 | - $pdf->SetXY($posx,$posy); |
|
| 1565 | - $pdf->SetFillColor(230,230,230); |
|
| 1560 | + $pdf->SetTextColor(0, 0, 0); |
|
| 1561 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
| 1562 | + $pdf->SetXY($posx, $posy - 5); |
|
| 1563 | + $pdf->MultiCell(66, 5, $outputlangs->transnoentities("BillFrom").":", 0, 'L'); |
|
| 1564 | + $pdf->SetXY($posx, $posy); |
|
| 1565 | + $pdf->SetFillColor(230, 230, 230); |
|
| 1566 | 1566 | $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1); |
| 1567 | - $pdf->SetTextColor(0,0,60); |
|
| 1567 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1568 | 1568 | |
| 1569 | 1569 | // Show sender name |
| 1570 | - $pdf->SetXY($posx+2,$posy+3); |
|
| 1571 | - $pdf->SetFont('','B', $default_font_size); |
|
| 1570 | + $pdf->SetXY($posx + 2, $posy + 3); |
|
| 1571 | + $pdf->SetFont('', 'B', $default_font_size); |
|
| 1572 | 1572 | $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); |
| 1573 | - $posy=$pdf->getY(); |
|
| 1573 | + $posy = $pdf->getY(); |
|
| 1574 | 1574 | |
| 1575 | 1575 | // Show sender information |
| 1576 | - $pdf->SetXY($posx+2,$posy); |
|
| 1577 | - $pdf->SetFont('','', $default_font_size - 1); |
|
| 1576 | + $pdf->SetXY($posx + 2, $posy); |
|
| 1577 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 1578 | 1578 | $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L'); |
| 1579 | 1579 | |
| 1580 | 1580 | |
| 1581 | 1581 | |
| 1582 | 1582 | // If BILLING contact defined on invoice, we use it |
| 1583 | - $usecontact=false; |
|
| 1584 | - $arrayidcontact=$object->getIdContact('external','BILLING'); |
|
| 1583 | + $usecontact = false; |
|
| 1584 | + $arrayidcontact = $object->getIdContact('external', 'BILLING'); |
|
| 1585 | 1585 | if (count($arrayidcontact) > 0) |
| 1586 | 1586 | { |
| 1587 | - $usecontact=true; |
|
| 1588 | - $result=$object->fetch_contact($arrayidcontact[0]); |
|
| 1587 | + $usecontact = true; |
|
| 1588 | + $result = $object->fetch_contact($arrayidcontact[0]); |
|
| 1589 | 1589 | } |
| 1590 | 1590 | |
| 1591 | 1591 | // Recipient name |
| 1592 | - if (! empty($usecontact)) |
|
| 1592 | + if (!empty($usecontact)) |
|
| 1593 | 1593 | { |
| 1594 | 1594 | // On peut utiliser le nom de la societe du contact |
| 1595 | - if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; |
|
| 1595 | + if (!empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; |
|
| 1596 | 1596 | else $socname = $object->thirdparty->name; |
| 1597 | - $carac_client_name=$outputlangs->convToOutputCharset($socname); |
|
| 1597 | + $carac_client_name = $outputlangs->convToOutputCharset($socname); |
|
| 1598 | 1598 | } |
| 1599 | 1599 | else |
| 1600 | 1600 | { |
| 1601 | - $carac_client_name=$outputlangs->convToOutputCharset($object->thirdparty->name); |
|
| 1601 | + $carac_client_name = $outputlangs->convToOutputCharset($object->thirdparty->name); |
|
| 1602 | 1602 | } |
| 1603 | 1603 | |
| 1604 | - $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,($usecontact?$object->contact:''),$usecontact,'target'); |
|
| 1604 | + $carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, 'target'); |
|
| 1605 | 1605 | |
| 1606 | 1606 | // Show recipient |
| 1607 | - $widthrecbox=100; |
|
| 1608 | - if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format |
|
| 1609 | - $posy=42; |
|
| 1610 | - $posx=$this->page_largeur-$this->marge_droite-$widthrecbox; |
|
| 1611 | - if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche; |
|
| 1607 | + $widthrecbox = 100; |
|
| 1608 | + if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format |
|
| 1609 | + $posy = 42; |
|
| 1610 | + $posx = $this->page_largeur - $this->marge_droite - $widthrecbox; |
|
| 1611 | + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche; |
|
| 1612 | 1612 | |
| 1613 | 1613 | // Show recipient frame |
| 1614 | - $pdf->SetTextColor(0,0,0); |
|
| 1615 | - $pdf->SetFont('','', $default_font_size - 2); |
|
| 1616 | - $pdf->SetXY($posx+2,$posy-5); |
|
| 1617 | - $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":",0,'L'); |
|
| 1614 | + $pdf->SetTextColor(0, 0, 0); |
|
| 1615 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
| 1616 | + $pdf->SetXY($posx + 2, $posy - 5); |
|
| 1617 | + $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":", 0, 'L'); |
|
| 1618 | 1618 | $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre); |
| 1619 | 1619 | |
| 1620 | 1620 | // Show recipient name |
| 1621 | - $pdf->SetXY($posx+2,$posy+3); |
|
| 1622 | - $pdf->SetFont('','B', $default_font_size); |
|
| 1621 | + $pdf->SetXY($posx + 2, $posy + 3); |
|
| 1622 | + $pdf->SetFont('', 'B', $default_font_size); |
|
| 1623 | 1623 | $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L'); |
| 1624 | 1624 | |
| 1625 | 1625 | // Show recipient information |
| 1626 | - $pdf->SetFont('','', $default_font_size - 1); |
|
| 1627 | - $pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4)); |
|
| 1626 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 1627 | + $pdf->SetXY($posx + 2, $posy + 4 + (dol_nboflines_bis($carac_client_name, 50) * 4)); |
|
| 1628 | 1628 | $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); |
| 1629 | 1629 | } |
| 1630 | 1630 | |
| 1631 | - $pdf->SetTextColor(0,0,0); |
|
| 1631 | + $pdf->SetTextColor(0, 0, 0); |
|
| 1632 | 1632 | } |
| 1633 | 1633 | |
| 1634 | 1634 | /** |
@@ -1640,11 +1640,11 @@ discard block |
||
| 1640 | 1640 | * @param int $hidefreetext 1=Hide free text |
| 1641 | 1641 | * @return int Return height of bottom margin including footer text |
| 1642 | 1642 | */ |
| 1643 | - function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) |
|
| 1643 | + function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) |
|
| 1644 | 1644 | { |
| 1645 | - $showdetails=0; |
|
| 1646 | - $free_text = (float)DOL_VERSION > 3.8 ? 'INVOICE_FREE_TEXT' : 'FACTURE_FREE_TEXT'; |
|
| 1647 | - return pdf_pagefoot($pdf,$outputlangs,$free_text,$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); |
|
| 1645 | + $showdetails = 0; |
|
| 1646 | + $free_text = (float) DOL_VERSION > 3.8 ? 'INVOICE_FREE_TEXT' : 'FACTURE_FREE_TEXT'; |
|
| 1647 | + return pdf_pagefoot($pdf, $outputlangs, $free_text, $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); |
|
| 1648 | 1648 | } |
| 1649 | 1649 | |
| 1650 | 1650 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | var $description; |
| 43 | 43 | var $type; |
| 44 | 44 | |
| 45 | - var $phpmin = array(4,3,0); // Minimum version of PHP required by module |
|
| 45 | + var $phpmin = array(4, 3, 0); // Minimum version of PHP required by module |
|
| 46 | 46 | var $version = 'dolibarr'; |
| 47 | 47 | |
| 48 | 48 | var $page_largeur; |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | var $marge_haute; |
| 54 | 54 | var $marge_basse; |
| 55 | 55 | |
| 56 | - var $emetteur; // Objet societe qui emet |
|
| 56 | + var $emetteur; // Objet societe qui emet |
|
| 57 | 57 | |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | function __construct($db) |
| 65 | 65 | { |
| 66 | - global $conf,$langs,$mysoc; |
|
| 66 | + global $conf, $langs, $mysoc; |
|
| 67 | 67 | |
| 68 | 68 | $langs->load("main"); |
| 69 | 69 | $langs->load("bills"); |
@@ -75,56 +75,56 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | // Dimension page pour format A4 |
| 77 | 77 | $this->type = 'pdf'; |
| 78 | - $formatarray=pdf_getFormat(); |
|
| 78 | + $formatarray = pdf_getFormat(); |
|
| 79 | 79 | $this->page_largeur = $formatarray['width']; |
| 80 | 80 | $this->page_hauteur = $formatarray['height']; |
| 81 | - $this->format = array($this->page_largeur,$this->page_hauteur); |
|
| 82 | - $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10; |
|
| 83 | - $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10; |
|
| 84 | - $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10; |
|
| 85 | - $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10; |
|
| 86 | - |
|
| 87 | - $this->option_logo = 1; // Affiche logo |
|
| 88 | - $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION |
|
| 89 | - $this->option_modereg = 1; // Affiche mode reglement |
|
| 90 | - $this->option_condreg = 1; // Affiche conditions reglement |
|
| 91 | - $this->option_codeproduitservice = 1; // Affiche code produit-service |
|
| 92 | - $this->option_multilang = 1; // Dispo en plusieurs langues |
|
| 93 | - $this->option_escompte = 1; // Affiche si il y a eu escompte |
|
| 94 | - $this->option_credit_note = 1; // Support credit notes |
|
| 95 | - $this->option_freetext = 1; // Support add of a personalised text |
|
| 96 | - $this->option_draft_watermark = 1; //Support add of a watermark on drafts |
|
| 97 | - |
|
| 98 | - $this->franchise=!$mysoc->tva_assuj; |
|
| 81 | + $this->format = array($this->page_largeur, $this->page_hauteur); |
|
| 82 | + $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; |
|
| 83 | + $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; |
|
| 84 | + $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; |
|
| 85 | + $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; |
|
| 86 | + |
|
| 87 | + $this->option_logo = 1; // Affiche logo |
|
| 88 | + $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION |
|
| 89 | + $this->option_modereg = 1; // Affiche mode reglement |
|
| 90 | + $this->option_condreg = 1; // Affiche conditions reglement |
|
| 91 | + $this->option_codeproduitservice = 1; // Affiche code produit-service |
|
| 92 | + $this->option_multilang = 1; // Dispo en plusieurs langues |
|
| 93 | + $this->option_escompte = 1; // Affiche si il y a eu escompte |
|
| 94 | + $this->option_credit_note = 1; // Support credit notes |
|
| 95 | + $this->option_freetext = 1; // Support add of a personalised text |
|
| 96 | + $this->option_draft_watermark = 1; //Support add of a watermark on drafts |
|
| 97 | + |
|
| 98 | + $this->franchise = !$mysoc->tva_assuj; |
|
| 99 | 99 | |
| 100 | 100 | // Get source company |
| 101 | - $this->emetteur=$mysoc; |
|
| 102 | - if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if was not defined |
|
| 101 | + $this->emetteur = $mysoc; |
|
| 102 | + if (empty($this->emetteur->country_code)) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined |
|
| 103 | 103 | |
| 104 | 104 | // Define position of columns |
| 105 | - $this->posxdesc=$this->marge_gauche+1; |
|
| 106 | - $this->posxtva=112; |
|
| 107 | - $this->posxup=126; |
|
| 108 | - $this->posxqty=145; |
|
| 109 | - $this->posxdiscount=162; |
|
| 110 | - $this->postotalht=174; |
|
| 111 | - if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup; |
|
| 112 | - $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images |
|
| 105 | + $this->posxdesc = $this->marge_gauche + 1; |
|
| 106 | + $this->posxtva = 112; |
|
| 107 | + $this->posxup = 126; |
|
| 108 | + $this->posxqty = 145; |
|
| 109 | + $this->posxdiscount = 162; |
|
| 110 | + $this->postotalht = 174; |
|
| 111 | + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva = $this->posxup; |
|
| 112 | + $this->posxpicture = $this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images |
|
| 113 | 113 | if ($this->page_largeur < 210) // To work with US executive format |
| 114 | 114 | { |
| 115 | - $this->posxpicture-=20; |
|
| 116 | - $this->posxtva-=20; |
|
| 117 | - $this->posxup-=20; |
|
| 118 | - $this->posxqty-=20; |
|
| 119 | - $this->posxdiscount-=20; |
|
| 120 | - $this->postotalht-=20; |
|
| 115 | + $this->posxpicture -= 20; |
|
| 116 | + $this->posxtva -= 20; |
|
| 117 | + $this->posxup -= 20; |
|
| 118 | + $this->posxqty -= 20; |
|
| 119 | + $this->posxdiscount -= 20; |
|
| 120 | + $this->postotalht -= 20; |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - $this->tva=array(); |
|
| 124 | - $this->localtax1=array(); |
|
| 125 | - $this->localtax2=array(); |
|
| 126 | - $this->atleastoneratenotnull=0; |
|
| 127 | - $this->atleastonediscount=0; |
|
| 123 | + $this->tva = array(); |
|
| 124 | + $this->localtax1 = array(); |
|
| 125 | + $this->localtax2 = array(); |
|
| 126 | + $this->atleastoneratenotnull = 0; |
|
| 127 | + $this->atleastonediscount = 0; |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |
@@ -138,13 +138,13 @@ discard block |
||
| 138 | 138 | * @param int $hideref Do not show ref |
| 139 | 139 | * @return int 1=OK, 0=KO |
| 140 | 140 | */ |
| 141 | - function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) |
|
| 141 | + function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) |
|
| 142 | 142 | { |
| 143 | - global $user,$langs,$conf,$mysoc,$db,$hookmanager; |
|
| 143 | + global $user, $langs, $conf, $mysoc, $db, $hookmanager; |
|
| 144 | 144 | |
| 145 | - if (! is_object($outputlangs)) $outputlangs=$langs; |
|
| 145 | + if (!is_object($outputlangs)) $outputlangs = $langs; |
|
| 146 | 146 | // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO |
| 147 | - if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; |
|
| 147 | + if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1'; |
|
| 148 | 148 | |
| 149 | 149 | $outputlangs->load("main"); |
| 150 | 150 | $outputlangs->load("dict"); |
@@ -156,51 +156,51 @@ discard block |
||
| 156 | 156 | $nblignes = count($object->lines); |
| 157 | 157 | |
| 158 | 158 | // Loop on each lines to detect if there is at least one image to show |
| 159 | - $realpatharray=array(); |
|
| 160 | - if (! empty($conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE)) |
|
| 159 | + $realpatharray = array(); |
|
| 160 | + if (!empty($conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE)) |
|
| 161 | 161 | { |
| 162 | 162 | $objphoto = new Product($this->db); |
| 163 | 163 | |
| 164 | - for ($i = 0 ; $i < $nblignes ; $i++) |
|
| 164 | + for ($i = 0; $i < $nblignes; $i++) |
|
| 165 | 165 | { |
| 166 | 166 | if (empty($object->lines[$i]->fk_product)) continue; |
| 167 | 167 | |
| 168 | 168 | $objphoto->fetch($object->lines[$i]->fk_product); |
| 169 | 169 | |
| 170 | - if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) |
|
| 170 | + if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) |
|
| 171 | 171 | { |
| 172 | - $pdir[0] = get_exdir($objphoto->id,2) . $objphoto->id ."/photos/"; |
|
| 172 | + $pdir[0] = get_exdir($objphoto->id, 2).$objphoto->id."/photos/"; |
|
| 173 | 173 | $pdir[1] = dol_sanitizeFileName($objphoto->ref).'/'; |
| 174 | 174 | } |
| 175 | 175 | else |
| 176 | 176 | { |
| 177 | 177 | $pdir[0] = dol_sanitizeFileName($objphoto->ref).'/'; |
| 178 | - $pdir[1] = get_exdir($objphoto->id,2) . $objphoto->id ."/photos/"; |
|
| 178 | + $pdir[1] = get_exdir($objphoto->id, 2).$objphoto->id."/photos/"; |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | $arephoto = false; |
| 182 | 182 | foreach ($pdir as $midir) |
| 183 | 183 | { |
| 184 | - if (! $arephoto) |
|
| 184 | + if (!$arephoto) |
|
| 185 | 185 | { |
| 186 | 186 | $dir = $conf->product->dir_output.'/'.$midir; |
| 187 | 187 | |
| 188 | - foreach ($objphoto->liste_photos($dir,1) as $key => $obj) |
|
| 188 | + foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) |
|
| 189 | 189 | { |
| 190 | 190 | if (empty($conf->global->CAT_HIGH_QUALITY_IMAGES)) // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo |
| 191 | 191 | { |
| 192 | 192 | if ($obj['photo_vignette']) |
| 193 | 193 | { |
| 194 | - $filename= $obj['photo_vignette']; |
|
| 194 | + $filename = $obj['photo_vignette']; |
|
| 195 | 195 | } |
| 196 | 196 | else |
| 197 | 197 | { |
| 198 | - $filename=$obj['photo']; |
|
| 198 | + $filename = $obj['photo']; |
|
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | 201 | else |
| 202 | 202 | { |
| 203 | - $filename=$obj['photo']; |
|
| 203 | + $filename = $obj['photo']; |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | $realpath = $dir.$filename; |
@@ -209,16 +209,16 @@ discard block |
||
| 209 | 209 | } |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | - if ($realpath && $arephoto) $realpatharray[$i]=$realpath; |
|
| 212 | + if ($realpath && $arephoto) $realpatharray[$i] = $realpath; |
|
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | - if (count($realpatharray) == 0) $this->posxpicture=$this->posxtva; |
|
| 216 | + if (count($realpatharray) == 0) $this->posxpicture = $this->posxtva; |
|
| 217 | 217 | |
| 218 | 218 | if ($conf->propal->dir_output) |
| 219 | 219 | { |
| 220 | 220 | $object->fetch_thirdparty(); |
| 221 | - if(!empty($object->client) ){ |
|
| 221 | + if (!empty($object->client)) { |
|
| 222 | 222 | $object->thirdparty = $object->client; |
| 223 | 223 | } |
| 224 | 224 | // $deja_regle = 0; |
@@ -227,20 +227,20 @@ discard block |
||
| 227 | 227 | if ($object->specimen) |
| 228 | 228 | { |
| 229 | 229 | $dir = $conf->propal->dir_output; |
| 230 | - $file = $dir . "/SPECIMEN.pdf"; |
|
| 230 | + $file = $dir."/SPECIMEN.pdf"; |
|
| 231 | 231 | } |
| 232 | 232 | else |
| 233 | 233 | { |
| 234 | 234 | $objectref = dol_sanitizeFileName($object->ref); |
| 235 | - $dir = $conf->propal->dir_output . "/" . $objectref; |
|
| 236 | - $file = $dir . "/" . $objectref . ".pdf"; |
|
| 235 | + $dir = $conf->propal->dir_output."/".$objectref; |
|
| 236 | + $file = $dir."/".$objectref.".pdf"; |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | - if (! file_exists($dir)) |
|
| 239 | + if (!file_exists($dir)) |
|
| 240 | 240 | { |
| 241 | 241 | if (dol_mkdir($dir) < 0) |
| 242 | 242 | { |
| 243 | - $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); |
|
| 243 | + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); |
|
| 244 | 244 | return 0; |
| 245 | 245 | } |
| 246 | 246 | } |
@@ -248,23 +248,23 @@ discard block |
||
| 248 | 248 | if (file_exists($dir)) |
| 249 | 249 | { |
| 250 | 250 | // Add pdfgeneration hook |
| 251 | - if (! is_object($hookmanager)) |
|
| 251 | + if (!is_object($hookmanager)) |
|
| 252 | 252 | { |
| 253 | 253 | include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
| 254 | - $hookmanager=new HookManager($this->db); |
|
| 254 | + $hookmanager = new HookManager($this->db); |
|
| 255 | 255 | } |
| 256 | 256 | $hookmanager->initHooks(array('pdfgeneration')); |
| 257 | - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); |
|
| 257 | + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); |
|
| 258 | 258 | global $action; |
| 259 | - $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
| 259 | + $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 260 | 260 | |
| 261 | 261 | // Create pdf instance |
| 262 | - $pdf=pdf_getInstance($this->format); |
|
| 263 | - $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
| 264 | - $heightforinfotot = 50; // Height reserved to output the info and total part |
|
| 265 | - $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page |
|
| 266 | - $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
| 267 | - $pdf->SetAutoPageBreak(1,0); |
|
| 262 | + $pdf = pdf_getInstance($this->format); |
|
| 263 | + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
| 264 | + $heightforinfotot = 50; // Height reserved to output the info and total part |
|
| 265 | + $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page |
|
| 266 | + $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
| 267 | + $pdf->SetAutoPageBreak(1, 0); |
|
| 268 | 268 | |
| 269 | 269 | if (class_exists('TCPDF')) |
| 270 | 270 | { |
@@ -273,27 +273,27 @@ discard block |
||
| 273 | 273 | } |
| 274 | 274 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
| 275 | 275 | // Set path to the background PDF File |
| 276 | - if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
| 276 | + if (empty($conf->global->MAIN_DISABLE_FPDI) && !empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
| 277 | 277 | { |
| 278 | 278 | $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); |
| 279 | 279 | $tplidx = $pdf->importPage(1); |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | $pdf->Open(); |
| 283 | - $pagenb=0; |
|
| 284 | - $pdf->SetDrawColor(128,128,128); |
|
| 283 | + $pagenb = 0; |
|
| 284 | + $pdf->SetDrawColor(128, 128, 128); |
|
| 285 | 285 | |
| 286 | 286 | $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); |
| 287 | 287 | $pdf->SetSubject($outputlangs->transnoentities("CommercialProposal")); |
| 288 | 288 | $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
| 289 | 289 | $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
| 290 | 290 | $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("CommercialProposal")); |
| 291 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 291 | + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 292 | 292 | |
| 293 | - $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
|
| 293 | + $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
|
| 294 | 294 | |
| 295 | 295 | // Positionne $this->atleastonediscount si on a au moins une remise |
| 296 | - for ($i = 0 ; $i < $nblignes ; $i++) |
|
| 296 | + for ($i = 0; $i < $nblignes; $i++) |
|
| 297 | 297 | { |
| 298 | 298 | if ($object->lines[$i]->remise_percent) |
| 299 | 299 | { |
@@ -302,60 +302,60 @@ discard block |
||
| 302 | 302 | } |
| 303 | 303 | if (empty($this->atleastonediscount)) |
| 304 | 304 | { |
| 305 | - $this->posxpicture+=($this->postotalht - $this->posxdiscount); |
|
| 306 | - $this->posxtva+=($this->postotalht - $this->posxdiscount); |
|
| 307 | - $this->posxup+=($this->postotalht - $this->posxdiscount); |
|
| 308 | - $this->posxqty+=($this->postotalht - $this->posxdiscount); |
|
| 309 | - $this->posxdiscount+=($this->postotalht - $this->posxdiscount); |
|
| 305 | + $this->posxpicture += ($this->postotalht - $this->posxdiscount); |
|
| 306 | + $this->posxtva += ($this->postotalht - $this->posxdiscount); |
|
| 307 | + $this->posxup += ($this->postotalht - $this->posxdiscount); |
|
| 308 | + $this->posxqty += ($this->postotalht - $this->posxdiscount); |
|
| 309 | + $this->posxdiscount += ($this->postotalht - $this->posxdiscount); |
|
| 310 | 310 | //$this->postotalht; |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | // New page |
| 314 | 314 | $pdf->AddPage(); |
| 315 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 315 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 316 | 316 | $pagenb++; |
| 317 | 317 | $this->_pagehead($pdf, $object, 1, $outputlangs); |
| 318 | - $pdf->SetFont('','', $default_font_size - 1); |
|
| 319 | - $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
| 320 | - $pdf->SetTextColor(0,0,0); |
|
| 318 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 319 | + $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
| 320 | + $pdf->SetTextColor(0, 0, 0); |
|
| 321 | 321 | |
| 322 | 322 | $tab_top = 90; |
| 323 | - $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); |
|
| 323 | + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10); |
|
| 324 | 324 | $tab_height = 130; |
| 325 | 325 | $tab_height_newpage = 150; |
| 326 | 326 | |
| 327 | 327 | // Affiche notes |
| 328 | - $notetoshow=empty($object->note_public)?'':$object->note_public; |
|
| 329 | - if (! empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) |
|
| 328 | + $notetoshow = empty($object->note_public) ? '' : $object->note_public; |
|
| 329 | + if (!empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) |
|
| 330 | 330 | { |
| 331 | 331 | // Get first sale rep |
| 332 | 332 | if (is_object($object->thirdparty)) |
| 333 | 333 | { |
| 334 | - $salereparray=$object->thirdparty->getSalesRepresentatives($user); |
|
| 335 | - $salerepobj=new User($this->db); |
|
| 334 | + $salereparray = $object->thirdparty->getSalesRepresentatives($user); |
|
| 335 | + $salerepobj = new User($this->db); |
|
| 336 | 336 | $salerepobj->fetch($salereparray[0]['id']); |
| 337 | - if (! empty($salerepobj->signature)) $notetoshow=dol_concatdesc($notetoshow, $salerepobj->signature); |
|
| 337 | + if (!empty($salerepobj->signature)) $notetoshow = dol_concatdesc($notetoshow, $salerepobj->signature); |
|
| 338 | 338 | } |
| 339 | 339 | } |
| 340 | 340 | if ($notetoshow) |
| 341 | 341 | { |
| 342 | 342 | $tab_top = 88; |
| 343 | 343 | |
| 344 | - $pdf->SetFont('','', $default_font_size - 1); |
|
| 345 | - $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1); |
|
| 344 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 345 | + $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1); |
|
| 346 | 346 | $nexY = $pdf->GetY(); |
| 347 | - $height_note=$nexY-$tab_top; |
|
| 347 | + $height_note = $nexY - $tab_top; |
|
| 348 | 348 | |
| 349 | 349 | // Rect prend une longueur en 3eme param |
| 350 | - $pdf->SetDrawColor(192,192,192); |
|
| 351 | - $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1); |
|
| 350 | + $pdf->SetDrawColor(192, 192, 192); |
|
| 351 | + $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1); |
|
| 352 | 352 | |
| 353 | 353 | $tab_height = $tab_height - $height_note; |
| 354 | - $tab_top = $nexY+6; |
|
| 354 | + $tab_top = $nexY + 6; |
|
| 355 | 355 | } |
| 356 | 356 | else |
| 357 | 357 | { |
| 358 | - $height_note=0; |
|
| 358 | + $height_note = 0; |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | $iniY = $tab_top + 7; |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | $TStack = array(); |
| 370 | 370 | |
| 371 | 371 | // Loop on each lines |
| 372 | - for ($i = 0 ; $i < $nblignes ; $i++) |
|
| 372 | + for ($i = 0; $i < $nblignes; $i++) |
|
| 373 | 373 | { |
| 374 | 374 | $package_qty = $TStack[count($TStack) - 1]['package_qty']; |
| 375 | 375 | $inPackage = count($TStack) > 0; |
@@ -433,94 +433,94 @@ discard block |
||
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | $curY = $nexY; |
| 436 | - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage |
|
| 437 | - $pdf->SetTextColor(0,0,0); |
|
| 436 | + $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage |
|
| 437 | + $pdf->SetTextColor(0, 0, 0); |
|
| 438 | 438 | |
| 439 | 439 | // Define size of image if we need it |
| 440 | - $imglinesize=array(); |
|
| 441 | - if (! empty($realpatharray[$i])) $imglinesize=pdf_getSizeForImage($realpatharray[$i]); |
|
| 440 | + $imglinesize = array(); |
|
| 441 | + if (!empty($realpatharray[$i])) $imglinesize = pdf_getSizeForImage($realpatharray[$i]); |
|
| 442 | 442 | |
| 443 | 443 | $pdf->setTopMargin($tab_top_newpage); |
| 444 | - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
|
| 445 | - $pageposbefore=$pdf->getPage(); |
|
| 444 | + $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
|
| 445 | + $pageposbefore = $pdf->getPage(); |
|
| 446 | 446 | |
| 447 | - $showpricebeforepagebreak=1; |
|
| 448 | - $posYAfterImage=0; |
|
| 449 | - $posYAfterDescription=0; |
|
| 447 | + $showpricebeforepagebreak = 1; |
|
| 448 | + $posYAfterImage = 0; |
|
| 449 | + $posYAfterDescription = 0; |
|
| 450 | 450 | |
| 451 | 451 | // We start with Photo of product line |
| 452 | - if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur-($heightforfooter+$heightforfreetext+$heightforinfotot))) // If photo too high, we moved completely on new page |
|
| 452 | + if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // If photo too high, we moved completely on new page |
|
| 453 | 453 | { |
| 454 | - $pdf->AddPage('','',true); |
|
| 455 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 454 | + $pdf->AddPage('', '', true); |
|
| 455 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 456 | 456 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
| 457 | - $pdf->setPage($pageposbefore+1); |
|
| 457 | + $pdf->setPage($pageposbefore + 1); |
|
| 458 | 458 | |
| 459 | 459 | $curY = $tab_top_newpage; |
| 460 | - $showpricebeforepagebreak=0; |
|
| 460 | + $showpricebeforepagebreak = 0; |
|
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | if (isset($imglinesize['width']) && isset($imglinesize['height'])) |
| 464 | 464 | { |
| 465 | - $curX = $this->posxpicture-1; |
|
| 466 | - $pdf->Image($realpatharray[$i], $curX + (($this->posxtva-$this->posxpicture-$imglinesize['width'])/2), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi |
|
| 465 | + $curX = $this->posxpicture - 1; |
|
| 466 | + $pdf->Image($realpatharray[$i], $curX + (($this->posxtva - $this->posxpicture - $imglinesize['width']) / 2), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi |
|
| 467 | 467 | // $pdf->Image does not increase value return by getY, so we save it manually |
| 468 | - $posYAfterImage=$curY+$imglinesize['height']; |
|
| 468 | + $posYAfterImage = $curY + $imglinesize['height']; |
|
| 469 | 469 | } |
| 470 | 470 | |
| 471 | 471 | // Description of product line |
| 472 | - $curX = $this->posxdesc-1; |
|
| 472 | + $curX = $this->posxdesc - 1; |
|
| 473 | 473 | |
| 474 | 474 | $pdf->startTransaction(); |
| 475 | - pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc); |
|
| 475 | + pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxpicture - $curX, 3, $curX, $curY, $hideref, $hidedesc); |
|
| 476 | 476 | |
| 477 | - $pageposafter=$pdf->getPage(); |
|
| 477 | + $pageposafter = $pdf->getPage(); |
|
| 478 | 478 | if ($pageposafter > $pageposbefore) // There is a pagebreak |
| 479 | 479 | { |
| 480 | 480 | $pdf->rollbackTransaction(true); |
| 481 | - $pageposafter=$pageposbefore; |
|
| 481 | + $pageposafter = $pageposbefore; |
|
| 482 | 482 | //print $pageposafter.'-'.$pageposbefore;exit; |
| 483 | - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
| 484 | - pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc); |
|
| 483 | + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
| 484 | + pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxpicture - $curX, 3, $curX, $curY, $hideref, $hidedesc); |
|
| 485 | 485 | |
| 486 | - $pageposafter=$pdf->getPage(); |
|
| 487 | - $posyafter=$pdf->GetY(); |
|
| 486 | + $pageposafter = $pdf->getPage(); |
|
| 487 | + $posyafter = $pdf->GetY(); |
|
| 488 | 488 | //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; |
| 489 | - if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text |
|
| 489 | + if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // There is no space left for total+free text |
|
| 490 | 490 | { |
| 491 | - if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page |
|
| 491 | + if ($i == ($nblignes - 1)) // No more lines, and no space left to show total, so we create a new page |
|
| 492 | 492 | { |
| 493 | - $pdf->AddPage('','',true); |
|
| 494 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 493 | + $pdf->AddPage('', '', true); |
|
| 494 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 495 | 495 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
| 496 | - $pdf->setPage($pageposafter+1); |
|
| 496 | + $pdf->setPage($pageposafter + 1); |
|
| 497 | 497 | } |
| 498 | 498 | } |
| 499 | 499 | else |
| 500 | 500 | { |
| 501 | 501 | // We found a page break |
| 502 | - $showpricebeforepagebreak=0; |
|
| 502 | + $showpricebeforepagebreak = 0; |
|
| 503 | 503 | } |
| 504 | 504 | } |
| 505 | 505 | else // No pagebreak |
| 506 | 506 | { |
| 507 | 507 | $pdf->commitTransaction(); |
| 508 | 508 | } |
| 509 | - $posYAfterDescription=$pdf->GetY(); |
|
| 509 | + $posYAfterDescription = $pdf->GetY(); |
|
| 510 | 510 | |
| 511 | 511 | $nexY = $pdf->GetY(); |
| 512 | - $pageposafter=$pdf->getPage(); |
|
| 512 | + $pageposafter = $pdf->getPage(); |
|
| 513 | 513 | |
| 514 | 514 | $pdf->setPage($pageposbefore); |
| 515 | 515 | $pdf->setTopMargin($this->marge_haute); |
| 516 | - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
| 516 | + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
| 517 | 517 | |
| 518 | 518 | // We suppose that a too long description or photo were moved completely on next page |
| 519 | 519 | if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { |
| 520 | 520 | $pdf->setPage($pageposafter); $curY = $tab_top_newpage; |
| 521 | 521 | } |
| 522 | 522 | |
| 523 | - $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut |
|
| 523 | + $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut |
|
| 524 | 524 | |
| 525 | 525 | // VAT Rate |
| 526 | 526 | if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) |
@@ -533,7 +533,7 @@ discard block |
||
| 533 | 533 | } |
| 534 | 534 | |
| 535 | 535 | $pdf->SetXY($this->posxtva, $curY); |
| 536 | - $pdf->MultiCell($this->posxup-$this->posxtva-0.8, 3, $vat_rate, 0, 'R'); |
|
| 536 | + $pdf->MultiCell($this->posxup - $this->posxtva - 0.8, 3, $vat_rate, 0, 'R'); |
|
| 537 | 537 | } |
| 538 | 538 | |
| 539 | 539 | // Unit price before discount |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | $pdf->SetXY($this->posxup, $curY); |
| 547 | - $pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, $up_excl_tax, 0, 'R', 0); |
|
| 547 | + $pdf->MultiCell($this->posxqty - $this->posxup - 0.8, 3, $up_excl_tax, 0, 'R', 0); |
|
| 548 | 548 | |
| 549 | 549 | // Booléen pour déterminer s'il s'agit d'une ligne de titre ou non |
| 550 | 550 | $isTitle = false; |
@@ -568,14 +568,14 @@ discard block |
||
| 568 | 568 | } |
| 569 | 569 | |
| 570 | 570 | $pdf->SetXY($this->posxqty, $curY); |
| 571 | - $pdf->MultiCell($this->posxdiscount-$this->posxqty-0.8, 3, $qty, 0, 'R'); // Enough for 6 chars |
|
| 571 | + $pdf->MultiCell($this->posxdiscount - $this->posxqty - 0.8, 3, $qty, 0, 'R'); // Enough for 6 chars |
|
| 572 | 572 | |
| 573 | 573 | // Discount on line |
| 574 | 574 | if ($object->lines[$i]->remise_percent) |
| 575 | 575 | { |
| 576 | - $pdf->SetXY($this->posxdiscount-2, $curY); |
|
| 576 | + $pdf->SetXY($this->posxdiscount - 2, $curY); |
|
| 577 | 577 | $remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails); |
| 578 | - $pdf->MultiCell($this->postotalht-$this->posxdiscount+2, 3, $remise_percent, 0, 'R'); |
|
| 578 | + $pdf->MultiCell($this->postotalht - $this->posxdiscount + 2, 3, $remise_percent, 0, 'R'); |
|
| 579 | 579 | } |
| 580 | 580 | |
| 581 | 581 | // Total HT line |
@@ -586,40 +586,40 @@ discard block |
||
| 586 | 586 | } |
| 587 | 587 | |
| 588 | 588 | $pdf->SetXY($this->postotalht, $curY); |
| 589 | - $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0); |
|
| 589 | + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, $total_excl_tax, 0, 'R', 0); |
|
| 590 | 590 | |
| 591 | 591 | // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva |
| 592 | - $tvaligne=$object->lines[$i]->total_tva; |
|
| 593 | - $localtax1ligne=$object->lines[$i]->total_localtax1; |
|
| 594 | - $localtax2ligne=$object->lines[$i]->total_localtax2; |
|
| 595 | - $localtax1_rate=$object->lines[$i]->localtax1_tx; |
|
| 596 | - $localtax2_rate=$object->lines[$i]->localtax2_tx; |
|
| 597 | - $localtax1_type=$object->lines[$i]->localtax1_type; |
|
| 598 | - $localtax2_type=$object->lines[$i]->localtax2_type; |
|
| 592 | + $tvaligne = $object->lines[$i]->total_tva; |
|
| 593 | + $localtax1ligne = $object->lines[$i]->total_localtax1; |
|
| 594 | + $localtax2ligne = $object->lines[$i]->total_localtax2; |
|
| 595 | + $localtax1_rate = $object->lines[$i]->localtax1_tx; |
|
| 596 | + $localtax2_rate = $object->lines[$i]->localtax2_tx; |
|
| 597 | + $localtax1_type = $object->lines[$i]->localtax1_type; |
|
| 598 | + $localtax2_type = $object->lines[$i]->localtax2_type; |
|
| 599 | 599 | |
| 600 | - if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100; |
|
| 601 | - if ($object->remise_percent) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100; |
|
| 602 | - if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100; |
|
| 600 | + if ($object->remise_percent) $tvaligne -= ($tvaligne * $object->remise_percent) / 100; |
|
| 601 | + if ($object->remise_percent) $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100; |
|
| 602 | + if ($object->remise_percent) $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100; |
|
| 603 | 603 | |
| 604 | - $vatrate=(string) $object->lines[$i]->tva_tx; |
|
| 604 | + $vatrate = (string) $object->lines[$i]->tva_tx; |
|
| 605 | 605 | |
| 606 | 606 | // Retrieve type from database for backward compatibility with old records |
| 607 | - if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined |
|
| 608 | - && (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax |
|
| 607 | + if ((!isset($localtax1_type) || $localtax1_type == '' || !isset($localtax2_type) || $localtax2_type == '') // if tax type not defined |
|
| 608 | + && (!empty($localtax1_rate) || !empty($localtax2_rate))) // and there is local tax |
|
| 609 | 609 | { |
| 610 | - $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$object->thirdparty,$mysoc); |
|
| 610 | + $localtaxtmp_array = getLocalTaxesFromRate($vatrate, 0, $object->thirdparty, $mysoc); |
|
| 611 | 611 | $localtax1_type = $localtaxtmp_array[0]; |
| 612 | 612 | $localtax2_type = $localtaxtmp_array[2]; |
| 613 | 613 | } |
| 614 | 614 | |
| 615 | 615 | // retrieve global local tax |
| 616 | 616 | if ($localtax1_type && $localtax1ligne != 0) |
| 617 | - $this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne; |
|
| 617 | + $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne; |
|
| 618 | 618 | if ($localtax2_type && $localtax2ligne != 0) |
| 619 | - $this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne; |
|
| 619 | + $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne; |
|
| 620 | 620 | |
| 621 | - if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*'; |
|
| 622 | - if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=''; |
|
| 621 | + if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate .= '*'; |
|
| 622 | + if (!isset($this->tva[$vatrate])) $this->tva[$vatrate] = ''; |
|
| 623 | 623 | |
| 624 | 624 | if (!empty($object->lines[$i]->TTotal_tva)) |
| 625 | 625 | { |
@@ -633,19 +633,19 @@ discard block |
||
| 633 | 633 | $this->tva[$vatrate] += $tvaligne; |
| 634 | 634 | } |
| 635 | 635 | |
| 636 | - if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage; |
|
| 636 | + if ($posYAfterImage > $posYAfterDescription) $nexY = $posYAfterImage; |
|
| 637 | 637 | |
| 638 | 638 | // Add line |
| 639 | - if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) |
|
| 639 | + if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) |
|
| 640 | 640 | { |
| 641 | 641 | $pdf->setPage($pageposafter); |
| 642 | - $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210))); |
|
| 642 | + $pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(210, 210, 210))); |
|
| 643 | 643 | //$pdf->SetDrawColor(190,190,200); |
| 644 | - $pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1); |
|
| 644 | + $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1); |
|
| 645 | 645 | $pdf->SetLineStyle(array('dash'=>0)); |
| 646 | 646 | } |
| 647 | 647 | |
| 648 | - $nexY+=2; // Passe espace entre les lignes |
|
| 648 | + $nexY += 2; // Passe espace entre les lignes |
|
| 649 | 649 | |
| 650 | 650 | // Detect if some page were added automatically and output _tableau for past pages |
| 651 | 651 | while ($pagenb < $pageposafter) |
@@ -659,13 +659,13 @@ discard block |
||
| 659 | 659 | { |
| 660 | 660 | $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); |
| 661 | 661 | } |
| 662 | - $this->_pagefoot($pdf,$object,$outputlangs,1); |
|
| 662 | + $this->_pagefoot($pdf, $object, $outputlangs, 1); |
|
| 663 | 663 | $pagenb++; |
| 664 | 664 | $pdf->setPage($pagenb); |
| 665 | - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
| 665 | + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
| 666 | 666 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
| 667 | 667 | } |
| 668 | - if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) |
|
| 668 | + if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) |
|
| 669 | 669 | { |
| 670 | 670 | if ($pagenb == 1) |
| 671 | 671 | { |
@@ -675,10 +675,10 @@ discard block |
||
| 675 | 675 | { |
| 676 | 676 | $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); |
| 677 | 677 | } |
| 678 | - $this->_pagefoot($pdf,$object,$outputlangs,1); |
|
| 678 | + $this->_pagefoot($pdf, $object, $outputlangs, 1); |
|
| 679 | 679 | // New page |
| 680 | 680 | $pdf->AddPage(); |
| 681 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 681 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 682 | 682 | $pagenb++; |
| 683 | 683 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
| 684 | 684 | } |
@@ -688,20 +688,20 @@ discard block |
||
| 688 | 688 | if ($pagenb == 1) |
| 689 | 689 | { |
| 690 | 690 | $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); |
| 691 | - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
|
| 691 | + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
|
| 692 | 692 | } |
| 693 | 693 | else |
| 694 | 694 | { |
| 695 | 695 | $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); |
| 696 | - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
|
| 696 | + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
|
| 697 | 697 | } |
| 698 | 698 | |
| 699 | 699 | // Affiche zone infos |
| 700 | - $posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs); |
|
| 700 | + $posy = $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs); |
|
| 701 | 701 | |
| 702 | 702 | if (!$conf->global->SUBTOTAL_HIDE_DOCUMENT_TOTAL) { |
| 703 | 703 | // Affiche zone totaux |
| 704 | - $posy=$this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs); |
|
| 704 | + $posy = $this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs); |
|
| 705 | 705 | } |
| 706 | 706 | |
| 707 | 707 | // Affiche zone versements |
@@ -713,38 +713,38 @@ discard block |
||
| 713 | 713 | */ |
| 714 | 714 | |
| 715 | 715 | // Pied de page |
| 716 | - $this->_pagefoot($pdf,$object,$outputlangs); |
|
| 717 | - if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); |
|
| 716 | + $this->_pagefoot($pdf, $object, $outputlangs); |
|
| 717 | + if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); |
|
| 718 | 718 | |
| 719 | 719 | $pdf->Close(); |
| 720 | 720 | |
| 721 | - $pdf->Output($file,'F'); |
|
| 721 | + $pdf->Output($file, 'F'); |
|
| 722 | 722 | |
| 723 | 723 | //Add pdfgeneration hook |
| 724 | 724 | $hookmanager->initHooks(array('pdfgeneration')); |
| 725 | - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); |
|
| 725 | + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); |
|
| 726 | 726 | global $action; |
| 727 | - $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
|
| 727 | + $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
| 728 | 728 | |
| 729 | - if (! empty($conf->global->MAIN_UMASK)) |
|
| 729 | + if (!empty($conf->global->MAIN_UMASK)) |
|
| 730 | 730 | @chmod($file, octdec($conf->global->MAIN_UMASK)); |
| 731 | 731 | |
| 732 | - return 1; // Pas d'erreur |
|
| 732 | + return 1; // Pas d'erreur |
|
| 733 | 733 | } |
| 734 | 734 | else |
| 735 | 735 | { |
| 736 | - $this->error=$langs->trans("ErrorCanNotCreateDir",$dir); |
|
| 736 | + $this->error = $langs->trans("ErrorCanNotCreateDir", $dir); |
|
| 737 | 737 | return 0; |
| 738 | 738 | } |
| 739 | 739 | } |
| 740 | 740 | else |
| 741 | 741 | { |
| 742 | - $this->error=$langs->trans("ErrorConstantNotDefined","PROP_OUTPUTDIR"); |
|
| 742 | + $this->error = $langs->trans("ErrorConstantNotDefined", "PROP_OUTPUTDIR"); |
|
| 743 | 743 | return 0; |
| 744 | 744 | } |
| 745 | 745 | |
| 746 | - $this->error=$langs->trans("ErrorUnknown"); |
|
| 747 | - return 0; // Erreur par defaut |
|
| 746 | + $this->error = $langs->trans("ErrorUnknown"); |
|
| 747 | + return 0; // Erreur par defaut |
|
| 748 | 748 | } |
| 749 | 749 | |
| 750 | 750 | /** |
@@ -776,66 +776,66 @@ discard block |
||
| 776 | 776 | global $conf; |
| 777 | 777 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
| 778 | 778 | |
| 779 | - $pdf->SetFont('','', $default_font_size - 1); |
|
| 779 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 780 | 780 | |
| 781 | 781 | // If France, show VAT mention if not applicable |
| 782 | 782 | if ($this->emetteur->country_code == 'FR' && $this->franchise == 1) |
| 783 | 783 | { |
| 784 | - $pdf->SetFont('','B', $default_font_size - 2); |
|
| 784 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
| 785 | 785 | $pdf->SetXY($this->marge_gauche, $posy); |
| 786 | 786 | $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); |
| 787 | 787 | |
| 788 | - $posy=$pdf->GetY()+4; |
|
| 788 | + $posy = $pdf->GetY() + 4; |
|
| 789 | 789 | } |
| 790 | 790 | |
| 791 | - $posxval=52; |
|
| 791 | + $posxval = 52; |
|
| 792 | 792 | |
| 793 | 793 | // Show shipping date |
| 794 | - if (! empty($object->date_livraison)) |
|
| 794 | + if (!empty($object->date_livraison)) |
|
| 795 | 795 | { |
| 796 | 796 | $outputlangs->load("sendings"); |
| 797 | - $pdf->SetFont('','B', $default_font_size - 2); |
|
| 797 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
| 798 | 798 | $pdf->SetXY($this->marge_gauche, $posy); |
| 799 | 799 | $titre = $outputlangs->transnoentities("DateDeliveryPlanned").':'; |
| 800 | 800 | $pdf->MultiCell(80, 4, $titre, 0, 'L'); |
| 801 | - $pdf->SetFont('','', $default_font_size - 2); |
|
| 801 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
| 802 | 802 | $pdf->SetXY($posxval, $posy); |
| 803 | - $dlp=dol_print_date($object->date_livraison,"daytext",false,$outputlangs,true); |
|
| 803 | + $dlp = dol_print_date($object->date_livraison, "daytext", false, $outputlangs, true); |
|
| 804 | 804 | $pdf->MultiCell(80, 4, $dlp, 0, 'L'); |
| 805 | 805 | |
| 806 | - $posy=$pdf->GetY()+1; |
|
| 806 | + $posy = $pdf->GetY() + 1; |
|
| 807 | 807 | } |
| 808 | 808 | elseif ($object->availability_code || $object->availability) // Show availability conditions |
| 809 | 809 | { |
| 810 | - $pdf->SetFont('','B', $default_font_size - 2); |
|
| 810 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
| 811 | 811 | $pdf->SetXY($this->marge_gauche, $posy); |
| 812 | 812 | $titre = $outputlangs->transnoentities("AvailabilityPeriod").':'; |
| 813 | 813 | $pdf->MultiCell(80, 4, $titre, 0, 'L'); |
| 814 | - $pdf->SetTextColor(0,0,0); |
|
| 815 | - $pdf->SetFont('','', $default_font_size - 2); |
|
| 814 | + $pdf->SetTextColor(0, 0, 0); |
|
| 815 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
| 816 | 816 | $pdf->SetXY($posxval, $posy); |
| 817 | - $lib_availability=$outputlangs->transnoentities("AvailabilityType".$object->availability_code)!=('AvailabilityType'.$object->availability_code)?$outputlangs->transnoentities("AvailabilityType".$object->availability_code):$outputlangs->convToOutputCharset($object->availability); |
|
| 818 | - $lib_availability=str_replace('\n',"\n",$lib_availability); |
|
| 817 | + $lib_availability = $outputlangs->transnoentities("AvailabilityType".$object->availability_code) != ('AvailabilityType'.$object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : $outputlangs->convToOutputCharset($object->availability); |
|
| 818 | + $lib_availability = str_replace('\n', "\n", $lib_availability); |
|
| 819 | 819 | $pdf->MultiCell(80, 4, $lib_availability, 0, 'L'); |
| 820 | 820 | |
| 821 | - $posy=$pdf->GetY()+1; |
|
| 821 | + $posy = $pdf->GetY() + 1; |
|
| 822 | 822 | } |
| 823 | 823 | |
| 824 | 824 | // Show payments conditions |
| 825 | 825 | if (empty($conf->global->PROPALE_PDF_HIDE_PAYMENTTERMCOND) && ($object->cond_reglement_code || $object->cond_reglement)) |
| 826 | 826 | { |
| 827 | - $pdf->SetFont('','B', $default_font_size - 2); |
|
| 827 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
| 828 | 828 | $pdf->SetXY($this->marge_gauche, $posy); |
| 829 | 829 | $titre = $outputlangs->transnoentities("PaymentConditions").':'; |
| 830 | 830 | $pdf->MultiCell(80, 4, $titre, 0, 'L'); |
| 831 | 831 | |
| 832 | - $pdf->SetFont('','', $default_font_size - 2); |
|
| 832 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
| 833 | 833 | $pdf->SetXY($posxval, $posy); |
| 834 | - $lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement_doc); |
|
| 835 | - $lib_condition_paiement=str_replace('\n',"\n",$lib_condition_paiement); |
|
| 836 | - $pdf->MultiCell(80, 4, $lib_condition_paiement,0,'L'); |
|
| 834 | + $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc); |
|
| 835 | + $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement); |
|
| 836 | + $pdf->MultiCell(80, 4, $lib_condition_paiement, 0, 'L'); |
|
| 837 | 837 | |
| 838 | - $posy=$pdf->GetY()+3; |
|
| 838 | + $posy = $pdf->GetY() + 3; |
|
| 839 | 839 | } |
| 840 | 840 | |
| 841 | 841 | if (empty($conf->global->PROPALE_PDF_HIDE_PAYMENTTERMCOND)) |
@@ -861,25 +861,25 @@ discard block |
||
| 861 | 861 | && $object->mode_reglement_code != 'CHQ' |
| 862 | 862 | && $object->mode_reglement_code != 'VIR') |
| 863 | 863 | { |
| 864 | - $pdf->SetFont('','B', $default_font_size - 2); |
|
| 864 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
| 865 | 865 | $pdf->SetXY($this->marge_gauche, $posy); |
| 866 | 866 | $titre = $outputlangs->transnoentities("PaymentMode").':'; |
| 867 | 867 | $pdf->MultiCell(80, 5, $titre, 0, 'L'); |
| 868 | - $pdf->SetFont('','', $default_font_size - 2); |
|
| 868 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
| 869 | 869 | $pdf->SetXY($posxval, $posy); |
| 870 | - $lib_mode_reg=$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code)!=('PaymentType'.$object->mode_reglement_code)?$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code):$outputlangs->convToOutputCharset($object->mode_reglement); |
|
| 871 | - $pdf->MultiCell(80, 5, $lib_mode_reg,0,'L'); |
|
| 870 | + $lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement); |
|
| 871 | + $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L'); |
|
| 872 | 872 | |
| 873 | - $posy=$pdf->GetY()+2; |
|
| 873 | + $posy = $pdf->GetY() + 2; |
|
| 874 | 874 | } |
| 875 | 875 | |
| 876 | 876 | // Show payment mode CHQ |
| 877 | 877 | if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') |
| 878 | 878 | { |
| 879 | 879 | // Si mode reglement non force ou si force a CHQ |
| 880 | - if (! empty($conf->global->FACTURE_CHQ_NUMBER)) |
|
| 880 | + if (!empty($conf->global->FACTURE_CHQ_NUMBER)) |
|
| 881 | 881 | { |
| 882 | - $diffsizetitle=(empty($conf->global->PDF_DIFFSIZE_TITLE)?3:$conf->global->PDF_DIFFSIZE_TITLE); |
|
| 882 | + $diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE); |
|
| 883 | 883 | |
| 884 | 884 | if ($conf->global->FACTURE_CHQ_NUMBER > 0) |
| 885 | 885 | { |
@@ -887,31 +887,31 @@ discard block |
||
| 887 | 887 | $account->fetch($conf->global->FACTURE_CHQ_NUMBER); |
| 888 | 888 | |
| 889 | 889 | $pdf->SetXY($this->marge_gauche, $posy); |
| 890 | - $pdf->SetFont('','B', $default_font_size - $diffsizetitle); |
|
| 891 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$account->proprio),0,'L',0); |
|
| 892 | - $posy=$pdf->GetY()+1; |
|
| 890 | + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); |
|
| 891 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $account->proprio), 0, 'L', 0); |
|
| 892 | + $posy = $pdf->GetY() + 1; |
|
| 893 | 893 | |
| 894 | 894 | if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) |
| 895 | 895 | { |
| 896 | 896 | $pdf->SetXY($this->marge_gauche, $posy); |
| 897 | - $pdf->SetFont('','', $default_font_size - $diffsizetitle); |
|
| 897 | + $pdf->SetFont('', '', $default_font_size - $diffsizetitle); |
|
| 898 | 898 | $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0); |
| 899 | - $posy=$pdf->GetY()+2; |
|
| 899 | + $posy = $pdf->GetY() + 2; |
|
| 900 | 900 | } |
| 901 | 901 | } |
| 902 | 902 | if ($conf->global->FACTURE_CHQ_NUMBER == -1) |
| 903 | 903 | { |
| 904 | 904 | $pdf->SetXY($this->marge_gauche, $posy); |
| 905 | - $pdf->SetFont('','B', $default_font_size - $diffsizetitle); |
|
| 906 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$this->emetteur->name),0,'L',0); |
|
| 907 | - $posy=$pdf->GetY()+1; |
|
| 905 | + $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); |
|
| 906 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $this->emetteur->name), 0, 'L', 0); |
|
| 907 | + $posy = $pdf->GetY() + 1; |
|
| 908 | 908 | |
| 909 | 909 | if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) |
| 910 | 910 | { |
| 911 | 911 | $pdf->SetXY($this->marge_gauche, $posy); |
| 912 | - $pdf->SetFont('','', $default_font_size - $diffsizetitle); |
|
| 912 | + $pdf->SetFont('', '', $default_font_size - $diffsizetitle); |
|
| 913 | 913 | $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0); |
| 914 | - $posy=$pdf->GetY()+2; |
|
| 914 | + $posy = $pdf->GetY() + 2; |
|
| 915 | 915 | } |
| 916 | 916 | } |
| 917 | 917 | } |
@@ -920,18 +920,18 @@ discard block |
||
| 920 | 920 | // If payment mode not forced or forced to VIR, show payment with BAN |
| 921 | 921 | if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') |
| 922 | 922 | { |
| 923 | - if (! empty($object->fk_bank) || ! empty($conf->global->FACTURE_RIB_NUMBER)) |
|
| 923 | + if (!empty($object->fk_bank) || !empty($conf->global->FACTURE_RIB_NUMBER)) |
|
| 924 | 924 | { |
| 925 | - $bankid=(empty($object->fk_bank)?$conf->global->FACTURE_RIB_NUMBER:$object->fk_bank); |
|
| 925 | + $bankid = (empty($object->fk_bank) ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_bank); |
|
| 926 | 926 | $account = new Account($this->db); |
| 927 | 927 | $account->fetch($bankid); |
| 928 | 928 | |
| 929 | - $curx=$this->marge_gauche; |
|
| 930 | - $cury=$posy; |
|
| 929 | + $curx = $this->marge_gauche; |
|
| 930 | + $cury = $posy; |
|
| 931 | 931 | |
| 932 | - $posy=pdf_bank($pdf,$outputlangs,$curx,$cury,$account,0,$default_font_size); |
|
| 932 | + $posy = pdf_bank($pdf, $outputlangs, $curx, $cury, $account, 0, $default_font_size); |
|
| 933 | 933 | |
| 934 | - $posy+=2; |
|
| 934 | + $posy += 2; |
|
| 935 | 935 | } |
| 936 | 936 | } |
| 937 | 937 | } |
@@ -952,40 +952,40 @@ discard block |
||
| 952 | 952 | */ |
| 953 | 953 | function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) |
| 954 | 954 | { |
| 955 | - global $conf,$mysoc; |
|
| 955 | + global $conf, $mysoc; |
|
| 956 | 956 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
| 957 | 957 | |
| 958 | 958 | $tab2_top = $posy; |
| 959 | 959 | $tab2_hl = 4; |
| 960 | - $pdf->SetFont('','', $default_font_size - 1); |
|
| 960 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 961 | 961 | |
| 962 | 962 | // Tableau total |
| 963 | 963 | $col1x = 120; $col2x = 170; |
| 964 | 964 | if ($this->page_largeur < 210) // To work with US executive format |
| 965 | 965 | { |
| 966 | - $col2x-=20; |
|
| 966 | + $col2x -= 20; |
|
| 967 | 967 | } |
| 968 | 968 | $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x); |
| 969 | 969 | |
| 970 | - $useborder=0; |
|
| 970 | + $useborder = 0; |
|
| 971 | 971 | $index = 0; |
| 972 | 972 | |
| 973 | 973 | // Total HT |
| 974 | - $pdf->SetFillColor(255,255,255); |
|
| 974 | + $pdf->SetFillColor(255, 255, 255); |
|
| 975 | 975 | $pdf->SetXY($col1x, $tab2_top + 0); |
| 976 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); |
|
| 976 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); |
|
| 977 | 977 | |
| 978 | 978 | $pdf->SetXY($col2x, $tab2_top + 0); |
| 979 | - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + (! empty($object->remise)?$object->remise:0), 0, $outputlangs), 0, 'R', 1); |
|
| 979 | + $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + (!empty($object->remise) ? $object->remise : 0), 0, $outputlangs), 0, 'R', 1); |
|
| 980 | 980 | |
| 981 | 981 | // Show VAT by rates and total |
| 982 | - $pdf->SetFillColor(248,248,248); |
|
| 982 | + $pdf->SetFillColor(248, 248, 248); |
|
| 983 | 983 | |
| 984 | - $this->atleastoneratenotnull=0; |
|
| 984 | + $this->atleastoneratenotnull = 0; |
|
| 985 | 985 | if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) |
| 986 | 986 | { |
| 987 | - $tvaisnull=((! empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false); |
|
| 988 | - if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_ISNULL) && $tvaisnull) |
|
| 987 | + $tvaisnull = ((!empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false); |
|
| 988 | + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_ISNULL) && $tvaisnull) |
|
| 989 | 989 | { |
| 990 | 990 | // Nothing to do |
| 991 | 991 | } |
@@ -994,28 +994,28 @@ discard block |
||
| 994 | 994 | //Local tax 1 before VAT |
| 995 | 995 | //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') |
| 996 | 996 | //{ |
| 997 | - foreach( $this->localtax1 as $localtax_type => $localtax_rate ) |
|
| 997 | + foreach ($this->localtax1 as $localtax_type => $localtax_rate) |
|
| 998 | 998 | { |
| 999 | - if (in_array((string) $localtax_type, array('1','3','5'))) continue; |
|
| 999 | + if (in_array((string) $localtax_type, array('1', '3', '5'))) continue; |
|
| 1000 | 1000 | |
| 1001 | - foreach( $localtax_rate as $tvakey => $tvaval ) |
|
| 1001 | + foreach ($localtax_rate as $tvakey => $tvaval) |
|
| 1002 | 1002 | { |
| 1003 | - if ($tvakey!=0) // On affiche pas taux 0 |
|
| 1003 | + if ($tvakey != 0) // On affiche pas taux 0 |
|
| 1004 | 1004 | { |
| 1005 | 1005 | //$this->atleastoneratenotnull++; |
| 1006 | 1006 | |
| 1007 | 1007 | $index++; |
| 1008 | 1008 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 1009 | 1009 | |
| 1010 | - $tvacompl=''; |
|
| 1011 | - if (preg_match('/\*/',$tvakey)) |
|
| 1010 | + $tvacompl = ''; |
|
| 1011 | + if (preg_match('/\*/', $tvakey)) |
|
| 1012 | 1012 | { |
| 1013 | - $tvakey=str_replace('*','',$tvakey); |
|
| 1013 | + $tvakey = str_replace('*', '', $tvakey); |
|
| 1014 | 1014 | $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; |
| 1015 | 1015 | } |
| 1016 | - $totalvat = $outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code).' '; |
|
| 1017 | - $totalvat.=vatrate(abs($tvakey),1).$tvacompl; |
|
| 1018 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 1016 | + $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; |
|
| 1017 | + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; |
|
| 1018 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 1019 | 1019 | |
| 1020 | 1020 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 1021 | 1021 | $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); |
@@ -1026,13 +1026,13 @@ discard block |
||
| 1026 | 1026 | //Local tax 2 before VAT |
| 1027 | 1027 | //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') |
| 1028 | 1028 | //{ |
| 1029 | - foreach( $this->localtax2 as $localtax_type => $localtax_rate ) |
|
| 1029 | + foreach ($this->localtax2 as $localtax_type => $localtax_rate) |
|
| 1030 | 1030 | { |
| 1031 | - if (in_array((string) $localtax_type, array('1','3','5'))) continue; |
|
| 1031 | + if (in_array((string) $localtax_type, array('1', '3', '5'))) continue; |
|
| 1032 | 1032 | |
| 1033 | - foreach( $localtax_rate as $tvakey => $tvaval ) |
|
| 1033 | + foreach ($localtax_rate as $tvakey => $tvaval) |
|
| 1034 | 1034 | { |
| 1035 | - if ($tvakey!=0) // On affiche pas taux 0 |
|
| 1035 | + if ($tvakey != 0) // On affiche pas taux 0 |
|
| 1036 | 1036 | { |
| 1037 | 1037 | //$this->atleastoneratenotnull++; |
| 1038 | 1038 | |
@@ -1041,15 +1041,15 @@ discard block |
||
| 1041 | 1041 | $index++; |
| 1042 | 1042 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 1043 | 1043 | |
| 1044 | - $tvacompl=''; |
|
| 1045 | - if (preg_match('/\*/',$tvakey)) |
|
| 1044 | + $tvacompl = ''; |
|
| 1045 | + if (preg_match('/\*/', $tvakey)) |
|
| 1046 | 1046 | { |
| 1047 | - $tvakey=str_replace('*','',$tvakey); |
|
| 1047 | + $tvakey = str_replace('*', '', $tvakey); |
|
| 1048 | 1048 | $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; |
| 1049 | 1049 | } |
| 1050 | 1050 | $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; |
| 1051 | - $totalvat.=vatrate(abs($tvakey),1).$tvacompl; |
|
| 1052 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 1051 | + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; |
|
| 1052 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 1053 | 1053 | |
| 1054 | 1054 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 1055 | 1055 | $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); |
@@ -1059,7 +1059,7 @@ discard block |
||
| 1059 | 1059 | } |
| 1060 | 1060 | //} |
| 1061 | 1061 | // VAT |
| 1062 | - foreach($this->tva as $tvakey => $tvaval) |
|
| 1062 | + foreach ($this->tva as $tvakey => $tvaval) |
|
| 1063 | 1063 | { |
| 1064 | 1064 | if ($tvakey > 0) // On affiche pas taux 0 |
| 1065 | 1065 | { |
@@ -1068,15 +1068,15 @@ discard block |
||
| 1068 | 1068 | $index++; |
| 1069 | 1069 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 1070 | 1070 | |
| 1071 | - $tvacompl=''; |
|
| 1072 | - if (preg_match('/\*/',$tvakey)) |
|
| 1071 | + $tvacompl = ''; |
|
| 1072 | + if (preg_match('/\*/', $tvakey)) |
|
| 1073 | 1073 | { |
| 1074 | - $tvakey=str_replace('*','',$tvakey); |
|
| 1074 | + $tvakey = str_replace('*', '', $tvakey); |
|
| 1075 | 1075 | $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; |
| 1076 | 1076 | } |
| 1077 | - $totalvat =$outputlangs->transnoentities("TotalVAT").' '; |
|
| 1078 | - $totalvat.=vatrate($tvakey,1).$tvacompl; |
|
| 1079 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 1077 | + $totalvat = $outputlangs->transnoentities("TotalVAT").' '; |
|
| 1078 | + $totalvat .= vatrate($tvakey, 1).$tvacompl; |
|
| 1079 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 1080 | 1080 | |
| 1081 | 1081 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 1082 | 1082 | $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); |
@@ -1086,11 +1086,11 @@ discard block |
||
| 1086 | 1086 | //Local tax 1 after VAT |
| 1087 | 1087 | //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') |
| 1088 | 1088 | //{ |
| 1089 | - foreach( $this->localtax1 as $localtax_type => $localtax_rate ) |
|
| 1089 | + foreach ($this->localtax1 as $localtax_type => $localtax_rate) |
|
| 1090 | 1090 | { |
| 1091 | - if (in_array((string) $localtax_type, array('2','4','6'))) continue; |
|
| 1091 | + if (in_array((string) $localtax_type, array('2', '4', '6'))) continue; |
|
| 1092 | 1092 | |
| 1093 | - foreach( $localtax_rate as $tvakey => $tvaval ) |
|
| 1093 | + foreach ($localtax_rate as $tvakey => $tvaval) |
|
| 1094 | 1094 | { |
| 1095 | 1095 | if ($tvakey != 0) // On affiche pas taux 0 |
| 1096 | 1096 | { |
@@ -1099,16 +1099,16 @@ discard block |
||
| 1099 | 1099 | $index++; |
| 1100 | 1100 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 1101 | 1101 | |
| 1102 | - $tvacompl=''; |
|
| 1103 | - if (preg_match('/\*/',$tvakey)) |
|
| 1102 | + $tvacompl = ''; |
|
| 1103 | + if (preg_match('/\*/', $tvakey)) |
|
| 1104 | 1104 | { |
| 1105 | - $tvakey=str_replace('*','',$tvakey); |
|
| 1105 | + $tvakey = str_replace('*', '', $tvakey); |
|
| 1106 | 1106 | $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; |
| 1107 | 1107 | } |
| 1108 | - $totalvat = $outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code).' '; |
|
| 1108 | + $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; |
|
| 1109 | 1109 | |
| 1110 | - $totalvat.=vatrate(abs($tvakey),1).$tvacompl; |
|
| 1111 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 1110 | + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; |
|
| 1111 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 1112 | 1112 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 1113 | 1113 | $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); |
| 1114 | 1114 | } |
@@ -1118,11 +1118,11 @@ discard block |
||
| 1118 | 1118 | //Local tax 2 after VAT |
| 1119 | 1119 | //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') |
| 1120 | 1120 | //{ |
| 1121 | - foreach( $this->localtax2 as $localtax_type => $localtax_rate ) |
|
| 1121 | + foreach ($this->localtax2 as $localtax_type => $localtax_rate) |
|
| 1122 | 1122 | { |
| 1123 | - if (in_array((string) $localtax_type, array('2','4','6'))) continue; |
|
| 1123 | + if (in_array((string) $localtax_type, array('2', '4', '6'))) continue; |
|
| 1124 | 1124 | |
| 1125 | - foreach( $localtax_rate as $tvakey => $tvaval ) |
|
| 1125 | + foreach ($localtax_rate as $tvakey => $tvaval) |
|
| 1126 | 1126 | { |
| 1127 | 1127 | // retrieve global local tax |
| 1128 | 1128 | if ($tvakey != 0) // On affiche pas taux 0 |
@@ -1132,16 +1132,16 @@ discard block |
||
| 1132 | 1132 | $index++; |
| 1133 | 1133 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 1134 | 1134 | |
| 1135 | - $tvacompl=''; |
|
| 1136 | - if (preg_match('/\*/',$tvakey)) |
|
| 1135 | + $tvacompl = ''; |
|
| 1136 | + if (preg_match('/\*/', $tvakey)) |
|
| 1137 | 1137 | { |
| 1138 | - $tvakey=str_replace('*','',$tvakey); |
|
| 1138 | + $tvakey = str_replace('*', '', $tvakey); |
|
| 1139 | 1139 | $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; |
| 1140 | 1140 | } |
| 1141 | - $totalvat = $outputlangs->transcountrynoentities("TotalLT2",$mysoc->country_code).' '; |
|
| 1141 | + $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; |
|
| 1142 | 1142 | |
| 1143 | - $totalvat.=vatrate(abs($tvakey),1).$tvacompl; |
|
| 1144 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 1143 | + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; |
|
| 1144 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 1145 | 1145 | |
| 1146 | 1146 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 1147 | 1147 | $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); |
@@ -1153,16 +1153,16 @@ discard block |
||
| 1153 | 1153 | // Total TTC |
| 1154 | 1154 | $index++; |
| 1155 | 1155 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 1156 | - $pdf->SetTextColor(0,0,60); |
|
| 1157 | - $pdf->SetFillColor(224,224,224); |
|
| 1158 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); |
|
| 1156 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1157 | + $pdf->SetFillColor(224, 224, 224); |
|
| 1158 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); |
|
| 1159 | 1159 | |
| 1160 | 1160 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 1161 | 1161 | $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc, 0, $outputlangs), $useborder, 'R', 1); |
| 1162 | 1162 | } |
| 1163 | 1163 | } |
| 1164 | 1164 | |
| 1165 | - $pdf->SetTextColor(0,0,0); |
|
| 1165 | + $pdf->SetTextColor(0, 0, 0); |
|
| 1166 | 1166 | |
| 1167 | 1167 | /* |
| 1168 | 1168 | $resteapayer = $object->total_ttc - $deja_regle; |
@@ -1174,7 +1174,7 @@ discard block |
||
| 1174 | 1174 | $index++; |
| 1175 | 1175 | |
| 1176 | 1176 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 1177 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("AlreadyPaid"), 0, 'L', 0); |
|
| 1177 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("AlreadyPaid"), 0, 'L', 0); |
|
| 1178 | 1178 | |
| 1179 | 1179 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 1180 | 1180 | $pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle, 0, $outputlangs), 0, 'R', 0); |
@@ -1196,16 +1196,16 @@ discard block |
||
| 1196 | 1196 | */ |
| 1197 | 1197 | |
| 1198 | 1198 | $index++; |
| 1199 | - $pdf->SetTextColor(0,0,60); |
|
| 1200 | - $pdf->SetFillColor(224,224,224); |
|
| 1199 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1200 | + $pdf->SetFillColor(224, 224, 224); |
|
| 1201 | 1201 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 1202 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1); |
|
| 1202 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1); |
|
| 1203 | 1203 | |
| 1204 | 1204 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 1205 | 1205 | $pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer, 0, $outputlangs), $useborder, 'R', 1); |
| 1206 | 1206 | |
| 1207 | - $pdf->SetFont('','', $default_font_size - 1); |
|
| 1208 | - $pdf->SetTextColor(0,0,0); |
|
| 1207 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 1208 | + $pdf->SetTextColor(0, 0, 0); |
|
| 1209 | 1209 | } |
| 1210 | 1210 | |
| 1211 | 1211 | $index++; |
@@ -1224,47 +1224,47 @@ discard block |
||
| 1224 | 1224 | * @param int $hidebottom Hide bottom bar of array |
| 1225 | 1225 | * @return void |
| 1226 | 1226 | */ |
| 1227 | - function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0) |
|
| 1227 | + function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0) |
|
| 1228 | 1228 | { |
| 1229 | 1229 | global $conf; |
| 1230 | 1230 | |
| 1231 | 1231 | // Force to disable hidetop and hidebottom |
| 1232 | - $hidebottom=0; |
|
| 1233 | - if ($hidetop) $hidetop=-1; |
|
| 1232 | + $hidebottom = 0; |
|
| 1233 | + if ($hidetop) $hidetop = -1; |
|
| 1234 | 1234 | |
| 1235 | 1235 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
| 1236 | 1236 | |
| 1237 | 1237 | // Amount in (at tab_top - 1) |
| 1238 | - $pdf->SetTextColor(0,0,0); |
|
| 1239 | - $pdf->SetFont('','',$default_font_size - 2); |
|
| 1238 | + $pdf->SetTextColor(0, 0, 0); |
|
| 1239 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
| 1240 | 1240 | |
| 1241 | 1241 | if (empty($hidetop)) |
| 1242 | 1242 | { |
| 1243 | - $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency)); |
|
| 1244 | - $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4); |
|
| 1243 | + $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$conf->currency)); |
|
| 1244 | + $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4); |
|
| 1245 | 1245 | $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); |
| 1246 | 1246 | |
| 1247 | 1247 | //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; |
| 1248 | - if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); |
|
| 1248 | + if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); |
|
| 1249 | 1249 | } |
| 1250 | 1250 | |
| 1251 | - $pdf->SetDrawColor(128,128,128); |
|
| 1252 | - $pdf->SetFont('','',$default_font_size - 1); |
|
| 1251 | + $pdf->SetDrawColor(128, 128, 128); |
|
| 1252 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 1253 | 1253 | |
| 1254 | 1254 | // Output Rect |
| 1255 | - $this->printRect($pdf,$this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param |
|
| 1255 | + $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param |
|
| 1256 | 1256 | |
| 1257 | 1257 | if (empty($hidetop)) |
| 1258 | 1258 | { |
| 1259 | - $pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); // line prend une position y en 2eme param et 4eme param |
|
| 1259 | + $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5); // line prend une position y en 2eme param et 4eme param |
|
| 1260 | 1260 | |
| 1261 | - $pdf->SetXY($this->posxdesc-1, $tab_top+1); |
|
| 1262 | - $pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L'); |
|
| 1261 | + $pdf->SetXY($this->posxdesc - 1, $tab_top + 1); |
|
| 1262 | + $pdf->MultiCell(108, 2, $outputlangs->transnoentities("Designation"), '', 'L'); |
|
| 1263 | 1263 | } |
| 1264 | 1264 | |
| 1265 | - if (! empty($conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE)) |
|
| 1265 | + if (!empty($conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE)) |
|
| 1266 | 1266 | { |
| 1267 | - $pdf->line($this->posxpicture-1, $tab_top, $this->posxpicture-1, $tab_top + $tab_height); |
|
| 1267 | + $pdf->line($this->posxpicture - 1, $tab_top, $this->posxpicture - 1, $tab_top + $tab_height); |
|
| 1268 | 1268 | if (empty($hidetop)) |
| 1269 | 1269 | { |
| 1270 | 1270 | //$pdf->SetXY($this->posxpicture-1, $tab_top+1); |
@@ -1274,35 +1274,35 @@ discard block |
||
| 1274 | 1274 | |
| 1275 | 1275 | if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) |
| 1276 | 1276 | { |
| 1277 | - $pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height); |
|
| 1277 | + $pdf->line($this->posxtva - 1, $tab_top, $this->posxtva - 1, $tab_top + $tab_height); |
|
| 1278 | 1278 | if (empty($hidetop)) |
| 1279 | 1279 | { |
| 1280 | - $pdf->SetXY($this->posxtva-3, $tab_top+1); |
|
| 1281 | - $pdf->MultiCell($this->posxup-$this->posxtva+3,2, $outputlangs->transnoentities("VAT"),'','C'); |
|
| 1280 | + $pdf->SetXY($this->posxtva - 3, $tab_top + 1); |
|
| 1281 | + $pdf->MultiCell($this->posxup - $this->posxtva + 3, 2, $outputlangs->transnoentities("VAT"), '', 'C'); |
|
| 1282 | 1282 | } |
| 1283 | 1283 | } |
| 1284 | 1284 | |
| 1285 | - $pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height); |
|
| 1285 | + $pdf->line($this->posxup - 1, $tab_top, $this->posxup - 1, $tab_top + $tab_height); |
|
| 1286 | 1286 | if (empty($hidetop)) |
| 1287 | 1287 | { |
| 1288 | - $pdf->SetXY($this->posxup-1, $tab_top+1); |
|
| 1289 | - $pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceUHT"),'','C'); |
|
| 1288 | + $pdf->SetXY($this->posxup - 1, $tab_top + 1); |
|
| 1289 | + $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities("PriceUHT"), '', 'C'); |
|
| 1290 | 1290 | } |
| 1291 | 1291 | |
| 1292 | - $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); |
|
| 1292 | + $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height); |
|
| 1293 | 1293 | if (empty($hidetop)) |
| 1294 | 1294 | { |
| 1295 | - $pdf->SetXY($this->posxqty-1, $tab_top+1); |
|
| 1296 | - $pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C'); |
|
| 1295 | + $pdf->SetXY($this->posxqty - 1, $tab_top + 1); |
|
| 1296 | + $pdf->MultiCell($this->posxdiscount - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C'); |
|
| 1297 | 1297 | } |
| 1298 | 1298 | |
| 1299 | - $pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height); |
|
| 1299 | + $pdf->line($this->posxdiscount - 1, $tab_top, $this->posxdiscount - 1, $tab_top + $tab_height); |
|
| 1300 | 1300 | if (empty($hidetop)) |
| 1301 | 1301 | { |
| 1302 | 1302 | if ($this->atleastonediscount) |
| 1303 | 1303 | { |
| 1304 | - $pdf->SetXY($this->posxdiscount-1, $tab_top+1); |
|
| 1305 | - $pdf->MultiCell($this->postotalht-$this->posxdiscount+1,2, $outputlangs->transnoentities("ReductionShort"),'','C'); |
|
| 1304 | + $pdf->SetXY($this->posxdiscount - 1, $tab_top + 1); |
|
| 1305 | + $pdf->MultiCell($this->postotalht - $this->posxdiscount + 1, 2, $outputlangs->transnoentities("ReductionShort"), '', 'C'); |
|
| 1306 | 1306 | } |
| 1307 | 1307 | } |
| 1308 | 1308 | if ($this->atleastonediscount) |
@@ -1311,8 +1311,8 @@ discard block |
||
| 1311 | 1311 | } |
| 1312 | 1312 | if (empty($hidetop)) |
| 1313 | 1313 | { |
| 1314 | - $pdf->SetXY($this->postotalht-1, $tab_top+1); |
|
| 1315 | - $pdf->MultiCell(30,2, $outputlangs->transnoentities("TotalHT"),'','C'); |
|
| 1314 | + $pdf->SetXY($this->postotalht - 1, $tab_top + 1); |
|
| 1315 | + $pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHT"), '', 'C'); |
|
| 1316 | 1316 | } |
| 1317 | 1317 | } |
| 1318 | 1318 | |
@@ -1327,7 +1327,7 @@ discard block |
||
| 1327 | 1327 | */ |
| 1328 | 1328 | function _pagehead(&$pdf, $object, $showaddress, $outputlangs) |
| 1329 | 1329 | { |
| 1330 | - global $conf,$langs; |
|
| 1330 | + global $conf, $langs; |
|
| 1331 | 1331 | |
| 1332 | 1332 | $outputlangs->load("main"); |
| 1333 | 1333 | $outputlangs->load("bills"); |
@@ -1336,87 +1336,87 @@ discard block |
||
| 1336 | 1336 | |
| 1337 | 1337 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
| 1338 | 1338 | |
| 1339 | - pdf_pagehead($pdf,$outputlangs,$this->page_hauteur); |
|
| 1339 | + pdf_pagehead($pdf, $outputlangs, $this->page_hauteur); |
|
| 1340 | 1340 | |
| 1341 | 1341 | // Show Draft Watermark |
| 1342 | - if($object->statut==0 && (! empty($conf->global->PROPALE_DRAFT_WATERMARK)) ) |
|
| 1342 | + if ($object->statut == 0 && (!empty($conf->global->PROPALE_DRAFT_WATERMARK))) |
|
| 1343 | 1343 | { |
| 1344 | - pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->PROPALE_DRAFT_WATERMARK); |
|
| 1344 | + pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->PROPALE_DRAFT_WATERMARK); |
|
| 1345 | 1345 | } |
| 1346 | 1346 | |
| 1347 | - $pdf->SetTextColor(0,0,60); |
|
| 1348 | - $pdf->SetFont('','B', $default_font_size + 3); |
|
| 1347 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1348 | + $pdf->SetFont('', 'B', $default_font_size + 3); |
|
| 1349 | 1349 | |
| 1350 | - $posy=$this->marge_haute; |
|
| 1351 | - $posx=$this->page_largeur-$this->marge_droite-100; |
|
| 1350 | + $posy = $this->marge_haute; |
|
| 1351 | + $posx = $this->page_largeur - $this->marge_droite - 100; |
|
| 1352 | 1352 | |
| 1353 | - $pdf->SetXY($this->marge_gauche,$posy); |
|
| 1353 | + $pdf->SetXY($this->marge_gauche, $posy); |
|
| 1354 | 1354 | |
| 1355 | 1355 | // Logo |
| 1356 | - $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; |
|
| 1356 | + $logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; |
|
| 1357 | 1357 | if ($this->emetteur->logo) |
| 1358 | 1358 | { |
| 1359 | 1359 | if (is_readable($logo)) |
| 1360 | 1360 | { |
| 1361 | - $height=pdf_getHeightForLogo($logo); |
|
| 1362 | - $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
| 1361 | + $height = pdf_getHeightForLogo($logo); |
|
| 1362 | + $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
| 1363 | 1363 | } |
| 1364 | 1364 | else |
| 1365 | 1365 | { |
| 1366 | - $pdf->SetTextColor(200,0,0); |
|
| 1367 | - $pdf->SetFont('','B',$default_font_size - 2); |
|
| 1368 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L'); |
|
| 1366 | + $pdf->SetTextColor(200, 0, 0); |
|
| 1367 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
| 1368 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); |
|
| 1369 | 1369 | $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); |
| 1370 | 1370 | } |
| 1371 | 1371 | } |
| 1372 | 1372 | else |
| 1373 | 1373 | { |
| 1374 | - $text=$this->emetteur->name; |
|
| 1374 | + $text = $this->emetteur->name; |
|
| 1375 | 1375 | $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); |
| 1376 | 1376 | } |
| 1377 | 1377 | |
| 1378 | - $pdf->SetFont('','B',$default_font_size + 3); |
|
| 1379 | - $pdf->SetXY($posx,$posy); |
|
| 1380 | - $pdf->SetTextColor(0,0,60); |
|
| 1381 | - $title=$outputlangs->transnoentities("CommercialProposal"); |
|
| 1378 | + $pdf->SetFont('', 'B', $default_font_size + 3); |
|
| 1379 | + $pdf->SetXY($posx, $posy); |
|
| 1380 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1381 | + $title = $outputlangs->transnoentities("CommercialProposal"); |
|
| 1382 | 1382 | $pdf->MultiCell(100, 4, $title, '', 'R'); |
| 1383 | 1383 | |
| 1384 | - $pdf->SetFont('','B',$default_font_size); |
|
| 1384 | + $pdf->SetFont('', 'B', $default_font_size); |
|
| 1385 | 1385 | |
| 1386 | - $posy+=5; |
|
| 1387 | - $pdf->SetXY($posx,$posy); |
|
| 1388 | - $pdf->SetTextColor(0,0,60); |
|
| 1389 | - $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : " . $outputlangs->convToOutputCharset($object->ref), '', 'R'); |
|
| 1386 | + $posy += 5; |
|
| 1387 | + $pdf->SetXY($posx, $posy); |
|
| 1388 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1389 | + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($object->ref), '', 'R'); |
|
| 1390 | 1390 | |
| 1391 | - $posy+=1; |
|
| 1392 | - $pdf->SetFont('','', $default_font_size - 2); |
|
| 1391 | + $posy += 1; |
|
| 1392 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
| 1393 | 1393 | |
| 1394 | 1394 | if ($object->ref_client) |
| 1395 | 1395 | { |
| 1396 | - $posy+=4; |
|
| 1397 | - $pdf->SetXY($posx,$posy); |
|
| 1398 | - $pdf->SetTextColor(0,0,60); |
|
| 1399 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : " . $outputlangs->convToOutputCharset($object->ref_client), '', 'R'); |
|
| 1396 | + $posy += 4; |
|
| 1397 | + $pdf->SetXY($posx, $posy); |
|
| 1398 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1399 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R'); |
|
| 1400 | 1400 | } |
| 1401 | 1401 | |
| 1402 | - $posy+=4; |
|
| 1403 | - $pdf->SetXY($posx,$posy); |
|
| 1404 | - $pdf->SetTextColor(0,0,60); |
|
| 1405 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->date,"day",false,$outputlangs,true), '', 'R'); |
|
| 1402 | + $posy += 4; |
|
| 1403 | + $pdf->SetXY($posx, $posy); |
|
| 1404 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1405 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R'); |
|
| 1406 | 1406 | |
| 1407 | - $posy+=4; |
|
| 1408 | - $pdf->SetXY($posx,$posy); |
|
| 1409 | - $pdf->SetTextColor(0,0,60); |
|
| 1410 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateEndPropal")." : " . dol_print_date($object->fin_validite,"day",false,$outputlangs,true), '', 'R'); |
|
| 1407 | + $posy += 4; |
|
| 1408 | + $pdf->SetXY($posx, $posy); |
|
| 1409 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1410 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateEndPropal")." : ".dol_print_date($object->fin_validite, "day", false, $outputlangs, true), '', 'R'); |
|
| 1411 | 1411 | if ($object->thirdparty->code_client) |
| 1412 | 1412 | { |
| 1413 | - $posy+=4; |
|
| 1414 | - $pdf->SetXY($posx,$posy); |
|
| 1415 | - $pdf->SetTextColor(0,0,60); |
|
| 1416 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); |
|
| 1413 | + $posy += 4; |
|
| 1414 | + $pdf->SetXY($posx, $posy); |
|
| 1415 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1416 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); |
|
| 1417 | 1417 | } |
| 1418 | 1418 | |
| 1419 | - $posy+=2; |
|
| 1419 | + $posy += 2; |
|
| 1420 | 1420 | |
| 1421 | 1421 | // Show list of linked objects |
| 1422 | 1422 | $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size); |
@@ -1424,95 +1424,95 @@ discard block |
||
| 1424 | 1424 | if ($showaddress) |
| 1425 | 1425 | { |
| 1426 | 1426 | // Sender properties |
| 1427 | - $carac_emetteur=''; |
|
| 1427 | + $carac_emetteur = ''; |
|
| 1428 | 1428 | // Add internal contact of proposal if defined |
| 1429 | - $arrayidcontact=$object->getIdContact('internal','SALESREPFOLL'); |
|
| 1429 | + $arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL'); |
|
| 1430 | 1430 | if (count($arrayidcontact) > 0) |
| 1431 | 1431 | { |
| 1432 | 1432 | $object->fetch_user($arrayidcontact[0]); |
| 1433 | - $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; |
|
| 1433 | + $carac_emetteur .= ($carac_emetteur ? "\n" : '').$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; |
|
| 1434 | 1434 | } |
| 1435 | 1435 | |
| 1436 | 1436 | $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty); |
| 1437 | 1437 | |
| 1438 | 1438 | // Show sender |
| 1439 | - $posy=42; |
|
| 1440 | - $posx=$this->marge_gauche; |
|
| 1441 | - if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80; |
|
| 1442 | - $hautcadre=40; |
|
| 1439 | + $posy = 42; |
|
| 1440 | + $posx = $this->marge_gauche; |
|
| 1441 | + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80; |
|
| 1442 | + $hautcadre = 40; |
|
| 1443 | 1443 | |
| 1444 | 1444 | // Show sender frame |
| 1445 | - $pdf->SetTextColor(0,0,0); |
|
| 1446 | - $pdf->SetFont('','', $default_font_size - 2); |
|
| 1447 | - $pdf->SetXY($posx,$posy-5); |
|
| 1448 | - $pdf->MultiCell(66,5, $outputlangs->transnoentities("BillFrom").":", 0, 'L'); |
|
| 1449 | - $pdf->SetXY($posx,$posy); |
|
| 1450 | - $pdf->SetFillColor(230,230,230); |
|
| 1445 | + $pdf->SetTextColor(0, 0, 0); |
|
| 1446 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
| 1447 | + $pdf->SetXY($posx, $posy - 5); |
|
| 1448 | + $pdf->MultiCell(66, 5, $outputlangs->transnoentities("BillFrom").":", 0, 'L'); |
|
| 1449 | + $pdf->SetXY($posx, $posy); |
|
| 1450 | + $pdf->SetFillColor(230, 230, 230); |
|
| 1451 | 1451 | $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1); |
| 1452 | - $pdf->SetTextColor(0,0,60); |
|
| 1452 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1453 | 1453 | |
| 1454 | 1454 | // Show sender name |
| 1455 | - $pdf->SetXY($posx+2,$posy+3); |
|
| 1456 | - $pdf->SetFont('','B', $default_font_size); |
|
| 1455 | + $pdf->SetXY($posx + 2, $posy + 3); |
|
| 1456 | + $pdf->SetFont('', 'B', $default_font_size); |
|
| 1457 | 1457 | $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); |
| 1458 | - $posy=$pdf->getY(); |
|
| 1458 | + $posy = $pdf->getY(); |
|
| 1459 | 1459 | |
| 1460 | 1460 | // Show sender information |
| 1461 | - $pdf->SetXY($posx+2,$posy); |
|
| 1462 | - $pdf->SetFont('','', $default_font_size - 1); |
|
| 1461 | + $pdf->SetXY($posx + 2, $posy); |
|
| 1462 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 1463 | 1463 | $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L'); |
| 1464 | 1464 | |
| 1465 | 1465 | |
| 1466 | 1466 | // If CUSTOMER contact defined, we use it |
| 1467 | - $usecontact=false; |
|
| 1468 | - $arrayidcontact=$object->getIdContact('external','CUSTOMER'); |
|
| 1467 | + $usecontact = false; |
|
| 1468 | + $arrayidcontact = $object->getIdContact('external', 'CUSTOMER'); |
|
| 1469 | 1469 | if (count($arrayidcontact) > 0) |
| 1470 | 1470 | { |
| 1471 | - $usecontact=true; |
|
| 1472 | - $result=$object->fetch_contact($arrayidcontact[0]); |
|
| 1471 | + $usecontact = true; |
|
| 1472 | + $result = $object->fetch_contact($arrayidcontact[0]); |
|
| 1473 | 1473 | } |
| 1474 | 1474 | |
| 1475 | 1475 | // Recipient name |
| 1476 | - if (! empty($usecontact)) |
|
| 1476 | + if (!empty($usecontact)) |
|
| 1477 | 1477 | { |
| 1478 | 1478 | // On peut utiliser le nom de la societe du contact |
| 1479 | - if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; |
|
| 1479 | + if (!empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; |
|
| 1480 | 1480 | else $socname = $object->thirdparty->name; |
| 1481 | - $carac_client_name=$outputlangs->convToOutputCharset($socname); |
|
| 1481 | + $carac_client_name = $outputlangs->convToOutputCharset($socname); |
|
| 1482 | 1482 | } |
| 1483 | 1483 | else |
| 1484 | 1484 | { |
| 1485 | - $carac_client_name=$outputlangs->convToOutputCharset($object->thirdparty->name); |
|
| 1485 | + $carac_client_name = $outputlangs->convToOutputCharset($object->thirdparty->name); |
|
| 1486 | 1486 | } |
| 1487 | 1487 | |
| 1488 | - $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,($usecontact?$object->contact:''),$usecontact,'target'); |
|
| 1488 | + $carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, 'target'); |
|
| 1489 | 1489 | |
| 1490 | 1490 | // Show recipient |
| 1491 | - $widthrecbox=100; |
|
| 1492 | - if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format |
|
| 1493 | - $posy=42; |
|
| 1494 | - $posx=$this->page_largeur-$this->marge_droite-$widthrecbox; |
|
| 1495 | - if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche; |
|
| 1491 | + $widthrecbox = 100; |
|
| 1492 | + if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format |
|
| 1493 | + $posy = 42; |
|
| 1494 | + $posx = $this->page_largeur - $this->marge_droite - $widthrecbox; |
|
| 1495 | + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche; |
|
| 1496 | 1496 | |
| 1497 | 1497 | // Show recipient frame |
| 1498 | - $pdf->SetTextColor(0,0,0); |
|
| 1499 | - $pdf->SetFont('','', $default_font_size - 2); |
|
| 1500 | - $pdf->SetXY($posx+2,$posy-5); |
|
| 1498 | + $pdf->SetTextColor(0, 0, 0); |
|
| 1499 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
| 1500 | + $pdf->SetXY($posx + 2, $posy - 5); |
|
| 1501 | 1501 | $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":", 0, 'L'); |
| 1502 | 1502 | $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre); |
| 1503 | 1503 | |
| 1504 | 1504 | // Show recipient name |
| 1505 | - $pdf->SetXY($posx+2,$posy+3); |
|
| 1506 | - $pdf->SetFont('','B', $default_font_size); |
|
| 1505 | + $pdf->SetXY($posx + 2, $posy + 3); |
|
| 1506 | + $pdf->SetFont('', 'B', $default_font_size); |
|
| 1507 | 1507 | $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L'); |
| 1508 | 1508 | |
| 1509 | 1509 | // Show recipient information |
| 1510 | - $pdf->SetFont('','', $default_font_size - 1); |
|
| 1511 | - $pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4)); |
|
| 1510 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 1511 | + $pdf->SetXY($posx + 2, $posy + 4 + (dol_nboflines_bis($carac_client_name, 50) * 4)); |
|
| 1512 | 1512 | $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); |
| 1513 | 1513 | } |
| 1514 | 1514 | |
| 1515 | - $pdf->SetTextColor(0,0,0); |
|
| 1515 | + $pdf->SetTextColor(0, 0, 0); |
|
| 1516 | 1516 | } |
| 1517 | 1517 | |
| 1518 | 1518 | /** |
@@ -1524,11 +1524,11 @@ discard block |
||
| 1524 | 1524 | * @param int $hidefreetext 1=Hide free text |
| 1525 | 1525 | * @return int Return height of bottom margin including footer text |
| 1526 | 1526 | */ |
| 1527 | - function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) |
|
| 1527 | + function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) |
|
| 1528 | 1528 | { |
| 1529 | - $showdetails=0; |
|
| 1530 | - $free_text = (float)DOL_VERSION > 3.8 ? 'PROPOSAL_FREE_TEXT' : 'PROPALE_FREE_TEXT'; |
|
| 1531 | - return pdf_pagefoot($pdf,$outputlangs,$free_text,$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); |
|
| 1529 | + $showdetails = 0; |
|
| 1530 | + $free_text = (float) DOL_VERSION > 3.8 ? 'PROPOSAL_FREE_TEXT' : 'PROPALE_FREE_TEXT'; |
|
| 1531 | + return pdf_pagefoot($pdf, $outputlangs, $free_text, $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); |
|
| 1532 | 1532 | } |
| 1533 | 1533 | |
| 1534 | 1534 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * \brief Fichier de la classe permettant de generer les commandes au modele Einstein |
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | -require_once DOL_DOCUMENT_ROOT .'/core/modules/commande/modules_commande.php'; |
|
| 29 | +require_once DOL_DOCUMENT_ROOT.'/core/modules/commande/modules_commande.php'; |
|
| 30 | 30 | require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
| 31 | 31 | require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
| 32 | 32 | require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | var $description; |
| 44 | 44 | var $type; |
| 45 | 45 | |
| 46 | - var $phpmin = array(4,3,0); // Minimum version of PHP required by module |
|
| 46 | + var $phpmin = array(4, 3, 0); // Minimum version of PHP required by module |
|
| 47 | 47 | var $version = 'dolibarr'; |
| 48 | 48 | |
| 49 | 49 | var $page_largeur; |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | var $marge_haute; |
| 55 | 55 | var $marge_basse; |
| 56 | 56 | |
| 57 | - var $emetteur; // Objet societe qui emet |
|
| 57 | + var $emetteur; // Objet societe qui emet |
|
| 58 | 58 | |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | function __construct($db) |
| 66 | 66 | { |
| 67 | - global $conf,$langs,$mysoc; |
|
| 67 | + global $conf, $langs, $mysoc; |
|
| 68 | 68 | |
| 69 | 69 | $langs->load("main"); |
| 70 | 70 | $langs->load("bills"); |
@@ -76,56 +76,56 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | // Dimension page pour format A4 |
| 78 | 78 | $this->type = 'pdf'; |
| 79 | - $formatarray=pdf_getFormat(); |
|
| 79 | + $formatarray = pdf_getFormat(); |
|
| 80 | 80 | $this->page_largeur = $formatarray['width']; |
| 81 | 81 | $this->page_hauteur = $formatarray['height']; |
| 82 | - $this->format = array($this->page_largeur,$this->page_hauteur); |
|
| 83 | - $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10; |
|
| 84 | - $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10; |
|
| 85 | - $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10; |
|
| 86 | - $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10; |
|
| 87 | - |
|
| 88 | - $this->option_logo = 1; // Affiche logo |
|
| 89 | - $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION |
|
| 90 | - $this->option_modereg = 1; // Affiche mode reglement |
|
| 91 | - $this->option_condreg = 1; // Affiche conditions reglement |
|
| 92 | - $this->option_codeproduitservice = 1; // Affiche code produit-service |
|
| 93 | - $this->option_multilang = 1; // Dispo en plusieurs langues |
|
| 94 | - $this->option_escompte = 0; // Affiche si il y a eu escompte |
|
| 95 | - $this->option_credit_note = 0; // Support credit notes |
|
| 96 | - $this->option_freetext = 1; // Support add of a personalised text |
|
| 97 | - $this->option_draft_watermark = 1; // Support add of a watermark on drafts |
|
| 98 | - |
|
| 99 | - $this->franchise=!$mysoc->tva_assuj; |
|
| 82 | + $this->format = array($this->page_largeur, $this->page_hauteur); |
|
| 83 | + $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; |
|
| 84 | + $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; |
|
| 85 | + $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; |
|
| 86 | + $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; |
|
| 87 | + |
|
| 88 | + $this->option_logo = 1; // Affiche logo |
|
| 89 | + $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION |
|
| 90 | + $this->option_modereg = 1; // Affiche mode reglement |
|
| 91 | + $this->option_condreg = 1; // Affiche conditions reglement |
|
| 92 | + $this->option_codeproduitservice = 1; // Affiche code produit-service |
|
| 93 | + $this->option_multilang = 1; // Dispo en plusieurs langues |
|
| 94 | + $this->option_escompte = 0; // Affiche si il y a eu escompte |
|
| 95 | + $this->option_credit_note = 0; // Support credit notes |
|
| 96 | + $this->option_freetext = 1; // Support add of a personalised text |
|
| 97 | + $this->option_draft_watermark = 1; // Support add of a watermark on drafts |
|
| 98 | + |
|
| 99 | + $this->franchise = !$mysoc->tva_assuj; |
|
| 100 | 100 | |
| 101 | 101 | // Get source company |
| 102 | - $this->emetteur=$mysoc; |
|
| 103 | - if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if was not defined |
|
| 102 | + $this->emetteur = $mysoc; |
|
| 103 | + if (empty($this->emetteur->country_code)) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined |
|
| 104 | 104 | |
| 105 | 105 | // Define position of columns |
| 106 | - $this->posxdesc=$this->marge_gauche+1; |
|
| 107 | - $this->posxtva=112; |
|
| 108 | - $this->posxup=126; |
|
| 109 | - $this->posxqty=145; |
|
| 110 | - $this->posxdiscount=162; |
|
| 111 | - $this->postotalht=174; |
|
| 112 | - if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup; |
|
| 113 | - $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images |
|
| 106 | + $this->posxdesc = $this->marge_gauche + 1; |
|
| 107 | + $this->posxtva = 112; |
|
| 108 | + $this->posxup = 126; |
|
| 109 | + $this->posxqty = 145; |
|
| 110 | + $this->posxdiscount = 162; |
|
| 111 | + $this->postotalht = 174; |
|
| 112 | + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva = $this->posxup; |
|
| 113 | + $this->posxpicture = $this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images |
|
| 114 | 114 | if ($this->page_largeur < 210) // To work with US executive format |
| 115 | 115 | { |
| 116 | - $this->posxpicture-=20; |
|
| 117 | - $this->posxtva-=20; |
|
| 118 | - $this->posxup-=20; |
|
| 119 | - $this->posxqty-=20; |
|
| 120 | - $this->posxdiscount-=20; |
|
| 121 | - $this->postotalht-=20; |
|
| 116 | + $this->posxpicture -= 20; |
|
| 117 | + $this->posxtva -= 20; |
|
| 118 | + $this->posxup -= 20; |
|
| 119 | + $this->posxqty -= 20; |
|
| 120 | + $this->posxdiscount -= 20; |
|
| 121 | + $this->postotalht -= 20; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - $this->tva=array(); |
|
| 125 | - $this->localtax1=array(); |
|
| 126 | - $this->localtax2=array(); |
|
| 127 | - $this->atleastoneratenotnull=0; |
|
| 128 | - $this->atleastonediscount=0; |
|
| 124 | + $this->tva = array(); |
|
| 125 | + $this->localtax1 = array(); |
|
| 126 | + $this->localtax2 = array(); |
|
| 127 | + $this->atleastoneratenotnull = 0; |
|
| 128 | + $this->atleastonediscount = 0; |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
@@ -139,13 +139,13 @@ discard block |
||
| 139 | 139 | * @param int $hideref Do not show ref |
| 140 | 140 | * @return int 1=OK, 0=KO |
| 141 | 141 | */ |
| 142 | - function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) |
|
| 142 | + function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) |
|
| 143 | 143 | { |
| 144 | - global $user,$langs,$conf,$mysoc,$db,$hookmanager; |
|
| 144 | + global $user, $langs, $conf, $mysoc, $db, $hookmanager; |
|
| 145 | 145 | |
| 146 | - if (! is_object($outputlangs)) $outputlangs=$langs; |
|
| 146 | + if (!is_object($outputlangs)) $outputlangs = $langs; |
|
| 147 | 147 | // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO |
| 148 | - if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; |
|
| 148 | + if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1'; |
|
| 149 | 149 | |
| 150 | 150 | $outputlangs->load("main"); |
| 151 | 151 | $outputlangs->load("dict"); |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | if ($conf->commande->dir_output) |
| 161 | 161 | { |
| 162 | 162 | $object->fetch_thirdparty(); |
| 163 | - if(!empty($object->client) ){ |
|
| 163 | + if (!empty($object->client)) { |
|
| 164 | 164 | $object->thirdparty = $object->client; |
| 165 | 165 | } |
| 166 | 166 | $deja_regle = ""; |
@@ -169,20 +169,20 @@ discard block |
||
| 169 | 169 | if ($object->specimen) |
| 170 | 170 | { |
| 171 | 171 | $dir = $conf->commande->dir_output; |
| 172 | - $file = $dir . "/SPECIMEN.pdf"; |
|
| 172 | + $file = $dir."/SPECIMEN.pdf"; |
|
| 173 | 173 | } |
| 174 | 174 | else |
| 175 | 175 | { |
| 176 | 176 | $objectref = dol_sanitizeFileName($object->ref); |
| 177 | - $dir = $conf->commande->dir_output . "/" . $objectref; |
|
| 178 | - $file = $dir . "/" . $objectref . ".pdf"; |
|
| 177 | + $dir = $conf->commande->dir_output."/".$objectref; |
|
| 178 | + $file = $dir."/".$objectref.".pdf"; |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - if (! file_exists($dir)) |
|
| 181 | + if (!file_exists($dir)) |
|
| 182 | 182 | { |
| 183 | 183 | if (dol_mkdir($dir) < 0) |
| 184 | 184 | { |
| 185 | - $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); |
|
| 185 | + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); |
|
| 186 | 186 | return 0; |
| 187 | 187 | } |
| 188 | 188 | } |
@@ -190,23 +190,23 @@ discard block |
||
| 190 | 190 | if (file_exists($dir)) |
| 191 | 191 | { |
| 192 | 192 | // Add pdfgeneration hook |
| 193 | - if (! is_object($hookmanager)) |
|
| 193 | + if (!is_object($hookmanager)) |
|
| 194 | 194 | { |
| 195 | 195 | include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
| 196 | - $hookmanager=new HookManager($this->db); |
|
| 196 | + $hookmanager = new HookManager($this->db); |
|
| 197 | 197 | } |
| 198 | 198 | $hookmanager->initHooks(array('pdfgeneration')); |
| 199 | - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); |
|
| 199 | + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); |
|
| 200 | 200 | global $action; |
| 201 | - $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
| 201 | + $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 202 | 202 | |
| 203 | 203 | // Create pdf instance |
| 204 | - $pdf=pdf_getInstance($this->format); |
|
| 205 | - $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
| 206 | - $heightforinfotot = 50; // Height reserved to output the info and total part |
|
| 207 | - $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page |
|
| 208 | - $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
| 209 | - $pdf->SetAutoPageBreak(1,0); |
|
| 204 | + $pdf = pdf_getInstance($this->format); |
|
| 205 | + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
| 206 | + $heightforinfotot = 50; // Height reserved to output the info and total part |
|
| 207 | + $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page |
|
| 208 | + $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
| 209 | + $pdf->SetAutoPageBreak(1, 0); |
|
| 210 | 210 | |
| 211 | 211 | if (class_exists('TCPDF')) |
| 212 | 212 | { |
@@ -215,27 +215,27 @@ discard block |
||
| 215 | 215 | } |
| 216 | 216 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
| 217 | 217 | // Set path to the background PDF File |
| 218 | - if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
| 218 | + if (empty($conf->global->MAIN_DISABLE_FPDI) && !empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
| 219 | 219 | { |
| 220 | 220 | $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); |
| 221 | 221 | $tplidx = $pdf->importPage(1); |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | $pdf->Open(); |
| 225 | - $pagenb=0; |
|
| 226 | - $pdf->SetDrawColor(128,128,128); |
|
| 225 | + $pagenb = 0; |
|
| 226 | + $pdf->SetDrawColor(128, 128, 128); |
|
| 227 | 227 | |
| 228 | 228 | $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); |
| 229 | 229 | $pdf->SetSubject($outputlangs->transnoentities("Order")); |
| 230 | 230 | $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
| 231 | 231 | $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
| 232 | 232 | $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order")); |
| 233 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 233 | + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 234 | 234 | |
| 235 | - $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
|
| 235 | + $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
|
| 236 | 236 | |
| 237 | 237 | // Positionne $this->atleastonediscount si on a au moins une remise |
| 238 | - for ($i = 0 ; $i < $nblignes ; $i++) |
|
| 238 | + for ($i = 0; $i < $nblignes; $i++) |
|
| 239 | 239 | { |
| 240 | 240 | if ($object->lines[$i]->remise_percent) |
| 241 | 241 | { |
@@ -244,61 +244,61 @@ discard block |
||
| 244 | 244 | } |
| 245 | 245 | if (empty($this->atleastonediscount)) |
| 246 | 246 | { |
| 247 | - $this->posxpicture+=($this->postotalht - $this->posxdiscount); |
|
| 248 | - $this->posxtva+=($this->postotalht - $this->posxdiscount); |
|
| 249 | - $this->posxup+=($this->postotalht - $this->posxdiscount); |
|
| 250 | - $this->posxqty+=($this->postotalht - $this->posxdiscount); |
|
| 251 | - $this->posxdiscount+=($this->postotalht - $this->posxdiscount); |
|
| 247 | + $this->posxpicture += ($this->postotalht - $this->posxdiscount); |
|
| 248 | + $this->posxtva += ($this->postotalht - $this->posxdiscount); |
|
| 249 | + $this->posxup += ($this->postotalht - $this->posxdiscount); |
|
| 250 | + $this->posxqty += ($this->postotalht - $this->posxdiscount); |
|
| 251 | + $this->posxdiscount += ($this->postotalht - $this->posxdiscount); |
|
| 252 | 252 | //$this->postotalht; |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | // New page |
| 256 | 256 | $pdf->AddPage(); |
| 257 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 257 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 258 | 258 | $pagenb++; |
| 259 | 259 | $this->_pagehead($pdf, $object, 1, $outputlangs); |
| 260 | - $pdf->SetFont('','', $default_font_size - 1); |
|
| 261 | - $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
| 262 | - $pdf->SetTextColor(0,0,0); |
|
| 260 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 261 | + $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
| 262 | + $pdf->SetTextColor(0, 0, 0); |
|
| 263 | 263 | |
| 264 | 264 | |
| 265 | 265 | $tab_top = 90; |
| 266 | - $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); |
|
| 266 | + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10); |
|
| 267 | 267 | $tab_height = 130; |
| 268 | 268 | $tab_height_newpage = 150; |
| 269 | 269 | |
| 270 | 270 | // Affiche notes |
| 271 | - $notetoshow=empty($object->note_public)?'':$object->note_public; |
|
| 272 | - if (! empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) |
|
| 271 | + $notetoshow = empty($object->note_public) ? '' : $object->note_public; |
|
| 272 | + if (!empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) |
|
| 273 | 273 | { |
| 274 | 274 | // Get first sale rep |
| 275 | 275 | if (is_object($object->thirdparty)) |
| 276 | 276 | { |
| 277 | - $salereparray=$object->thirdparty->getSalesRepresentatives($user); |
|
| 278 | - $salerepobj=new User($this->db); |
|
| 277 | + $salereparray = $object->thirdparty->getSalesRepresentatives($user); |
|
| 278 | + $salerepobj = new User($this->db); |
|
| 279 | 279 | $salerepobj->fetch($salereparray[0]['id']); |
| 280 | - if (! empty($salerepobj->signature)) $notetoshow=dol_concatdesc($notetoshow, $salerepobj->signature); |
|
| 280 | + if (!empty($salerepobj->signature)) $notetoshow = dol_concatdesc($notetoshow, $salerepobj->signature); |
|
| 281 | 281 | } |
| 282 | 282 | } |
| 283 | 283 | if ($notetoshow) |
| 284 | 284 | { |
| 285 | 285 | $tab_top = 88; |
| 286 | 286 | |
| 287 | - $pdf->SetFont('','', $default_font_size - 1); |
|
| 288 | - $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1); |
|
| 287 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 288 | + $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1); |
|
| 289 | 289 | $nexY = $pdf->GetY(); |
| 290 | - $height_note=$nexY-$tab_top; |
|
| 290 | + $height_note = $nexY - $tab_top; |
|
| 291 | 291 | |
| 292 | 292 | // Rect prend une longueur en 3eme param |
| 293 | - $pdf->SetDrawColor(192,192,192); |
|
| 294 | - $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1); |
|
| 293 | + $pdf->SetDrawColor(192, 192, 192); |
|
| 294 | + $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1); |
|
| 295 | 295 | |
| 296 | 296 | $tab_height = $tab_height - $height_note; |
| 297 | - $tab_top = $nexY+6; |
|
| 297 | + $tab_top = $nexY + 6; |
|
| 298 | 298 | } |
| 299 | 299 | else |
| 300 | 300 | { |
| 301 | - $height_note=0; |
|
| 301 | + $height_note = 0; |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | $iniY = $tab_top + 7; |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | $TStack = array(); |
| 313 | 313 | |
| 314 | 314 | // Loop on each lines |
| 315 | - for ($i = 0 ; $i < $nblignes ; $i++) |
|
| 315 | + for ($i = 0; $i < $nblignes; $i++) |
|
| 316 | 316 | { |
| 317 | 317 | $package_qty = $TStack[count($TStack) - 1]['package_qty']; |
| 318 | 318 | $inPackage = count($TStack) > 0; |
@@ -376,44 +376,44 @@ discard block |
||
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | $curY = $nexY; |
| 379 | - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage |
|
| 380 | - $pdf->SetTextColor(0,0,0); |
|
| 379 | + $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage |
|
| 380 | + $pdf->SetTextColor(0, 0, 0); |
|
| 381 | 381 | |
| 382 | 382 | $pdf->setTopMargin($tab_top_newpage); |
| 383 | - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
|
| 384 | - $pageposbefore=$pdf->getPage(); |
|
| 383 | + $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
|
| 384 | + $pageposbefore = $pdf->getPage(); |
|
| 385 | 385 | |
| 386 | 386 | // Description of product line |
| 387 | - $curX = $this->posxdesc-1; |
|
| 387 | + $curX = $this->posxdesc - 1; |
|
| 388 | 388 | |
| 389 | - $showpricebeforepagebreak=1; |
|
| 389 | + $showpricebeforepagebreak = 1; |
|
| 390 | 390 | |
| 391 | 391 | $pdf->startTransaction(); |
| 392 | - pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc); |
|
| 393 | - $pageposafter=$pdf->getPage(); |
|
| 392 | + pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxtva - $curX, 3, $curX, $curY, $hideref, $hidedesc); |
|
| 393 | + $pageposafter = $pdf->getPage(); |
|
| 394 | 394 | if ($pageposafter > $pageposbefore) // There is a pagebreak |
| 395 | 395 | { |
| 396 | 396 | $pdf->rollbackTransaction(true); |
| 397 | - $pageposafter=$pageposbefore; |
|
| 397 | + $pageposafter = $pageposbefore; |
|
| 398 | 398 | //print $pageposafter.'-'.$pageposbefore;exit; |
| 399 | - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
| 400 | - pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc); |
|
| 401 | - $pageposafter=$pdf->getPage(); |
|
| 402 | - $posyafter=$pdf->GetY(); |
|
| 403 | - if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text |
|
| 399 | + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
| 400 | + pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxtva - $curX, 4, $curX, $curY, $hideref, $hidedesc); |
|
| 401 | + $pageposafter = $pdf->getPage(); |
|
| 402 | + $posyafter = $pdf->GetY(); |
|
| 403 | + if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // There is no space left for total+free text |
|
| 404 | 404 | { |
| 405 | - if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page |
|
| 405 | + if ($i == ($nblignes - 1)) // No more lines, and no space left to show total, so we create a new page |
|
| 406 | 406 | { |
| 407 | - $pdf->AddPage('','',true); |
|
| 408 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 407 | + $pdf->AddPage('', '', true); |
|
| 408 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 409 | 409 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
| 410 | - $pdf->setPage($pageposafter+1); |
|
| 410 | + $pdf->setPage($pageposafter + 1); |
|
| 411 | 411 | } |
| 412 | 412 | } |
| 413 | 413 | else |
| 414 | 414 | { |
| 415 | 415 | // We found a page break |
| 416 | - $showpricebeforepagebreak=0; |
|
| 416 | + $showpricebeforepagebreak = 0; |
|
| 417 | 417 | } |
| 418 | 418 | } |
| 419 | 419 | else // No pagebreak |
@@ -422,17 +422,17 @@ discard block |
||
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | $nexY = $pdf->GetY(); |
| 425 | - $pageposafter=$pdf->getPage(); |
|
| 425 | + $pageposafter = $pdf->getPage(); |
|
| 426 | 426 | $pdf->setPage($pageposbefore); |
| 427 | 427 | $pdf->setTopMargin($this->marge_haute); |
| 428 | - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
| 428 | + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
| 429 | 429 | |
| 430 | 430 | // We suppose that a too long description is moved completely on next page |
| 431 | 431 | if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { |
| 432 | 432 | $pdf->setPage($pageposafter); $curY = $tab_top_newpage; |
| 433 | 433 | } |
| 434 | 434 | |
| 435 | - $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut |
|
| 435 | + $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut |
|
| 436 | 436 | |
| 437 | 437 | // VAT Rate |
| 438 | 438 | if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | } |
| 446 | 446 | |
| 447 | 447 | $pdf->SetXY($this->posxtva, $curY); |
| 448 | - $pdf->MultiCell($this->posxup-$this->posxtva-0.8, 3, $vat_rate, 0, 'R'); |
|
| 448 | + $pdf->MultiCell($this->posxup - $this->posxtva - 0.8, 3, $vat_rate, 0, 'R'); |
|
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | // Unit price before discount |
@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | $pdf->SetXY($this->posxup, $curY); |
| 459 | - $pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, $up_excl_tax, 0, 'R', 0); |
|
| 459 | + $pdf->MultiCell($this->posxqty - $this->posxup - 0.8, 3, $up_excl_tax, 0, 'R', 0); |
|
| 460 | 460 | |
| 461 | 461 | // Booléen pour déterminer s'il s'agit d'une ligne de titre ou non |
| 462 | 462 | $isTitle = false; |
@@ -478,14 +478,14 @@ discard block |
||
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | $pdf->SetXY($this->posxqty, $curY); |
| 481 | - $pdf->MultiCell($this->posxdiscount-$this->posxqty-0.8, 3, $qty, 0, 'R'); // Enough for 6 chars |
|
| 481 | + $pdf->MultiCell($this->posxdiscount - $this->posxqty - 0.8, 3, $qty, 0, 'R'); // Enough for 6 chars |
|
| 482 | 482 | |
| 483 | 483 | // Discount on line |
| 484 | 484 | if ($object->lines[$i]->remise_percent) |
| 485 | 485 | { |
| 486 | - $pdf->SetXY($this->posxdiscount-2, $curY); |
|
| 486 | + $pdf->SetXY($this->posxdiscount - 2, $curY); |
|
| 487 | 487 | $remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails); |
| 488 | - $pdf->MultiCell($this->postotalht-$this->posxdiscount+2, 3, $remise_percent, 0, 'R'); |
|
| 488 | + $pdf->MultiCell($this->postotalht - $this->posxdiscount + 2, 3, $remise_percent, 0, 'R'); |
|
| 489 | 489 | } |
| 490 | 490 | |
| 491 | 491 | // Total HT line |
@@ -496,41 +496,41 @@ discard block |
||
| 496 | 496 | } |
| 497 | 497 | |
| 498 | 498 | $pdf->SetXY($this->postotalht, $curY); |
| 499 | - $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0); |
|
| 499 | + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, $total_excl_tax, 0, 'R', 0); |
|
| 500 | 500 | |
| 501 | 501 | // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva |
| 502 | - $tvaligne=$object->lines[$i]->total_tva; |
|
| 502 | + $tvaligne = $object->lines[$i]->total_tva; |
|
| 503 | 503 | |
| 504 | - $localtax1ligne=$object->lines[$i]->total_localtax1; |
|
| 505 | - $localtax2ligne=$object->lines[$i]->total_localtax2; |
|
| 506 | - $localtax1_rate=$object->lines[$i]->localtax1_tx; |
|
| 507 | - $localtax2_rate=$object->lines[$i]->localtax2_tx; |
|
| 508 | - $localtax1_type=$object->lines[$i]->localtax1_type; |
|
| 509 | - $localtax2_type=$object->lines[$i]->localtax2_type; |
|
| 504 | + $localtax1ligne = $object->lines[$i]->total_localtax1; |
|
| 505 | + $localtax2ligne = $object->lines[$i]->total_localtax2; |
|
| 506 | + $localtax1_rate = $object->lines[$i]->localtax1_tx; |
|
| 507 | + $localtax2_rate = $object->lines[$i]->localtax2_tx; |
|
| 508 | + $localtax1_type = $object->lines[$i]->localtax1_type; |
|
| 509 | + $localtax2_type = $object->lines[$i]->localtax2_type; |
|
| 510 | 510 | |
| 511 | - if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100; |
|
| 512 | - if ($object->remise_percent) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100; |
|
| 513 | - if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100; |
|
| 511 | + if ($object->remise_percent) $tvaligne -= ($tvaligne * $object->remise_percent) / 100; |
|
| 512 | + if ($object->remise_percent) $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100; |
|
| 513 | + if ($object->remise_percent) $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100; |
|
| 514 | 514 | |
| 515 | - $vatrate=(string) $object->lines[$i]->tva_tx; |
|
| 515 | + $vatrate = (string) $object->lines[$i]->tva_tx; |
|
| 516 | 516 | |
| 517 | 517 | // Retrieve type from database for backward compatibility with old records |
| 518 | - if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined |
|
| 519 | - && (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax |
|
| 518 | + if ((!isset($localtax1_type) || $localtax1_type == '' || !isset($localtax2_type) || $localtax2_type == '') // if tax type not defined |
|
| 519 | + && (!empty($localtax1_rate) || !empty($localtax2_rate))) // and there is local tax |
|
| 520 | 520 | { |
| 521 | - $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$object->thirdparty,$mysoc); |
|
| 521 | + $localtaxtmp_array = getLocalTaxesFromRate($vatrate, 0, $object->thirdparty, $mysoc); |
|
| 522 | 522 | $localtax1_type = $localtaxtmp_array[0]; |
| 523 | 523 | $localtax2_type = $localtaxtmp_array[2]; |
| 524 | 524 | } |
| 525 | 525 | |
| 526 | 526 | // retrieve global local tax |
| 527 | 527 | if ($localtax1_type && $localtax1ligne != 0) |
| 528 | - $this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne; |
|
| 528 | + $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne; |
|
| 529 | 529 | if ($localtax2_type && $localtax2ligne != 0) |
| 530 | - $this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne; |
|
| 530 | + $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne; |
|
| 531 | 531 | |
| 532 | - if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*'; |
|
| 533 | - if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=''; |
|
| 532 | + if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate .= '*'; |
|
| 533 | + if (!isset($this->tva[$vatrate])) $this->tva[$vatrate] = ''; |
|
| 534 | 534 | |
| 535 | 535 | if (!empty($object->lines[$i]->TTotal_tva)) |
| 536 | 536 | { |
@@ -545,16 +545,16 @@ discard block |
||
| 545 | 545 | } |
| 546 | 546 | |
| 547 | 547 | // Add line |
| 548 | - if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) |
|
| 548 | + if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) |
|
| 549 | 549 | { |
| 550 | 550 | $pdf->setPage($pageposafter); |
| 551 | - $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210))); |
|
| 551 | + $pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(210, 210, 210))); |
|
| 552 | 552 | //$pdf->SetDrawColor(190,190,200); |
| 553 | - $pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1); |
|
| 553 | + $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1); |
|
| 554 | 554 | $pdf->SetLineStyle(array('dash'=>0)); |
| 555 | 555 | } |
| 556 | 556 | |
| 557 | - $nexY+=2; // Passe espace entre les lignes |
|
| 557 | + $nexY += 2; // Passe espace entre les lignes |
|
| 558 | 558 | |
| 559 | 559 | // Detect if some page were added automatically and output _tableau for past pages |
| 560 | 560 | while ($pagenb < $pageposafter) |
@@ -568,13 +568,13 @@ discard block |
||
| 568 | 568 | { |
| 569 | 569 | $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); |
| 570 | 570 | } |
| 571 | - $this->_pagefoot($pdf,$object,$outputlangs,1); |
|
| 571 | + $this->_pagefoot($pdf, $object, $outputlangs, 1); |
|
| 572 | 572 | $pagenb++; |
| 573 | 573 | $pdf->setPage($pagenb); |
| 574 | - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
| 574 | + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
| 575 | 575 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
| 576 | 576 | } |
| 577 | - if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) |
|
| 577 | + if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) |
|
| 578 | 578 | { |
| 579 | 579 | if ($pagenb == 1) |
| 580 | 580 | { |
@@ -584,10 +584,10 @@ discard block |
||
| 584 | 584 | { |
| 585 | 585 | $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); |
| 586 | 586 | } |
| 587 | - $this->_pagefoot($pdf,$object,$outputlangs,1); |
|
| 587 | + $this->_pagefoot($pdf, $object, $outputlangs, 1); |
|
| 588 | 588 | // New page |
| 589 | 589 | $pdf->AddPage(); |
| 590 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 590 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 591 | 591 | $pagenb++; |
| 592 | 592 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
| 593 | 593 | } |
@@ -597,60 +597,60 @@ discard block |
||
| 597 | 597 | if ($pagenb == 1) |
| 598 | 598 | { |
| 599 | 599 | $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); |
| 600 | - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
|
| 600 | + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
|
| 601 | 601 | } |
| 602 | 602 | else |
| 603 | 603 | { |
| 604 | 604 | $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); |
| 605 | - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
|
| 605 | + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
|
| 606 | 606 | } |
| 607 | 607 | |
| 608 | 608 | // Affiche zone infos |
| 609 | - $posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs); |
|
| 609 | + $posy = $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs); |
|
| 610 | 610 | |
| 611 | 611 | if (!$conf->global->SUBTOTAL_HIDE_DOCUMENT_TOTAL) { |
| 612 | 612 | // Affiche zone totaux |
| 613 | - $posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); |
|
| 613 | + $posy = $this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); |
|
| 614 | 614 | } |
| 615 | 615 | |
| 616 | 616 | // Affiche zone versements |
| 617 | 617 | if ($deja_regle) |
| 618 | 618 | { |
| 619 | - $posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs); |
|
| 619 | + $posy = $this->_tableau_versements($pdf, $object, $posy, $outputlangs); |
|
| 620 | 620 | } |
| 621 | 621 | |
| 622 | 622 | // Pied de page |
| 623 | - $this->_pagefoot($pdf,$object,$outputlangs); |
|
| 624 | - if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); |
|
| 623 | + $this->_pagefoot($pdf, $object, $outputlangs); |
|
| 624 | + if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); |
|
| 625 | 625 | |
| 626 | 626 | $pdf->Close(); |
| 627 | 627 | |
| 628 | - $pdf->Output($file,'F'); |
|
| 628 | + $pdf->Output($file, 'F'); |
|
| 629 | 629 | |
| 630 | 630 | // Add pdfgeneration hook |
| 631 | 631 | $hookmanager->initHooks(array('pdfgeneration')); |
| 632 | - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); |
|
| 632 | + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); |
|
| 633 | 633 | global $action; |
| 634 | - $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
|
| 634 | + $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
| 635 | 635 | |
| 636 | - if (! empty($conf->global->MAIN_UMASK)) |
|
| 636 | + if (!empty($conf->global->MAIN_UMASK)) |
|
| 637 | 637 | @chmod($file, octdec($conf->global->MAIN_UMASK)); |
| 638 | 638 | |
| 639 | - return 1; // Pas d'erreur |
|
| 639 | + return 1; // Pas d'erreur |
|
| 640 | 640 | } |
| 641 | 641 | else |
| 642 | 642 | { |
| 643 | - $this->error=$langs->trans("ErrorCanNotCreateDir",$dir); |
|
| 643 | + $this->error = $langs->trans("ErrorCanNotCreateDir", $dir); |
|
| 644 | 644 | return 0; |
| 645 | 645 | } |
| 646 | 646 | } |
| 647 | 647 | else |
| 648 | 648 | { |
| 649 | - $this->error=$langs->trans("ErrorConstantNotDefined","COMMANDE_OUTPUTDIR"); |
|
| 649 | + $this->error = $langs->trans("ErrorConstantNotDefined", "COMMANDE_OUTPUTDIR"); |
|
| 650 | 650 | return 0; |
| 651 | 651 | } |
| 652 | - $this->error=$langs->trans("ErrorUnknown"); |
|
| 653 | - return 0; // Erreur par defaut |
|
| 652 | + $this->error = $langs->trans("ErrorUnknown"); |
|
| 653 | + return 0; // Erreur par defaut |
|
| 654 | 654 | } |
| 655 | 655 | |
| 656 | 656 | /** |
@@ -682,35 +682,35 @@ discard block |
||
| 682 | 682 | global $conf; |
| 683 | 683 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
| 684 | 684 | |
| 685 | - $pdf->SetFont('','', $default_font_size - 1); |
|
| 685 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 686 | 686 | |
| 687 | 687 | // If France, show VAT mention if not applicable |
| 688 | 688 | if ($this->emetteur->country_code == 'FR' && $this->franchise == 1) |
| 689 | 689 | { |
| 690 | - $pdf->SetFont('','B', $default_font_size - 2); |
|
| 690 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
| 691 | 691 | $pdf->SetXY($this->marge_gauche, $posy); |
| 692 | 692 | $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); |
| 693 | 693 | |
| 694 | - $posy=$pdf->GetY()+4; |
|
| 694 | + $posy = $pdf->GetY() + 4; |
|
| 695 | 695 | } |
| 696 | 696 | |
| 697 | - $posxval=52; |
|
| 697 | + $posxval = 52; |
|
| 698 | 698 | |
| 699 | 699 | // Show payments conditions |
| 700 | 700 | if ($object->cond_reglement_code || $object->cond_reglement) |
| 701 | 701 | { |
| 702 | - $pdf->SetFont('','B', $default_font_size - 2); |
|
| 702 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
| 703 | 703 | $pdf->SetXY($this->marge_gauche, $posy); |
| 704 | 704 | $titre = $outputlangs->transnoentities("PaymentConditions").':'; |
| 705 | 705 | $pdf->MultiCell(80, 4, $titre, 0, 'L'); |
| 706 | 706 | |
| 707 | - $pdf->SetFont('','', $default_font_size - 2); |
|
| 707 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
| 708 | 708 | $pdf->SetXY($posxval, $posy); |
| 709 | - $lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement_doc); |
|
| 710 | - $lib_condition_paiement=str_replace('\n',"\n",$lib_condition_paiement); |
|
| 711 | - $pdf->MultiCell(80, 4, $lib_condition_paiement,0,'L'); |
|
| 709 | + $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc); |
|
| 710 | + $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement); |
|
| 711 | + $pdf->MultiCell(80, 4, $lib_condition_paiement, 0, 'L'); |
|
| 712 | 712 | |
| 713 | - $posy=$pdf->GetY()+3; |
|
| 713 | + $posy = $pdf->GetY() + 3; |
|
| 714 | 714 | } |
| 715 | 715 | |
| 716 | 716 | // Check a payment mode is defined |
@@ -741,34 +741,34 @@ discard block |
||
| 741 | 741 | }*/ |
| 742 | 742 | |
| 743 | 743 | // Show planed date of delivery |
| 744 | - if (! empty($object->date_livraison)) |
|
| 744 | + if (!empty($object->date_livraison)) |
|
| 745 | 745 | { |
| 746 | 746 | $outputlangs->load("sendings"); |
| 747 | - $pdf->SetFont('','B', $default_font_size - 2); |
|
| 747 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
| 748 | 748 | $pdf->SetXY($this->marge_gauche, $posy); |
| 749 | 749 | $titre = $outputlangs->transnoentities("DateDeliveryPlanned").':'; |
| 750 | 750 | $pdf->MultiCell(80, 4, $titre, 0, 'L'); |
| 751 | - $pdf->SetFont('','', $default_font_size - 2); |
|
| 751 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
| 752 | 752 | $pdf->SetXY($posxval, $posy); |
| 753 | - $dlp=dol_print_date($object->date_livraison,"daytext",false,$outputlangs,true); |
|
| 753 | + $dlp = dol_print_date($object->date_livraison, "daytext", false, $outputlangs, true); |
|
| 754 | 754 | $pdf->MultiCell(80, 4, $dlp, 0, 'L'); |
| 755 | 755 | |
| 756 | - $posy=$pdf->GetY()+1; |
|
| 756 | + $posy = $pdf->GetY() + 1; |
|
| 757 | 757 | } |
| 758 | 758 | elseif ($object->availability_code || $object->availability) // Show availability conditions |
| 759 | 759 | { |
| 760 | - $pdf->SetFont('','B', $default_font_size - 2); |
|
| 760 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
| 761 | 761 | $pdf->SetXY($this->marge_gauche, $posy); |
| 762 | 762 | $titre = $outputlangs->transnoentities("AvailabilityPeriod").':'; |
| 763 | 763 | $pdf->MultiCell(80, 4, $titre, 0, 'L'); |
| 764 | - $pdf->SetTextColor(0,0,0); |
|
| 765 | - $pdf->SetFont('','', $default_font_size - 2); |
|
| 764 | + $pdf->SetTextColor(0, 0, 0); |
|
| 765 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
| 766 | 766 | $pdf->SetXY($posxval, $posy); |
| 767 | - $lib_availability=$outputlangs->transnoentities("AvailabilityType".$object->availability_code)!=('AvailabilityType'.$object->availability_code)?$outputlangs->transnoentities("AvailabilityType".$object->availability_code):$outputlangs->convToOutputCharset(isset($object->availability)?$object->availability:''); |
|
| 768 | - $lib_availability=str_replace('\n',"\n",$lib_availability); |
|
| 767 | + $lib_availability = $outputlangs->transnoentities("AvailabilityType".$object->availability_code) != ('AvailabilityType'.$object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : $outputlangs->convToOutputCharset(isset($object->availability) ? $object->availability : ''); |
|
| 768 | + $lib_availability = str_replace('\n', "\n", $lib_availability); |
|
| 769 | 769 | $pdf->MultiCell(80, 4, $lib_availability, 0, 'L'); |
| 770 | 770 | |
| 771 | - $posy=$pdf->GetY()+1; |
|
| 771 | + $posy = $pdf->GetY() + 1; |
|
| 772 | 772 | } |
| 773 | 773 | |
| 774 | 774 | // Show payment mode |
@@ -776,24 +776,24 @@ discard block |
||
| 776 | 776 | && $object->mode_reglement_code != 'CHQ' |
| 777 | 777 | && $object->mode_reglement_code != 'VIR') |
| 778 | 778 | { |
| 779 | - $pdf->SetFont('','B', $default_font_size - 2); |
|
| 779 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
| 780 | 780 | $pdf->SetXY($this->marge_gauche, $posy); |
| 781 | 781 | $titre = $outputlangs->transnoentities("PaymentMode").':'; |
| 782 | 782 | $pdf->MultiCell(80, 5, $titre, 0, 'L'); |
| 783 | 783 | |
| 784 | - $pdf->SetFont('','', $default_font_size - 2); |
|
| 784 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
| 785 | 785 | $pdf->SetXY($posxval, $posy); |
| 786 | - $lib_mode_reg=$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code)!=('PaymentType'.$object->mode_reglement_code)?$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code):$outputlangs->convToOutputCharset($object->mode_reglement); |
|
| 787 | - $pdf->MultiCell(80, 5, $lib_mode_reg,0,'L'); |
|
| 786 | + $lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement); |
|
| 787 | + $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L'); |
|
| 788 | 788 | |
| 789 | - $posy=$pdf->GetY()+2; |
|
| 789 | + $posy = $pdf->GetY() + 2; |
|
| 790 | 790 | } |
| 791 | 791 | |
| 792 | 792 | // Show payment mode CHQ |
| 793 | 793 | if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') |
| 794 | 794 | { |
| 795 | 795 | // Si mode reglement non force ou si force a CHQ |
| 796 | - if (! empty($conf->global->FACTURE_CHQ_NUMBER)) |
|
| 796 | + if (!empty($conf->global->FACTURE_CHQ_NUMBER)) |
|
| 797 | 797 | { |
| 798 | 798 | if ($conf->global->FACTURE_CHQ_NUMBER > 0) |
| 799 | 799 | { |
@@ -801,31 +801,31 @@ discard block |
||
| 801 | 801 | $account->fetch($conf->global->FACTURE_CHQ_NUMBER); |
| 802 | 802 | |
| 803 | 803 | $pdf->SetXY($this->marge_gauche, $posy); |
| 804 | - $pdf->SetFont('','B', $default_font_size - 3); |
|
| 805 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$account->proprio),0,'L',0); |
|
| 806 | - $posy=$pdf->GetY()+1; |
|
| 804 | + $pdf->SetFont('', 'B', $default_font_size - 3); |
|
| 805 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $account->proprio), 0, 'L', 0); |
|
| 806 | + $posy = $pdf->GetY() + 1; |
|
| 807 | 807 | |
| 808 | 808 | if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) |
| 809 | 809 | { |
| 810 | 810 | $pdf->SetXY($this->marge_gauche, $posy); |
| 811 | - $pdf->SetFont('','', $default_font_size - 3); |
|
| 811 | + $pdf->SetFont('', '', $default_font_size - 3); |
|
| 812 | 812 | $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0); |
| 813 | - $posy=$pdf->GetY()+2; |
|
| 813 | + $posy = $pdf->GetY() + 2; |
|
| 814 | 814 | } |
| 815 | 815 | } |
| 816 | 816 | if ($conf->global->FACTURE_CHQ_NUMBER == -1) |
| 817 | 817 | { |
| 818 | 818 | $pdf->SetXY($this->marge_gauche, $posy); |
| 819 | - $pdf->SetFont('','B', $default_font_size - 3); |
|
| 820 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$this->emetteur->name),0,'L',0); |
|
| 821 | - $posy=$pdf->GetY()+1; |
|
| 819 | + $pdf->SetFont('', 'B', $default_font_size - 3); |
|
| 820 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $this->emetteur->name), 0, 'L', 0); |
|
| 821 | + $posy = $pdf->GetY() + 1; |
|
| 822 | 822 | |
| 823 | 823 | if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) |
| 824 | 824 | { |
| 825 | 825 | $pdf->SetXY($this->marge_gauche, $posy); |
| 826 | - $pdf->SetFont('','', $default_font_size - 3); |
|
| 826 | + $pdf->SetFont('', '', $default_font_size - 3); |
|
| 827 | 827 | $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0); |
| 828 | - $posy=$pdf->GetY()+2; |
|
| 828 | + $posy = $pdf->GetY() + 2; |
|
| 829 | 829 | } |
| 830 | 830 | } |
| 831 | 831 | } |
@@ -834,18 +834,18 @@ discard block |
||
| 834 | 834 | // If payment mode not forced or forced to VIR, show payment with BAN |
| 835 | 835 | if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') |
| 836 | 836 | { |
| 837 | - if (! empty($object->fk_bank) || ! empty($conf->global->FACTURE_RIB_NUMBER)) |
|
| 837 | + if (!empty($object->fk_bank) || !empty($conf->global->FACTURE_RIB_NUMBER)) |
|
| 838 | 838 | { |
| 839 | - $bankid=(empty($object->fk_bank)?$conf->global->FACTURE_RIB_NUMBER:$object->fk_bank); |
|
| 839 | + $bankid = (empty($object->fk_bank) ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_bank); |
|
| 840 | 840 | $account = new Account($this->db); |
| 841 | 841 | $account->fetch($bankid); |
| 842 | 842 | |
| 843 | - $curx=$this->marge_gauche; |
|
| 844 | - $cury=$posy; |
|
| 843 | + $curx = $this->marge_gauche; |
|
| 844 | + $cury = $posy; |
|
| 845 | 845 | |
| 846 | - $posy=pdf_bank($pdf,$outputlangs,$curx,$cury,$account,0,$default_font_size); |
|
| 846 | + $posy = pdf_bank($pdf, $outputlangs, $curx, $cury, $account, 0, $default_font_size); |
|
| 847 | 847 | |
| 848 | - $posy+=2; |
|
| 848 | + $posy += 2; |
|
| 849 | 849 | } |
| 850 | 850 | } |
| 851 | 851 | |
@@ -865,41 +865,41 @@ discard block |
||
| 865 | 865 | */ |
| 866 | 866 | function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) |
| 867 | 867 | { |
| 868 | - global $conf,$mysoc; |
|
| 868 | + global $conf, $mysoc; |
|
| 869 | 869 | |
| 870 | 870 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
| 871 | 871 | |
| 872 | 872 | $tab2_top = $posy; |
| 873 | 873 | $tab2_hl = 4; |
| 874 | - $pdf->SetFont('','', $default_font_size - 1); |
|
| 874 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 875 | 875 | |
| 876 | 876 | // Tableau total |
| 877 | 877 | $col1x = 120; $col2x = 170; |
| 878 | 878 | if ($this->page_largeur < 210) // To work with US executive format |
| 879 | 879 | { |
| 880 | - $col2x-=20; |
|
| 880 | + $col2x -= 20; |
|
| 881 | 881 | } |
| 882 | 882 | $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x); |
| 883 | 883 | |
| 884 | - $useborder=0; |
|
| 884 | + $useborder = 0; |
|
| 885 | 885 | $index = 0; |
| 886 | 886 | |
| 887 | 887 | // Total HT |
| 888 | - $pdf->SetFillColor(255,255,255); |
|
| 888 | + $pdf->SetFillColor(255, 255, 255); |
|
| 889 | 889 | $pdf->SetXY($col1x, $tab2_top + 0); |
| 890 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); |
|
| 890 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); |
|
| 891 | 891 | |
| 892 | 892 | $pdf->SetXY($col2x, $tab2_top + 0); |
| 893 | - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + (! empty($object->remise)?$object->remise:0), 0, $outputlangs), 0, 'R', 1); |
|
| 893 | + $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + (!empty($object->remise) ? $object->remise : 0), 0, $outputlangs), 0, 'R', 1); |
|
| 894 | 894 | |
| 895 | 895 | // Show VAT by rates and total |
| 896 | - $pdf->SetFillColor(248,248,248); |
|
| 896 | + $pdf->SetFillColor(248, 248, 248); |
|
| 897 | 897 | |
| 898 | - $this->atleastoneratenotnull=0; |
|
| 898 | + $this->atleastoneratenotnull = 0; |
|
| 899 | 899 | if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) |
| 900 | 900 | { |
| 901 | - $tvaisnull=((! empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false); |
|
| 902 | - if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_ISNULL) && $tvaisnull) |
|
| 901 | + $tvaisnull = ((!empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false); |
|
| 902 | + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_ISNULL) && $tvaisnull) |
|
| 903 | 903 | { |
| 904 | 904 | // Nothing to do |
| 905 | 905 | } |
@@ -908,27 +908,27 @@ discard block |
||
| 908 | 908 | //Local tax 1 before VAT |
| 909 | 909 | //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') |
| 910 | 910 | //{ |
| 911 | - foreach( $this->localtax1 as $localtax_type => $localtax_rate ) |
|
| 911 | + foreach ($this->localtax1 as $localtax_type => $localtax_rate) |
|
| 912 | 912 | { |
| 913 | - if (in_array((string) $localtax_type, array('1','3','5'))) continue; |
|
| 914 | - foreach( $localtax_rate as $tvakey => $tvaval ) |
|
| 913 | + if (in_array((string) $localtax_type, array('1', '3', '5'))) continue; |
|
| 914 | + foreach ($localtax_rate as $tvakey => $tvaval) |
|
| 915 | 915 | { |
| 916 | - if ($tvakey!=0) // On affiche pas taux 0 |
|
| 916 | + if ($tvakey != 0) // On affiche pas taux 0 |
|
| 917 | 917 | { |
| 918 | 918 | //$this->atleastoneratenotnull++; |
| 919 | 919 | |
| 920 | 920 | $index++; |
| 921 | 921 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 922 | 922 | |
| 923 | - $tvacompl=''; |
|
| 924 | - if (preg_match('/\*/',$tvakey)) |
|
| 923 | + $tvacompl = ''; |
|
| 924 | + if (preg_match('/\*/', $tvakey)) |
|
| 925 | 925 | { |
| 926 | - $tvakey=str_replace('*','',$tvakey); |
|
| 926 | + $tvakey = str_replace('*', '', $tvakey); |
|
| 927 | 927 | $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; |
| 928 | 928 | } |
| 929 | - $totalvat = $outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code).' '; |
|
| 930 | - $totalvat.=vatrate(abs($tvakey),1).$tvacompl; |
|
| 931 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 929 | + $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; |
|
| 930 | + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; |
|
| 931 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 932 | 932 | |
| 933 | 933 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 934 | 934 | $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); |
@@ -939,12 +939,12 @@ discard block |
||
| 939 | 939 | //Local tax 2 before VAT |
| 940 | 940 | //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') |
| 941 | 941 | //{ |
| 942 | - foreach( $this->localtax2 as $localtax_type => $localtax_rate ) |
|
| 942 | + foreach ($this->localtax2 as $localtax_type => $localtax_rate) |
|
| 943 | 943 | { |
| 944 | - if (in_array((string) $localtax_type, array('1','3','5'))) continue; |
|
| 945 | - foreach( $localtax_rate as $tvakey => $tvaval ) |
|
| 944 | + if (in_array((string) $localtax_type, array('1', '3', '5'))) continue; |
|
| 945 | + foreach ($localtax_rate as $tvakey => $tvaval) |
|
| 946 | 946 | { |
| 947 | - if ($tvakey!=0) // On affiche pas taux 0 |
|
| 947 | + if ($tvakey != 0) // On affiche pas taux 0 |
|
| 948 | 948 | { |
| 949 | 949 | //$this->atleastoneratenotnull++; |
| 950 | 950 | |
@@ -953,15 +953,15 @@ discard block |
||
| 953 | 953 | $index++; |
| 954 | 954 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 955 | 955 | |
| 956 | - $tvacompl=''; |
|
| 957 | - if (preg_match('/\*/',$tvakey)) |
|
| 956 | + $tvacompl = ''; |
|
| 957 | + if (preg_match('/\*/', $tvakey)) |
|
| 958 | 958 | { |
| 959 | - $tvakey=str_replace('*','',$tvakey); |
|
| 959 | + $tvakey = str_replace('*', '', $tvakey); |
|
| 960 | 960 | $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; |
| 961 | 961 | } |
| 962 | - $totalvat = $outputlangs->transcountrynoentities("TotalLT2",$mysoc->country_code).' '; |
|
| 963 | - $totalvat.=vatrate(abs($tvakey),1).$tvacompl; |
|
| 964 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 962 | + $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; |
|
| 963 | + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; |
|
| 964 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 965 | 965 | |
| 966 | 966 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 967 | 967 | $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); |
@@ -971,7 +971,7 @@ discard block |
||
| 971 | 971 | } |
| 972 | 972 | //} |
| 973 | 973 | // VAT |
| 974 | - foreach($this->tva as $tvakey => $tvaval) |
|
| 974 | + foreach ($this->tva as $tvakey => $tvaval) |
|
| 975 | 975 | { |
| 976 | 976 | if ($tvakey > 0) // On affiche pas taux 0 |
| 977 | 977 | { |
@@ -980,15 +980,15 @@ discard block |
||
| 980 | 980 | $index++; |
| 981 | 981 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 982 | 982 | |
| 983 | - $tvacompl=''; |
|
| 984 | - if (preg_match('/\*/',$tvakey)) |
|
| 983 | + $tvacompl = ''; |
|
| 984 | + if (preg_match('/\*/', $tvakey)) |
|
| 985 | 985 | { |
| 986 | - $tvakey=str_replace('*','',$tvakey); |
|
| 986 | + $tvakey = str_replace('*', '', $tvakey); |
|
| 987 | 987 | $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; |
| 988 | 988 | } |
| 989 | - $totalvat =$outputlangs->transnoentities("TotalVAT").' '; |
|
| 990 | - $totalvat.=vatrate($tvakey,1).$tvacompl; |
|
| 991 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 989 | + $totalvat = $outputlangs->transnoentities("TotalVAT").' '; |
|
| 990 | + $totalvat .= vatrate($tvakey, 1).$tvacompl; |
|
| 991 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 992 | 992 | |
| 993 | 993 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 994 | 994 | $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); |
@@ -998,11 +998,11 @@ discard block |
||
| 998 | 998 | //Local tax 1 after VAT |
| 999 | 999 | //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') |
| 1000 | 1000 | //{ |
| 1001 | - foreach( $this->localtax1 as $localtax_type => $localtax_rate ) |
|
| 1001 | + foreach ($this->localtax1 as $localtax_type => $localtax_rate) |
|
| 1002 | 1002 | { |
| 1003 | - if (in_array((string) $localtax_type, array('2','4','6'))) continue; |
|
| 1003 | + if (in_array((string) $localtax_type, array('2', '4', '6'))) continue; |
|
| 1004 | 1004 | |
| 1005 | - foreach( $localtax_rate as $tvakey => $tvaval ) |
|
| 1005 | + foreach ($localtax_rate as $tvakey => $tvaval) |
|
| 1006 | 1006 | { |
| 1007 | 1007 | if ($tvakey != 0) // On affiche pas taux 0 |
| 1008 | 1008 | { |
@@ -1011,16 +1011,16 @@ discard block |
||
| 1011 | 1011 | $index++; |
| 1012 | 1012 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 1013 | 1013 | |
| 1014 | - $tvacompl=''; |
|
| 1015 | - if (preg_match('/\*/',$tvakey)) |
|
| 1014 | + $tvacompl = ''; |
|
| 1015 | + if (preg_match('/\*/', $tvakey)) |
|
| 1016 | 1016 | { |
| 1017 | - $tvakey=str_replace('*','',$tvakey); |
|
| 1017 | + $tvakey = str_replace('*', '', $tvakey); |
|
| 1018 | 1018 | $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; |
| 1019 | 1019 | } |
| 1020 | - $totalvat = $outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code).' '; |
|
| 1020 | + $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; |
|
| 1021 | 1021 | |
| 1022 | - $totalvat.=vatrate(abs($tvakey),1).$tvacompl; |
|
| 1023 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 1022 | + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; |
|
| 1023 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 1024 | 1024 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 1025 | 1025 | $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); |
| 1026 | 1026 | } |
@@ -1030,11 +1030,11 @@ discard block |
||
| 1030 | 1030 | //Local tax 2 after VAT |
| 1031 | 1031 | //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') |
| 1032 | 1032 | //{ |
| 1033 | - foreach( $this->localtax2 as $localtax_type => $localtax_rate ) |
|
| 1033 | + foreach ($this->localtax2 as $localtax_type => $localtax_rate) |
|
| 1034 | 1034 | { |
| 1035 | - if (in_array((string) $localtax_type, array('2','4','6'))) continue; |
|
| 1035 | + if (in_array((string) $localtax_type, array('2', '4', '6'))) continue; |
|
| 1036 | 1036 | |
| 1037 | - foreach( $localtax_rate as $tvakey => $tvaval ) |
|
| 1037 | + foreach ($localtax_rate as $tvakey => $tvaval) |
|
| 1038 | 1038 | { |
| 1039 | 1039 | if ($tvakey != 0) // On affiche pas taux 0 |
| 1040 | 1040 | { |
@@ -1043,16 +1043,16 @@ discard block |
||
| 1043 | 1043 | $index++; |
| 1044 | 1044 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 1045 | 1045 | |
| 1046 | - $tvacompl=''; |
|
| 1047 | - if (preg_match('/\*/',$tvakey)) |
|
| 1046 | + $tvacompl = ''; |
|
| 1047 | + if (preg_match('/\*/', $tvakey)) |
|
| 1048 | 1048 | { |
| 1049 | - $tvakey=str_replace('*','',$tvakey); |
|
| 1049 | + $tvakey = str_replace('*', '', $tvakey); |
|
| 1050 | 1050 | $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; |
| 1051 | 1051 | } |
| 1052 | - $totalvat = $outputlangs->transcountrynoentities("TotalLT2",$mysoc->country_code).' '; |
|
| 1052 | + $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; |
|
| 1053 | 1053 | |
| 1054 | - $totalvat.=vatrate(abs($tvakey),1).$tvacompl; |
|
| 1055 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 1054 | + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; |
|
| 1055 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 1056 | 1056 | |
| 1057 | 1057 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 1058 | 1058 | $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); |
@@ -1064,24 +1064,24 @@ discard block |
||
| 1064 | 1064 | // Total TTC |
| 1065 | 1065 | $index++; |
| 1066 | 1066 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 1067 | - $pdf->SetTextColor(0,0,60); |
|
| 1068 | - $pdf->SetFillColor(224,224,224); |
|
| 1069 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); |
|
| 1067 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1068 | + $pdf->SetFillColor(224, 224, 224); |
|
| 1069 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); |
|
| 1070 | 1070 | |
| 1071 | 1071 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 1072 | 1072 | $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc, 0, $outputlangs), $useborder, 'R', 1); |
| 1073 | 1073 | } |
| 1074 | 1074 | } |
| 1075 | 1075 | |
| 1076 | - $pdf->SetTextColor(0,0,0); |
|
| 1076 | + $pdf->SetTextColor(0, 0, 0); |
|
| 1077 | 1077 | |
| 1078 | - $creditnoteamount=0; |
|
| 1079 | - $depositsamount=0; |
|
| 1078 | + $creditnoteamount = 0; |
|
| 1079 | + $depositsamount = 0; |
|
| 1080 | 1080 | //$creditnoteamount=$object->getSumCreditNotesUsed(); |
| 1081 | 1081 | //$depositsamount=$object->getSumDepositsUsed(); |
| 1082 | 1082 | //print "x".$creditnoteamount."-".$depositsamount;exit; |
| 1083 | 1083 | $resteapayer = price2num($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT'); |
| 1084 | - if (! empty($object->paye)) $resteapayer=0; |
|
| 1084 | + if (!empty($object->paye)) $resteapayer = 0; |
|
| 1085 | 1085 | |
| 1086 | 1086 | if ($deja_regle > 0) |
| 1087 | 1087 | { |
@@ -1089,21 +1089,21 @@ discard block |
||
| 1089 | 1089 | $index++; |
| 1090 | 1090 | |
| 1091 | 1091 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 1092 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("AlreadyPaid"), 0, 'L', 0); |
|
| 1092 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("AlreadyPaid"), 0, 'L', 0); |
|
| 1093 | 1093 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 1094 | 1094 | $pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle, 0, $outputlangs), 0, 'R', 0); |
| 1095 | 1095 | |
| 1096 | 1096 | $index++; |
| 1097 | - $pdf->SetTextColor(0,0,60); |
|
| 1098 | - $pdf->SetFillColor(224,224,224); |
|
| 1097 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1098 | + $pdf->SetFillColor(224, 224, 224); |
|
| 1099 | 1099 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 1100 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1); |
|
| 1100 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1); |
|
| 1101 | 1101 | |
| 1102 | 1102 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 1103 | 1103 | $pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer, 0, $outputlangs), $useborder, 'R', 1); |
| 1104 | 1104 | |
| 1105 | - $pdf->SetFont('','', $default_font_size - 1); |
|
| 1106 | - $pdf->SetTextColor(0,0,0); |
|
| 1105 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 1106 | + $pdf->SetTextColor(0, 0, 0); |
|
| 1107 | 1107 | } |
| 1108 | 1108 | |
| 1109 | 1109 | $index++; |
@@ -1122,75 +1122,75 @@ discard block |
||
| 1122 | 1122 | * @param int $hidebottom Hide bottom bar of array |
| 1123 | 1123 | * @return void |
| 1124 | 1124 | */ |
| 1125 | - function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0) |
|
| 1125 | + function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0) |
|
| 1126 | 1126 | { |
| 1127 | 1127 | global $conf; |
| 1128 | 1128 | |
| 1129 | 1129 | // Force to disable hidetop and hidebottom |
| 1130 | - $hidebottom=0; |
|
| 1131 | - if ($hidetop) $hidetop=-1; |
|
| 1130 | + $hidebottom = 0; |
|
| 1131 | + if ($hidetop) $hidetop = -1; |
|
| 1132 | 1132 | |
| 1133 | 1133 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
| 1134 | 1134 | |
| 1135 | 1135 | // Amount in (at tab_top - 1) |
| 1136 | - $pdf->SetTextColor(0,0,0); |
|
| 1137 | - $pdf->SetFont('','', $default_font_size - 2); |
|
| 1136 | + $pdf->SetTextColor(0, 0, 0); |
|
| 1137 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
| 1138 | 1138 | |
| 1139 | 1139 | if (empty($hidetop)) |
| 1140 | 1140 | { |
| 1141 | - $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency)); |
|
| 1142 | - $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4); |
|
| 1141 | + $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$conf->currency)); |
|
| 1142 | + $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4); |
|
| 1143 | 1143 | $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); |
| 1144 | 1144 | |
| 1145 | 1145 | //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; |
| 1146 | - if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); |
|
| 1146 | + if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); |
|
| 1147 | 1147 | } |
| 1148 | 1148 | |
| 1149 | - $pdf->SetDrawColor(128,128,128); |
|
| 1150 | - $pdf->SetFont('','', $default_font_size - 1); |
|
| 1149 | + $pdf->SetDrawColor(128, 128, 128); |
|
| 1150 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 1151 | 1151 | |
| 1152 | 1152 | // Output Rect |
| 1153 | - $this->printRect($pdf,$this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param |
|
| 1153 | + $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param |
|
| 1154 | 1154 | |
| 1155 | 1155 | if (empty($hidetop)) |
| 1156 | 1156 | { |
| 1157 | - $pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); // line prend une position y en 2eme param et 4eme param |
|
| 1157 | + $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5); // line prend une position y en 2eme param et 4eme param |
|
| 1158 | 1158 | |
| 1159 | - $pdf->SetXY($this->posxdesc-1, $tab_top+1); |
|
| 1160 | - $pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L'); |
|
| 1159 | + $pdf->SetXY($this->posxdesc - 1, $tab_top + 1); |
|
| 1160 | + $pdf->MultiCell(108, 2, $outputlangs->transnoentities("Designation"), '', 'L'); |
|
| 1161 | 1161 | } |
| 1162 | 1162 | |
| 1163 | 1163 | if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) |
| 1164 | 1164 | { |
| 1165 | - $pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height); |
|
| 1165 | + $pdf->line($this->posxtva - 1, $tab_top, $this->posxtva - 1, $tab_top + $tab_height); |
|
| 1166 | 1166 | if (empty($hidetop)) |
| 1167 | 1167 | { |
| 1168 | - $pdf->SetXY($this->posxtva-3, $tab_top+1); |
|
| 1169 | - $pdf->MultiCell($this->posxup-$this->posxtva+3,2, $outputlangs->transnoentities("VAT"),'','C'); |
|
| 1168 | + $pdf->SetXY($this->posxtva - 3, $tab_top + 1); |
|
| 1169 | + $pdf->MultiCell($this->posxup - $this->posxtva + 3, 2, $outputlangs->transnoentities("VAT"), '', 'C'); |
|
| 1170 | 1170 | } |
| 1171 | 1171 | } |
| 1172 | 1172 | |
| 1173 | - $pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height); |
|
| 1173 | + $pdf->line($this->posxup - 1, $tab_top, $this->posxup - 1, $tab_top + $tab_height); |
|
| 1174 | 1174 | if (empty($hidetop)) |
| 1175 | 1175 | { |
| 1176 | - $pdf->SetXY($this->posxup-1, $tab_top+1); |
|
| 1177 | - $pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceUHT"),'','C'); |
|
| 1176 | + $pdf->SetXY($this->posxup - 1, $tab_top + 1); |
|
| 1177 | + $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities("PriceUHT"), '', 'C'); |
|
| 1178 | 1178 | } |
| 1179 | 1179 | |
| 1180 | - $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); |
|
| 1180 | + $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height); |
|
| 1181 | 1181 | if (empty($hidetop)) |
| 1182 | 1182 | { |
| 1183 | - $pdf->SetXY($this->posxqty-1, $tab_top+1); |
|
| 1184 | - $pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C'); |
|
| 1183 | + $pdf->SetXY($this->posxqty - 1, $tab_top + 1); |
|
| 1184 | + $pdf->MultiCell($this->posxdiscount - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C'); |
|
| 1185 | 1185 | } |
| 1186 | 1186 | |
| 1187 | - $pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height); |
|
| 1187 | + $pdf->line($this->posxdiscount - 1, $tab_top, $this->posxdiscount - 1, $tab_top + $tab_height); |
|
| 1188 | 1188 | if (empty($hidetop)) |
| 1189 | 1189 | { |
| 1190 | 1190 | if ($this->atleastonediscount) |
| 1191 | 1191 | { |
| 1192 | - $pdf->SetXY($this->posxdiscount-1, $tab_top+1); |
|
| 1193 | - $pdf->MultiCell($this->postotalht-$this->posxdiscount+1,2, $outputlangs->transnoentities("ReductionShort"),'','C'); |
|
| 1192 | + $pdf->SetXY($this->posxdiscount - 1, $tab_top + 1); |
|
| 1193 | + $pdf->MultiCell($this->postotalht - $this->posxdiscount + 1, 2, $outputlangs->transnoentities("ReductionShort"), '', 'C'); |
|
| 1194 | 1194 | } |
| 1195 | 1195 | } |
| 1196 | 1196 | |
@@ -1200,8 +1200,8 @@ discard block |
||
| 1200 | 1200 | } |
| 1201 | 1201 | if (empty($hidetop)) |
| 1202 | 1202 | { |
| 1203 | - $pdf->SetXY($this->postotalht-1, $tab_top+1); |
|
| 1204 | - $pdf->MultiCell(30,2, $outputlangs->transnoentities("TotalHT"),'','C'); |
|
| 1203 | + $pdf->SetXY($this->postotalht - 1, $tab_top + 1); |
|
| 1204 | + $pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHT"), '', 'C'); |
|
| 1205 | 1205 | } |
| 1206 | 1206 | } |
| 1207 | 1207 | |
@@ -1216,7 +1216,7 @@ discard block |
||
| 1216 | 1216 | */ |
| 1217 | 1217 | function _pagehead(&$pdf, $object, $showaddress, $outputlangs) |
| 1218 | 1218 | { |
| 1219 | - global $conf,$langs,$hookmanager; |
|
| 1219 | + global $conf, $langs, $hookmanager; |
|
| 1220 | 1220 | |
| 1221 | 1221 | $outputlangs->load("main"); |
| 1222 | 1222 | $outputlangs->load("bills"); |
@@ -1225,75 +1225,75 @@ discard block |
||
| 1225 | 1225 | $outputlangs->load("orders"); |
| 1226 | 1226 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
| 1227 | 1227 | |
| 1228 | - pdf_pagehead($pdf,$outputlangs,$this->page_hauteur); |
|
| 1228 | + pdf_pagehead($pdf, $outputlangs, $this->page_hauteur); |
|
| 1229 | 1229 | |
| 1230 | 1230 | // Show Draft Watermark |
| 1231 | - if($object->statut==0 && (! empty($conf->global->COMMANDE_DRAFT_WATERMARK)) ) |
|
| 1231 | + if ($object->statut == 0 && (!empty($conf->global->COMMANDE_DRAFT_WATERMARK))) |
|
| 1232 | 1232 | { |
| 1233 | - pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->COMMANDE_DRAFT_WATERMARK); |
|
| 1233 | + pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->COMMANDE_DRAFT_WATERMARK); |
|
| 1234 | 1234 | } |
| 1235 | 1235 | |
| 1236 | - $pdf->SetTextColor(0,0,60); |
|
| 1237 | - $pdf->SetFont('','B', $default_font_size + 3); |
|
| 1236 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1237 | + $pdf->SetFont('', 'B', $default_font_size + 3); |
|
| 1238 | 1238 | |
| 1239 | - $posy=$this->marge_haute; |
|
| 1240 | - $posx=$this->page_largeur-$this->marge_droite-100; |
|
| 1239 | + $posy = $this->marge_haute; |
|
| 1240 | + $posx = $this->page_largeur - $this->marge_droite - 100; |
|
| 1241 | 1241 | |
| 1242 | - $pdf->SetXY($this->marge_gauche,$posy); |
|
| 1242 | + $pdf->SetXY($this->marge_gauche, $posy); |
|
| 1243 | 1243 | |
| 1244 | 1244 | // Logo |
| 1245 | - $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; |
|
| 1245 | + $logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; |
|
| 1246 | 1246 | if ($this->emetteur->logo) |
| 1247 | 1247 | { |
| 1248 | 1248 | if (is_readable($logo)) |
| 1249 | 1249 | { |
| 1250 | - $height=pdf_getHeightForLogo($logo); |
|
| 1251 | - $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
| 1250 | + $height = pdf_getHeightForLogo($logo); |
|
| 1251 | + $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
| 1252 | 1252 | } |
| 1253 | 1253 | else |
| 1254 | 1254 | { |
| 1255 | - $pdf->SetTextColor(200,0,0); |
|
| 1256 | - $pdf->SetFont('','B', $default_font_size -2); |
|
| 1257 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L'); |
|
| 1255 | + $pdf->SetTextColor(200, 0, 0); |
|
| 1256 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
| 1257 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); |
|
| 1258 | 1258 | $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); |
| 1259 | 1259 | } |
| 1260 | 1260 | } |
| 1261 | 1261 | else |
| 1262 | 1262 | { |
| 1263 | - $text=$this->emetteur->name; |
|
| 1263 | + $text = $this->emetteur->name; |
|
| 1264 | 1264 | $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); |
| 1265 | 1265 | } |
| 1266 | 1266 | |
| 1267 | - $pdf->SetFont('','B', $default_font_size + 3); |
|
| 1268 | - $pdf->SetXY($posx,$posy); |
|
| 1269 | - $pdf->SetTextColor(0,0,60); |
|
| 1270 | - $title=$outputlangs->transnoentities("Order"); |
|
| 1267 | + $pdf->SetFont('', 'B', $default_font_size + 3); |
|
| 1268 | + $pdf->SetXY($posx, $posy); |
|
| 1269 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1270 | + $title = $outputlangs->transnoentities("Order"); |
|
| 1271 | 1271 | $pdf->MultiCell(100, 3, $title, '', 'R'); |
| 1272 | 1272 | |
| 1273 | - $pdf->SetFont('','B',$default_font_size); |
|
| 1273 | + $pdf->SetFont('', 'B', $default_font_size); |
|
| 1274 | 1274 | |
| 1275 | - $posy+=5; |
|
| 1276 | - $pdf->SetXY($posx,$posy); |
|
| 1277 | - $pdf->SetTextColor(0,0,60); |
|
| 1278 | - $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : " . $outputlangs->convToOutputCharset($object->ref), '', 'R'); |
|
| 1275 | + $posy += 5; |
|
| 1276 | + $pdf->SetXY($posx, $posy); |
|
| 1277 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1278 | + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($object->ref), '', 'R'); |
|
| 1279 | 1279 | |
| 1280 | - $posy+=1; |
|
| 1281 | - $pdf->SetFont('','', $default_font_size - 1); |
|
| 1280 | + $posy += 1; |
|
| 1281 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 1282 | 1282 | |
| 1283 | 1283 | if ($object->ref_client) |
| 1284 | 1284 | { |
| 1285 | - $posy+=5; |
|
| 1286 | - $pdf->SetXY($posx,$posy); |
|
| 1287 | - $pdf->SetTextColor(0,0,60); |
|
| 1288 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : " . $outputlangs->convToOutputCharset($object->ref_client), '', 'R'); |
|
| 1285 | + $posy += 5; |
|
| 1286 | + $pdf->SetXY($posx, $posy); |
|
| 1287 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1288 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R'); |
|
| 1289 | 1289 | } |
| 1290 | 1290 | |
| 1291 | - $posy+=4; |
|
| 1292 | - $pdf->SetXY($posx,$posy); |
|
| 1293 | - $pdf->SetTextColor(0,0,60); |
|
| 1294 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : " . dol_print_date($object->date,"%d %b %Y",false,$outputlangs,true), '', 'R'); |
|
| 1291 | + $posy += 4; |
|
| 1292 | + $pdf->SetXY($posx, $posy); |
|
| 1293 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1294 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($object->date, "%d %b %Y", false, $outputlangs, true), '', 'R'); |
|
| 1295 | 1295 | |
| 1296 | - $posy+=2; |
|
| 1296 | + $posy += 2; |
|
| 1297 | 1297 | |
| 1298 | 1298 | // Show list of linked objects |
| 1299 | 1299 | $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size); |
@@ -1304,84 +1304,84 @@ discard block |
||
| 1304 | 1304 | $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty); |
| 1305 | 1305 | |
| 1306 | 1306 | // Show sender |
| 1307 | - $posy=42; |
|
| 1308 | - $posx=$this->marge_gauche; |
|
| 1309 | - if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80; |
|
| 1310 | - $hautcadre=40; |
|
| 1307 | + $posy = 42; |
|
| 1308 | + $posx = $this->marge_gauche; |
|
| 1309 | + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80; |
|
| 1310 | + $hautcadre = 40; |
|
| 1311 | 1311 | |
| 1312 | 1312 | // Show sender frame |
| 1313 | - $pdf->SetTextColor(0,0,0); |
|
| 1314 | - $pdf->SetFont('','', $default_font_size - 2); |
|
| 1315 | - $pdf->SetXY($posx,$posy-5); |
|
| 1316 | - $pdf->MultiCell(66,5, $outputlangs->transnoentities("BillFrom").":", 0, 'L'); |
|
| 1317 | - $pdf->SetXY($posx,$posy); |
|
| 1318 | - $pdf->SetFillColor(230,230,230); |
|
| 1313 | + $pdf->SetTextColor(0, 0, 0); |
|
| 1314 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
| 1315 | + $pdf->SetXY($posx, $posy - 5); |
|
| 1316 | + $pdf->MultiCell(66, 5, $outputlangs->transnoentities("BillFrom").":", 0, 'L'); |
|
| 1317 | + $pdf->SetXY($posx, $posy); |
|
| 1318 | + $pdf->SetFillColor(230, 230, 230); |
|
| 1319 | 1319 | $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1); |
| 1320 | - $pdf->SetTextColor(0,0,60); |
|
| 1320 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1321 | 1321 | |
| 1322 | 1322 | // Show sender name |
| 1323 | - $pdf->SetXY($posx+2,$posy+3); |
|
| 1324 | - $pdf->SetFont('','B', $default_font_size); |
|
| 1323 | + $pdf->SetXY($posx + 2, $posy + 3); |
|
| 1324 | + $pdf->SetFont('', 'B', $default_font_size); |
|
| 1325 | 1325 | $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); |
| 1326 | - $posy=$pdf->getY(); |
|
| 1326 | + $posy = $pdf->getY(); |
|
| 1327 | 1327 | |
| 1328 | 1328 | // Show sender information |
| 1329 | - $pdf->SetXY($posx+2,$posy); |
|
| 1330 | - $pdf->SetFont('','', $default_font_size - 1); |
|
| 1329 | + $pdf->SetXY($posx + 2, $posy); |
|
| 1330 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 1331 | 1331 | $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L'); |
| 1332 | 1332 | |
| 1333 | 1333 | |
| 1334 | 1334 | |
| 1335 | 1335 | // If CUSTOMER contact defined on order, we use it |
| 1336 | - $usecontact=false; |
|
| 1337 | - $arrayidcontact=$object->getIdContact('external','CUSTOMER'); |
|
| 1336 | + $usecontact = false; |
|
| 1337 | + $arrayidcontact = $object->getIdContact('external', 'CUSTOMER'); |
|
| 1338 | 1338 | if (count($arrayidcontact) > 0) |
| 1339 | 1339 | { |
| 1340 | - $usecontact=true; |
|
| 1341 | - $result=$object->fetch_contact($arrayidcontact[0]); |
|
| 1340 | + $usecontact = true; |
|
| 1341 | + $result = $object->fetch_contact($arrayidcontact[0]); |
|
| 1342 | 1342 | } |
| 1343 | 1343 | |
| 1344 | 1344 | // Recipient name |
| 1345 | - if (! empty($usecontact)) |
|
| 1345 | + if (!empty($usecontact)) |
|
| 1346 | 1346 | { |
| 1347 | 1347 | // On peut utiliser le nom de la societe du contact |
| 1348 | - if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; |
|
| 1348 | + if (!empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; |
|
| 1349 | 1349 | else $socname = $object->thirdparty->name; |
| 1350 | - $carac_client_name=$outputlangs->convToOutputCharset($socname); |
|
| 1350 | + $carac_client_name = $outputlangs->convToOutputCharset($socname); |
|
| 1351 | 1351 | } |
| 1352 | 1352 | else |
| 1353 | 1353 | { |
| 1354 | - $carac_client_name=$outputlangs->convToOutputCharset($object->thirdparty->name); |
|
| 1354 | + $carac_client_name = $outputlangs->convToOutputCharset($object->thirdparty->name); |
|
| 1355 | 1355 | } |
| 1356 | 1356 | |
| 1357 | - $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,($usecontact?$object->contact:''),$usecontact,'target'); |
|
| 1357 | + $carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, 'target'); |
|
| 1358 | 1358 | |
| 1359 | 1359 | // Show recipient |
| 1360 | - $widthrecbox=100; |
|
| 1361 | - if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format |
|
| 1362 | - $posy=42; |
|
| 1363 | - $posx=$this->page_largeur-$this->marge_droite-$widthrecbox; |
|
| 1364 | - if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche; |
|
| 1360 | + $widthrecbox = 100; |
|
| 1361 | + if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format |
|
| 1362 | + $posy = 42; |
|
| 1363 | + $posx = $this->page_largeur - $this->marge_droite - $widthrecbox; |
|
| 1364 | + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche; |
|
| 1365 | 1365 | |
| 1366 | 1366 | // Show recipient frame |
| 1367 | - $pdf->SetTextColor(0,0,0); |
|
| 1368 | - $pdf->SetFont('','', $default_font_size - 2); |
|
| 1369 | - $pdf->SetXY($posx+2,$posy-5); |
|
| 1370 | - $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":",0,'L'); |
|
| 1367 | + $pdf->SetTextColor(0, 0, 0); |
|
| 1368 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
| 1369 | + $pdf->SetXY($posx + 2, $posy - 5); |
|
| 1370 | + $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":", 0, 'L'); |
|
| 1371 | 1371 | $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre); |
| 1372 | 1372 | |
| 1373 | 1373 | // Show recipient name |
| 1374 | - $pdf->SetXY($posx+2,$posy+3); |
|
| 1375 | - $pdf->SetFont('','B', $default_font_size); |
|
| 1374 | + $pdf->SetXY($posx + 2, $posy + 3); |
|
| 1375 | + $pdf->SetFont('', 'B', $default_font_size); |
|
| 1376 | 1376 | $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L'); |
| 1377 | 1377 | |
| 1378 | 1378 | // Show recipient information |
| 1379 | - $pdf->SetFont('','', $default_font_size - 1); |
|
| 1380 | - $pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4)); |
|
| 1379 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 1380 | + $pdf->SetXY($posx + 2, $posy + 4 + (dol_nboflines_bis($carac_client_name, 50) * 4)); |
|
| 1381 | 1381 | $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); |
| 1382 | 1382 | } |
| 1383 | 1383 | |
| 1384 | - $pdf->SetTextColor(0,0,0); |
|
| 1384 | + $pdf->SetTextColor(0, 0, 0); |
|
| 1385 | 1385 | } |
| 1386 | 1386 | |
| 1387 | 1387 | /** |
@@ -1393,11 +1393,11 @@ discard block |
||
| 1393 | 1393 | * @param int $hidefreetext 1=Hide free text |
| 1394 | 1394 | * @return int Return height of bottom margin including footer text |
| 1395 | 1395 | */ |
| 1396 | - function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) |
|
| 1396 | + function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) |
|
| 1397 | 1397 | { |
| 1398 | - $showdetails=0; |
|
| 1399 | - $free_text = (float)DOL_VERSION > 3.8 ? 'ORDER_FREE_TEXT' : 'COMMANDE_FREE_TEXT'; |
|
| 1400 | - return pdf_pagefoot($pdf,$outputlangs,$free_text,$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); |
|
| 1398 | + $showdetails = 0; |
|
| 1399 | + $free_text = (float) DOL_VERSION > 3.8 ? 'ORDER_FREE_TEXT' : 'COMMANDE_FREE_TEXT'; |
|
| 1400 | + return pdf_pagefoot($pdf, $outputlangs, $free_text, $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); |
|
| 1401 | 1401 | } |
| 1402 | 1402 | |
| 1403 | 1403 | } |
@@ -10,8 +10,8 @@ discard block |
||
| 10 | 10 | dol_include_once('/supplier_proposal/class/supplier_proposal.class.php'); |
| 11 | 11 | dol_include_once('/fourn/class/fournisseur.facture.class.php'); |
| 12 | 12 | |
| 13 | - $get=GETPOST('get'); |
|
| 14 | - $set=GETPOST('set'); |
|
| 13 | + $get = GETPOST('get'); |
|
| 14 | + $set = GETPOST('set'); |
|
| 15 | 15 | |
| 16 | 16 | switch ($get) { |
| 17 | 17 | default: |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | switch ($set) { |
| 22 | 22 | case 'updateLineNC': // Gestion du Compris/Non Compris via les titres et/ou lignes |
| 23 | - echo json_encode( _updateLineNC(GETPOST('element'), GETPOST('elementid'), GETPOST('lineid'), GETPOST('subtotal_nc')) ); |
|
| 23 | + echo json_encode(_updateLineNC(GETPOST('element'), GETPOST('elementid'), GETPOST('lineid'), GETPOST('subtotal_nc'))); |
|
| 24 | 24 | |
| 25 | 25 | break; |
| 26 | 26 | default: |
@@ -27,37 +27,37 @@ discard block |
||
| 27 | 27 | // Change this following line to use the correct relative path (../, ../../, etc) |
| 28 | 28 | // Dolibarr environment |
| 29 | 29 | $res = @include("../../main.inc.php"); // From htdocs directory |
| 30 | -if (! $res) { |
|
| 30 | +if (!$res) { |
|
| 31 | 31 | $res = @include("../../../main.inc.php"); // From "custom" directory |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // Libraries |
| 35 | -require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php"; |
|
| 35 | +require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; |
|
| 36 | 36 | require_once '../lib/subtotal.lib.php'; |
| 37 | 37 | |
| 38 | 38 | $langs->load("subtotal@subtotal"); |
| 39 | 39 | |
| 40 | 40 | // Access control |
| 41 | -if (! $user->admin) { |
|
| 41 | +if (!$user->admin) { |
|
| 42 | 42 | accessforbidden(); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | // Parameters |
| 46 | 46 | $action = GETPOST('action', 'alpha'); |
| 47 | 47 | |
| 48 | -if($action=='save') { |
|
| 48 | +if ($action == 'save') { |
|
| 49 | 49 | |
| 50 | - foreach($_REQUEST['TDivers'] as $name=>$param) { |
|
| 50 | + foreach ($_REQUEST['TDivers'] as $name=>$param) { |
|
| 51 | 51 | |
| 52 | - dolibarr_set_const($db, $name, $param,'chaine', 0, '', $conf->entity); |
|
| 52 | + dolibarr_set_const($db, $name, $param, 'chaine', 0, '', $conf->entity); |
|
| 53 | 53 | |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | -if (preg_match('/set_(.*)/',$action,$reg)) |
|
| 58 | +if (preg_match('/set_(.*)/', $action, $reg)) |
|
| 59 | 59 | { |
| 60 | - $code=$reg[1]; |
|
| 60 | + $code = $reg[1]; |
|
| 61 | 61 | $value = GETPOST($code); |
| 62 | 62 | if ($code == 'SUBTOTAL_TFIELD_TO_KEEP_WITH_NC') $value = implode(',', $value); |
| 63 | 63 | |
@@ -83,10 +83,10 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | |
| 85 | 85 | |
| 86 | -llxHeader('','Gestion de sous-total, Ă propos',''); |
|
| 86 | +llxHeader('', 'Gestion de sous-total, Ă propos', ''); |
|
| 87 | 87 | |
| 88 | -$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; |
|
| 89 | -print_fiche_titre('Gestion de subtotal',$linkback,'setup'); |
|
| 88 | +$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; |
|
| 89 | +print_fiche_titre('Gestion de subtotal', $linkback, 'setup'); |
|
| 90 | 90 | |
| 91 | 91 | // Configuration header |
| 92 | 92 | $head = subtotalAdminPrepareHead(); |
@@ -101,11 +101,11 @@ discard block |
||
| 101 | 101 | showParameters(); |
| 102 | 102 | |
| 103 | 103 | function showParameters() { |
| 104 | - global $db,$conf,$langs,$bc; |
|
| 104 | + global $db, $conf, $langs, $bc; |
|
| 105 | 105 | |
| 106 | - $html=new Form($db); |
|
| 106 | + $html = new Form($db); |
|
| 107 | 107 | |
| 108 | - $var=false; |
|
| 108 | + $var = false; |
|
| 109 | 109 | print '<table class="noborder" width="100%">'; |
| 110 | 110 | print '<tr class="liste_titre">'; |
| 111 | 111 | print '<td>'.$langs->trans("Parameters").'</td>'."\n"; |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n"; |
| 114 | 114 | print '</tr>'; |
| 115 | 115 | |
| 116 | - $var=!$var; |
|
| 116 | + $var = !$var; |
|
| 117 | 117 | print '<tr '.$bc[$var].'>'; |
| 118 | 118 | print '<td>'.$langs->trans("SUBTOTAL_USE_NEW_FORMAT").'</td>'; |
| 119 | 119 | print '<td align="center" width="20"> </td>'; |
@@ -121,9 +121,9 @@ discard block |
||
| 121 | 121 | print ajax_constantonoff('SUBTOTAL_USE_NEW_FORMAT'); |
| 122 | 122 | print '</td></tr>'; |
| 123 | 123 | |
| 124 | - if((float)DOL_VERSION>=3.8) |
|
| 124 | + if ((float) DOL_VERSION >= 3.8) |
|
| 125 | 125 | { |
| 126 | - $var=!$var; |
|
| 126 | + $var = !$var; |
|
| 127 | 127 | print '<tr '.$bc[$var].'>'; |
| 128 | 128 | print '<td>'.$langs->trans("SUBTOTAL_USE_NUMEROTATION").'</td>'; |
| 129 | 129 | print '<td align="center" width="20"> </td>'; |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | print '</td></tr>'; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - $var=!$var; |
|
| 135 | + $var = !$var; |
|
| 136 | 136 | print '<tr '.$bc[$var].'>'; |
| 137 | 137 | print '<td>'.$langs->trans("SUBTOTAL_ALLOW_ADD_BLOCK").'</td>'; |
| 138 | 138 | print '<td align="center" width="20"> </td>'; |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | print ajax_constantonoff('SUBTOTAL_ALLOW_ADD_BLOCK'); |
| 141 | 141 | print '</td></tr>'; |
| 142 | 142 | |
| 143 | - $var=!$var; |
|
| 143 | + $var = !$var; |
|
| 144 | 144 | print '<tr '.$bc[$var].'>'; |
| 145 | 145 | print '<td>'.$langs->trans("SUBTOTAL_ALLOW_EDIT_BLOCK").'</td>'; |
| 146 | 146 | print '<td align="center" width="20"> </td>'; |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | print ajax_constantonoff('SUBTOTAL_ALLOW_EDIT_BLOCK'); |
| 149 | 149 | print '</td></tr>'; |
| 150 | 150 | |
| 151 | - $var=!$var; |
|
| 151 | + $var = !$var; |
|
| 152 | 152 | print '<tr '.$bc[$var].'>'; |
| 153 | 153 | print '<td>'.$langs->trans("SUBTOTAL_ALLOW_REMOVE_BLOCK").'</td>'; |
| 154 | 154 | print '<td align="center" width="20"> </td>'; |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | print ajax_constantonoff('SUBTOTAL_ALLOW_REMOVE_BLOCK'); |
| 157 | 157 | print '</td></tr>'; |
| 158 | 158 | |
| 159 | - $var=!$var; |
|
| 159 | + $var = !$var; |
|
| 160 | 160 | print '<tr '.$bc[$var].'>'; |
| 161 | 161 | print '<td>'.$langs->trans("SUBTOTAL_ALLOW_DUPLICATE_BLOCK").'</td>'; |
| 162 | 162 | print '<td align="center" width="20"> </td>'; |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | print ajax_constantonoff('SUBTOTAL_ALLOW_DUPLICATE_BLOCK'); |
| 165 | 165 | print '</td></tr>'; |
| 166 | 166 | |
| 167 | - $var=!$var; |
|
| 167 | + $var = !$var; |
|
| 168 | 168 | print '<tr '.$bc[$var].'>'; |
| 169 | 169 | print '<td>'.$langs->trans("SUBTOTAL_ALLOW_ADD_LINE_UNDER_TITLE").'</td>'; |
| 170 | 170 | print '<td align="center" width="20"> </td>'; |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | print ajax_constantonoff('SUBTOTAL_ALLOW_ADD_LINE_UNDER_TITLE'); |
| 173 | 173 | print '</td></tr>'; |
| 174 | 174 | |
| 175 | - $var=!$var; |
|
| 175 | + $var = !$var; |
|
| 176 | 176 | print '<tr '.$bc[$var].'>'; |
| 177 | 177 | print '<td>'.$langs->trans("SUBTOTAL_ADD_LINE_UNDER_TITLE_AT_END_BLOCK").'</td>'; |
| 178 | 178 | print '<td align="center" width="20"> </td>'; |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | print ajax_constantonoff('SUBTOTAL_ADD_LINE_UNDER_TITLE_AT_END_BLOCK'); |
| 181 | 181 | print '</td></tr>'; |
| 182 | 182 | |
| 183 | - $var=!$var; |
|
| 183 | + $var = !$var; |
|
| 184 | 184 | print '<tr '.$bc[$var].'>'; |
| 185 | 185 | print '<td>'.$html->textwithpicto($langs->trans("SUBTOTAL_TEXT_FOR_TITLE_ORDETSTOINVOICE"), $langs->trans("SUBTOTAL_TEXT_FOR_TITLE_ORDETSTOINVOICE_info")).'</td>'; |
| 186 | 186 | print '<td align="center" width="20"> </td>'; |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | print '</form>'; |
| 194 | 194 | print '</td></tr>'; |
| 195 | 195 | |
| 196 | - $var=!$var; |
|
| 196 | + $var = !$var; |
|
| 197 | 197 | print '<tr '.$bc[$var].'>'; |
| 198 | 198 | print '<td>'.$langs->trans("SUBTOTAL_TITLE_STYLE").'</td>'; |
| 199 | 199 | print '<td align="center" width="20"> </td>'; |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | print '</form>'; |
| 207 | 207 | print '</td></tr>'; |
| 208 | 208 | |
| 209 | - $var=!$var; |
|
| 209 | + $var = !$var; |
|
| 210 | 210 | print '<tr '.$bc[$var].'>'; |
| 211 | 211 | print '<td>'.$langs->trans("SUBTOTAL_SUBTOTAL_STYLE").'</td>'; |
| 212 | 212 | print '<td align="center" width="20"> </td>'; |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | print '</form>'; |
| 220 | 220 | print '</td></tr>'; |
| 221 | 221 | |
| 222 | - $var=!$var; |
|
| 222 | + $var = !$var; |
|
| 223 | 223 | print '<tr '.$bc[$var].'>'; |
| 224 | 224 | print '<td>'.$langs->trans("SUBTOTAL_ONE_LINE_IF_HIDE_INNERLINES", $langs->transnoentitiesnoconv('HideInnerLines')).'</td>'; |
| 225 | 225 | print '<td align="center" width="20"> </td>'; |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | print ajax_constantonoff('SUBTOTAL_ONE_LINE_IF_HIDE_INNERLINES'); |
| 228 | 228 | print '</td></tr>'; |
| 229 | 229 | |
| 230 | - $var=!$var; |
|
| 230 | + $var = !$var; |
|
| 231 | 231 | print '<tr '.$bc[$var].'>'; |
| 232 | 232 | print '<td>'.$langs->trans("SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES", $langs->transnoentitiesnoconv('HideInnerLines')).'</td>'; |
| 233 | 233 | print '<td align="center" width="20"> </td>'; |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | |
| 238 | 238 | if ((double) DOL_VERSION >= 4.0) |
| 239 | 239 | { |
| 240 | - $var=!$var; |
|
| 240 | + $var = !$var; |
|
| 241 | 241 | print '<tr '.$bc[$var].'>'; |
| 242 | 242 | print '<td>'.$langs->trans("SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS").'</td>'; |
| 243 | 243 | print '<td align="center" width="20"> </td>'; |
@@ -245,12 +245,12 @@ discard block |
||
| 245 | 245 | print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">'; |
| 246 | 246 | print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
| 247 | 247 | print '<input type="hidden" name="action" value="set_SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS">'; |
| 248 | - print $html->selectyesno("SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS",$conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS,1); |
|
| 248 | + print $html->selectyesno("SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS", $conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS, 1); |
|
| 249 | 249 | print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'; |
| 250 | 250 | print '</form>'; |
| 251 | 251 | print '</td></tr>'; |
| 252 | 252 | |
| 253 | - $var=!$var; |
|
| 253 | + $var = !$var; |
|
| 254 | 254 | print '<tr '.$bc[$var].'>'; |
| 255 | 255 | print '<td>'.$langs->trans("SUBTOTAL_TFIELD_TO_KEEP_WITH_NC").'</td>'; |
| 256 | 256 | print '<td align="center" width="20"> </td>'; |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | print '</td></tr>'; |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | - $var=!$var; |
|
| 268 | + $var = !$var; |
|
| 269 | 269 | print '<tr '.$bc[$var].'>'; |
| 270 | 270 | print '<td>'.$langs->trans('SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE').'</td>'; |
| 271 | 271 | print '<td align="center" width="20"> </td>'; |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | print ajax_constantonoff('SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE'); |
| 274 | 274 | print '</td></tr>'; |
| 275 | 275 | |
| 276 | - $var=!$var; |
|
| 276 | + $var = !$var; |
|
| 277 | 277 | print '<tr '.$bc[$var].'>'; |
| 278 | 278 | print '<td>'.$langs->trans('SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE').'</td>'; |
| 279 | 279 | print '<td align="center" width="20"> </td>'; |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | |
| 286 | 286 | |
| 287 | 287 | |
| 288 | - $var=false; |
|
| 288 | + $var = false; |
|
| 289 | 289 | print '<table class="noborder" width="100%">'; |
| 290 | 290 | print '<tr class="liste_titre">'; |
| 291 | 291 | print '<td>'.$langs->trans("RecapGeneration").'</td>'."\n"; |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n"; |
| 294 | 294 | print '</tr>'; |
| 295 | 295 | |
| 296 | - $var=!$var; |
|
| 296 | + $var = !$var; |
|
| 297 | 297 | print '<tr '.$bc[$var].'>'; |
| 298 | 298 | print '<td>'.$langs->trans('SUBTOTAL_KEEP_RECAP_FILE').'</td>'; |
| 299 | 299 | print '<td align="center" width="20"> </td>'; |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | print ajax_constantonoff('SUBTOTAL_KEEP_RECAP_FILE'); |
| 302 | 302 | print '</td></tr>'; |
| 303 | 303 | |
| 304 | - $var=!$var; |
|
| 304 | + $var = !$var; |
|
| 305 | 305 | print '<tr '.$bc[$var].'>'; |
| 306 | 306 | print '<td>'.$langs->trans('SUBTOTAL_PROPAL_ADD_RECAP').'</td>'; |
| 307 | 307 | print '<td align="center" width="20"> </td>'; |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | print ajax_constantonoff('SUBTOTAL_PROPAL_ADD_RECAP'); |
| 310 | 310 | print '</td></tr>'; |
| 311 | 311 | |
| 312 | - $var=!$var; |
|
| 312 | + $var = !$var; |
|
| 313 | 313 | print '<tr '.$bc[$var].'>'; |
| 314 | 314 | print '<td>'.$langs->trans('SUBTOTAL_COMMANDE_ADD_RECAP').'</td>'; |
| 315 | 315 | print '<td align="center" width="20"> </td>'; |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | print '</td></tr>'; |
| 319 | 319 | |
| 320 | 320 | |
| 321 | - $var=!$var; |
|
| 321 | + $var = !$var; |
|
| 322 | 322 | print '<tr '.$bc[$var].'>'; |
| 323 | 323 | print '<td>'.$langs->trans('SUBTOTAL_INVOICE_ADD_RECAP').'</td>'; |
| 324 | 324 | print '<td align="center" width="20"> </td>'; |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | <form method="POST" action="<?php echo $_SERVER['PHP_SELF'] ?>"> |
| 351 | 351 | <input type="hidden" name="token" value="<?php echo $_SESSION['newtoken'] ?>"> |
| 352 | 352 | <input type="hidden" name="action" value="set_SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY" /> |
| 353 | - <?php echo $html->selectyesno("SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY",$conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY,1); ?> |
|
| 353 | + <?php echo $html->selectyesno("SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY", $conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY, 1); ?> |
|
| 354 | 354 | <input type="submit" class="button" value="<?php echo $langs->trans("Modify") ?>"> |
| 355 | 355 | </form> |
| 356 | 356 | </td> |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | <form method="POST" action="<?php echo $_SERVER['PHP_SELF'] ?>"> |
| 363 | 363 | <input type="hidden" name="token" value="<?php echo $_SESSION['newtoken'] ?>"> |
| 364 | 364 | <input type="hidden" name="action" value="set_SUBTOTAL_HIDE_DOCUMENT_TOTAL" /> |
| 365 | - <?php echo $html->selectyesno("SUBTOTAL_HIDE_DOCUMENT_TOTAL",$conf->global->SUBTOTAL_HIDE_DOCUMENT_TOTAL,1); ?> |
|
| 365 | + <?php echo $html->selectyesno("SUBTOTAL_HIDE_DOCUMENT_TOTAL", $conf->global->SUBTOTAL_HIDE_DOCUMENT_TOTAL, 1); ?> |
|
| 366 | 366 | <input type="submit" class="button" value="<?php echo $langs->trans("Modify") ?>"> |
| 367 | 367 | </form> |
| 368 | 368 | </td> |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | <form method="POST" action="<?php echo $_SERVER['PHP_SELF'] ?>"> |
| 376 | 376 | <input type="hidden" name="token" value="<?php echo $_SESSION['newtoken'] ?>"> |
| 377 | 377 | <input type="hidden" name="action" value="set_SUBTOTAL_SHOW_QTY_ON_TITLES" /> |
| 378 | - <?php echo $html->selectyesno("SUBTOTAL_SHOW_QTY_ON_TITLES",$conf->global->SUBTOTAL_SHOW_QTY_ON_TITLES,1); ?> |
|
| 378 | + <?php echo $html->selectyesno("SUBTOTAL_SHOW_QTY_ON_TITLES", $conf->global->SUBTOTAL_SHOW_QTY_ON_TITLES, 1); ?> |
|
| 379 | 379 | <input type="submit" class="button" value="<?php echo $langs->trans("Modify") ?>"> |
| 380 | 380 | </form> |
| 381 | 381 | </td> |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | <form method="POST" action="<?php echo $_SERVER['PHP_SELF'] ?>"> |
| 388 | 388 | <input type="hidden" name="token" value="<?php echo $_SESSION['newtoken'] ?>"> |
| 389 | 389 | <input type="hidden" name="action" value="set_SUBTOTAL_ONLY_HIDE_SUBPRODUCTS_PRICES" /> |
| 390 | - <?php echo $html->selectyesno("SUBTOTAL_ONLY_HIDE_SUBPRODUCTS_PRICES",$conf->global->SUBTOTAL_ONLY_HIDE_SUBPRODUCTS_PRICES,1); ?> |
|
| 390 | + <?php echo $html->selectyesno("SUBTOTAL_ONLY_HIDE_SUBPRODUCTS_PRICES", $conf->global->SUBTOTAL_ONLY_HIDE_SUBPRODUCTS_PRICES, 1); ?> |
|
| 391 | 391 | <input type="submit" class="button" value="<?php echo $langs->trans("Modify") ?>"> |
| 392 | 392 | </form> |
| 393 | 393 | </td> |