Merge pull request #19732 from defrance/patch-173
FIX : allow create supplier order from other external modules
This commit is contained in:
commit
f848953238
@ -9,6 +9,7 @@
|
|||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014 Ion Agorria <ion@agorria.com>
|
* Copyright (C) 2014 Ion Agorria <ion@agorria.com>
|
||||||
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||||
|
* Copyright (C) 2022 Charlene Benke <charlene@patas-monkey.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -1211,13 +1212,17 @@ if (empty($reshook)) {
|
|||||||
if (!$error) {
|
if (!$error) {
|
||||||
// If creation from another object of another module (Example: origin=propal, originid=1)
|
// If creation from another object of another module (Example: origin=propal, originid=1)
|
||||||
if (!empty($origin) && !empty($originid)) {
|
if (!empty($origin) && !empty($originid)) {
|
||||||
|
$element = $subelement = $origin;
|
||||||
|
$classname = ucfirst($subelement);
|
||||||
if ($origin == 'propal' || $origin == 'proposal') {
|
if ($origin == 'propal' || $origin == 'proposal') {
|
||||||
$classname = 'Propal';
|
|
||||||
$element = 'comm/propal'; $subelement = 'propal';
|
$element = 'comm/propal'; $subelement = 'propal';
|
||||||
} elseif ($origin == 'order' || $origin == 'commande') {
|
$classname = 'Propal';
|
||||||
$classname = 'Commande';
|
}
|
||||||
|
if ($origin == 'order' || $origin == 'commande') {
|
||||||
$element = $subelement = 'commande';
|
$element = $subelement = 'commande';
|
||||||
} else {
|
$classname = 'Commande';
|
||||||
|
}
|
||||||
|
if ($origin == 'supplier_proposal') {
|
||||||
$classname = 'SupplierProposal';
|
$classname = 'SupplierProposal';
|
||||||
$element = 'supplier_proposal';
|
$element = 'supplier_proposal';
|
||||||
$subelement = 'supplier_proposal';
|
$subelement = 'supplier_proposal';
|
||||||
@ -1529,6 +1534,7 @@ if ($action == 'create') {
|
|||||||
if (!empty($origin) && !empty($originid)) {
|
if (!empty($origin) && !empty($originid)) {
|
||||||
// Parse element/subelement (ex: project_task)
|
// Parse element/subelement (ex: project_task)
|
||||||
$element = $subelement = $origin;
|
$element = $subelement = $origin;
|
||||||
|
$classname = ucfirst($subelement);
|
||||||
$regs = array();
|
$regs = array();
|
||||||
if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) {
|
if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) {
|
||||||
$element = $regs[1];
|
$element = $regs[1];
|
||||||
@ -1538,15 +1544,19 @@ if ($action == 'create') {
|
|||||||
if ($origin == 'propal' || $origin == 'proposal') {
|
if ($origin == 'propal' || $origin == 'proposal') {
|
||||||
$classname = 'Propal';
|
$classname = 'Propal';
|
||||||
$element = 'comm/propal'; $subelement = 'propal';
|
$element = 'comm/propal'; $subelement = 'propal';
|
||||||
} elseif ($origin == 'order' || $origin == 'commande') {
|
}
|
||||||
|
if ($origin == 'order' || $origin == 'commande') {
|
||||||
$classname = 'Commande';
|
$classname = 'Commande';
|
||||||
$element = $subelement = 'commande';
|
$element = $subelement = 'commande';
|
||||||
} else {
|
}
|
||||||
|
if ($origin == 'supplier_proposal') {
|
||||||
$classname = 'SupplierProposal';
|
$classname = 'SupplierProposal';
|
||||||
$element = 'supplier_proposal';
|
$element = 'supplier_proposal';
|
||||||
$subelement = 'supplier_proposal';
|
$subelement = 'supplier_proposal';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dol_include_once('/'.$element.'/class/'.$subelement.'.class.php');
|
dol_include_once('/'.$element.'/class/'.$subelement.'.class.php');
|
||||||
|
|
||||||
$objectsrc = new $classname($db);
|
$objectsrc = new $classname($db);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user