|
@@ -163,7 +163,9 @@ discard block |
|
|
block discarded – undo |
|
163
|
163
|
|
|
164
|
164
|
$parameters=array(); |
|
165
|
165
|
$reshook=$hookmanager->executeHooks('doActions', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks |
|
166
|
|
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
|
166
|
+if ($reshook < 0) { |
|
|
167
|
+ setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
|
168
|
+} |
|
167
|
169
|
|
|
168
|
170
|
if (empty($reshook)) { |
|
169
|
171
|
// Action to record a payment on a TakePOS invoice |
|
@@ -534,10 +536,11 @@ discard block |
|
|
block discarded – undo |
|
534
|
536
|
} else { |
|
535
|
537
|
$prod->load_stock('warehouseopen'); |
|
536
|
538
|
$constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"]; |
|
537
|
|
- if ($prod->stock_warehouse[$conf->global->$constantforkey]->detail_batch!="") |
|
538
|
|
- if (is_object($prod->stock_warehouse[$conf->global->$constantforkey]) && count($prod->stock_warehouse[$conf->global->$constantforkey]->detail_batch)) { |
|
|
539
|
+ if ($prod->stock_warehouse[$conf->global->$constantforkey]->detail_batch!="") { |
|
|
540
|
+ if (is_object($prod->stock_warehouse[$conf->global->$constantforkey]) && count($prod->stock_warehouse[$conf->global->$constantforkey]->detail_batch)) { |
|
539
|
541
|
foreach ($prod->stock_warehouse[$conf->global->$constantforkey]->detail_batch as $dbatch) { |
|
540
|
542
|
$nbofsuggested++; |
|
|
543
|
+ } |
|
541
|
544
|
} |
|
542
|
545
|
} |
|
543
|
546
|
|
|
@@ -557,7 +560,9 @@ discard block |
|
|
block discarded – undo |
|
557
|
560
|
print '<!-- Show details of lot -->'; |
|
558
|
561
|
print '<td class="left">'; |
|
559
|
562
|
$staticwarehouse = new Entrepot($db); |
|
560
|
|
- if ($warehouse_id > 0) $staticwarehouse->fetch($conf->global->$constantforkey); |
|
|
563
|
+ if ($warehouse_id > 0) { |
|
|
564
|
+ $staticwarehouse->fetch($conf->global->$constantforkey); |
|
|
565
|
+ } |
|
561
|
566
|
$detail = ''; |
|
562
|
567
|
$detail .= $langs->trans("LotSerial").': '.$dbatch->batch; |
|
563
|
568
|
if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { |
|
@@ -607,7 +612,10 @@ discard block |
|
|
block discarded – undo |
|
607
|
612
|
if (!empty($conf->global->TAKEPOS_GROUP_SAME_PRODUCT)) { |
|
608
|
613
|
foreach ($invoice->lines as $line) { |
|
609
|
614
|
if ($line->product_ref == $prod->ref) { |
|
610
|
|
- if ($line->special_code==4) continue; // If this line is sended to printer create new line |
|
|
615
|
+ if ($line->special_code==4) { |
|
|
616
|
+ continue; |
|
|
617
|
+ } |
|
|
618
|
+ // If this line is sended to printer create new line |
|
611
|
619
|
// check if qty in stock |
|
612
|
620
|
if (getDolGlobalString('TAKEPOS_QTY_IN_STOCK') && (($line->qty + $qty) > $prod->stock_reel)) { |
|
613
|
621
|
$invoice->error = $langs->trans('NotEnoughInStock'); |
|
@@ -646,8 +654,9 @@ discard block |
|
|
block discarded – undo |
|
646
|
654
|
if ($pf->find_min_price_product_fournisseur($idproduct, $qty) > 0) { |
|
647
|
655
|
$line['fk_fournprice'] = $pf->product_fourn_price_id; |
|
648
|
656
|
$line['pa_ht'] = $pf->fourn_unitprice_with_discount; |
|
649
|
|
- if (getDolGlobalString('PRODUCT_CHARGES') && $pf->fourn_charges > 0) |
|
650
|
|
- $line['pa_ht'] += $pf->fourn_charges / $pf->fourn_qty; |
|
|
657
|
+ if (getDolGlobalString('PRODUCT_CHARGES') && $pf->fourn_charges > 0) { |
|
|
658
|
+ $line['pa_ht'] += $pf->fourn_charges / $pf->fourn_qty; |
|
|
659
|
+ } |
|
651
|
660
|
} |
|
652
|
661
|
} |
|
653
|
662
|
} |
|
@@ -655,7 +664,9 @@ discard block |
|
|
block discarded – undo |
|
655
|
664
|
// complete line by hook |
|
656
|
665
|
$parameters = array('prod' => $prod, 'line' => $line); |
|
657
|
666
|
$reshook=$hookmanager->executeHooks('completeTakePosAddLine', $parameters, $invoice, $action); // Note that $action and $line may have been modified by some hooks |
|
658
|
|
- if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
|
667
|
+ if ($reshook < 0) { |
|
|
668
|
+ setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
|
669
|
+ } |
|
659
|
670
|
|
|
660
|
671
|
|
|
661
|
672
|
if (empty($reshook)) { |
|
@@ -709,9 +720,11 @@ discard block |
|
|
block discarded – undo |
|
709
|
720
|
$desc = GETPOST('addnote', 'alpha'); |
|
710
|
721
|
if ($idline==0) { |
|
711
|
722
|
$invoice->update_note($desc, '_public'); |
|
712
|
|
- } else foreach ($invoice->lines as $line) { |
|
|
723
|
+ } else { |
|
|
724
|
+ foreach ($invoice->lines as $line) { |
|
713
|
725
|
if ($line->id == $idline) { |
|
714
|
726
|
$result = $invoice->updateline($line->id, $desc, $line->subprice, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); |
|
|
727
|
+ } |
|
715
|
728
|
} |
|
716
|
729
|
} |
|
717
|
730
|
$invoice->fetch($placeid); |
|
@@ -1070,7 +1083,10 @@ discard block |
|
|
block discarded – undo |
|
1070
|
1083
|
<script type="text/javascript"> |
|
1071
|
1084
|
var selectedline=0; |
|
1072
|
1085
|
var selectedtext=""; |
|
1073
|
|
-<?php if ($action=="valid") echo "var place=0;";?> // Set to default place after close sale |
|
|
1086
|
+<?php if ($action=="valid") { |
|
|
1087
|
+ echo "var place=0;"; |
|
|
1088
|
+} |
|
|
1089
|
+?> // Set to default place after close sale |
|
1074
|
1090
|
var placeid=<?php echo ($placeid > 0 ? $placeid : 0); ?>; |
|
1075
|
1091
|
$(document).ready(function() { |
|
1076
|
1092
|
var idoflineadded = <?php echo (empty($idoflineadded) ? 0 : $idoflineadded); ?>; |
|
@@ -1469,7 +1485,9 @@ discard block |
|
|
block discarded – undo |
|
1469
|
1485
|
// complete header by hook |
|
1470
|
1486
|
$parameters=array(); |
|
1471
|
1487
|
$reshook=$hookmanager->executeHooks('completeTakePosInvoiceHeader', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks |
|
1472
|
|
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
|
1488
|
+if ($reshook < 0) { |
|
|
1489
|
+ setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
|
1490
|
+} |
|
1473
|
1491
|
print $hookmanager->resPrint; |
|
1474
|
1492
|
|
|
1475
|
1493
|
if (empty($_SESSION["basiclayout"]) || $_SESSION["basiclayout"] != 1) { |
|
@@ -1633,7 +1651,9 @@ discard block |
|
|
block discarded – undo |
|
1633
|
1651
|
// complete line by hook |
|
1634
|
1652
|
$parameters=array('line' => $line); |
|
1635
|
1653
|
$reshook=$hookmanager->executeHooks('completeTakePosInvoiceParentLine', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks |
|
1636
|
|
- if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
|
1654
|
+ if ($reshook < 0) { |
|
|
1655
|
+ setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
|
1656
|
+ } |
|
1637
|
1657
|
$htmlsupplements[$line->fk_parent_line] .= $hookmanager->resPrint; |
|
1638
|
1658
|
|
|
1639
|
1659
|
if (empty($_SESSION["basiclayout"]) || $_SESSION["basiclayout"] != 1) { |
|
@@ -1727,7 +1747,9 @@ discard block |
|
|
block discarded – undo |
|
1727
|
1747
|
// complete line by hook |
|
1728
|
1748
|
$parameters=array('line' => $line); |
|
1729
|
1749
|
$reshook=$hookmanager->executeHooks('completeTakePosInvoiceLine', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks |
|
1730
|
|
- if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
|
1750
|
+ if ($reshook < 0) { |
|
|
1751
|
+ setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
|
1752
|
+ } |
|
1731
|
1753
|
$htmlforlines .= $hookmanager->resPrint; |
|
1732
|
1754
|
|
|
1733
|
1755
|
$htmlforlines .= '<td class="right">'.vatrate($line->remise_percent, true).'</td>'; |