Commit b453851a authored by Sigrid Suski's avatar Sigrid Suski

(#) SobiPro::Count() function shows also unpublished and unapproved entries

parent 9e5b8c9d
......@@ -50,6 +50,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
(#) Updating special data for contact and info fields via template does not work
(#) Select list field in entry and search form wrongly created
(#) If a dynamic plugin task is available other plugin tasks weren't executed
(#) SobiPro::Count() function shows also unpublished and unapproved entries
### 1.6 (31 July 2020)
......
......@@ -17,7 +17,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* @created 10 January 2009 by Radek Suski
* @modified 03 September 2020 by Sigrid Suski
* @modified 17 September 2020 by Sigrid Suski
*/
defined( 'SOBIPRO' ) || exit( 'Restricted access' );
......@@ -400,11 +400,6 @@ abstract class SPDBObject extends SPObject
$order = trim( $order );
$conditions = [ 'sprl.pid' => $this->id ];
$conditions[ 'spo.oType' ] = $type;
if ( $state == 1 ) {
$conditions[ 'spo.state' ] = $state;
$conditions[ 'spo.approved' ] = $state;
}
$oPrefix = 'spo.';
switch ( $order ) {
......@@ -449,10 +444,23 @@ abstract class SPDBObject extends SPObject
}
break;
default:
$oPrefix = '';
$order = '';
$table = 'spdb_relations';
$conditions = [ 'pid' => $this->id ];
if ( $state ) {
$conditions[ 'spo.state' ] = $state;
$conditions[ 'spo.approved' ] = $state;
$table = $db->join(
[
[ 'table' => 'spdb_object', 'as' => 'spo', 'key' => 'id' ],
[ 'table' => 'spdb_relations', 'as' => 'sprl', 'key' => 'id' ],
]
);
$oPrefix = 'sprl.';
}
else {
$oPrefix = '';
$table = 'spdb_relations';
}
//$conditions[ 'oType' ] = $type;
break;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment