SQL modifications for multicompany compatibility

Thanks to hregis
This commit is contained in:
David Beniamine 2019-03-25 16:49:33 +01:00
parent 833da30af1
commit 32303bbe48
No known key found for this signature in database
GPG Key ID: DFC3C8C672850E10
4 changed files with 15 additions and 8 deletions

View File

@ -43,7 +43,10 @@ $langs->loadLangs(array("admin", "cashdesk"));
global $db;
$sql="SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_paiement WHERE active=1 ORDER BY libelle";
$sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_paiement";
$sql.= " WHERE entity IN (".getEntity('c_paiement').")";
$sql.= " AND active = 1";
$sql.= " ORDER BY libelle";
$resql = $db->query($sql);
$paiements = array();
if($resql){

View File

@ -40,10 +40,6 @@ $number = GETPOST('number');
$idline = GETPOST('idline');
$desc = GETPOST('desc', 'alpha');
$pay = GETPOST('pay');
$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS-".$place.")'";
$resql = $db->query($sql);
$row = $db->fetch_array($resql);
$placeid = $row[0];
$placeid = 0; // $placeid is id of invoice
@ -53,7 +49,9 @@ if ($ret > 0) $placeid = $invoice->id;
// Retrieve paiementid
$sql="SELECT id FROM ".MAIN_DB_PREFIX."c_paiement WHERE code='$pay'";
$sql = "SELECT id FROM ".MAIN_DB_PREFIX."c_paiement";
$sql.= " WHERE entity IN (".getEntity('c_paiement').")";
$sql.= " AND code = '$pay'";
$resql = $db->query($sql);
$codes = $db->fetch_array($resql);
$paiementid=$codes[0];

View File

@ -51,7 +51,10 @@ top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
$langs->loadLangs(array("main", "bills", "cashdesk"));
$sql="SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_paiement WHERE active=1 ORDER BY libelle";
$sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_paiement";
$sql.= " WHERE entity IN (".getEntity('c_paiement').")";
$sql.= " AND active = 1";
$sql.= " ORDER BY libelle";
$resql = $db->query($sql);
$paiements = array();
if($resql){

View File

@ -451,7 +451,10 @@ $( document ).ready(function() {
<?php
// TakePOS setup check
// TODO
$sql="SELECT code,libelle FROM ".MAIN_DB_PREFIX."c_paiement WHERE active=1 ORDER BY libelle";
$sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_paiement";
$sql.= " WHERE entity IN (".getEntity('c_paiement').")";
$sql.= " AND active = 1";
$sql.= " ORDER BY libelle";
$resql = $db->query($sql);
$paiementsModes = array();
if($resql){