diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 72238eab75e63..e82b155a7d3db 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1530,11 +1530,12 @@ $element = $subelement = 'expedition'; } - $object->origin = $origin; + $object->origin = $origin; // deprecated + $object->origin_type = $origin; $object->origin_id = $originid; // Possibility to add external linked objects with hooks - $object->linked_objects[$object->origin] = $object->origin_id; + $object->linked_objects[$object->origin_type] = $object->origin_id; // link with order if it is a shipping invoice if ($object->origin == 'shipping') { require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; @@ -1903,7 +1904,7 @@ }*/ // Hooks - $parameters = array('objFrom' => $srcobject); + $parameters = array('origin_type' => $object->origin_type, 'origin_id' => $object->origin_id, 'objFrom' => $srcobject); $reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been // modified by hook if ($reshook < 0) { @@ -1959,7 +1960,8 @@ if (!empty($origin) && !empty($originid)) { include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; - $object->origin = $origin; + $object->origin = $origin; // deprecated + $object->origin_type = $origin; $object->origin_id = $originid; // retained warranty @@ -1981,8 +1983,6 @@ } foreach ($object->lines as $i => &$line) { - $line->origin = $object->origin; - $line->origin_id = $line->id; $line->fk_prev_id = $line->id; $line->fetch_optionals(); if (getDolGlobalInt('INVOICE_USE_SITUATION') == 2) { @@ -2023,6 +2023,7 @@ $object->note = trim(GETPOST('note', 'restricthtml')); $object->note_private = trim(GETPOST('note', 'restricthtml')); $object->ref_client = GETPOST('ref_client', 'alpha'); + $object->ref_customer = GETPOST('ref_client', 'alpha'); $object->model_pdf = GETPOST('model', 'alpha'); $object->fk_project = GETPOSTINT('projectid'); $object->cond_reglement_id = GETPOSTINT('cond_reglement_id'); @@ -2035,6 +2036,7 @@ // Special properties of replacement invoice $object->situation_counter += 1; + $id = $object->createFromCurrent($user); if ($id <= 0) { $mesg = $object->error; @@ -2048,6 +2050,15 @@ if ($ret > 0) { $nextSituationInvoice->insertExtraFields(); } + + // Hooks + $parameters = array('origin_type' => $object->origin_type, 'origin_id' => $object->origin_id); + $reshook = $hookmanager->executeHooks('createFrom', $parameters, $nextSituationInvoice, $action); // Note that $action and $object may have been + // modified by hook + if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + $error++; + } } } } diff --git a/htdocs/core/bookmarks_page.php b/htdocs/core/bookmarks_page.php index a24918273d833..06b855459ff88 100644 --- a/htdocs/core/bookmarks_page.php +++ b/htdocs/core/bookmarks_page.php @@ -146,7 +146,7 @@ print "\n"; print "\n"; -print '