@@ -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 | |
| 30 | 35 | $TNotElements = array ('invoice_supplier', 'order_supplier'); |
@@ -36,7 +41,9 @@ discard block |
||
| 36 | 41 | /** |
| 37 | 42 | * @var $object Facture |
| 38 | 43 | */ |
| 39 | - 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); |
|
| 44 | + if($object->element=='facture') { |
|
| 45 | + $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); |
|
| 46 | + } |
|
| 40 | 47 | /** |
| 41 | 48 | * @var $object Facture fournisseur |
| 42 | 49 | */ |
@@ -48,16 +55,22 @@ discard block |
||
| 48 | 55 | /** |
| 49 | 56 | * @var $object Propal |
| 50 | 57 | */ |
| 51 | - 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); |
|
| 58 | + else if($object->element=='propal') { |
|
| 59 | + $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
| 60 | + } |
|
| 52 | 61 | /** |
| 53 | 62 | * @var $object Propal Fournisseur |
| 54 | 63 | */ |
| 55 | - else if($object->element=='supplier_proposal') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
| 64 | + else if($object->element=='supplier_proposal') { |
|
| 65 | + $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
| 66 | + } |
|
| 56 | 67 | |
| 57 | 68 | /** |
| 58 | 69 | * @var $object Commande |
| 59 | 70 | */ |
| 60 | - 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); |
|
| 71 | + else if($object->element=='commande') { |
|
| 72 | + $res = $object->addline($desc, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,$rang, TSubtotal::$module_number, 0, null, 0, $label); |
|
| 73 | + } |
|
| 61 | 74 | /** |
| 62 | 75 | * @var $object Commande fournisseur |
| 63 | 76 | */ |
@@ -68,7 +81,9 @@ discard block |
||
| 68 | 81 | /** |
| 69 | 82 | * @var $object Facturerec |
| 70 | 83 | */ |
| 71 | - 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); |
|
| 84 | + else if($object->element=='facturerec') { |
|
| 85 | + $res = $object->addline($desc, 0,$qty, 0, 0, 0, 0, 0, 'HT', 0, '', 0, 9, $rang, TSubtotal::$module_number,$label); |
|
| 86 | + } |
|
| 72 | 87 | |
| 73 | 88 | } |
| 74 | 89 | |
@@ -90,8 +105,9 @@ discard block |
||
| 90 | 105 | // Define output language |
| 91 | 106 | $outputlangs = $langs; |
| 92 | 107 | $newlang = GETPOST('lang_id', 'alpha'); |
| 93 | - if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) |
|
| 94 | - $newlang = !empty($object->client) ? $object->client->default_lang : $object->thirdparty->default_lang; |
|
| 108 | + if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) { |
|
| 109 | + $newlang = !empty($object->client) ? $object->client->default_lang : $object->thirdparty->default_lang; |
|
| 110 | + } |
|
| 95 | 111 | if (! empty($newlang)) { |
| 96 | 112 | $outputlangs = new Translate("", $conf); |
| 97 | 113 | $outputlangs->setDefaultLang($newlang); |
@@ -100,13 +116,18 @@ discard block |
||
| 100 | 116 | $ret = $object->fetch($object->id); // Reload to get new records |
| 101 | 117 | if ((float) DOL_VERSION <= 3.6) |
| 102 | 118 | { |
| 103 | - if ($object->element == 'propal') propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 104 | - elseif ($object->element == 'commande') commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 105 | - elseif ($object->element == 'facture') facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 106 | - } |
|
| 107 | - else |
|
| 119 | + if ($object->element == 'propal') { |
|
| 120 | + propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 121 | + } elseif ($object->element == 'commande') { |
|
| 122 | + commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 123 | + } elseif ($object->element == 'facture') { |
|
| 124 | + facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 125 | + } |
|
| 126 | + } else |
|
| 108 | 127 | { |
| 109 | - if ($object->element!= 'facturerec') $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 128 | + if ($object->element!= 'facturerec') { |
|
| 129 | + $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 130 | + } |
|
| 110 | 131 | } |
| 111 | 132 | } |
| 112 | 133 | } |
@@ -120,7 +141,9 @@ discard block |
||
| 120 | 141 | */ |
| 121 | 142 | public static function updateRang(&$object, $rang_start, $move_to=1) |
| 122 | 143 | { |
| 123 | - if (!class_exists('GenericObject')) require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php'; |
|
| 144 | + if (!class_exists('GenericObject')) { |
|
| 145 | + require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php'; |
|
| 146 | + } |
|
| 124 | 147 | |
| 125 | 148 | $row=new GenericObject($object->db); |
| 126 | 149 | $row->table_element_line = $object->table_element_line; |
@@ -129,7 +152,9 @@ discard block |
||
| 129 | 152 | |
| 130 | 153 | foreach ($object->lines as &$line) |
| 131 | 154 | { |
| 132 | - if ($line->rang < $rang_start) continue; |
|
| 155 | + if ($line->rang < $rang_start) { |
|
| 156 | + continue; |
|
| 157 | + } |
|
| 133 | 158 | |
| 134 | 159 | $row->updateRangOfLine($line->id, $line->rang+$move_to); |
| 135 | 160 | } |
@@ -152,21 +177,28 @@ discard block |
||
| 152 | 177 | foreach ($TTitle_reverse as $k => $title_line) |
| 153 | 178 | { |
| 154 | 179 | $title_niveau = self::getNiveau($title_line); |
| 155 | - if ($title_niveau < $level_new_title) break; |
|
| 180 | + if ($title_niveau < $level_new_title) { |
|
| 181 | + break; |
|
| 182 | + } |
|
| 156 | 183 | |
| 157 | 184 | $rang_to_add = self::titleHasTotalLine($object, $title_line, true, true); |
| 158 | 185 | |
| 159 | 186 | if (is_numeric($rang_to_add)) |
| 160 | 187 | { |
| 161 | - if ($rang_to_add != -1) self::updateRang($object, $rang_to_add); |
|
| 188 | + if ($rang_to_add != -1) { |
|
| 189 | + self::updateRang($object, $rang_to_add); |
|
| 190 | + } |
|
| 162 | 191 | |
| 163 | 192 | self::addSubTotalLine($object, $langs->trans('SubTotal'), 100-$title_niveau, $rang_to_add); |
| 164 | 193 | |
| 165 | 194 | $object->lines[] = $object->line; // ajout de la ligne dans le tableau de ligne (Dolibarr ne le fait pas) |
| 166 | 195 | if ($rang_to_add != -1) |
| 167 | 196 | { |
| 168 | - if (method_exists($object, 'fetch_lines')) $object->fetch_lines(); |
|
| 169 | - else $object->fetch($object->id); |
|
| 197 | + if (method_exists($object, 'fetch_lines')) { |
|
| 198 | + $object->fetch_lines(); |
|
| 199 | + } else { |
|
| 200 | + $object->fetch($object->id); |
|
| 201 | + } |
|
| 170 | 202 | } |
| 171 | 203 | } |
| 172 | 204 | } |
@@ -196,7 +228,9 @@ discard block |
||
| 196 | 228 | |
| 197 | 229 | foreach ($TTitle as $k => $title_line) |
| 198 | 230 | { |
| 199 | - if (self::titleHasTotalLine($object, $title_line)) unset($TTitle[$k]); |
|
| 231 | + if (self::titleHasTotalLine($object, $title_line)) { |
|
| 232 | + unset($TTitle[$k]); |
|
| 233 | + } |
|
| 200 | 234 | } |
| 201 | 235 | |
| 202 | 236 | return $TTitle; |
@@ -213,23 +247,41 @@ discard block |
||
| 213 | 247 | */ |
| 214 | 248 | public static function titleHasTotalLine(&$object, &$title_line, $strict_mode=false, $return_rang_on_false=false) |
| 215 | 249 | { |
| 216 | - if (empty($object->lines) || !is_array($object->lines)) return false; |
|
| 250 | + if (empty($object->lines) || !is_array($object->lines)) { |
|
| 251 | + return false; |
|
| 252 | + } |
|
| 217 | 253 | |
| 218 | 254 | $title_niveau = self::getNiveau($title_line); |
| 219 | 255 | foreach ($object->lines as &$line) |
| 220 | 256 | { |
| 221 | - if ($line->rang <= $title_line->rang) continue; |
|
| 222 | - 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 |
|
| 223 | - if (!self::isSubtotal($line)) continue; |
|
| 257 | + if ($line->rang <= $title_line->rang) { |
|
| 258 | + continue; |
|
| 259 | + } |
|
| 260 | + if (self::isTitle($line) && self::getNiveau($line) <= $title_niveau) { |
|
| 261 | + return false; |
|
| 262 | + } |
|
| 263 | + // 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 |
|
| 264 | + if (!self::isSubtotal($line)) { |
|
| 265 | + continue; |
|
| 266 | + } |
|
| 224 | 267 | |
| 225 | 268 | $subtotal_niveau = self::getNiveau($line); |
| 226 | 269 | |
| 227 | 270 | // Comparaison du niveau de la ligne de sous-total avec celui du titre |
| 228 | - if ($subtotal_niveau == $title_niveau) return true; // niveau égale => Ok mon titre a un sous-total |
|
| 229 | - elseif ($subtotal_niveau < $title_niveau) // niveau inférieur trouvé (exemple : sous-total de niveau 1 contre mon titre de niveau 3) |
|
| 271 | + if ($subtotal_niveau == $title_niveau) { |
|
| 272 | + return true; |
|
| 273 | + } |
|
| 274 | + // niveau égale => Ok mon titre a un sous-total |
|
| 275 | + elseif ($subtotal_niveau < $title_niveau) { |
|
| 276 | + // niveau inférieur trouvé (exemple : sous-total de niveau 1 contre mon titre de niveau 3) |
|
| 230 | 277 | { |
| 231 | - if ($strict_mode) return ($return_rang_on_false) ? $line->rang : false; // mode strict niveau pas égale donc faux |
|
| 232 | - else return true; // mode libre => OK je considère que mon titre à un sous-total |
|
| 278 | + if ($strict_mode) return ($return_rang_on_false) ? $line->rang : false; |
|
| 279 | + } |
|
| 280 | + // mode strict niveau pas égale donc faux |
|
| 281 | + else { |
|
| 282 | + return true; |
|
| 283 | + } |
|
| 284 | + // mode libre => OK je considère que mon titre à un sous-total |
|
| 233 | 285 | } |
| 234 | 286 | } |
| 235 | 287 | |
@@ -277,16 +329,19 @@ discard block |
||
| 277 | 329 | |
| 278 | 330 | foreach ($object->lines as &$l) |
| 279 | 331 | { |
| 280 | - if ($l->rang <= $line->rang) continue; |
|
| 281 | - elseif (self::isSubtotal($l) && self::getNiveau($l) <= self::getNiveau($line)) break; |
|
| 282 | - elseif ($breakOnTitle && self::isTitle($l) && self::getNiveau($l) <= self::getNiveau($line)) break; |
|
| 332 | + if ($l->rang <= $line->rang) { |
|
| 333 | + continue; |
|
| 334 | + } elseif (self::isSubtotal($l) && self::getNiveau($l) <= self::getNiveau($line)) { |
|
| 335 | + break; |
|
| 336 | + } elseif ($breakOnTitle && self::isTitle($l) && self::getNiveau($l) <= self::getNiveau($line)) { |
|
| 337 | + break; |
|
| 338 | + } |
|
| 283 | 339 | |
| 284 | 340 | if (!empty($l->array_options['options_subtotal_nc'])) |
| 285 | 341 | { |
| 286 | 342 | $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); |
| 287 | 343 | $TTot['total_options'] += $tabprice[0]; // total ht |
| 288 | - } |
|
| 289 | - else |
|
| 344 | + } else |
|
| 290 | 345 | { |
| 291 | 346 | $TTot['total_pa_ht'] += $l->pa_ht * $l->qty; |
| 292 | 347 | $TTot['total_subprice'] += $l->subprice * $l->qty; |
@@ -306,29 +361,41 @@ discard block |
||
| 306 | 361 | |
| 307 | 362 | public static function getOrderIdFromLineId(&$db, $fk_commandedet) |
| 308 | 363 | { |
| 309 | - if (empty($fk_commandedet)) return false; |
|
| 364 | + if (empty($fk_commandedet)) { |
|
| 365 | + return false; |
|
| 366 | + } |
|
| 310 | 367 | |
| 311 | 368 | $sql = 'SELECT fk_commande FROM '.MAIN_DB_PREFIX.'commandedet WHERE rowid = '.$fk_commandedet; |
| 312 | 369 | $resql = $db->query($sql); |
| 313 | 370 | |
| 314 | - if ($resql && ($row = $db->fetch_object($resql))) return $row->fk_commande; |
|
| 315 | - else return false; |
|
| 371 | + if ($resql && ($row = $db->fetch_object($resql))) { |
|
| 372 | + return $row->fk_commande; |
|
| 373 | + } else { |
|
| 374 | + return false; |
|
| 375 | + } |
|
| 316 | 376 | } |
| 317 | 377 | |
| 318 | 378 | public static function getLastLineOrderId(&$db, $fk_commande) |
| 319 | 379 | { |
| 320 | - if (empty($fk_commande)) return false; |
|
| 380 | + if (empty($fk_commande)) { |
|
| 381 | + return false; |
|
| 382 | + } |
|
| 321 | 383 | |
| 322 | 384 | $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'commandedet WHERE fk_commande = '.$fk_commande.' ORDER BY rang DESC LIMIT 1'; |
| 323 | 385 | $resql = $db->query($sql); |
| 324 | 386 | |
| 325 | - if ($resql && ($row = $db->fetch_object($resql))) return $row->rowid; |
|
| 326 | - else return false; |
|
| 387 | + if ($resql && ($row = $db->fetch_object($resql))) { |
|
| 388 | + return $row->rowid; |
|
| 389 | + } else { |
|
| 390 | + return false; |
|
| 391 | + } |
|
| 327 | 392 | } |
| 328 | 393 | |
| 329 | 394 | public static function getParentTitleOfLine(&$object, $i) |
| 330 | 395 | { |
| 331 | - if ($i <= 0) return false; |
|
| 396 | + if ($i <= 0) { |
|
| 397 | + return false; |
|
| 398 | + } |
|
| 332 | 399 | |
| 333 | 400 | $skip_title = 0; |
| 334 | 401 | // Je parcours les lignes précédentes |
@@ -347,8 +414,7 @@ discard block |
||
| 347 | 414 | //@INFO J'ai ma ligne titre qui contient ma ligne, par contre je check pas s'il y a un sous-total |
| 348 | 415 | return $line; |
| 349 | 416 | break; |
| 350 | - } |
|
| 351 | - elseif ($line->product_type == 9 && $line->qty >= 90 && $line->qty <= 99) |
|
| 417 | + } elseif ($line->product_type == 9 && $line->qty >= 90 && $line->qty <= 99) |
|
| 352 | 418 | { |
| 353 | 419 | // 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) |
| 354 | 420 | $skip_title++; |
@@ -363,7 +429,9 @@ discard block |
||
| 363 | 429 | $res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty <= 9; |
| 364 | 430 | if($res && $level > -1) { |
| 365 | 431 | return $line->qty == $level; |
| 366 | - } else return $res; |
|
| 432 | + } else { |
|
| 433 | + return $res; |
|
| 434 | + } |
|
| 367 | 435 | |
| 368 | 436 | } |
| 369 | 437 | |
@@ -372,7 +440,9 @@ discard block |
||
| 372 | 440 | $res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty >= 90; |
| 373 | 441 | if($res && $level > -1) { |
| 374 | 442 | return self::getNiveau($line) == $level; |
| 375 | - } else return $res; |
|
| 443 | + } else { |
|
| 444 | + return $res; |
|
| 445 | + } |
|
| 376 | 446 | } |
| 377 | 447 | |
| 378 | 448 | public static function isFreeText(&$line) |
@@ -393,10 +463,14 @@ discard block |
||
| 393 | 463 | // editeur wysiwyg |
| 394 | 464 | require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
| 395 | 465 | $nbrows=ROWS_2; |
| 396 | - if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
| 466 | + if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { |
|
| 467 | + $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
| 468 | + } |
|
| 397 | 469 | $enable=(isset($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0); |
| 398 | 470 | $toolbarname='dolibarr_details'; |
| 399 | - if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes'; |
|
| 471 | + if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) { |
|
| 472 | + $toolbarname='dolibarr_notes'; |
|
| 473 | + } |
|
| 400 | 474 | $text = !empty($line->description)?$line->description:$line->label; |
| 401 | 475 | $doleditor=new DolEditor('line-description',$text,'',164,$toolbarname,'',false,true,$enable,$nbrows,'98%', $readonly); |
| 402 | 476 | return $doleditor->Create(1); |
@@ -411,12 +485,10 @@ discard block |
||
| 411 | 485 | { |
| 412 | 486 | $object->statut = 0; // hack for facture rec |
| 413 | 487 | $createRight = $user->rights->facture->creer; |
| 414 | - } |
|
| 415 | - elseif($object->element == 'order_supplier' ) |
|
| 488 | + } elseif($object->element == 'order_supplier' ) |
|
| 416 | 489 | { |
| 417 | 490 | $createRight = $user->rights->fournisseur->commande->creer; |
| 418 | - } |
|
| 419 | - elseif($object->element == 'invoice_supplier' ) |
|
| 491 | + } elseif($object->element == 'invoice_supplier' ) |
|
| 420 | 492 | { |
| 421 | 493 | $createRight = $user->rights->fournisseur->facture->creer; |
| 422 | 494 | } |
@@ -427,11 +499,16 @@ discard block |
||
| 427 | 499 | |
| 428 | 500 | if(!empty($object->lines)) { |
| 429 | 501 | foreach($object->lines as $line) { |
| 430 | - if($line->id == $lineid) $duplicateLine = $line; |
|
| 502 | + if($line->id == $lineid) { |
|
| 503 | + $duplicateLine = $line; |
|
| 504 | + } |
|
| 431 | 505 | } |
| 432 | 506 | } |
| 433 | - if(!empty($duplicateLine) && !self::isModSubtotalLine($duplicateLine)) $TLine = array($duplicateLine); |
|
| 434 | - else $TLine = self::getLinesFromTitleId($object, $lineid, $withBlockLine); |
|
| 507 | + if(!empty($duplicateLine) && !self::isModSubtotalLine($duplicateLine)) { |
|
| 508 | + $TLine = array($duplicateLine); |
|
| 509 | + } else { |
|
| 510 | + $TLine = self::getLinesFromTitleId($object, $lineid, $withBlockLine); |
|
| 511 | + } |
|
| 435 | 512 | |
| 436 | 513 | if (!empty($TLine)) |
| 437 | 514 | { |
@@ -495,8 +572,9 @@ discard block |
||
| 495 | 572 | |
| 496 | 573 | $TLineAdded[] = $object->line; |
| 497 | 574 | // Error from addline |
| 498 | - if ($res <= 0) break; |
|
| 499 | - else |
|
| 575 | + if ($res <= 0) { |
|
| 576 | + break; |
|
| 577 | + } else |
|
| 500 | 578 | { |
| 501 | 579 | $object->line_from = $line; |
| 502 | 580 | // Call trigger |
@@ -518,8 +596,7 @@ discard block |
||
| 518 | 596 | _updateLineNC($object->element, $object->id, $line->id, $line->array_options['options_subtotal_nc']); |
| 519 | 597 | } |
| 520 | 598 | return count($TLineAdded); |
| 521 | - } |
|
| 522 | - else |
|
| 599 | + } else |
|
| 523 | 600 | { |
| 524 | 601 | $object->db->rollback(); |
| 525 | 602 | return -1; |
@@ -535,10 +612,14 @@ discard block |
||
| 535 | 612 | global $langs; |
| 536 | 613 | |
| 537 | 614 | // Besoin de comparer sur les 2 formes d'écriture |
| 538 | - if (!$key_is_id) $TTitle_search = array($langs->trans($key_trad), $langs->transnoentitiesnoconv($key_trad)); |
|
| 615 | + if (!$key_is_id) { |
|
| 616 | + $TTitle_search = array($langs->trans($key_trad), $langs->transnoentitiesnoconv($key_trad)); |
|
| 617 | + } |
|
| 539 | 618 | |
| 540 | 619 | $TTitle_under_search = array(); |
| 541 | - if (!empty($under_title)) $TTitle_under_search = array($langs->trans($under_title), $langs->transnoentitiesnoconv($under_title)); |
|
| 620 | + if (!empty($under_title)) { |
|
| 621 | + $TTitle_under_search = array($langs->trans($under_title), $langs->transnoentitiesnoconv($under_title)); |
|
| 622 | + } |
|
| 542 | 623 | |
| 543 | 624 | $TLine = array(); |
| 544 | 625 | $add_line = false; |
@@ -548,28 +629,37 @@ discard block |
||
| 548 | 629 | { |
| 549 | 630 | if (!$under_title_found && !empty($TTitle_under_search)) |
| 550 | 631 | { |
| 551 | - if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search)) ) $under_title_found = true; |
|
| 552 | - } |
|
| 553 | - else |
|
| 632 | + if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search)) ) { |
|
| 633 | + $under_title_found = true; |
|
| 634 | + } |
|
| 635 | + } else |
|
| 554 | 636 | { |
| 555 | 637 | 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) ))) |
| 556 | 638 | { |
| 557 | - if ($key_is_id) $level = $line->qty; |
|
| 639 | + if ($key_is_id) { |
|
| 640 | + $level = $line->qty; |
|
| 641 | + } |
|
| 558 | 642 | |
| 559 | 643 | $add_line = true; |
| 560 | - if ($withBlockLine) $TLine[] = $line; |
|
| 644 | + if ($withBlockLine) { |
|
| 645 | + $TLine[] = $line; |
|
| 646 | + } |
|
| 561 | 647 | continue; |
| 562 | - } |
|
| 563 | - elseif ($add_line && TSubtotal::isModSubtotalLine($line) && TSubtotal::getNiveau($line) == $level) // Si on tombe sur un sous-total, il faut que ce soit un du même niveau que le titre |
|
| 648 | + } elseif ($add_line && TSubtotal::isModSubtotalLine($line) && TSubtotal::getNiveau($line) == $level) { |
|
| 649 | + // Si on tombe sur un sous-total, il faut que ce soit un du même niveau que le titre |
|
| 564 | 650 | { |
| 565 | 651 | if ($withBlockLine) $TLine[] = $line; |
| 652 | + } |
|
| 566 | 653 | break; |
| 567 | 654 | } |
| 568 | 655 | |
| 569 | 656 | if ($add_line) |
| 570 | 657 | { |
| 571 | - if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line)) ) continue; |
|
| 572 | - else $TLine[] = $line; |
|
| 658 | + if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line)) ) { |
|
| 659 | + continue; |
|
| 660 | + } else { |
|
| 661 | + $TLine[] = $line; |
|
| 662 | + } |
|
| 573 | 663 | } |
| 574 | 664 | } |
| 575 | 665 | } |
@@ -603,7 +693,9 @@ discard block |
||
| 603 | 693 | |
| 604 | 694 | case 'order_supplier': |
| 605 | 695 | $object->special_code = SELF::$module_number; |
| 606 | - if (empty($desc)) $desc = $label; |
|
| 696 | + if (empty($desc)) { |
|
| 697 | + $desc = $label; |
|
| 698 | + } |
|
| 607 | 699 | $res = $object->updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $type, 0, $date_start, $date_end, $array_options, $fk_unit); |
| 608 | 700 | break; |
| 609 | 701 | |
@@ -613,7 +705,9 @@ discard block |
||
| 613 | 705 | |
| 614 | 706 | case 'invoice_supplier': |
| 615 | 707 | $object->special_code = SELF::$module_number; |
| 616 | - if (empty($desc)) $desc = $label; |
|
| 708 | + if (empty($desc)) { |
|
| 709 | + $desc = $label; |
|
| 710 | + } |
|
| 617 | 711 | $res = $object->updateline($rowid, $desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, 0, $price_base_type, $info_bits, $type, $remise_percent, 0, $date_start, $date_end, $array_options, $fk_unit); |
| 618 | 712 | break; |
| 619 | 713 | |
@@ -630,8 +724,11 @@ discard block |
||
| 630 | 724 | break; |
| 631 | 725 | } |
| 632 | 726 | |
| 633 | - if ($res <= 0) $object->db->rollback(); |
|
| 634 | - else $object->db->commit(); |
|
| 727 | + if ($res <= 0) { |
|
| 728 | + $object->db->rollback(); |
|
| 729 | + } else { |
|
| 730 | + $object->db->commit(); |
|
| 731 | + } |
|
| 635 | 732 | |
| 636 | 733 | return $res; |
| 637 | 734 | } |
@@ -641,24 +738,20 @@ discard block |
||
| 641 | 738 | global $db, $object; |
| 642 | 739 | |
| 643 | 740 | $TTitle = array(); |
| 644 | - if(! empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {} |
|
| 645 | - else { |
|
| 741 | + if(! empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {} else { |
|
| 646 | 742 | if ($origin_line->element == 'propaldet') |
| 647 | 743 | { |
| 648 | 744 | $object = new Propal($db); |
| 649 | 745 | $object->fetch($origin_line->fk_propal); |
| 650 | - } |
|
| 651 | - else if ($origin_line->element == 'commandedet') |
|
| 746 | + } else if ($origin_line->element == 'commandedet') |
|
| 652 | 747 | { |
| 653 | 748 | $object = new Commande($db); |
| 654 | 749 | $object->fetch($origin_line->fk_commande); |
| 655 | - } |
|
| 656 | - else if ($origin_line->element == 'facturedet') |
|
| 750 | + } else if ($origin_line->element == 'facturedet') |
|
| 657 | 751 | { |
| 658 | 752 | $object = new Facture($db); |
| 659 | 753 | $object->fetch($origin_line->fk_facture); |
| 660 | - } |
|
| 661 | - else |
|
| 754 | + } else |
|
| 662 | 755 | { |
| 663 | 756 | return $TTitle; |
| 664 | 757 | } |
@@ -668,8 +761,11 @@ discard block |
||
| 668 | 761 | $i = 0; |
| 669 | 762 | foreach ($object->lines as &$line) |
| 670 | 763 | { |
| 671 | - if ($origin_line->id == $line->id) break; |
|
| 672 | - else $i++; |
|
| 764 | + if ($origin_line->id == $line->id) { |
|
| 765 | + break; |
|
| 766 | + } else { |
|
| 767 | + $i++; |
|
| 768 | + } |
|
| 673 | 769 | } |
| 674 | 770 | |
| 675 | 771 | $i--; // Skip la ligne d'origine |
@@ -684,35 +780,43 @@ discard block |
||
| 684 | 780 | if (self::isSubtotal($object->lines[$y])) |
| 685 | 781 | { |
| 686 | 782 | $next_title_lvl_to_skip = self::getNiveau($object->lines[$y]); |
| 687 | - } |
|
| 688 | - elseif (self::isTitle($object->lines[$y])) |
|
| 783 | + } elseif (self::isTitle($object->lines[$y])) |
|
| 689 | 784 | { |
| 690 | 785 | if ($object->lines[$y]->qty == $next_title_lvl_to_skip) |
| 691 | 786 | { |
| 692 | 787 | $next_title_lvl_to_skip = 0; |
| 693 | 788 | continue; |
| 694 | - } |
|
| 695 | - else |
|
| 789 | + } else |
|
| 696 | 790 | { |
| 697 | - if (empty($object->lines[$y]->array_options)) $object->lines[$y]->fetch_optionals(); |
|
| 791 | + if (empty($object->lines[$y]->array_options)) { |
|
| 792 | + $object->lines[$y]->fetch_optionals(); |
|
| 793 | + } |
|
| 698 | 794 | $TTitle[$object->lines[$y]->id] = $object->lines[$y]; |
| 699 | 795 | |
| 700 | - if ($object->lines[$y]->qty == 1) break; |
|
| 796 | + if ($object->lines[$y]->qty == 1) { |
|
| 797 | + break; |
|
| 798 | + } |
|
| 701 | 799 | } |
| 702 | 800 | } |
| 703 | 801 | } |
| 704 | 802 | } |
| 705 | 803 | |
| 706 | - if ($reverse) $TTitle = array_reverse($TTitle, true); |
|
| 804 | + if ($reverse) { |
|
| 805 | + $TTitle = array_reverse($TTitle, true); |
|
| 806 | + } |
|
| 707 | 807 | |
| 708 | 808 | return $TTitle; |
| 709 | 809 | } |
| 710 | 810 | |
| 711 | 811 | public static function getNiveau(&$line) |
| 712 | 812 | { |
| 713 | - if (self::isTitle($line)) return $line->qty; |
|
| 714 | - elseif (self::isSubtotal($line)) return 100 - $line->qty; |
|
| 715 | - else return 0; |
|
| 813 | + if (self::isTitle($line)) { |
|
| 814 | + return $line->qty; |
|
| 815 | + } elseif (self::isSubtotal($line)) { |
|
| 816 | + return 100 - $line->qty; |
|
| 817 | + } else { |
|
| 818 | + return 0; |
|
| 819 | + } |
|
| 716 | 820 | } |
| 717 | 821 | |
| 718 | 822 | /** |
@@ -737,10 +841,16 @@ discard block |
||
| 737 | 841 | $objmarge->marge_droite = 10; |
| 738 | 842 | |
| 739 | 843 | $objectref = dol_sanitizeFileName($object->ref); |
| 740 | - if ($object->element == 'propal') $dir = $conf->propal->dir_output . '/' . $objectref; |
|
| 741 | - elseif ($object->element == 'commande') $dir = $conf->commande->dir_output . '/' . $objectref; |
|
| 742 | - elseif ($object->element == 'facture') $dir = $conf->facture->dir_output . '/' . $objectref; |
|
| 743 | - elseif ($object->element == 'facturerec') return; // no PDF for facturerec |
|
| 844 | + if ($object->element == 'propal') { |
|
| 845 | + $dir = $conf->propal->dir_output . '/' . $objectref; |
|
| 846 | + } elseif ($object->element == 'commande') { |
|
| 847 | + $dir = $conf->commande->dir_output . '/' . $objectref; |
|
| 848 | + } elseif ($object->element == 'facture') { |
|
| 849 | + $dir = $conf->facture->dir_output . '/' . $objectref; |
|
| 850 | + } elseif ($object->element == 'facturerec') { |
|
| 851 | + return; |
|
| 852 | + } |
|
| 853 | + // no PDF for facturerec |
|
| 744 | 854 | else |
| 745 | 855 | { |
| 746 | 856 | setEventMessage($langs->trans('warning_subtotal_recap_object_element_unknown', $object->element), 'warnings'); |
@@ -775,7 +885,9 @@ discard block |
||
| 775 | 885 | $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
| 776 | 886 | $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
| 777 | 887 | $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("subtotalRecap")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); |
| 778 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 888 | + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { |
|
| 889 | + $pdf->SetCompression(false); |
|
| 890 | + } |
|
| 779 | 891 | |
| 780 | 892 | $pdf->SetMargins($objmarge->marge_gauche, $objmarge->marge_haute, $objmarge->marge_droite); // Left, Top, Right |
| 781 | 893 | |
@@ -785,7 +897,9 @@ discard block |
||
| 785 | 897 | |
| 786 | 898 | // New page |
| 787 | 899 | $pdf->AddPage(); |
| 788 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 900 | + if (! empty($tplidx)) { |
|
| 901 | + $pdf->useTemplate($tplidx); |
|
| 902 | + } |
|
| 789 | 903 | $pagenb++; |
| 790 | 904 | |
| 791 | 905 | |
@@ -841,8 +955,10 @@ discard block |
||
| 841 | 955 | { |
| 842 | 956 | $TTot['TTotal_tva_multicurrency'][$tx] += $amount; |
| 843 | 957 | } |
| 958 | + } else { |
|
| 959 | + $pdf->SetFont('','', $default_font_size - 1); |
|
| 844 | 960 | } |
| 845 | - else $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage |
|
| 961 | + // Into loop to work with multipage |
|
| 846 | 962 | |
| 847 | 963 | $pdf->SetTextColor(0,0,0); |
| 848 | 964 | |
@@ -864,9 +980,11 @@ discard block |
||
| 864 | 980 | $pdf->startTransaction(); |
| 865 | 981 | $pdf->writeHTMLCell($posx_options-$posx_designation-$decalage, 3, $posx_designation+$decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J',true); |
| 866 | 982 | $pageposafter=$pdf->getPage(); |
| 867 | - if ($pageposafter > $pageposbefore) // There is a pagebreak |
|
| 983 | + if ($pageposafter > $pageposbefore) { |
|
| 984 | + // There is a pagebreak |
|
| 868 | 985 | { |
| 869 | 986 | $pdf->rollbackTransaction(true); |
| 987 | + } |
|
| 870 | 988 | $pageposafter=$pageposbefore; |
| 871 | 989 | //print $pageposafter.'-'.$pageposbefore;exit; |
| 872 | 990 | $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
@@ -875,23 +993,27 @@ discard block |
||
| 875 | 993 | $pageposafter=$pdf->getPage(); |
| 876 | 994 | $posyafter=$pdf->GetY(); |
| 877 | 995 | //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; |
| 878 | - if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter+$heightforinfotot))) // There is no space left for total+free text |
|
| 996 | + if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter+$heightforinfotot))) { |
|
| 997 | + // There is no space left for total+free text |
|
| 879 | 998 | { |
| 880 | 999 | if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page |
| 881 | 1000 | { |
| 882 | 1001 | $pdf->AddPage('','',true); |
| 883 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 884 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
|
| 1002 | + } |
|
| 1003 | + if (! empty($tplidx)) { |
|
| 1004 | + $pdf->useTemplate($tplidx); |
|
| 1005 | + } |
|
| 1006 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { |
|
| 1007 | + self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
|
| 1008 | + } |
|
| 885 | 1009 | $pdf->setPage($pageposafter+1); |
| 886 | 1010 | } |
| 887 | - } |
|
| 888 | - else |
|
| 1011 | + } else |
|
| 889 | 1012 | { |
| 890 | 1013 | // We found a page break |
| 891 | 1014 | $showpricebeforepagebreak=0; |
| 892 | 1015 | } |
| 893 | - } |
|
| 894 | - else // No pagebreak |
|
| 1016 | + } else // No pagebreak |
|
| 895 | 1017 | { |
| 896 | 1018 | $pdf->commitTransaction(); |
| 897 | 1019 | } |
@@ -931,8 +1053,7 @@ discard block |
||
| 931 | 1053 | if ($pagenb == 1) |
| 932 | 1054 | { |
| 933 | 1055 | 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); |
| 934 | - } |
|
| 935 | - else |
|
| 1056 | + } else |
|
| 936 | 1057 | { |
| 937 | 1058 | 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); |
| 938 | 1059 | } |
@@ -940,7 +1061,9 @@ discard block |
||
| 940 | 1061 | $pagenb++; |
| 941 | 1062 | $pdf->setPage($pagenb); |
| 942 | 1063 | $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
| 943 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
|
| 1064 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { |
|
| 1065 | + self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
|
| 1066 | + } |
|
| 944 | 1067 | } |
| 945 | 1068 | } |
| 946 | 1069 | } |
@@ -950,8 +1073,7 @@ discard block |
||
| 950 | 1073 | { |
| 951 | 1074 | 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); |
| 952 | 1075 | $bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
| 953 | - } |
|
| 954 | - else |
|
| 1076 | + } else |
|
| 955 | 1077 | { |
| 956 | 1078 | 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); |
| 957 | 1079 | $bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
@@ -965,7 +1087,9 @@ discard block |
||
| 965 | 1087 | |
| 966 | 1088 | $pagecount = self::concat($outputlangs, array($origin_file, $file), $origin_file); |
| 967 | 1089 | |
| 968 | - if (empty($conf->global->SUBTOTAL_KEEP_RECAP_FILE)) unlink($file); |
|
| 1090 | + if (empty($conf->global->SUBTOTAL_KEEP_RECAP_FILE)) { |
|
| 1091 | + unlink($file); |
|
| 1092 | + } |
|
| 969 | 1093 | } |
| 970 | 1094 | |
| 971 | 1095 | private static function printLevel($objmarge, $pdf, $line, $curY, $posx_designation) |
@@ -1008,8 +1132,7 @@ discard block |
||
| 1008 | 1132 | { |
| 1009 | 1133 | $height=pdf_getHeightForLogo($logo); |
| 1010 | 1134 | $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
| 1011 | - } |
|
| 1012 | - else |
|
| 1135 | + } else |
|
| 1013 | 1136 | { |
| 1014 | 1137 | $pdf->SetTextColor(200,0,0); |
| 1015 | 1138 | $pdf->SetFont('','B',$default_font_size - 2); |
@@ -1018,8 +1141,7 @@ discard block |
||
| 1018 | 1141 | } |
| 1019 | 1142 | |
| 1020 | 1143 | $posy+=35; |
| 1021 | - } |
|
| 1022 | - else |
|
| 1144 | + } else |
|
| 1023 | 1145 | { |
| 1024 | 1146 | $text=$mysoc->name; |
| 1025 | 1147 | $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); |
@@ -1033,9 +1155,13 @@ discard block |
||
| 1033 | 1155 | $pdf->SetXY($objmarge->marge_gauche,$posy); |
| 1034 | 1156 | |
| 1035 | 1157 | $key = 'subtotalPropalTitle'; |
| 1036 | - if ($object->element == 'commande') $key = 'subtotalCommandeTitle'; |
|
| 1037 | - elseif ($object->element == 'facture') $key = 'subtotalInvoiceTitle'; |
|
| 1038 | - elseif ($object->element == 'facturerec') $key = 'subtotalInvoiceTitle'; |
|
| 1158 | + if ($object->element == 'commande') { |
|
| 1159 | + $key = 'subtotalCommandeTitle'; |
|
| 1160 | + } elseif ($object->element == 'facture') { |
|
| 1161 | + $key = 'subtotalInvoiceTitle'; |
|
| 1162 | + } elseif ($object->element == 'facturerec') { |
|
| 1163 | + $key = 'subtotalInvoiceTitle'; |
|
| 1164 | + } |
|
| 1039 | 1165 | |
| 1040 | 1166 | $pdf->MultiCell(150, 4, $outputlangs->transnoentities($key, $object->ref, $object->thirdparty->name), '', 'L'); |
| 1041 | 1167 | |
@@ -1070,7 +1196,9 @@ discard block |
||
| 1070 | 1196 | |
| 1071 | 1197 | // Force to disable hidetop and hidebottom |
| 1072 | 1198 | $hidebottom=0; |
| 1073 | - if ($hidetop) $hidetop=-1; |
|
| 1199 | + if ($hidetop) { |
|
| 1200 | + $hidetop=-1; |
|
| 1201 | + } |
|
| 1074 | 1202 | |
| 1075 | 1203 | $currency = !empty($currency) ? $currency : $conf->currency; |
| 1076 | 1204 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
@@ -1085,7 +1213,9 @@ discard block |
||
| 1085 | 1213 | $pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4.5); |
| 1086 | 1214 | $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); |
| 1087 | 1215 | |
| 1088 | - 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)); |
|
| 1216 | + if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) { |
|
| 1217 | + $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)); |
|
| 1218 | + } |
|
| 1089 | 1219 | |
| 1090 | 1220 | |
| 1091 | 1221 | $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 |
@@ -1098,8 +1228,7 @@ discard block |
||
| 1098 | 1228 | $pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant,2, $outputlangs->transnoentities("Amount"),'','R'); |
| 1099 | 1229 | |
| 1100 | 1230 | $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 |
| 1101 | - } |
|
| 1102 | - else |
|
| 1231 | + } else |
|
| 1103 | 1232 | { |
| 1104 | 1233 | $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 |
| 1105 | 1234 | } |
@@ -1120,10 +1249,12 @@ discard block |
||
| 1120 | 1249 | |
| 1121 | 1250 | // Tableau total |
| 1122 | 1251 | $col1x = 120; $col2x = 170; |
| 1123 | - if ($objmarge->page_largeur < 210) // To work with US executive format |
|
| 1252 | + if ($objmarge->page_largeur < 210) { |
|
| 1253 | + // To work with US executive format |
|
| 1124 | 1254 | { |
| 1125 | 1255 | $col2x-=20; |
| 1126 | 1256 | } |
| 1257 | + } |
|
| 1127 | 1258 | $largcol2 = ($objmarge->page_largeur - $objmarge->marge_droite - $col2x); |
| 1128 | 1259 | |
| 1129 | 1260 | $useborder=0; |
@@ -1145,9 +1276,11 @@ discard block |
||
| 1145 | 1276 | $atleastoneratenotnull=0; |
| 1146 | 1277 | foreach($TTot['TTotal_tva'] as $tvakey => $tvaval) |
| 1147 | 1278 | { |
| 1148 | - if ($tvakey != 0) // On affiche pas taux 0 |
|
| 1279 | + if ($tvakey != 0) { |
|
| 1280 | + // On affiche pas taux 0 |
|
| 1149 | 1281 | { |
| 1150 | 1282 | $atleastoneratenotnull++; |
| 1283 | + } |
|
| 1151 | 1284 | |
| 1152 | 1285 | $index++; |
| 1153 | 1286 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
@@ -1200,9 +1333,13 @@ discard block |
||
| 1200 | 1333 | */ |
| 1201 | 1334 | private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0) |
| 1202 | 1335 | { |
| 1203 | - if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); |
|
| 1336 | + if (empty($hidetop) || $hidetop==-1) { |
|
| 1337 | + $pdf->line($x, $y, $x+$l, $y); |
|
| 1338 | + } |
|
| 1204 | 1339 | $pdf->line($x+$l, $y, $x+$l, $y+$h); |
| 1205 | - if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
| 1340 | + if (empty($hidebottom)) { |
|
| 1341 | + $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
| 1342 | + } |
|
| 1206 | 1343 | $pdf->line($x, $y+$h, $x, $y); |
| 1207 | 1344 | } |
| 1208 | 1345 | |
@@ -1211,7 +1348,9 @@ discard block |
||
| 1211 | 1348 | { |
| 1212 | 1349 | global $conf; |
| 1213 | 1350 | |
| 1214 | - if (empty($fileoutput)) $fileoutput = $file[0]; |
|
| 1351 | + if (empty($fileoutput)) { |
|
| 1352 | + $fileoutput = $file[0]; |
|
| 1353 | + } |
|
| 1215 | 1354 | |
| 1216 | 1355 | $pdf=pdf_getInstance(); |
| 1217 | 1356 | if (class_exists('TCPDF')) |
@@ -1221,7 +1360,9 @@ discard block |
||
| 1221 | 1360 | } |
| 1222 | 1361 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
| 1223 | 1362 | |
| 1224 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 1363 | + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { |
|
| 1364 | + $pdf->SetCompression(false); |
|
| 1365 | + } |
|
| 1225 | 1366 | |
| 1226 | 1367 | |
| 1227 | 1368 | foreach($files as $file) |
@@ -1237,7 +1378,9 @@ discard block |
||
| 1237 | 1378 | } |
| 1238 | 1379 | |
| 1239 | 1380 | $pdf->Output($fileoutput,'F'); |
| 1240 | - if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
| 1381 | + if (! empty($conf->global->MAIN_UMASK)) { |
|
| 1382 | + @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
| 1383 | + } |
|
| 1241 | 1384 | |
| 1242 | 1385 | return $pagecount; |
| 1243 | 1386 | } |
@@ -1250,7 +1393,9 @@ discard block |
||
| 1250 | 1393 | */ |
| 1251 | 1394 | public static function hasNcTitle(&$line) |
| 1252 | 1395 | { |
| 1253 | - if(isset($line->has_nc_title)) return $line->has_nc_title; |
|
| 1396 | + if(isset($line->has_nc_title)) { |
|
| 1397 | + return $line->has_nc_title; |
|
| 1398 | + } |
|
| 1254 | 1399 | |
| 1255 | 1400 | $TTitle = self::getAllTitleFromLine($line); |
| 1256 | 1401 | foreach ($TTitle as &$line_title) |
@@ -1275,7 +1420,9 @@ discard block |
||
| 1275 | 1420 | public static function getTitleLabel($line) |
| 1276 | 1421 | { |
| 1277 | 1422 | $title = $line->label; |
| 1278 | - if (empty($title)) $title = !empty($line->description) ? $line->description : $line->desc; |
|
| 1423 | + if (empty($title)) { |
|
| 1424 | + $title = !empty($line->description) ? $line->description : $line->desc; |
|
| 1425 | + } |
|
| 1279 | 1426 | return $title; |
| 1280 | 1427 | } |
| 1281 | 1428 | } |
@@ -45,7 +45,9 @@ discard block |
||
| 45 | 45 | $value = ''; |
| 46 | 46 | $sql = 'SELECT content FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text WHERE rowid = '.GETPOST('rowid'); |
| 47 | 47 | $resql = $this->db->query($sql); |
| 48 | - if ($resql && ($obj = $this->db->fetch_object($resql))) $value = $obj->content; |
|
| 48 | + if ($resql && ($obj = $this->db->fetch_object($resql))) { |
|
| 49 | + $value = $obj->content; |
|
| 50 | + } |
|
| 49 | 51 | } |
| 50 | 52 | |
| 51 | 53 | ?> |
@@ -124,8 +126,7 @@ discard block |
||
| 124 | 126 | } elseif($object->element == 'invoice_supplier' ) |
| 125 | 127 | { |
| 126 | 128 | $createRight = $user->rights->fournisseur->facture->creer; |
| 127 | - } |
|
| 128 | - elseif($object->element == 'shipping') |
|
| 129 | + } elseif($object->element == 'shipping') |
|
| 129 | 130 | { |
| 130 | 131 | $createRight = true; // No rights management for shipments |
| 131 | 132 | } |
@@ -133,8 +134,11 @@ discard block |
||
| 133 | 134 | if ($object->statut == 0 && $createRight) { |
| 134 | 135 | |
| 135 | 136 | |
| 136 | - if($object->element=='facture')$idvar = 'facid'; |
|
| 137 | - else $idvar='id'; |
|
| 137 | + if($object->element=='facture') { |
|
| 138 | + $idvar = 'facid'; |
|
| 139 | + } else { |
|
| 140 | + $idvar='id'; |
|
| 141 | + } |
|
| 138 | 142 | |
| 139 | 143 | if(in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text')) ) |
| 140 | 144 | { |
@@ -142,10 +146,11 @@ discard block |
||
| 142 | 146 | |
| 143 | 147 | if($action=='add_title_line') { |
| 144 | 148 | $title = GETPOST('title'); |
| 145 | - if(empty($title)) $title = $langs->trans('title'); |
|
| 149 | + if(empty($title)) { |
|
| 150 | + $title = $langs->trans('title'); |
|
| 151 | + } |
|
| 146 | 152 | $qty = $level<1 ? 1 : $level ; |
| 147 | - } |
|
| 148 | - else if($action=='add_free_text') { |
|
| 153 | + } else if($action=='add_free_text') { |
|
| 149 | 154 | $title = GETPOST('title'); |
| 150 | 155 | |
| 151 | 156 | if (empty($title)) { |
@@ -157,29 +162,31 @@ discard block |
||
| 157 | 162 | } |
| 158 | 163 | } |
| 159 | 164 | } |
| 160 | - if(empty($title)) $title = $langs->trans('subtotalAddLineDescription'); |
|
| 165 | + if(empty($title)) { |
|
| 166 | + $title = $langs->trans('subtotalAddLineDescription'); |
|
| 167 | + } |
|
| 161 | 168 | $qty = 50; |
| 162 | - } |
|
| 163 | - else if($action=='add_subtitle_line') { |
|
| 169 | + } else if($action=='add_subtitle_line') { |
|
| 164 | 170 | $title = GETPOST('title'); |
| 165 | - if(empty($title)) $title = $langs->trans('subtitle'); |
|
| 171 | + if(empty($title)) { |
|
| 172 | + $title = $langs->trans('subtitle'); |
|
| 173 | + } |
|
| 166 | 174 | $qty = 2; |
| 167 | - } |
|
| 168 | - else if($action=='add_subtotal_line') { |
|
| 175 | + } else if($action=='add_subtotal_line') { |
|
| 169 | 176 | $title = $langs->trans('SubSubTotal'); |
| 170 | 177 | $qty = 98; |
| 171 | - } |
|
| 172 | - else { |
|
| 178 | + } else { |
|
| 173 | 179 | $title = GETPOST('title') ? GETPOST('title') : $langs->trans('SubTotal'); |
| 174 | 180 | $qty = $level ? 100-$level : 99; |
| 175 | 181 | } |
| 176 | 182 | dol_include_once('/subtotal/class/subtotal.class.php'); |
| 177 | 183 | |
| 178 | - if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) TSubtotal::addSubtotalMissing($object, $qty); |
|
| 184 | + if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) { |
|
| 185 | + TSubtotal::addSubtotalMissing($object, $qty); |
|
| 186 | + } |
|
| 179 | 187 | |
| 180 | 188 | TSubtotal::addSubTotalLine($object, $title, $qty); |
| 181 | - } |
|
| 182 | - else if($action==='ask_deleteallline') { |
|
| 189 | + } else if($action==='ask_deleteallline') { |
|
| 183 | 190 | $form=new Form($db); |
| 184 | 191 | |
| 185 | 192 | $lineid = GETPOST('lineid','integer'); |
@@ -202,8 +209,7 @@ discard block |
||
| 202 | 209 | $this->printNewFormat($object, $conf, $langs, $idvar); |
| 203 | 210 | } |
| 204 | 211 | } |
| 205 | - } |
|
| 206 | - elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts)) |
|
| 212 | + } elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts)) |
|
| 207 | 213 | { |
| 208 | 214 | ?> |
| 209 | 215 | <script type="text/javascript"> |
@@ -221,8 +227,13 @@ discard block |
||
| 221 | 227 | |
| 222 | 228 | function printNewFormat(&$object, &$conf, &$langs, $idvar) |
| 223 | 229 | { |
| 224 | - if (empty($conf->global->SUBTOTAL_ALLOW_ADD_BLOCK)) return false; |
|
| 225 | - if ($line->fk_prev_id != null && !empty($line->fk_prev_id)) return false; // Si facture de situation |
|
| 230 | + if (empty($conf->global->SUBTOTAL_ALLOW_ADD_BLOCK)) { |
|
| 231 | + return false; |
|
| 232 | + } |
|
| 233 | + if ($line->fk_prev_id != null && !empty($line->fk_prev_id)) { |
|
| 234 | + return false; |
|
| 235 | + } |
|
| 236 | + // Si facture de situation |
|
| 226 | 237 | ?> |
| 227 | 238 | <script type="text/javascript"> |
| 228 | 239 | $(document).ready(function() { |
@@ -508,8 +519,7 @@ discard block |
||
| 508 | 519 | } |
| 509 | 520 | |
| 510 | 521 | |
| 511 | - } |
|
| 512 | - else{ |
|
| 522 | + } else{ |
|
| 513 | 523 | $substitutionarray['line_not_modsubtotal'] = true; |
| 514 | 524 | $substitutionarray['line_modsubtotal'] = 0; |
| 515 | 525 | } |
@@ -567,8 +577,11 @@ discard block |
||
| 567 | 577 | |
| 568 | 578 | $showBlockExtrafields = GETPOST('showBlockExtrafields'); |
| 569 | 579 | |
| 570 | - if($object->element=='facture') $idvar = 'facid'; |
|
| 571 | - else $idvar = 'id'; |
|
| 580 | + if($object->element=='facture') { |
|
| 581 | + $idvar = 'facid'; |
|
| 582 | + } else { |
|
| 583 | + $idvar = 'id'; |
|
| 584 | + } |
|
| 572 | 585 | |
| 573 | 586 | if ($action == 'updateligne' || $action == 'updateline') |
| 574 | 587 | { |
@@ -598,8 +611,7 @@ discard block |
||
| 598 | 611 | header('Location: '.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id); |
| 599 | 612 | exit; // Surtout ne pas laisser Dolibarr faire du traitement sur le updateligne sinon ça plante les données de la ligne |
| 600 | 613 | } |
| 601 | - } |
|
| 602 | - else if($action === 'builddoc') { |
|
| 614 | + } else if($action === 'builddoc') { |
|
| 603 | 615 | |
| 604 | 616 | if ( |
| 605 | 617 | in_array('invoicecard',explode(':',$parameters['context'])) |
@@ -614,33 +626,27 @@ discard block |
||
| 614 | 626 | $sessname = 'subtotal_hideInnerLines_facture'; |
| 615 | 627 | $sessname2 = 'subtotal_hidedetails_facture'; |
| 616 | 628 | $sessname3 = 'subtotal_hideprices_facture'; |
| 617 | - } |
|
| 618 | - elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
|
| 629 | + } elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
|
| 619 | 630 | $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
| 620 | 631 | $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
| 621 | 632 | $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
| 622 | - } |
|
| 623 | - elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
| 633 | + } elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
| 624 | 634 | $sessname = 'subtotal_hideInnerLines_propal'; |
| 625 | 635 | $sessname2 = 'subtotal_hidedetails_propal'; |
| 626 | 636 | $sessname3 = 'subtotal_hideprices_propal'; |
| 627 | - } |
|
| 628 | - elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
|
| 637 | + } elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
|
| 629 | 638 | $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
| 630 | 639 | $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
| 631 | 640 | $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
| 632 | - } |
|
| 633 | - elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
| 641 | + } elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
| 634 | 642 | $sessname = 'subtotal_hideInnerLines_commande'; |
| 635 | 643 | $sessname2 = 'subtotal_hidedetails_commande'; |
| 636 | 644 | $sessname3 = 'subtotal_hideprices_commande'; |
| 637 | - } |
|
| 638 | - elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
|
| 645 | + } elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
|
| 639 | 646 | $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
| 640 | 647 | $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
| 641 | 648 | $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
| 642 | - } |
|
| 643 | - else { |
|
| 649 | + } else { |
|
| 644 | 650 | $sessname = 'subtotal_hideInnerLines_unknown'; |
| 645 | 651 | $sessname2 = 'subtotal_hidedetails_unknown'; |
| 646 | 652 | $sessname3 = 'subtotal_hideprices_unknown'; |
@@ -649,15 +655,24 @@ discard block |
||
| 649 | 655 | global $hideprices; |
| 650 | 656 | |
| 651 | 657 | $hideInnerLines = (int)GETPOST('hideInnerLines'); |
| 652 | - if(!empty($_SESSION[$sessname]) && !is_array($_SESSION[$sessname][$object->id]) ) $_SESSION[$sessname] = array(); // prevent old system |
|
| 658 | + if(!empty($_SESSION[$sessname]) && !is_array($_SESSION[$sessname][$object->id]) ) { |
|
| 659 | + $_SESSION[$sessname] = array(); |
|
| 660 | + } |
|
| 661 | + // prevent old system |
|
| 653 | 662 | $_SESSION[$sessname][$object->id] = $hideInnerLines; |
| 654 | 663 | |
| 655 | 664 | $hidedetails= (int)GETPOST('hidedetails'); |
| 656 | - if(!empty($_SESSION[$sessname2]) && !is_array($_SESSION[$sessname2][$object->id]) ) $_SESSION[$sessname2] = array(); // prevent old system |
|
| 665 | + if(!empty($_SESSION[$sessname2]) && !is_array($_SESSION[$sessname2][$object->id]) ) { |
|
| 666 | + $_SESSION[$sessname2] = array(); |
|
| 667 | + } |
|
| 668 | + // prevent old system |
|
| 657 | 669 | $_SESSION[$sessname2][$object->id] = $hidedetails; |
| 658 | 670 | |
| 659 | 671 | $hideprices= (int)GETPOST('hideprices'); |
| 660 | - if(!empty($_SESSION[$sessname3]) && !is_array($_SESSION[$sessname3][$object->id]) ) $_SESSION[$sessname3] = array(); // prevent old system |
|
| 672 | + if(!empty($_SESSION[$sessname3]) && !is_array($_SESSION[$sessname3][$object->id]) ) { |
|
| 673 | + $_SESSION[$sessname3] = array(); |
|
| 674 | + } |
|
| 675 | + // prevent old system |
|
| 661 | 676 | $_SESSION[$sessname3][$object->id] = $hideprices; |
| 662 | 677 | |
| 663 | 678 | foreach($object->lines as &$line) { |
@@ -665,8 +680,7 @@ discard block |
||
| 665 | 680 | |
| 666 | 681 | if($line->qty>=90) { |
| 667 | 682 | $line->modsubtotal_total = 1; |
| 668 | - } |
|
| 669 | - else{ |
|
| 683 | + } else{ |
|
| 670 | 684 | $line->modsubtotal_title = 1; |
| 671 | 685 | } |
| 672 | 686 | |
@@ -675,8 +689,7 @@ discard block |
||
| 675 | 689 | } |
| 676 | 690 | } |
| 677 | 691 | |
| 678 | - } |
|
| 679 | - else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
| 692 | + } else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
| 680 | 693 | |
| 681 | 694 | $Tab = $this->getArrayOfLineForAGroup($object, GETPOST('lineid')); |
| 682 | 695 | |
@@ -684,7 +697,9 @@ discard block |
||
| 684 | 697 | /** |
| 685 | 698 | * @var $object Facture |
| 686 | 699 | */ |
| 687 | - if($object->element=='facture') $object->deleteline($idLine); |
|
| 700 | + if($object->element=='facture') { |
|
| 701 | + $object->deleteline($idLine); |
|
| 702 | + } |
|
| 688 | 703 | /** |
| 689 | 704 | * @var $object Facture fournisseur |
| 690 | 705 | */ |
@@ -695,18 +710,25 @@ discard block |
||
| 695 | 710 | /** |
| 696 | 711 | * @var $object Propal |
| 697 | 712 | */ |
| 698 | - else if($object->element=='propal') $object->deleteline($idLine); |
|
| 713 | + else if($object->element=='propal') { |
|
| 714 | + $object->deleteline($idLine); |
|
| 715 | + } |
|
| 699 | 716 | /** |
| 700 | 717 | * @var $object Propal Fournisseur |
| 701 | 718 | */ |
| 702 | - else if($object->element=='supplier_proposal') $object->deleteline($idLine); |
|
| 719 | + else if($object->element=='supplier_proposal') { |
|
| 720 | + $object->deleteline($idLine); |
|
| 721 | + } |
|
| 703 | 722 | /** |
| 704 | 723 | * @var $object Commande |
| 705 | 724 | */ |
| 706 | 725 | else if($object->element=='commande') |
| 707 | 726 | { |
| 708 | - if ((float) DOL_VERSION >= 5.0) $object->deleteline($user, $idLine); |
|
| 709 | - else $object->deleteline($idLine); |
|
| 727 | + if ((float) DOL_VERSION >= 5.0) { |
|
| 728 | + $object->deleteline($user, $idLine); |
|
| 729 | + } else { |
|
| 730 | + $object->deleteline($idLine); |
|
| 731 | + } |
|
| 710 | 732 | } |
| 711 | 733 | /** |
| 712 | 734 | * @var $object Commande fournisseur |
@@ -718,25 +740,32 @@ discard block |
||
| 718 | 740 | /** |
| 719 | 741 | * @var $object Facturerec |
| 720 | 742 | */ |
| 721 | - else if($object->element=='facturerec') $object->deleteline($idLine); |
|
| 743 | + else if($object->element=='facturerec') { |
|
| 744 | + $object->deleteline($idLine); |
|
| 745 | + } |
|
| 722 | 746 | /** |
| 723 | 747 | * @var $object Expedition |
| 724 | 748 | */ |
| 725 | - else if($object->element=='shipping') $object->deleteline($user, $idLine); |
|
| 749 | + else if($object->element=='shipping') { |
|
| 750 | + $object->deleteline($user, $idLine); |
|
| 751 | + } |
|
| 726 | 752 | } |
| 727 | 753 | |
| 728 | 754 | header('location:?id='.$object->id); |
| 729 | 755 | exit; |
| 730 | 756 | |
| 731 | - } |
|
| 732 | - else if ($action == 'duplicate') |
|
| 757 | + } else if ($action == 'duplicate') |
|
| 733 | 758 | { |
| 734 | 759 | $lineid = GETPOST('lineid', 'int'); |
| 735 | 760 | $nbDuplicate = TSubtotal::duplicateLines($object, $lineid, true); |
| 736 | 761 | |
| 737 | - if ($nbDuplicate > 0) setEventMessage($langs->trans('subtotal_duplicate_success', $nbDuplicate)); |
|
| 738 | - elseif ($nbDuplicate == 0) setEventMessage($langs->trans('subtotal_duplicate_lineid_not_found'), 'warnings'); |
|
| 739 | - else setEventMessage($langs->trans('subtotal_duplicate_error'), 'errors'); |
|
| 762 | + if ($nbDuplicate > 0) { |
|
| 763 | + setEventMessage($langs->trans('subtotal_duplicate_success', $nbDuplicate)); |
|
| 764 | + } elseif ($nbDuplicate == 0) { |
|
| 765 | + setEventMessage($langs->trans('subtotal_duplicate_lineid_not_found'), 'warnings'); |
|
| 766 | + } else { |
|
| 767 | + setEventMessage($langs->trans('subtotal_duplicate_error'), 'errors'); |
|
| 768 | + } |
|
| 740 | 769 | |
| 741 | 770 | header('Location: ?id='.$object->id); |
| 742 | 771 | exit; |
@@ -754,21 +783,26 @@ discard block |
||
| 754 | 783 | global $conf; |
| 755 | 784 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && !empty($object->table_element_line) && in_array($object->element, array('commande', 'facture', 'propal'))) |
| 756 | 785 | { |
| 757 | - if ($object->element == 'commande') |
|
| 758 | - $obj = new OrderLine($object->db); |
|
| 759 | - if ($object->element == 'propal') |
|
| 760 | - $obj = new PropaleLigne($object->db); |
|
| 761 | - if ($object->element == 'facture') |
|
| 762 | - $obj = new FactureLigne($object->db); |
|
| 786 | + if ($object->element == 'commande') { |
|
| 787 | + $obj = new OrderLine($object->db); |
|
| 788 | + } |
|
| 789 | + if ($object->element == 'propal') { |
|
| 790 | + $obj = new PropaleLigne($object->db); |
|
| 791 | + } |
|
| 792 | + if ($object->element == 'facture') { |
|
| 793 | + $obj = new FactureLigne($object->db); |
|
| 794 | + } |
|
| 763 | 795 | if (!empty($parameters['fk_element'])) |
| 764 | 796 | { |
| 765 | 797 | |
| 766 | 798 | if($obj->fetch($parameters['fk_element'])){ |
| 767 | 799 | $obj->id= $obj->rowid; |
| 768 | - if (empty($obj->array_options)) |
|
| 769 | - $obj->fetch_optionals(); |
|
| 770 | - if (!empty($obj->array_options['options_subtotal_nc'])) |
|
| 771 | - return 1; |
|
| 800 | + if (empty($obj->array_options)) { |
|
| 801 | + $obj->fetch_optionals(); |
|
| 802 | + } |
|
| 803 | + if (!empty($obj->array_options['options_subtotal_nc'])) { |
|
| 804 | + return 1; |
|
| 805 | + } |
|
| 772 | 806 | } |
| 773 | 807 | } |
| 774 | 808 | } |
@@ -840,27 +874,33 @@ discard block |
||
| 840 | 874 | $TTotal_tva = array(); |
| 841 | 875 | |
| 842 | 876 | $sign=1; |
| 843 | - if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; |
|
| 877 | + if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) { |
|
| 878 | + $sign=-1; |
|
| 879 | + } |
|
| 844 | 880 | |
| 845 | - if (GETPOST('action') == 'builddoc') $builddoc = true; |
|
| 846 | - else $builddoc = false; |
|
| 881 | + if (GETPOST('action') == 'builddoc') { |
|
| 882 | + $builddoc = true; |
|
| 883 | + } else { |
|
| 884 | + $builddoc = false; |
|
| 885 | + } |
|
| 847 | 886 | |
| 848 | 887 | dol_include_once('/subtotal/class/subtotal.class.php'); |
| 849 | 888 | foreach($object->lines as $l) { |
| 850 | 889 | //print $l->rang.'>='.$rang.' '.$total.'<br/>'; |
| 851 | 890 | if($l->rang>=$rang) { |
| 852 | 891 | //echo 'return!<br>'; |
| 853 | - if (!$return_all) return $total; |
|
| 854 | - else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
| 855 | - } |
|
| 856 | - else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
| 892 | + if (!$return_all) { |
|
| 893 | + return $total; |
|
| 894 | + } else { |
|
| 895 | + return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
| 896 | + } |
|
| 897 | + } else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
| 857 | 898 | { |
| 858 | 899 | $total = 0; |
| 859 | 900 | $total_tva = 0; |
| 860 | 901 | $total_ttc = 0; |
| 861 | 902 | $TTotal_tva = array(); |
| 862 | - } |
|
| 863 | - elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
| 903 | + } elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
| 864 | 904 | |
| 865 | 905 | // TODO retirer le test avec $builddoc quand Dolibarr affichera le total progression sur la card et pas seulement dans le PDF |
| 866 | 906 | if ($builddoc && $object->element == 'facture' && $object->type==Facture::TYPE_SITUATION) |
@@ -882,8 +922,7 @@ discard block |
||
| 882 | 922 | $TTotal_tva[$l->tva_tx] += $sign * ($l->total_tva / ($l->situation_percent / 100)) * $progress; |
| 883 | 923 | $total_ttc += $sign * ($l->total_tva / ($l->total_ttc / 100)) * $progress; |
| 884 | 924 | } |
| 885 | - } |
|
| 886 | - else |
|
| 925 | + } else |
|
| 887 | 926 | { |
| 888 | 927 | $total += $l->total_ht; |
| 889 | 928 | $total_tva += $l->total_tva; |
@@ -893,8 +932,11 @@ discard block |
||
| 893 | 932 | } |
| 894 | 933 | |
| 895 | 934 | } |
| 896 | - if (!$return_all) return $total; |
|
| 897 | - else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
| 935 | + if (!$return_all) { |
|
| 936 | + return $total; |
|
| 937 | + } else { |
|
| 938 | + return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
| 939 | + } |
|
| 898 | 940 | } |
| 899 | 941 | |
| 900 | 942 | /** |
@@ -941,15 +983,18 @@ discard block |
||
| 941 | 983 | } |
| 942 | 984 | |
| 943 | 985 | |
| 944 | - if($line->qty==99) |
|
| 945 | - $pdf->SetFillColor(220,220,220); |
|
| 946 | - elseif ($line->qty==98) |
|
| 947 | - $pdf->SetFillColor(230,230,230); |
|
| 948 | - else |
|
| 949 | - $pdf->SetFillColor(240,240,240); |
|
| 986 | + if($line->qty==99) { |
|
| 987 | + $pdf->SetFillColor(220,220,220); |
|
| 988 | + } elseif ($line->qty==98) { |
|
| 989 | + $pdf->SetFillColor(230,230,230); |
|
| 990 | + } else { |
|
| 991 | + $pdf->SetFillColor(240,240,240); |
|
| 992 | + } |
|
| 950 | 993 | |
| 951 | 994 | $style = 'B'; |
| 952 | - if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
|
| 995 | + if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) { |
|
| 996 | + $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
|
| 997 | + } |
|
| 953 | 998 | |
| 954 | 999 | $pdf->SetFont('', $style, 9); |
| 955 | 1000 | |
@@ -991,8 +1036,7 @@ discard block |
||
| 991 | 1036 | // $line->total_tva |
| 992 | 1037 | // $line->total |
| 993 | 1038 | // $line->total_ttc |
| 994 | - } |
|
| 995 | - else |
|
| 1039 | + } else |
|
| 996 | 1040 | { |
| 997 | 1041 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
| 998 | 1042 | $total_to_print = price($total); |
@@ -1005,11 +1049,14 @@ discard block |
||
| 1005 | 1049 | } |
| 1006 | 1050 | |
| 1007 | 1051 | $pdf->SetXY($pdf->postotalht, $posy); |
| 1008 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
| 1052 | + if($set_pagebreak_margin) { |
|
| 1053 | + $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
| 1054 | + } |
|
| 1009 | 1055 | $pdf->MultiCell($pdf->page_largeur-$pdf->marge_droite-$pdf->postotalht, 3, $total_to_print, 0, 'R', 0); |
| 1010 | - } |
|
| 1011 | - else{ |
|
| 1012 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
| 1056 | + } else{ |
|
| 1057 | + if($set_pagebreak_margin) { |
|
| 1058 | + $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
| 1059 | + } |
|
| 1013 | 1060 | } |
| 1014 | 1061 | |
| 1015 | 1062 | $posy = $posy + $cell_height; |
@@ -1041,25 +1088,40 @@ discard block |
||
| 1041 | 1088 | |
| 1042 | 1089 | |
| 1043 | 1090 | $style = ($line->qty==1) ? 'BU' : 'BUI'; |
| 1044 | - if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
|
| 1091 | + if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) { |
|
| 1092 | + $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
|
| 1093 | + } |
|
| 1045 | 1094 | |
| 1046 | 1095 | if($hideInnerLines) { |
| 1047 | - if($line->qty==1)$pdf->SetFont('', $style, 9); |
|
| 1048 | - else |
|
| 1096 | + if($line->qty==1) { |
|
| 1097 | + $pdf->SetFont('', $style, 9); |
|
| 1098 | + } else |
|
| 1049 | 1099 | { |
| 1050 | - if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
|
| 1100 | + if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) { |
|
| 1101 | + $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
|
| 1102 | + } |
|
| 1051 | 1103 | $pdf->SetFont('', $style, 9); |
| 1052 | 1104 | } |
| 1053 | - } |
|
| 1054 | - else { |
|
| 1105 | + } else { |
|
| 1055 | 1106 | |
| 1056 | - if($line->qty==1)$pdf->SetFont('', $style, 9); //TODO if super utile |
|
| 1057 | - else $pdf->SetFont('', $style, 9); |
|
| 1107 | + if($line->qty==1) { |
|
| 1108 | + $pdf->SetFont('', $style, 9); |
|
| 1109 | + } |
|
| 1110 | + //TODO if super utile |
|
| 1111 | + else { |
|
| 1112 | + $pdf->SetFont('', $style, 9); |
|
| 1113 | + } |
|
| 1058 | 1114 | |
| 1059 | 1115 | } |
| 1060 | 1116 | |
| 1061 | - if ($label === strip_tags($label) && $label === dol_html_entity_decode($label, ENT_QUOTES)) $pdf->MultiCell($w, $h, $label, 0, 'L'); // Pas de HTML dans la chaine |
|
| 1062 | - else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); // et maintenant avec du HTML |
|
| 1117 | + if ($label === strip_tags($label) && $label === dol_html_entity_decode($label, ENT_QUOTES)) { |
|
| 1118 | + $pdf->MultiCell($w, $h, $label, 0, 'L'); |
|
| 1119 | + } |
|
| 1120 | + // Pas de HTML dans la chaine |
|
| 1121 | + else { |
|
| 1122 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); |
|
| 1123 | + } |
|
| 1124 | + // et maintenant avec du HTML |
|
| 1063 | 1125 | |
| 1064 | 1126 | if($description && !$hidedesc) { |
| 1065 | 1127 | $posy = $pdf->GetY(); |
@@ -1083,8 +1145,7 @@ discard block |
||
| 1083 | 1145 | |
| 1084 | 1146 | if(is_array($parameters)) { |
| 1085 | 1147 | $i = & $parameters['i']; |
| 1086 | - } |
|
| 1087 | - else { |
|
| 1148 | + } else { |
|
| 1088 | 1149 | $i = (int)$parameters; |
| 1089 | 1150 | } |
| 1090 | 1151 | |
@@ -1114,17 +1175,14 @@ discard block |
||
| 1114 | 1175 | |
| 1115 | 1176 | if((float)DOL_VERSION<=3.6) { |
| 1116 | 1177 | return ''; |
| 1117 | - } |
|
| 1118 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1178 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1119 | 1179 | return 1; |
| 1120 | 1180 | } |
| 1121 | 1181 | |
| 1122 | - } |
|
| 1123 | - elseif(!empty($hideprices)) { |
|
| 1182 | + } elseif(!empty($hideprices)) { |
|
| 1124 | 1183 | $this->resprints = $object->lines[$parameters['i']]->qty; |
| 1125 | 1184 | return 1; |
| 1126 | - } |
|
| 1127 | - elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
|
| 1185 | + } elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
|
| 1128 | 1186 | { |
| 1129 | 1187 | $hideInnerLines = (int)GETPOST('hideInnerLines'); |
| 1130 | 1188 | $hidedetails = (int)GETPOST('hidedetails'); |
@@ -1134,12 +1192,20 @@ discard block |
||
| 1134 | 1192 | } |
| 1135 | 1193 | } |
| 1136 | 1194 | |
| 1137 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1138 | - else $i = (int)$parameters; |
|
| 1195 | + if(is_array($parameters)) { |
|
| 1196 | + $i = & $parameters['i']; |
|
| 1197 | + } else { |
|
| 1198 | + $i = (int)$parameters; |
|
| 1199 | + } |
|
| 1139 | 1200 | |
| 1140 | - if (empty($object->lines[$i])) return 0; // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
|
| 1201 | + if (empty($object->lines[$i])) { |
|
| 1202 | + return 0; |
|
| 1203 | + } |
|
| 1204 | + // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
|
| 1141 | 1205 | |
| 1142 | - if(empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); |
|
| 1206 | + if(empty($object->lines[$i]->array_options)) { |
|
| 1207 | + $object->lines[$i]->fetch_optionals(); |
|
| 1208 | + } |
|
| 1143 | 1209 | |
| 1144 | 1210 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
| 1145 | 1211 | { |
@@ -1156,8 +1222,11 @@ discard block |
||
| 1156 | 1222 | function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') { |
| 1157 | 1223 | global $conf, $hideprices, $hookmanager; |
| 1158 | 1224 | |
| 1159 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1160 | - else $i = (int)$parameters; |
|
| 1225 | + if(is_array($parameters)) { |
|
| 1226 | + $i = & $parameters['i']; |
|
| 1227 | + } else { |
|
| 1228 | + $i = (int)$parameters; |
|
| 1229 | + } |
|
| 1161 | 1230 | |
| 1162 | 1231 | if($this->isModSubtotalLine($parameters,$object) ){ |
| 1163 | 1232 | |
@@ -1165,13 +1234,11 @@ discard block |
||
| 1165 | 1234 | |
| 1166 | 1235 | if((float)DOL_VERSION<=3.6) { |
| 1167 | 1236 | return ''; |
| 1168 | - } |
|
| 1169 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1237 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1170 | 1238 | return 1; |
| 1171 | 1239 | } |
| 1172 | 1240 | |
| 1173 | - } |
|
| 1174 | - elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS)) |
|
| 1241 | + } elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS)) |
|
| 1175 | 1242 | { |
| 1176 | 1243 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
| 1177 | 1244 | { |
@@ -1243,12 +1310,10 @@ discard block |
||
| 1243 | 1310 | $this->error = $hookmanager->error; |
| 1244 | 1311 | $this->errors = $hookmanager->errors; |
| 1245 | 1312 | return -1; |
| 1246 | - } |
|
| 1247 | - elseif (empty($reshook)) |
|
| 1313 | + } elseif (empty($reshook)) |
|
| 1248 | 1314 | { |
| 1249 | 1315 | $this->resprints .= $hookmanager->resprints; |
| 1250 | - } |
|
| 1251 | - else |
|
| 1316 | + } else |
|
| 1252 | 1317 | { |
| 1253 | 1318 | $this->resprints = $hookmanager->resprints; |
| 1254 | 1319 | |
@@ -1271,14 +1336,16 @@ discard block |
||
| 1271 | 1336 | |
| 1272 | 1337 | if((float)DOL_VERSION<=3.6) { |
| 1273 | 1338 | return ''; |
| 1274 | - } |
|
| 1275 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1339 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1276 | 1340 | return 1; |
| 1277 | 1341 | } |
| 1278 | 1342 | } |
| 1279 | 1343 | |
| 1280 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1281 | - else $i = (int)$parameters; |
|
| 1344 | + if(is_array($parameters)) { |
|
| 1345 | + $i = & $parameters['i']; |
|
| 1346 | + } else { |
|
| 1347 | + $i = (int)$parameters; |
|
| 1348 | + } |
|
| 1282 | 1349 | |
| 1283 | 1350 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
| 1284 | 1351 | { |
@@ -1300,14 +1367,16 @@ discard block |
||
| 1300 | 1367 | |
| 1301 | 1368 | if((float)DOL_VERSION<=3.6) { |
| 1302 | 1369 | return ''; |
| 1303 | - } |
|
| 1304 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1370 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1305 | 1371 | return 1; |
| 1306 | 1372 | } |
| 1307 | 1373 | } |
| 1308 | 1374 | |
| 1309 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1310 | - else $i = (int)$parameters; |
|
| 1375 | + if(is_array($parameters)) { |
|
| 1376 | + $i = & $parameters['i']; |
|
| 1377 | + } else { |
|
| 1378 | + $i = (int)$parameters; |
|
| 1379 | + } |
|
| 1311 | 1380 | |
| 1312 | 1381 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
| 1313 | 1382 | { |
@@ -1324,8 +1393,11 @@ discard block |
||
| 1324 | 1393 | function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') { |
| 1325 | 1394 | global $conf,$hideprices,$hookmanager; |
| 1326 | 1395 | |
| 1327 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1328 | - else $i = (int)$parameters; |
|
| 1396 | + if(is_array($parameters)) { |
|
| 1397 | + $i = & $parameters['i']; |
|
| 1398 | + } else { |
|
| 1399 | + $i = (int)$parameters; |
|
| 1400 | + } |
|
| 1329 | 1401 | |
| 1330 | 1402 | if($this->isModSubtotalLine($parameters,$object) ) { |
| 1331 | 1403 | $this->resprints = ' '; |
@@ -1336,7 +1408,9 @@ discard block |
||
| 1336 | 1408 | if(TSubtotal::isSubtotal($line)) { |
| 1337 | 1409 | $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
| 1338 | 1410 | |
| 1339 | - if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1411 | + if(is_object($parentTitle) && empty($parentTitle->array_options)) { |
|
| 1412 | + $parentTitle->fetch_optionals(); |
|
| 1413 | + } |
|
| 1340 | 1414 | if(! empty($parentTitle->array_options['options_show_total_ht'])) { |
| 1341 | 1415 | $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
| 1342 | 1416 | $this->resprints = price($TTotal['total_subprice']); |
@@ -1345,8 +1419,7 @@ discard block |
||
| 1345 | 1419 | |
| 1346 | 1420 | if((float)DOL_VERSION<=3.6) { |
| 1347 | 1421 | return ''; |
| 1348 | - } |
|
| 1349 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1422 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1350 | 1423 | return 1; |
| 1351 | 1424 | } |
| 1352 | 1425 | } |
@@ -1391,8 +1464,11 @@ discard block |
||
| 1391 | 1464 | function pdf_getlineremisepercent($parameters=array(), &$object, &$action='') { |
| 1392 | 1465 | global $conf,$hideprices,$hookmanager; |
| 1393 | 1466 | |
| 1394 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1395 | - else $i = (int) $parameters; |
|
| 1467 | + if(is_array($parameters)) { |
|
| 1468 | + $i = & $parameters['i']; |
|
| 1469 | + } else { |
|
| 1470 | + $i = (int) $parameters; |
|
| 1471 | + } |
|
| 1396 | 1472 | |
| 1397 | 1473 | if($this->isModSubtotalLine($parameters,$object) ) { |
| 1398 | 1474 | $this->resprints = ' '; |
@@ -1403,7 +1479,9 @@ discard block |
||
| 1403 | 1479 | if(TSubtotal::isSubtotal($line)) { |
| 1404 | 1480 | $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
| 1405 | 1481 | |
| 1406 | - if(empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1482 | + if(empty($parentTitle->array_options)) { |
|
| 1483 | + $parentTitle->fetch_optionals(); |
|
| 1484 | + } |
|
| 1407 | 1485 | if(! empty($parentTitle->array_options['options_show_reduc'])) { |
| 1408 | 1486 | $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
| 1409 | 1487 | $this->resprints = price((1-$TTotal['total_ht'] / $TTotal['total_subprice'])*100, 0, '', 1, 2, 2).'%'; |
@@ -1412,12 +1490,10 @@ discard block |
||
| 1412 | 1490 | |
| 1413 | 1491 | if((float)DOL_VERSION<=3.6) { |
| 1414 | 1492 | return ''; |
| 1415 | - } |
|
| 1416 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1493 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1417 | 1494 | return 1; |
| 1418 | 1495 | } |
| 1419 | - } |
|
| 1420 | - elseif (!empty($hideprices) |
|
| 1496 | + } elseif (!empty($hideprices) |
|
| 1421 | 1497 | || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
| 1422 | 1498 | ) |
| 1423 | 1499 | { |
@@ -1438,14 +1514,16 @@ discard block |
||
| 1438 | 1514 | $this->resprints = ' '; |
| 1439 | 1515 | if((float)DOL_VERSION<=3.6) { |
| 1440 | 1516 | return ''; |
| 1441 | - } |
|
| 1442 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1517 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1443 | 1518 | return 1; |
| 1444 | 1519 | } |
| 1445 | 1520 | } |
| 1446 | 1521 | |
| 1447 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1448 | - else $i = (int)$parameters; |
|
| 1522 | + if(is_array($parameters)) { |
|
| 1523 | + $i = & $parameters['i']; |
|
| 1524 | + } else { |
|
| 1525 | + $i = (int)$parameters; |
|
| 1526 | + } |
|
| 1449 | 1527 | |
| 1450 | 1528 | if (!empty($hideprices) |
| 1451 | 1529 | || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
@@ -1469,16 +1547,21 @@ discard block |
||
| 1469 | 1547 | |
| 1470 | 1548 | if((float)DOL_VERSION<=3.6) { |
| 1471 | 1549 | return ''; |
| 1472 | - } |
|
| 1473 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1550 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1474 | 1551 | return 1; |
| 1475 | 1552 | } |
| 1476 | 1553 | } |
| 1477 | 1554 | |
| 1478 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1479 | - else $i = (int)$parameters; |
|
| 1555 | + if(is_array($parameters)) { |
|
| 1556 | + $i = & $parameters['i']; |
|
| 1557 | + } else { |
|
| 1558 | + $i = (int)$parameters; |
|
| 1559 | + } |
|
| 1480 | 1560 | |
| 1481 | - if (empty($object->lines[$i])) return 0; // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
|
| 1561 | + if (empty($object->lines[$i])) { |
|
| 1562 | + return 0; |
|
| 1563 | + } |
|
| 1564 | + // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
|
| 1482 | 1565 | |
| 1483 | 1566 | $object->lines[$i]->fetch_optionals(); |
| 1484 | 1567 | // Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché |
@@ -1524,14 +1607,16 @@ discard block |
||
| 1524 | 1607 | $this->resprints = ' '; |
| 1525 | 1608 | if((float)DOL_VERSION<=3.6) { |
| 1526 | 1609 | return ''; |
| 1527 | - } |
|
| 1528 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1610 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1529 | 1611 | return 1; |
| 1530 | 1612 | } |
| 1531 | 1613 | } |
| 1532 | 1614 | |
| 1533 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1534 | - else $i = (int)$parameters; |
|
| 1615 | + if(is_array($parameters)) { |
|
| 1616 | + $i = & $parameters['i']; |
|
| 1617 | + } else { |
|
| 1618 | + $i = (int)$parameters; |
|
| 1619 | + } |
|
| 1535 | 1620 | |
| 1536 | 1621 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
| 1537 | 1622 | { |
@@ -1561,7 +1646,9 @@ discard block |
||
| 1561 | 1646 | } |
| 1562 | 1647 | } |
| 1563 | 1648 | |
| 1564 | - if (!empty($TLineTitle)) $TTitleNumeroted = $this->formatNumerotation($TLineTitle); |
|
| 1649 | + if (!empty($TLineTitle)) { |
|
| 1650 | + $TTitleNumeroted = $this->formatNumerotation($TLineTitle); |
|
| 1651 | + } |
|
| 1565 | 1652 | } |
| 1566 | 1653 | |
| 1567 | 1654 | } |
@@ -1575,8 +1662,12 @@ discard block |
||
| 1575 | 1662 | $j=0; |
| 1576 | 1663 | foreach ($TLineTitle as $k => &$line) |
| 1577 | 1664 | { |
| 1578 | - if (!empty($line_reference) && $line->rang <= $line_reference->rang) continue; |
|
| 1579 | - if (!empty($line_reference) && $line->qty <= $line_reference->qty) break; |
|
| 1665 | + if (!empty($line_reference) && $line->rang <= $line_reference->rang) { |
|
| 1666 | + continue; |
|
| 1667 | + } |
|
| 1668 | + if (!empty($line_reference) && $line->qty <= $line_reference->qty) { |
|
| 1669 | + break; |
|
| 1670 | + } |
|
| 1580 | 1671 | |
| 1581 | 1672 | if ($line->qty == $level) |
| 1582 | 1673 | { |
@@ -1610,7 +1701,9 @@ discard block |
||
| 1610 | 1701 | |
| 1611 | 1702 | $hidedetails = (int)GETPOST('hidedetails'); |
| 1612 | 1703 | |
| 1613 | - if(empty($hidedetails)) return false; |
|
| 1704 | + if(empty($hidedetails)) { |
|
| 1705 | + return false; |
|
| 1706 | + } |
|
| 1614 | 1707 | |
| 1615 | 1708 | // TODO can't add VAT to document without lines... :-/ |
| 1616 | 1709 | |
@@ -1638,7 +1731,9 @@ discard block |
||
| 1638 | 1731 | foreach($object->lines as $k => &$l) { |
| 1639 | 1732 | if(TSubtotal::isSubtotal($l)) { |
| 1640 | 1733 | $parentTitle = TSubtotal::getParentTitleOfLine($object, $k); |
| 1641 | - if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
| 1734 | + if(is_object($parentTitle) && empty($parentTitle->array_options)) { |
|
| 1735 | + $parentTitle->fetch_optionals(); |
|
| 1736 | + } |
|
| 1642 | 1737 | if(! empty($parentTitle->id) && ! empty($parentTitle->array_options['options_show_total_ht'])) { |
| 1643 | 1738 | $l->remise_percent = 100; // Affichage de la réduction sur la ligne de sous-total |
| 1644 | 1739 | } |
@@ -1680,7 +1775,9 @@ discard block |
||
| 1680 | 1775 | */ |
| 1681 | 1776 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
| 1682 | 1777 | |
| 1683 | - if (TSubtotal::getNiveau($line) == 1) $line->TTotal_tva = $TTotal_tva; |
|
| 1778 | + if (TSubtotal::getNiveau($line) == 1) { |
|
| 1779 | + $line->TTotal_tva = $TTotal_tva; |
|
| 1780 | + } |
|
| 1684 | 1781 | $line->total_ht = $total; |
| 1685 | 1782 | $line->total_tva = $total_tva; |
| 1686 | 1783 | $line->total = $line->total_ht; |
@@ -1744,8 +1841,7 @@ discard block |
||
| 1744 | 1841 | } |
| 1745 | 1842 | |
| 1746 | 1843 | |
| 1747 | - } |
|
| 1748 | - elseif ($hidedetails) |
|
| 1844 | + } elseif ($hidedetails) |
|
| 1749 | 1845 | { |
| 1750 | 1846 | $TLines[] = $line; //Cas où je cache uniquement les prix des produits |
| 1751 | 1847 | } |
@@ -1816,13 +1912,17 @@ discard block |
||
| 1816 | 1912 | |
| 1817 | 1913 | if(!empty($hideprices)) { |
| 1818 | 1914 | foreach($object->lines as &$line) { |
| 1819 | - if($line->fk_product_type!=9) $line->fk_parent_line = -1; |
|
| 1915 | + if($line->fk_product_type!=9) { |
|
| 1916 | + $line->fk_parent_line = -1; |
|
| 1917 | + } |
|
| 1820 | 1918 | } |
| 1821 | 1919 | } |
| 1822 | 1920 | |
| 1823 | 1921 | $line = &$object->lines[$i]; |
| 1824 | 1922 | |
| 1825 | - if($object->element == 'delivery' && ! empty($object->commande->expeditions[$line->fk_origin_line])) unset($object->commande->expeditions[$line->fk_origin_line]); |
|
| 1923 | + if($object->element == 'delivery' && ! empty($object->commande->expeditions[$line->fk_origin_line])) { |
|
| 1924 | + unset($object->commande->expeditions[$line->fk_origin_line]); |
|
| 1925 | + } |
|
| 1826 | 1926 | |
| 1827 | 1927 | if($line->info_bits>0) { // PAGE BREAK |
| 1828 | 1928 | $pdf->addPage(); |
@@ -1838,7 +1938,9 @@ discard block |
||
| 1838 | 1938 | } |
| 1839 | 1939 | |
| 1840 | 1940 | if($line->qty>90) { |
| 1841 | - if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) $label .= ' '.$this->getTitle($object, $line); |
|
| 1941 | + if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) { |
|
| 1942 | + $label .= ' '.$this->getTitle($object, $line); |
|
| 1943 | + } |
|
| 1842 | 1944 | |
| 1843 | 1945 | $pageBefore = $pdf->getPage(); |
| 1844 | 1946 | $this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
@@ -1876,8 +1978,7 @@ discard block |
||
| 1876 | 1978 | |
| 1877 | 1979 | $posy = $pdf->GetY(); |
| 1878 | 1980 | return 1; |
| 1879 | - } |
|
| 1880 | - else if ($line->qty < 10) { |
|
| 1981 | + } else if ($line->qty < 10) { |
|
| 1881 | 1982 | $pageBefore = $pdf->getPage(); |
| 1882 | 1983 | |
| 1883 | 1984 | $this->pdf_add_title($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
@@ -1907,8 +2008,7 @@ discard block |
||
| 1907 | 2008 | // if($line->rowid==47) exit; |
| 1908 | 2009 | |
| 1909 | 2010 | return 0; |
| 1910 | - } |
|
| 1911 | - elseif (empty($object->lines[$parameters['i']])) |
|
| 2011 | + } elseif (empty($object->lines[$parameters['i']])) |
|
| 1912 | 2012 | { |
| 1913 | 2013 | $this->resprints = -1; |
| 1914 | 2014 | } |
@@ -1941,7 +2041,9 @@ discard block |
||
| 1941 | 2041 | |
| 1942 | 2042 | foreach ($object->lines as $line) |
| 1943 | 2043 | { |
| 1944 | - if ($line->id == $currentLine->id) break; |
|
| 2044 | + if ($line->id == $currentLine->id) { |
|
| 2045 | + break; |
|
| 2046 | + } |
|
| 1945 | 2047 | |
| 1946 | 2048 | $qty_search = 100 - $currentLine->qty; |
| 1947 | 2049 | |
@@ -1980,22 +2082,18 @@ discard block |
||
| 1980 | 2082 | { |
| 1981 | 2083 | $object->statut = 0; // hack for facture rec |
| 1982 | 2084 | $createRight = $user->rights->facture->creer; |
| 1983 | - } |
|
| 1984 | - elseif($object->element == 'order_supplier' ) |
|
| 2085 | + } elseif($object->element == 'order_supplier' ) |
|
| 1985 | 2086 | { |
| 1986 | 2087 | $createRight = $user->rights->fournisseur->commande->creer; |
| 1987 | - } |
|
| 1988 | - elseif($object->element == 'invoice_supplier' ) |
|
| 2088 | + } elseif($object->element == 'invoice_supplier' ) |
|
| 1989 | 2089 | { |
| 1990 | 2090 | $createRight = $user->rights->fournisseur->facture->creer; |
| 1991 | - } |
|
| 1992 | - elseif($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) |
|
| 2091 | + } elseif($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) |
|
| 1993 | 2092 | { |
| 1994 | 2093 | // H4cK 4n0nYm0u$-style : $line n'est pas un objet instancié mais provient d'un fetch_object d'une requête SQL |
| 1995 | 2094 | $line->id = $line->rowid; |
| 1996 | 2095 | $line->product_type = $line->type; |
| 1997 | - } |
|
| 1998 | - elseif($object->element == 'shipping' || $object->element == 'delivery') |
|
| 2096 | + } elseif($object->element == 'shipping' || $object->element == 'delivery') |
|
| 1999 | 2097 | { |
| 2000 | 2098 | if(empty($line->origin_line_id) && ! empty($line->fk_origin_line)) |
| 2001 | 2099 | { |
@@ -2015,8 +2113,11 @@ discard block |
||
| 2015 | 2113 | |
| 2016 | 2114 | $line = $originline; |
| 2017 | 2115 | } |
| 2018 | - if($object->element=='facture')$idvar = 'facid'; |
|
| 2019 | - else $idvar='id'; |
|
| 2116 | + if($object->element=='facture') { |
|
| 2117 | + $idvar = 'facid'; |
|
| 2118 | + } else { |
|
| 2119 | + $idvar='id'; |
|
| 2120 | + } |
|
| 2020 | 2121 | if($line->special_code!=$this->module_number || $line->product_type!=9) { |
| 2021 | 2122 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_LINE) && $object->element !== 'invoice_supplier') |
| 2022 | 2123 | { |
@@ -2034,8 +2135,7 @@ discard block |
||
| 2034 | 2135 | |
| 2035 | 2136 | } |
| 2036 | 2137 | return 0; |
| 2037 | - } |
|
| 2038 | - else if (in_array('invoicecard',$contexts) || in_array('invoicesuppliercard',$contexts) || in_array('propalcard',$contexts) || in_array('supplier_proposalcard',$contexts) || in_array('ordercard',$contexts) || in_array('ordersuppliercard',$contexts) || in_array('invoicereccard',$contexts)) |
|
| 2138 | + } else if (in_array('invoicecard',$contexts) || in_array('invoicesuppliercard',$contexts) || in_array('propalcard',$contexts) || in_array('supplier_proposalcard',$contexts) || in_array('ordercard',$contexts) || in_array('ordersuppliercard',$contexts) || in_array('invoicereccard',$contexts)) |
|
| 2039 | 2139 | { |
| 2040 | 2140 | |
| 2041 | 2141 | |
@@ -2063,22 +2163,44 @@ discard block |
||
| 2063 | 2163 | <?php |
| 2064 | 2164 | } |
| 2065 | 2165 | |
| 2066 | - if(empty($line->description)) $line->description = $line->desc; |
|
| 2166 | + if(empty($line->description)) { |
|
| 2167 | + $line->description = $line->desc; |
|
| 2168 | + } |
|
| 2067 | 2169 | |
| 2068 | 2170 | $colspan = 5; |
| 2069 | - if($object->element == 'facturerec' ) $colspan = 3; |
|
| 2070 | - if($object->element == 'order_supplier') (float) DOL_VERSION < 7.0 ? $colspan = 3 : $colspan = 6; |
|
| 2071 | - if($object->element == 'invoice_supplier') (float) DOL_VERSION < 7.0 ? $colspan = 4: $colspan = 7; |
|
| 2072 | - if($object->element == 'supplier_proposal') (float) DOL_VERSION < 6.0 ? $colspan = 4 : $colspan = 3; |
|
| 2171 | + if($object->element == 'facturerec' ) { |
|
| 2172 | + $colspan = 3; |
|
| 2173 | + } |
|
| 2174 | + if($object->element == 'order_supplier') { |
|
| 2175 | + (float) DOL_VERSION < 7.0 ? $colspan = 3 : $colspan = 6; |
|
| 2176 | + } |
|
| 2177 | + if($object->element == 'invoice_supplier') { |
|
| 2178 | + (float) DOL_VERSION < 7.0 ? $colspan = 4: $colspan = 7; |
|
| 2179 | + } |
|
| 2180 | + if($object->element == 'supplier_proposal') { |
|
| 2181 | + (float) DOL_VERSION < 6.0 ? $colspan = 4 : $colspan = 3; |
|
| 2182 | + } |
|
| 2073 | 2183 | if(!empty($conf->multicurrency->enabled) && ((float) DOL_VERSION < 8.0 || $object->multicurrency_code != $conf->currency)) { |
| 2074 | 2184 | $colspan++; // Colonne PU Devise |
| 2075 | 2185 | } |
| 2076 | - if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
| 2077 | - if(!empty($conf->margin->enabled)) $colspan++; |
|
| 2078 | - if(!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
| 2079 | - if(!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
| 2080 | - if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
| 2081 | - if(!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
| 2186 | + if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) { |
|
| 2187 | + $colspan++; |
|
| 2188 | + } |
|
| 2189 | + if(!empty($conf->margin->enabled)) { |
|
| 2190 | + $colspan++; |
|
| 2191 | + } |
|
| 2192 | + if(!empty($conf->global->DISPLAY_MARGIN_RATES)) { |
|
| 2193 | + $colspan++; |
|
| 2194 | + } |
|
| 2195 | + if(!empty($conf->global->DISPLAY_MARK_RATES)) { |
|
| 2196 | + $colspan++; |
|
| 2197 | + } |
|
| 2198 | + if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) { |
|
| 2199 | + $colspan++; |
|
| 2200 | + } |
|
| 2201 | + if(!empty($conf->global->PRODUCT_USE_UNITS)) { |
|
| 2202 | + $colspan++; |
|
| 2203 | + } |
|
| 2082 | 2204 | |
| 2083 | 2205 | /* Titre */ |
| 2084 | 2206 | //var_dump($line); |
@@ -2091,23 +2213,36 @@ discard block |
||
| 2091 | 2213 | <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
| 2092 | 2214 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
| 2093 | 2215 | { |
| 2094 | - if($line->qty==99) print 'background:#adadcf'; |
|
| 2095 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 2096 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
| 2097 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
| 2098 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
| 2099 | - else if($line->qty==50) print ''; |
|
| 2100 | - else print 'background:#eeeeff;'; |
|
| 2216 | + if($line->qty==99) { |
|
| 2217 | + print 'background:#adadcf'; |
|
| 2218 | + } else if($line->qty==98) { |
|
| 2219 | + print 'background:#ddddff;'; |
|
| 2220 | + } else if($line->qty<=97 && $line->qty>=91) { |
|
| 2221 | + print 'background:#eeeeff;'; |
|
| 2222 | + } else if($line->qty==1) { |
|
| 2223 | + print 'background:#adadcf;'; |
|
| 2224 | + } else if($line->qty==2) { |
|
| 2225 | + print 'background:#ddddff;'; |
|
| 2226 | + } else if($line->qty==50) { |
|
| 2227 | + print ''; |
|
| 2228 | + } else { |
|
| 2229 | + print 'background:#eeeeff;'; |
|
| 2230 | + } |
|
| 2101 | 2231 | |
| 2102 | 2232 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
| 2103 | - } |
|
| 2104 | - else |
|
| 2233 | + } else |
|
| 2105 | 2234 | { |
| 2106 | - if($line->qty==99) print 'background:#ddffdd'; |
|
| 2107 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 2108 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
| 2109 | - else if($line->qty==50) print ''; |
|
| 2110 | - else print 'background:#eeffee;' ; |
|
| 2235 | + if($line->qty==99) { |
|
| 2236 | + print 'background:#ddffdd'; |
|
| 2237 | + } else if($line->qty==98) { |
|
| 2238 | + print 'background:#ddddff;'; |
|
| 2239 | + } else if($line->qty==2) { |
|
| 2240 | + print 'background:#eeeeff; '; |
|
| 2241 | + } else if($line->qty==50) { |
|
| 2242 | + print ''; |
|
| 2243 | + } else { |
|
| 2244 | + print 'background:#eeffee;' ; |
|
| 2245 | + } |
|
| 2111 | 2246 | } |
| 2112 | 2247 | |
| 2113 | 2248 | ?>;"> |
@@ -2134,13 +2269,11 @@ discard block |
||
| 2134 | 2269 | $qty_displayed = $line->qty; |
| 2135 | 2270 | print img_picto('', 'subsubtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;color:#0075DE;">'.$qty_displayed.'</span> '; |
| 2136 | 2271 | |
| 2137 | - } |
|
| 2138 | - else if (TSubtotal::isSubtotal($line)) |
|
| 2272 | + } else if (TSubtotal::isSubtotal($line)) |
|
| 2139 | 2273 | { |
| 2140 | 2274 | $qty_displayed = 100 - $line->qty; |
| 2141 | 2275 | print img_picto('', 'subsubtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;color:#0075DE;">'.$qty_displayed.'</span> '; |
| 2142 | - } |
|
| 2143 | - else |
|
| 2276 | + } else |
|
| 2144 | 2277 | { |
| 2145 | 2278 | $isFreeText = true; |
| 2146 | 2279 | } |
@@ -2161,9 +2294,13 @@ discard block |
||
| 2161 | 2294 | } |
| 2162 | 2295 | |
| 2163 | 2296 | $readonlyForSituation = ''; |
| 2164 | - if (!empty($line->fk_prev_id) && $line->fk_prev_id != null) $readonlyForSituation = 'readonly'; |
|
| 2297 | + if (!empty($line->fk_prev_id) && $line->fk_prev_id != null) { |
|
| 2298 | + $readonlyForSituation = 'readonly'; |
|
| 2299 | + } |
|
| 2165 | 2300 | |
| 2166 | - if (!$isFreeText) echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
|
| 2301 | + if (!$isFreeText) { |
|
| 2302 | + echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
|
| 2303 | + } |
|
| 2167 | 2304 | |
| 2168 | 2305 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) ) |
| 2169 | 2306 | { |
@@ -2171,8 +2308,12 @@ discard block |
||
| 2171 | 2308 | for ($j=1; $j<10; $j++) |
| 2172 | 2309 | { |
| 2173 | 2310 | if (!empty($readonlyForSituation)) { |
| 2174 | - if ($qty_displayed == $j) $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
| 2175 | - } else $select .= '<option '.($qty_displayed == $j ? 'selected="selected"' : '').' value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
| 2311 | + if ($qty_displayed == $j) { |
|
| 2312 | + $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
| 2313 | + } |
|
| 2314 | + } else { |
|
| 2315 | + $select .= '<option '.($qty_displayed == $j ? 'selected="selected"' : '').' value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
| 2316 | + } |
|
| 2176 | 2317 | } |
| 2177 | 2318 | $select .= '</select> '; |
| 2178 | 2319 | |
@@ -2192,7 +2333,9 @@ discard block |
||
| 2192 | 2333 | echo '<div>'; |
| 2193 | 2334 | echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>'; |
| 2194 | 2335 | echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>'; |
| 2195 | - if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
| 2336 | + if (empty($readonlyForSituation)) { |
|
| 2337 | + echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
| 2338 | + } |
|
| 2196 | 2339 | echo '</select>'; |
| 2197 | 2340 | echo '</div>'; |
| 2198 | 2341 | |
@@ -2211,8 +2354,9 @@ discard block |
||
| 2211 | 2354 | echo '<input style="vertical-align:sub;" type="checkbox" name="line-showReduc" id="subtotal-showReduc" value="1" '.(($line->array_options['options_show_reduc'] > 0) ? 'checked="checked"' : '') .' /> '; |
| 2212 | 2355 | echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>'; |
| 2213 | 2356 | echo '</div>'; |
| 2357 | + } else if ($isFreeText) { |
|
| 2358 | + echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
| 2214 | 2359 | } |
| 2215 | - else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
| 2216 | 2360 | echo '</div>'; |
| 2217 | 2361 | |
| 2218 | 2362 | if($line->qty<10) { |
@@ -2232,8 +2376,7 @@ discard block |
||
| 2232 | 2376 | $doleditor->Create(); |
| 2233 | 2377 | } |
| 2234 | 2378 | |
| 2235 | - } |
|
| 2236 | - else { |
|
| 2379 | + } else { |
|
| 2237 | 2380 | |
| 2238 | 2381 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) |
| 2239 | 2382 | { |
@@ -2241,14 +2384,19 @@ discard block |
||
| 2241 | 2384 | { |
| 2242 | 2385 | echo str_repeat(' ', $line->qty-1); |
| 2243 | 2386 | |
| 2244 | - if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
| 2245 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
| 2387 | + if (TSubtotal::isTitle($line)) { |
|
| 2388 | + print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
| 2389 | + } else { |
|
| 2390 | + print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
| 2391 | + } |
|
| 2246 | 2392 | } |
| 2247 | - } |
|
| 2248 | - else |
|
| 2393 | + } else |
|
| 2249 | 2394 | { |
| 2250 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
| 2251 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2395 | + if($line->qty<=1) { |
|
| 2396 | + print img_picto('', 'subtotal@subtotal'); |
|
| 2397 | + } else if($line->qty==2) { |
|
| 2398 | + print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2399 | + } |
|
| 2252 | 2400 | } |
| 2253 | 2401 | |
| 2254 | 2402 | |
@@ -2258,21 +2406,26 @@ discard block |
||
| 2258 | 2406 | $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
| 2259 | 2407 | |
| 2260 | 2408 | if (empty($line->label)) { |
| 2261 | - if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
|
| 2262 | - else print $line->description; |
|
| 2263 | - } |
|
| 2264 | - else { |
|
| 2409 | + if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) { |
|
| 2410 | + print $line->description.' '.$this->getTitle($object, $line); |
|
| 2411 | + } else { |
|
| 2412 | + print $line->description; |
|
| 2413 | + } |
|
| 2414 | + } else { |
|
| 2265 | 2415 | |
| 2266 | 2416 | if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
| 2267 | 2417 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
| 2268 | - } |
|
| 2269 | - else{ |
|
| 2418 | + } else{ |
|
| 2270 | 2419 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
| 2271 | 2420 | } |
| 2272 | 2421 | |
| 2273 | 2422 | } |
| 2274 | - if($line->qty>90) print ' : '; |
|
| 2275 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2423 | + if($line->qty>90) { |
|
| 2424 | + print ' : '; |
|
| 2425 | + } |
|
| 2426 | + if($line->info_bits > 0) { |
|
| 2427 | + echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2428 | + } |
|
| 2276 | 2429 | |
| 2277 | 2430 | |
| 2278 | 2431 | |
@@ -2315,11 +2468,12 @@ discard block |
||
| 2315 | 2468 | </script> |
| 2316 | 2469 | <?php |
| 2317 | 2470 | |
| 2318 | - } |
|
| 2319 | - else{ |
|
| 2471 | + } else{ |
|
| 2320 | 2472 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
| 2321 | 2473 | { |
| 2322 | - if(TSubtotal::isTitle($line) && ( $line->fk_prev_id === null )) echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
| 2474 | + if(TSubtotal::isTitle($line) && ( $line->fk_prev_id === null )) { |
|
| 2475 | + echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
| 2476 | + } |
|
| 2323 | 2477 | } |
| 2324 | 2478 | |
| 2325 | 2479 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
@@ -2409,7 +2563,9 @@ discard block |
||
| 2409 | 2563 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
| 2410 | 2564 | |
| 2411 | 2565 | $colspan+=3; $mode = 'view'; |
| 2412 | - if($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
| 2566 | + if($action === 'editline' && $line->rowid == GETPOST('lineid')) { |
|
| 2567 | + $mode = 'edit'; |
|
| 2568 | + } |
|
| 2413 | 2569 | |
| 2414 | 2570 | $ex_element = $line->element; |
| 2415 | 2571 | $line->element = 'tr_extrafield_title '.$line->element; // Pour pouvoir manipuler ces tr |
@@ -2468,8 +2624,7 @@ discard block |
||
| 2468 | 2624 | |
| 2469 | 2625 | return 1; |
| 2470 | 2626 | |
| 2471 | - } |
|
| 2472 | - elseif(($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) || (in_array('expeditioncard', $contexts) && $action == 'create')) |
|
| 2627 | + } elseif(($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) || (in_array('expeditioncard', $contexts) && $action == 'create')) |
|
| 2473 | 2628 | { |
| 2474 | 2629 | $colspan = 4; |
| 2475 | 2630 | |
@@ -2479,23 +2634,36 @@ discard block |
||
| 2479 | 2634 | <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
| 2480 | 2635 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
| 2481 | 2636 | { |
| 2482 | - if($line->qty==99) print 'background:#adadcf'; |
|
| 2483 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 2484 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
| 2485 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
| 2486 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
| 2487 | - else if($line->qty==50) print ''; |
|
| 2488 | - else print 'background:#eeeeff;'; |
|
| 2637 | + if($line->qty==99) { |
|
| 2638 | + print 'background:#adadcf'; |
|
| 2639 | + } else if($line->qty==98) { |
|
| 2640 | + print 'background:#ddddff;'; |
|
| 2641 | + } else if($line->qty<=97 && $line->qty>=91) { |
|
| 2642 | + print 'background:#eeeeff;'; |
|
| 2643 | + } else if($line->qty==1) { |
|
| 2644 | + print 'background:#adadcf;'; |
|
| 2645 | + } else if($line->qty==2) { |
|
| 2646 | + print 'background:#ddddff;'; |
|
| 2647 | + } else if($line->qty==50) { |
|
| 2648 | + print ''; |
|
| 2649 | + } else { |
|
| 2650 | + print 'background:#eeeeff;'; |
|
| 2651 | + } |
|
| 2489 | 2652 | |
| 2490 | 2653 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
| 2491 | - } |
|
| 2492 | - else |
|
| 2654 | + } else |
|
| 2493 | 2655 | { |
| 2494 | - if($line->qty==99) print 'background:#ddffdd'; |
|
| 2495 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 2496 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
| 2497 | - else if($line->qty==50) print ''; |
|
| 2498 | - else print 'background:#eeffee;' ; |
|
| 2656 | + if($line->qty==99) { |
|
| 2657 | + print 'background:#ddffdd'; |
|
| 2658 | + } else if($line->qty==98) { |
|
| 2659 | + print 'background:#ddddff;'; |
|
| 2660 | + } else if($line->qty==2) { |
|
| 2661 | + print 'background:#eeeeff; '; |
|
| 2662 | + } else if($line->qty==50) { |
|
| 2663 | + print ''; |
|
| 2664 | + } else { |
|
| 2665 | + print 'background:#eeffee;' ; |
|
| 2666 | + } |
|
| 2499 | 2667 | } |
| 2500 | 2668 | |
| 2501 | 2669 | ?>;"> |
@@ -2509,14 +2677,19 @@ discard block |
||
| 2509 | 2677 | { |
| 2510 | 2678 | echo str_repeat(' ', $line->qty-1); |
| 2511 | 2679 | |
| 2512 | - if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
| 2513 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
| 2680 | + if (TSubtotal::isTitle($line)) { |
|
| 2681 | + print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
| 2682 | + } else { |
|
| 2683 | + print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
| 2684 | + } |
|
| 2514 | 2685 | } |
| 2515 | - } |
|
| 2516 | - else |
|
| 2686 | + } else |
|
| 2517 | 2687 | { |
| 2518 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
| 2519 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2688 | + if($line->qty<=1) { |
|
| 2689 | + print img_picto('', 'subtotal@subtotal'); |
|
| 2690 | + } else if($line->qty==2) { |
|
| 2691 | + print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2692 | + } |
|
| 2520 | 2693 | } |
| 2521 | 2694 | |
| 2522 | 2695 | |
@@ -2526,21 +2699,24 @@ discard block |
||
| 2526 | 2699 | $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
| 2527 | 2700 | |
| 2528 | 2701 | if (empty($line->label)) { |
| 2529 | - if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
|
| 2530 | - else print $line->description; |
|
| 2531 | - } |
|
| 2532 | - else { |
|
| 2702 | + if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) { |
|
| 2703 | + print $line->description.' '.$this->getTitle($object, $line); |
|
| 2704 | + } else { |
|
| 2705 | + print $line->description; |
|
| 2706 | + } |
|
| 2707 | + } else { |
|
| 2533 | 2708 | |
| 2534 | 2709 | if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
| 2535 | 2710 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
| 2536 | - } |
|
| 2537 | - else{ |
|
| 2711 | + } else{ |
|
| 2538 | 2712 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
| 2539 | 2713 | } |
| 2540 | 2714 | |
| 2541 | 2715 | } |
| 2542 | 2716 | //if($line->qty>90) print ' : '; |
| 2543 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2717 | + if($line->info_bits > 0) { |
|
| 2718 | + echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2719 | + } |
|
| 2544 | 2720 | |
| 2545 | 2721 | ?> |
| 2546 | 2722 | </td> |
@@ -2563,8 +2739,7 @@ discard block |
||
| 2563 | 2739 | </tr> |
| 2564 | 2740 | <?php |
| 2565 | 2741 | return 1; |
| 2566 | - } |
|
| 2567 | - elseif ($object->element == 'shipping' || $object->element == 'delivery') |
|
| 2742 | + } elseif ($object->element == 'shipping' || $object->element == 'delivery') |
|
| 2568 | 2743 | { |
| 2569 | 2744 | global $form; |
| 2570 | 2745 | |
@@ -2576,13 +2751,25 @@ discard block |
||
| 2576 | 2751 | $extralabelslines=$extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
| 2577 | 2752 | |
| 2578 | 2753 | $colspan = 4; |
| 2579 | - if($object->origin && $object->origin_id > 0) $colspan++; |
|
| 2580 | - if(! empty($conf->stock->enabled)) $colspan++; |
|
| 2581 | - if(! empty($conf->productbatch->enabled)) $colspan++; |
|
| 2582 | - if($object->statut == 0) $colspan++; |
|
| 2583 | - if($object->statut == 0 && empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) $colspan++; |
|
| 2754 | + if($object->origin && $object->origin_id > 0) { |
|
| 2755 | + $colspan++; |
|
| 2756 | + } |
|
| 2757 | + if(! empty($conf->stock->enabled)) { |
|
| 2758 | + $colspan++; |
|
| 2759 | + } |
|
| 2760 | + if(! empty($conf->productbatch->enabled)) { |
|
| 2761 | + $colspan++; |
|
| 2762 | + } |
|
| 2763 | + if($object->statut == 0) { |
|
| 2764 | + $colspan++; |
|
| 2765 | + } |
|
| 2766 | + if($object->statut == 0 && empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) { |
|
| 2767 | + $colspan++; |
|
| 2768 | + } |
|
| 2584 | 2769 | |
| 2585 | - if($object->element == 'delivery') $colspan = 2; |
|
| 2770 | + if($object->element == 'delivery') { |
|
| 2771 | + $colspan = 2; |
|
| 2772 | + } |
|
| 2586 | 2773 | |
| 2587 | 2774 | print '<!-- origin line id = '.$line->origin_line_id.' -->'; // id of order line |
| 2588 | 2775 | |
@@ -2592,23 +2779,36 @@ discard block |
||
| 2592 | 2779 | <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
| 2593 | 2780 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
| 2594 | 2781 | { |
| 2595 | - if($line->qty==99) print 'background:#adadcf'; |
|
| 2596 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 2597 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
| 2598 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
| 2599 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
| 2600 | - else if($line->qty==50) print ''; |
|
| 2601 | - else print 'background:#eeeeff;'; |
|
| 2782 | + if($line->qty==99) { |
|
| 2783 | + print 'background:#adadcf'; |
|
| 2784 | + } else if($line->qty==98) { |
|
| 2785 | + print 'background:#ddddff;'; |
|
| 2786 | + } else if($line->qty<=97 && $line->qty>=91) { |
|
| 2787 | + print 'background:#eeeeff;'; |
|
| 2788 | + } else if($line->qty==1) { |
|
| 2789 | + print 'background:#adadcf;'; |
|
| 2790 | + } else if($line->qty==2) { |
|
| 2791 | + print 'background:#ddddff;'; |
|
| 2792 | + } else if($line->qty==50) { |
|
| 2793 | + print ''; |
|
| 2794 | + } else { |
|
| 2795 | + print 'background:#eeeeff;'; |
|
| 2796 | + } |
|
| 2602 | 2797 | |
| 2603 | 2798 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
| 2604 | - } |
|
| 2605 | - else |
|
| 2799 | + } else |
|
| 2606 | 2800 | { |
| 2607 | - if($line->qty==99) print 'background:#ddffdd'; |
|
| 2608 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 2609 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
| 2610 | - else if($line->qty==50) print ''; |
|
| 2611 | - else print 'background:#eeffee;' ; |
|
| 2801 | + if($line->qty==99) { |
|
| 2802 | + print 'background:#ddffdd'; |
|
| 2803 | + } else if($line->qty==98) { |
|
| 2804 | + print 'background:#ddddff;'; |
|
| 2805 | + } else if($line->qty==2) { |
|
| 2806 | + print 'background:#eeeeff; '; |
|
| 2807 | + } else if($line->qty==50) { |
|
| 2808 | + print ''; |
|
| 2809 | + } else { |
|
| 2810 | + print 'background:#eeffee;' ; |
|
| 2811 | + } |
|
| 2612 | 2812 | } |
| 2613 | 2813 | |
| 2614 | 2814 | ?>;"> |
@@ -2630,14 +2830,19 @@ discard block |
||
| 2630 | 2830 | { |
| 2631 | 2831 | echo str_repeat(' ', $line->qty-1); |
| 2632 | 2832 | |
| 2633 | - if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
| 2634 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
| 2833 | + if (TSubtotal::isTitle($line)) { |
|
| 2834 | + print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
| 2835 | + } else { |
|
| 2836 | + print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
| 2837 | + } |
|
| 2635 | 2838 | } |
| 2636 | - } |
|
| 2637 | - else |
|
| 2839 | + } else |
|
| 2638 | 2840 | { |
| 2639 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
| 2640 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2841 | + if($line->qty<=1) { |
|
| 2842 | + print img_picto('', 'subtotal@subtotal'); |
|
| 2843 | + } else if($line->qty==2) { |
|
| 2844 | + print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2845 | + } |
|
| 2641 | 2846 | } |
| 2642 | 2847 | |
| 2643 | 2848 | |
@@ -2647,19 +2852,22 @@ discard block |
||
| 2647 | 2852 | $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
| 2648 | 2853 | |
| 2649 | 2854 | if (empty($line->label)) { |
| 2650 | - if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
|
| 2651 | - else print $line->description; |
|
| 2652 | - } |
|
| 2653 | - else { |
|
| 2855 | + if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) { |
|
| 2856 | + print $line->description.' '.$this->getTitle($object, $line); |
|
| 2857 | + } else { |
|
| 2858 | + print $line->description; |
|
| 2859 | + } |
|
| 2860 | + } else { |
|
| 2654 | 2861 | if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
| 2655 | 2862 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
| 2656 | - } |
|
| 2657 | - else{ |
|
| 2863 | + } else{ |
|
| 2658 | 2864 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
| 2659 | 2865 | } |
| 2660 | 2866 | } |
| 2661 | 2867 | //if($line->qty>90) print ' : '; |
| 2662 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2868 | + if($line->info_bits > 0) { |
|
| 2869 | + echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2870 | + } |
|
| 2663 | 2871 | |
| 2664 | 2872 | ?> |
| 2665 | 2873 | </td> |
@@ -2839,10 +3047,9 @@ discard block |
||
| 2839 | 3047 | |
| 2840 | 3048 | if(TSubtotal::isTitle($line)){ |
| 2841 | 3049 | $ThtmlData['data-issubtotal'] = 'title'; |
| 2842 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
| 3050 | + } elseif(TSubtotal::isSubtotal($line)){ |
|
| 2843 | 3051 | $ThtmlData['data-issubtotal'] = 'subtotal'; |
| 2844 | - } |
|
| 2845 | - else{ |
|
| 3052 | + } else{ |
|
| 2846 | 3053 | $ThtmlData['data-issubtotal'] = 'freetext'; |
| 2847 | 3054 | } |
| 2848 | 3055 | |
@@ -2852,7 +3059,9 @@ discard block |
||
| 2852 | 3059 | |
| 2853 | 3060 | // hook |
| 2854 | 3061 | $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
| 2855 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 3062 | + if ($reshook < 0) { |
|
| 3063 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 3064 | + } |
|
| 2856 | 3065 | if ($reshook>0) |
| 2857 | 3066 | { |
| 2858 | 3067 | $ThtmlData = $hookmanager->resArray; |