commit
2ec45acbbd
@ -313,27 +313,24 @@ function getInvoice($authentication,$id='',$ref='',$ref_ext='')
|
|||||||
'invoice'=>array(
|
'invoice'=>array(
|
||||||
'id' => $invoice->id,
|
'id' => $invoice->id,
|
||||||
'ref' => $invoice->ref,
|
'ref' => $invoice->ref,
|
||||||
'ref_ext' => $invoice->ref_ext?$invoice->ref_ext:'', // If not defined, field is not added into soap
|
'ref_ext' => $invoice->ref_ext?$invoice->ref_ext:'', // If not defined, field is not added into soap
|
||||||
'fk_user_author' => $invoice->user_author?$invoice->user_author:'',
|
'fk_user_author' => $invoice->user_author?$invoice->user_author:'',
|
||||||
'fk_user_valid' => $invoice->user_valid?$invoice->user_valid:'',
|
'fk_user_valid' => $invoice->user_valid?$invoice->user_valid:'',
|
||||||
'date' => $invoice->date?dol_print_date($invoice->date,'dayrfc'):'',
|
'date' => $invoice->date?dol_print_date($invoice->date,'dayrfc'):'',
|
||||||
'date_creation' => $invoice->date_creation?dol_print_date($invoice->date_creation,'dayhourrfc'):'',
|
'date_creation' => $invoice->date_creation?dol_print_date($invoice->date_creation,'dayhourrfc'):'',
|
||||||
'date_validation' => $invoice->date_validation?dol_print_date($invoice->date_creation,'dayhourrfc'):'',
|
'date_validation' => $invoice->date_validation?dol_print_date($invoice->date_creation,'dayhourrfc'):'',
|
||||||
'date_modification' => $invoice->datem?dol_print_date($invoice->datem,'dayhourrfc'):'',
|
'date_modification' => $invoice->datem?dol_print_date($invoice->datem,'dayhourrfc'):'',
|
||||||
'type' => $invoice->type,
|
'type' => $invoice->type,
|
||||||
'total_net' => $invoice->total_ht,
|
'total_net' => $invoice->total_ht,
|
||||||
'total_vat' => $invoice->total_tva,
|
'total_vat' => $invoice->total_tva,
|
||||||
'total' => $invoice->total_ttc,
|
'total' => $invoice->total_ttc,
|
||||||
'note_private' => $invoice->note_private?$invoice->note_private:'',
|
'note_private' => $invoice->note_private?$invoice->note_private:'',
|
||||||
'note_public' => $invoice->note_public?$invoice->note_public:'',
|
'note_public' => $invoice->note_public?$invoice->note_public:'',
|
||||||
'status'=> $invoice->statut,
|
'status'=> $invoice->statut,
|
||||||
'close_code' => $invoice->close_code?$invoice->close_code:'',
|
'close_code' => $invoice->close_code?$invoice->close_code:'',
|
||||||
'close_note' => $invoice->close_note?$invoice->close_note:'',
|
'close_note' => $invoice->close_note?$invoice->close_note:'',
|
||||||
'lines' => $linesresp
|
'lines' => $linesresp
|
||||||
// 'lines' => array('0'=>array('id'=>222,'type'=>1),
|
));
|
||||||
// '1'=>array('id'=>333,'type'=>1))
|
|
||||||
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -393,10 +390,6 @@ function getInvoicesForThirdParty($authentication,$idthirdparty)
|
|||||||
|
|
||||||
$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.=' FROM '.MAIN_DB_PREFIX.'facture as f';
|
||||||
//$sql.=', '.MAIN_DB_PREFIX.'societe as s';
|
|
||||||
//$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product = p.rowid';
|
|
||||||
//$sql.=" WHERE f.fk_soc = s.rowid AND nom = '".$db->escape($idthirdparty)."'";
|
|
||||||
//$sql.=" WHERE f.fk_soc = s.rowid AND nom = '".$db->escape($idthirdparty)."'";
|
|
||||||
$sql.=" WHERE f.entity = ".$conf->entity;
|
$sql.=" WHERE f.entity = ".$conf->entity;
|
||||||
if ($idthirdparty != 'all' ) $sql.=" AND f.fk_soc = ".$db->escape($idthirdparty);
|
if ($idthirdparty != 'all' ) $sql.=" AND f.fk_soc = ".$db->escape($idthirdparty);
|
||||||
|
|
||||||
@ -414,55 +407,58 @@ function getInvoicesForThirdParty($authentication,$idthirdparty)
|
|||||||
$invoice->fetch($obj->facid);
|
$invoice->fetch($obj->facid);
|
||||||
|
|
||||||
// Sécurité pour utilisateur externe
|
// Sécurité pour utilisateur externe
|
||||||
if( $socid && ( $socid != $order->socid) )
|
if( $socid && ( $socid != $invoice->socid) )
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errorcode='PERMISSION_DENIED'; $errorlabel=$order->socid.' User does not have permission for this request';
|
$errorcode='PERMISSION_DENIED'; $errorlabel=$invoice->socid.' User does not have permission for this request';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define lines of invoice
|
if(!$error)
|
||||||
$linesresp=array();
|
{
|
||||||
foreach($invoice->lines as $line)
|
// Define lines of invoice
|
||||||
{
|
$linesresp=array();
|
||||||
$linesresp[]=array(
|
foreach($invoice->lines as $line)
|
||||||
'id'=>$line->rowid,
|
{
|
||||||
'type'=>$line->product_type,
|
$linesresp[]=array(
|
||||||
'total_net'=>$line->total_ht,
|
'id'=>$line->rowid,
|
||||||
'total_vat'=>$line->total_tva,
|
'type'=>$line->product_type,
|
||||||
'total'=>$line->total_ttc,
|
'total_net'=>$line->total_ht,
|
||||||
'vat_rate'=>$line->tva_tx,
|
'total_vat'=>$line->total_tva,
|
||||||
'qty'=>$line->qty,
|
'total'=>$line->total_ttc,
|
||||||
'product_ref'=>$line->product_ref,
|
'vat_rate'=>$line->tva_tx,
|
||||||
'product_label'=>$line->product_label,
|
'qty'=>$line->qty,
|
||||||
'product_desc'=>$line->product_desc,
|
'product_ref'=>$line->product_ref,
|
||||||
);
|
'product_label'=>$line->product_label,
|
||||||
}
|
'product_desc'=>$line->product_desc,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Now define invoice
|
// Now define invoice
|
||||||
$linesinvoice[]=array(
|
$linesinvoice[]=array(
|
||||||
'id' => $invoice->id,
|
'id' => $invoice->id,
|
||||||
'ref' => $invoice->ref,
|
'ref' => $invoice->ref,
|
||||||
'ref_ext' => $invoice->ref_ext?$invoice->ref_ext:'', // If not defined, field is not added into soap
|
'ref_ext' => $invoice->ref_ext?$invoice->ref_ext:'', // If not defined, field is not added into soap
|
||||||
'fk_user_author' => $invoice->user_author?$invoice->user_author:'',
|
'fk_user_author' => $invoice->user_author?$invoice->user_author:'',
|
||||||
'fk_user_valid' => $invoice->user_valid?$invoice->user_valid:'',
|
'fk_user_valid' => $invoice->user_valid?$invoice->user_valid:'',
|
||||||
'date' => $invoice->date?dol_print_date($invoice->date,'dayrfc'):'',
|
'date' => $invoice->date?dol_print_date($invoice->date,'dayrfc'):'',
|
||||||
'date_due' => $invoice->date_lim_reglement?dol_print_date($invoice->date_lim_reglement,'dayrfc'):'',
|
'date_due' => $invoice->date_lim_reglement?dol_print_date($invoice->date_lim_reglement,'dayrfc'):'',
|
||||||
'date_creation' => $invoice->date_creation?dol_print_date($invoice->date_creation,'dayhourrfc'):'',
|
'date_creation' => $invoice->date_creation?dol_print_date($invoice->date_creation,'dayhourrfc'):'',
|
||||||
'date_validation' => $invoice->date_validation?dol_print_date($invoice->date_creation,'dayhourrfc'):'',
|
'date_validation' => $invoice->date_validation?dol_print_date($invoice->date_creation,'dayhourrfc'):'',
|
||||||
'date_modification' => $invoice->datem?dol_print_date($invoice->datem,'dayhourrfc'):'',
|
'date_modification' => $invoice->datem?dol_print_date($invoice->datem,'dayhourrfc'):'',
|
||||||
'type' => $invoice->type,
|
'type' => $invoice->type,
|
||||||
'total_net' => $invoice->total_ht,
|
'total_net' => $invoice->total_ht,
|
||||||
'total_vat' => $invoice->total_tva,
|
'total_vat' => $invoice->total_tva,
|
||||||
'total' => $invoice->total_ttc,
|
'total' => $invoice->total_ttc,
|
||||||
'note_private' => $invoice->note_private?$invoice->note_private:'',
|
'note_private' => $invoice->note_private?$invoice->note_private:'',
|
||||||
'note_public' => $invoice->note_public?$invoice->note_public:'',
|
'note_public' => $invoice->note_public?$invoice->note_public:'',
|
||||||
'status'=> $invoice->statut,
|
'status'=> $invoice->statut,
|
||||||
'close_code' => $invoice->close_code?$invoice->close_code:'',
|
'close_code' => $invoice->close_code?$invoice->close_code:'',
|
||||||
'close_note' => $invoice->close_note?$invoice->close_note:'',
|
'close_note' => $invoice->close_note?$invoice->close_note:'',
|
||||||
'lines' => $linesresp
|
'lines' => $linesresp
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$objectresp=array(
|
$objectresp=array(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user