Merge pull request #19143 from andreubisquerra/develop

TakePOS Split Sale fixes and improvements
This commit is contained in:
Laurent Destailleur 2021-10-23 17:25:53 +02:00 committed by GitHub
commit 6832893cb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 6 deletions

View File

@ -1719,7 +1719,13 @@ if ($resql) {
print '<tr class="oddeven"';
if ($contextpage == 'poslist') {
print ' onclick="parent.$(\'#poslines\').load(\'invoice.php?action=history&placeid='.$obj->id.'\', function() {parent.$.colorbox.close();});"';
print ' onclick="parent.$(\'#poslines\').load(\'invoice.php?action=history&placeid='.$obj->id.'\', function() {parent.$.colorbox.close();';
if (strpos($obj->ref, 'PROV') !== false) {
//If is a draft invoice, load var to be able to add products
$place = str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $obj->ref));
print 'parent.place=\''.$place.'\'';
}
print '});"';
}
print '>';

View File

@ -103,12 +103,10 @@ if ($action=="split") {
dol_htmloutput_errors($invoice->error, $invoice->errors, 1);
}
$sql = "UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' where rowid=".$placeid;
echo $sql;
$db->query($sql);
}
}
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set fk_facture=".$placeid." where rowid=".$line;
echo $sql;
$db->query($sql);
}
$invoice->fetch('', '(PROV-POS'.$_SESSION["takeposterminal"].'-SPLIT)');
@ -167,11 +165,11 @@ if ($conf->global->TAKEPOS_COLOR_THEME == 1) {
<script>
function Split(selectedline, split) {
$.ajax({
url: "split.php?action=split&line="+selectedline+"&split="+split,
url: "split.php?action=split&line="+selectedline+"&split="+split+"&place=<?php echo $place;?>",
context: document.body
}).done(function() {
$("#currentplace").load("invoice.php?place="+parent.place+"&invoiceid="+parent.invoiceid, function() {
$('.posinvoiceline').click(function(){
$('#currentplace').find('.posinvoiceline').click(function(){
Split(this.id, 1);
});
});
@ -184,6 +182,11 @@ function Split(selectedline, split) {
}
$( document ).ready(function() {
if (parent.place=='SPLIT') {
parent.place=0;
parent.invoiceid=0;
parent.Refresh();
}
$("#currentplace").load("invoice.php?place="+parent.place+"&invoiceid="+parent.invoiceid, function() {
$('#currentplace').find('.posinvoiceline')
.click(function(){
@ -197,7 +200,7 @@ $( document ).ready(function() {
});
});
if (parent.place=='SPLIT') parent.place=0;
$("#headersplit1").html("<?php echo $langs->trans("Place");?> "+parent.place);
$("#headersplit2").html("<?php echo $langs->trans("SplitSale");?>");