Fix: When creating an invoice, we must first create it as draft and then
after validate.
This commit is contained in:
parent
b62c069967
commit
9b38857c9a
@ -515,7 +515,7 @@ function createInvoice($authentication,$invoice)
|
||||
$newobject->date=dol_stringtotime($invoice['date'],'dayrfc');
|
||||
$newobject->note_private=$invoice['note_private'];
|
||||
$newobject->note_public=$invoice['note_public'];
|
||||
$newobject->statut=$invoice['status'];
|
||||
$newobject->statut=0; // We start with status draft
|
||||
$newobject->fk_project=$invoice['project_id'];
|
||||
$newobject->date_creation=$now;
|
||||
|
||||
@ -551,7 +551,7 @@ function createInvoice($authentication,$invoice)
|
||||
$error++;
|
||||
}
|
||||
|
||||
if ($newobject->statut == 1) // We want invoice validated
|
||||
if ($invoice['status'] == 1) // We want invoice to have status validated
|
||||
{
|
||||
$result=$newobject->validate($fuser);
|
||||
if ($result < 0)
|
||||
|
||||
@ -392,7 +392,7 @@ function getOrder($authentication,$id='',$ref='',$ref_ext='')
|
||||
'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_modification' => $invoice->datem?dol_print_date($invoice->datem,'dayhourrfc'):'',
|
||||
|
||||
|
||||
'remise' => $order->remise,
|
||||
'remise_percent' => $order->remise_percent,
|
||||
'remise_absolue' => $order->remise_absolue,
|
||||
@ -407,7 +407,7 @@ function getOrder($authentication,$id='',$ref='',$ref_ext='')
|
||||
'mode_reglement_id' => $order->mode_reglement_id,
|
||||
'mode_reglement_code' => $order->mode_reglement_code,
|
||||
'mode_reglement' => $order->mode_reglement,
|
||||
|
||||
|
||||
'date_livraison' => $order->date_livraison,
|
||||
'fk_delivery_address' => $order->fk_delivery_address,
|
||||
|
||||
@ -617,7 +617,7 @@ function createOrder($authentication,$order)
|
||||
dol_syslog("Function: createOrder login=".$authentication['login']." socid :".$order['socid']);
|
||||
|
||||
if ($authentication['entity']) $conf->entity=$authentication['entity'];
|
||||
|
||||
|
||||
// Init and check authentication
|
||||
$objectresp=array();
|
||||
$errorcode='';$errorlabel='';
|
||||
@ -637,7 +637,7 @@ function createOrder($authentication,$order)
|
||||
$newobject->date_lim_reglement=dol_stringtotime($order['date_due'],'dayrfc');
|
||||
$newobject->note_private=$order['note_private'];
|
||||
$newobject->note_public=$order['note_public'];
|
||||
$newobject->statut=0;
|
||||
$newobject->statut=0; // We start with status draft
|
||||
$newobject->facturee=$order['facturee'];
|
||||
$newobject->fk_project=$order['project_id'];
|
||||
$newobject->cond_reglement_id=$order['cond_reglement_id'];
|
||||
@ -679,7 +679,7 @@ function createOrder($authentication,$order)
|
||||
|
||||
}
|
||||
|
||||
if ($order['status'] == 1) // We want order validated
|
||||
if ($order['status'] == 1) // We want order to have status validated
|
||||
{
|
||||
dol_syslog("Webservice server_order:: order validation start", LOG_DEBUG);
|
||||
$result=$newobject->valid($fuser);
|
||||
@ -689,7 +689,7 @@ function createOrder($authentication,$order)
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
dol_syslog("Webservice server_order:: order creation & validation succeeded, commit", LOG_DEBUG);
|
||||
@ -704,7 +704,7 @@ function createOrder($authentication,$order)
|
||||
$errorcode='KO';
|
||||
$errorlabel=$newobject->error;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if ($error)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user