@@ -23,7 +23,9 @@ discard block |
||
| 23 | 23 | $prop->desc = ''; |
| 24 | 24 | } |
| 25 | 25 | $ret = $prop->update(1); |
| 26 | - if($ret>0) $i++; |
|
| 26 | + if($ret>0) { |
|
| 27 | + $i++; |
|
| 28 | + } |
|
| 27 | 29 | } |
| 28 | 30 | print $i." lignes converties<br>"; |
| 29 | 31 | } |
@@ -45,7 +47,9 @@ discard block |
||
| 45 | 47 | $cdeline->desc = ''; |
| 46 | 48 | } |
| 47 | 49 | $ret = $cdeline->update($user, 1); |
| 48 | - if($ret>0) $i++; |
|
| 50 | + if($ret>0) { |
|
| 51 | + $i++; |
|
| 52 | + } |
|
| 49 | 53 | } |
| 50 | 54 | |
| 51 | 55 | print $i." lignes converties<br>"; |
@@ -69,7 +73,9 @@ discard block |
||
| 69 | 73 | $facline->desc = ''; |
| 70 | 74 | } |
| 71 | 75 | $ret = $facline->update($user, 1); |
| 72 | - if($ret>0) $i++; |
|
| 76 | + if($ret>0) { |
|
| 77 | + $i++; |
|
| 78 | + } |
|
| 73 | 79 | } |
| 74 | 80 | |
| 75 | 81 | print $i." lignes converties<br>"; |
@@ -13,18 +13,23 @@ discard block |
||
| 13 | 13 | /** |
| 14 | 14 | * @var $object Facture |
| 15 | 15 | */ |
| 16 | - if($object->element=='facture') $res = $object->addline($object->id, $label, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,-1, TSubtotal::$module_number); |
|
| 16 | + if($object->element=='facture') { |
|
| 17 | + $res = $object->addline($object->id, $label, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,-1, TSubtotal::$module_number); |
|
| 18 | + } |
|
| 17 | 19 | /** |
| 18 | 20 | * @var $object Propal |
| 19 | 21 | */ |
| 20 | - else if($object->element=='propal') $res = $object->addline($object->id,$label, 0,$qty,0,0,0,0,0,'HT',0,0,9,-1, TSubtotal::$module_number); |
|
| 22 | + else if($object->element=='propal') { |
|
| 23 | + $res = $object->addline($object->id,$label, 0,$qty,0,0,0,0,0,'HT',0,0,9,-1, TSubtotal::$module_number); |
|
| 24 | + } |
|
| 21 | 25 | /** |
| 22 | 26 | * @var $object Commande |
| 23 | 27 | */ |
| 24 | - else if($object->element=='commande') $res = $object->addline($object->id,$label, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,-1, TSubtotal::$module_number); |
|
| 28 | + else if($object->element=='commande') { |
|
| 29 | + $res = $object->addline($object->id,$label, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,-1, TSubtotal::$module_number); |
|
| 30 | + } |
|
| 25 | 31 | |
| 26 | - } |
|
| 27 | - else { |
|
| 32 | + } else { |
|
| 28 | 33 | $desc = ''; |
| 29 | 34 | if ((float) DOL_VERSION < 6 || $qty==50) { |
| 30 | 35 | $desc = $label; |
@@ -34,29 +39,40 @@ discard block |
||
| 34 | 39 | /** |
| 35 | 40 | * @var $object Facture |
| 36 | 41 | */ |
| 37 | - if($object->element=='facture') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,$rang, TSubtotal::$module_number, '', 0, 0, null, 0, $label); |
|
| 42 | + if($object->element=='facture') { |
|
| 43 | + $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,$rang, TSubtotal::$module_number, '', 0, 0, null, 0, $label); |
|
| 44 | + } |
|
| 38 | 45 | /** |
| 39 | 46 | * @var $object Facture fournisseur |
| 40 | 47 | */ |
| 41 | 48 | else if($object->element=='invoice_supplier') { |
| 42 | 49 | $object->special_code = TSubtotal::$module_number; |
| 43 | 50 | $rang = $object->line_max() + 1; |
| 44 | - if($qty==50) $res = $object->addline($desc,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); |
|
| 45 | - else $res = $object->addline($label,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); |
|
| 51 | + if($qty==50) { |
|
| 52 | + $res = $object->addline($desc,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); |
|
| 53 | + } else { |
|
| 54 | + $res = $object->addline($label,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); |
|
| 55 | + } |
|
| 46 | 56 | } |
| 47 | 57 | /** |
| 48 | 58 | * @var $object Propal |
| 49 | 59 | */ |
| 50 | - 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); |
|
| 60 | + else if($object->element=='propal') { |
|
| 61 | + $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
| 62 | + } |
|
| 51 | 63 | /** |
| 52 | 64 | * @var $object Propal Fournisseur |
| 53 | 65 | */ |
| 54 | - 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); |
|
| 66 | + else if($object->element=='supplier_proposal') { |
|
| 67 | + $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
| 68 | + } |
|
| 55 | 69 | |
| 56 | 70 | /** |
| 57 | 71 | * @var $object Commande |
| 58 | 72 | */ |
| 59 | - 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); |
|
| 73 | + else if($object->element=='commande') { |
|
| 74 | + $res = $object->addline($desc, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,$rang, TSubtotal::$module_number, 0, null, 0, $label); |
|
| 75 | + } |
|
| 60 | 76 | /** |
| 61 | 77 | * @var $object Commande fournisseur |
| 62 | 78 | */ |
@@ -67,7 +83,9 @@ discard block |
||
| 67 | 83 | /** |
| 68 | 84 | * @var $object Facturerec |
| 69 | 85 | */ |
| 70 | - 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); |
|
| 86 | + else if($object->element=='facturerec') { |
|
| 87 | + $res = $object->addline($desc, 0,$qty, 0, 0, 0, 0, 0, 'HT', 0, '', 0, 9, $rang, TSubtotal::$module_number,$label); |
|
| 88 | + } |
|
| 71 | 89 | |
| 72 | 90 | } |
| 73 | 91 | |
@@ -89,8 +107,9 @@ discard block |
||
| 89 | 107 | // Define output language |
| 90 | 108 | $outputlangs = $langs; |
| 91 | 109 | $newlang = GETPOST('lang_id', 'alpha'); |
| 92 | - if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) |
|
| 93 | - $newlang = !empty($object->client) ? $object->client->default_lang : $object->thirdparty->default_lang; |
|
| 110 | + if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) { |
|
| 111 | + $newlang = !empty($object->client) ? $object->client->default_lang : $object->thirdparty->default_lang; |
|
| 112 | + } |
|
| 94 | 113 | if (! empty($newlang)) { |
| 95 | 114 | $outputlangs = new Translate("", $conf); |
| 96 | 115 | $outputlangs->setDefaultLang($newlang); |
@@ -99,13 +118,18 @@ discard block |
||
| 99 | 118 | $ret = $object->fetch($object->id); // Reload to get new records |
| 100 | 119 | if ((float) DOL_VERSION <= 3.6) |
| 101 | 120 | { |
| 102 | - if ($object->element == 'propal') propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 103 | - elseif ($object->element == 'commande') commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 104 | - elseif ($object->element == 'facture') facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 105 | - } |
|
| 106 | - else |
|
| 121 | + if ($object->element == 'propal') { |
|
| 122 | + propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 123 | + } elseif ($object->element == 'commande') { |
|
| 124 | + commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 125 | + } elseif ($object->element == 'facture') { |
|
| 126 | + facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 127 | + } |
|
| 128 | + } else |
|
| 107 | 129 | { |
| 108 | - if ($object->element!= 'facturerec') $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 130 | + if ($object->element!= 'facturerec') { |
|
| 131 | + $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 132 | + } |
|
| 109 | 133 | } |
| 110 | 134 | } |
| 111 | 135 | } |
@@ -119,7 +143,9 @@ discard block |
||
| 119 | 143 | */ |
| 120 | 144 | public static function updateRang(&$object, $rang_start, $move_to=1) |
| 121 | 145 | { |
| 122 | - if (!class_exists('GenericObject')) require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php'; |
|
| 146 | + if (!class_exists('GenericObject')) { |
|
| 147 | + require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php'; |
|
| 148 | + } |
|
| 123 | 149 | |
| 124 | 150 | $row=new GenericObject($object->db); |
| 125 | 151 | $row->table_element_line = $object->table_element_line; |
@@ -128,7 +154,9 @@ discard block |
||
| 128 | 154 | |
| 129 | 155 | foreach ($object->lines as &$line) |
| 130 | 156 | { |
| 131 | - if ($line->rang < $rang_start) continue; |
|
| 157 | + if ($line->rang < $rang_start) { |
|
| 158 | + continue; |
|
| 159 | + } |
|
| 132 | 160 | |
| 133 | 161 | $row->updateRangOfLine($line->id, $line->rang+$move_to); |
| 134 | 162 | } |
@@ -151,21 +179,28 @@ discard block |
||
| 151 | 179 | foreach ($TTitle_reverse as $k => $title_line) |
| 152 | 180 | { |
| 153 | 181 | $title_niveau = self::getNiveau($title_line); |
| 154 | - if ($title_niveau < $level_new_title) break; |
|
| 182 | + if ($title_niveau < $level_new_title) { |
|
| 183 | + break; |
|
| 184 | + } |
|
| 155 | 185 | |
| 156 | 186 | $rang_to_add = self::titleHasTotalLine($object, $title_line, true, true); |
| 157 | 187 | |
| 158 | 188 | if (is_numeric($rang_to_add)) |
| 159 | 189 | { |
| 160 | - if ($rang_to_add != -1) self::updateRang($object, $rang_to_add); |
|
| 190 | + if ($rang_to_add != -1) { |
|
| 191 | + self::updateRang($object, $rang_to_add); |
|
| 192 | + } |
|
| 161 | 193 | |
| 162 | 194 | self::addSubTotalLine($object, $langs->trans('SubTotal'), 100-$title_niveau, $rang_to_add); |
| 163 | 195 | |
| 164 | 196 | $object->lines[] = $object->line; // ajout de la ligne dans le tableau de ligne (Dolibarr ne le fait pas) |
| 165 | 197 | if ($rang_to_add != -1) |
| 166 | 198 | { |
| 167 | - if (method_exists($object, 'fetch_lines')) $object->fetch_lines(); |
|
| 168 | - else $object->fetch($object->id); |
|
| 199 | + if (method_exists($object, 'fetch_lines')) { |
|
| 200 | + $object->fetch_lines(); |
|
| 201 | + } else { |
|
| 202 | + $object->fetch($object->id); |
|
| 203 | + } |
|
| 169 | 204 | } |
| 170 | 205 | } |
| 171 | 206 | } |
@@ -195,7 +230,9 @@ discard block |
||
| 195 | 230 | |
| 196 | 231 | foreach ($TTitle as $k => $title_line) |
| 197 | 232 | { |
| 198 | - if (self::titleHasTotalLine($object, $title_line)) unset($TTitle[$k]); |
|
| 233 | + if (self::titleHasTotalLine($object, $title_line)) { |
|
| 234 | + unset($TTitle[$k]); |
|
| 235 | + } |
|
| 199 | 236 | } |
| 200 | 237 | |
| 201 | 238 | return $TTitle; |
@@ -212,23 +249,41 @@ discard block |
||
| 212 | 249 | */ |
| 213 | 250 | public static function titleHasTotalLine(&$object, &$title_line, $strict_mode=false, $return_rang_on_false=false) |
| 214 | 251 | { |
| 215 | - if (empty($object->lines) || !is_array($object->lines)) return false; |
|
| 252 | + if (empty($object->lines) || !is_array($object->lines)) { |
|
| 253 | + return false; |
|
| 254 | + } |
|
| 216 | 255 | |
| 217 | 256 | $title_niveau = self::getNiveau($title_line); |
| 218 | 257 | foreach ($object->lines as &$line) |
| 219 | 258 | { |
| 220 | - if ($line->rang <= $title_line->rang) continue; |
|
| 221 | - 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 |
|
| 222 | - if (!self::isSubtotal($line)) continue; |
|
| 259 | + if ($line->rang <= $title_line->rang) { |
|
| 260 | + continue; |
|
| 261 | + } |
|
| 262 | + if (self::isTitle($line) && self::getNiveau($line) <= $title_niveau) { |
|
| 263 | + return false; |
|
| 264 | + } |
|
| 265 | + // 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 |
|
| 266 | + if (!self::isSubtotal($line)) { |
|
| 267 | + continue; |
|
| 268 | + } |
|
| 223 | 269 | |
| 224 | 270 | $subtotal_niveau = self::getNiveau($line); |
| 225 | 271 | |
| 226 | 272 | // Comparaison du niveau de la ligne de sous-total avec celui du titre |
| 227 | - if ($subtotal_niveau == $title_niveau) return true; // niveau égale => Ok mon titre a un sous-total |
|
| 228 | - elseif ($subtotal_niveau < $title_niveau) // niveau inférieur trouvé (exemple : sous-total de niveau 1 contre mon titre de niveau 3) |
|
| 273 | + if ($subtotal_niveau == $title_niveau) { |
|
| 274 | + return true; |
|
| 275 | + } |
|
| 276 | + // niveau égale => Ok mon titre a un sous-total |
|
| 277 | + elseif ($subtotal_niveau < $title_niveau) { |
|
| 278 | + // niveau inférieur trouvé (exemple : sous-total de niveau 1 contre mon titre de niveau 3) |
|
| 229 | 279 | { |
| 230 | - if ($strict_mode) return ($return_rang_on_false) ? $line->rang : false; // mode strict niveau pas égale donc faux |
|
| 231 | - else return true; // mode libre => OK je considère que mon titre à un sous-total |
|
| 280 | + if ($strict_mode) return ($return_rang_on_false) ? $line->rang : false; |
|
| 281 | + } |
|
| 282 | + // mode strict niveau pas égale donc faux |
|
| 283 | + else { |
|
| 284 | + return true; |
|
| 285 | + } |
|
| 286 | + // mode libre => OK je considère que mon titre à un sous-total |
|
| 232 | 287 | } |
| 233 | 288 | } |
| 234 | 289 | |
@@ -276,16 +331,19 @@ discard block |
||
| 276 | 331 | |
| 277 | 332 | foreach ($object->lines as &$l) |
| 278 | 333 | { |
| 279 | - if ($l->rang <= $line->rang) continue; |
|
| 280 | - elseif (self::isSubtotal($l) && self::getNiveau($l) == $line->qty) break; |
|
| 281 | - elseif (self::isModSubtotalLine($l)) continue; |
|
| 334 | + if ($l->rang <= $line->rang) { |
|
| 335 | + continue; |
|
| 336 | + } elseif (self::isSubtotal($l) && self::getNiveau($l) == $line->qty) { |
|
| 337 | + break; |
|
| 338 | + } elseif (self::isModSubtotalLine($l)) { |
|
| 339 | + continue; |
|
| 340 | + } |
|
| 282 | 341 | |
| 283 | 342 | if (!empty($l->array_options['options_subtotal_nc'])) |
| 284 | 343 | { |
| 285 | 344 | $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); |
| 286 | 345 | $TTot['total_options'] += $tabprice[0]; // total ht |
| 287 | - } |
|
| 288 | - else |
|
| 346 | + } else |
|
| 289 | 347 | { |
| 290 | 348 | $TTot['total_pa_ht'] += $l->pa_ht * $l->qty; |
| 291 | 349 | $TTot['total_ht'] += $l->total_ht; |
@@ -304,29 +362,41 @@ discard block |
||
| 304 | 362 | |
| 305 | 363 | public static function getOrderIdFromLineId(&$db, $fk_commandedet) |
| 306 | 364 | { |
| 307 | - if (empty($fk_commandedet)) return false; |
|
| 365 | + if (empty($fk_commandedet)) { |
|
| 366 | + return false; |
|
| 367 | + } |
|
| 308 | 368 | |
| 309 | 369 | $sql = 'SELECT fk_commande FROM '.MAIN_DB_PREFIX.'commandedet WHERE rowid = '.$fk_commandedet; |
| 310 | 370 | $resql = $db->query($sql); |
| 311 | 371 | |
| 312 | - if ($resql && ($row = $db->fetch_object($resql))) return $row->fk_commande; |
|
| 313 | - else return false; |
|
| 372 | + if ($resql && ($row = $db->fetch_object($resql))) { |
|
| 373 | + return $row->fk_commande; |
|
| 374 | + } else { |
|
| 375 | + return false; |
|
| 376 | + } |
|
| 314 | 377 | } |
| 315 | 378 | |
| 316 | 379 | public static function getLastLineOrderId(&$db, $fk_commande) |
| 317 | 380 | { |
| 318 | - if (empty($fk_commande)) return false; |
|
| 381 | + if (empty($fk_commande)) { |
|
| 382 | + return false; |
|
| 383 | + } |
|
| 319 | 384 | |
| 320 | 385 | $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'commandedet WHERE fk_commande = '.$fk_commande.' ORDER BY rang DESC LIMIT 1'; |
| 321 | 386 | $resql = $db->query($sql); |
| 322 | 387 | |
| 323 | - if ($resql && ($row = $db->fetch_object($resql))) return $row->rowid; |
|
| 324 | - else return false; |
|
| 388 | + if ($resql && ($row = $db->fetch_object($resql))) { |
|
| 389 | + return $row->rowid; |
|
| 390 | + } else { |
|
| 391 | + return false; |
|
| 392 | + } |
|
| 325 | 393 | } |
| 326 | 394 | |
| 327 | 395 | public static function getParentTitleOfLine(&$object, $i) |
| 328 | 396 | { |
| 329 | - if ($i <= 0) return false; |
|
| 397 | + if ($i <= 0) { |
|
| 398 | + return false; |
|
| 399 | + } |
|
| 330 | 400 | |
| 331 | 401 | $skip_title = 0; |
| 332 | 402 | // Je parcours les lignes précédentes |
@@ -345,8 +415,7 @@ discard block |
||
| 345 | 415 | //@INFO J'ai ma ligne titre qui contient ma ligne, par contre je check pas s'il y a un sous-total |
| 346 | 416 | return $line; |
| 347 | 417 | break; |
| 348 | - } |
|
| 349 | - elseif ($line->product_type == 9 && $line->qty >= 90 && $line->qty <= 99) |
|
| 418 | + } elseif ($line->product_type == 9 && $line->qty >= 90 && $line->qty <= 99) |
|
| 350 | 419 | { |
| 351 | 420 | // 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) |
| 352 | 421 | $skip_title++; |
@@ -361,7 +430,9 @@ discard block |
||
| 361 | 430 | $res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty <= 9; |
| 362 | 431 | if($res && $level > -1) { |
| 363 | 432 | return $line->qty == $level; |
| 364 | - } else return $res; |
|
| 433 | + } else { |
|
| 434 | + return $res; |
|
| 435 | + } |
|
| 365 | 436 | |
| 366 | 437 | } |
| 367 | 438 | |
@@ -388,10 +459,14 @@ discard block |
||
| 388 | 459 | // editeur wysiwyg |
| 389 | 460 | require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
| 390 | 461 | $nbrows=ROWS_2; |
| 391 | - if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
| 462 | + if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { |
|
| 463 | + $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
| 464 | + } |
|
| 392 | 465 | $enable=(isset($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0); |
| 393 | 466 | $toolbarname='dolibarr_details'; |
| 394 | - if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes'; |
|
| 467 | + if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) { |
|
| 468 | + $toolbarname='dolibarr_notes'; |
|
| 469 | + } |
|
| 395 | 470 | $text = !empty($line->description)?$line->description:$line->label; |
| 396 | 471 | $doleditor=new DolEditor('line-description',$text,'',164,$toolbarname,'',false,true,$enable,$nbrows,'98%', $readonly); |
| 397 | 472 | return $doleditor->Create(1); |
@@ -406,12 +481,10 @@ discard block |
||
| 406 | 481 | { |
| 407 | 482 | $object->statut = 0; // hack for facture rec |
| 408 | 483 | $createRight = $user->rights->facture->creer; |
| 409 | - } |
|
| 410 | - elseif($object->element == 'order_supplier' ) |
|
| 484 | + } elseif($object->element == 'order_supplier' ) |
|
| 411 | 485 | { |
| 412 | 486 | $createRight = $user->rights->fournisseur->commande->creer; |
| 413 | - } |
|
| 414 | - elseif($object->element == 'invoice_supplier' ) |
|
| 487 | + } elseif($object->element == 'invoice_supplier' ) |
|
| 415 | 488 | { |
| 416 | 489 | $createRight = $user->rights->fournisseur->facture->creer; |
| 417 | 490 | } |
@@ -484,8 +557,9 @@ discard block |
||
| 484 | 557 | |
| 485 | 558 | $TLineAdded[] = $object->line; |
| 486 | 559 | // Error from addline |
| 487 | - if ($res <= 0) break; |
|
| 488 | - else |
|
| 560 | + if ($res <= 0) { |
|
| 561 | + break; |
|
| 562 | + } else |
|
| 489 | 563 | { |
| 490 | 564 | $object->line_from = $line; |
| 491 | 565 | // Call trigger |
@@ -507,8 +581,7 @@ discard block |
||
| 507 | 581 | _updateLineNC($object->element, $object->id, $line->id, $line->array_options['options_subtotal_nc']); |
| 508 | 582 | } |
| 509 | 583 | return count($TLineAdded); |
| 510 | - } |
|
| 511 | - else |
|
| 584 | + } else |
|
| 512 | 585 | { |
| 513 | 586 | $object->db->rollback(); |
| 514 | 587 | return -1; |
@@ -524,10 +597,14 @@ discard block |
||
| 524 | 597 | global $langs; |
| 525 | 598 | |
| 526 | 599 | // Besoin de comparer sur les 2 formes d'écriture |
| 527 | - if (!$key_is_id) $TTitle_search = array($langs->trans($key_trad), $langs->transnoentitiesnoconv($key_trad)); |
|
| 600 | + if (!$key_is_id) { |
|
| 601 | + $TTitle_search = array($langs->trans($key_trad), $langs->transnoentitiesnoconv($key_trad)); |
|
| 602 | + } |
|
| 528 | 603 | |
| 529 | 604 | $TTitle_under_search = array(); |
| 530 | - if (!empty($under_title)) $TTitle_under_search = array($langs->trans($under_title), $langs->transnoentitiesnoconv($under_title)); |
|
| 605 | + if (!empty($under_title)) { |
|
| 606 | + $TTitle_under_search = array($langs->trans($under_title), $langs->transnoentitiesnoconv($under_title)); |
|
| 607 | + } |
|
| 531 | 608 | |
| 532 | 609 | $TLine = array(); |
| 533 | 610 | $add_line = false; |
@@ -537,28 +614,37 @@ discard block |
||
| 537 | 614 | { |
| 538 | 615 | if (!$under_title_found && !empty($TTitle_under_search)) |
| 539 | 616 | { |
| 540 | - if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search)) ) $under_title_found = true; |
|
| 541 | - } |
|
| 542 | - else |
|
| 617 | + if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search)) ) { |
|
| 618 | + $under_title_found = true; |
|
| 619 | + } |
|
| 620 | + } else |
|
| 543 | 621 | { |
| 544 | 622 | 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) ))) |
| 545 | 623 | { |
| 546 | - if ($key_is_id) $level = $line->qty; |
|
| 624 | + if ($key_is_id) { |
|
| 625 | + $level = $line->qty; |
|
| 626 | + } |
|
| 547 | 627 | |
| 548 | 628 | $add_line = true; |
| 549 | - if ($withBlockLine) $TLine[] = $line; |
|
| 629 | + if ($withBlockLine) { |
|
| 630 | + $TLine[] = $line; |
|
| 631 | + } |
|
| 550 | 632 | continue; |
| 551 | - } |
|
| 552 | - elseif ($add_line && $line->product_type == 9 && (100 - $line->qty == $level) ) // Si on tombe sur un sous-total, il faut que ce soit un du même niveau que le titre |
|
| 633 | + } elseif ($add_line && $line->product_type == 9 && (100 - $line->qty == $level) ) { |
|
| 634 | + // Si on tombe sur un sous-total, il faut que ce soit un du même niveau que le titre |
|
| 553 | 635 | { |
| 554 | 636 | if ($withBlockLine) $TLine[] = $line; |
| 637 | + } |
|
| 555 | 638 | break; |
| 556 | 639 | } |
| 557 | 640 | |
| 558 | 641 | if ($add_line) |
| 559 | 642 | { |
| 560 | - if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line)) ) continue; |
|
| 561 | - else $TLine[] = $line; |
|
| 643 | + if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line)) ) { |
|
| 644 | + continue; |
|
| 645 | + } else { |
|
| 646 | + $TLine[] = $line; |
|
| 647 | + } |
|
| 562 | 648 | } |
| 563 | 649 | } |
| 564 | 650 | } |
@@ -592,7 +678,9 @@ discard block |
||
| 592 | 678 | |
| 593 | 679 | case 'order_supplier': |
| 594 | 680 | $object->special_code = SELF::$module_number; |
| 595 | - if (empty($desc)) $desc = $label; |
|
| 681 | + if (empty($desc)) { |
|
| 682 | + $desc = $label; |
|
| 683 | + } |
|
| 596 | 684 | $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); |
| 597 | 685 | break; |
| 598 | 686 | |
@@ -602,7 +690,9 @@ discard block |
||
| 602 | 690 | |
| 603 | 691 | case 'invoice_supplier': |
| 604 | 692 | $object->special_code = SELF::$module_number; |
| 605 | - if (empty($desc)) $desc = $label; |
|
| 693 | + if (empty($desc)) { |
|
| 694 | + $desc = $label; |
|
| 695 | + } |
|
| 606 | 696 | $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); |
| 607 | 697 | break; |
| 608 | 698 | |
@@ -619,8 +709,11 @@ discard block |
||
| 619 | 709 | break; |
| 620 | 710 | } |
| 621 | 711 | |
| 622 | - if ($res <= 0) $object->db->rollback(); |
|
| 623 | - else $object->db->commit(); |
|
| 712 | + if ($res <= 0) { |
|
| 713 | + $object->db->rollback(); |
|
| 714 | + } else { |
|
| 715 | + $object->db->commit(); |
|
| 716 | + } |
|
| 624 | 717 | |
| 625 | 718 | return $res; |
| 626 | 719 | } |
@@ -630,24 +723,20 @@ discard block |
||
| 630 | 723 | global $db, $object; |
| 631 | 724 | |
| 632 | 725 | $TTitle = array(); |
| 633 | - if(! empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {} |
|
| 634 | - else { |
|
| 726 | + if(! empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {} else { |
|
| 635 | 727 | if ($origin_line->element == 'propaldet') |
| 636 | 728 | { |
| 637 | 729 | $object = new Propal($db); |
| 638 | 730 | $object->fetch($origin_line->fk_propal); |
| 639 | - } |
|
| 640 | - else if ($origin_line->element == 'commandedet') |
|
| 731 | + } else if ($origin_line->element == 'commandedet') |
|
| 641 | 732 | { |
| 642 | 733 | $object = new Commande($db); |
| 643 | 734 | $object->fetch($origin_line->fk_commande); |
| 644 | - } |
|
| 645 | - else if ($origin_line->element == 'facturedet') |
|
| 735 | + } else if ($origin_line->element == 'facturedet') |
|
| 646 | 736 | { |
| 647 | 737 | $object = new Facture($db); |
| 648 | 738 | $object->fetch($origin_line->fk_facture); |
| 649 | - } |
|
| 650 | - else |
|
| 739 | + } else |
|
| 651 | 740 | { |
| 652 | 741 | return $TTitle; |
| 653 | 742 | } |
@@ -657,8 +746,11 @@ discard block |
||
| 657 | 746 | $i = 0; |
| 658 | 747 | foreach ($object->lines as &$line) |
| 659 | 748 | { |
| 660 | - if ($origin_line->id == $line->id) break; |
|
| 661 | - else $i++; |
|
| 749 | + if ($origin_line->id == $line->id) { |
|
| 750 | + break; |
|
| 751 | + } else { |
|
| 752 | + $i++; |
|
| 753 | + } |
|
| 662 | 754 | } |
| 663 | 755 | |
| 664 | 756 | $i--; // Skip la ligne d'origine |
@@ -673,35 +765,43 @@ discard block |
||
| 673 | 765 | if (self::isSubtotal($object->lines[$y])) |
| 674 | 766 | { |
| 675 | 767 | $next_title_lvl_to_skip = self::getNiveau($object->lines[$y]); |
| 676 | - } |
|
| 677 | - elseif (self::isTitle($object->lines[$y])) |
|
| 768 | + } elseif (self::isTitle($object->lines[$y])) |
|
| 678 | 769 | { |
| 679 | 770 | if ($object->lines[$y]->qty == $next_title_lvl_to_skip) |
| 680 | 771 | { |
| 681 | 772 | $next_title_lvl_to_skip = 0; |
| 682 | 773 | continue; |
| 683 | - } |
|
| 684 | - else |
|
| 774 | + } else |
|
| 685 | 775 | { |
| 686 | - if (empty($object->lines[$y]->array_options)) $object->lines[$y]->fetch_optionals(); |
|
| 776 | + if (empty($object->lines[$y]->array_options)) { |
|
| 777 | + $object->lines[$y]->fetch_optionals(); |
|
| 778 | + } |
|
| 687 | 779 | $TTitle[$object->lines[$y]->id] = $object->lines[$y]; |
| 688 | 780 | |
| 689 | - if ($object->lines[$y]->qty == 1) break; |
|
| 781 | + if ($object->lines[$y]->qty == 1) { |
|
| 782 | + break; |
|
| 783 | + } |
|
| 690 | 784 | } |
| 691 | 785 | } |
| 692 | 786 | } |
| 693 | 787 | } |
| 694 | 788 | |
| 695 | - if ($reverse) $TTitle = array_reverse($TTitle, true); |
|
| 789 | + if ($reverse) { |
|
| 790 | + $TTitle = array_reverse($TTitle, true); |
|
| 791 | + } |
|
| 696 | 792 | |
| 697 | 793 | return $TTitle; |
| 698 | 794 | } |
| 699 | 795 | |
| 700 | 796 | public static function getNiveau(&$line) |
| 701 | 797 | { |
| 702 | - if (self::isTitle($line)) return $line->qty; |
|
| 703 | - elseif (self::isSubtotal($line)) return 100 - $line->qty; |
|
| 704 | - else return 0; |
|
| 798 | + if (self::isTitle($line)) { |
|
| 799 | + return $line->qty; |
|
| 800 | + } elseif (self::isSubtotal($line)) { |
|
| 801 | + return 100 - $line->qty; |
|
| 802 | + } else { |
|
| 803 | + return 0; |
|
| 804 | + } |
|
| 705 | 805 | } |
| 706 | 806 | |
| 707 | 807 | /** |
@@ -726,10 +826,16 @@ discard block |
||
| 726 | 826 | $objmarge->marge_droite = 10; |
| 727 | 827 | |
| 728 | 828 | $objectref = dol_sanitizeFileName($object->ref); |
| 729 | - if ($object->element == 'propal') $dir = $conf->propal->dir_output . '/' . $objectref; |
|
| 730 | - elseif ($object->element == 'commande') $dir = $conf->commande->dir_output . '/' . $objectref; |
|
| 731 | - elseif ($object->element == 'facture') $dir = $conf->facture->dir_output . '/' . $objectref; |
|
| 732 | - elseif ($object->element == 'facturerec') return; // no PDF for facturerec |
|
| 829 | + if ($object->element == 'propal') { |
|
| 830 | + $dir = $conf->propal->dir_output . '/' . $objectref; |
|
| 831 | + } elseif ($object->element == 'commande') { |
|
| 832 | + $dir = $conf->commande->dir_output . '/' . $objectref; |
|
| 833 | + } elseif ($object->element == 'facture') { |
|
| 834 | + $dir = $conf->facture->dir_output . '/' . $objectref; |
|
| 835 | + } elseif ($object->element == 'facturerec') { |
|
| 836 | + return; |
|
| 837 | + } |
|
| 838 | + // no PDF for facturerec |
|
| 733 | 839 | else |
| 734 | 840 | { |
| 735 | 841 | setEventMessage($langs->trans('warning_subtotal_recap_object_element_unknown', $object->element), 'warnings'); |
@@ -764,7 +870,9 @@ discard block |
||
| 764 | 870 | $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
| 765 | 871 | $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
| 766 | 872 | $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("subtotalRecap")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); |
| 767 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 873 | + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { |
|
| 874 | + $pdf->SetCompression(false); |
|
| 875 | + } |
|
| 768 | 876 | |
| 769 | 877 | $pdf->SetMargins($objmarge->marge_gauche, $objmarge->marge_haute, $objmarge->marge_droite); // Left, Top, Right |
| 770 | 878 | |
@@ -774,7 +882,9 @@ discard block |
||
| 774 | 882 | |
| 775 | 883 | // New page |
| 776 | 884 | $pdf->AddPage(); |
| 777 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 885 | + if (! empty($tplidx)) { |
|
| 886 | + $pdf->useTemplate($tplidx); |
|
| 887 | + } |
|
| 778 | 888 | $pagenb++; |
| 779 | 889 | |
| 780 | 890 | |
@@ -830,8 +940,10 @@ discard block |
||
| 830 | 940 | { |
| 831 | 941 | $TTot['TTotal_tva_multicurrency'][$tx] += $amount; |
| 832 | 942 | } |
| 943 | + } else { |
|
| 944 | + $pdf->SetFont('','', $default_font_size - 1); |
|
| 833 | 945 | } |
| 834 | - else $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage |
|
| 946 | + // Into loop to work with multipage |
|
| 835 | 947 | |
| 836 | 948 | $pdf->SetTextColor(0,0,0); |
| 837 | 949 | |
@@ -853,9 +965,11 @@ discard block |
||
| 853 | 965 | $pdf->startTransaction(); |
| 854 | 966 | $pdf->writeHTMLCell($posx_options-$posx_designation-$decalage, 3, $posx_designation+$decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J',true); |
| 855 | 967 | $pageposafter=$pdf->getPage(); |
| 856 | - if ($pageposafter > $pageposbefore) // There is a pagebreak |
|
| 968 | + if ($pageposafter > $pageposbefore) { |
|
| 969 | + // There is a pagebreak |
|
| 857 | 970 | { |
| 858 | 971 | $pdf->rollbackTransaction(true); |
| 972 | + } |
|
| 859 | 973 | $pageposafter=$pageposbefore; |
| 860 | 974 | //print $pageposafter.'-'.$pageposbefore;exit; |
| 861 | 975 | $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
@@ -864,23 +978,27 @@ discard block |
||
| 864 | 978 | $pageposafter=$pdf->getPage(); |
| 865 | 979 | $posyafter=$pdf->GetY(); |
| 866 | 980 | //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; |
| 867 | - if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter+$heightforinfotot))) // There is no space left for total+free text |
|
| 981 | + if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter+$heightforinfotot))) { |
|
| 982 | + // There is no space left for total+free text |
|
| 868 | 983 | { |
| 869 | 984 | if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page |
| 870 | 985 | { |
| 871 | 986 | $pdf->AddPage('','',true); |
| 872 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 873 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
|
| 987 | + } |
|
| 988 | + if (! empty($tplidx)) { |
|
| 989 | + $pdf->useTemplate($tplidx); |
|
| 990 | + } |
|
| 991 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { |
|
| 992 | + self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
|
| 993 | + } |
|
| 874 | 994 | $pdf->setPage($pageposafter+1); |
| 875 | 995 | } |
| 876 | - } |
|
| 877 | - else |
|
| 996 | + } else |
|
| 878 | 997 | { |
| 879 | 998 | // We found a page break |
| 880 | 999 | $showpricebeforepagebreak=0; |
| 881 | 1000 | } |
| 882 | - } |
|
| 883 | - else // No pagebreak |
|
| 1001 | + } else // No pagebreak |
|
| 884 | 1002 | { |
| 885 | 1003 | $pdf->commitTransaction(); |
| 886 | 1004 | } |
@@ -920,8 +1038,7 @@ discard block |
||
| 920 | 1038 | if ($pagenb == 1) |
| 921 | 1039 | { |
| 922 | 1040 | 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); |
| 923 | - } |
|
| 924 | - else |
|
| 1041 | + } else |
|
| 925 | 1042 | { |
| 926 | 1043 | 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); |
| 927 | 1044 | } |
@@ -929,7 +1046,9 @@ discard block |
||
| 929 | 1046 | $pagenb++; |
| 930 | 1047 | $pdf->setPage($pagenb); |
| 931 | 1048 | $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
| 932 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
|
| 1049 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { |
|
| 1050 | + self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
|
| 1051 | + } |
|
| 933 | 1052 | } |
| 934 | 1053 | } |
| 935 | 1054 | } |
@@ -939,8 +1058,7 @@ discard block |
||
| 939 | 1058 | { |
| 940 | 1059 | 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); |
| 941 | 1060 | $bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
| 942 | - } |
|
| 943 | - else |
|
| 1061 | + } else |
|
| 944 | 1062 | { |
| 945 | 1063 | 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); |
| 946 | 1064 | $bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
@@ -954,7 +1072,9 @@ discard block |
||
| 954 | 1072 | |
| 955 | 1073 | $pagecount = self::concat($outputlangs, array($origin_file, $file), $origin_file); |
| 956 | 1074 | |
| 957 | - if (empty($conf->global->SUBTOTAL_KEEP_RECAP_FILE)) unlink($file); |
|
| 1075 | + if (empty($conf->global->SUBTOTAL_KEEP_RECAP_FILE)) { |
|
| 1076 | + unlink($file); |
|
| 1077 | + } |
|
| 958 | 1078 | } |
| 959 | 1079 | |
| 960 | 1080 | private static function printLevel($objmarge, $pdf, $line, $curY, $posx_designation) |
@@ -997,8 +1117,7 @@ discard block |
||
| 997 | 1117 | { |
| 998 | 1118 | $height=pdf_getHeightForLogo($logo); |
| 999 | 1119 | $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
| 1000 | - } |
|
| 1001 | - else |
|
| 1120 | + } else |
|
| 1002 | 1121 | { |
| 1003 | 1122 | $pdf->SetTextColor(200,0,0); |
| 1004 | 1123 | $pdf->SetFont('','B',$default_font_size - 2); |
@@ -1007,8 +1126,7 @@ discard block |
||
| 1007 | 1126 | } |
| 1008 | 1127 | |
| 1009 | 1128 | $posy+=35; |
| 1010 | - } |
|
| 1011 | - else |
|
| 1129 | + } else |
|
| 1012 | 1130 | { |
| 1013 | 1131 | $text=$mysoc->name; |
| 1014 | 1132 | $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); |
@@ -1022,9 +1140,13 @@ discard block |
||
| 1022 | 1140 | $pdf->SetXY($objmarge->marge_gauche,$posy); |
| 1023 | 1141 | |
| 1024 | 1142 | $key = 'subtotalPropalTitle'; |
| 1025 | - if ($object->element == 'commande') $key = 'subtotalCommandeTitle'; |
|
| 1026 | - elseif ($object->element == 'facture') $key = 'subtotalInvoiceTitle'; |
|
| 1027 | - elseif ($object->element == 'facturerec') $key = 'subtotalInvoiceTitle'; |
|
| 1143 | + if ($object->element == 'commande') { |
|
| 1144 | + $key = 'subtotalCommandeTitle'; |
|
| 1145 | + } elseif ($object->element == 'facture') { |
|
| 1146 | + $key = 'subtotalInvoiceTitle'; |
|
| 1147 | + } elseif ($object->element == 'facturerec') { |
|
| 1148 | + $key = 'subtotalInvoiceTitle'; |
|
| 1149 | + } |
|
| 1028 | 1150 | |
| 1029 | 1151 | $pdf->MultiCell(150, 4, $outputlangs->transnoentities($key, $object->ref, $object->thirdparty->name), '', 'L'); |
| 1030 | 1152 | |
@@ -1059,7 +1181,9 @@ discard block |
||
| 1059 | 1181 | |
| 1060 | 1182 | // Force to disable hidetop and hidebottom |
| 1061 | 1183 | $hidebottom=0; |
| 1062 | - if ($hidetop) $hidetop=-1; |
|
| 1184 | + if ($hidetop) { |
|
| 1185 | + $hidetop=-1; |
|
| 1186 | + } |
|
| 1063 | 1187 | |
| 1064 | 1188 | $currency = !empty($currency) ? $currency : $conf->currency; |
| 1065 | 1189 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
@@ -1074,7 +1198,9 @@ discard block |
||
| 1074 | 1198 | $pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4.5); |
| 1075 | 1199 | $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); |
| 1076 | 1200 | |
| 1077 | - 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)); |
|
| 1201 | + if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) { |
|
| 1202 | + $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)); |
|
| 1203 | + } |
|
| 1078 | 1204 | |
| 1079 | 1205 | |
| 1080 | 1206 | $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 |
@@ -1087,8 +1213,7 @@ discard block |
||
| 1087 | 1213 | $pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant,2, $outputlangs->transnoentities("Amount"),'','R'); |
| 1088 | 1214 | |
| 1089 | 1215 | $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 |
| 1090 | - } |
|
| 1091 | - else |
|
| 1216 | + } else |
|
| 1092 | 1217 | { |
| 1093 | 1218 | $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 |
| 1094 | 1219 | } |
@@ -1109,10 +1234,12 @@ discard block |
||
| 1109 | 1234 | |
| 1110 | 1235 | // Tableau total |
| 1111 | 1236 | $col1x = 120; $col2x = 170; |
| 1112 | - if ($objmarge->page_largeur < 210) // To work with US executive format |
|
| 1237 | + if ($objmarge->page_largeur < 210) { |
|
| 1238 | + // To work with US executive format |
|
| 1113 | 1239 | { |
| 1114 | 1240 | $col2x-=20; |
| 1115 | 1241 | } |
| 1242 | + } |
|
| 1116 | 1243 | $largcol2 = ($objmarge->page_largeur - $objmarge->marge_droite - $col2x); |
| 1117 | 1244 | |
| 1118 | 1245 | $useborder=0; |
@@ -1134,9 +1261,11 @@ discard block |
||
| 1134 | 1261 | $atleastoneratenotnull=0; |
| 1135 | 1262 | foreach($TTot['TTotal_tva'] as $tvakey => $tvaval) |
| 1136 | 1263 | { |
| 1137 | - if ($tvakey != 0) // On affiche pas taux 0 |
|
| 1264 | + if ($tvakey != 0) { |
|
| 1265 | + // On affiche pas taux 0 |
|
| 1138 | 1266 | { |
| 1139 | 1267 | $atleastoneratenotnull++; |
| 1268 | + } |
|
| 1140 | 1269 | |
| 1141 | 1270 | $index++; |
| 1142 | 1271 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
@@ -1189,9 +1318,13 @@ discard block |
||
| 1189 | 1318 | */ |
| 1190 | 1319 | private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0) |
| 1191 | 1320 | { |
| 1192 | - if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); |
|
| 1321 | + if (empty($hidetop) || $hidetop==-1) { |
|
| 1322 | + $pdf->line($x, $y, $x+$l, $y); |
|
| 1323 | + } |
|
| 1193 | 1324 | $pdf->line($x+$l, $y, $x+$l, $y+$h); |
| 1194 | - if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
| 1325 | + if (empty($hidebottom)) { |
|
| 1326 | + $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
| 1327 | + } |
|
| 1195 | 1328 | $pdf->line($x, $y+$h, $x, $y); |
| 1196 | 1329 | } |
| 1197 | 1330 | |
@@ -1200,7 +1333,9 @@ discard block |
||
| 1200 | 1333 | { |
| 1201 | 1334 | global $conf; |
| 1202 | 1335 | |
| 1203 | - if (empty($fileoutput)) $fileoutput = $file[0]; |
|
| 1336 | + if (empty($fileoutput)) { |
|
| 1337 | + $fileoutput = $file[0]; |
|
| 1338 | + } |
|
| 1204 | 1339 | |
| 1205 | 1340 | $pdf=pdf_getInstance(); |
| 1206 | 1341 | if (class_exists('TCPDF')) |
@@ -1210,7 +1345,9 @@ discard block |
||
| 1210 | 1345 | } |
| 1211 | 1346 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
| 1212 | 1347 | |
| 1213 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 1348 | + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { |
|
| 1349 | + $pdf->SetCompression(false); |
|
| 1350 | + } |
|
| 1214 | 1351 | |
| 1215 | 1352 | |
| 1216 | 1353 | foreach($files as $file) |
@@ -1226,7 +1363,9 @@ discard block |
||
| 1226 | 1363 | } |
| 1227 | 1364 | |
| 1228 | 1365 | $pdf->Output($fileoutput,'F'); |
| 1229 | - if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
| 1366 | + if (! empty($conf->global->MAIN_UMASK)) { |
|
| 1367 | + @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
| 1368 | + } |
|
| 1230 | 1369 | |
| 1231 | 1370 | return $pagecount; |
| 1232 | 1371 | } |
@@ -1239,7 +1378,9 @@ discard block |
||
| 1239 | 1378 | */ |
| 1240 | 1379 | public static function hasNcTitle(&$line) |
| 1241 | 1380 | { |
| 1242 | - if(isset($line->has_nc_title)) return $line->has_nc_title; |
|
| 1381 | + if(isset($line->has_nc_title)) { |
|
| 1382 | + return $line->has_nc_title; |
|
| 1383 | + } |
|
| 1243 | 1384 | |
| 1244 | 1385 | $TTitle = self::getAllTitleFromLine($line); |
| 1245 | 1386 | foreach ($TTitle as &$line_title) |
@@ -1264,7 +1405,9 @@ discard block |
||
| 1264 | 1405 | public static function getTitleLabel($line) |
| 1265 | 1406 | { |
| 1266 | 1407 | $title = $line->label; |
| 1267 | - if (empty($title)) $title = !empty($line->description) ? $line->description : $line->desc; |
|
| 1408 | + if (empty($title)) { |
|
| 1409 | + $title = !empty($line->description) ? $line->description : $line->desc; |
|
| 1410 | + } |
|
| 1268 | 1411 | return $title; |
| 1269 | 1412 | } |
| 1270 | 1413 | } |
@@ -25,7 +25,9 @@ discard block |
||
| 25 | 25 | $value = ''; |
| 26 | 26 | $sql = 'SELECT content FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text WHERE rowid = '.GETPOST('rowid'); |
| 27 | 27 | $resql = $this->db->query($sql); |
| 28 | - if ($resql && ($obj = $this->db->fetch_object($resql))) $value = $obj->content; |
|
| 28 | + if ($resql && ($obj = $this->db->fetch_object($resql))) { |
|
| 29 | + $value = $obj->content; |
|
| 30 | + } |
|
| 29 | 31 | } |
| 30 | 32 | |
| 31 | 33 | ?> |
@@ -109,8 +111,11 @@ discard block |
||
| 109 | 111 | if ($object->statut == 0 && $createRight) { |
| 110 | 112 | |
| 111 | 113 | |
| 112 | - if($object->element=='facture')$idvar = 'facid'; |
|
| 113 | - else $idvar='id'; |
|
| 114 | + if($object->element=='facture') { |
|
| 115 | + $idvar = 'facid'; |
|
| 116 | + } else { |
|
| 117 | + $idvar='id'; |
|
| 118 | + } |
|
| 114 | 119 | |
| 115 | 120 | if(in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text')) ) |
| 116 | 121 | { |
@@ -118,10 +123,11 @@ discard block |
||
| 118 | 123 | |
| 119 | 124 | if($action=='add_title_line') { |
| 120 | 125 | $title = GETPOST('title'); |
| 121 | - if(empty($title)) $title = $langs->trans('title'); |
|
| 126 | + if(empty($title)) { |
|
| 127 | + $title = $langs->trans('title'); |
|
| 128 | + } |
|
| 122 | 129 | $qty = $level<1 ? 1 : $level ; |
| 123 | - } |
|
| 124 | - else if($action=='add_free_text') { |
|
| 130 | + } else if($action=='add_free_text') { |
|
| 125 | 131 | $title = GETPOST('title'); |
| 126 | 132 | |
| 127 | 133 | if (empty($title)) { |
@@ -133,29 +139,31 @@ discard block |
||
| 133 | 139 | } |
| 134 | 140 | } |
| 135 | 141 | } |
| 136 | - if(empty($title)) $title = $langs->trans('subtotalAddLineDescription'); |
|
| 142 | + if(empty($title)) { |
|
| 143 | + $title = $langs->trans('subtotalAddLineDescription'); |
|
| 144 | + } |
|
| 137 | 145 | $qty = 50; |
| 138 | - } |
|
| 139 | - else if($action=='add_subtitle_line') { |
|
| 146 | + } else if($action=='add_subtitle_line') { |
|
| 140 | 147 | $title = GETPOST('title'); |
| 141 | - if(empty($title)) $title = $langs->trans('subtitle'); |
|
| 148 | + if(empty($title)) { |
|
| 149 | + $title = $langs->trans('subtitle'); |
|
| 150 | + } |
|
| 142 | 151 | $qty = 2; |
| 143 | - } |
|
| 144 | - else if($action=='add_subtotal_line') { |
|
| 152 | + } else if($action=='add_subtotal_line') { |
|
| 145 | 153 | $title = $langs->trans('SubSubTotal'); |
| 146 | 154 | $qty = 98; |
| 147 | - } |
|
| 148 | - else { |
|
| 155 | + } else { |
|
| 149 | 156 | $title = GETPOST('title') ? GETPOST('title') : $langs->trans('SubTotal'); |
| 150 | 157 | $qty = $level ? 100-$level : 99; |
| 151 | 158 | } |
| 152 | 159 | dol_include_once('/subtotal/class/subtotal.class.php'); |
| 153 | 160 | |
| 154 | - if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) TSubtotal::addSubtotalMissing($object, $qty); |
|
| 161 | + if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) { |
|
| 162 | + TSubtotal::addSubtotalMissing($object, $qty); |
|
| 163 | + } |
|
| 155 | 164 | |
| 156 | 165 | TSubtotal::addSubTotalLine($object, $title, $qty); |
| 157 | - } |
|
| 158 | - else if($action==='ask_deleteallline') { |
|
| 166 | + } else if($action==='ask_deleteallline') { |
|
| 159 | 167 | $form=new Form($db); |
| 160 | 168 | |
| 161 | 169 | $lineid = GETPOST('lineid','integer'); |
@@ -178,8 +186,7 @@ discard block |
||
| 178 | 186 | $this->printNewFormat($object, $conf, $langs, $idvar); |
| 179 | 187 | } |
| 180 | 188 | } |
| 181 | - } |
|
| 182 | - elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts)) |
|
| 189 | + } elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts)) |
|
| 183 | 190 | { |
| 184 | 191 | ?> |
| 185 | 192 | <script type="text/javascript"> |
@@ -197,8 +204,13 @@ discard block |
||
| 197 | 204 | |
| 198 | 205 | function printNewFormat(&$object, &$conf, &$langs, $idvar) |
| 199 | 206 | { |
| 200 | - if (empty($conf->global->SUBTOTAL_ALLOW_ADD_BLOCK)) return false; |
|
| 201 | - if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) return false; // Si facture de situation |
|
| 207 | + if (empty($conf->global->SUBTOTAL_ALLOW_ADD_BLOCK)) { |
|
| 208 | + return false; |
|
| 209 | + } |
|
| 210 | + if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) { |
|
| 211 | + return false; |
|
| 212 | + } |
|
| 213 | + // Si facture de situation |
|
| 202 | 214 | ?> |
| 203 | 215 | <script type="text/javascript"> |
| 204 | 216 | $(document).ready(function() { |
@@ -484,8 +496,7 @@ discard block |
||
| 484 | 496 | } |
| 485 | 497 | |
| 486 | 498 | |
| 487 | - } |
|
| 488 | - else{ |
|
| 499 | + } else{ |
|
| 489 | 500 | $substitutionarray['line_not_modsubtotal'] = true; |
| 490 | 501 | $substitutionarray['line_modsubtotal'] = 0; |
| 491 | 502 | } |
@@ -543,8 +554,11 @@ discard block |
||
| 543 | 554 | |
| 544 | 555 | $showBlockExtrafields = GETPOST('showBlockExtrafields'); |
| 545 | 556 | |
| 546 | - if($object->element=='facture') $idvar = 'facid'; |
|
| 547 | - else $idvar = 'id'; |
|
| 557 | + if($object->element=='facture') { |
|
| 558 | + $idvar = 'facid'; |
|
| 559 | + } else { |
|
| 560 | + $idvar = 'id'; |
|
| 561 | + } |
|
| 548 | 562 | |
| 549 | 563 | if ($action == 'updateligne' || $action == 'updateline') |
| 550 | 564 | { |
@@ -574,8 +588,7 @@ discard block |
||
| 574 | 588 | header('Location: '.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id); |
| 575 | 589 | exit; // Surtout ne pas laisser Dolibarr faire du traitement sur le updateligne sinon ça plante les données de la ligne |
| 576 | 590 | } |
| 577 | - } |
|
| 578 | - else if($action === 'builddoc') { |
|
| 591 | + } else if($action === 'builddoc') { |
|
| 579 | 592 | |
| 580 | 593 | if ( |
| 581 | 594 | in_array('invoicecard',explode(':',$parameters['context'])) |
@@ -590,33 +603,27 @@ discard block |
||
| 590 | 603 | $sessname = 'subtotal_hideInnerLines_facture'; |
| 591 | 604 | $sessname2 = 'subtotal_hidedetails_facture'; |
| 592 | 605 | $sessname3 = 'subtotal_hideprices_facture'; |
| 593 | - } |
|
| 594 | - elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
|
| 606 | + } elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
|
| 595 | 607 | $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
| 596 | 608 | $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
| 597 | 609 | $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
| 598 | - } |
|
| 599 | - elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
| 610 | + } elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
| 600 | 611 | $sessname = 'subtotal_hideInnerLines_propal'; |
| 601 | 612 | $sessname2 = 'subtotal_hidedetails_propal'; |
| 602 | 613 | $sessname3 = 'subtotal_hideprices_propal'; |
| 603 | - } |
|
| 604 | - elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
|
| 614 | + } elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
|
| 605 | 615 | $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
| 606 | 616 | $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
| 607 | 617 | $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
| 608 | - } |
|
| 609 | - elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
| 618 | + } elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
| 610 | 619 | $sessname = 'subtotal_hideInnerLines_commande'; |
| 611 | 620 | $sessname2 = 'subtotal_hidedetails_commande'; |
| 612 | 621 | $sessname3 = 'subtotal_hideprices_commande'; |
| 613 | - } |
|
| 614 | - elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
|
| 622 | + } elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
|
| 615 | 623 | $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
| 616 | 624 | $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
| 617 | 625 | $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
| 618 | - } |
|
| 619 | - else { |
|
| 626 | + } else { |
|
| 620 | 627 | $sessname = 'subtotal_hideInnerLines_unknown'; |
| 621 | 628 | $sessname2 = 'subtotal_hidedetails_unknown'; |
| 622 | 629 | $sessname3 = 'subtotal_hideprices_unknown'; |
@@ -625,15 +632,24 @@ discard block |
||
| 625 | 632 | global $hideprices; |
| 626 | 633 | |
| 627 | 634 | $hideInnerLines = (int)GETPOST('hideInnerLines'); |
| 628 | - if(!empty($_SESSION[$sessname]) && !is_array($_SESSION[$sessname][$object->id]) ) $_SESSION[$sessname] = array(); // prevent old system |
|
| 635 | + if(!empty($_SESSION[$sessname]) && !is_array($_SESSION[$sessname][$object->id]) ) { |
|
| 636 | + $_SESSION[$sessname] = array(); |
|
| 637 | + } |
|
| 638 | + // prevent old system |
|
| 629 | 639 | $_SESSION[$sessname][$object->id] = $hideInnerLines; |
| 630 | 640 | |
| 631 | 641 | $hidedetails= (int)GETPOST('hidedetails'); |
| 632 | - if(!empty($_SESSION[$sessname2]) && !is_array($_SESSION[$sessname2][$object->id]) ) $_SESSION[$sessname2] = array(); // prevent old system |
|
| 642 | + if(!empty($_SESSION[$sessname2]) && !is_array($_SESSION[$sessname2][$object->id]) ) { |
|
| 643 | + $_SESSION[$sessname2] = array(); |
|
| 644 | + } |
|
| 645 | + // prevent old system |
|
| 633 | 646 | $_SESSION[$sessname2][$object->id] = $hidedetails; |
| 634 | 647 | |
| 635 | 648 | $hideprices= (int)GETPOST('hideprices'); |
| 636 | - if(!empty($_SESSION[$sessname3]) && !is_array($_SESSION[$sessname3][$object->id]) ) $_SESSION[$sessname3] = array(); // prevent old system |
|
| 649 | + if(!empty($_SESSION[$sessname3]) && !is_array($_SESSION[$sessname3][$object->id]) ) { |
|
| 650 | + $_SESSION[$sessname3] = array(); |
|
| 651 | + } |
|
| 652 | + // prevent old system |
|
| 637 | 653 | $_SESSION[$sessname3][$object->id] = $hideprices; |
| 638 | 654 | |
| 639 | 655 | foreach($object->lines as &$line) { |
@@ -641,8 +657,7 @@ discard block |
||
| 641 | 657 | |
| 642 | 658 | if($line->qty>=90) { |
| 643 | 659 | $line->modsubtotal_total = 1; |
| 644 | - } |
|
| 645 | - else{ |
|
| 660 | + } else{ |
|
| 646 | 661 | $line->modsubtotal_title = 1; |
| 647 | 662 | } |
| 648 | 663 | |
@@ -651,8 +666,7 @@ discard block |
||
| 651 | 666 | } |
| 652 | 667 | } |
| 653 | 668 | |
| 654 | - } |
|
| 655 | - else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
| 669 | + } else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
| 656 | 670 | |
| 657 | 671 | $Tab = $this->getArrayOfLineForAGroup($object, GETPOST('lineid')); |
| 658 | 672 | |
@@ -660,7 +674,9 @@ discard block |
||
| 660 | 674 | /** |
| 661 | 675 | * @var $object Facture |
| 662 | 676 | */ |
| 663 | - if($object->element=='facture') $object->deleteline($idLine); |
|
| 677 | + if($object->element=='facture') { |
|
| 678 | + $object->deleteline($idLine); |
|
| 679 | + } |
|
| 664 | 680 | /** |
| 665 | 681 | * @var $object Facture fournisseur |
| 666 | 682 | */ |
@@ -671,18 +687,25 @@ discard block |
||
| 671 | 687 | /** |
| 672 | 688 | * @var $object Propal |
| 673 | 689 | */ |
| 674 | - else if($object->element=='propal') $object->deleteline($idLine); |
|
| 690 | + else if($object->element=='propal') { |
|
| 691 | + $object->deleteline($idLine); |
|
| 692 | + } |
|
| 675 | 693 | /** |
| 676 | 694 | * @var $object Propal Fournisseur |
| 677 | 695 | */ |
| 678 | - else if($object->element=='supplier_proposal') $object->deleteline($idLine); |
|
| 696 | + else if($object->element=='supplier_proposal') { |
|
| 697 | + $object->deleteline($idLine); |
|
| 698 | + } |
|
| 679 | 699 | /** |
| 680 | 700 | * @var $object Commande |
| 681 | 701 | */ |
| 682 | 702 | else if($object->element=='commande') |
| 683 | 703 | { |
| 684 | - if ((float) DOL_VERSION >= 5.0) $object->deleteline($user, $idLine); |
|
| 685 | - else $object->deleteline($idLine); |
|
| 704 | + if ((float) DOL_VERSION >= 5.0) { |
|
| 705 | + $object->deleteline($user, $idLine); |
|
| 706 | + } else { |
|
| 707 | + $object->deleteline($idLine); |
|
| 708 | + } |
|
| 686 | 709 | } |
| 687 | 710 | /** |
| 688 | 711 | * @var $object Commande fournisseur |
@@ -694,21 +717,26 @@ discard block |
||
| 694 | 717 | /** |
| 695 | 718 | * @var $object Facturerec |
| 696 | 719 | */ |
| 697 | - else if($object->element=='facturerec') $object->deleteline($idLine); |
|
| 720 | + else if($object->element=='facturerec') { |
|
| 721 | + $object->deleteline($idLine); |
|
| 722 | + } |
|
| 698 | 723 | } |
| 699 | 724 | |
| 700 | 725 | header('location:?id='.$object->id); |
| 701 | 726 | exit; |
| 702 | 727 | |
| 703 | - } |
|
| 704 | - else if ($action == 'duplicate') |
|
| 728 | + } else if ($action == 'duplicate') |
|
| 705 | 729 | { |
| 706 | 730 | $lineid = GETPOST('lineid', 'int'); |
| 707 | 731 | $nbDuplicate = TSubtotal::duplicateLines($object, $lineid, true); |
| 708 | 732 | |
| 709 | - if ($nbDuplicate > 0) setEventMessage($langs->trans('subtotal_duplicate_success', $nbDuplicate)); |
|
| 710 | - elseif ($nbDuplicate == 0) setEventMessage($langs->trans('subtotal_duplicate_lineid_not_found'), 'warnings'); |
|
| 711 | - else setEventMessage($langs->trans('subtotal_duplicate_error'), 'errors'); |
|
| 733 | + if ($nbDuplicate > 0) { |
|
| 734 | + setEventMessage($langs->trans('subtotal_duplicate_success', $nbDuplicate)); |
|
| 735 | + } elseif ($nbDuplicate == 0) { |
|
| 736 | + setEventMessage($langs->trans('subtotal_duplicate_lineid_not_found'), 'warnings'); |
|
| 737 | + } else { |
|
| 738 | + setEventMessage($langs->trans('subtotal_duplicate_error'), 'errors'); |
|
| 739 | + } |
|
| 712 | 740 | |
| 713 | 741 | header('Location: ?id='.$object->id); |
| 714 | 742 | exit; |
@@ -788,17 +816,18 @@ discard block |
||
| 788 | 816 | //print $l->rang.'>='.$rang.' '.$total.'<br/>'; |
| 789 | 817 | if($l->rang>=$rang) { |
| 790 | 818 | //echo 'return!<br>'; |
| 791 | - if (!$return_all) return $total; |
|
| 792 | - else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
| 793 | - } |
|
| 794 | - else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
| 819 | + if (!$return_all) { |
|
| 820 | + return $total; |
|
| 821 | + } else { |
|
| 822 | + return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
| 823 | + } |
|
| 824 | + } else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
| 795 | 825 | { |
| 796 | 826 | $total = 0; |
| 797 | 827 | $total_tva = 0; |
| 798 | 828 | $total_ttc = 0; |
| 799 | 829 | $TTotal_tva = array(); |
| 800 | - } |
|
| 801 | - elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
| 830 | + } elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
| 802 | 831 | $total += $l->total_ht; |
| 803 | 832 | $total_tva += $l->total_tva; |
| 804 | 833 | $TTotal_tva[$l->tva_tx] += $l->total_tva; |
@@ -806,8 +835,11 @@ discard block |
||
| 806 | 835 | } |
| 807 | 836 | |
| 808 | 837 | } |
| 809 | - if (!$return_all) return $total; |
|
| 810 | - else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
| 838 | + if (!$return_all) { |
|
| 839 | + return $total; |
|
| 840 | + } else { |
|
| 841 | + return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
| 842 | + } |
|
| 811 | 843 | } |
| 812 | 844 | |
| 813 | 845 | /* |
@@ -875,15 +907,18 @@ discard block |
||
| 875 | 907 | } |
| 876 | 908 | |
| 877 | 909 | |
| 878 | - if($line->qty==99) |
|
| 879 | - $pdf->SetFillColor(220,220,220); |
|
| 880 | - elseif ($line->qty==98) |
|
| 881 | - $pdf->SetFillColor(230,230,230); |
|
| 882 | - else |
|
| 883 | - $pdf->SetFillColor(240,240,240); |
|
| 910 | + if($line->qty==99) { |
|
| 911 | + $pdf->SetFillColor(220,220,220); |
|
| 912 | + } elseif ($line->qty==98) { |
|
| 913 | + $pdf->SetFillColor(230,230,230); |
|
| 914 | + } else { |
|
| 915 | + $pdf->SetFillColor(240,240,240); |
|
| 916 | + } |
|
| 884 | 917 | |
| 885 | 918 | $style = 'B'; |
| 886 | - if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
|
| 919 | + if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) { |
|
| 920 | + $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
|
| 921 | + } |
|
| 887 | 922 | |
| 888 | 923 | $pdf->SetFont('', $style, 9); |
| 889 | 924 | |
@@ -922,8 +957,7 @@ discard block |
||
| 922 | 957 | // $line->total_tva |
| 923 | 958 | // $line->total |
| 924 | 959 | // $line->total_ttc |
| 925 | - } |
|
| 926 | - else |
|
| 960 | + } else |
|
| 927 | 961 | { |
| 928 | 962 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
| 929 | 963 | if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation |
@@ -940,11 +974,14 @@ discard block |
||
| 940 | 974 | } |
| 941 | 975 | |
| 942 | 976 | $pdf->SetXY($pdf->postotalht, $posy); |
| 943 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
| 977 | + if($set_pagebreak_margin) { |
|
| 978 | + $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
| 979 | + } |
|
| 944 | 980 | $pdf->MultiCell($pdf->page_largeur-$pdf->marge_droite-$pdf->postotalht, 3, $total_to_print, 0, 'R', 0); |
| 945 | - } |
|
| 946 | - else{ |
|
| 947 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
| 981 | + } else{ |
|
| 982 | + if($set_pagebreak_margin) { |
|
| 983 | + $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
| 984 | + } |
|
| 948 | 985 | } |
| 949 | 986 | |
| 950 | 987 | $posy = $posy + $cell_height; |
@@ -976,25 +1013,40 @@ discard block |
||
| 976 | 1013 | |
| 977 | 1014 | |
| 978 | 1015 | $style = ($line->qty==1) ? 'BU' : 'BUI'; |
| 979 | - if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
|
| 1016 | + if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) { |
|
| 1017 | + $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
|
| 1018 | + } |
|
| 980 | 1019 | |
| 981 | 1020 | if($hideInnerLines) { |
| 982 | - if($line->qty==1)$pdf->SetFont('', $style, 9); |
|
| 983 | - else |
|
| 1021 | + if($line->qty==1) { |
|
| 1022 | + $pdf->SetFont('', $style, 9); |
|
| 1023 | + } else |
|
| 984 | 1024 | { |
| 985 | - if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
|
| 1025 | + if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) { |
|
| 1026 | + $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
|
| 1027 | + } |
|
| 986 | 1028 | $pdf->SetFont('', $style, 9); |
| 987 | 1029 | } |
| 988 | - } |
|
| 989 | - else { |
|
| 1030 | + } else { |
|
| 990 | 1031 | |
| 991 | - if($line->qty==1)$pdf->SetFont('', $style, 9); //TODO if super utile |
|
| 992 | - else $pdf->SetFont('', $style, 9); |
|
| 1032 | + if($line->qty==1) { |
|
| 1033 | + $pdf->SetFont('', $style, 9); |
|
| 1034 | + } |
|
| 1035 | + //TODO if super utile |
|
| 1036 | + else { |
|
| 1037 | + $pdf->SetFont('', $style, 9); |
|
| 1038 | + } |
|
| 993 | 1039 | |
| 994 | 1040 | } |
| 995 | 1041 | |
| 996 | - 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 |
|
| 997 | - else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); // et maintenant avec du HTML |
|
| 1042 | + if ($label === strip_tags($label) && $label === dol_html_entity_decode($label, ENT_QUOTES)) { |
|
| 1043 | + $pdf->MultiCell($w, $h, $label, 0, 'L'); |
|
| 1044 | + } |
|
| 1045 | + // Pas de HTML dans la chaine |
|
| 1046 | + else { |
|
| 1047 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); |
|
| 1048 | + } |
|
| 1049 | + // et maintenant avec du HTML |
|
| 998 | 1050 | |
| 999 | 1051 | if($description && !$hidedesc) { |
| 1000 | 1052 | $posy = $pdf->GetY(); |
@@ -1018,8 +1070,7 @@ discard block |
||
| 1018 | 1070 | |
| 1019 | 1071 | if(is_array($parameters)) { |
| 1020 | 1072 | $i = & $parameters['i']; |
| 1021 | - } |
|
| 1022 | - else { |
|
| 1073 | + } else { |
|
| 1023 | 1074 | $i = (int)$parameters; |
| 1024 | 1075 | } |
| 1025 | 1076 | |
@@ -1041,17 +1092,14 @@ discard block |
||
| 1041 | 1092 | |
| 1042 | 1093 | if((float)DOL_VERSION<=3.6) { |
| 1043 | 1094 | return ''; |
| 1044 | - } |
|
| 1045 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1095 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1046 | 1096 | return 1; |
| 1047 | 1097 | } |
| 1048 | 1098 | |
| 1049 | - } |
|
| 1050 | - elseif(!empty($hideprices)) { |
|
| 1099 | + } elseif(!empty($hideprices)) { |
|
| 1051 | 1100 | $this->resprints = $object->lines[$parameters['i']]->qty; |
| 1052 | 1101 | return 1; |
| 1053 | - } |
|
| 1054 | - elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
|
| 1102 | + } elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
|
| 1055 | 1103 | { |
| 1056 | 1104 | $hideInnerLines = (int)GETPOST('hideInnerLines'); |
| 1057 | 1105 | $hidedetails = (int)GETPOST('hidedetails'); |
@@ -1061,12 +1109,20 @@ discard block |
||
| 1061 | 1109 | } |
| 1062 | 1110 | } |
| 1063 | 1111 | |
| 1064 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1065 | - else $i = (int)$parameters; |
|
| 1112 | + if(is_array($parameters)) { |
|
| 1113 | + $i = & $parameters['i']; |
|
| 1114 | + } else { |
|
| 1115 | + $i = (int)$parameters; |
|
| 1116 | + } |
|
| 1066 | 1117 | |
| 1067 | - 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) |
|
| 1118 | + if (empty($object->lines[$i])) { |
|
| 1119 | + return 0; |
|
| 1120 | + } |
|
| 1121 | + // 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) |
|
| 1068 | 1122 | |
| 1069 | - if(empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); |
|
| 1123 | + if(empty($object->lines[$i]->array_options)) { |
|
| 1124 | + $object->lines[$i]->fetch_optionals(); |
|
| 1125 | + } |
|
| 1070 | 1126 | |
| 1071 | 1127 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
| 1072 | 1128 | { |
@@ -1083,8 +1139,11 @@ discard block |
||
| 1083 | 1139 | function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') { |
| 1084 | 1140 | global $conf, $hideprices, $hookmanager; |
| 1085 | 1141 | |
| 1086 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1087 | - else $i = (int)$parameters; |
|
| 1142 | + if(is_array($parameters)) { |
|
| 1143 | + $i = & $parameters['i']; |
|
| 1144 | + } else { |
|
| 1145 | + $i = (int)$parameters; |
|
| 1146 | + } |
|
| 1088 | 1147 | |
| 1089 | 1148 | if($this->isModSubtotalLine($parameters,$object) ){ |
| 1090 | 1149 | |
@@ -1092,13 +1151,11 @@ discard block |
||
| 1092 | 1151 | |
| 1093 | 1152 | if((float)DOL_VERSION<=3.6) { |
| 1094 | 1153 | return ''; |
| 1095 | - } |
|
| 1096 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1154 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1097 | 1155 | return 1; |
| 1098 | 1156 | } |
| 1099 | 1157 | |
| 1100 | - } |
|
| 1101 | - elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS)) |
|
| 1158 | + } elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS)) |
|
| 1102 | 1159 | { |
| 1103 | 1160 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
| 1104 | 1161 | { |
@@ -1170,12 +1227,10 @@ discard block |
||
| 1170 | 1227 | $this->error = $hookmanager->error; |
| 1171 | 1228 | $this->errors = $hookmanager->errors; |
| 1172 | 1229 | return -1; |
| 1173 | - } |
|
| 1174 | - elseif (empty($reshook)) |
|
| 1230 | + } elseif (empty($reshook)) |
|
| 1175 | 1231 | { |
| 1176 | 1232 | $this->resprints .= $hookmanager->resprints; |
| 1177 | - } |
|
| 1178 | - else |
|
| 1233 | + } else |
|
| 1179 | 1234 | { |
| 1180 | 1235 | $this->resprints = $hookmanager->resprints; |
| 1181 | 1236 | |
@@ -1198,14 +1253,16 @@ discard block |
||
| 1198 | 1253 | |
| 1199 | 1254 | if((float)DOL_VERSION<=3.6) { |
| 1200 | 1255 | return ''; |
| 1201 | - } |
|
| 1202 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1256 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1203 | 1257 | return 1; |
| 1204 | 1258 | } |
| 1205 | 1259 | } |
| 1206 | 1260 | |
| 1207 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1208 | - else $i = (int)$parameters; |
|
| 1261 | + if(is_array($parameters)) { |
|
| 1262 | + $i = & $parameters['i']; |
|
| 1263 | + } else { |
|
| 1264 | + $i = (int)$parameters; |
|
| 1265 | + } |
|
| 1209 | 1266 | |
| 1210 | 1267 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
| 1211 | 1268 | { |
@@ -1227,14 +1284,16 @@ discard block |
||
| 1227 | 1284 | |
| 1228 | 1285 | if((float)DOL_VERSION<=3.6) { |
| 1229 | 1286 | return ''; |
| 1230 | - } |
|
| 1231 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1287 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1232 | 1288 | return 1; |
| 1233 | 1289 | } |
| 1234 | 1290 | } |
| 1235 | 1291 | |
| 1236 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1237 | - else $i = (int)$parameters; |
|
| 1292 | + if(is_array($parameters)) { |
|
| 1293 | + $i = & $parameters['i']; |
|
| 1294 | + } else { |
|
| 1295 | + $i = (int)$parameters; |
|
| 1296 | + } |
|
| 1238 | 1297 | |
| 1239 | 1298 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
| 1240 | 1299 | { |
@@ -1256,13 +1315,15 @@ discard block |
||
| 1256 | 1315 | |
| 1257 | 1316 | if((float)DOL_VERSION<=3.6) { |
| 1258 | 1317 | return ''; |
| 1259 | - } |
|
| 1260 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1318 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1261 | 1319 | return 1; |
| 1262 | 1320 | } |
| 1263 | 1321 | } |
| 1264 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1265 | - else $i = (int)$parameters; |
|
| 1322 | + if(is_array($parameters)) { |
|
| 1323 | + $i = & $parameters['i']; |
|
| 1324 | + } else { |
|
| 1325 | + $i = (int)$parameters; |
|
| 1326 | + } |
|
| 1266 | 1327 | |
| 1267 | 1328 | |
| 1268 | 1329 | // Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché |
@@ -1309,14 +1370,16 @@ discard block |
||
| 1309 | 1370 | $this->resprints = ' '; |
| 1310 | 1371 | if((float)DOL_VERSION<=3.6) { |
| 1311 | 1372 | return ''; |
| 1312 | - } |
|
| 1313 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1373 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1314 | 1374 | return 1; |
| 1315 | 1375 | } |
| 1316 | 1376 | } |
| 1317 | 1377 | |
| 1318 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1319 | - else $i = (int)$parameters; |
|
| 1378 | + if(is_array($parameters)) { |
|
| 1379 | + $i = & $parameters['i']; |
|
| 1380 | + } else { |
|
| 1381 | + $i = (int)$parameters; |
|
| 1382 | + } |
|
| 1320 | 1383 | |
| 1321 | 1384 | if (!empty($hideprices) |
| 1322 | 1385 | || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
@@ -1340,16 +1403,21 @@ discard block |
||
| 1340 | 1403 | |
| 1341 | 1404 | if((float)DOL_VERSION<=3.6) { |
| 1342 | 1405 | return ''; |
| 1343 | - } |
|
| 1344 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1406 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1345 | 1407 | return 1; |
| 1346 | 1408 | } |
| 1347 | 1409 | } |
| 1348 | 1410 | |
| 1349 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1350 | - else $i = (int)$parameters; |
|
| 1411 | + if(is_array($parameters)) { |
|
| 1412 | + $i = & $parameters['i']; |
|
| 1413 | + } else { |
|
| 1414 | + $i = (int)$parameters; |
|
| 1415 | + } |
|
| 1351 | 1416 | |
| 1352 | - 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) |
|
| 1417 | + if (empty($object->lines[$i])) { |
|
| 1418 | + return 0; |
|
| 1419 | + } |
|
| 1420 | + // 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) |
|
| 1353 | 1421 | |
| 1354 | 1422 | $object->lines[$i]->fetch_optionals(); |
| 1355 | 1423 | // Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché |
@@ -1395,14 +1463,16 @@ discard block |
||
| 1395 | 1463 | $this->resprints = ' '; |
| 1396 | 1464 | if((float)DOL_VERSION<=3.6) { |
| 1397 | 1465 | return ''; |
| 1398 | - } |
|
| 1399 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1466 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1400 | 1467 | return 1; |
| 1401 | 1468 | } |
| 1402 | 1469 | } |
| 1403 | 1470 | |
| 1404 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1405 | - else $i = (int)$parameters; |
|
| 1471 | + if(is_array($parameters)) { |
|
| 1472 | + $i = & $parameters['i']; |
|
| 1473 | + } else { |
|
| 1474 | + $i = (int)$parameters; |
|
| 1475 | + } |
|
| 1406 | 1476 | |
| 1407 | 1477 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
| 1408 | 1478 | { |
@@ -1432,7 +1502,9 @@ discard block |
||
| 1432 | 1502 | } |
| 1433 | 1503 | } |
| 1434 | 1504 | |
| 1435 | - if (!empty($TLineTitle)) $TTitleNumeroted = $this->formatNumerotation($TLineTitle); |
|
| 1505 | + if (!empty($TLineTitle)) { |
|
| 1506 | + $TTitleNumeroted = $this->formatNumerotation($TLineTitle); |
|
| 1507 | + } |
|
| 1436 | 1508 | } |
| 1437 | 1509 | |
| 1438 | 1510 | } |
@@ -1446,8 +1518,12 @@ discard block |
||
| 1446 | 1518 | $j=0; |
| 1447 | 1519 | foreach ($TLineTitle as $k => &$line) |
| 1448 | 1520 | { |
| 1449 | - if (!empty($line_reference) && $line->rang <= $line_reference->rang) continue; |
|
| 1450 | - if (!empty($line_reference) && $line->qty <= $line_reference->qty) break; |
|
| 1521 | + if (!empty($line_reference) && $line->rang <= $line_reference->rang) { |
|
| 1522 | + continue; |
|
| 1523 | + } |
|
| 1524 | + if (!empty($line_reference) && $line->qty <= $line_reference->qty) { |
|
| 1525 | + break; |
|
| 1526 | + } |
|
| 1451 | 1527 | |
| 1452 | 1528 | if ($line->qty == $level) |
| 1453 | 1529 | { |
@@ -1481,7 +1557,9 @@ discard block |
||
| 1481 | 1557 | |
| 1482 | 1558 | $hidedetails = (int)GETPOST('hidedetails'); |
| 1483 | 1559 | |
| 1484 | - if(empty($hidedetails)) return false; |
|
| 1560 | + if(empty($hidedetails)) { |
|
| 1561 | + return false; |
|
| 1562 | + } |
|
| 1485 | 1563 | |
| 1486 | 1564 | // TODO can't add VAT to document without lines... :-/ |
| 1487 | 1565 | |
@@ -1534,7 +1612,9 @@ discard block |
||
| 1534 | 1612 | */ |
| 1535 | 1613 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
| 1536 | 1614 | |
| 1537 | - if (TSubtotal::getNiveau($line) == 1) $line->TTotal_tva = $TTotal_tva; |
|
| 1615 | + if (TSubtotal::getNiveau($line) == 1) { |
|
| 1616 | + $line->TTotal_tva = $TTotal_tva; |
|
| 1617 | + } |
|
| 1538 | 1618 | $line->total_ht = $total; |
| 1539 | 1619 | $line->total_tva = $total_tva; |
| 1540 | 1620 | $line->total = $line->total_ht; |
@@ -1589,8 +1669,7 @@ discard block |
||
| 1589 | 1669 | } |
| 1590 | 1670 | |
| 1591 | 1671 | |
| 1592 | - } |
|
| 1593 | - elseif ($hidedetails) |
|
| 1672 | + } elseif ($hidedetails) |
|
| 1594 | 1673 | { |
| 1595 | 1674 | $TLines[] = $line; //Cas où je cache uniquement les prix des produits |
| 1596 | 1675 | } |
@@ -1661,7 +1740,9 @@ discard block |
||
| 1661 | 1740 | |
| 1662 | 1741 | if(!empty($hideprices)) { |
| 1663 | 1742 | foreach($object->lines as &$line) { |
| 1664 | - if($line->fk_product_type!=9) $line->fk_parent_line = -1; |
|
| 1743 | + if($line->fk_product_type!=9) { |
|
| 1744 | + $line->fk_parent_line = -1; |
|
| 1745 | + } |
|
| 1665 | 1746 | } |
| 1666 | 1747 | } |
| 1667 | 1748 | |
@@ -1682,7 +1763,9 @@ discard block |
||
| 1682 | 1763 | |
| 1683 | 1764 | if($line->qty>90) { |
| 1684 | 1765 | |
| 1685 | - if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) $label .= ' '.$this->getTitle($object, $line); |
|
| 1766 | + if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) { |
|
| 1767 | + $label .= ' '.$this->getTitle($object, $line); |
|
| 1768 | + } |
|
| 1686 | 1769 | |
| 1687 | 1770 | $pageBefore = $pdf->getPage(); |
| 1688 | 1771 | $this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
@@ -1700,8 +1783,7 @@ discard block |
||
| 1700 | 1783 | |
| 1701 | 1784 | $posy = $pdf->GetY(); |
| 1702 | 1785 | return 1; |
| 1703 | - } |
|
| 1704 | - else if ($line->qty < 10) { |
|
| 1786 | + } else if ($line->qty < 10) { |
|
| 1705 | 1787 | $pageBefore = $pdf->getPage(); |
| 1706 | 1788 | |
| 1707 | 1789 | $this->pdf_add_title($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
@@ -1725,8 +1807,7 @@ discard block |
||
| 1725 | 1807 | // if($line->rowid==47) exit; |
| 1726 | 1808 | |
| 1727 | 1809 | return 0; |
| 1728 | - } |
|
| 1729 | - elseif (empty($object->lines[$parameters['i']])) |
|
| 1810 | + } elseif (empty($object->lines[$parameters['i']])) |
|
| 1730 | 1811 | { |
| 1731 | 1812 | $this->resprints = -1; |
| 1732 | 1813 | } |
@@ -1759,7 +1840,9 @@ discard block |
||
| 1759 | 1840 | |
| 1760 | 1841 | foreach ($object->lines as $line) |
| 1761 | 1842 | { |
| 1762 | - if ($line->id == $currentLine->id) break; |
|
| 1843 | + if ($line->id == $currentLine->id) { |
|
| 1844 | + break; |
|
| 1845 | + } |
|
| 1763 | 1846 | |
| 1764 | 1847 | $qty_search = 100 - $currentLine->qty; |
| 1765 | 1848 | |
@@ -1796,23 +1879,23 @@ discard block |
||
| 1796 | 1879 | { |
| 1797 | 1880 | $object->statut = 0; // hack for facture rec |
| 1798 | 1881 | $createRight = $user->rights->facture->creer; |
| 1799 | - } |
|
| 1800 | - elseif($object->element == 'order_supplier' ) |
|
| 1882 | + } elseif($object->element == 'order_supplier' ) |
|
| 1801 | 1883 | { |
| 1802 | 1884 | $createRight = $user->rights->fournisseur->commande->creer; |
| 1803 | - } |
|
| 1804 | - elseif($object->element == 'invoice_supplier' ) |
|
| 1885 | + } elseif($object->element == 'invoice_supplier' ) |
|
| 1805 | 1886 | { |
| 1806 | 1887 | $createRight = $user->rights->fournisseur->facture->creer; |
| 1807 | 1888 | } |
| 1808 | 1889 | |
| 1809 | 1890 | if($line->special_code!=$this->module_number || $line->product_type!=9) { |
| 1810 | 1891 | null; |
| 1811 | - } |
|
| 1812 | - 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)) |
|
| 1892 | + } 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)) |
|
| 1813 | 1893 | { |
| 1814 | - if($object->element=='facture')$idvar = 'facid'; |
|
| 1815 | - else $idvar='id'; |
|
| 1894 | + if($object->element=='facture') { |
|
| 1895 | + $idvar = 'facid'; |
|
| 1896 | + } else { |
|
| 1897 | + $idvar='id'; |
|
| 1898 | + } |
|
| 1816 | 1899 | |
| 1817 | 1900 | if((float)DOL_VERSION <= 3.4) |
| 1818 | 1901 | { |
@@ -1838,20 +1921,44 @@ discard block |
||
| 1838 | 1921 | <?php |
| 1839 | 1922 | } |
| 1840 | 1923 | |
| 1841 | - if(empty($line->description)) $line->description = $line->desc; |
|
| 1924 | + if(empty($line->description)) { |
|
| 1925 | + $line->description = $line->desc; |
|
| 1926 | + } |
|
| 1842 | 1927 | |
| 1843 | 1928 | $colspan = 5; |
| 1844 | - if($object->element == 'facturerec' ) $colspan = 3; |
|
| 1845 | - if($object->element == 'order_supplier') $colspan = 3; |
|
| 1846 | - if($object->element == 'invoice_supplier') $colspan = 4; |
|
| 1847 | - if($object->element == 'supplier_proposal') $colspan = 4; |
|
| 1848 | - if(!empty($conf->multicurrency->enabled)) $colspan+=2; |
|
| 1849 | - if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
| 1850 | - if(!empty($conf->margin->enabled)) $colspan++; |
|
| 1851 | - if(!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
| 1852 | - if(!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
| 1853 | - if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
| 1854 | - if(!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
| 1929 | + if($object->element == 'facturerec' ) { |
|
| 1930 | + $colspan = 3; |
|
| 1931 | + } |
|
| 1932 | + if($object->element == 'order_supplier') { |
|
| 1933 | + $colspan = 3; |
|
| 1934 | + } |
|
| 1935 | + if($object->element == 'invoice_supplier') { |
|
| 1936 | + $colspan = 4; |
|
| 1937 | + } |
|
| 1938 | + if($object->element == 'supplier_proposal') { |
|
| 1939 | + $colspan = 4; |
|
| 1940 | + } |
|
| 1941 | + if(!empty($conf->multicurrency->enabled)) { |
|
| 1942 | + $colspan+=2; |
|
| 1943 | + } |
|
| 1944 | + if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) { |
|
| 1945 | + $colspan++; |
|
| 1946 | + } |
|
| 1947 | + if(!empty($conf->margin->enabled)) { |
|
| 1948 | + $colspan++; |
|
| 1949 | + } |
|
| 1950 | + if(!empty($conf->global->DISPLAY_MARGIN_RATES)) { |
|
| 1951 | + $colspan++; |
|
| 1952 | + } |
|
| 1953 | + if(!empty($conf->global->DISPLAY_MARK_RATES)) { |
|
| 1954 | + $colspan++; |
|
| 1955 | + } |
|
| 1956 | + if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) { |
|
| 1957 | + $colspan++; |
|
| 1958 | + } |
|
| 1959 | + if(!empty($conf->global->PRODUCT_USE_UNITS)) { |
|
| 1960 | + $colspan++; |
|
| 1961 | + } |
|
| 1855 | 1962 | |
| 1856 | 1963 | /* Titre */ |
| 1857 | 1964 | //var_dump($line); |
@@ -1864,23 +1971,36 @@ discard block |
||
| 1864 | 1971 | <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
| 1865 | 1972 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
| 1866 | 1973 | { |
| 1867 | - if($line->qty==99) print 'background:#adadcf'; |
|
| 1868 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 1869 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
| 1870 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
| 1871 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
| 1872 | - else if($line->qty==50) print ''; |
|
| 1873 | - else print 'background:#eeeeff;'; |
|
| 1974 | + if($line->qty==99) { |
|
| 1975 | + print 'background:#adadcf'; |
|
| 1976 | + } else if($line->qty==98) { |
|
| 1977 | + print 'background:#ddddff;'; |
|
| 1978 | + } else if($line->qty<=97 && $line->qty>=91) { |
|
| 1979 | + print 'background:#eeeeff;'; |
|
| 1980 | + } else if($line->qty==1) { |
|
| 1981 | + print 'background:#adadcf;'; |
|
| 1982 | + } else if($line->qty==2) { |
|
| 1983 | + print 'background:#ddddff;'; |
|
| 1984 | + } else if($line->qty==50) { |
|
| 1985 | + print ''; |
|
| 1986 | + } else { |
|
| 1987 | + print 'background:#eeeeff;'; |
|
| 1988 | + } |
|
| 1874 | 1989 | |
| 1875 | 1990 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
| 1876 | - } |
|
| 1877 | - else |
|
| 1991 | + } else |
|
| 1878 | 1992 | { |
| 1879 | - if($line->qty==99) print 'background:#ddffdd'; |
|
| 1880 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 1881 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
| 1882 | - else if($line->qty==50) print ''; |
|
| 1883 | - else print 'background:#eeffee;' ; |
|
| 1993 | + if($line->qty==99) { |
|
| 1994 | + print 'background:#ddffdd'; |
|
| 1995 | + } else if($line->qty==98) { |
|
| 1996 | + print 'background:#ddddff;'; |
|
| 1997 | + } else if($line->qty==2) { |
|
| 1998 | + print 'background:#eeeeff; '; |
|
| 1999 | + } else if($line->qty==50) { |
|
| 2000 | + print ''; |
|
| 2001 | + } else { |
|
| 2002 | + print 'background:#eeffee;' ; |
|
| 2003 | + } |
|
| 1884 | 2004 | } |
| 1885 | 2005 | |
| 1886 | 2006 | ?>;"> |
@@ -1903,13 +2023,11 @@ discard block |
||
| 1903 | 2023 | $qty_displayed = $line->qty; |
| 1904 | 2024 | print img_picto('', 'subsubtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;color:#0075DE;">'.$qty_displayed.'</span> '; |
| 1905 | 2025 | |
| 1906 | - } |
|
| 1907 | - else if (TSubtotal::isSubtotal($line)) |
|
| 2026 | + } else if (TSubtotal::isSubtotal($line)) |
|
| 1908 | 2027 | { |
| 1909 | 2028 | $qty_displayed = 100 - $line->qty; |
| 1910 | 2029 | print img_picto('', 'subsubtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;color:#0075DE;">'.$qty_displayed.'</span> '; |
| 1911 | - } |
|
| 1912 | - else |
|
| 2030 | + } else |
|
| 1913 | 2031 | { |
| 1914 | 2032 | $isFreeText = true; |
| 1915 | 2033 | } |
@@ -1930,9 +2048,13 @@ discard block |
||
| 1930 | 2048 | } |
| 1931 | 2049 | |
| 1932 | 2050 | $readonlyForSituation = ''; |
| 1933 | - if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) $readonlyForSituation = 'readonly'; |
|
| 2051 | + if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) { |
|
| 2052 | + $readonlyForSituation = 'readonly'; |
|
| 2053 | + } |
|
| 1934 | 2054 | |
| 1935 | - if (!$isFreeText) echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
|
| 2055 | + if (!$isFreeText) { |
|
| 2056 | + echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
|
| 2057 | + } |
|
| 1936 | 2058 | |
| 1937 | 2059 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) ) |
| 1938 | 2060 | { |
@@ -1940,8 +2062,12 @@ discard block |
||
| 1940 | 2062 | for ($j=1; $j<10; $j++) |
| 1941 | 2063 | { |
| 1942 | 2064 | if (!empty($readonlyForSituation)) { |
| 1943 | - if ($qty_displayed == $j) $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
| 1944 | - } else $select .= '<option '.($qty_displayed == $j ? 'selected="selected"' : '').' value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
| 2065 | + if ($qty_displayed == $j) { |
|
| 2066 | + $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
| 2067 | + } |
|
| 2068 | + } else { |
|
| 2069 | + $select .= '<option '.($qty_displayed == $j ? 'selected="selected"' : '').' value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
| 2070 | + } |
|
| 1945 | 2071 | } |
| 1946 | 2072 | $select .= '</select> '; |
| 1947 | 2073 | |
@@ -1957,15 +2083,18 @@ discard block |
||
| 1957 | 2083 | $form = new Form($db); |
| 1958 | 2084 | echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>'; |
| 1959 | 2085 | echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>'; |
| 1960 | - if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
| 2086 | + if (empty($readonlyForSituation)) { |
|
| 2087 | + echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
| 2088 | + } |
|
| 1961 | 2089 | echo '</select> '; |
| 1962 | 2090 | |
| 1963 | 2091 | if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION) |
| 1964 | 2092 | { |
| 1965 | 2093 | echo '<label for="subtotal_progress">'.$langs->trans('subtotal_apply_progress').'</label> <input id="subtotal_progress" name="subtotal_progress" value="" size="1" />%'; |
| 1966 | 2094 | } |
| 2095 | + } else if ($isFreeText) { |
|
| 2096 | + echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
| 1967 | 2097 | } |
| 1968 | - else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
| 1969 | 2098 | echo '</div>'; |
| 1970 | 2099 | |
| 1971 | 2100 | if($line->qty<10) { |
@@ -1985,8 +2114,7 @@ discard block |
||
| 1985 | 2114 | $doleditor->Create(); |
| 1986 | 2115 | } |
| 1987 | 2116 | |
| 1988 | - } |
|
| 1989 | - else { |
|
| 2117 | + } else { |
|
| 1990 | 2118 | |
| 1991 | 2119 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) |
| 1992 | 2120 | { |
@@ -1994,14 +2122,19 @@ discard block |
||
| 1994 | 2122 | { |
| 1995 | 2123 | echo str_repeat(' ', $line->qty-1); |
| 1996 | 2124 | |
| 1997 | - if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
| 1998 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
| 2125 | + if (TSubtotal::isTitle($line)) { |
|
| 2126 | + print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
| 2127 | + } else { |
|
| 2128 | + print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
| 2129 | + } |
|
| 1999 | 2130 | } |
| 2000 | - } |
|
| 2001 | - else |
|
| 2131 | + } else |
|
| 2002 | 2132 | { |
| 2003 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
| 2004 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2133 | + if($line->qty<=1) { |
|
| 2134 | + print img_picto('', 'subtotal@subtotal'); |
|
| 2135 | + } else if($line->qty==2) { |
|
| 2136 | + print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2137 | + } |
|
| 2005 | 2138 | } |
| 2006 | 2139 | |
| 2007 | 2140 | |
@@ -2011,21 +2144,26 @@ discard block |
||
| 2011 | 2144 | $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
| 2012 | 2145 | |
| 2013 | 2146 | if (empty($line->label)) { |
| 2014 | - if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
|
| 2015 | - else print $line->description; |
|
| 2016 | - } |
|
| 2017 | - else { |
|
| 2147 | + if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) { |
|
| 2148 | + print $line->description.' '.$this->getTitle($object, $line); |
|
| 2149 | + } else { |
|
| 2150 | + print $line->description; |
|
| 2151 | + } |
|
| 2152 | + } else { |
|
| 2018 | 2153 | |
| 2019 | 2154 | if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
| 2020 | 2155 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
| 2021 | - } |
|
| 2022 | - else{ |
|
| 2156 | + } else{ |
|
| 2023 | 2157 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
| 2024 | 2158 | } |
| 2025 | 2159 | |
| 2026 | 2160 | } |
| 2027 | - if($line->qty>90) print ' : '; |
|
| 2028 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2161 | + if($line->qty>90) { |
|
| 2162 | + print ' : '; |
|
| 2163 | + } |
|
| 2164 | + if($line->info_bits > 0) { |
|
| 2165 | + echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2166 | + } |
|
| 2029 | 2167 | |
| 2030 | 2168 | |
| 2031 | 2169 | |
@@ -2062,11 +2200,12 @@ discard block |
||
| 2062 | 2200 | </script> |
| 2063 | 2201 | <?php |
| 2064 | 2202 | |
| 2065 | - } |
|
| 2066 | - else{ |
|
| 2203 | + } else{ |
|
| 2067 | 2204 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
| 2068 | 2205 | { |
| 2069 | - if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) ) echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
| 2206 | + if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) ) { |
|
| 2207 | + echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
| 2208 | + } |
|
| 2070 | 2209 | } |
| 2071 | 2210 | |
| 2072 | 2211 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
@@ -2135,7 +2274,9 @@ discard block |
||
| 2135 | 2274 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
| 2136 | 2275 | |
| 2137 | 2276 | $colspan+=3; $mode = 'view'; |
| 2138 | - if($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
| 2277 | + if($action === 'editline' && $line->rowid == GETPOST('lineid')) { |
|
| 2278 | + $mode = 'edit'; |
|
| 2279 | + } |
|
| 2139 | 2280 | |
| 2140 | 2281 | $ex_element = $line->element; |
| 2141 | 2282 | $line->element = 'tr_extrafield_title '.$line->element; // Pour pouvoir manipuler ces tr |
@@ -2317,10 +2458,9 @@ discard block |
||
| 2317 | 2458 | |
| 2318 | 2459 | if(TSubtotal::isTitle($line)){ |
| 2319 | 2460 | $ThtmlData['data-issubtotal'] = 'title'; |
| 2320 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
| 2461 | + } elseif(TSubtotal::isSubtotal($line)){ |
|
| 2321 | 2462 | $ThtmlData['data-issubtotal'] = 'subtotal'; |
| 2322 | - } |
|
| 2323 | - else{ |
|
| 2463 | + } else{ |
|
| 2324 | 2464 | $ThtmlData['data-issubtotal'] = 'freetext'; |
| 2325 | 2465 | } |
| 2326 | 2466 | |
@@ -2330,7 +2470,9 @@ discard block |
||
| 2330 | 2470 | |
| 2331 | 2471 | // hook |
| 2332 | 2472 | $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
| 2333 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 2473 | + if ($reshook < 0) { |
|
| 2474 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 2475 | + } |
|
| 2334 | 2476 | if ($reshook>0) |
| 2335 | 2477 | { |
| 2336 | 2478 | $ThtmlData = $hookmanager->resArray; |