@@ -1887,6 +1887,23 @@ public function getPostFields() {
18871887 return $ this ->postFields ;
18881888 }
18891889
1890+
1891+ /**
1892+ * Prepare "IN" subselect
1893+ *
1894+ * @param array $items
1895+ * @param string $key
1896+ *
1897+ * @return string "in" fragment
1898+ */
1899+ public static function flexiIN (array $ items , string $ key ) {
1900+ $ slashed = array_map (function ($ a , $ column ) {
1901+ return $ column == 'stitky ' ? "' " . self ::code ($ a ) . "' " : "' $ a' " ;
1902+ }, $ data [$ column ],
1903+ array_fill (0 , count ($ data [$ column ]), $ column ));
1904+ return $ key . " in ( " . implode (', ' , $ slashed ) . ") " ;
1905+ }
1906+
18901907 /**
18911908 * Generuje fragment url pro filtrování.
18921909 *
@@ -1910,11 +1927,7 @@ public static function flexiUrl(array $data, $joiner = 'and', $defop = 'eq') {
19101927 } elseif (is_null ($ data [$ column ])) {
19111928 $ parts [$ column ] = $ column . " is null " ;
19121929 } elseif (is_array ($ data [$ column ])) {
1913- $ parts [$ column ] = $ column . " in ( " . implode (', ' ,
1914- array_map (function ($ a , $ column ) {
1915- return $ column == 'stitky ' ? "' " . self ::code ($ a ) . "' " : "' $ a' " ;
1916- }, $ data [$ column ],
1917- array_fill (0 , count ($ data [$ column ]), $ column ))) . ") " ;
1930+ $ parts [$ column ] = self ::flexiIN ($ value , $ column );
19181931 } elseif (is_object ($ data [$ column ])) {
19191932 switch (get_class ($ data [$ column ])) {
19201933 case 'DatePeriod ' :
@@ -2109,7 +2122,7 @@ public function getExternalID($want = null) {
21092122 $ ids = $ this ->getExternalIDs ();
21102123 if (is_null ($ want )) {
21112124 if (!empty ($ ids )) {
2112- $ extid = is_array ($ ids ) ? current ($ ids ) : $ ids ;
2125+ $ extid = is_array ($ ids-> value ) ? current ($ ids-> value ) : $ ids ;
21132126 }
21142127 } else {
21152128 if (!is_null ($ ids ) && is_array ($ ids ->value )) {
0 commit comments