fix merging

This commit is contained in:
Philippe GRAND 2019-07-28 05:22:44 +02:00
commit 46514475d0
3 changed files with 13 additions and 13 deletions

View File

@ -88,18 +88,21 @@ if (preg_match('/api\/index\.php\/explorer/', $_SERVER["PHP_SELF"]) && ! empty($
// index.php/xxx called by any REST client to run API // index.php/xxx called by any REST client to run API
$reg=array();
preg_match('/index\.php\/([^\/]+)(.*)$/', $_SERVER["PHP_SELF"], $reg); preg_match('/index\.php\/([^\/]+)(.*)$/', $_SERVER["PHP_SELF"], $reg);
// .../index.php/categories?sortfield=t.rowid&sortorder=ASC // .../index.php/categories?sortfield=t.rowid&sortorder=ASC
// Set the flag to say to refresh (when we reload the explorer, production must be for API call only) // When in production mode, a file api/temp/routes.php is created with the API available of current call.
$refreshcache=false; // But, if we set $refreshcache to false, so it may have only one API in the routes.php file if we make a call for one API without
// using the explorer. And when we make another call for another API, the API is not into the api/temp/routes.php and a 404 is returned.
// So we force refresh to each call.
$refreshcache=(empty($conf->global->API_PRODUCTION_DO_NOT_ALWAYS_REFRESH_CACHE) ? true : false);
if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $reg[2] == '/swagger.json/root' || $reg[2] == '/resources.json' || $reg[2] == '/resources.json/root')) if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $reg[2] == '/swagger.json/root' || $reg[2] == '/resources.json' || $reg[2] == '/resources.json/root'))
{ {
$refreshcache=true; $refreshcache=true;
} }
$api = new DolibarrApi($db, '', $refreshcache); $api = new DolibarrApi($db, '', $refreshcache);
//var_dump($api->r->apiVersionMap); //var_dump($api->r->apiVersionMap);
@ -115,7 +118,7 @@ UploadFormat::$allowedMimeTypes = array('image/jpeg', 'image/png', 'text/plain',
// Call Explorer file for all APIs definitions // Call Explorer file for all APIs definitions (this part is slow)
if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $reg[2] == '/swagger.json/root' || $reg[2] == '/resources.json' || $reg[2] == '/resources.json/root')) if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $reg[2] == '/swagger.json/root' || $reg[2] == '/resources.json' || $reg[2] == '/resources.json/root'))
{ {
// Scan all API files to load them // Scan all API files to load them
@ -254,5 +257,6 @@ if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
//var_dump($api->r->apiVersionMap); //var_dump($api->r->apiVersionMap);
//exit; //exit;
// Call API (we suppose we found it) // Call API (we suppose we found it).
// The handle will use the file api/temp/routes.php to get data to run the API. If the file exists and the entry for API is not found, it will return 404.
$api->r->handle(); $api->r->handle();

View File

@ -6382,7 +6382,7 @@ abstract class CommonObject
* @param array $params Optional parameters. Example: array('style'=>'class="oddeven"', 'colspan'=>$colspan) * @param array $params Optional parameters. Example: array('style'=>'class="oddeven"', 'colspan'=>$colspan)
* @param string $keysuffix Suffix string to add after name and id of field (can be used to avoid duplicate names) * @param string $keysuffix Suffix string to add after name and id of field (can be used to avoid duplicate names)
* @param string $keyprefix Prefix string to add before name and id of field (can be used to avoid duplicate names) * @param string $keyprefix Prefix string to add before name and id of field (can be used to avoid duplicate names)
* @param string $onetrtd All fields in same tr td * @param string $onetrtd All fields in same tr td (TODO field not used ?)
* @return string * @return string
*/ */
public function showOptionals($extrafields, $mode = 'view', $params = null, $keysuffix = '', $keyprefix = '', $onetrtd = 0) public function showOptionals($extrafields, $mode = 'view', $params = null, $keysuffix = '', $keyprefix = '', $onetrtd = 0)
@ -6494,10 +6494,7 @@ abstract class CommonObject
$out .= '<tr id="'.$html_id.'" '.$csstyle.' class="'.$class.$this->element.'_extras_'.$key.' trextrafields_collapse'.$extrafields_collapse_num.'" '.$domData.' >'; $out .= '<tr id="'.$html_id.'" '.$csstyle.' class="'.$class.$this->element.'_extras_'.$key.' trextrafields_collapse'.$extrafields_collapse_num.'" '.$domData.' >';
if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) { $colspan='0'; }
{
if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) { $colspan='0'; }
}
if ($action == 'selectlines') { $colspan++; } if ($action == 'selectlines') { $colspan++; }

View File

@ -1132,11 +1132,10 @@ class ExpenseReport extends CommonObject
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
if (!$notrigger) if (! $error && ! $notrigger)
{ {
// Call trigger // Call trigger
$result=$this->call_trigger('EXPENSE_REPORT_VALIDATE', $fuser); $result=$this->call_trigger('EXPENSE_REPORT_VALIDATE', $fuser);
if ($result < 0) { if ($result < 0) {
$error++; $error++;
} }
@ -1160,7 +1159,7 @@ class ExpenseReport extends CommonObject
$dirdest = $conf->expensereport->dir_output.'/'.$newref; $dirdest = $conf->expensereport->dir_output.'/'.$newref;
if (file_exists($dirsource)) if (file_exists($dirsource))
{ {
dol_syslog(get_class($this)."::valid() rename dir ".$dirsource." into ".$dirdest); dol_syslog(get_class($this)."::setValidate() rename dir ".$dirsource." into ".$dirdest);
if (@rename($dirsource, $dirdest)) if (@rename($dirsource, $dirdest))
{ {