Skip to content

Commit

Permalink
Merge branch '4.0' of git@github.com:Dolibarr/dolibarr.git into 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jul 16, 2016
2 parents 58caf89 + 5aa63ff commit c3bf1b2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions htdocs/webservices/server_invoice.php
@@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -412,7 +413,7 @@ function getInvoicesForThirdParty($authentication,$idthirdparty)
$error=0;
$fuser=check_authentication($authentication,$error,$errorcode,$errorlabel);

if ($fuser->societe_id) $socid=$fuser->societe_id;
if ($fuser->socid) $socid=$fuser->socid;

// Check parameters
if (! $error && empty($idthirdparty))
Expand All @@ -425,7 +426,7 @@ function getInvoicesForThirdParty($authentication,$idthirdparty)
{
$linesinvoice=array();

$sql.='SELECT f.rowid as facid, facnumber as ref, ref_ext, type, fk_statut as status, total_ttc, total, tva';
$sql ='SELECT f.rowid as facid, facnumber as ref, ref_ext, type, fk_statut as status, total_ttc, total, tva';
$sql.=' FROM '.MAIN_DB_PREFIX.'facture as f';
$sql.=" WHERE f.entity = ".$conf->entity;
if ($idthirdparty != 'all' ) $sql.=" AND f.fk_soc = ".$db->escape($idthirdparty);
Expand Down Expand Up @@ -660,7 +661,7 @@ function createInvoice($authentication,$invoice)
function createInvoiceFromOrder($authentication,$id_order='', $ref_order='', $ref_ext_order='',
$id_invoice='', $ref_invoice='', $ref_ext_invoice='')
{
global $db,$conf,$langs;
global $db,$conf;

$now=dol_now();

Expand All @@ -674,6 +675,7 @@ function createInvoiceFromOrder($authentication,$id_order='', $ref_order='', $re
$errorcode='';$errorlabel='';
$error=0;
$fuser=check_authentication($authentication,$error,$errorcode,$errorlabel);
if ($fuser->socid) $socid=$fuser->socid;

// Check parameters
if (empty($id_order) && empty($ref_order) && empty($ref_ext_order)) {
Expand All @@ -690,7 +692,7 @@ function createInvoiceFromOrder($authentication,$id_order='', $ref_order='', $re
if ($fuser->rights->commande->lire)
{
$order=new Commande($db);
$result=$order->fetch($id,$ref,$ref_ext);
$result=$order->fetch($id_order,$ref_order,$ref_ext_order);
if ($result > 0)
{
// Security for external user
Expand Down

0 comments on commit c3bf1b2

Please sign in to comment.