|
@@ -5,30 +5,30 @@ discard block |
|
|
block discarded – undo |
|
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
|
29
|
|
|
30
|
|
- $TNotElements = array ('invoice_supplier', 'order_supplier'); |
|
31
|
|
- if ((float) DOL_VERSION < 6 || $qty==50 && !in_array($object->element, $TNotElements) ) { |
|
|
30
|
+ $TNotElements = array('invoice_supplier', 'order_supplier'); |
|
|
31
|
+ if ((float) DOL_VERSION < 6 || $qty == 50 && !in_array($object->element, $TNotElements)) { |
|
32
|
32
|
$desc = $label; |
|
33
|
33
|
$label = ''; |
|
34
|
34
|
} |
|
@@ -36,39 +36,39 @@ discard block |
|
|
block discarded – undo |
|
36
|
36
|
/** |
|
37
|
37
|
* @var $object Facture |
|
38
|
38
|
*/ |
|
39
|
|
- if($object->element=='facture') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,$rang, TSubtotal::$module_number, '', 0, 0, null, 0, $label); |
|
|
39
|
+ if ($object->element == 'facture') $res = $object->addline($desc, 0, $qty, 0, 0, 0, 0, 0, '', '', 0, 0, '', 'HT', 0, 9, $rang, TSubtotal::$module_number, '', 0, 0, null, 0, $label); |
|
40
|
40
|
/** |
|
41
|
41
|
* @var $object Facture fournisseur |
|
42
|
42
|
*/ |
|
43
|
|
- else if($object->element=='invoice_supplier') { |
|
|
43
|
+ else if ($object->element == 'invoice_supplier') { |
|
44
|
44
|
$object->special_code = TSubtotal::$module_number; |
|
45
|
|
- if( (float)DOL_VERSION < 6 ) $rang = $object->line_max() + 1; |
|
46
|
|
- $res = $object->addline($label,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); |
|
|
45
|
+ if ((float) DOL_VERSION < 6) $rang = $object->line_max() + 1; |
|
|
46
|
+ $res = $object->addline($label, 0, 0, 0, 0, $qty, 0, 0, '', '', 0, 0, 'HT', 9, $rang); |
|
47
|
47
|
} |
|
48
|
48
|
/** |
|
49
|
49
|
* @var $object Propal |
|
50
|
50
|
*/ |
|
51
|
|
- else if($object->element=='propal') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
|
51
|
+ else if ($object->element == 'propal') $res = $object->addline($desc, 0, $qty, 0, 0, 0, 0, 0, 'HT', 0, 0, 9, $rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
52
|
52
|
/** |
|
53
|
53
|
* @var $object Propal Fournisseur |
|
54
|
54
|
*/ |
|
55
|
|
- else if($object->element=='supplier_proposal') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
|
55
|
+ else if ($object->element == 'supplier_proposal') $res = $object->addline($desc, 0, $qty, 0, 0, 0, 0, 0, 'HT', 0, 0, 9, $rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
56
|
56
|
|
|
57
|
57
|
/** |
|
58
|
58
|
* @var $object Commande |
|
59
|
59
|
*/ |
|
60
|
|
- else if($object->element=='commande') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,$rang, TSubtotal::$module_number, 0, null, 0, $label); |
|
|
60
|
+ else if ($object->element == 'commande') $res = $object->addline($desc, 0, $qty, 0, 0, 0, 0, 0, 0, 0, 'HT', 0, '', '', 9, $rang, TSubtotal::$module_number, 0, null, 0, $label); |
|
61
|
61
|
/** |
|
62
|
62
|
* @var $object Commande fournisseur |
|
63
|
63
|
*/ |
|
64
|
|
- else if($object->element=='order_supplier') { |
|
|
64
|
+ else if ($object->element == 'order_supplier') { |
|
65
|
65
|
$object->special_code = TSubtotal::$module_number; |
|
66
|
|
- $res = $object->addline($label, 0,$qty,0,0,0,0,0,'',0,'HT', 0, 9); |
|
|
66
|
+ $res = $object->addline($label, 0, $qty, 0, 0, 0, 0, 0, '', 0, 'HT', 0, 9); |
|
67
|
67
|
} |
|
68
|
68
|
/** |
|
69
|
69
|
* @var $object Facturerec |
|
70
|
70
|
*/ |
|
71
|
|
- else if($object->element=='facturerec') $res = $object->addline($desc, 0,$qty, 0, 0, 0, 0, 0, 'HT', 0, '', 0, 9, $rang, TSubtotal::$module_number,$label); |
|
|
71
|
+ else if ($object->element == 'facturerec') $res = $object->addline($desc, 0, $qty, 0, 0, 0, 0, 0, 'HT', 0, '', 0, 9, $rang, TSubtotal::$module_number, $label); |
|
72
|
72
|
|
|
73
|
73
|
} |
|
74
|
74
|
|
|
@@ -79,20 +79,20 @@ discard block |
|
|
block discarded – undo |
|
79
|
79
|
|
|
80
|
80
|
public static function generateDoc(&$object) |
|
81
|
81
|
{ |
|
82
|
|
- global $conf,$langs,$db; |
|
|
82
|
+ global $conf, $langs, $db; |
|
83
|
83
|
|
|
84
|
84
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) |
|
85
|
85
|
{ |
|
86
|
|
- $hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); |
|
87
|
|
- $hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); |
|
88
|
|
- $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); |
|
|
86
|
+ $hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); |
|
|
87
|
+ $hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); |
|
|
88
|
+ $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); |
|
89
|
89
|
|
|
90
|
90
|
// Define output language |
|
91
|
91
|
$outputlangs = $langs; |
|
92
|
92
|
$newlang = GETPOST('lang_id', 'alpha'); |
|
93
|
|
- if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) |
|
|
93
|
+ if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) |
|
94
|
94
|
$newlang = !empty($object->client) ? $object->client->default_lang : $object->thirdparty->default_lang; |
|
95
|
|
- if (! empty($newlang)) { |
|
|
95
|
+ if (!empty($newlang)) { |
|
96
|
96
|
$outputlangs = new Translate("", $conf); |
|
97
|
97
|
$outputlangs->setDefaultLang($newlang); |
|
98
|
98
|
} |
|
@@ -106,7 +106,7 @@ discard block |
|
|
block discarded – undo |
|
106
|
106
|
} |
|
107
|
107
|
else |
|
108
|
108
|
{ |
|
109
|
|
- if ($object->element!= 'facturerec') $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
|
109
|
+ if ($object->element != 'facturerec') $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
110
|
110
|
} |
|
111
|
111
|
} |
|
112
|
112
|
} |
|
@@ -118,11 +118,11 @@ discard block |
|
|
block discarded – undo |
|
118
|
118
|
* @param type $rang_start |
|
119
|
119
|
* @param type $move_to |
|
120
|
120
|
*/ |
|
121
|
|
- public static function updateRang(&$object, $rang_start, $move_to=1) |
|
|
121
|
+ public static function updateRang(&$object, $rang_start, $move_to = 1) |
|
122
|
122
|
{ |
|
123
|
123
|
if (!class_exists('GenericObject')) require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php'; |
|
124
|
124
|
|
|
125
|
|
- $row=new GenericObject($object->db); |
|
|
125
|
+ $row = new GenericObject($object->db); |
|
126
|
126
|
$row->table_element_line = $object->table_element_line; |
|
127
|
127
|
$row->fk_element = $object->fk_element; |
|
128
|
128
|
$row->id = $object->id; |
|
@@ -131,7 +131,7 @@ discard block |
|
|
block discarded – undo |
|
131
|
131
|
{ |
|
132
|
132
|
if ($line->rang < $rang_start) continue; |
|
133
|
133
|
|
|
134
|
|
- $row->updateRangOfLine($line->id, $line->rang+$move_to); |
|
|
134
|
+ $row->updateRangOfLine($line->id, $line->rang + $move_to); |
|
135
|
135
|
} |
|
136
|
136
|
} |
|
137
|
137
|
|
|
@@ -160,7 +160,7 @@ discard block |
|
|
block discarded – undo |
|
160
|
160
|
{ |
|
161
|
161
|
if ($rang_to_add != -1) self::updateRang($object, $rang_to_add); |
|
162
|
162
|
|
|
163
|
|
- self::addSubTotalLine($object, $langs->trans('SubTotal'), 100-$title_niveau, $rang_to_add); |
|
|
163
|
+ self::addSubTotalLine($object, $langs->trans('SubTotal'), 100 - $title_niveau, $rang_to_add); |
|
164
|
164
|
|
|
165
|
165
|
$object->lines[] = $object->line; // ajout de la ligne dans le tableau de ligne (Dolibarr ne le fait pas) |
|
166
|
166
|
if ($rang_to_add != -1) |
|
@@ -172,14 +172,14 @@ discard block |
|
|
block discarded – undo |
|
172
|
172
|
} |
|
173
|
173
|
} |
|
174
|
174
|
|
|
175
|
|
- public static function addTitle(&$object, $label, $level, $rang=-1) |
|
|
175
|
+ public static function addTitle(&$object, $label, $level, $rang = -1) |
|
176
|
176
|
{ |
|
177
|
177
|
self::addSubTotalLine($object, $label, $level, $rang); |
|
178
|
178
|
} |
|
179
|
179
|
|
|
180
|
|
- public static function addTotal(&$object, $label, $level, $rang=-1) |
|
|
180
|
+ public static function addTotal(&$object, $label, $level, $rang = -1) |
|
181
|
181
|
{ |
|
182
|
|
- self::addSubTotalLine($object, $label, (100-$level), $rang); |
|
|
182
|
+ self::addSubTotalLine($object, $label, (100 - $level), $rang); |
|
183
|
183
|
} |
|
184
|
184
|
|
|
185
|
185
|
/** |
|
@@ -190,7 +190,7 @@ discard block |
|
|
block discarded – undo |
|
190
|
190
|
* |
|
191
|
191
|
* @return array |
|
192
|
192
|
*/ |
|
193
|
|
- public static function getAllTitleWithoutTotalFromDocument(&$object, $get_block_total=false) |
|
|
193
|
+ public static function getAllTitleWithoutTotalFromDocument(&$object, $get_block_total = false) |
|
194
|
194
|
{ |
|
195
|
195
|
$TTitle = self::getAllTitleFromDocument($object, $get_block_total); |
|
196
|
196
|
|
|
@@ -211,7 +211,7 @@ discard block |
|
|
block discarded – undo |
|
211
|
211
|
* @param boolean $return_rang_on_false si true alors renvoi le rang où devrait ce trouver le sous-total |
|
212
|
212
|
* @return boolean |
|
213
|
213
|
*/ |
|
214
|
|
- public static function titleHasTotalLine(&$object, &$title_line, $strict_mode=false, $return_rang_on_false=false) |
|
|
214
|
+ public static function titleHasTotalLine(&$object, &$title_line, $strict_mode = false, $return_rang_on_false = false) |
|
215
|
215
|
{ |
|
216
|
216
|
if (empty($object->lines) || !is_array($object->lines)) return false; |
|
217
|
217
|
|
|
@@ -237,7 +237,7 @@ discard block |
|
|
block discarded – undo |
|
237
|
237
|
return ($return_rang_on_false) ? -1 : false; |
|
238
|
238
|
} |
|
239
|
239
|
|
|
240
|
|
- public static function getAllTitleFromDocument(&$object, $get_block_total=false) |
|
|
240
|
+ public static function getAllTitleFromDocument(&$object, $get_block_total = false) |
|
241
|
241
|
{ |
|
242
|
242
|
$TRes = array(); |
|
243
|
243
|
if (!empty($object->lines)) |
|
@@ -365,19 +365,19 @@ discard block |
|
|
block discarded – undo |
|
365
|
365
|
return false; |
|
366
|
366
|
} |
|
367
|
367
|
|
|
368
|
|
- public static function isTitle(&$line, $level=-1) |
|
|
368
|
+ public static function isTitle(&$line, $level = -1) |
|
369
|
369
|
{ |
|
370
|
370
|
$res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty <= 9; |
|
371
|
|
- if($res && $level > -1) { |
|
|
371
|
+ if ($res && $level > -1) { |
|
372
|
372
|
return $line->qty == $level; |
|
373
|
373
|
} else return $res; |
|
374
|
374
|
|
|
375
|
375
|
} |
|
376
|
376
|
|
|
377
|
|
- public static function isSubtotal(&$line, $level=-1) |
|
|
377
|
+ public static function isSubtotal(&$line, $level = -1) |
|
378
|
378
|
{ |
|
379
|
379
|
$res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty >= 90; |
|
380
|
|
- if($res && $level > -1) { |
|
|
380
|
+ if ($res && $level > -1) { |
|
381
|
381
|
return self::getNiveau($line) == $level; |
|
382
|
382
|
} else return $res; |
|
383
|
383
|
} |
|
@@ -392,52 +392,52 @@ discard block |
|
|
block discarded – undo |
|
392
|
392
|
return self::isTitle($line) || self::isSubtotal($line) || self::isFreeText($line); |
|
393
|
393
|
} |
|
394
|
394
|
|
|
395
|
|
- public static function getFreeTextHtml(&$line, $readonly=0) |
|
|
395
|
+ public static function getFreeTextHtml(&$line, $readonly = 0) |
|
396
|
396
|
{ |
|
397
|
397
|
global $conf; |
|
398
|
398
|
|
|
399
|
399
|
// Copie du fichier "objectline_edit.tpl.php" |
|
400
|
400
|
// editeur wysiwyg |
|
401
|
401
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
402
|
|
- $nbrows=ROWS_2; |
|
403
|
|
- if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
404
|
|
- $enable=(isset($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0); |
|
405
|
|
- $toolbarname='dolibarr_details'; |
|
406
|
|
- if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes'; |
|
407
|
|
- $text = !empty($line->description)?$line->description:$line->label; |
|
408
|
|
- $doleditor=new DolEditor('line-description',$text,'',164,$toolbarname,'',false,true,$enable,$nbrows,'98%', $readonly); |
|
|
402
|
+ $nbrows = ROWS_2; |
|
|
403
|
+ if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
|
404
|
+ $enable = (isset($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); |
|
|
405
|
+ $toolbarname = 'dolibarr_details'; |
|
|
406
|
+ if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname = 'dolibarr_notes'; |
|
|
407
|
+ $text = !empty($line->description) ? $line->description : $line->label; |
|
|
408
|
+ $doleditor = new DolEditor('line-description', $text, '', 164, $toolbarname, '', false, true, $enable, $nbrows, '98%', $readonly); |
|
409
|
409
|
return $doleditor->Create(1); |
|
410
|
410
|
} |
|
411
|
411
|
|
|
412
|
|
- public static function duplicateLines(&$object, $lineid, $withBlockLine=false) |
|
|
412
|
+ public static function duplicateLines(&$object, $lineid, $withBlockLine = false) |
|
413
|
413
|
{ |
|
414
|
|
- global $db,$user,$conf; |
|
|
414
|
+ global $db, $user, $conf; |
|
415
|
415
|
|
|
416
|
416
|
$createRight = $user->rights->{$object->element}->creer; |
|
417
|
|
- if($object->element == 'facturerec' ) |
|
|
417
|
+ if ($object->element == 'facturerec') |
|
418
|
418
|
{ |
|
419
|
419
|
$object->statut = 0; // hack for facture rec |
|
420
|
420
|
$createRight = $user->rights->facture->creer; |
|
421
|
421
|
} |
|
422
|
|
- elseif($object->element == 'order_supplier' ) |
|
|
422
|
+ elseif ($object->element == 'order_supplier') |
|
423
|
423
|
{ |
|
424
|
424
|
$createRight = $user->rights->fournisseur->commande->creer; |
|
425
|
425
|
} |
|
426
|
|
- elseif($object->element == 'invoice_supplier' ) |
|
|
426
|
+ elseif ($object->element == 'invoice_supplier') |
|
427
|
427
|
{ |
|
428
|
428
|
$createRight = $user->rights->fournisseur->facture->creer; |
|
429
|
429
|
} |
|
430
|
430
|
|
|
431
|
|
- if ($object->statut == 0 && $createRight && (!empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) || !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_LINE))) |
|
|
431
|
+ if ($object->statut == 0 && $createRight && (!empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) || !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_LINE))) |
|
432
|
432
|
{ |
|
433
|
433
|
dol_include_once('/subtotal/lib/subtotal.lib.php'); |
|
434
|
434
|
|
|
435
|
|
- if(!empty($object->lines)) { |
|
436
|
|
- foreach($object->lines as $line) { |
|
437
|
|
- if($line->id == $lineid) $duplicateLine = $line; |
|
|
435
|
+ if (!empty($object->lines)) { |
|
|
436
|
+ foreach ($object->lines as $line) { |
|
|
437
|
+ if ($line->id == $lineid) $duplicateLine = $line; |
|
438
|
438
|
} |
|
439
|
439
|
} |
|
440
|
|
- if(!empty($duplicateLine) && !self::isModSubtotalLine($duplicateLine)) $TLine = array($duplicateLine); |
|
|
440
|
+ if (!empty($duplicateLine) && !self::isModSubtotalLine($duplicateLine)) $TLine = array($duplicateLine); |
|
441
|
441
|
else $TLine = self::getLinesFromTitleId($object, $lineid, $withBlockLine); |
|
442
|
442
|
|
|
443
|
443
|
if (!empty($TLine)) |
|
@@ -467,7 +467,7 @@ discard block |
|
|
block discarded – undo |
|
467
|
467
|
case 'order_supplier': |
|
468
|
468
|
$object->line = $line; |
|
469
|
469
|
$object->line->fk_commande = $object->id; |
|
470
|
|
- $object->line->rang = $object->line_max() +1; |
|
|
470
|
+ $object->line->rang = $object->line_max() + 1; |
|
471
|
471
|
$res = $object->line->insert(1); |
|
472
|
472
|
break; |
|
473
|
473
|
|
|
@@ -507,7 +507,7 @@ discard block |
|
|
block discarded – undo |
|
507
|
507
|
{ |
|
508
|
508
|
$object->line_from = $line; |
|
509
|
509
|
// Call trigger |
|
510
|
|
- $result=$object->call_trigger('LINE_DUPLICATE',$user); // $object->line |
|
|
510
|
+ $result = $object->call_trigger('LINE_DUPLICATE', $user); // $object->line |
|
511
|
511
|
if ($result < 0) |
|
512
|
512
|
{ |
|
513
|
513
|
$object->db->rollback(); |
|
@@ -537,7 +537,7 @@ discard block |
|
|
block discarded – undo |
|
537
|
537
|
} |
|
538
|
538
|
} |
|
539
|
539
|
|
|
540
|
|
- public static function getLinesFromTitle(&$object, $key_trad, $level=1, $under_title='', $withBlockLine=false, $key_is_id=false) |
|
|
540
|
+ public static function getLinesFromTitle(&$object, $key_trad, $level = 1, $under_title = '', $withBlockLine = false, $key_is_id = false) |
|
541
|
541
|
{ |
|
542
|
542
|
global $langs; |
|
543
|
543
|
|
|
@@ -549,17 +549,17 @@ discard block |
|
|
block discarded – undo |
|
549
|
549
|
|
|
550
|
550
|
$TLine = array(); |
|
551
|
551
|
$add_line = false; |
|
552
|
|
- $under_title_found=false; |
|
|
552
|
+ $under_title_found = false; |
|
553
|
553
|
|
|
554
|
554
|
foreach ($object->lines as $key => &$line) |
|
555
|
555
|
{ |
|
556
|
556
|
if (!$under_title_found && !empty($TTitle_under_search)) |
|
557
|
557
|
{ |
|
558
|
|
- if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search)) ) $under_title_found = true; |
|
|
558
|
+ if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search))) $under_title_found = true; |
|
559
|
559
|
} |
|
560
|
560
|
else |
|
561
|
561
|
{ |
|
562
|
|
- 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) ))) |
|
|
562
|
+ 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)))) |
|
563
|
563
|
{ |
|
564
|
564
|
if ($key_is_id) $level = $line->qty; |
|
565
|
565
|
|
|
@@ -575,7 +575,7 @@ discard block |
|
|
block discarded – undo |
|
575
|
575
|
|
|
576
|
576
|
if ($add_line) |
|
577
|
577
|
{ |
|
578
|
|
- if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line)) ) continue; |
|
|
578
|
+ if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line))) continue; |
|
579
|
579
|
else $TLine[] = $line; |
|
580
|
580
|
} |
|
581
|
581
|
} |
|
@@ -584,12 +584,12 @@ discard block |
|
|
block discarded – undo |
|
584
|
584
|
return $TLine; |
|
585
|
585
|
} |
|
586
|
586
|
|
|
587
|
|
- public static function getLinesFromTitleId(&$object, $lineid, $withBlockLine=false) |
|
|
587
|
+ public static function getLinesFromTitleId(&$object, $lineid, $withBlockLine = false) |
|
588
|
588
|
{ |
|
589
|
589
|
return self::getLinesFromTitle($object, $lineid, '', '', $withBlockLine, true); |
|
590
|
590
|
} |
|
591
|
591
|
|
|
592
|
|
- 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, $notrigger = 0) |
|
|
592
|
+ 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, $notrigger = 0) |
|
593
|
593
|
{ |
|
594
|
594
|
$res = 0; |
|
595
|
595
|
$object->db->begin(); |
|
@@ -601,7 +601,7 @@ discard block |
|
|
block discarded – undo |
|
601
|
601
|
break; |
|
602
|
602
|
|
|
603
|
603
|
case 'supplier_proposal': |
|
604
|
|
- $res = $object->updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $desc, $price_base_type, $info_bits, $special_code, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $type, $array_options,'', $fk_unit); |
|
|
604
|
+ $res = $object->updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $desc, $price_base_type, $info_bits, $special_code, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $type, $array_options, '', $fk_unit); |
|
605
|
605
|
break; |
|
606
|
606
|
|
|
607
|
607
|
case 'commande': |
|
@@ -630,9 +630,9 @@ discard block |
|
|
block discarded – undo |
|
630
|
630
|
$factureRecLine->fetch($rowid); |
|
631
|
631
|
$factureRecLine->array_options = $array_options; |
|
632
|
632
|
$factureRecLine->insertExtraFields(); |
|
633
|
|
- $rang=$factureRecLine->rang; |
|
|
633
|
+ $rang = $factureRecLine->rang; |
|
634
|
634
|
|
|
635
|
|
- $fk_product=0; $fk_remise_except=''; $pu_ttc=0; |
|
|
635
|
+ $fk_product = 0; $fk_remise_except = ''; $pu_ttc = 0; |
|
636
|
636
|
$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); |
|
637
|
637
|
break; |
|
638
|
638
|
} |
|
@@ -648,7 +648,7 @@ discard block |
|
|
block discarded – undo |
|
648
|
648
|
global $db, $object; |
|
649
|
649
|
|
|
650
|
650
|
$TTitle = array(); |
|
651
|
|
- if(! empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {} |
|
|
651
|
+ if (!empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {} |
|
652
|
652
|
else { |
|
653
|
653
|
if ($origin_line->element == 'propaldet') |
|
654
|
654
|
{ |
|
@@ -728,7 +728,7 @@ discard block |
|
|
block discarded – undo |
|
728
|
728
|
*/ |
|
729
|
729
|
public static function addRecapPage(&$parameters, &$origin_pdf) |
|
730
|
730
|
{ |
|
731
|
|
- global $user,$conf,$langs; |
|
|
731
|
+ global $user, $conf, $langs; |
|
732
|
732
|
|
|
733
|
733
|
$origin_file = $parameters['file']; |
|
734
|
734
|
$outputlangs = $parameters['outputlangs']; |
|
@@ -744,21 +744,21 @@ discard block |
|
|
block discarded – undo |
|
744
|
744
|
$objmarge->marge_droite = 10; |
|
745
|
745
|
|
|
746
|
746
|
$objectref = dol_sanitizeFileName($object->ref); |
|
747
|
|
- if ($object->element == 'propal') $dir = $conf->propal->dir_output . '/' . $objectref; |
|
748
|
|
- elseif ($object->element == 'commande') $dir = $conf->commande->dir_output . '/' . $objectref; |
|
749
|
|
- elseif ($object->element == 'facture') $dir = $conf->facture->dir_output . '/' . $objectref; |
|
|
747
|
+ if ($object->element == 'propal') $dir = $conf->propal->dir_output.'/'.$objectref; |
|
|
748
|
+ elseif ($object->element == 'commande') $dir = $conf->commande->dir_output.'/'.$objectref; |
|
|
749
|
+ elseif ($object->element == 'facture') $dir = $conf->facture->dir_output.'/'.$objectref; |
|
750
|
750
|
elseif ($object->element == 'facturerec') return; // no PDF for facturerec |
|
751
|
751
|
else |
|
752
|
752
|
{ |
|
753
|
753
|
setEventMessage($langs->trans('warning_subtotal_recap_object_element_unknown', $object->element), 'warnings'); |
|
754
|
754
|
return -1; |
|
755
|
755
|
} |
|
756
|
|
- $file = $dir . '/' . $objectref . '_recap.pdf'; |
|
|
756
|
+ $file = $dir.'/'.$objectref.'_recap.pdf'; |
|
757
|
757
|
|
|
758
|
758
|
// $pdf=pdf_getInstance($origin_pdf->format); |
|
759
|
|
- $pdf=pdf_getInstance(array(210, 297)); // Format A4 Portrait |
|
760
|
|
- $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
761
|
|
- $pdf->SetAutoPageBreak(1,0); |
|
|
759
|
+ $pdf = pdf_getInstance(array(210, 297)); // Format A4 Portrait |
|
|
760
|
+ $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
|
761
|
+ $pdf->SetAutoPageBreak(1, 0); |
|
762
|
762
|
|
|
763
|
763
|
if (class_exists('TCPDF')) |
|
764
|
764
|
{ |
|
@@ -767,49 +767,49 @@ discard block |
|
|
block discarded – undo |
|
767
|
767
|
} |
|
768
|
768
|
$pdf->SetFont(pdf_getPDFFont($outputlangs)); |
|
769
|
769
|
// Set path to the background PDF File |
|
770
|
|
- if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
|
770
|
+ if (empty($conf->global->MAIN_DISABLE_FPDI) && !empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
771
|
771
|
{ |
|
772
|
772
|
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); |
|
773
|
773
|
$tplidx = $pdf->importPage(1); |
|
774
|
774
|
} |
|
775
|
775
|
|
|
776
|
776
|
$pdf->Open(); |
|
777
|
|
- $pagenb=0; |
|
778
|
|
- $pdf->SetDrawColor(128,128,128); |
|
|
777
|
+ $pagenb = 0; |
|
|
778
|
+ $pdf->SetDrawColor(128, 128, 128); |
|
779
|
779
|
|
|
780
|
780
|
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); |
|
781
|
781
|
$pdf->SetSubject($outputlangs->transnoentities("subtotalRecap")); |
|
782
|
782
|
$pdf->SetCreator("Dolibarr ".DOL_VERSION); |
|
783
|
783
|
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
|
784
|
784
|
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("subtotalRecap")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); |
|
785
|
|
- if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
|
785
|
+ if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
786
|
786
|
|
|
787
|
|
- $pdf->SetMargins($objmarge->marge_gauche, $objmarge->marge_haute, $objmarge->marge_droite); // Left, Top, Right |
|
|
787
|
+ $pdf->SetMargins($objmarge->marge_gauche, $objmarge->marge_haute, $objmarge->marge_droite); // Left, Top, Right |
|
788
|
788
|
|
|
789
|
|
- $pagenb=0; |
|
790
|
|
- $pdf->SetDrawColor(128,128,128); |
|
|
789
|
+ $pagenb = 0; |
|
|
790
|
+ $pdf->SetDrawColor(128, 128, 128); |
|
791
|
791
|
|
|
792
|
792
|
|
|
793
|
793
|
// New page |
|
794
|
794
|
$pdf->AddPage(); |
|
795
|
|
- if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
|
795
|
+ if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
796
|
796
|
$pagenb++; |
|
797
|
797
|
|
|
798
|
798
|
|
|
799
|
799
|
self::pagehead($objmarge, $pdf, $object, 1, $outputlangs); |
|
800
|
|
- $pdf->SetFont('','', $default_font_size - 1); |
|
801
|
|
- $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
802
|
|
- $pdf->SetTextColor(0,0,0); |
|
|
800
|
+ $pdf->SetFont('', '', $default_font_size - 1); |
|
|
801
|
+ $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
|
802
|
+ $pdf->SetTextColor(0, 0, 0); |
|
803
|
803
|
|
|
804
|
|
- $heightforinfotot = 25; // Height reserved to output the info and total part |
|
805
|
|
- $heightforfooter = $objmarge->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
|
804
|
+ $heightforinfotot = 25; // Height reserved to output the info and total part |
|
|
805
|
+ $heightforfooter = $objmarge->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
806
|
806
|
|
|
807
|
807
|
$posx_designation = 25; |
|
808
|
808
|
$posx_options = 150; |
|
809
|
809
|
$posx_montant = 170; |
|
810
|
810
|
|
|
811
|
811
|
$tab_top = 72; |
|
812
|
|
- $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?72:20); // TODO à vérifier |
|
|
812
|
+ $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 72 : 20); // TODO à vérifier |
|
813
|
813
|
|
|
814
|
814
|
$TTot = array('total_ht' => 0, 'total_ttc' => 0, 'TTotal_tva' => array()); |
|
815
|
815
|
|
|
@@ -823,14 +823,14 @@ discard block |
|
|
block discarded – undo |
|
823
|
823
|
$nexY = $tab_top + 10; |
|
824
|
824
|
|
|
825
|
825
|
$nblignes = count($TLine); |
|
826
|
|
- foreach($TLine as $i => &$line) |
|
|
826
|
+ foreach ($TLine as $i => &$line) |
|
827
|
827
|
{ |
|
828
|
828
|
$curY = $nexY; |
|
829
|
829
|
|
|
830
|
830
|
if (self::getNiveau($line) == 1) |
|
831
|
831
|
{ |
|
832
|
|
- $pdf->SetFont('','B', $default_font_size - 1); // Into loop to work with multipage |
|
833
|
|
- $curY+=2; |
|
|
832
|
+ $pdf->SetFont('', 'B', $default_font_size - 1); // Into loop to work with multipage |
|
|
833
|
+ $curY += 2; |
|
834
|
834
|
|
|
835
|
835
|
$TTot['total_ht'] += $line->total_ht; |
|
836
|
836
|
$TTot['total_tva'] += $line->total_tva; |
|
@@ -849,67 +849,67 @@ discard block |
|
|
block discarded – undo |
|
849
|
849
|
$TTot['TTotal_tva_multicurrency'][$tx] += $amount; |
|
850
|
850
|
} |
|
851
|
851
|
} |
|
852
|
|
- else $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage |
|
|
852
|
+ else $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage |
|
853
|
853
|
|
|
854
|
|
- $pdf->SetTextColor(0,0,0); |
|
|
854
|
+ $pdf->SetTextColor(0, 0, 0); |
|
855
|
855
|
|
|
856
|
856
|
$pdf->setTopMargin($tab_top_newpage + 10); |
|
857
|
|
- $pdf->setPageOrientation('', 1, $heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
|
858
|
|
- $pageposbefore=$pdf->getPage(); |
|
|
857
|
+ $pdf->setPageOrientation('', 1, $heightforfooter + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
|
|
858
|
+ $pageposbefore = $pdf->getPage(); |
|
859
|
859
|
|
|
860
|
|
- $showpricebeforepagebreak=1; |
|
|
860
|
+ $showpricebeforepagebreak = 1; |
|
861
|
861
|
|
|
862
|
862
|
$decalage = (self::getNiveau($line) - 1) * 2; |
|
863
|
863
|
|
|
864
|
864
|
// Print: Designation |
|
865
|
865
|
$label = $line->label; |
|
866
|
|
- if( (float)DOL_VERSION < 6 ) { |
|
|
866
|
+ if ((float) DOL_VERSION < 6) { |
|
867
|
867
|
$label = !empty($line->label) ? $line->label : $line->desc; |
|
868
|
868
|
} |
|
869
|
869
|
|
|
870
|
870
|
|
|
871
|
871
|
$pdf->startTransaction(); |
|
872
|
|
- $pdf->writeHTMLCell($posx_options-$posx_designation-$decalage, 3, $posx_designation+$decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J',true); |
|
873
|
|
- $pageposafter=$pdf->getPage(); |
|
|
872
|
+ $pdf->writeHTMLCell($posx_options - $posx_designation - $decalage, 3, $posx_designation + $decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J', true); |
|
|
873
|
+ $pageposafter = $pdf->getPage(); |
|
874
|
874
|
if ($pageposafter > $pageposbefore) // There is a pagebreak |
|
875
|
875
|
{ |
|
876
|
876
|
$pdf->rollbackTransaction(true); |
|
877
|
|
- $pageposafter=$pageposbefore; |
|
|
877
|
+ $pageposafter = $pageposbefore; |
|
878
|
878
|
//print $pageposafter.'-'.$pageposbefore;exit; |
|
879
|
|
- $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
880
|
|
- $pdf->writeHTMLCell($posx_options-$posx_designation-$decalage, 3, $posx_designation+$decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J',true); |
|
|
879
|
+ $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
|
880
|
+ $pdf->writeHTMLCell($posx_options - $posx_designation - $decalage, 3, $posx_designation + $decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J', true); |
|
881
|
881
|
|
|
882
|
|
- $pageposafter=$pdf->getPage(); |
|
883
|
|
- $posyafter=$pdf->GetY(); |
|
|
882
|
+ $pageposafter = $pdf->getPage(); |
|
|
883
|
+ $posyafter = $pdf->GetY(); |
|
884
|
884
|
//var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; |
|
885
|
|
- if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter+$heightforinfotot))) // There is no space left for total+free text |
|
|
885
|
+ if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter + $heightforinfotot))) // There is no space left for total+free text |
|
886
|
886
|
{ |
|
887
|
|
- if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page |
|
|
887
|
+ if ($i == ($nblignes - 1)) // No more lines, and no space left to show total, so we create a new page |
|
888
|
888
|
{ |
|
889
|
|
- $pdf->AddPage('','',true); |
|
890
|
|
- if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
|
889
|
+ $pdf->AddPage('', '', true); |
|
|
890
|
+ if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
891
|
891
|
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
|
892
|
|
- $pdf->setPage($pageposafter+1); |
|
|
892
|
+ $pdf->setPage($pageposafter + 1); |
|
893
|
893
|
} |
|
894
|
894
|
} |
|
895
|
895
|
else |
|
896
|
896
|
{ |
|
897
|
897
|
// We found a page break |
|
898
|
|
- $showpricebeforepagebreak=0; |
|
|
898
|
+ $showpricebeforepagebreak = 0; |
|
899
|
899
|
} |
|
900
|
900
|
} |
|
901
|
901
|
else // No pagebreak |
|
902
|
902
|
{ |
|
903
|
903
|
$pdf->commitTransaction(); |
|
904
|
904
|
} |
|
905
|
|
- $posYAfterDescription=$pdf->GetY(); |
|
|
905
|
+ $posYAfterDescription = $pdf->GetY(); |
|
906
|
906
|
|
|
907
|
907
|
$nexY = $pdf->GetY(); |
|
908
|
|
- $pageposafter=$pdf->getPage(); |
|
|
908
|
+ $pageposafter = $pdf->getPage(); |
|
909
|
909
|
|
|
910
|
910
|
$pdf->setPage($pageposbefore); |
|
911
|
911
|
$pdf->setTopMargin($objmarge->marge_haute); |
|
912
|
|
- $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
|
912
|
+ $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
913
|
913
|
|
|
914
|
914
|
// We suppose that a too long description or photo were moved completely on next page |
|
915
|
915
|
if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { |
|
@@ -922,14 +922,14 @@ discard block |
|
|
block discarded – undo |
|
922
|
922
|
if (!empty($line->total_options)) |
|
923
|
923
|
{ |
|
924
|
924
|
$pdf->SetXY($posx_options, $curY); |
|
925
|
|
- $pdf->MultiCell($posx_montant-$posx_options-0.8, 3, price($line->total_options, 0, $outputlangs), 0, 'R', 0); |
|
|
925
|
+ $pdf->MultiCell($posx_montant - $posx_options - 0.8, 3, price($line->total_options, 0, $outputlangs), 0, 'R', 0); |
|
926
|
926
|
} |
|
927
|
927
|
|
|
928
|
928
|
// Print: Montant |
|
929
|
929
|
$pdf->SetXY($posx_montant, $curY); |
|
930
|
|
- $pdf->MultiCell($objmarge->page_largeur-$objmarge->marge_droite-$posx_montant-0.8, 3, price($line->total_ht, 0, $outputlangs), 0, 'R', 0); |
|
|
930
|
+ $pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant - 0.8, 3, price($line->total_ht, 0, $outputlangs), 0, 'R', 0); |
|
931
|
931
|
|
|
932
|
|
- $nexY+=2; // Passe espace entre les lignes |
|
|
932
|
+ $nexY += 2; // Passe espace entre les lignes |
|
933
|
933
|
|
|
934
|
934
|
// Detect if some page were added automatically and output _tableau for past pages |
|
935
|
935
|
while ($pagenb < $pageposafter) |
|
@@ -946,7 +946,7 @@ discard block |
|
|
block discarded – undo |
|
946
|
946
|
|
|
947
|
947
|
$pagenb++; |
|
948
|
948
|
$pdf->setPage($pagenb); |
|
949
|
|
- $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
|
949
|
+ $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
950
|
950
|
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
|
951
|
951
|
} |
|
952
|
952
|
} |
|
@@ -956,19 +956,19 @@ discard block |
|
|
block discarded – undo |
|
956
|
956
|
if ($pagenb == 1) |
|
957
|
957
|
{ |
|
958
|
958
|
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); |
|
959
|
|
- $bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
|
|
959
|
+ $bottomlasttab = $objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
|
960
|
960
|
} |
|
961
|
961
|
else |
|
962
|
962
|
{ |
|
963
|
963
|
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); |
|
964
|
|
- $bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
|
|
964
|
+ $bottomlasttab = $objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
|
965
|
965
|
} |
|
966
|
966
|
|
|
967
|
967
|
// Affiche zone totaux |
|
968
|
|
- $posy=self::tableau_tot($objmarge, $pdf, $object, $bottomlasttab, $outputlangs, $TTot); |
|
|
968
|
+ $posy = self::tableau_tot($objmarge, $pdf, $object, $bottomlasttab, $outputlangs, $TTot); |
|
969
|
969
|
|
|
970
|
970
|
$pdf->Close(); |
|
971
|
|
- $pdf->Output($file,'F'); |
|
|
971
|
+ $pdf->Output($file, 'F'); |
|
972
|
972
|
|
|
973
|
973
|
$pagecount = self::concat($outputlangs, array($origin_file, $file), $origin_file); |
|
974
|
974
|
|
|
@@ -980,7 +980,7 @@ discard block |
|
|
block discarded – undo |
|
980
|
980
|
$level = $line->qty; // TODO à améliorer |
|
981
|
981
|
|
|
982
|
982
|
$pdf->SetXY($objmarge->marge_gauche, $curY); |
|
983
|
|
- $pdf->MultiCell($posx_designation-$objmarge->marge_gauche-0.8, 5, $level, 0, 'L', 0); |
|
|
983
|
+ $pdf->MultiCell($posx_designation - $objmarge->marge_gauche - 0.8, 5, $level, 0, 'L', 0); |
|
984
|
984
|
} |
|
985
|
985
|
|
|
986
|
986
|
/** |
|
@@ -994,50 +994,50 @@ discard block |
|
|
block discarded – undo |
|
994
|
994
|
*/ |
|
995
|
995
|
private static function pagehead(&$objmarge, &$pdf, &$object, $showdetail, $outputlangs) |
|
996
|
996
|
{ |
|
997
|
|
- global $conf,$mysoc; |
|
|
997
|
+ global $conf, $mysoc; |
|
998
|
998
|
|
|
999
|
999
|
$default_font_size = pdf_getPDFFontSize($outputlangs); |
|
1000
|
1000
|
|
|
1001
|
|
- pdf_pagehead($pdf,$outputlangs,$objmarge->page_hauteur); |
|
|
1001
|
+ pdf_pagehead($pdf, $outputlangs, $objmarge->page_hauteur); |
|
1002
|
1002
|
|
|
1003
|
|
- $pdf->SetTextColor(0,0,60); |
|
1004
|
|
- $pdf->SetFont('','B', $default_font_size + 3); |
|
|
1003
|
+ $pdf->SetTextColor(0, 0, 60); |
|
|
1004
|
+ $pdf->SetFont('', 'B', $default_font_size + 3); |
|
1005
|
1005
|
|
|
1006
|
|
- $posy=$objmarge->marge_haute; |
|
1007
|
|
- $posx=$objmarge->page_largeur-$objmarge->marge_droite-100; |
|
|
1006
|
+ $posy = $objmarge->marge_haute; |
|
|
1007
|
+ $posx = $objmarge->page_largeur - $objmarge->marge_droite - 100; |
|
1008
|
1008
|
|
|
1009
|
|
- $pdf->SetXY($objmarge->marge_gauche,$posy); |
|
|
1009
|
+ $pdf->SetXY($objmarge->marge_gauche, $posy); |
|
1010
|
1010
|
|
|
1011
|
|
- $logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo; |
|
|
1011
|
+ $logo = $conf->mycompany->dir_output.'/logos/'.$mysoc->logo; |
|
1012
|
1012
|
if ($mysoc->logo) |
|
1013
|
1013
|
{ |
|
1014
|
1014
|
if (is_readable($logo)) |
|
1015
|
1015
|
{ |
|
1016
|
|
- $height=pdf_getHeightForLogo($logo); |
|
1017
|
|
- $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
|
1016
|
+ $height = pdf_getHeightForLogo($logo); |
|
|
1017
|
+ $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
1018
|
1018
|
} |
|
1019
|
1019
|
else |
|
1020
|
1020
|
{ |
|
1021
|
|
- $pdf->SetTextColor(200,0,0); |
|
1022
|
|
- $pdf->SetFont('','B',$default_font_size - 2); |
|
1023
|
|
- $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L'); |
|
|
1021
|
+ $pdf->SetTextColor(200, 0, 0); |
|
|
1022
|
+ $pdf->SetFont('', 'B', $default_font_size - 2); |
|
|
1023
|
+ $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); |
|
1024
|
1024
|
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); |
|
1025
|
1025
|
} |
|
1026
|
1026
|
|
|
1027
|
|
- $posy+=35; |
|
|
1027
|
+ $posy += 35; |
|
1028
|
1028
|
} |
|
1029
|
1029
|
else |
|
1030
|
1030
|
{ |
|
1031
|
|
- $text=$mysoc->name; |
|
|
1031
|
+ $text = $mysoc->name; |
|
1032
|
1032
|
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); |
|
1033
|
1033
|
|
|
1034
|
|
- $posy+=15; |
|
|
1034
|
+ $posy += 15; |
|
1035
|
1035
|
} |
|
1036
|
1036
|
|
|
1037
|
1037
|
|
|
1038
|
|
- $pdf->SetTextColor(0,0,0); |
|
1039
|
|
- $pdf->SetFont('','B', $default_font_size + 2); |
|
1040
|
|
- $pdf->SetXY($objmarge->marge_gauche,$posy); |
|
|
1038
|
+ $pdf->SetTextColor(0, 0, 0); |
|
|
1039
|
+ $pdf->SetFont('', 'B', $default_font_size + 2); |
|
|
1040
|
+ $pdf->SetXY($objmarge->marge_gauche, $posy); |
|
1041
|
1041
|
|
|
1042
|
1042
|
$key = 'subtotalPropalTitle'; |
|
1043
|
1043
|
if ($object->element == 'commande') $key = 'subtotalCommandeTitle'; |
|
@@ -1046,14 +1046,14 @@ discard block |
|
|
block discarded – undo |
|
1046
|
1046
|
|
|
1047
|
1047
|
$pdf->MultiCell(150, 4, $outputlangs->transnoentities($key, $object->ref, $object->thirdparty->name), '', 'L'); |
|
1048
|
1048
|
|
|
1049
|
|
- $pdf->SetFont('','', $default_font_size); |
|
1050
|
|
- $pdf->SetXY($objmarge->page_largeur-$objmarge->marge_droite-40,$posy); |
|
|
1049
|
+ $pdf->SetFont('', '', $default_font_size); |
|
|
1050
|
+ $pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - 40, $posy); |
|
1051
|
1051
|
$pdf->MultiCell(40, 4, dol_print_date($object->date, 'daytext'), '', 'R'); |
|
1052
|
1052
|
|
|
1053
|
1053
|
$posy += 8; |
|
1054
|
1054
|
|
|
1055
|
|
- $pdf->SetFont('','B', $default_font_size + 2); |
|
1056
|
|
- $pdf->SetXY($objmarge->marge_gauche,$posy); |
|
|
1055
|
+ $pdf->SetFont('', 'B', $default_font_size + 2); |
|
|
1056
|
+ $pdf->SetXY($objmarge->marge_gauche, $posy); |
|
1057
|
1057
|
$pdf->MultiCell(70, 4, $outputlangs->transnoentities('subtotalRecapLot'), '', 'L'); |
|
1058
|
1058
|
|
|
1059
|
1059
|
} |
|
@@ -1071,44 +1071,44 @@ discard block |
|
|
block discarded – undo |
|
1071
|
1071
|
* @param string $currency Currency code |
|
1072
|
1072
|
* @return void |
|
1073
|
1073
|
*/ |
|
1074
|
|
- private static function tableau(&$objmarge, &$pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='') |
|
|
1074
|
+ private static function tableau(&$objmarge, &$pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '') |
|
1075
|
1075
|
{ |
|
1076
|
1076
|
global $conf; |
|
1077
|
1077
|
|
|
1078
|
1078
|
// Force to disable hidetop and hidebottom |
|
1079
|
|
- $hidebottom=0; |
|
1080
|
|
- if ($hidetop) $hidetop=-1; |
|
|
1079
|
+ $hidebottom = 0; |
|
|
1080
|
+ if ($hidetop) $hidetop = -1; |
|
1081
|
1081
|
|
|
1082
|
1082
|
$currency = !empty($currency) ? $currency : $conf->currency; |
|
1083
|
1083
|
$default_font_size = pdf_getPDFFontSize($outputlangs); |
|
1084
|
1084
|
|
|
1085
|
1085
|
// Amount in (at tab_top - 1) |
|
1086
|
|
- $pdf->SetTextColor(0,0,0); |
|
1087
|
|
- $pdf->SetFont('','',$default_font_size); |
|
|
1086
|
+ $pdf->SetTextColor(0, 0, 0); |
|
|
1087
|
+ $pdf->SetFont('', '', $default_font_size); |
|
1088
|
1088
|
|
|
1089
|
1089
|
if (empty($hidetop)) |
|
1090
|
1090
|
{ |
|
1091
|
|
- $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$currency)); |
|
1092
|
|
- $pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4.5); |
|
|
1091
|
+ $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency)); |
|
|
1092
|
+ $pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4.5); |
|
1093
|
1093
|
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); |
|
1094
|
1094
|
|
|
1095
|
|
- 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)); |
|
|
1095
|
+ 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)); |
|
1096
|
1096
|
|
|
1097
|
1097
|
|
|
1098
|
|
- $pdf->line($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur-$objmarge->marge_droite, $tab_top); // line prend une position y en 2eme param et 4eme param |
|
|
1098
|
+ $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 |
|
1099
|
1099
|
|
|
1100
|
|
- $pdf->SetXY($posx_designation, $tab_top+2); |
|
1101
|
|
- $pdf->MultiCell($posx_options - $posx_designation,2, $outputlangs->transnoentities("Designation"),'','L'); |
|
1102
|
|
- $pdf->SetXY($posx_options, $tab_top+2); |
|
1103
|
|
- $pdf->MultiCell($posx_montant - $posx_options,2, $outputlangs->transnoentities("Options"),'','R'); |
|
1104
|
|
- $pdf->SetXY($posx_montant, $tab_top+2); |
|
1105
|
|
- $pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant,2, $outputlangs->transnoentities("Amount"),'','R'); |
|
|
1100
|
+ $pdf->SetXY($posx_designation, $tab_top + 2); |
|
|
1101
|
+ $pdf->MultiCell($posx_options - $posx_designation, 2, $outputlangs->transnoentities("Designation"), '', 'L'); |
|
|
1102
|
+ $pdf->SetXY($posx_options, $tab_top + 2); |
|
|
1103
|
+ $pdf->MultiCell($posx_montant - $posx_options, 2, $outputlangs->transnoentities("Options"), '', 'R'); |
|
|
1104
|
+ $pdf->SetXY($posx_montant, $tab_top + 2); |
|
|
1105
|
+ $pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant, 2, $outputlangs->transnoentities("Amount"), '', 'R'); |
|
1106
|
1106
|
|
|
1107
|
|
- $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 |
|
|
1107
|
+ $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 |
|
1108
|
1108
|
} |
|
1109
|
1109
|
else |
|
1110
|
1110
|
{ |
|
1111
|
|
- $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 |
|
|
1111
|
+ $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 |
|
1112
|
1112
|
} |
|
1113
|
1113
|
|
|
1114
|
1114
|
} |
|
@@ -1117,29 +1117,29 @@ discard block |
|
|
block discarded – undo |
|
1117
|
1117
|
{ |
|
1118
|
1118
|
global $conf; |
|
1119
|
1119
|
|
|
1120
|
|
- $pdf->line($objmarge->marge_gauche, $posy, $objmarge->page_largeur-$objmarge->marge_droite, $posy); // line prend une position y en 2eme param et 4eme param |
|
|
1120
|
+ $pdf->line($objmarge->marge_gauche, $posy, $objmarge->page_largeur - $objmarge->marge_droite, $posy); // line prend une position y en 2eme param et 4eme param |
|
1121
|
1121
|
|
|
1122
|
1122
|
$default_font_size = pdf_getPDFFontSize($outputlangs); |
|
1123
|
1123
|
|
|
1124
|
|
- $tab2_top = $posy+2; |
|
|
1124
|
+ $tab2_top = $posy + 2; |
|
1125
|
1125
|
$tab2_hl = 4; |
|
1126
|
|
- $pdf->SetFont('','', $default_font_size - 1); |
|
|
1126
|
+ $pdf->SetFont('', '', $default_font_size - 1); |
|
1127
|
1127
|
|
|
1128
|
1128
|
// Tableau total |
|
1129
|
1129
|
$col1x = 120; $col2x = 170; |
|
1130
|
1130
|
if ($objmarge->page_largeur < 210) // To work with US executive format |
|
1131
|
1131
|
{ |
|
1132
|
|
- $col2x-=20; |
|
|
1132
|
+ $col2x -= 20; |
|
1133
|
1133
|
} |
|
1134
|
1134
|
$largcol2 = ($objmarge->page_largeur - $objmarge->marge_droite - $col2x); |
|
1135
|
1135
|
|
|
1136
|
|
- $useborder=0; |
|
|
1136
|
+ $useborder = 0; |
|
1137
|
1137
|
$index = 0; |
|
1138
|
1138
|
|
|
1139
|
1139
|
// Total HT |
|
1140
|
|
- $pdf->SetFillColor(255,255,255); |
|
|
1140
|
+ $pdf->SetFillColor(255, 255, 255); |
|
1141
|
1141
|
$pdf->SetXY($col1x, $tab2_top + 0); |
|
1142
|
|
- $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); |
|
|
1142
|
+ $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); |
|
1143
|
1143
|
|
|
1144
|
1144
|
// $total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1) ? $TTot['multicurrency_total_ht'] : $TTot['total_ht']; |
|
1145
|
1145
|
$total_ht = $TTot['total_ht']; |
|
@@ -1147,10 +1147,10 @@ discard block |
|
|
block discarded – undo |
|
1147
|
1147
|
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ht, 0, $outputlangs), 0, 'R', 1); |
|
1148
|
1148
|
|
|
1149
|
1149
|
// Show VAT by rates and total |
|
1150
|
|
- $pdf->SetFillColor(248,248,248); |
|
|
1150
|
+ $pdf->SetFillColor(248, 248, 248); |
|
1151
|
1151
|
|
|
1152
|
|
- $atleastoneratenotnull=0; |
|
1153
|
|
- foreach($TTot['TTotal_tva'] as $tvakey => $tvaval) |
|
|
1152
|
+ $atleastoneratenotnull = 0; |
|
|
1153
|
+ foreach ($TTot['TTotal_tva'] as $tvakey => $tvaval) |
|
1154
|
1154
|
{ |
|
1155
|
1155
|
if ($tvakey != 0) // On affiche pas taux 0 |
|
1156
|
1156
|
{ |
|
@@ -1159,15 +1159,15 @@ discard block |
|
|
block discarded – undo |
|
1159
|
1159
|
$index++; |
|
1160
|
1160
|
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
|
1161
|
1161
|
|
|
1162
|
|
- $tvacompl=''; |
|
1163
|
|
- if (preg_match('/\*/',$tvakey)) |
|
|
1162
|
+ $tvacompl = ''; |
|
|
1163
|
+ if (preg_match('/\*/', $tvakey)) |
|
1164
|
1164
|
{ |
|
1165
|
|
- $tvakey=str_replace('*','',$tvakey); |
|
|
1165
|
+ $tvakey = str_replace('*', '', $tvakey); |
|
1166
|
1166
|
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; |
|
1167
|
1167
|
} |
|
1168
|
|
- $totalvat =$outputlangs->transnoentities("TotalVAT").' '; |
|
1169
|
|
- $totalvat.=vatrate($tvakey,1).$tvacompl; |
|
1170
|
|
- $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
|
1168
|
+ $totalvat = $outputlangs->transnoentities("TotalVAT").' '; |
|
|
1169
|
+ $totalvat .= vatrate($tvakey, 1).$tvacompl; |
|
|
1170
|
+ $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
1171
|
1171
|
|
|
1172
|
1172
|
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
|
1173
|
1173
|
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); |
|
@@ -1177,16 +1177,16 @@ discard block |
|
|
block discarded – undo |
|
1177
|
1177
|
// Total TTC |
|
1178
|
1178
|
$index++; |
|
1179
|
1179
|
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
|
1180
|
|
- $pdf->SetTextColor(0,0,60); |
|
1181
|
|
- $pdf->SetFillColor(224,224,224); |
|
1182
|
|
- $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); |
|
|
1180
|
+ $pdf->SetTextColor(0, 0, 60); |
|
|
1181
|
+ $pdf->SetFillColor(224, 224, 224); |
|
|
1182
|
+ $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); |
|
1183
|
1183
|
|
|
1184
|
1184
|
// $total_ttc = ($conf->multicurrency->enabled && $object->multiccurency_tx != 1) ? $TTot['multicurrency_total_ttc'] : $TTot['total_ttc']; |
|
1185
|
1185
|
$total_ttc = $TTot['total_ttc']; |
|
1186
|
1186
|
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
|
1187
|
1187
|
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc, 0, $outputlangs), $useborder, 'R', 1); |
|
1188
|
1188
|
|
|
1189
|
|
- $pdf->SetTextColor(0,0,0); |
|
|
1189
|
+ $pdf->SetTextColor(0, 0, 0); |
|
1190
|
1190
|
|
|
1191
|
1191
|
$index++; |
|
1192
|
1192
|
return ($tab2_top + ($tab2_hl * $index)); |
|
@@ -1205,22 +1205,22 @@ discard block |
|
|
block discarded – undo |
|
1205
|
1205
|
* @param int $hidebottom Hide bottom |
|
1206
|
1206
|
* @return void |
|
1207
|
1207
|
*/ |
|
1208
|
|
- private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0) |
|
|
1208
|
+ private static function printRect($pdf, $x, $y, $l, $h, $hidetop = 0, $hidebottom = 0) |
|
1209
|
1209
|
{ |
|
1210
|
|
- if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); |
|
1211
|
|
- $pdf->line($x+$l, $y, $x+$l, $y+$h); |
|
1212
|
|
- if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
1213
|
|
- $pdf->line($x, $y+$h, $x, $y); |
|
|
1210
|
+ if (empty($hidetop) || $hidetop == -1) $pdf->line($x, $y, $x + $l, $y); |
|
|
1211
|
+ $pdf->line($x + $l, $y, $x + $l, $y + $h); |
|
|
1212
|
+ if (empty($hidebottom)) $pdf->line($x + $l, $y + $h, $x, $y + $h); |
|
|
1213
|
+ $pdf->line($x, $y + $h, $x, $y); |
|
1214
|
1214
|
} |
|
1215
|
1215
|
|
|
1216
|
1216
|
|
|
1217
|
|
- public static function concat(&$outputlangs, $files, $fileoutput='') |
|
|
1217
|
+ public static function concat(&$outputlangs, $files, $fileoutput = '') |
|
1218
|
1218
|
{ |
|
1219
|
1219
|
global $conf; |
|
1220
|
1220
|
|
|
1221
|
1221
|
if (empty($fileoutput)) $fileoutput = $file[0]; |
|
1222
|
1222
|
|
|
1223
|
|
- $pdf=pdf_getInstance(); |
|
|
1223
|
+ $pdf = pdf_getInstance(); |
|
1224
|
1224
|
if (class_exists('TCPDF')) |
|
1225
|
1225
|
{ |
|
1226
|
1226
|
$pdf->setPrintHeader(false); |
|
@@ -1228,10 +1228,10 @@ discard block |
|
|
block discarded – undo |
|
1228
|
1228
|
} |
|
1229
|
1229
|
$pdf->SetFont(pdf_getPDFFont($outputlangs)); |
|
1230
|
1230
|
|
|
1231
|
|
- if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
|
1231
|
+ if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
1232
|
1232
|
|
|
1233
|
1233
|
|
|
1234
|
|
- foreach($files as $file) |
|
|
1234
|
+ foreach ($files as $file) |
|
1235
|
1235
|
{ |
|
1236
|
1236
|
$pagecount = $pdf->setSourceFile($file); |
|
1237
|
1237
|
for ($i = 1; $i <= $pagecount; $i++) |
|
@@ -1243,8 +1243,8 @@ discard block |
|
|
block discarded – undo |
|
1243
|
1243
|
} |
|
1244
|
1244
|
} |
|
1245
|
1245
|
|
|
1246
|
|
- $pdf->Output($fileoutput,'F'); |
|
1247
|
|
- if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
|
1246
|
+ $pdf->Output($fileoutput, 'F'); |
|
|
1247
|
+ if (!empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
1248
|
1248
|
|
|
1249
|
1249
|
return $pagecount; |
|
1250
|
1250
|
} |
|
@@ -1257,7 +1257,7 @@ discard block |
|
|
block discarded – undo |
|
1257
|
1257
|
*/ |
|
1258
|
1258
|
public static function hasNcTitle(&$line) |
|
1259
|
1259
|
{ |
|
1260
|
|
- if(isset($line->has_nc_title)) return $line->has_nc_title; |
|
|
1260
|
+ if (isset($line->has_nc_title)) return $line->has_nc_title; |
|
1261
|
1261
|
|
|
1262
|
1262
|
$TTitle = self::getAllTitleFromLine($line); |
|
1263
|
1263
|
foreach ($TTitle as &$line_title) |