From 4d2a77a6571a170c277e52d6822a938d9484c667 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 6 Jun 2012 14:00:23 +0200 Subject: [PATCH 1/3] Fix: missing search in alternative root directory --- htdocs/core/lib/admin.lib.php | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 3632e42811c..1f772550ffc 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -719,29 +719,35 @@ function activateModule($value,$withdeps=1) if (! $ret && $withdeps) { - if (is_array($objMod->depends) && !empty($objMod->depends)) + if (is_array($objMod->depends) && ! empty($objMod->depends)) { // Activation des modules dont le module depend $num = count($objMod->depends); for ($i = 0; $i < $num; $i++) { - if (file_exists(DOL_DOCUMENT_ROOT."/core/modules/".$objMod->depends[$i].".class.php")) - { - activateModule($objMod->depends[$i]); - } + foreach ($modulesdir as $dir) + { + if (file_exists($dir.$objMod->depends[$i].".class.php")) + { + 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 $num = count($objMod->conflictwith); for ($i = 0; $i < $num; $i++) { - if (file_exists(DOL_DOCUMENT_ROOT."/core/modules/".$objMod->conflictwith[$i].".class.php")) - { - unActivateModule($objMod->conflictwith[$i],0); - } + foreach ($modulesdir as $dir) + { + if (file_exists($dir.$objMod->conflictwith[$i].".class.php")) + { + unActivateModule($objMod->conflictwith[$i],0); + } + } } } } From b96fb07cbf361896e9684ca5686a93a96293521d Mon Sep 17 00:00:00 2001 From: simnandez Date: Wed, 6 Jun 2012 18:02:47 +0200 Subject: [PATCH 2/3] =?UTF-8?q?[=20task=20#104=20]=20Possibilit=C3=A9=20de?= =?UTF-8?q?=20facturer=20plusieurs=20commandes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/commande/orderstoinvoice.php | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index 0633f40b338..3c74aeeb891 100755 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -49,14 +49,9 @@ if (! $user->rights->facture->creer) $sortfield = GETPOST("sortfield",'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 (! $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_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 @@ -202,14 +197,12 @@ if (($action == 'create' || $action == 'add') && ! $mesg ) $sql.= ", '".$object->element."'"; $sql.= ")"; - dol_syslog(get_class($this)."::add_object_linked sql=".$sql, LOG_DEBUG); if ($db->query($sql)) { $db->commit(); } else { - $db->rollback(); } } @@ -528,7 +521,6 @@ else $sql.= ' AND c.ref_client LIKE \'%'.$db->escape($sref_client).'%\''; } $sql.= ' ORDER BY '.$sortfield.' '.$sortorder; - $sql.= $db->plimit($limit + 1,$offset); $resql = $db->query($sql); if ($resql) @@ -545,7 +537,7 @@ else } $title.=' - '.$langs->trans('StatusOrderToBillShort'); $num = $db->num_rows($resql); - print_barre_liste($title, $_GET['page'], 'liste.php','&socid='.$socid,$sortfield,$sortorder,'',$num); + print_fiche_titre($title); $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); $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; $generic_commande = new Commande($db); - while ($i < min($num,$limit)) + while ($i < $num) { $objp = $db->fetch_object($resql); $var=!$var; From d0161087cb14151d6d7d83943359bdc78276e148 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 6 Jun 2012 22:59:26 +0200 Subject: [PATCH 3/3] Fix: problem with external module --- htdocs/core/ajax/loadinplace.php | 11 +++++++++-- htdocs/core/ajax/saveinplace.php | 18 +++++++++++++----- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/htdocs/core/ajax/loadinplace.php b/htdocs/core/ajax/loadinplace.php index 152ba07288d..55d9adb70f3 100644 --- a/htdocs/core/ajax/loadinplace.php +++ b/htdocs/core/ajax/loadinplace.php @@ -87,8 +87,15 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($ } else if (! empty($ext_element)) { - dol_include_once('/'.$ext_element.'/class/actions_'.$ext_element.'.class.php'); - $classname = 'Actions'.ucfirst($ext_element); + $module = $subelement = $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); $ret = $object->$methodname(); if ($ret > 0) echo json_encode($object->$cachename); diff --git a/htdocs/core/ajax/saveinplace.php b/htdocs/core/ajax/saveinplace.php index 9af6a83e54a..50541facffa 100644 --- a/htdocs/core/ajax/saveinplace.php +++ b/htdocs/core/ajax/saveinplace.php @@ -51,6 +51,7 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($ $field = substr($field, 8); // remove prefix val_ $type = GETPOST('type','alpha',2); $value = ($type == 'ckeditor' ? GETPOST('value','',2) : GETPOST('value','alpha',2)); + $loadmethod = GETPOST('loadmethod','alpha',2); $savemethod = GETPOST('savemethod','alpha',2); $savemethodname = (! empty($savemethod) ? $savemethod : 'setValueFrom'); @@ -104,9 +105,9 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($ } else if ($type == 'select') { - $loadmethodname = 'load_cache_'.GETPOST('loadmethod','alpha'); - $loadcachename = 'cache_'.GETPOST('loadmethod','alpha'); - $loadviewname = 'view_'.GETPOST('loadmethod','alpha'); + $loadmethodname = 'load_cache_'.$loadmethod; + $loadcachename = 'cache_'.$loadmethod; + $loadviewname = 'view_'.$loadmethod; $form = new Form($db); if (method_exists($form, $loadmethodname)) @@ -131,8 +132,15 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($ } else { - dol_include_once('/'.$ext_element.'/class/actions_'.$ext_element.'.class.php'); - $classname = 'Actions'.ucfirst($ext_element); + $module = $subelement = $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); $ret = $object->$loadmethodname(); if ($ret > 0)