|
@@ -39,10 +39,10 @@ discard block |
|
|
block discarded – undo |
|
39
|
39
|
* @var $object Facture fournisseur |
|
40
|
40
|
*/ |
|
41
|
41
|
else if($object->element=='invoice_supplier') { |
|
42
|
|
- $object->special_code = TSubtotal::$module_number; |
|
43
|
|
- $rang = $object->line_max() + 1; |
|
44
|
|
- if($qty==50) $res = $object->addline($desc,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); |
|
45
|
|
- else $res = $object->addline($label,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); |
|
|
42
|
+ $object->special_code = TSubtotal::$module_number; |
|
|
43
|
+ $rang = $object->line_max() + 1; |
|
|
44
|
+ if($qty==50) $res = $object->addline($desc,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); |
|
|
45
|
+ else $res = $object->addline($label,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); |
|
46
|
46
|
} |
|
47
|
47
|
/** |
|
48
|
48
|
* @var $object Propal |
|
@@ -61,8 +61,8 @@ discard block |
|
|
block discarded – undo |
|
61
|
61
|
* @var $object Commande fournisseur |
|
62
|
62
|
*/ |
|
63
|
63
|
else if($object->element=='order_supplier') { |
|
64
|
|
- $object->special_code = TSubtotal::$module_number; |
|
65
|
|
- $res = $object->addline($label, 0,$qty,0,0,0,0,0,'',0,'HT', 0, 9); |
|
|
64
|
+ $object->special_code = TSubtotal::$module_number; |
|
|
65
|
+ $res = $object->addline($label, 0,$qty,0,0,0,0,0,'',0,'HT', 0, 9); |
|
66
|
66
|
} |
|
67
|
67
|
/** |
|
68
|
68
|
* @var $object Facturerec |
|
@@ -368,10 +368,10 @@ discard block |
|
|
block discarded – undo |
|
368
|
368
|
|
|
369
|
369
|
public static function isSubtotal(&$line, $level=-1) |
|
370
|
370
|
{ |
|
371
|
|
- $res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty >= 90; |
|
372
|
|
- if($res && $level > -1) { |
|
373
|
|
- return self::getNiveau($line) == $level; |
|
374
|
|
- } else return $res; |
|
|
371
|
+ $res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty >= 90; |
|
|
372
|
+ if($res && $level > -1) { |
|
|
373
|
+ return self::getNiveau($line) == $level; |
|
|
374
|
+ } else return $res; |
|
375
|
375
|
} |
|
376
|
376
|
|
|
377
|
377
|
public static function isFreeText(&$line) |
|
@@ -408,16 +408,16 @@ discard block |
|
|
block discarded – undo |
|
408
|
408
|
$createRight = $user->rights->{$object->element}->creer; |
|
409
|
409
|
if($object->element == 'facturerec' ) |
|
410
|
410
|
{ |
|
411
|
|
- $object->statut = 0; // hack for facture rec |
|
412
|
|
- $createRight = $user->rights->facture->creer; |
|
|
411
|
+ $object->statut = 0; // hack for facture rec |
|
|
412
|
+ $createRight = $user->rights->facture->creer; |
|
413
|
413
|
} |
|
414
|
414
|
elseif($object->element == 'order_supplier' ) |
|
415
|
415
|
{ |
|
416
|
|
- $createRight = $user->rights->fournisseur->commande->creer; |
|
|
416
|
+ $createRight = $user->rights->fournisseur->commande->creer; |
|
417
|
417
|
} |
|
418
|
418
|
elseif($object->element == 'invoice_supplier' ) |
|
419
|
419
|
{ |
|
420
|
|
- $createRight = $user->rights->fournisseur->facture->creer; |
|
|
420
|
+ $createRight = $user->rights->fournisseur->facture->creer; |
|
421
|
421
|
} |
|
422
|
422
|
|
|
423
|
423
|
if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK)) |
|
@@ -442,8 +442,8 @@ discard block |
|
|
block discarded – undo |
|
442
|
442
|
break; |
|
443
|
443
|
|
|
444
|
444
|
case 'supplier_proposal': |
|
445
|
|
- $res = $object->addline($line->desc, $line->subprice, $line->qty, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->fk_product, $line->remise_percent, 'HT', 0, $line->info_bits, $line->product_type, -1, $line->special_code, 0, 0, $line->pa_ht, $line->label, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->origin, $line->origin_id); |
|
446
|
|
- break; |
|
|
445
|
+ $res = $object->addline($line->desc, $line->subprice, $line->qty, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->fk_product, $line->remise_percent, 'HT', 0, $line->info_bits, $line->product_type, -1, $line->special_code, 0, 0, $line->pa_ht, $line->label, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->origin, $line->origin_id); |
|
|
446
|
+ break; |
|
447
|
447
|
|
|
448
|
448
|
case 'commande': |
|
449
|
449
|
//$desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='',$array_options=0, $fk_unit=null, $origin='', $origin_id=0) |
|
@@ -451,10 +451,10 @@ discard block |
|
|
block discarded – undo |
|
451
|
451
|
break; |
|
452
|
452
|
|
|
453
|
453
|
case 'order_supplier': |
|
454
|
|
- $object->line = $line; |
|
455
|
|
- $object->line->fk_commande = $object->id; |
|
456
|
|
- $object->line->rang = $object->line_max() +1; |
|
457
|
|
- $res = $object->line->insert(1); |
|
|
454
|
+ $object->line = $line; |
|
|
455
|
+ $object->line->fk_commande = $object->id; |
|
|
456
|
+ $object->line->rang = $object->line_max() +1; |
|
|
457
|
+ $res = $object->line->insert(1); |
|
458
|
458
|
break; |
|
459
|
459
|
|
|
460
|
460
|
case 'facture': |
|
@@ -507,8 +507,8 @@ discard block |
|
|
block discarded – undo |
|
507
|
507
|
$object->db->commit(); |
|
508
|
508
|
foreach ($TLineAdded as &$line) |
|
509
|
509
|
{ |
|
510
|
|
- // ça peut paraitre non optimisé de déclancher la fonction sur toutes les lignes mais ceci est nécessaire pour réappliquer l'état exact de chaque ligne |
|
511
|
|
- _updateLineNC($object->element, $object->id, $line->id, $line->array_options['options_subtotal_nc']); |
|
|
510
|
+ // ça peut paraitre non optimisé de déclancher la fonction sur toutes les lignes mais ceci est nécessaire pour réappliquer l'état exact de chaque ligne |
|
|
511
|
+ _updateLineNC($object->element, $object->id, $line->id, $line->array_options['options_subtotal_nc']); |
|
512
|
512
|
} |
|
513
|
513
|
return count($TLineAdded); |
|
514
|
514
|
} |
|
@@ -582,33 +582,33 @@ discard block |
|
|
block discarded – undo |
|
582
|
582
|
|
|
583
|
583
|
switch ($object->element) |
|
584
|
584
|
{ |
|
585
|
|
- case 'propal': |
|
586
|
|
- $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, $date_start, $date_end, $array_options, $fk_unit, 0, $notrigger); |
|
587
|
|
- break; |
|
|
585
|
+ case 'propal': |
|
|
586
|
+ $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, $date_start, $date_end, $array_options, $fk_unit, 0, $notrigger); |
|
|
587
|
+ break; |
|
588
|
588
|
|
|
589
|
|
- case 'supplier_proposal': |
|
590
|
|
- $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); |
|
591
|
|
- break; |
|
|
589
|
+ case 'supplier_proposal': |
|
|
590
|
+ $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); |
|
|
591
|
+ break; |
|
592
|
592
|
|
|
593
|
593
|
case 'commande': |
|
594
|
594
|
$res = $object->updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $date_start, $date_end, $type, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $special_code, $array_options, $fk_unit, 0, $notrigger); |
|
595
|
595
|
break; |
|
596
|
596
|
|
|
597
|
597
|
case 'order_supplier': |
|
598
|
|
- $object->special_code = SELF::$module_number; |
|
599
|
|
- if (empty($desc)) $desc = $label; |
|
600
|
|
- $res = $object->updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $type, 0, $date_start, $date_end, $array_options, $fk_unit); |
|
601
|
|
- break; |
|
|
598
|
+ $object->special_code = SELF::$module_number; |
|
|
599
|
+ if (empty($desc)) $desc = $label; |
|
|
600
|
+ $res = $object->updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $type, 0, $date_start, $date_end, $array_options, $fk_unit); |
|
|
601
|
+ break; |
|
602
|
602
|
|
|
603
|
603
|
case 'facture': |
|
604
|
604
|
$res = $object->updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $type, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $special_code, $array_options, $situation_percent, $fk_unit, 0, $notrigger); |
|
605
|
605
|
break; |
|
606
|
606
|
|
|
607
|
607
|
case 'invoice_supplier': |
|
608
|
|
- $object->special_code = SELF::$module_number; |
|
609
|
|
- if (empty($desc)) $desc = $label; |
|
610
|
|
- $res = $object->updateline($rowid, $desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, 0, $price_base_type, $info_bits, $type, $remise_percent, 0, $date_start, $date_end, $array_options, $fk_unit); |
|
611
|
|
- break; |
|
|
608
|
+ $object->special_code = SELF::$module_number; |
|
|
609
|
+ if (empty($desc)) $desc = $label; |
|
|
610
|
+ $res = $object->updateline($rowid, $desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, 0, $price_base_type, $info_bits, $type, $remise_percent, 0, $date_start, $date_end, $array_options, $fk_unit); |
|
|
611
|
+ break; |
|
612
|
612
|
|
|
613
|
613
|
case 'facturerec': |
|
614
|
614
|
// Add extrafields and get rang |
|
@@ -999,8 +999,8 @@ discard block |
|
|
block discarded – undo |
|
999
|
999
|
{ |
|
1000
|
1000
|
if (is_readable($logo)) |
|
1001
|
1001
|
{ |
|
1002
|
|
- $height=pdf_getHeightForLogo($logo); |
|
1003
|
|
- $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
|
1002
|
+ $height=pdf_getHeightForLogo($logo); |
|
|
1003
|
+ $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
1004
|
1004
|
} |
|
1005
|
1005
|
else |
|
1006
|
1006
|
{ |
|
@@ -1191,13 +1191,13 @@ discard block |
|
|
block discarded – undo |
|
1191
|
1191
|
* @param int $hidebottom Hide bottom |
|
1192
|
1192
|
* @return void |
|
1193
|
1193
|
*/ |
|
1194
|
|
- private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0) |
|
1195
|
|
- { |
|
1196
|
|
- if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); |
|
1197
|
|
- $pdf->line($x+$l, $y, $x+$l, $y+$h); |
|
1198
|
|
- if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
1199
|
|
- $pdf->line($x, $y+$h, $x, $y); |
|
1200
|
|
- } |
|
|
1194
|
+ private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0) |
|
|
1195
|
+ { |
|
|
1196
|
+ if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); |
|
|
1197
|
+ $pdf->line($x+$l, $y, $x+$l, $y+$h); |
|
|
1198
|
+ if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
|
1199
|
+ $pdf->line($x, $y+$h, $x, $y); |
|
|
1200
|
+ } |
|
1201
|
1201
|
|
|
1202
|
1202
|
|
|
1203
|
1203
|
public static function concat(&$outputlangs, $files, $fileoutput='') |
|
@@ -1207,14 +1207,14 @@ discard block |
|
|
block discarded – undo |
|
1207
|
1207
|
if (empty($fileoutput)) $fileoutput = $file[0]; |
|
1208
|
1208
|
|
|
1209
|
1209
|
$pdf=pdf_getInstance(); |
|
1210
|
|
- if (class_exists('TCPDF')) |
|
1211
|
|
- { |
|
1212
|
|
- $pdf->setPrintHeader(false); |
|
1213
|
|
- $pdf->setPrintFooter(false); |
|
1214
|
|
- } |
|
1215
|
|
- $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
|
|
1210
|
+ if (class_exists('TCPDF')) |
|
|
1211
|
+ { |
|
|
1212
|
+ $pdf->setPrintHeader(false); |
|
|
1213
|
+ $pdf->setPrintFooter(false); |
|
|
1214
|
+ } |
|
|
1215
|
+ $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
|
1216
|
1216
|
|
|
1217
|
|
- if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
|
1217
|
+ if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
1218
|
1218
|
|
|
1219
|
1219
|
|
|
1220
|
1220
|
foreach($files as $file) |