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

This commit is contained in:
Laurent Destailleur 2012-06-06 23:13:06 +02:00
commit 5c553878c7
4 changed files with 41 additions and 28 deletions

View File

@ -49,14 +49,9 @@ if (! $user->rights->facture->creer)
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
if ($page == -1) { $page = 0; }
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortfield) $sortfield='c.rowid'; if (! $sortfield) $sortfield='c.rowid';
if (! $sortorder) $sortorder='DESC'; if (! $sortorder) $sortorder='DESC';
$limit = $conf->liste_limit;
$date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]); // Date for local PHP server $date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]); // Date for local PHP server
$date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]); $date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]);
$date_starty=dol_mktime(0,0,0,$_REQUEST["date_start_delymonth"],$_REQUEST["date_start_delyday"],$_REQUEST["date_start_delyyear"]); // Date for local PHP server $date_starty=dol_mktime(0,0,0,$_REQUEST["date_start_delymonth"],$_REQUEST["date_start_delyday"],$_REQUEST["date_start_delyyear"]); // Date for local PHP server
@ -202,14 +197,12 @@ if (($action == 'create' || $action == 'add') && ! $mesg )
$sql.= ", '".$object->element."'"; $sql.= ", '".$object->element."'";
$sql.= ")"; $sql.= ")";
dol_syslog(get_class($this)."::add_object_linked sql=".$sql, LOG_DEBUG);
if ($db->query($sql)) if ($db->query($sql))
{ {
$db->commit(); $db->commit();
} }
else else
{ {
$db->rollback(); $db->rollback();
} }
} }
@ -528,7 +521,6 @@ else
$sql.= ' AND c.ref_client LIKE \'%'.$db->escape($sref_client).'%\''; $sql.= ' AND c.ref_client LIKE \'%'.$db->escape($sref_client).'%\'';
} }
$sql.= ' ORDER BY '.$sortfield.' '.$sortorder; $sql.= ' ORDER BY '.$sortfield.' '.$sortorder;
$sql.= $db->plimit($limit + 1,$offset);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
@ -545,7 +537,7 @@ else
} }
$title.=' - '.$langs->trans('StatusOrderToBillShort'); $title.=' - '.$langs->trans('StatusOrderToBillShort');
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
print_barre_liste($title, $_GET['page'], 'liste.php','&socid='.$socid,$sortfield,$sortorder,'',$num); print_fiche_titre($title);
$i = 0; $i = 0;
$period=$html->select_date($date_start,'date_start',0,0,1,'',1,0,1).' - '.$html->select_date($date_end,'date_end',0,0,1,'',1,0,1); $period=$html->select_date($date_start,'date_start',0,0,1,'',1,0,1).' - '.$html->select_date($date_end,'date_end',0,0,1,'',1,0,1);
$periodely=$html->select_date($date_starty,'date_start_dely',0,0,1,'',1,0,1).' - '.$html->select_date($date_endy,'date_end_dely',0,0,1,'',1,0,1); $periodely=$html->select_date($date_starty,'date_start_dely',0,0,1,'',1,0,1).' - '.$html->select_date($date_endy,'date_end_dely',0,0,1,'',1,0,1);
@ -604,7 +596,7 @@ else
$var=True; $var=True;
$generic_commande = new Commande($db); $generic_commande = new Commande($db);
while ($i < min($num,$limit)) while ($i < $num)
{ {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
$var=!$var; $var=!$var;

View File

@ -87,8 +87,15 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($
} }
else if (! empty($ext_element)) else if (! empty($ext_element))
{ {
dol_include_once('/'.$ext_element.'/class/actions_'.$ext_element.'.class.php'); $module = $subelement = $ext_element;
$classname = 'Actions'.ucfirst($ext_element); if (preg_match('/^([^_]+)_([^_]+)/i',$ext_element,$regs))
{
$module = $regs[1];
$subelement = $regs[2];
}
dol_include_once('/'.$module.'/class/actions_'.$subelement.'.class.php');
$classname = 'Actions'.ucfirst($subelement);
$object = new $classname($db); $object = new $classname($db);
$ret = $object->$methodname(); $ret = $object->$methodname();
if ($ret > 0) echo json_encode($object->$cachename); if ($ret > 0) echo json_encode($object->$cachename);

View File

@ -51,6 +51,7 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($
$field = substr($field, 8); // remove prefix val_ $field = substr($field, 8); // remove prefix val_
$type = GETPOST('type','alpha',2); $type = GETPOST('type','alpha',2);
$value = ($type == 'ckeditor' ? GETPOST('value','',2) : GETPOST('value','alpha',2)); $value = ($type == 'ckeditor' ? GETPOST('value','',2) : GETPOST('value','alpha',2));
$loadmethod = GETPOST('loadmethod','alpha',2);
$savemethod = GETPOST('savemethod','alpha',2); $savemethod = GETPOST('savemethod','alpha',2);
$savemethodname = (! empty($savemethod) ? $savemethod : 'setValueFrom'); $savemethodname = (! empty($savemethod) ? $savemethod : 'setValueFrom');
@ -104,9 +105,9 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($
} }
else if ($type == 'select') else if ($type == 'select')
{ {
$loadmethodname = 'load_cache_'.GETPOST('loadmethod','alpha'); $loadmethodname = 'load_cache_'.$loadmethod;
$loadcachename = 'cache_'.GETPOST('loadmethod','alpha'); $loadcachename = 'cache_'.$loadmethod;
$loadviewname = 'view_'.GETPOST('loadmethod','alpha'); $loadviewname = 'view_'.$loadmethod;
$form = new Form($db); $form = new Form($db);
if (method_exists($form, $loadmethodname)) if (method_exists($form, $loadmethodname))
@ -131,8 +132,15 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($
} }
else else
{ {
dol_include_once('/'.$ext_element.'/class/actions_'.$ext_element.'.class.php'); $module = $subelement = $ext_element;
$classname = 'Actions'.ucfirst($ext_element); if (preg_match('/^([^_]+)_([^_]+)/i',$ext_element,$regs))
{
$module = $regs[1];
$subelement = $regs[2];
}
dol_include_once('/'.$module.'/class/actions_'.$subelement.'.class.php');
$classname = 'Actions'.ucfirst($subelement);
$object = new $classname($db); $object = new $classname($db);
$ret = $object->$loadmethodname(); $ret = $object->$loadmethodname();
if ($ret > 0) if ($ret > 0)

View File

@ -725,26 +725,32 @@ function activateModule($value,$withdeps=1)
$num = count($objMod->depends); $num = count($objMod->depends);
for ($i = 0; $i < $num; $i++) for ($i = 0; $i < $num; $i++)
{ {
if (file_exists(DOL_DOCUMENT_ROOT."/core/modules/".$objMod->depends[$i].".class.php")) foreach ($modulesdir as $dir)
{
if (file_exists($dir.$objMod->depends[$i].".class.php"))
{ {
activateModule($objMod->depends[$i]); activateModule($objMod->depends[$i]);
} }
} }
} }
}
if (isset($objMod->conflictwith) && is_array($objMod->conflictwith)) if (is_array($objMod->conflictwith) && ! empty($objMod->conflictwith))
{ {
// Desactivation des modules qui entrent en conflit // Desactivation des modules qui entrent en conflit
$num = count($objMod->conflictwith); $num = count($objMod->conflictwith);
for ($i = 0; $i < $num; $i++) for ($i = 0; $i < $num; $i++)
{ {
if (file_exists(DOL_DOCUMENT_ROOT."/core/modules/".$objMod->conflictwith[$i].".class.php")) foreach ($modulesdir as $dir)
{
if (file_exists($dir.$objMod->conflictwith[$i].".class.php"))
{ {
unActivateModule($objMod->conflictwith[$i],0); unActivateModule($objMod->conflictwith[$i],0);
} }
} }
} }
} }
}
return $ret; return $ret;
} }