Merge branch 'develop' of github.com:Dolibarr/dolibarr into develop

This commit is contained in:
Quentin Vial-Gouteyron 2017-07-07 10:51:02 +02:00
commit 426b394b73
6 changed files with 43 additions and 33 deletions

View File

@ -101,7 +101,7 @@ else
$head = member_stats_prepare_head($adh);
dol_fiche_head($head, 'statsbyproperties', $langs->trans("Statistics"), 0, 'user');
dol_fiche_head($head, 'statsbyproperties', $langs->trans("Statistics"), -1, 'user');
// Print title

View File

@ -198,7 +198,7 @@ if ($mode)
$head = member_stats_prepare_head($adh);
dol_fiche_head($head, $tab, $langs->trans("Statistics"), 0, 'user');
dol_fiche_head($head, $tab, $langs->trans("Statistics"), -1, 'user');
// Print title

View File

@ -131,9 +131,9 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' |
{
while (($file = readdir($handle))!==false)
{
if (is_readable($dir.$file) && preg_match("/^mod(.*)\.class\.php$/i",$file,$reg))
if (is_readable($dir.$file) && preg_match("/^mod(.*)\.class\.php$/i",$file,$regmod))
{
$module = strtolower($reg[1]);
$module = strtolower($regmod[1]);
$moduledirforclass = getModuleDirForApiClass($module);
$moduleforperm = $module;
if ($module == 'propale') { $moduleforperm='propal'; }
@ -159,9 +159,9 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' |
if ($file_searched == 'api_access.class.php') continue;
// Support of the deprecated API.
if (is_readable($dir_part.$file_searched) && preg_match("/^api_deprecated_(.*)\.class\.php$/i",$file_searched,$reg))
if (is_readable($dir_part.$file_searched) && preg_match("/^api_deprecated_(.*)\.class\.php$/i",$file_searched,$regapi))
{
$classname = ucwords($reg[1]).'Api';
$classname = ucwords($regapi[1]).'Api';
require_once $dir_part.$file_searched;
if (class_exists($classname))
{
@ -173,9 +173,9 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' |
dol_syslog("We found an api_xxx file (".$file_searched.") but class ".$classname." does not exists after loading file", LOG_WARNING);
}
}
elseif (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i",$file_searched,$reg))
elseif (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i",$file_searched,$regapi))
{
$classname = ucwords($reg[1]);
$classname = ucwords($regapi[1]);
$classname = str_replace('_', '', $classname);
require_once $dir_part.$file_searched;
if (class_exists($classname))
@ -206,7 +206,7 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' |
}
// Call one APIs or one definition of an API
if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/resources.json' && preg_match('/^\/resources.json\/(.+)$/', $reg[2], $regbis))))
if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/resources.json' && preg_match('/^\/resources.json\/(.+)$/', $reg[2], $regbis) && $regbis[1] != 'root')))
{
$module = $reg[1];
if ($module == 'explorer') // If we call page to explore details of a service

View File

@ -447,9 +447,10 @@ class Categorie extends CommonObject
* Delete a category from database
*
* @param User $user Object user that ask to delete
* @return int <0 KO >0 OK
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 KO >0 OK
*/
function delete($user)
function delete($user, $notrigger=0)
{
global $conf,$langs;
@ -462,6 +463,14 @@ class Categorie extends CommonObject
$this->db->begin();
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('CATEGORY_DELETE',$user);
if ($result < 0) $error++;
// End call triggers
}
/* FIX #1317 : Check for child category and move up 1 level*/
if (! $error)
{
@ -580,25 +589,16 @@ class Categorie extends CommonObject
$this->error=$this->db->lasterror();
$error++;
}
else
}
// Removed extrafields
if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$this->deleteExtraFields();
if ($result < 0)
{
// Removed extrafields
if (! $error)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$this->deleteExtraFields();
if ($result < 0)
{
$error++;
dol_syslog(get_class($this)."::delete erreur ".$this->error, LOG_ERR);
}
}
}
// Call trigger
$result=$this->call_trigger('CATEGORY_DELETE',$user);
if ($result < 0) { $error++; }
// End call triggers
$error++;
dol_syslog(get_class($this)."::delete erreur ".$this->error, LOG_ERR);
}
}

View File

@ -172,7 +172,7 @@ while ($i < min($num,$limit))
$opensurvey_static->id=$obj->id_sondage;
$opensurvey_static->status=$obj->status;
print '<tr>';
print '<td>';
print '<a href="'.dol_buildpath('/opensurvey/card.php',1).'?id='.$obj->id_sondage.'">'.img_picto('','object_opensurvey').' '.$obj->id_sondage.'</a>';
@ -198,19 +198,27 @@ while ($i < min($num,$limit))
print '</td>';
print'<td align="right">'.$nbuser.'</td>'."\n";
print '<td align="center">'.dol_print_date($db->jdate($obj->date_fin),'day');
if ($db->jdate($obj->date_fin) < time()) { print ' ('.$langs->trans("Expired").')'; }
print '</td>';
print'<td align="center">'.$opensurvey_static->getLibStatut(5).'</td>'."\n";
print'<td align="center"></td>'."\n";
print '</tr>'."\n";
$i++;
}
// If no record found
if ($num == 0)
{
$colspan=8;
//foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
}
print '</table>'."\n";
print '</div>';
print '</form>';

View File

@ -311,7 +311,9 @@ if ($ret)
}
else
{
print '<tr><td class="opacitymedium">'.$langs->trans('NoResourceInDatabase').'</td></tr>';
$colspan=1;
foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
}
print '</table>';