Add Invoice hook in orderstoinvoice.php + Standardization
Signed-off-by: Stephen L. <lrq3000@gmail.com>
This commit is contained in:
parent
9ab8f4c6a3
commit
3b9af82c39
@ -78,6 +78,12 @@ if ($action == 'create')
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->initHooks(array('orderstoinvoice'));
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -200,18 +206,18 @@ if (($action == 'create' || $action == 'add') && empty($mesgs))
|
||||
|
||||
while ($ii < $nn)
|
||||
{
|
||||
dol_include_once('/commande/class/commande.class.php');
|
||||
$srcobject = new Commande($db);
|
||||
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
$objectsrc = new Commande($db);
|
||||
dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines");
|
||||
$result=$srcobject->fetch($orders_id[$ii]);
|
||||
$result=$objectsrc->fetch($orders_id[$ii]);
|
||||
if ($result > 0)
|
||||
{
|
||||
if($closeOrders) {
|
||||
$srcobject->classer_facturee();
|
||||
$srcobject->setStatut(3);
|
||||
$objectsrc->classer_facturee();
|
||||
$objectsrc->setStatut(3);
|
||||
}
|
||||
$lines = $srcobject->lines;
|
||||
if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines();
|
||||
$lines = $objectsrc->lines;
|
||||
if (empty($lines) && method_exists($objectsrc,'fetch_lines')) $lines = $objectsrc->fetch_lines();
|
||||
$fk_parent_line=0;
|
||||
$num=count($lines);
|
||||
for ($i=0;$i<$num;$i++)
|
||||
@ -306,7 +312,7 @@ if (($action == 'create' || $action == 'add') && empty($mesgs))
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesgs[]=$srcobject->error;
|
||||
$mesgs[]=$objectsrc->error;
|
||||
$error++;
|
||||
}
|
||||
$ii++;
|
||||
@ -424,6 +430,23 @@ if ($action == 'create' && empty($mesgs))
|
||||
select_projects($soc->id, $projectid, 'projectid');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
$objectsrc = new Commande($db);
|
||||
$listoforders = array();
|
||||
foreach ($selected as $sel)
|
||||
{
|
||||
$result=$objectsrc->fetch($sel);
|
||||
if ($result > 0)
|
||||
{
|
||||
$listoforders[] = $objectsrc->ref;
|
||||
}
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters=array('objectsrc' => $objectsrc, 'idsrc' => $listoforders, 'colspan' => ' colspan="3"');
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
// Modele PDF
|
||||
print '<tr><td>'.$langs->trans('Model').'</td>';
|
||||
print '<td>';
|
||||
@ -438,18 +461,7 @@ if ($action == 'create' && empty($mesgs))
|
||||
print '<td valign="top" colspan="2">';
|
||||
print '<textarea name="note_public" wrap="soft" cols="70" rows="'.ROWS_3.'">';
|
||||
|
||||
dol_include_once('/commande/class/commande.class.php');
|
||||
$srcobject = new Commande($db);
|
||||
$listoforders = '';
|
||||
foreach ($selected as $sel)
|
||||
{
|
||||
$result=$srcobject->fetch($sel);
|
||||
if ($result > 0)
|
||||
{
|
||||
$listoforders .= ($listoforders?', ':'').$srcobject->ref;
|
||||
}
|
||||
}
|
||||
print $langs->trans("Orders").": ".$listoforders;
|
||||
print $langs->trans("Orders").": ".implode(', ', $listoforders);
|
||||
|
||||
print '</textarea></td></tr>';
|
||||
// Private note
|
||||
|
||||
Loading…
Reference in New Issue
Block a user