@@ -5,28 +5,28 @@ discard block |
||
| 5 | 5 | |
| 6 | 6 | static $module_number = 104777; |
| 7 | 7 | |
| 8 | - static function addSubTotalLine(&$object, $label, $qty, $rang=-1) { |
|
| 8 | + static function addSubTotalLine(&$object, $label, $qty, $rang = -1) { |
|
| 9 | 9 | |
| 10 | 10 | $res = 0; |
| 11 | 11 | |
| 12 | - if( (float)DOL_VERSION <= 3.4 ) { |
|
| 12 | + if ((float) DOL_VERSION <= 3.4) { |
|
| 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') $res = $object->addline($object->id, $label, 0, $qty, 0, 0, 0, 0, 0, '', '', 0, 0, '', 'HT', 0, 9, -1, TSubtotal::$module_number); |
|
| 17 | 17 | /** |
| 18 | 18 | * @var $object Propal |
| 19 | 19 | */ |
| 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); |
|
| 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); |
|
| 21 | 21 | /** |
| 22 | 22 | * @var $object Commande |
| 23 | 23 | */ |
| 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); |
|
| 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); |
|
| 25 | 25 | |
| 26 | 26 | } |
| 27 | 27 | else { |
| 28 | 28 | $desc = ''; |
| 29 | - if ((float) DOL_VERSION < 6 || $qty==50) { |
|
| 29 | + if ((float) DOL_VERSION < 6 || $qty == 50) { |
|
| 30 | 30 | $desc = $label; |
| 31 | 31 | $label = ''; |
| 32 | 32 | } |
@@ -34,19 +34,19 @@ discard block |
||
| 34 | 34 | /** |
| 35 | 35 | * @var $object Facture |
| 36 | 36 | */ |
| 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); |
|
| 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); |
|
| 38 | 38 | /** |
| 39 | 39 | * @var $object Propal |
| 40 | 40 | */ |
| 41 | - else if($object->element=='propal') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
| 41 | + else if ($object->element == 'propal') $res = $object->addline($desc, 0, $qty, 0, 0, 0, 0, 0, 'HT', 0, 0, 9, $rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
| 42 | 42 | /** |
| 43 | 43 | * @var $object Commande |
| 44 | 44 | */ |
| 45 | - else if($object->element=='commande') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,$rang, TSubtotal::$module_number, 0, null, 0, $label); |
|
| 45 | + else if ($object->element == 'commande') $res = $object->addline($desc, 0, $qty, 0, 0, 0, 0, 0, 0, 0, 'HT', 0, '', '', 9, $rang, TSubtotal::$module_number, 0, null, 0, $label); |
|
| 46 | 46 | /** |
| 47 | 47 | * @var $object Facturerec |
| 48 | 48 | */ |
| 49 | - else if($object->element=='facturerec') $res = $object->addline($desc, 0,$qty, 0, 0, 0, 0, 0, 'HT', 0, '', 0, 9, $rang, TSubtotal::$module_number,$label); |
|
| 49 | + else if ($object->element == 'facturerec') $res = $object->addline($desc, 0, $qty, 0, 0, 0, 0, 0, 'HT', 0, '', 0, 9, $rang, TSubtotal::$module_number, $label); |
|
| 50 | 50 | |
| 51 | 51 | } |
| 52 | 52 | |
@@ -57,20 +57,20 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | public static function generateDoc(&$object) |
| 59 | 59 | { |
| 60 | - global $conf,$langs,$db; |
|
| 60 | + global $conf, $langs, $db; |
|
| 61 | 61 | |
| 62 | 62 | if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) |
| 63 | 63 | { |
| 64 | - $hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); |
|
| 65 | - $hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); |
|
| 66 | - $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); |
|
| 64 | + $hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); |
|
| 65 | + $hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); |
|
| 66 | + $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); |
|
| 67 | 67 | |
| 68 | 68 | // Define output language |
| 69 | 69 | $outputlangs = $langs; |
| 70 | 70 | $newlang = GETPOST('lang_id', 'alpha'); |
| 71 | - if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) |
|
| 71 | + if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) |
|
| 72 | 72 | $newlang = !empty($object->client) ? $object->client->default_lang : $object->thirdparty->default_lang; |
| 73 | - if (! empty($newlang)) { |
|
| 73 | + if (!empty($newlang)) { |
|
| 74 | 74 | $outputlangs = new Translate("", $conf); |
| 75 | 75 | $outputlangs->setDefaultLang($newlang); |
| 76 | 76 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | } |
| 85 | 85 | else |
| 86 | 86 | { |
| 87 | - if ($object->element!= 'facturerec') $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 87 | + if ($object->element != 'facturerec') $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -96,11 +96,11 @@ discard block |
||
| 96 | 96 | * @param type $rang_start |
| 97 | 97 | * @param type $move_to |
| 98 | 98 | */ |
| 99 | - public static function updateRang(&$object, $rang_start, $move_to=1) |
|
| 99 | + public static function updateRang(&$object, $rang_start, $move_to = 1) |
|
| 100 | 100 | { |
| 101 | 101 | if (!class_exists('GenericObject')) require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php'; |
| 102 | 102 | |
| 103 | - $row=new GenericObject($object->db); |
|
| 103 | + $row = new GenericObject($object->db); |
|
| 104 | 104 | $row->table_element_line = $object->table_element_line; |
| 105 | 105 | $row->fk_element = $object->fk_element; |
| 106 | 106 | $row->id = $object->id; |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | { |
| 110 | 110 | if ($line->rang < $rang_start) continue; |
| 111 | 111 | |
| 112 | - $row->updateRangOfLine($line->id, $line->rang+$move_to); |
|
| 112 | + $row->updateRangOfLine($line->id, $line->rang + $move_to); |
|
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | { |
| 139 | 139 | if ($rang_to_add != -1) self::updateRang($object, $rang_to_add); |
| 140 | 140 | |
| 141 | - self::addSubTotalLine($object, $langs->trans('SubTotal'), 100-$title_niveau, $rang_to_add); |
|
| 141 | + self::addSubTotalLine($object, $langs->trans('SubTotal'), 100 - $title_niveau, $rang_to_add); |
|
| 142 | 142 | |
| 143 | 143 | $object->lines[] = $object->line; // ajout de la ligne dans le tableau de ligne (Dolibarr ne le fait pas) |
| 144 | 144 | if ($rang_to_add != -1) |
@@ -150,14 +150,14 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - public static function addTitle(&$object, $label, $level, $rang=-1) |
|
| 153 | + public static function addTitle(&$object, $label, $level, $rang = -1) |
|
| 154 | 154 | { |
| 155 | 155 | self::addSubTotalLine($object, $label, $level, $rang); |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - public static function addTotal(&$object, $label, $level, $rang=-1) |
|
| 158 | + public static function addTotal(&$object, $label, $level, $rang = -1) |
|
| 159 | 159 | { |
| 160 | - self::addSubTotalLine($object, $label, (100-$level), $rang); |
|
| 160 | + self::addSubTotalLine($object, $label, (100 - $level), $rang); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | * |
| 169 | 169 | * @return array |
| 170 | 170 | */ |
| 171 | - public static function getAllTitleWithoutTotalFromDocument(&$object, $get_block_total=false) |
|
| 171 | + public static function getAllTitleWithoutTotalFromDocument(&$object, $get_block_total = false) |
|
| 172 | 172 | { |
| 173 | 173 | $TTitle = self::getAllTitleFromDocument($object, $get_block_total); |
| 174 | 174 | |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | * @param boolean $return_rang_on_false si true alors renvoi le rang où devrait ce trouver le sous-total |
| 190 | 190 | * @return boolean |
| 191 | 191 | */ |
| 192 | - public static function titleHasTotalLine(&$object, &$title_line, $strict_mode=false, $return_rang_on_false=false) |
|
| 192 | + public static function titleHasTotalLine(&$object, &$title_line, $strict_mode = false, $return_rang_on_false = false) |
|
| 193 | 193 | { |
| 194 | 194 | if (empty($object->lines) || !is_array($object->lines)) return false; |
| 195 | 195 | |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | return ($return_rang_on_false) ? -1 : false; |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - public static function getAllTitleFromDocument(&$object, $get_block_total=false) |
|
| 218 | + public static function getAllTitleFromDocument(&$object, $get_block_total = false) |
|
| 219 | 219 | { |
| 220 | 220 | $TRes = array(); |
| 221 | 221 | if (!empty($object->lines)) |
@@ -335,10 +335,10 @@ discard block |
||
| 335 | 335 | return false; |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | - public static function isTitle(&$line, $level=-1) |
|
| 338 | + public static function isTitle(&$line, $level = -1) |
|
| 339 | 339 | { |
| 340 | 340 | $res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty <= 9; |
| 341 | - if($res && $level > -1) { |
|
| 341 | + if ($res && $level > -1) { |
|
| 342 | 342 | return $line->qty == $level; |
| 343 | 343 | } else return $res; |
| 344 | 344 | |
@@ -359,28 +359,28 @@ discard block |
||
| 359 | 359 | return self::isTitle($line) || self::isSubtotal($line) || self::isFreeText($line); |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | - public static function getFreeTextHtml(&$line, $readonly=0) |
|
| 362 | + public static function getFreeTextHtml(&$line, $readonly = 0) |
|
| 363 | 363 | { |
| 364 | 364 | global $conf; |
| 365 | 365 | |
| 366 | 366 | // Copie du fichier "objectline_edit.tpl.php" |
| 367 | 367 | // editeur wysiwyg |
| 368 | 368 | require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
| 369 | - $nbrows=ROWS_2; |
|
| 370 | - if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
| 371 | - $enable=(isset($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0); |
|
| 372 | - $toolbarname='dolibarr_details'; |
|
| 373 | - if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes'; |
|
| 374 | - $text = !empty($line->description)?$line->description:$line->label; |
|
| 375 | - $doleditor=new DolEditor('line-description',$text,'',164,$toolbarname,'',false,true,$enable,$nbrows,'98%', $readonly); |
|
| 369 | + $nbrows = ROWS_2; |
|
| 370 | + if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
| 371 | + $enable = (isset($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); |
|
| 372 | + $toolbarname = 'dolibarr_details'; |
|
| 373 | + if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname = 'dolibarr_notes'; |
|
| 374 | + $text = !empty($line->description) ? $line->description : $line->label; |
|
| 375 | + $doleditor = new DolEditor('line-description', $text, '', 164, $toolbarname, '', false, true, $enable, $nbrows, '98%', $readonly); |
|
| 376 | 376 | return $doleditor->Create(1); |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | - public static function duplicateLines(&$object, $lineid, $withBlockLine=false) |
|
| 379 | + public static function duplicateLines(&$object, $lineid, $withBlockLine = false) |
|
| 380 | 380 | { |
| 381 | - global $db,$user,$conf; |
|
| 381 | + global $db, $user, $conf; |
|
| 382 | 382 | |
| 383 | - if ($object->statut == 0 && $user->rights->{$object->element}->creer && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK)) |
|
| 383 | + if ($object->statut == 0 && $user->rights->{$object->element}->creer && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK)) |
|
| 384 | 384 | { |
| 385 | 385 | dol_include_once('/subtotal/lib/subtotal.lib.php'); |
| 386 | 386 | |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | { |
| 422 | 422 | $object->line_from = $line; |
| 423 | 423 | // Call trigger |
| 424 | - $result=$object->call_trigger('LINE_DUPLICATE',$user); // $object->line |
|
| 424 | + $result = $object->call_trigger('LINE_DUPLICATE', $user); // $object->line |
|
| 425 | 425 | if ($result < 0) |
| 426 | 426 | { |
| 427 | 427 | $object->db->rollback(); |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | } |
| 453 | 453 | } |
| 454 | 454 | |
| 455 | - public static function getLinesFromTitle(&$object, $key_trad, $level=1, $under_title='', $withBlockLine=false, $key_is_id=false) |
|
| 455 | + public static function getLinesFromTitle(&$object, $key_trad, $level = 1, $under_title = '', $withBlockLine = false, $key_is_id = false) |
|
| 456 | 456 | { |
| 457 | 457 | global $langs; |
| 458 | 458 | |
@@ -464,17 +464,17 @@ discard block |
||
| 464 | 464 | |
| 465 | 465 | $TLine = array(); |
| 466 | 466 | $add_line = false; |
| 467 | - $under_title_found=false; |
|
| 467 | + $under_title_found = false; |
|
| 468 | 468 | |
| 469 | 469 | foreach ($object->lines as $key => &$line) |
| 470 | 470 | { |
| 471 | 471 | if (!$under_title_found && !empty($TTitle_under_search)) |
| 472 | 472 | { |
| 473 | - if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search)) ) $under_title_found = true; |
|
| 473 | + if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search))) $under_title_found = true; |
|
| 474 | 474 | } |
| 475 | 475 | else |
| 476 | 476 | { |
| 477 | - 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) ))) |
|
| 477 | + if (($key_is_id && $line->id == $key_trad) || (!$key_is_id && $line->product_type == 9 && $line->qty == $level && (in_array($line->desc, $TTitle_search) || in_array($line->label, $TTitle_search)))) |
|
| 478 | 478 | { |
| 479 | 479 | if ($key_is_id) $level = $line->qty; |
| 480 | 480 | |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | if ($withBlockLine) $TLine[] = $line; |
| 483 | 483 | continue; |
| 484 | 484 | } |
| 485 | - elseif ($add_line && $line->product_type == 9 && (100 - $line->qty == $level) ) // Si on tombe sur un sous-total, il faut que ce soit un du même niveau que le titre |
|
| 485 | + elseif ($add_line && $line->product_type == 9 && (100 - $line->qty == $level)) // Si on tombe sur un sous-total, il faut que ce soit un du même niveau que le titre |
|
| 486 | 486 | { |
| 487 | 487 | if ($withBlockLine) $TLine[] = $line; |
| 488 | 488 | break; |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | |
| 491 | 491 | if ($add_line) |
| 492 | 492 | { |
| 493 | - if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line)) ) continue; |
|
| 493 | + if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line))) continue; |
|
| 494 | 494 | else $TLine[] = $line; |
| 495 | 495 | } |
| 496 | 496 | } |
@@ -499,12 +499,12 @@ discard block |
||
| 499 | 499 | return $TLine; |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | - public static function getLinesFromTitleId(&$object, $lineid, $withBlockLine=false) |
|
| 502 | + public static function getLinesFromTitleId(&$object, $lineid, $withBlockLine = false) |
|
| 503 | 503 | { |
| 504 | 504 | return self::getLinesFromTitle($object, $lineid, '', '', $withBlockLine, true); |
| 505 | 505 | } |
| 506 | 506 | |
| 507 | - public static function doUpdateLine(&$object, $rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $type, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $situation_percent=0, $fk_unit = null) |
|
| 507 | + public static function doUpdateLine(&$object, $rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $type, $txlocaltax1 = 0, $txlocaltax2 = 0, $price_base_type = 'HT', $info_bits = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $situation_percent = 0, $fk_unit = null) |
|
| 508 | 508 | { |
| 509 | 509 | $res = 0; |
| 510 | 510 | $object->db->begin(); |
@@ -529,9 +529,9 @@ discard block |
||
| 529 | 529 | $factureRecLine->fetch($rowid); |
| 530 | 530 | $factureRecLine->array_options = $array_options; |
| 531 | 531 | $factureRecLine->insertExtraFields(); |
| 532 | - $rang=$factureRecLine->rang; |
|
| 532 | + $rang = $factureRecLine->rang; |
|
| 533 | 533 | |
| 534 | - $fk_product=0; $fk_remise_except=''; $pu_ttc=0; |
|
| 534 | + $fk_product = 0; $fk_remise_except = ''; $pu_ttc = 0; |
|
| 535 | 535 | $res = $object->updateline($rowid, $desc, $pu, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $price_base_type, $info_bits, $fk_remise_except, $pu_ttc, $type, $rang, $special_code, $label, $fk_unit); |
| 536 | 536 | break; |
| 537 | 537 | } |
@@ -547,7 +547,7 @@ discard block |
||
| 547 | 547 | global $db, $object; |
| 548 | 548 | |
| 549 | 549 | $TTitle = array(); |
| 550 | - if(! empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {} |
|
| 550 | + if (!empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {} |
|
| 551 | 551 | else { |
| 552 | 552 | if ($origin_line->element == 'propaldet') |
| 553 | 553 | { |
@@ -627,7 +627,7 @@ discard block |
||
| 627 | 627 | */ |
| 628 | 628 | public static function addRecapPage(&$parameters, &$origin_pdf) |
| 629 | 629 | { |
| 630 | - global $user,$conf,$langs; |
|
| 630 | + global $user, $conf, $langs; |
|
| 631 | 631 | |
| 632 | 632 | $origin_file = $parameters['file']; |
| 633 | 633 | $outputlangs = $parameters['outputlangs']; |
@@ -643,21 +643,21 @@ discard block |
||
| 643 | 643 | $objmarge->marge_droite = 10; |
| 644 | 644 | |
| 645 | 645 | $objectref = dol_sanitizeFileName($object->ref); |
| 646 | - if ($object->element == 'propal') $dir = $conf->propal->dir_output . '/' . $objectref; |
|
| 647 | - elseif ($object->element == 'commande') $dir = $conf->commande->dir_output . '/' . $objectref; |
|
| 648 | - elseif ($object->element == 'facture') $dir = $conf->facture->dir_output . '/' . $objectref; |
|
| 646 | + if ($object->element == 'propal') $dir = $conf->propal->dir_output.'/'.$objectref; |
|
| 647 | + elseif ($object->element == 'commande') $dir = $conf->commande->dir_output.'/'.$objectref; |
|
| 648 | + elseif ($object->element == 'facture') $dir = $conf->facture->dir_output.'/'.$objectref; |
|
| 649 | 649 | elseif ($object->element == 'facturerec') return; // no PDF for facturerec |
| 650 | 650 | else |
| 651 | 651 | { |
| 652 | 652 | setEventMessage($langs->trans('warning_subtotal_recap_object_element_unknown', $object->element), 'warnings'); |
| 653 | 653 | return -1; |
| 654 | 654 | } |
| 655 | - $file = $dir . '/' . $objectref . '_recap.pdf'; |
|
| 655 | + $file = $dir.'/'.$objectref.'_recap.pdf'; |
|
| 656 | 656 | |
| 657 | 657 | // $pdf=pdf_getInstance($origin_pdf->format); |
| 658 | - $pdf=pdf_getInstance(array(210, 297)); // Format A4 Portrait |
|
| 659 | - $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
| 660 | - $pdf->SetAutoPageBreak(1,0); |
|
| 658 | + $pdf = pdf_getInstance(array(210, 297)); // Format A4 Portrait |
|
| 659 | + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
| 660 | + $pdf->SetAutoPageBreak(1, 0); |
|
| 661 | 661 | |
| 662 | 662 | if (class_exists('TCPDF')) |
| 663 | 663 | { |
@@ -666,49 +666,49 @@ discard block |
||
| 666 | 666 | } |
| 667 | 667 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
| 668 | 668 | // Set path to the background PDF File |
| 669 | - if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
| 669 | + if (empty($conf->global->MAIN_DISABLE_FPDI) && !empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
| 670 | 670 | { |
| 671 | 671 | $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); |
| 672 | 672 | $tplidx = $pdf->importPage(1); |
| 673 | 673 | } |
| 674 | 674 | |
| 675 | 675 | $pdf->Open(); |
| 676 | - $pagenb=0; |
|
| 677 | - $pdf->SetDrawColor(128,128,128); |
|
| 676 | + $pagenb = 0; |
|
| 677 | + $pdf->SetDrawColor(128, 128, 128); |
|
| 678 | 678 | |
| 679 | 679 | $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); |
| 680 | 680 | $pdf->SetSubject($outputlangs->transnoentities("subtotalRecap")); |
| 681 | 681 | $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
| 682 | 682 | $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
| 683 | 683 | $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("subtotalRecap")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); |
| 684 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 684 | + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 685 | 685 | |
| 686 | - $pdf->SetMargins($objmarge->marge_gauche, $objmarge->marge_haute, $objmarge->marge_droite); // Left, Top, Right |
|
| 686 | + $pdf->SetMargins($objmarge->marge_gauche, $objmarge->marge_haute, $objmarge->marge_droite); // Left, Top, Right |
|
| 687 | 687 | |
| 688 | - $pagenb=0; |
|
| 689 | - $pdf->SetDrawColor(128,128,128); |
|
| 688 | + $pagenb = 0; |
|
| 689 | + $pdf->SetDrawColor(128, 128, 128); |
|
| 690 | 690 | |
| 691 | 691 | |
| 692 | 692 | // New page |
| 693 | 693 | $pdf->AddPage(); |
| 694 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 694 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 695 | 695 | $pagenb++; |
| 696 | 696 | |
| 697 | 697 | |
| 698 | 698 | self::pagehead($objmarge, $pdf, $object, 1, $outputlangs); |
| 699 | - $pdf->SetFont('','', $default_font_size - 1); |
|
| 700 | - $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
| 701 | - $pdf->SetTextColor(0,0,0); |
|
| 699 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 700 | + $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
| 701 | + $pdf->SetTextColor(0, 0, 0); |
|
| 702 | 702 | |
| 703 | - $heightforinfotot = 25; // Height reserved to output the info and total part |
|
| 704 | - $heightforfooter = $objmarge->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
| 703 | + $heightforinfotot = 25; // Height reserved to output the info and total part |
|
| 704 | + $heightforfooter = $objmarge->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
| 705 | 705 | |
| 706 | 706 | $posx_designation = 25; |
| 707 | 707 | $posx_options = 150; |
| 708 | 708 | $posx_montant = 170; |
| 709 | 709 | |
| 710 | 710 | $tab_top = 72; |
| 711 | - $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?72:20); // TODO à vérifier |
|
| 711 | + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 72 : 20); // TODO à vérifier |
|
| 712 | 712 | |
| 713 | 713 | $TTot = array('total_ht' => 0, 'total_ttc' => 0, 'TTotal_tva' => array()); |
| 714 | 714 | |
@@ -722,14 +722,14 @@ discard block |
||
| 722 | 722 | $nexY = $tab_top + 10; |
| 723 | 723 | |
| 724 | 724 | $nblignes = count($TLine); |
| 725 | - foreach($TLine as $i => &$line) |
|
| 725 | + foreach ($TLine as $i => &$line) |
|
| 726 | 726 | { |
| 727 | 727 | $curY = $nexY; |
| 728 | 728 | |
| 729 | 729 | if (self::getNiveau($line) == 1) |
| 730 | 730 | { |
| 731 | - $pdf->SetFont('','B', $default_font_size - 1); // Into loop to work with multipage |
|
| 732 | - $curY+=2; |
|
| 731 | + $pdf->SetFont('', 'B', $default_font_size - 1); // Into loop to work with multipage |
|
| 732 | + $curY += 2; |
|
| 733 | 733 | |
| 734 | 734 | $TTot['total_ht'] += $line->total_ht; |
| 735 | 735 | $TTot['total_tva'] += $line->total_tva; |
@@ -748,67 +748,67 @@ discard block |
||
| 748 | 748 | $TTot['TTotal_tva_multicurrency'][$tx] += $amount; |
| 749 | 749 | } |
| 750 | 750 | } |
| 751 | - else $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage |
|
| 751 | + else $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage |
|
| 752 | 752 | |
| 753 | - $pdf->SetTextColor(0,0,0); |
|
| 753 | + $pdf->SetTextColor(0, 0, 0); |
|
| 754 | 754 | |
| 755 | 755 | $pdf->setTopMargin($tab_top_newpage + 10); |
| 756 | - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
|
| 757 | - $pageposbefore=$pdf->getPage(); |
|
| 756 | + $pdf->setPageOrientation('', 1, $heightforfooter + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
|
| 757 | + $pageposbefore = $pdf->getPage(); |
|
| 758 | 758 | |
| 759 | - $showpricebeforepagebreak=1; |
|
| 759 | + $showpricebeforepagebreak = 1; |
|
| 760 | 760 | |
| 761 | 761 | $decalage = (self::getNiveau($line) - 1) * 2; |
| 762 | 762 | |
| 763 | 763 | // Print: Designation |
| 764 | 764 | $label = $line->label; |
| 765 | - if( (float)DOL_VERSION < 6 ) { |
|
| 765 | + if ((float) DOL_VERSION < 6) { |
|
| 766 | 766 | $label = !empty($line->label) ? $line->label : $line->desc; |
| 767 | 767 | } |
| 768 | 768 | |
| 769 | 769 | |
| 770 | 770 | $pdf->startTransaction(); |
| 771 | - $pdf->writeHTMLCell($posx_options-$posx_designation-$decalage, 3, $posx_designation+$decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J',true); |
|
| 772 | - $pageposafter=$pdf->getPage(); |
|
| 771 | + $pdf->writeHTMLCell($posx_options - $posx_designation - $decalage, 3, $posx_designation + $decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J', true); |
|
| 772 | + $pageposafter = $pdf->getPage(); |
|
| 773 | 773 | if ($pageposafter > $pageposbefore) // There is a pagebreak |
| 774 | 774 | { |
| 775 | 775 | $pdf->rollbackTransaction(true); |
| 776 | - $pageposafter=$pageposbefore; |
|
| 776 | + $pageposafter = $pageposbefore; |
|
| 777 | 777 | //print $pageposafter.'-'.$pageposbefore;exit; |
| 778 | - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
| 779 | - $pdf->writeHTMLCell($posx_options-$posx_designation-$decalage, 3, $posx_designation+$decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J',true); |
|
| 778 | + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
| 779 | + $pdf->writeHTMLCell($posx_options - $posx_designation - $decalage, 3, $posx_designation + $decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J', true); |
|
| 780 | 780 | |
| 781 | - $pageposafter=$pdf->getPage(); |
|
| 782 | - $posyafter=$pdf->GetY(); |
|
| 781 | + $pageposafter = $pdf->getPage(); |
|
| 782 | + $posyafter = $pdf->GetY(); |
|
| 783 | 783 | //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; |
| 784 | - if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter+$heightforinfotot))) // There is no space left for total+free text |
|
| 784 | + if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter + $heightforinfotot))) // There is no space left for total+free text |
|
| 785 | 785 | { |
| 786 | - if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page |
|
| 786 | + if ($i == ($nblignes - 1)) // No more lines, and no space left to show total, so we create a new page |
|
| 787 | 787 | { |
| 788 | - $pdf->AddPage('','',true); |
|
| 789 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 788 | + $pdf->AddPage('', '', true); |
|
| 789 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 790 | 790 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
| 791 | - $pdf->setPage($pageposafter+1); |
|
| 791 | + $pdf->setPage($pageposafter + 1); |
|
| 792 | 792 | } |
| 793 | 793 | } |
| 794 | 794 | else |
| 795 | 795 | { |
| 796 | 796 | // We found a page break |
| 797 | - $showpricebeforepagebreak=0; |
|
| 797 | + $showpricebeforepagebreak = 0; |
|
| 798 | 798 | } |
| 799 | 799 | } |
| 800 | 800 | else // No pagebreak |
| 801 | 801 | { |
| 802 | 802 | $pdf->commitTransaction(); |
| 803 | 803 | } |
| 804 | - $posYAfterDescription=$pdf->GetY(); |
|
| 804 | + $posYAfterDescription = $pdf->GetY(); |
|
| 805 | 805 | |
| 806 | 806 | $nexY = $pdf->GetY(); |
| 807 | - $pageposafter=$pdf->getPage(); |
|
| 807 | + $pageposafter = $pdf->getPage(); |
|
| 808 | 808 | |
| 809 | 809 | $pdf->setPage($pageposbefore); |
| 810 | 810 | $pdf->setTopMargin($objmarge->marge_haute); |
| 811 | - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
| 811 | + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
| 812 | 812 | |
| 813 | 813 | // We suppose that a too long description or photo were moved completely on next page |
| 814 | 814 | if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { |
@@ -821,14 +821,14 @@ discard block |
||
| 821 | 821 | if (!empty($line->total_options)) |
| 822 | 822 | { |
| 823 | 823 | $pdf->SetXY($posx_options, $curY); |
| 824 | - $pdf->MultiCell($posx_montant-$posx_options-0.8, 3, price($line->total_options, 0, $outputlangs), 0, 'R', 0); |
|
| 824 | + $pdf->MultiCell($posx_montant - $posx_options - 0.8, 3, price($line->total_options, 0, $outputlangs), 0, 'R', 0); |
|
| 825 | 825 | } |
| 826 | 826 | |
| 827 | 827 | // Print: Montant |
| 828 | 828 | $pdf->SetXY($posx_montant, $curY); |
| 829 | - $pdf->MultiCell($objmarge->page_largeur-$objmarge->marge_droite-$posx_montant-0.8, 3, price($line->total_ht, 0, $outputlangs), 0, 'R', 0); |
|
| 829 | + $pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant - 0.8, 3, price($line->total_ht, 0, $outputlangs), 0, 'R', 0); |
|
| 830 | 830 | |
| 831 | - $nexY+=2; // Passe espace entre les lignes |
|
| 831 | + $nexY += 2; // Passe espace entre les lignes |
|
| 832 | 832 | |
| 833 | 833 | // Detect if some page were added automatically and output _tableau for past pages |
| 834 | 834 | while ($pagenb < $pageposafter) |
@@ -845,7 +845,7 @@ discard block |
||
| 845 | 845 | |
| 846 | 846 | $pagenb++; |
| 847 | 847 | $pdf->setPage($pagenb); |
| 848 | - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
| 848 | + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
| 849 | 849 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
| 850 | 850 | } |
| 851 | 851 | } |
@@ -855,19 +855,19 @@ discard block |
||
| 855 | 855 | if ($pagenb == 1) |
| 856 | 856 | { |
| 857 | 857 | self::tableau($objmarge, $pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $objmarge->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code); |
| 858 | - $bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
|
| 858 | + $bottomlasttab = $objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
|
| 859 | 859 | } |
| 860 | 860 | else |
| 861 | 861 | { |
| 862 | 862 | self::tableau($objmarge, $pdf, $posx_designation, $posx_options, $posx_montant, $tab_top_newpage, $objmarge->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code); |
| 863 | - $bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
|
| 863 | + $bottomlasttab = $objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
|
| 864 | 864 | } |
| 865 | 865 | |
| 866 | 866 | // Affiche zone totaux |
| 867 | - $posy=self::tableau_tot($objmarge, $pdf, $object, $bottomlasttab, $outputlangs, $TTot); |
|
| 867 | + $posy = self::tableau_tot($objmarge, $pdf, $object, $bottomlasttab, $outputlangs, $TTot); |
|
| 868 | 868 | |
| 869 | 869 | $pdf->Close(); |
| 870 | - $pdf->Output($file,'F'); |
|
| 870 | + $pdf->Output($file, 'F'); |
|
| 871 | 871 | |
| 872 | 872 | $pagecount = self::concat($outputlangs, array($origin_file, $file), $origin_file); |
| 873 | 873 | |
@@ -879,7 +879,7 @@ discard block |
||
| 879 | 879 | $level = $line->qty; // TODO à améliorer |
| 880 | 880 | |
| 881 | 881 | $pdf->SetXY($objmarge->marge_gauche, $curY); |
| 882 | - $pdf->MultiCell($posx_designation-$objmarge->marge_gauche-0.8, 5, $level, 0, 'L', 0); |
|
| 882 | + $pdf->MultiCell($posx_designation - $objmarge->marge_gauche - 0.8, 5, $level, 0, 'L', 0); |
|
| 883 | 883 | } |
| 884 | 884 | |
| 885 | 885 | /** |
@@ -893,50 +893,50 @@ discard block |
||
| 893 | 893 | */ |
| 894 | 894 | private static function pagehead(&$objmarge, &$pdf, &$object, $showdetail, $outputlangs) |
| 895 | 895 | { |
| 896 | - global $conf,$mysoc; |
|
| 896 | + global $conf, $mysoc; |
|
| 897 | 897 | |
| 898 | 898 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
| 899 | 899 | |
| 900 | - pdf_pagehead($pdf,$outputlangs,$objmarge->page_hauteur); |
|
| 900 | + pdf_pagehead($pdf, $outputlangs, $objmarge->page_hauteur); |
|
| 901 | 901 | |
| 902 | - $pdf->SetTextColor(0,0,60); |
|
| 903 | - $pdf->SetFont('','B', $default_font_size + 3); |
|
| 902 | + $pdf->SetTextColor(0, 0, 60); |
|
| 903 | + $pdf->SetFont('', 'B', $default_font_size + 3); |
|
| 904 | 904 | |
| 905 | - $posy=$objmarge->marge_haute; |
|
| 906 | - $posx=$objmarge->page_largeur-$objmarge->marge_droite-100; |
|
| 905 | + $posy = $objmarge->marge_haute; |
|
| 906 | + $posx = $objmarge->page_largeur - $objmarge->marge_droite - 100; |
|
| 907 | 907 | |
| 908 | - $pdf->SetXY($objmarge->marge_gauche,$posy); |
|
| 908 | + $pdf->SetXY($objmarge->marge_gauche, $posy); |
|
| 909 | 909 | |
| 910 | - $logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo; |
|
| 910 | + $logo = $conf->mycompany->dir_output.'/logos/'.$mysoc->logo; |
|
| 911 | 911 | if ($mysoc->logo) |
| 912 | 912 | { |
| 913 | 913 | if (is_readable($logo)) |
| 914 | 914 | { |
| 915 | - $height=pdf_getHeightForLogo($logo); |
|
| 916 | - $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
| 915 | + $height = pdf_getHeightForLogo($logo); |
|
| 916 | + $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
| 917 | 917 | } |
| 918 | 918 | else |
| 919 | 919 | { |
| 920 | - $pdf->SetTextColor(200,0,0); |
|
| 921 | - $pdf->SetFont('','B',$default_font_size - 2); |
|
| 922 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L'); |
|
| 920 | + $pdf->SetTextColor(200, 0, 0); |
|
| 921 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
| 922 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); |
|
| 923 | 923 | $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); |
| 924 | 924 | } |
| 925 | 925 | |
| 926 | - $posy+=35; |
|
| 926 | + $posy += 35; |
|
| 927 | 927 | } |
| 928 | 928 | else |
| 929 | 929 | { |
| 930 | - $text=$mysoc->name; |
|
| 930 | + $text = $mysoc->name; |
|
| 931 | 931 | $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); |
| 932 | 932 | |
| 933 | - $posy+=15; |
|
| 933 | + $posy += 15; |
|
| 934 | 934 | } |
| 935 | 935 | |
| 936 | 936 | |
| 937 | - $pdf->SetTextColor(0,0,0); |
|
| 938 | - $pdf->SetFont('','B', $default_font_size + 2); |
|
| 939 | - $pdf->SetXY($objmarge->marge_gauche,$posy); |
|
| 937 | + $pdf->SetTextColor(0, 0, 0); |
|
| 938 | + $pdf->SetFont('', 'B', $default_font_size + 2); |
|
| 939 | + $pdf->SetXY($objmarge->marge_gauche, $posy); |
|
| 940 | 940 | |
| 941 | 941 | $key = 'subtotalPropalTitle'; |
| 942 | 942 | if ($object->element == 'commande') $key = 'subtotalCommandeTitle'; |
@@ -945,14 +945,14 @@ discard block |
||
| 945 | 945 | |
| 946 | 946 | $pdf->MultiCell(150, 4, $outputlangs->transnoentities($key, $object->ref, $object->thirdparty->name), '', 'L'); |
| 947 | 947 | |
| 948 | - $pdf->SetFont('','', $default_font_size); |
|
| 949 | - $pdf->SetXY($objmarge->page_largeur-$objmarge->marge_droite-40,$posy); |
|
| 948 | + $pdf->SetFont('', '', $default_font_size); |
|
| 949 | + $pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - 40, $posy); |
|
| 950 | 950 | $pdf->MultiCell(40, 4, dol_print_date($object->date, 'daytext'), '', 'R'); |
| 951 | 951 | |
| 952 | 952 | $posy += 8; |
| 953 | 953 | |
| 954 | - $pdf->SetFont('','B', $default_font_size + 2); |
|
| 955 | - $pdf->SetXY($objmarge->marge_gauche,$posy); |
|
| 954 | + $pdf->SetFont('', 'B', $default_font_size + 2); |
|
| 955 | + $pdf->SetXY($objmarge->marge_gauche, $posy); |
|
| 956 | 956 | $pdf->MultiCell(70, 4, $outputlangs->transnoentities('subtotalRecapLot'), '', 'L'); |
| 957 | 957 | |
| 958 | 958 | } |
@@ -970,44 +970,44 @@ discard block |
||
| 970 | 970 | * @param string $currency Currency code |
| 971 | 971 | * @return void |
| 972 | 972 | */ |
| 973 | - private static function tableau(&$objmarge, &$pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='') |
|
| 973 | + private static function tableau(&$objmarge, &$pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '') |
|
| 974 | 974 | { |
| 975 | 975 | global $conf; |
| 976 | 976 | |
| 977 | 977 | // Force to disable hidetop and hidebottom |
| 978 | - $hidebottom=0; |
|
| 979 | - if ($hidetop) $hidetop=-1; |
|
| 978 | + $hidebottom = 0; |
|
| 979 | + if ($hidetop) $hidetop = -1; |
|
| 980 | 980 | |
| 981 | 981 | $currency = !empty($currency) ? $currency : $conf->currency; |
| 982 | 982 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
| 983 | 983 | |
| 984 | 984 | // Amount in (at tab_top - 1) |
| 985 | - $pdf->SetTextColor(0,0,0); |
|
| 986 | - $pdf->SetFont('','',$default_font_size); |
|
| 985 | + $pdf->SetTextColor(0, 0, 0); |
|
| 986 | + $pdf->SetFont('', '', $default_font_size); |
|
| 987 | 987 | |
| 988 | 988 | if (empty($hidetop)) |
| 989 | 989 | { |
| 990 | - $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$currency)); |
|
| 991 | - $pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4.5); |
|
| 990 | + $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency)); |
|
| 991 | + $pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4.5); |
|
| 992 | 992 | $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); |
| 993 | 993 | |
| 994 | - if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur-$objmarge->marge_droite-$objmarge->marge_gauche, 8, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); |
|
| 994 | + if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur - $objmarge->marge_droite - $objmarge->marge_gauche, 8, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); |
|
| 995 | 995 | |
| 996 | 996 | |
| 997 | - $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 |
|
| 997 | + $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 |
|
| 998 | 998 | |
| 999 | - $pdf->SetXY($posx_designation, $tab_top+2); |
|
| 1000 | - $pdf->MultiCell($posx_options - $posx_designation,2, $outputlangs->transnoentities("Designation"),'','L'); |
|
| 1001 | - $pdf->SetXY($posx_options, $tab_top+2); |
|
| 1002 | - $pdf->MultiCell($posx_montant - $posx_options,2, $outputlangs->transnoentities("Options"),'','R'); |
|
| 1003 | - $pdf->SetXY($posx_montant, $tab_top+2); |
|
| 1004 | - $pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant,2, $outputlangs->transnoentities("Amount"),'','R'); |
|
| 999 | + $pdf->SetXY($posx_designation, $tab_top + 2); |
|
| 1000 | + $pdf->MultiCell($posx_options - $posx_designation, 2, $outputlangs->transnoentities("Designation"), '', 'L'); |
|
| 1001 | + $pdf->SetXY($posx_options, $tab_top + 2); |
|
| 1002 | + $pdf->MultiCell($posx_montant - $posx_options, 2, $outputlangs->transnoentities("Options"), '', 'R'); |
|
| 1003 | + $pdf->SetXY($posx_montant, $tab_top + 2); |
|
| 1004 | + $pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant, 2, $outputlangs->transnoentities("Amount"), '', 'R'); |
|
| 1005 | 1005 | |
| 1006 | - $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 |
|
| 1006 | + $pdf->line($objmarge->marge_gauche, $tab_top + 8, $objmarge->page_largeur - $objmarge->marge_droite, $tab_top + 8); // line prend une position y en 2eme param et 4eme param |
|
| 1007 | 1007 | } |
| 1008 | 1008 | else |
| 1009 | 1009 | { |
| 1010 | - $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 |
|
| 1010 | + $pdf->line($objmarge->marge_gauche, $tab_top - 2, $objmarge->page_largeur - $objmarge->marge_droite, $tab_top - 2); // line prend une position y en 2eme param et 4eme param |
|
| 1011 | 1011 | } |
| 1012 | 1012 | |
| 1013 | 1013 | } |
@@ -1016,29 +1016,29 @@ discard block |
||
| 1016 | 1016 | { |
| 1017 | 1017 | global $conf; |
| 1018 | 1018 | |
| 1019 | - $pdf->line($objmarge->marge_gauche, $posy, $objmarge->page_largeur-$objmarge->marge_droite, $posy); // line prend une position y en 2eme param et 4eme param |
|
| 1019 | + $pdf->line($objmarge->marge_gauche, $posy, $objmarge->page_largeur - $objmarge->marge_droite, $posy); // line prend une position y en 2eme param et 4eme param |
|
| 1020 | 1020 | |
| 1021 | 1021 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
| 1022 | 1022 | |
| 1023 | - $tab2_top = $posy+2; |
|
| 1023 | + $tab2_top = $posy + 2; |
|
| 1024 | 1024 | $tab2_hl = 4; |
| 1025 | - $pdf->SetFont('','', $default_font_size - 1); |
|
| 1025 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
| 1026 | 1026 | |
| 1027 | 1027 | // Tableau total |
| 1028 | 1028 | $col1x = 120; $col2x = 170; |
| 1029 | 1029 | if ($objmarge->page_largeur < 210) // To work with US executive format |
| 1030 | 1030 | { |
| 1031 | - $col2x-=20; |
|
| 1031 | + $col2x -= 20; |
|
| 1032 | 1032 | } |
| 1033 | 1033 | $largcol2 = ($objmarge->page_largeur - $objmarge->marge_droite - $col2x); |
| 1034 | 1034 | |
| 1035 | - $useborder=0; |
|
| 1035 | + $useborder = 0; |
|
| 1036 | 1036 | $index = 0; |
| 1037 | 1037 | |
| 1038 | 1038 | // Total HT |
| 1039 | - $pdf->SetFillColor(255,255,255); |
|
| 1039 | + $pdf->SetFillColor(255, 255, 255); |
|
| 1040 | 1040 | $pdf->SetXY($col1x, $tab2_top + 0); |
| 1041 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); |
|
| 1041 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); |
|
| 1042 | 1042 | |
| 1043 | 1043 | // $total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1) ? $TTot['multicurrency_total_ht'] : $TTot['total_ht']; |
| 1044 | 1044 | $total_ht = $TTot['total_ht']; |
@@ -1046,10 +1046,10 @@ discard block |
||
| 1046 | 1046 | $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht, 0, $outputlangs), 0, 'R', 1); |
| 1047 | 1047 | |
| 1048 | 1048 | // Show VAT by rates and total |
| 1049 | - $pdf->SetFillColor(248,248,248); |
|
| 1049 | + $pdf->SetFillColor(248, 248, 248); |
|
| 1050 | 1050 | |
| 1051 | - $atleastoneratenotnull=0; |
|
| 1052 | - foreach($TTot['TTotal_tva'] as $tvakey => $tvaval) |
|
| 1051 | + $atleastoneratenotnull = 0; |
|
| 1052 | + foreach ($TTot['TTotal_tva'] as $tvakey => $tvaval) |
|
| 1053 | 1053 | { |
| 1054 | 1054 | if ($tvakey != 0) // On affiche pas taux 0 |
| 1055 | 1055 | { |
@@ -1058,15 +1058,15 @@ discard block |
||
| 1058 | 1058 | $index++; |
| 1059 | 1059 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 1060 | 1060 | |
| 1061 | - $tvacompl=''; |
|
| 1062 | - if (preg_match('/\*/',$tvakey)) |
|
| 1061 | + $tvacompl = ''; |
|
| 1062 | + if (preg_match('/\*/', $tvakey)) |
|
| 1063 | 1063 | { |
| 1064 | - $tvakey=str_replace('*','',$tvakey); |
|
| 1064 | + $tvakey = str_replace('*', '', $tvakey); |
|
| 1065 | 1065 | $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; |
| 1066 | 1066 | } |
| 1067 | - $totalvat =$outputlangs->transnoentities("TotalVAT").' '; |
|
| 1068 | - $totalvat.=vatrate($tvakey,1).$tvacompl; |
|
| 1069 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 1067 | + $totalvat = $outputlangs->transnoentities("TotalVAT").' '; |
|
| 1068 | + $totalvat .= vatrate($tvakey, 1).$tvacompl; |
|
| 1069 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
| 1070 | 1070 | |
| 1071 | 1071 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 1072 | 1072 | $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); |
@@ -1076,16 +1076,16 @@ discard block |
||
| 1076 | 1076 | // Total TTC |
| 1077 | 1077 | $index++; |
| 1078 | 1078 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
| 1079 | - $pdf->SetTextColor(0,0,60); |
|
| 1080 | - $pdf->SetFillColor(224,224,224); |
|
| 1081 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); |
|
| 1079 | + $pdf->SetTextColor(0, 0, 60); |
|
| 1080 | + $pdf->SetFillColor(224, 224, 224); |
|
| 1081 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); |
|
| 1082 | 1082 | |
| 1083 | 1083 | // $total_ttc = ($conf->multicurrency->enabled && $object->multiccurency_tx != 1) ? $TTot['multicurrency_total_ttc'] : $TTot['total_ttc']; |
| 1084 | 1084 | $total_ttc = $TTot['total_ttc']; |
| 1085 | 1085 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
| 1086 | 1086 | $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc, 0, $outputlangs), $useborder, 'R', 1); |
| 1087 | 1087 | |
| 1088 | - $pdf->SetTextColor(0,0,0); |
|
| 1088 | + $pdf->SetTextColor(0, 0, 0); |
|
| 1089 | 1089 | |
| 1090 | 1090 | $index++; |
| 1091 | 1091 | return ($tab2_top + ($tab2_hl * $index)); |
@@ -1104,22 +1104,22 @@ discard block |
||
| 1104 | 1104 | * @param int $hidebottom Hide bottom |
| 1105 | 1105 | * @return void |
| 1106 | 1106 | */ |
| 1107 | - private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0) |
|
| 1107 | + private static function printRect($pdf, $x, $y, $l, $h, $hidetop = 0, $hidebottom = 0) |
|
| 1108 | 1108 | { |
| 1109 | - if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); |
|
| 1110 | - $pdf->line($x+$l, $y, $x+$l, $y+$h); |
|
| 1111 | - if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
| 1112 | - $pdf->line($x, $y+$h, $x, $y); |
|
| 1109 | + if (empty($hidetop) || $hidetop == -1) $pdf->line($x, $y, $x + $l, $y); |
|
| 1110 | + $pdf->line($x + $l, $y, $x + $l, $y + $h); |
|
| 1111 | + if (empty($hidebottom)) $pdf->line($x + $l, $y + $h, $x, $y + $h); |
|
| 1112 | + $pdf->line($x, $y + $h, $x, $y); |
|
| 1113 | 1113 | } |
| 1114 | 1114 | |
| 1115 | 1115 | |
| 1116 | - public static function concat(&$outputlangs, $files, $fileoutput='') |
|
| 1116 | + public static function concat(&$outputlangs, $files, $fileoutput = '') |
|
| 1117 | 1117 | { |
| 1118 | 1118 | global $conf; |
| 1119 | 1119 | |
| 1120 | 1120 | if (empty($fileoutput)) $fileoutput = $file[0]; |
| 1121 | 1121 | |
| 1122 | - $pdf=pdf_getInstance(); |
|
| 1122 | + $pdf = pdf_getInstance(); |
|
| 1123 | 1123 | if (class_exists('TCPDF')) |
| 1124 | 1124 | { |
| 1125 | 1125 | $pdf->setPrintHeader(false); |
@@ -1127,10 +1127,10 @@ discard block |
||
| 1127 | 1127 | } |
| 1128 | 1128 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
| 1129 | 1129 | |
| 1130 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 1130 | + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 1131 | 1131 | |
| 1132 | 1132 | |
| 1133 | - foreach($files as $file) |
|
| 1133 | + foreach ($files as $file) |
|
| 1134 | 1134 | { |
| 1135 | 1135 | $pagecount = $pdf->setSourceFile($file); |
| 1136 | 1136 | for ($i = 1; $i <= $pagecount; $i++) |
@@ -1142,8 +1142,8 @@ discard block |
||
| 1142 | 1142 | } |
| 1143 | 1143 | } |
| 1144 | 1144 | |
| 1145 | - $pdf->Output($fileoutput,'F'); |
|
| 1146 | - if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
| 1145 | + $pdf->Output($fileoutput, 'F'); |
|
| 1146 | + if (!empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
| 1147 | 1147 | |
| 1148 | 1148 | return $pagecount; |
| 1149 | 1149 | } |
@@ -1156,7 +1156,7 @@ discard block |
||
| 1156 | 1156 | */ |
| 1157 | 1157 | public static function hasNcTitle(&$line) |
| 1158 | 1158 | { |
| 1159 | - if(isset($line->has_nc_title)) return $line->has_nc_title; |
|
| 1159 | + if (isset($line->has_nc_title)) return $line->has_nc_title; |
|
| 1160 | 1160 | |
| 1161 | 1161 | $TTitle = self::getAllTitleFromLine($line); |
| 1162 | 1162 | foreach ($TTitle as &$line_title) |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * \ingroup titre |
| 24 | 24 | * \brief Description and activation file for module titre |
| 25 | 25 | */ |
| 26 | -include_once DOL_DOCUMENT_ROOT . "/core/modules/DolibarrModules.class.php"; |
|
| 26 | +include_once DOL_DOCUMENT_ROOT."/core/modules/DolibarrModules.class.php"; |
|
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * Description and activation class for module titre |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | $this->version = '3.0.1'; |
| 67 | 67 | // Key used in llx_const table to save module status enabled/disabled |
| 68 | 68 | // (where MYMODULE is value of property name of module in uppercase) |
| 69 | - $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); |
|
| 69 | + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
| 70 | 70 | // Where to store the module in setup page |
| 71 | 71 | // (0=common,1=interface,2=others,3=very specific) |
| 72 | 72 | $this->special = 2; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | // Set this to relative path of css if module has its own css file |
| 97 | 97 | //'css' => '/titre/css/mycss.css.php', |
| 98 | 98 | // Set here all hooks context managed by module |
| 99 | - 'hooks' => array('invoicecard','propalcard','ordercard','odtgeneration','orderstoinvoice','admin','invoicereccard') |
|
| 99 | + 'hooks' => array('invoicecard', 'propalcard', 'ordercard', 'odtgeneration', 'orderstoinvoice', 'admin', 'invoicereccard') |
|
| 100 | 100 | // Set here all workflow context managed by module |
| 101 | 101 | //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE')) |
| 102 | 102 | ); |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | // List of modules id that must be enabled if this module is enabled |
| 114 | 114 | $this->depends = array(); |
| 115 | 115 | |
| 116 | - $this->conflictwith=array('modMilestone'); |
|
| 116 | + $this->conflictwith = array('modMilestone'); |
|
| 117 | 117 | // List of modules id to disable if this one is disabled |
| 118 | 118 | $this->requiredby = array(); |
| 119 | 119 | // Minimum version of PHP required by module |
@@ -178,20 +178,20 @@ discard block |
||
| 178 | 178 | // 'categories_x' to add a tab in category view |
| 179 | 179 | // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
| 180 | 180 | // Dictionnaries |
| 181 | - if (! isset($conf->subtotal->enabled)) { |
|
| 182 | - $conf->subtotal=new stdClass(); |
|
| 181 | + if (!isset($conf->subtotal->enabled)) { |
|
| 182 | + $conf->subtotal = new stdClass(); |
|
| 183 | 183 | $conf->subtotal->enabled = 0; |
| 184 | 184 | } |
| 185 | 185 | $this->dictionaries = array( |
| 186 | 186 | 'langs'=>'subtotal@subtotal', |
| 187 | - 'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor |
|
| 188 | - 'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables |
|
| 189 | - 'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity), // Request to select fields |
|
| 190 | - 'tabsqlsort'=>array('label ASC'), // Sort order |
|
| 191 | - 'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary) |
|
| 192 | - 'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record) |
|
| 193 | - 'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert) |
|
| 194 | - 'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid') |
|
| 187 | + 'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor |
|
| 188 | + 'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables |
|
| 189 | + 'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity), // Request to select fields |
|
| 190 | + 'tabsqlsort'=>array('label ASC'), // Sort order |
|
| 191 | + 'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary) |
|
| 192 | + 'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record) |
|
| 193 | + 'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert) |
|
| 194 | + 'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid') |
|
| 195 | 195 | 'tabcond'=>array($conf->subtotal->enabled) |
| 196 | 196 | ); |
| 197 | 197 | /* Example: |