@@ -13,18 +13,23 @@ discard block |
||
| 13 | 13 | /** |
| 14 | 14 | * @var $object Facture |
| 15 | 15 | */ |
| 16 | - if($object->element=='facture') $res = $object->addline($object->id, $label, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,-1, TSubtotal::$module_number); |
|
| 16 | + if($object->element=='facture') { |
|
| 17 | + $res = $object->addline($object->id, $label, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,-1, TSubtotal::$module_number); |
|
| 18 | + } |
|
| 17 | 19 | /** |
| 18 | 20 | * @var $object Propal |
| 19 | 21 | */ |
| 20 | - else if($object->element=='propal') $res = $object->addline($object->id,$label, 0,$qty,0,0,0,0,0,'HT',0,0,9,-1, TSubtotal::$module_number); |
|
| 22 | + else if($object->element=='propal') { |
|
| 23 | + $res = $object->addline($object->id,$label, 0,$qty,0,0,0,0,0,'HT',0,0,9,-1, TSubtotal::$module_number); |
|
| 24 | + } |
|
| 21 | 25 | /** |
| 22 | 26 | * @var $object Commande |
| 23 | 27 | */ |
| 24 | - else if($object->element=='commande') $res = $object->addline($object->id,$label, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,-1, TSubtotal::$module_number); |
|
| 28 | + else if($object->element=='commande') { |
|
| 29 | + $res = $object->addline($object->id,$label, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,-1, TSubtotal::$module_number); |
|
| 30 | + } |
|
| 25 | 31 | |
| 26 | - } |
|
| 27 | - else { |
|
| 32 | + } else { |
|
| 28 | 33 | $desc = ''; |
| 29 | 34 | if ((float) DOL_VERSION < 6 || $qty==50) { |
| 30 | 35 | $desc = $label; |
@@ -34,19 +39,27 @@ discard block |
||
| 34 | 39 | /** |
| 35 | 40 | * @var $object Facture |
| 36 | 41 | */ |
| 37 | - if($object->element=='facture') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,$rang, TSubtotal::$module_number, '', 0, 0, null, 0, $label); |
|
| 42 | + if($object->element=='facture') { |
|
| 43 | + $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,$rang, TSubtotal::$module_number, '', 0, 0, null, 0, $label); |
|
| 44 | + } |
|
| 38 | 45 | /** |
| 39 | 46 | * @var $object Propal |
| 40 | 47 | */ |
| 41 | - else if($object->element=='propal') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
| 48 | + else if($object->element=='propal') { |
|
| 49 | + $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
| 50 | + } |
|
| 42 | 51 | /** |
| 43 | 52 | * @var $object Commande |
| 44 | 53 | */ |
| 45 | - else if($object->element=='commande') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,$rang, TSubtotal::$module_number, 0, null, 0, $label); |
|
| 54 | + else if($object->element=='commande') { |
|
| 55 | + $res = $object->addline($desc, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,$rang, TSubtotal::$module_number, 0, null, 0, $label); |
|
| 56 | + } |
|
| 46 | 57 | /** |
| 47 | 58 | * @var $object Facturerec |
| 48 | 59 | */ |
| 49 | - else if($object->element=='facturerec') $res = $object->addline($desc, 0,$qty, 0, 0, 0, 0, 0, 'HT', 0, '', 0, 9, $rang, TSubtotal::$module_number,$label); |
|
| 60 | + else if($object->element=='facturerec') { |
|
| 61 | + $res = $object->addline($desc, 0,$qty, 0, 0, 0, 0, 0, 'HT', 0, '', 0, 9, $rang, TSubtotal::$module_number,$label); |
|
| 62 | + } |
|
| 50 | 63 | |
| 51 | 64 | } |
| 52 | 65 | |
@@ -68,8 +81,9 @@ discard block |
||
| 68 | 81 | // Define output language |
| 69 | 82 | $outputlangs = $langs; |
| 70 | 83 | $newlang = GETPOST('lang_id', 'alpha'); |
| 71 | - if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) |
|
| 72 | - $newlang = !empty($object->client) ? $object->client->default_lang : $object->thirdparty->default_lang; |
|
| 84 | + if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) { |
|
| 85 | + $newlang = !empty($object->client) ? $object->client->default_lang : $object->thirdparty->default_lang; |
|
| 86 | + } |
|
| 73 | 87 | if (! empty($newlang)) { |
| 74 | 88 | $outputlangs = new Translate("", $conf); |
| 75 | 89 | $outputlangs->setDefaultLang($newlang); |
@@ -78,13 +92,18 @@ discard block |
||
| 78 | 92 | $ret = $object->fetch($object->id); // Reload to get new records |
| 79 | 93 | if ((float) DOL_VERSION <= 3.6) |
| 80 | 94 | { |
| 81 | - if ($object->element == 'propal') propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 82 | - elseif ($object->element == 'commande') commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 83 | - elseif ($object->element == 'facture') facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 84 | - } |
|
| 85 | - else |
|
| 95 | + if ($object->element == 'propal') { |
|
| 96 | + propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 97 | + } elseif ($object->element == 'commande') { |
|
| 98 | + commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 99 | + } elseif ($object->element == 'facture') { |
|
| 100 | + facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 101 | + } |
|
| 102 | + } else |
|
| 86 | 103 | { |
| 87 | - if ($object->element!= 'facturerec') $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 104 | + if ($object->element!= 'facturerec') { |
|
| 105 | + $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 106 | + } |
|
| 88 | 107 | } |
| 89 | 108 | } |
| 90 | 109 | } |
@@ -98,7 +117,9 @@ discard block |
||
| 98 | 117 | */ |
| 99 | 118 | public static function updateRang(&$object, $rang_start, $move_to=1) |
| 100 | 119 | { |
| 101 | - if (!class_exists('GenericObject')) require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php'; |
|
| 120 | + if (!class_exists('GenericObject')) { |
|
| 121 | + require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php'; |
|
| 122 | + } |
|
| 102 | 123 | |
| 103 | 124 | $row=new GenericObject($object->db); |
| 104 | 125 | $row->table_element_line = $object->table_element_line; |
@@ -107,7 +128,9 @@ discard block |
||
| 107 | 128 | |
| 108 | 129 | foreach ($object->lines as &$line) |
| 109 | 130 | { |
| 110 | - if ($line->rang < $rang_start) continue; |
|
| 131 | + if ($line->rang < $rang_start) { |
|
| 132 | + continue; |
|
| 133 | + } |
|
| 111 | 134 | |
| 112 | 135 | $row->updateRangOfLine($line->id, $line->rang+$move_to); |
| 113 | 136 | } |
@@ -130,21 +153,28 @@ discard block |
||
| 130 | 153 | foreach ($TTitle_reverse as $k => $title_line) |
| 131 | 154 | { |
| 132 | 155 | $title_niveau = self::getNiveau($title_line); |
| 133 | - if ($title_niveau < $level_new_title) break; |
|
| 156 | + if ($title_niveau < $level_new_title) { |
|
| 157 | + break; |
|
| 158 | + } |
|
| 134 | 159 | |
| 135 | 160 | $rang_to_add = self::titleHasTotalLine($object, $title_line, true, true); |
| 136 | 161 | |
| 137 | 162 | if (is_numeric($rang_to_add)) |
| 138 | 163 | { |
| 139 | - if ($rang_to_add != -1) self::updateRang($object, $rang_to_add); |
|
| 164 | + if ($rang_to_add != -1) { |
|
| 165 | + self::updateRang($object, $rang_to_add); |
|
| 166 | + } |
|
| 140 | 167 | |
| 141 | 168 | self::addSubTotalLine($object, $langs->trans('SubTotal'), 100-$title_niveau, $rang_to_add); |
| 142 | 169 | |
| 143 | 170 | $object->lines[] = $object->line; // ajout de la ligne dans le tableau de ligne (Dolibarr ne le fait pas) |
| 144 | 171 | if ($rang_to_add != -1) |
| 145 | 172 | { |
| 146 | - if (method_exists($object, 'fetch_lines')) $object->fetch_lines(); |
|
| 147 | - else $object->fetch($object->id); |
|
| 173 | + if (method_exists($object, 'fetch_lines')) { |
|
| 174 | + $object->fetch_lines(); |
|
| 175 | + } else { |
|
| 176 | + $object->fetch($object->id); |
|
| 177 | + } |
|
| 148 | 178 | } |
| 149 | 179 | } |
| 150 | 180 | } |
@@ -174,7 +204,9 @@ discard block |
||
| 174 | 204 | |
| 175 | 205 | foreach ($TTitle as $k => $title_line) |
| 176 | 206 | { |
| 177 | - if (self::titleHasTotalLine($object, $title_line)) unset($TTitle[$k]); |
|
| 207 | + if (self::titleHasTotalLine($object, $title_line)) { |
|
| 208 | + unset($TTitle[$k]); |
|
| 209 | + } |
|
| 178 | 210 | } |
| 179 | 211 | |
| 180 | 212 | return $TTitle; |
@@ -191,23 +223,41 @@ discard block |
||
| 191 | 223 | */ |
| 192 | 224 | public static function titleHasTotalLine(&$object, &$title_line, $strict_mode=false, $return_rang_on_false=false) |
| 193 | 225 | { |
| 194 | - if (empty($object->lines) || !is_array($object->lines)) return false; |
|
| 226 | + if (empty($object->lines) || !is_array($object->lines)) { |
|
| 227 | + return false; |
|
| 228 | + } |
|
| 195 | 229 | |
| 196 | 230 | $title_niveau = self::getNiveau($title_line); |
| 197 | 231 | foreach ($object->lines as &$line) |
| 198 | 232 | { |
| 199 | - if ($line->rang <= $title_line->rang) continue; |
|
| 200 | - if (self::isTitle($line) && self::getNiveau($line) <= $title_niveau) return false; // Oups on croise un titre d'un niveau inférieur ou égale (exemple : je croise un titre niveau 2 alors que je suis sur un titre de niveau 3) pas lieu de continuer car un nouveau bloc commence |
|
| 201 | - if (!self::isSubtotal($line)) continue; |
|
| 233 | + if ($line->rang <= $title_line->rang) { |
|
| 234 | + continue; |
|
| 235 | + } |
|
| 236 | + if (self::isTitle($line) && self::getNiveau($line) <= $title_niveau) { |
|
| 237 | + return false; |
|
| 238 | + } |
|
| 239 | + // Oups on croise un titre d'un niveau inférieur ou égale (exemple : je croise un titre niveau 2 alors que je suis sur un titre de niveau 3) pas lieu de continuer car un nouveau bloc commence |
|
| 240 | + if (!self::isSubtotal($line)) { |
|
| 241 | + continue; |
|
| 242 | + } |
|
| 202 | 243 | |
| 203 | 244 | $subtotal_niveau = self::getNiveau($line); |
| 204 | 245 | |
| 205 | 246 | // Comparaison du niveau de la ligne de sous-total avec celui du titre |
| 206 | - if ($subtotal_niveau == $title_niveau) return true; // niveau égale => Ok mon titre a un sous-total |
|
| 207 | - elseif ($subtotal_niveau < $title_niveau) // niveau inférieur trouvé (exemple : sous-total de niveau 1 contre mon titre de niveau 3) |
|
| 247 | + if ($subtotal_niveau == $title_niveau) { |
|
| 248 | + return true; |
|
| 249 | + } |
|
| 250 | + // niveau égale => Ok mon titre a un sous-total |
|
| 251 | + elseif ($subtotal_niveau < $title_niveau) { |
|
| 252 | + // niveau inférieur trouvé (exemple : sous-total de niveau 1 contre mon titre de niveau 3) |
|
| 208 | 253 | { |
| 209 | - if ($strict_mode) return ($return_rang_on_false) ? $line->rang : false; // mode strict niveau pas égale donc faux |
|
| 210 | - else return true; // mode libre => OK je considère que mon titre à un sous-total |
|
| 254 | + if ($strict_mode) return ($return_rang_on_false) ? $line->rang : false; |
|
| 255 | + } |
|
| 256 | + // mode strict niveau pas égale donc faux |
|
| 257 | + else { |
|
| 258 | + return true; |
|
| 259 | + } |
|
| 260 | + // mode libre => OK je considère que mon titre à un sous-total |
|
| 211 | 261 | } |
| 212 | 262 | } |
| 213 | 263 | |
@@ -255,16 +305,19 @@ discard block |
||
| 255 | 305 | |
| 256 | 306 | foreach ($object->lines as &$l) |
| 257 | 307 | { |
| 258 | - if ($l->rang <= $line->rang) continue; |
|
| 259 | - elseif (self::isSubtotal($l) && self::getNiveau($l) == $line->qty) break; |
|
| 260 | - elseif (self::isModSubtotalLine($l)) continue; |
|
| 308 | + if ($l->rang <= $line->rang) { |
|
| 309 | + continue; |
|
| 310 | + } elseif (self::isSubtotal($l) && self::getNiveau($l) == $line->qty) { |
|
| 311 | + break; |
|
| 312 | + } elseif (self::isModSubtotalLine($l)) { |
|
| 313 | + continue; |
|
| 314 | + } |
|
| 261 | 315 | |
| 262 | 316 | if (!empty($l->array_options['options_subtotal_nc'])) |
| 263 | 317 | { |
| 264 | 318 | $tabprice = calcul_price_total($l->qty, $l->subprice, $l->remise_percent, $l->tva_tx, $l->localtax1_tx, $l->localtax2_tx, 0, 'HT', $l->info_bits, $l->product_type); |
| 265 | 319 | $TTot['total_options'] += $tabprice[0]; // total ht |
| 266 | - } |
|
| 267 | - else |
|
| 320 | + } else |
|
| 268 | 321 | { |
| 269 | 322 | $TTot['total_pa_ht'] += $l->pa_ht * $l->qty; |
| 270 | 323 | $TTot['total_ht'] += $l->total_ht; |
@@ -283,29 +336,41 @@ discard block |
||
| 283 | 336 | |
| 284 | 337 | public static function getOrderIdFromLineId(&$db, $fk_commandedet) |
| 285 | 338 | { |
| 286 | - if (empty($fk_commandedet)) return false; |
|
| 339 | + if (empty($fk_commandedet)) { |
|
| 340 | + return false; |
|
| 341 | + } |
|
| 287 | 342 | |
| 288 | 343 | $sql = 'SELECT fk_commande FROM '.MAIN_DB_PREFIX.'commandedet WHERE rowid = '.$fk_commandedet; |
| 289 | 344 | $resql = $db->query($sql); |
| 290 | 345 | |
| 291 | - if ($resql && ($row = $db->fetch_object($resql))) return $row->fk_commande; |
|
| 292 | - else return false; |
|
| 346 | + if ($resql && ($row = $db->fetch_object($resql))) { |
|
| 347 | + return $row->fk_commande; |
|
| 348 | + } else { |
|
| 349 | + return false; |
|
| 350 | + } |
|
| 293 | 351 | } |
| 294 | 352 | |
| 295 | 353 | public static function getLastLineOrderId(&$db, $fk_commande) |
| 296 | 354 | { |
| 297 | - if (empty($fk_commande)) return false; |
|
| 355 | + if (empty($fk_commande)) { |
|
| 356 | + return false; |
|
| 357 | + } |
|
| 298 | 358 | |
| 299 | 359 | $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'commandedet WHERE fk_commande = '.$fk_commande.' ORDER BY rang DESC LIMIT 1'; |
| 300 | 360 | $resql = $db->query($sql); |
| 301 | 361 | |
| 302 | - if ($resql && ($row = $db->fetch_object($resql))) return $row->rowid; |
|
| 303 | - else return false; |
|
| 362 | + if ($resql && ($row = $db->fetch_object($resql))) { |
|
| 363 | + return $row->rowid; |
|
| 364 | + } else { |
|
| 365 | + return false; |
|
| 366 | + } |
|
| 304 | 367 | } |
| 305 | 368 | |
| 306 | 369 | public static function getParentTitleOfLine(&$object, $i) |
| 307 | 370 | { |
| 308 | - if ($i <= 0) return false; |
|
| 371 | + if ($i <= 0) { |
|
| 372 | + return false; |
|
| 373 | + } |
|
| 309 | 374 | |
| 310 | 375 | $skip_title = 0; |
| 311 | 376 | // Je parcours les lignes précédentes |
@@ -324,8 +389,7 @@ discard block |
||
| 324 | 389 | //@INFO J'ai ma ligne titre qui contient ma ligne, par contre je check pas s'il y a un sous-total |
| 325 | 390 | return $line; |
| 326 | 391 | break; |
| 327 | - } |
|
| 328 | - elseif ($line->product_type == 9 && $line->qty >= 90 && $line->qty <= 99) |
|
| 392 | + } elseif ($line->product_type == 9 && $line->qty >= 90 && $line->qty <= 99) |
|
| 329 | 393 | { |
| 330 | 394 | // Il s'agit d'un sous-total, ça veut dire que le prochain titre théoriquement doit être ignorer (je travail avec un incrément au cas ou je croise plusieurs sous-totaux) |
| 331 | 395 | $skip_title++; |
@@ -340,7 +404,9 @@ discard block |
||
| 340 | 404 | $res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty <= 9; |
| 341 | 405 | if($res && $level > -1) { |
| 342 | 406 | return $line->qty == $level; |
| 343 | - } else return $res; |
|
| 407 | + } else { |
|
| 408 | + return $res; |
|
| 409 | + } |
|
| 344 | 410 | |
| 345 | 411 | } |
| 346 | 412 | |
@@ -367,10 +433,14 @@ discard block |
||
| 367 | 433 | // editeur wysiwyg |
| 368 | 434 | require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
| 369 | 435 | $nbrows=ROWS_2; |
| 370 | - if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
| 436 | + if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { |
|
| 437 | + $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
| 438 | + } |
|
| 371 | 439 | $enable=(isset($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0); |
| 372 | 440 | $toolbarname='dolibarr_details'; |
| 373 | - if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes'; |
|
| 441 | + if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) { |
|
| 442 | + $toolbarname='dolibarr_notes'; |
|
| 443 | + } |
|
| 374 | 444 | $text = !empty($line->description)?$line->description:$line->label; |
| 375 | 445 | $doleditor=new DolEditor('line-description',$text,'',164,$toolbarname,'',false,true,$enable,$nbrows,'98%', $readonly); |
| 376 | 446 | return $doleditor->Create(1); |
@@ -416,8 +486,9 @@ discard block |
||
| 416 | 486 | |
| 417 | 487 | $TLineAdded[] = $object->line; |
| 418 | 488 | // Error from addline |
| 419 | - if ($res <= 0) break; |
|
| 420 | - else |
|
| 489 | + if ($res <= 0) { |
|
| 490 | + break; |
|
| 491 | + } else |
|
| 421 | 492 | { |
| 422 | 493 | $object->line_from = $line; |
| 423 | 494 | // Call trigger |
@@ -440,8 +511,7 @@ discard block |
||
| 440 | 511 | { |
| 441 | 512 | $object->db->commit(); |
| 442 | 513 | return count($TLine); |
| 443 | - } |
|
| 444 | - else |
|
| 514 | + } else |
|
| 445 | 515 | { |
| 446 | 516 | $object->db->rollback(); |
| 447 | 517 | return -1; |
@@ -457,10 +527,14 @@ discard block |
||
| 457 | 527 | global $langs; |
| 458 | 528 | |
| 459 | 529 | // Besoin de comparer sur les 2 formes d'écriture |
| 460 | - if (!$key_is_id) $TTitle_search = array($langs->trans($key_trad), $langs->transnoentitiesnoconv($key_trad)); |
|
| 530 | + if (!$key_is_id) { |
|
| 531 | + $TTitle_search = array($langs->trans($key_trad), $langs->transnoentitiesnoconv($key_trad)); |
|
| 532 | + } |
|
| 461 | 533 | |
| 462 | 534 | $TTitle_under_search = array(); |
| 463 | - if (!empty($under_title)) $TTitle_under_search = array($langs->trans($under_title), $langs->transnoentitiesnoconv($under_title)); |
|
| 535 | + if (!empty($under_title)) { |
|
| 536 | + $TTitle_under_search = array($langs->trans($under_title), $langs->transnoentitiesnoconv($under_title)); |
|
| 537 | + } |
|
| 464 | 538 | |
| 465 | 539 | $TLine = array(); |
| 466 | 540 | $add_line = false; |
@@ -470,28 +544,37 @@ discard block |
||
| 470 | 544 | { |
| 471 | 545 | if (!$under_title_found && !empty($TTitle_under_search)) |
| 472 | 546 | { |
| 473 | - if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search)) ) $under_title_found = true; |
|
| 474 | - } |
|
| 475 | - else |
|
| 547 | + if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search)) ) { |
|
| 548 | + $under_title_found = true; |
|
| 549 | + } |
|
| 550 | + } else |
|
| 476 | 551 | { |
| 477 | 552 | if ( ($key_is_id && $line->id == $key_trad) || (!$key_is_id && $line->product_type == 9 && $line->qty == $level && (in_array($line->desc, $TTitle_search) || in_array($line->label, $TTitle_search) ))) |
| 478 | 553 | { |
| 479 | - if ($key_is_id) $level = $line->qty; |
|
| 554 | + if ($key_is_id) { |
|
| 555 | + $level = $line->qty; |
|
| 556 | + } |
|
| 480 | 557 | |
| 481 | 558 | $add_line = true; |
| 482 | - if ($withBlockLine) $TLine[] = $line; |
|
| 559 | + if ($withBlockLine) { |
|
| 560 | + $TLine[] = $line; |
|
| 561 | + } |
|
| 483 | 562 | continue; |
| 484 | - } |
|
| 485 | - elseif ($add_line && $line->product_type == 9 && (100 - $line->qty == $level) ) // Si on tombe sur un sous-total, il faut que ce soit un du même niveau que le titre |
|
| 563 | + } elseif ($add_line && $line->product_type == 9 && (100 - $line->qty == $level) ) { |
|
| 564 | + // Si on tombe sur un sous-total, il faut que ce soit un du même niveau que le titre |
|
| 486 | 565 | { |
| 487 | 566 | if ($withBlockLine) $TLine[] = $line; |
| 567 | + } |
|
| 488 | 568 | break; |
| 489 | 569 | } |
| 490 | 570 | |
| 491 | 571 | if ($add_line) |
| 492 | 572 | { |
| 493 | - if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line)) ) continue; |
|
| 494 | - else $TLine[] = $line; |
|
| 573 | + if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line)) ) { |
|
| 574 | + continue; |
|
| 575 | + } else { |
|
| 576 | + $TLine[] = $line; |
|
| 577 | + } |
|
| 495 | 578 | } |
| 496 | 579 | } |
| 497 | 580 | } |
@@ -536,8 +619,11 @@ discard block |
||
| 536 | 619 | break; |
| 537 | 620 | } |
| 538 | 621 | |
| 539 | - if ($res <= 0) $object->db->rollback(); |
|
| 540 | - else $object->db->commit(); |
|
| 622 | + if ($res <= 0) { |
|
| 623 | + $object->db->rollback(); |
|
| 624 | + } else { |
|
| 625 | + $object->db->commit(); |
|
| 626 | + } |
|
| 541 | 627 | |
| 542 | 628 | return $res; |
| 543 | 629 | } |
@@ -547,24 +633,20 @@ discard block |
||
| 547 | 633 | global $db, $object; |
| 548 | 634 | |
| 549 | 635 | $TTitle = array(); |
| 550 | - if(! empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {} |
|
| 551 | - else { |
|
| 636 | + if(! empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {} else { |
|
| 552 | 637 | if ($origin_line->element == 'propaldet') |
| 553 | 638 | { |
| 554 | 639 | $object = new Propal($db); |
| 555 | 640 | $object->fetch($origin_line->fk_propal); |
| 556 | - } |
|
| 557 | - else if ($origin_line->element == 'commandedet') |
|
| 641 | + } else if ($origin_line->element == 'commandedet') |
|
| 558 | 642 | { |
| 559 | 643 | $object = new Commande($db); |
| 560 | 644 | $object->fetch($origin_line->fk_commande); |
| 561 | - } |
|
| 562 | - else if ($origin_line->element == 'facturedet') |
|
| 645 | + } else if ($origin_line->element == 'facturedet') |
|
| 563 | 646 | { |
| 564 | 647 | $object = new Facture($db); |
| 565 | 648 | $object->fetch($origin_line->fk_facture); |
| 566 | - } |
|
| 567 | - else |
|
| 649 | + } else |
|
| 568 | 650 | { |
| 569 | 651 | return $TTitle; |
| 570 | 652 | } |
@@ -574,8 +656,11 @@ discard block |
||
| 574 | 656 | $i = 0; |
| 575 | 657 | foreach ($object->lines as &$line) |
| 576 | 658 | { |
| 577 | - if ($origin_line->id == $line->id) break; |
|
| 578 | - else $i++; |
|
| 659 | + if ($origin_line->id == $line->id) { |
|
| 660 | + break; |
|
| 661 | + } else { |
|
| 662 | + $i++; |
|
| 663 | + } |
|
| 579 | 664 | } |
| 580 | 665 | |
| 581 | 666 | $i--; // Skip la ligne d'origine |
@@ -590,35 +675,43 @@ discard block |
||
| 590 | 675 | if (self::isSubtotal($object->lines[$y])) |
| 591 | 676 | { |
| 592 | 677 | $next_title_lvl_to_skip = self::getNiveau($object->lines[$y]); |
| 593 | - } |
|
| 594 | - elseif (self::isTitle($object->lines[$y])) |
|
| 678 | + } elseif (self::isTitle($object->lines[$y])) |
|
| 595 | 679 | { |
| 596 | 680 | if ($object->lines[$y]->qty == $next_title_lvl_to_skip) |
| 597 | 681 | { |
| 598 | 682 | $next_title_lvl_to_skip = 0; |
| 599 | 683 | continue; |
| 600 | - } |
|
| 601 | - else |
|
| 684 | + } else |
|
| 602 | 685 | { |
| 603 | - if (empty($object->lines[$y]->array_options)) $object->lines[$y]->fetch_optionals(); |
|
| 686 | + if (empty($object->lines[$y]->array_options)) { |
|
| 687 | + $object->lines[$y]->fetch_optionals(); |
|
| 688 | + } |
|
| 604 | 689 | $TTitle[$object->lines[$y]->id] = $object->lines[$y]; |
| 605 | 690 | |
| 606 | - if ($object->lines[$y]->qty == 1) break; |
|
| 691 | + if ($object->lines[$y]->qty == 1) { |
|
| 692 | + break; |
|
| 693 | + } |
|
| 607 | 694 | } |
| 608 | 695 | } |
| 609 | 696 | } |
| 610 | 697 | } |
| 611 | 698 | |
| 612 | - if ($reverse) $TTitle = array_reverse($TTitle, true); |
|
| 699 | + if ($reverse) { |
|
| 700 | + $TTitle = array_reverse($TTitle, true); |
|
| 701 | + } |
|
| 613 | 702 | |
| 614 | 703 | return $TTitle; |
| 615 | 704 | } |
| 616 | 705 | |
| 617 | 706 | public static function getNiveau(&$line) |
| 618 | 707 | { |
| 619 | - if (self::isTitle($line)) return $line->qty; |
|
| 620 | - elseif (self::isSubtotal($line)) return 100 - $line->qty; |
|
| 621 | - else return 0; |
|
| 708 | + if (self::isTitle($line)) { |
|
| 709 | + return $line->qty; |
|
| 710 | + } elseif (self::isSubtotal($line)) { |
|
| 711 | + return 100 - $line->qty; |
|
| 712 | + } else { |
|
| 713 | + return 0; |
|
| 714 | + } |
|
| 622 | 715 | } |
| 623 | 716 | |
| 624 | 717 | /** |
@@ -643,10 +736,16 @@ discard block |
||
| 643 | 736 | $objmarge->marge_droite = 10; |
| 644 | 737 | |
| 645 | 738 | $objectref = dol_sanitizeFileName($object->ref); |
| 646 | - if ($object->element == 'propal') $dir = $conf->propal->dir_output . '/' . $objectref; |
|
| 647 | - elseif ($object->element == 'commande') $dir = $conf->commande->dir_output . '/' . $objectref; |
|
| 648 | - elseif ($object->element == 'facture') $dir = $conf->facture->dir_output . '/' . $objectref; |
|
| 649 | - elseif ($object->element == 'facturerec') return; // no PDF for facturerec |
|
| 739 | + if ($object->element == 'propal') { |
|
| 740 | + $dir = $conf->propal->dir_output . '/' . $objectref; |
|
| 741 | + } elseif ($object->element == 'commande') { |
|
| 742 | + $dir = $conf->commande->dir_output . '/' . $objectref; |
|
| 743 | + } elseif ($object->element == 'facture') { |
|
| 744 | + $dir = $conf->facture->dir_output . '/' . $objectref; |
|
| 745 | + } elseif ($object->element == 'facturerec') { |
|
| 746 | + return; |
|
| 747 | + } |
|
| 748 | + // no PDF for facturerec |
|
| 650 | 749 | else |
| 651 | 750 | { |
| 652 | 751 | setEventMessage($langs->trans('warning_subtotal_recap_object_element_unknown', $object->element), 'warnings'); |
@@ -681,7 +780,9 @@ discard block |
||
| 681 | 780 | $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
| 682 | 781 | $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
| 683 | 782 | $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("subtotalRecap")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); |
| 684 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 783 | + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { |
|
| 784 | + $pdf->SetCompression(false); |
|
| 785 | + } |
|
| 685 | 786 | |
| 686 | 787 | $pdf->SetMargins($objmarge->marge_gauche, $objmarge->marge_haute, $objmarge->marge_droite); // Left, Top, Right |
| 687 | 788 | |
@@ -691,7 +792,9 @@ discard block |
||
| 691 | 792 | |
| 692 | 793 | // New page |
| 693 | 794 | $pdf->AddPage(); |
| 694 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 795 | + if (! empty($tplidx)) { |
|
| 796 | + $pdf->useTemplate($tplidx); |
|
| 797 | + } |
|
| 695 | 798 | $pagenb++; |
| 696 | 799 | |
| 697 | 800 | |
@@ -747,8 +850,10 @@ discard block |
||
| 747 | 850 | { |
| 748 | 851 | $TTot['TTotal_tva_multicurrency'][$tx] += $amount; |
| 749 | 852 | } |
| 853 | + } else { |
|
| 854 | + $pdf->SetFont('','', $default_font_size - 1); |
|
| 750 | 855 | } |
| 751 | - else $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage |
|
| 856 | + // Into loop to work with multipage |
|
| 752 | 857 | |
| 753 | 858 | $pdf->SetTextColor(0,0,0); |
| 754 | 859 | |
@@ -770,9 +875,11 @@ discard block |
||
| 770 | 875 | $pdf->startTransaction(); |
| 771 | 876 | $pdf->writeHTMLCell($posx_options-$posx_designation-$decalage, 3, $posx_designation+$decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J',true); |
| 772 | 877 | $pageposafter=$pdf->getPage(); |
| 773 | - if ($pageposafter > $pageposbefore) // There is a pagebreak |
|
| 878 | + if ($pageposafter > $pageposbefore) { |
|
| 879 | + // There is a pagebreak |
|
| 774 | 880 | { |
| 775 | 881 | $pdf->rollbackTransaction(true); |
| 882 | + } |
|
| 776 | 883 | $pageposafter=$pageposbefore; |
| 777 | 884 | //print $pageposafter.'-'.$pageposbefore;exit; |
| 778 | 885 | $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
@@ -781,23 +888,27 @@ discard block |
||
| 781 | 888 | $pageposafter=$pdf->getPage(); |
| 782 | 889 | $posyafter=$pdf->GetY(); |
| 783 | 890 | //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; |
| 784 | - if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter+$heightforinfotot))) // There is no space left for total+free text |
|
| 891 | + if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter+$heightforinfotot))) { |
|
| 892 | + // There is no space left for total+free text |
|
| 785 | 893 | { |
| 786 | 894 | if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page |
| 787 | 895 | { |
| 788 | 896 | $pdf->AddPage('','',true); |
| 789 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 790 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
|
| 897 | + } |
|
| 898 | + if (! empty($tplidx)) { |
|
| 899 | + $pdf->useTemplate($tplidx); |
|
| 900 | + } |
|
| 901 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { |
|
| 902 | + self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
|
| 903 | + } |
|
| 791 | 904 | $pdf->setPage($pageposafter+1); |
| 792 | 905 | } |
| 793 | - } |
|
| 794 | - else |
|
| 906 | + } else |
|
| 795 | 907 | { |
| 796 | 908 | // We found a page break |
| 797 | 909 | $showpricebeforepagebreak=0; |
| 798 | 910 | } |
| 799 | - } |
|
| 800 | - else // No pagebreak |
|
| 911 | + } else // No pagebreak |
|
| 801 | 912 | { |
| 802 | 913 | $pdf->commitTransaction(); |
| 803 | 914 | } |
@@ -837,8 +948,7 @@ discard block |
||
| 837 | 948 | if ($pagenb == 1) |
| 838 | 949 | { |
| 839 | 950 | self::tableau($objmarge, $pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $objmarge->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); |
| 840 | - } |
|
| 841 | - else |
|
| 951 | + } else |
|
| 842 | 952 | { |
| 843 | 953 | self::tableau($objmarge, $pdf, $posx_designation, $posx_options, $posx_montant, $tab_top_newpage, $objmarge->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code); |
| 844 | 954 | } |
@@ -846,7 +956,9 @@ discard block |
||
| 846 | 956 | $pagenb++; |
| 847 | 957 | $pdf->setPage($pagenb); |
| 848 | 958 | $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
| 849 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
|
| 959 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { |
|
| 960 | + self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
|
| 961 | + } |
|
| 850 | 962 | } |
| 851 | 963 | } |
| 852 | 964 | } |
@@ -856,8 +968,7 @@ discard block |
||
| 856 | 968 | { |
| 857 | 969 | self::tableau($objmarge, $pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $objmarge->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code); |
| 858 | 970 | $bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
| 859 | - } |
|
| 860 | - else |
|
| 971 | + } else |
|
| 861 | 972 | { |
| 862 | 973 | self::tableau($objmarge, $pdf, $posx_designation, $posx_options, $posx_montant, $tab_top_newpage, $objmarge->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code); |
| 863 | 974 | $bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
@@ -871,7 +982,9 @@ discard block |
||
| 871 | 982 | |
| 872 | 983 | $pagecount = self::concat($outputlangs, array($origin_file, $file), $origin_file); |
| 873 | 984 | |
| 874 | - if (empty($conf->global->SUBTOTAL_KEEP_RECAP_FILE)) unlink($file); |
|
| 985 | + if (empty($conf->global->SUBTOTAL_KEEP_RECAP_FILE)) { |
|
| 986 | + unlink($file); |
|
| 987 | + } |
|
| 875 | 988 | } |
| 876 | 989 | |
| 877 | 990 | private static function printLevel($objmarge, $pdf, $line, $curY, $posx_designation) |
@@ -914,8 +1027,7 @@ discard block |
||
| 914 | 1027 | { |
| 915 | 1028 | $height=pdf_getHeightForLogo($logo); |
| 916 | 1029 | $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
| 917 | - } |
|
| 918 | - else |
|
| 1030 | + } else |
|
| 919 | 1031 | { |
| 920 | 1032 | $pdf->SetTextColor(200,0,0); |
| 921 | 1033 | $pdf->SetFont('','B',$default_font_size - 2); |
@@ -924,8 +1036,7 @@ discard block |
||
| 924 | 1036 | } |
| 925 | 1037 | |
| 926 | 1038 | $posy+=35; |
| 927 | - } |
|
| 928 | - else |
|
| 1039 | + } else |
|
| 929 | 1040 | { |
| 930 | 1041 | $text=$mysoc->name; |
| 931 | 1042 | $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); |
@@ -939,9 +1050,13 @@ discard block |
||
| 939 | 1050 | $pdf->SetXY($objmarge->marge_gauche,$posy); |
| 940 | 1051 | |
| 941 | 1052 | $key = 'subtotalPropalTitle'; |
| 942 | - if ($object->element == 'commande') $key = 'subtotalCommandeTitle'; |
|
| 943 | - elseif ($object->element == 'facture') $key = 'subtotalInvoiceTitle'; |
|
| 944 | - elseif ($object->element == 'facturerec') $key = 'subtotalInvoiceTitle'; |
|
| 1053 | + if ($object->element == 'commande') { |
|
| 1054 | + $key = 'subtotalCommandeTitle'; |
|
| 1055 | + } elseif ($object->element == 'facture') { |
|
| 1056 | + $key = 'subtotalInvoiceTitle'; |
|
| 1057 | + } elseif ($object->element == 'facturerec') { |
|
| 1058 | + $key = 'subtotalInvoiceTitle'; |
|
| 1059 | + } |
|
| 945 | 1060 | |
| 946 | 1061 | $pdf->MultiCell(150, 4, $outputlangs->transnoentities($key, $object->ref, $object->thirdparty->name), '', 'L'); |
| 947 | 1062 | |
@@ -976,7 +1091,9 @@ discard block |
||
| 976 | 1091 | |
| 977 | 1092 | // Force to disable hidetop and hidebottom |
| 978 | 1093 | $hidebottom=0; |
| 979 | - if ($hidetop) $hidetop=-1; |
|
| 1094 | + if ($hidetop) { |
|
| 1095 | + $hidetop=-1; |
|
| 1096 | + } |
|
| 980 | 1097 | |
| 981 | 1098 | $currency = !empty($currency) ? $currency : $conf->currency; |
| 982 | 1099 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
@@ -991,7 +1108,9 @@ discard block |
||
| 991 | 1108 | $pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4.5); |
| 992 | 1109 | $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); |
| 993 | 1110 | |
| 994 | - if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur-$objmarge->marge_droite-$objmarge->marge_gauche, 8, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); |
|
| 1111 | + if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) { |
|
| 1112 | + $pdf->Rect($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur-$objmarge->marge_droite-$objmarge->marge_gauche, 8, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); |
|
| 1113 | + } |
|
| 995 | 1114 | |
| 996 | 1115 | |
| 997 | 1116 | $pdf->line($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur-$objmarge->marge_droite, $tab_top); // line prend une position y en 2eme param et 4eme param |
@@ -1004,8 +1123,7 @@ discard block |
||
| 1004 | 1123 | $pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant,2, $outputlangs->transnoentities("Amount"),'','R'); |
| 1005 | 1124 | |
| 1006 | 1125 | $pdf->line($objmarge->marge_gauche, $tab_top+8, $objmarge->page_largeur-$objmarge->marge_droite, $tab_top+8); // line prend une position y en 2eme param et 4eme param |
| 1007 | - } |
|
| 1008 | - else |
|
| 1126 | + } else |
|
| 1009 | 1127 | { |
| 1010 | 1128 | $pdf->line($objmarge->marge_gauche, $tab_top-2, $objmarge->page_largeur-$objmarge->marge_droite, $tab_top-2); // line prend une position y en 2eme param et 4eme param |
| 1011 | 1129 | } |
@@ -1026,10 +1144,12 @@ discard block |
||
| 1026 | 1144 | |
| 1027 | 1145 | // Tableau total |
| 1028 | 1146 | $col1x = 120; $col2x = 170; |
| 1029 | - if ($objmarge->page_largeur < 210) // To work with US executive format |
|
| 1147 | + if ($objmarge->page_largeur < 210) { |
|
| 1148 | + // To work with US executive format |
|
| 1030 | 1149 | { |
| 1031 | 1150 | $col2x-=20; |
| 1032 | 1151 | } |
| 1152 | + } |
|
| 1033 | 1153 | $largcol2 = ($objmarge->page_largeur - $objmarge->marge_droite - $col2x); |
| 1034 | 1154 | |
| 1035 | 1155 | $useborder=0; |
@@ -1051,9 +1171,11 @@ discard block |
||
| 1051 | 1171 | $atleastoneratenotnull=0; |
| 1052 | 1172 | foreach($TTot['TTotal_tva'] as $tvakey => $tvaval) |
| 1053 | 1173 | { |
| 1054 | - if ($tvakey != 0) // On affiche pas taux 0 |
|
| 1174 | + if ($tvakey != 0) { |
|
| 1175 | + // On affiche pas taux 0 |
|
| 1055 | 1176 | { |
| 1056 | 1177 | $atleastoneratenotnull++; |
| 1178 | + } |
|
| 1057 | 1179 | |
| 1058 | 1180 | $index++; |
| 1059 | 1181 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
@@ -1106,9 +1228,13 @@ discard block |
||
| 1106 | 1228 | */ |
| 1107 | 1229 | private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0) |
| 1108 | 1230 | { |
| 1109 | - if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); |
|
| 1231 | + if (empty($hidetop) || $hidetop==-1) { |
|
| 1232 | + $pdf->line($x, $y, $x+$l, $y); |
|
| 1233 | + } |
|
| 1110 | 1234 | $pdf->line($x+$l, $y, $x+$l, $y+$h); |
| 1111 | - if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
| 1235 | + if (empty($hidebottom)) { |
|
| 1236 | + $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
| 1237 | + } |
|
| 1112 | 1238 | $pdf->line($x, $y+$h, $x, $y); |
| 1113 | 1239 | } |
| 1114 | 1240 | |
@@ -1117,7 +1243,9 @@ discard block |
||
| 1117 | 1243 | { |
| 1118 | 1244 | global $conf; |
| 1119 | 1245 | |
| 1120 | - if (empty($fileoutput)) $fileoutput = $file[0]; |
|
| 1246 | + if (empty($fileoutput)) { |
|
| 1247 | + $fileoutput = $file[0]; |
|
| 1248 | + } |
|
| 1121 | 1249 | |
| 1122 | 1250 | $pdf=pdf_getInstance(); |
| 1123 | 1251 | if (class_exists('TCPDF')) |
@@ -1127,7 +1255,9 @@ discard block |
||
| 1127 | 1255 | } |
| 1128 | 1256 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
| 1129 | 1257 | |
| 1130 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 1258 | + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { |
|
| 1259 | + $pdf->SetCompression(false); |
|
| 1260 | + } |
|
| 1131 | 1261 | |
| 1132 | 1262 | |
| 1133 | 1263 | foreach($files as $file) |
@@ -1143,7 +1273,9 @@ discard block |
||
| 1143 | 1273 | } |
| 1144 | 1274 | |
| 1145 | 1275 | $pdf->Output($fileoutput,'F'); |
| 1146 | - if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
| 1276 | + if (! empty($conf->global->MAIN_UMASK)) { |
|
| 1277 | + @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
| 1278 | + } |
|
| 1147 | 1279 | |
| 1148 | 1280 | return $pagecount; |
| 1149 | 1281 | } |
@@ -1156,7 +1288,9 @@ discard block |
||
| 1156 | 1288 | */ |
| 1157 | 1289 | public static function hasNcTitle(&$line) |
| 1158 | 1290 | { |
| 1159 | - if(isset($line->has_nc_title)) return $line->has_nc_title; |
|
| 1291 | + if(isset($line->has_nc_title)) { |
|
| 1292 | + return $line->has_nc_title; |
|
| 1293 | + } |
|
| 1160 | 1294 | |
| 1161 | 1295 | $TTitle = self::getAllTitleFromLine($line); |
| 1162 | 1296 | foreach ($TTitle as &$line_title) |
@@ -1181,7 +1315,9 @@ discard block |
||
| 1181 | 1315 | public static function getTitleLabel($line) |
| 1182 | 1316 | { |
| 1183 | 1317 | $title = $line->label; |
| 1184 | - if (empty($title)) $title = !empty($line->description) ? $line->description : $line->desc; |
|
| 1318 | + if (empty($title)) { |
|
| 1319 | + $title = !empty($line->description) ? $line->description : $line->desc; |
|
| 1320 | + } |
|
| 1185 | 1321 | return $title; |
| 1186 | 1322 | } |
| 1187 | 1323 | } |