|
|
@@ -2231,7 +2231,8 @@ if ($id > 0) {
|
|
|
$morehtmlref .= '</div>';
|
|
|
|
|
|
|
|
|
- dol_banner_tab($object, 'id', $linkback, ($user->socid ? 0 : 1), 'id', 'ref', $morehtmlref);
|
|
|
+ //dol_banner_tab($object, 'id', $linkback, ($user->socid ? 0 : 1), 'id', 'ref', $morehtmlref);
|
|
|
+ dol_banner_tab($object, 'id', $linkback, 0, 'id', 'ref', $morehtmlref);
|
|
|
|
|
|
print '<div class="fichecenter">';
|
|
|
print '<div class="fichehalfleft">';
|
|
|
@@ -2417,7 +2418,7 @@ if ($id > 0) {
|
|
|
|
|
|
// Object linked (if link is for thirdparty, contact, project it is a recording error. We should not have links in link table
|
|
|
// for such objects because there is already a dedicated field into table llx_actioncomm.
|
|
|
- if (!empty($object->fk_element) && !empty($object->elementtype) && !in_array($object->elementtype, array('societe', 'contact', 'project'))) {
|
|
|
+ /* if (!empty($object->fk_element) && !empty($object->elementtype) && !in_array($object->elementtype, array('societe', 'contact', 'project'))) {
|
|
|
include_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
|
|
|
print '<tr><td>' . $langs->trans("LinkedObject") . '</td>';
|
|
|
$link = dolGetElementUrl($object->fk_element, $object->elementtype, 1);
|
|
|
@@ -2428,6 +2429,19 @@ if ($id > 0) {
|
|
|
print $link;
|
|
|
}
|
|
|
print '</td></tr>';
|
|
|
+ } */
|
|
|
+
|
|
|
+ if (!empty($object->fk_element) && !empty($object->elementtype) && !in_array($object->elementtype, array('societe', 'contact', 'project'))) {
|
|
|
+ include_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
|
|
|
+ print '<tr><td>' . $langs->trans("LinkedObject") . '</td>';
|
|
|
+ $link = ownDolGetElementUrl($object->fk_element, $object->elementtype, 1);
|
|
|
+ print '<td>';
|
|
|
+ if (empty($link)) {
|
|
|
+ print '<span class="opacitymedium">' . $langs->trans("ObjectDeleted") . '</span>';
|
|
|
+ } else {
|
|
|
+ print $link;
|
|
|
+ }
|
|
|
+ print '</td></tr>';
|
|
|
}
|
|
|
|
|
|
// Description
|
|
|
@@ -2545,7 +2559,7 @@ if ($id > 0) {
|
|
|
//print $formfile->showdocuments('actions', $object->id, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 0, 0, '', '', '', $langs->getDefaultLang());
|
|
|
|
|
|
print showFactures($id);
|
|
|
-
|
|
|
+
|
|
|
print '</div><div class="fichehalfright">';
|
|
|
|
|
|
|
|
|
@@ -2577,7 +2591,8 @@ function listOfFactures($id)
|
|
|
return $facturesString;
|
|
|
}
|
|
|
|
|
|
-function getAllFacturesOfThisEvent($id){
|
|
|
+function getAllFacturesOfThisEvent($id)
|
|
|
+{
|
|
|
global $db;
|
|
|
$sqlFactures = "SELECT bh.invoice_number, usr.login, usr.firstname, usr.lastname
|
|
|
FROM llx_booking_bookinghistory as bh
|
|
|
@@ -2586,7 +2601,8 @@ function getAllFacturesOfThisEvent($id){
|
|
|
return $db->query($sqlFactures);
|
|
|
}
|
|
|
|
|
|
-function showFactures($id){
|
|
|
+function showFactures($id)
|
|
|
+{
|
|
|
global $db, $langs;
|
|
|
$NumberOfFactures = $db->num_rows(getAllFacturesOfThisEvent($id));
|
|
|
|
|
|
@@ -2616,5 +2632,63 @@ function showFactures($id){
|
|
|
</tbody>
|
|
|
</table>
|
|
|
</div>';
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * Return link url to an object
|
|
|
+ *
|
|
|
+ * @param int $objectid Id of record
|
|
|
+ * @param string $objecttype Type of object ('invoice', 'order', 'expedition_bon', 'myobject@mymodule', ...)
|
|
|
+ * @param int $withpicto Picto to show
|
|
|
+ * @param string $option More options
|
|
|
+ * @return string URL of link to object id/type
|
|
|
+ */
|
|
|
+function ownDolGetElementUrl($objectid, $objecttype, $withpicto = 0, $option = '')
|
|
|
+{
|
|
|
+ global $db, $conf, $langs;
|
|
|
|
|
|
+ $ret = '';
|
|
|
+ $regs = array();
|
|
|
+
|
|
|
+ // If we ask a resource form external module (instead of default path)
|
|
|
+ if (preg_match('/^([^@]+)@([^@]+)$/i', $objecttype, $regs)) {
|
|
|
+ $myobject = $regs[1];
|
|
|
+ $module = $regs[2];
|
|
|
+ } else {
|
|
|
+ // Parse $objecttype (ex: project_task)
|
|
|
+ $module = $myobject = $objecttype;
|
|
|
+ if (preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) {
|
|
|
+ $module = $regs[1];
|
|
|
+ $myobject = $regs[2];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // Generic case for $classpath
|
|
|
+ $classpath = $module.'/class';
|
|
|
+
|
|
|
+ // Generic case for $classfile and $classname
|
|
|
+ $classfile = strtolower($myobject);
|
|
|
+ $classname = ucfirst($myobject);
|
|
|
+ //print "objecttype=".$objecttype." module=".$module." subelement=".$subelement." classfile=".$classfile." classname=".$classname." classpath=".$classpath;
|
|
|
+
|
|
|
+
|
|
|
+ if (isModEnabled($module)) {
|
|
|
+ $res = dol_include_once('/'.$classpath.'/'.$classfile.'.class.php');
|
|
|
+ if ($res) {
|
|
|
+ if (class_exists($classname)) {
|
|
|
+ $object = new $classname($db);
|
|
|
+ $res = $object->fetch($objectid);
|
|
|
+ $object->ref = $object->label;
|
|
|
+ if ($res > 0) {
|
|
|
+ $ret = $object->getNomUrl($withpicto, $option);
|
|
|
+ } elseif ($res == 0) {
|
|
|
+ $ret = $langs->trans('Deleted');
|
|
|
+ }
|
|
|
+ unset($object);
|
|
|
+ } else {
|
|
|
+ dol_syslog("Class with classname ".$classname." is unknown even after the include", LOG_ERR);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return $ret;
|
|
|
}
|