clean code (#35533)

This commit is contained in:
Frédéric FRANCE
2025-09-28 20:56:54 +02:00
committed by GitHub
parent 38a7524846
commit 7fb7d38ffc
2 changed files with 16 additions and 15 deletions

View File

@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) ---Replace with your own copyright and developer email---
*
* This program is free software; you can redistribute it and/or modify
@@ -160,20 +160,20 @@ class MyModuleApi extends DolibarrApi
}
}
// Add where from hooks and sqlfilters
$parameters = array('sqlfilters' => $sqlfilters, 'apiroute' => 'myobject', 'apimethod' => 'index');
$parameters = array('sqlfilters' => $sqlfilters, 'apiroute' => 'myobject', 'apimethod' => __METHOD__);
$action = 'list';
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $tmpobject, $action); // Note that $action and $object may have been modified by hook
if ($reshook > 0) {
$sql .= $hookmanager->resPrint;
$sql = $hookmanager->resPrint;
} elseif ($reshook == 0) {
$sql .= $hookmanager->resPrint;
}
if ($sqlfilters) {
$errormessage = '';
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
if ($errormessage) {
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
if ($sqlfilters) {
$errormessage = '';
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
if ($errormessage) {
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
}