Эх сурвалжийг харах

JIRA: 389 some fixes and developments

szollosil 1 жил өмнө
parent
commit
d65a874d21

+ 79 - 5
comm/action/card.php

@@ -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;
 }

+ 2 - 2
core/modules/modTicket.class.php

@@ -292,7 +292,7 @@ class modTicket extends DolibarrModules
 			'user' => 0);
 		$r++;
 
-		$this->menu[$r] = array('fk_menu' => 'fk_mainmenu=ticket,fk_leftmenu=ticket',
+		/* $this->menu[$r] = array('fk_menu' => 'fk_mainmenu=ticket,fk_leftmenu=ticket',
 			'type' => 'left',
 			'titre' => 'Statistics',
 			'mainmenu' => 'ticket',
@@ -303,7 +303,7 @@ class modTicket extends DolibarrModules
 			'perms' => '$user->rights->ticket->read',
 			'target' => '',
 			'user' => 0);
-		$r++;
+		$r++; */
 
 		$this->menu[$r] = array('fk_menu' => 'fk_mainmenu=ticket,fk_leftmenu=ticket',
 			'type' => 'left',

+ 3 - 3
custom/bbus/class/api_bbus.class.php

@@ -415,7 +415,7 @@ class BBus extends DolibarrApi
 		$sqlFAC = "SELECT rowid FROM llx_facture WHERE ref = '{$ref}'";
 		$resultFAC = $this->db->query($sqlFAC);
 		if ($this->db->num_rows($resultFAC)) {
-			while($facture = $this->db->fetch_object($resultFAC)){
+			while ($facture = $this->db->fetch_object($resultFAC)) {
 				$sql = "SELECT fdet.fk_product FROM llx_facture AS f
 			INNER JOIN llx_facturedet as fdet ON fdet.fk_facture = f.rowid
 			WHERE f.rowid = {$facture->rowid}";
@@ -717,10 +717,10 @@ class BBus extends DolibarrApi
 			ORDER BY ac.datep ASC";
 		ApiBbusLog::appLog($sql);
 
-			$result = $this->db->query($sql);
+		$result = $this->db->query($sql);
 		return $this->db->num_rows($result) > 0 ? 1 : 0;
 	}
-		
+
 	private function getCutOffTimeDate($product_id)
 	{
 		$date = date("Y-m-d H:i:s");

+ 1 - 0
custom/booking/class/api_booking.class.php

@@ -558,6 +558,7 @@ class BookingApi extends DolibarrApi
 			if ($this->noLocalEmptySpaces($fk_event, $reservations)) {
 				throw new RestException(506, 'No available spaces');
 			}
+			print 'Itt van hely';exit;
 			ApiBbusLog::appLog("{$sendId}: firstEventStep: local");
 			$createdPreOrderOBJ = $this->localcreatedpreorderobj($sendId, $fk_event, $reservations, $product_id);
 		} else {