Merge pull request #10305 from tuxgasy/8.0_bill_orders
Fix #10301 mass bill orders
This commit is contained in:
commit
0d9367b09d
@ -517,7 +517,9 @@ if ($massaction == 'confirm_createbills')
|
||||
$objecttmp = new Facture($db);
|
||||
if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) $objecttmp = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created order.
|
||||
else {
|
||||
|
||||
// Load extrafields of order
|
||||
$cmd->fetch_optionals();
|
||||
|
||||
$objecttmp->socid = $cmd->socid;
|
||||
$objecttmp->type = Facture::TYPE_STANDARD;
|
||||
$objecttmp->cond_reglement_id = $cmd->cond_reglement_id;
|
||||
@ -534,6 +536,8 @@ if ($massaction == 'confirm_createbills')
|
||||
$objecttmp->origin = 'commande';
|
||||
$objecttmp->origin_id = $id_order;
|
||||
|
||||
$objecttmp->array_options = $cmd->array_options; // Copy extrafields
|
||||
|
||||
$res = $objecttmp->create($user);
|
||||
|
||||
if($res > 0) $nb_bills_created++;
|
||||
@ -683,6 +687,7 @@ if ($massaction == 'confirm_createbills')
|
||||
if (! $error && $validate_invoices)
|
||||
{
|
||||
$massaction = $action = 'builddoc';
|
||||
|
||||
foreach($TAllFact as &$objecttmp)
|
||||
{
|
||||
$result = $objecttmp->validate($user);
|
||||
@ -700,7 +705,12 @@ if ($massaction == 'confirm_createbills')
|
||||
$donotredirect = 1;
|
||||
$upload_dir = $conf->facture->dir_output;
|
||||
$permissioncreate=$user->rights->facture->creer;
|
||||
|
||||
// Call action to build doc
|
||||
$savobject = $object;
|
||||
$object = $objecttmp;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
$object = $savobject;
|
||||
}
|
||||
|
||||
$massaction = $action = 'confirm_createbills';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user