szollosil преди 1 година
родител
ревизия
13e0db31c9

+ 3 - 1
compta/facture/card.php

@@ -5131,7 +5131,9 @@ if ($action == 'create') {
 
 	print dol_get_fiche_end();
 
-	print $form->buttonsSaveCancel("CreateDraft");
+	print $form->buttonsSaveCancelOwn("Create", "Cancel", "compta/facture/list.php?leftmenu=customers_bills");
+	//print $helper->buttonsSaveCancel("Create", "Cancel", "/compta/facture/list.php?leftmenu=customers_bills"); // csak a create marad, mert a cancel nem működik megfelelően
+
 
 	// Show origin lines
 	if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {

+ 72 - 1
core/class/html.form.class.php

@@ -10408,7 +10408,11 @@ class Form
 
 		foreach ($buttons as $button) {
 			$addclass = empty($button['addclass']) ? '' : $button['addclass'];
-			$retstring .= '<input type="submit" class="button button-'.$button['name'].($morecss ? ' '.$morecss : '').' '.$addclass.'" name="'.$button['name'].'" value="'.dol_escape_htmltag($langs->trans($button['label_key'])).'">';
+			if ($button['name'] !== 'cancel'){
+				$retstring .= '<input type="submit" class="button button-'.$button['name'].($morecss ? ' '.$morecss : '').' '.$addclass.'" name="'.$button['name'].'" value="'.dol_escape_htmltag($langs->trans($button['label_key'])).'">';
+			}else{
+				$retstring .= '<a class="button button-' . $cancel['name'] . '" href="' . dol_buildpath($cancelURL, 1) . '?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans($cancel['label_key']) . '</a>';
+			}
 		}
 		$retstring .= $withoutdiv ? '': '</div>';
 
@@ -10424,4 +10428,71 @@ class Form
 
 		return $retstring;
 	}
+
+	/**
+	 * Output the buttons to submit a creation/edit form
+	 *
+	 * @param   string  $save_label     	Alternative label for save button
+	 * @param   string  $cancel_label   	Alternative label for cancel button
+	 * @param   array   $morebuttons    	Add additional buttons between save and cancel
+	 * @param   bool    $withoutdiv     	Option to remove enclosing centered div
+	 * @param	string	$morecss			More CSS
+	 * @param	string	$dol_openinpopup	If the button are shown in a context of a page shown inside a popup, we put here the string name of popup.
+	 * @return 	string						Html code with the buttons
+	 */
+	public function buttonsSaveCancelOwn($save_label = 'Save', $cancel_label = 'Cancel', $cancelURL = '', $morebuttons = array(), $withoutdiv = 0, $morecss = '', $dol_openinpopup = '')
+    {
+        global $langs;
+
+        $buttons = array();
+
+        $save = array(
+            'name' => 'save',
+            'label_key' => $save_label,
+        );
+
+        if ($save_label == 'Create' || $save_label == 'Add') {
+            $save['name'] = 'add';
+        } elseif ($save_label == 'Modify') {
+            $save['name'] = 'edit';
+        }
+
+        $cancel = array(
+            'name' => 'cancel',
+            'label_key' => 'Cancel',
+        );
+
+        !empty($save_label) ? $buttons[] = $save : '';
+
+        if (!empty($morebuttons)) {
+            $buttons[] = $morebuttons;
+        }
+
+        //!empty($cancel_label) ? $buttons[] = $cancel : '';
+
+        $retstring = $withoutdiv ? '' : '<div class="center">';
+
+        foreach ($buttons as $button) {
+            $addclass = empty($button['addclass']) ? '' : $button['addclass'];
+            $retstring .= '<input type="submit" class="button button-' . $button['name'] . ($morecss ? ' ' . $morecss : '') . ' ' . $addclass . '" name="' . $button['name'] . '" value="' . dol_escape_htmltag($langs->trans($button['label_key'])) . '">';
+        }
+
+        if ($cancel_label == "Cancel") {
+            $retstring .= '<a class="button button-' . $cancel['name'] . '" href="' . dol_buildpath($cancelURL, 1) . '?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans($cancel['label_key']) . '</a>';
+        }
+
+        $retstring .= $withoutdiv ? '' : '</div>';
+
+        if ($dol_openinpopup) {
+            $retstring .= '<!-- buttons are shown into a $dol_openinpopup=' . $dol_openinpopup . ' context, so we enable the close of dialog on cancel -->' . "\n";
+            $retstring .= '<script>';
+            $retstring .= 'jQuery(".button-cancel").click(function(e) {
+				e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . $dol_openinpopup . '\');
+				window.parent.jQuery(\'#idfordialog' . $dol_openinpopup . '\').dialog(\'close\');
+				 });';
+            $retstring .= '</script>';
+        }
+
+        return $retstring;
+    }
 }

+ 3 - 3
custom/rollerstorage/class/api_rollerstorage.class.php

@@ -103,7 +103,7 @@ class RollerstorageApi extends DolibarrApi
 	public function checkPermissionLT()
 	{
 		global $conf, $user;
-		ApiBbusLog::LunaToursLog("checkPermissionLT_START");
+		//ApiBbusLog::LunaToursLog("checkPermissionLT_START");
 		$memcached = new Memcached();
 		$memcached->addServer("szollosil-excelia-urbanms-memcached", 11211);
 
@@ -120,9 +120,9 @@ class RollerstorageApi extends DolibarrApi
 			$permissionArray = $this->lunatours->createPermissionArray($productsBasicServices);
 			$cacheValue = json_encode($permissionArray);
 			$memcached->set($key, $cacheValue, 600); // 5 percig tároljuk
-			ApiBbusLog::LunaToursLog("Adat betöltve az adatbázisból: " . $cacheValue);
+			//ApiBbusLog::LunaToursLog("Adat betöltve az adatbázisból: " . $cacheValue);
 		} else {
-			ApiBbusLog::LunaToursLog("Adat betöltve a cache-ből: " . $cacheValue);
+			//ApiBbusLog::LunaToursLog("Adat betöltve a cache-ből: " . $cacheValue);
 		}
 		return json_decode($cacheValue, true);
 	}

+ 13 - 0
custom/settlements/core/triggers/interface_99_modSettlements_SettlementsTriggers.class.php

@@ -121,6 +121,8 @@ class InterfaceSettlementsTriggers extends DolibarrTriggers
 		//print $action;
 		//print '<br>';
 		//print_r($object);
+		//print $object->ref;
+		//print $object->table_element;
 		//exit;
 		switch ($action) {
 			case 'GROUP_CREATE':
@@ -192,6 +194,17 @@ class InterfaceSettlementsTriggers extends DolibarrTriggers
 					$groupusers = new GroupUsers($this->db);
 					$groupusers->updateGroupUserRow($group_id, $fk_user, $rowid);
 				}
+				if ($object->table_element == 'settlements_group') {
+					$sql = "update llx_settlements_grouptools as sgtup SET ref = '{$object->ref}', label = '{$object->ref}' WHERE sgtup.rowid IN (
+						SELECT sgt.rowid FROM public.llx_settlements_group as sg
+						INNER JOIN llx_settlements_usergrouptoolgroup as sugtg ON sugtg.fk_groupid = sg.rowid
+						INNER JOIN llx_settlements_grouptools as sgt ON sgt.rowid = sugtg.fk_group_tools_id
+						WHERE sg.rowid = {$object->id}
+						ORDER BY sg.rowid ASC
+						)";
+					$result = $this->db->query($sql);
+
+				}
 				break;
 			case 'GROUP_DELETE':
 				global $db;