Fix: compatibility with element and subelement
This commit is contained in:
parent
41f73f57a3
commit
424eabd13c
@ -45,12 +45,11 @@ $langs->load('bills');
|
|||||||
$langs->load('orders');
|
$langs->load('orders');
|
||||||
$langs->load('products');
|
$langs->load('products');
|
||||||
|
|
||||||
$sall=isset($_GET["sall"])?$_GET["sall"]:$_POST["sall"];
|
$sall=GETPOST("sall");
|
||||||
if (isset($_GET["msg"])) { $mesg=$_GET["mesg"]; }
|
$mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg"));
|
||||||
$year=isset($_GET["year"])?$_GET["year"]:"";
|
$year=GETPOST("year");
|
||||||
$month=isset($_GET["month"])?$_GET["month"]:"";
|
$month=GETPOST("month");
|
||||||
$socid=isset($_GET['socid'])?$_GET['socid']:$_POST['socid'];
|
$socid=GETPOST('socid');
|
||||||
$mesg=isset($_GET['mesg'])?$_GET['mesg']:'';
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$module='propale';
|
$module='propale';
|
||||||
@ -370,11 +369,11 @@ if ($_GET["action"] == 'classifybilled')
|
|||||||
/*
|
/*
|
||||||
* Cloture de la propale
|
* Cloture de la propale
|
||||||
*/
|
*/
|
||||||
if ($_REQUEST['action'] == 'setstatut' && $user->rights->propale->cloturer)
|
if (GETPOST('action') == 'setstatut' && $user->rights->propale->cloturer)
|
||||||
{
|
{
|
||||||
if (! $_POST['cancel'])
|
if (! $_POST['cancel'])
|
||||||
{
|
{
|
||||||
if (empty($_REQUEST['statut']))
|
if (! GETPOST('statut'))
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("CloseAs")).'</div>';
|
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("CloseAs")).'</div>';
|
||||||
$_REQUEST['action']='statut';
|
$_REQUEST['action']='statut';
|
||||||
@ -964,8 +963,8 @@ $companystatic=new Societe($db);
|
|||||||
|
|
||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
|
|
||||||
$id = $_REQUEST['id']?$_REQUEST['id']:$_REQUEST['id'];
|
$id = GETPOST('id');
|
||||||
$ref= $_REQUEST['ref'];
|
$ref= GETPOST('ref');
|
||||||
|
|
||||||
if ($id > 0 || ! empty($ref))
|
if ($id > 0 || ! empty($ref))
|
||||||
{
|
{
|
||||||
@ -1559,7 +1558,13 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
foreach($object->linked_object as $linked_object => $linked_objectid)
|
foreach($object->linked_object as $linked_object => $linked_objectid)
|
||||||
{
|
{
|
||||||
if($conf->$linked_object->enabled && $linked_object != $object->element)
|
$element = $subelement = $linked_object;
|
||||||
|
if (preg_match('/^([^_]+)_([^_]+)/i',$linked_object,$regs))
|
||||||
|
{
|
||||||
|
$element = $regs[1];
|
||||||
|
$subelement = $regs[2];
|
||||||
|
}
|
||||||
|
if($conf->$element->enabled && $element != $object->element)
|
||||||
{
|
{
|
||||||
$somethingshown=$object->showLinkedObjectBlock($linked_object,$linked_objectid,$somethingshown);
|
$somethingshown=$object->showLinkedObjectBlock($linked_object,$linked_objectid,$somethingshown);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1860,7 +1860,13 @@ else
|
|||||||
|
|
||||||
foreach($object->linked_object as $linked_object => $linked_objectid)
|
foreach($object->linked_object as $linked_object => $linked_objectid)
|
||||||
{
|
{
|
||||||
if($conf->$linked_object->enabled && $linked_object != $object->element)
|
$element = $subelement = $linked_object;
|
||||||
|
if (preg_match('/^([^_]+)_([^_]+)/i',$linked_object,$regs))
|
||||||
|
{
|
||||||
|
$element = $regs[1];
|
||||||
|
$subelement = $regs[2];
|
||||||
|
}
|
||||||
|
if($conf->$element->enabled && $element != $object->element)
|
||||||
{
|
{
|
||||||
$somethingshown=$object->showLinkedObjectBlock($linked_object,$linked_objectid,$somethingshown);
|
$somethingshown=$object->showLinkedObjectBlock($linked_object,$linked_objectid,$somethingshown);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1314,20 +1314,20 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['a
|
|||||||
/*
|
/*
|
||||||
* Generate document
|
* Generate document
|
||||||
*/
|
*/
|
||||||
if ($_REQUEST['action'] == 'builddoc') // En get ou en post
|
if (GETPOST('action') == 'builddoc') // En get ou en post
|
||||||
{
|
{
|
||||||
$object->fetch($facid);
|
$object->fetch($facid);
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
if ($_REQUEST['model'])
|
if (GETPOST('model'))
|
||||||
{
|
{
|
||||||
$object->setDocModel($user, $_REQUEST['model']);
|
$object->setDocModel($user, GETPOST('model'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define output language
|
// Define output language
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
$newlang='';
|
$newlang='';
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||||
if (! empty($newlang))
|
if (! empty($newlang))
|
||||||
{
|
{
|
||||||
@ -2780,7 +2780,13 @@ else
|
|||||||
|
|
||||||
foreach($object->linked_object as $linked_object => $linked_objectid)
|
foreach($object->linked_object as $linked_object => $linked_objectid)
|
||||||
{
|
{
|
||||||
if($conf->$linked_object->enabled && $linked_object != $object->element)
|
$element = $subelement = $linked_object;
|
||||||
|
if (preg_match('/^([^_]+)_([^_]+)/i',$linked_object,$regs))
|
||||||
|
{
|
||||||
|
$element = $regs[1];
|
||||||
|
$subelement = $regs[2];
|
||||||
|
}
|
||||||
|
if($conf->$element->enabled && $element != $object->element)
|
||||||
{
|
{
|
||||||
$somethingshown=$object->showLinkedObjectBlock($linked_object,$linked_objectid,$somethingshown);
|
$somethingshown=$object->showLinkedObjectBlock($linked_object,$linked_objectid,$somethingshown);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1364,16 +1364,22 @@ class CommonObject
|
|||||||
$num = sizeof($this->objectid);
|
$num = sizeof($this->objectid);
|
||||||
if ($num)
|
if ($num)
|
||||||
{
|
{
|
||||||
$classpath = $objecttype.'/class';
|
$element = $subelement = $objecttype;
|
||||||
$tplpath = $objecttype;
|
if (preg_match('/^([^_]+)_([^_]+)/i',$objecttype,$regs))
|
||||||
if ($objecttype == 'facture') { $tplpath = 'compta/'.$objecttype; $classpath = $tplpath.'/class'; } // To work with non standard path
|
{
|
||||||
if ($objecttype == 'propal') { $tplpath = 'comm/'.$objecttype; $classpath = $tplpath.'/class'; } // To work with non standard path
|
$element = $regs[1];
|
||||||
if ($objecttype == 'invoice_supplier') { $tplpath = 'fourn/facture'; $classpath = 'fourn/class'; } // To work with non standard path
|
$subelement = $regs[2];
|
||||||
if ($objecttype == 'order_supplier') { $tplpath = 'fourn/commande'; $classpath = 'fourn/class'; } // To work with non standard path
|
}
|
||||||
|
$classpath = $element.'/class';
|
||||||
|
$tplpath = $element;
|
||||||
|
if ($element == 'facture') { $tplpath = 'compta/'.$element; $classpath = $tplpath.'/class'; } // To work with non standard path
|
||||||
|
if ($element == 'propal') { $tplpath = 'comm/'.$element; $classpath = $tplpath.'/class'; } // To work with non standard path
|
||||||
|
if ($element == 'invoice_supplier') { $tplpath = 'fourn/facture'; $classpath = 'fourn/class'; } // To work with non standard path
|
||||||
|
if ($element == 'order_supplier') { $tplpath = 'fourn/commande'; $classpath = 'fourn/class'; } // To work with non standard path
|
||||||
|
|
||||||
$classfile = strtolower($objecttype); $classname = ucfirst($objecttype);
|
$classfile = strtolower($subelement); $classname = ucfirst($subelement);
|
||||||
if ($objecttype == 'invoice_supplier') { $classfile='fournisseur.facture'; $classname='FactureFournisseur'; }
|
if ($subelement == 'invoice_supplier') { $classfile='fournisseur.facture'; $classname='FactureFournisseur'; }
|
||||||
if ($objecttype == 'order_supplier') { $classfile='fournisseur.commande'; $classname='CommandeFournisseur'; }
|
if ($subelement == 'order_supplier') { $classfile='fournisseur.commande'; $classname='CommandeFournisseur'; }
|
||||||
//print $classfile." - ".$classpath." - ".$tplpath;
|
//print $classfile." - ".$classpath." - ".$tplpath;
|
||||||
if(!class_exists($classname))
|
if(!class_exists($classname))
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user