diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index 5380e94aec3..88b32e02dd9 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -90,9 +90,9 @@ if ($action == 'add') if (! $error && $fk_user != 0) // We will add fk_user = 0 later. { $sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes ("; - $sql.= "box_id, position, box_order, fk_user"; + $sql.= "box_id, position, box_order, fk_user, entity"; $sql.= ") values ("; - $sql.= GETPOST("boxid","int").", ".GETPOST("pos","alpha").", 'A01', ".$fk_user; + $sql.= GETPOST("boxid","int").", ".GETPOST("pos","alpha").", 'A01', ".$fk_user.", ".$conf->entity; $sql.= ")"; dol_syslog("boxes.php activate box sql=".$sql); @@ -109,9 +109,9 @@ if ($action == 'add') if (! $error) { $sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes ("; - $sql.= "box_id, position, box_order, fk_user"; + $sql.= "box_id, position, box_order, fk_user, entity"; $sql.= ") values ("; - $sql.= GETPOST("boxid","int").", ".GETPOST("pos","alpha").", 'A01', 0"; + $sql.= GETPOST("boxid","int").", ".GETPOST("pos","alpha").", 'A01', 0, ".$conf->entity; $sql.= ")"; dol_syslog("boxes.php activate box sql=".$sql); @@ -137,9 +137,9 @@ if ($action == 'add') if ($action == 'delete') { - $sql = "SELECT box_id FROM ".MAIN_DB_PREFIX."boxes"; $sql.= " WHERE rowid=".$rowid; + $resql = $db->query($sql); $obj=$db->fetch_object($resql); if (! empty($obj->box_id)) @@ -152,7 +152,9 @@ if ($action == 'delete') // $resql = $db->query($sql); $sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes"; - $sql.= " WHERE box_id=".$obj->box_id; + $sql.= " WHERE entity = ".$conf->entity; + $sql.= " AND box_id=".$obj->box_id; + $resql = $db->query($sql); $db->commit(); @@ -182,12 +184,12 @@ if ($action == 'switch') $newsecondnum=preg_replace('/[a-zA-Z]+/','',$newsecond); $newsecond=sprintf("%s%02d",$newsecondchar?$newsecondchar:'A',$newsecondnum+1); } - $sql="UPDATE ".MAIN_DB_PREFIX."boxes set box_order='".$newfirst."' WHERE rowid=".$objfrom->rowid; + $sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order='".$newfirst."' WHERE rowid=".$objfrom->rowid; dol_syslog($sql); $resultupdatefrom = $db->query($sql); if (! $resultupdatefrom) { dol_print_error($db); } - $sql="UPDATE ".MAIN_DB_PREFIX."boxes set box_order='".$newsecond."' WHERE rowid=".$objto->rowid; + $sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order='".$newsecond."' WHERE rowid=".$objto->rowid; dol_syslog($sql); $resultupdateto = $db->query($sql); if (! $resultupdateto) { dol_print_error($db); } @@ -231,8 +233,8 @@ $actives = array(); $sql = "SELECT b.rowid, b.box_id, b.position, b.box_order,"; $sql.= " bd.rowid as boxid"; $sql.= " FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as bd"; -$sql.= " WHERE b.box_id = bd.rowid"; -$sql.= " AND bd.entity = ".$conf->entity; +$sql.= " WHERE b.entity = ".$conf->entity; +$sql.= " AND b.box_id = bd.rowid"; $sql.= " AND b.fk_user=0"; $sql.= " ORDER by b.position, b.box_order"; @@ -256,7 +258,7 @@ if ($resql) // This occurs just after an insert. if ($decalage) { - $sql="UPDATE ".MAIN_DB_PREFIX."boxes set box_order='".$decalage."' WHERE rowid=".$obj->rowid; + $sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order='".$decalage."' WHERE rowid=".$obj->rowid; $db->query($sql); } } @@ -267,7 +269,8 @@ if ($resql) // This occurs just after an insert. $sql = "SELECT box_order"; $sql.= " FROM ".MAIN_DB_PREFIX."boxes"; - $sql.= " WHERE length(box_order) <= 2"; + $sql.= " WHERE entity = ".$conf->entity; + $sql.= " AND LENGTH(box_order) <= 2"; dol_syslog("Execute requests to renumber box order sql=".$sql); $result = $db->query($sql); @@ -280,13 +283,13 @@ if ($resql) if (preg_match("/[13579]{1}/",substr($record['box_order'],-1))) { $box_order = "A0".$record['box_order']; - $sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE box_order = '".$record['box_order']."'"; + $sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE entity = ".$conf->entity." AND box_order = '".$record['box_order']."'"; $resql = $db->query($sql); } else if (preg_match("/[02468]{1}/",substr($record['box_order'],-1))) { $box_order = "B0".$record['box_order']; - $sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE box_order = '".$record['box_order']."'"; + $sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE entity = ".$conf->entity." AND box_order = '".$record['box_order']."'"; $resql = $db->query($sql); } } @@ -295,13 +298,13 @@ if ($resql) if (preg_match("/[13579]{1}/",substr($record['box_order'],-1))) { $box_order = "A".$record['box_order']; - $sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE box_order = '".$record['box_order']."'"; + $sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE entity = ".$conf->entity." AND box_order = '".$record['box_order']."'"; $resql = $db->query($sql); } else if (preg_match("/[02468]{1}/",substr($record['box_order'],-1))) { $box_order = "B".$record['box_order']; - $sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE box_order = '".$record['box_order']."'"; + $sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE entity = ".$conf->entity." AND box_order = '".$record['box_order']."'"; $resql = $db->query($sql); } } diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php index da5f2c36a65..dca24bf4304 100644 --- a/htdocs/admin/external_rss.php +++ b/htdocs/admin/external_rss.php @@ -137,7 +137,8 @@ if ($_POST["delete"]) $obj=$db->fetch_object($resql); $sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes"; - $sql.= " WHERE box_id = ".$obj->rowid; + $sql.= " WHERE entity = ".$conf->entity; + $sql.= " AND box_id = ".$obj->rowid; $resql=$db->query($sql); $sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes_def"; diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index 856f5a412d9..d1a4ff48f67 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -1,7 +1,7 @@ - * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2012 Juanjo Menent +/* Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2012 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -45,9 +45,9 @@ $modules = array( // Conditions pour que l'option soit proposee $conditions = array( 'SOCIETE' => 1, -'PRODUCTDESC' => ($conf->product->enabled||$conf->service->enabled), -'MAILING' => $conf->mailing->enabled, -'DETAILS' => ($conf->facture->enabled||$conf->propal->enabled||$conf->commande->enabled), +'PRODUCTDESC' => (! empty($conf->product->enabled) || ! empty($conf->service->enabled)), +'MAILING' => ! empty($conf->mailing->enabled), +'DETAILS' => (! empty($conf->facture->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled)), ); // Picto $picto = array( @@ -129,14 +129,14 @@ else print ''.$langs->trans($desc).''; print ''; $constante = 'FCKEDITOR_ENABLE_'.$const; - $value = $conf->global->$constante; - if($value == 0) + $value = (isset($conf->global->$constante)?$conf->global->$constante:0); + if ($value == 0) { - print ''.img_picto($langs->trans("Disabled"),'switch_off').''; + print ''.img_picto($langs->trans("Disabled"),'switch_off').''; } - else if($value == 1) + else if ($value == 1) { - print ''.img_picto($langs->trans("Enabled"),'switch_on').''; + print ''.img_picto($langs->trans("Enabled"),'switch_on').''; } print ""; @@ -164,7 +164,7 @@ else */ } -$db->close(); llxFooter(); +$db->close(); ?> \ No newline at end of file diff --git a/htdocs/admin/mailing.php b/htdocs/admin/mailing.php index 231a3a9a3dc..0732dbeb31c 100644 --- a/htdocs/admin/mailing.php +++ b/htdocs/admin/mailing.php @@ -152,7 +152,7 @@ print ''; print ''; print '
'; -print '
'; +print '
'; llxFooter(); diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index d1abf15f345..584ce1e62fa 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -35,8 +35,8 @@ $error=0; $mesg=''; $action = GETPOST("action"); $syslog_file_on=(defined('SYSLOG_FILE_ON') && constant('SYSLOG_FILE_ON'))?1:0; $syslog_syslog_on=(defined('SYSLOG_SYSLOG_ON') && constant('SYSLOG_SYSLOG_ON'))?1:0; -$syslog_firephp_on=(defined('SYSLOG_FIREPHP_ON') && constant('SYSLOG_FIREPHP_ON'))?1:0; -$syslog_chromephp_on=(defined('SYSLOG_CHROMEPHP_ON') && constant('SYSLOG_CHROMEPHP_ON'))?1:0; +$syslog_firephp_on=(defined('SYSLOG_FIREPHP_ON') && constant('SYSLOG_FIREPHP_ON'))?1:0; +$syslog_chromephp_on=(defined('SYSLOG_CHROMEPHP_ON') && constant('SYSLOG_CHROMEPHP_ON'))?1:0; /* @@ -55,7 +55,7 @@ if ($action == 'set') $syslog_file_on=0; $syslog_syslog_on=0; $syslog_firephp_on=0; - $syslog_chromephp_on=0; + $syslog_chromephp_on=0; if (! $error && GETPOST("filename")) { @@ -225,30 +225,30 @@ catch(Exception $e) print ''."\n"; } -// Output to Chrome -try -{ - set_include_path('/usr/share/php/'); - $res=@include_once 'ChromePhp.php'; - restore_include_path(); - if ($res) - { - $var=!$var; - print ' '.$langs->trans("ChromePHP").''; - print ''; - print ''; - print "".$form->textwithpicto('','ChromePHP must be installed onto PHP path and ChromePHP plugin for Chrome must also be installed'); - print ''; - } -} -catch(Exception $e) -{ - // Do nothing - print ''."\n"; -} +// Output to Chrome +try +{ + set_include_path('/usr/share/php/'); + $res=@include_once 'ChromePhp.php'; + restore_include_path(); + if ($res) + { + $var=!$var; + print ' '.$langs->trans("ChromePHP").''; + print ''; + print ''; + print "".$form->textwithpicto('','ChromePHP must be installed onto PHP path and ChromePHP plugin for Chrome must also be installed'); + print ''; + } +} +catch(Exception $e) +{ + // Do nothing + print ''."\n"; +} print "\n"; print "\n"; diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 7d7bd4a0595..837a995c966 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -93,7 +93,7 @@ if ($action == 'add_action') } $fulldayevent=GETPOST('fullday'); - $percentage=in_array(GETPOST('status'),array(-1,100))?GETPOST('status'):GETPOST("percentage"); // If status is -1 or 100, percentage is not defined and we must use status + $percentage=in_array(GETPOST('status'),array(-1,100))?GETPOST('status'):GETPOST("percentage"); // If status is -1 or 100, percentage is not defined and we must use status // Clean parameters $datep=dol_mktime($fulldayevent?'00':$_POST["aphour"], $fulldayevent?'00':$_POST["apmin"], 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]); diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index b1b6aae88fa..03a356a8a72 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -455,9 +455,9 @@ else } else { - print ' '; + print ' '; } - print ''; + print ''; // Instant message and no email print ''.$langs->trans("IM").'jabberid).'">'; @@ -643,7 +643,7 @@ else { print ' '; } - print ''; + print ''; // Visibility print ''.$langs->trans("ContactVisibility").''; @@ -843,7 +843,7 @@ else } else { - print ' '; + print ' '; } print ''; diff --git a/htdocs/core/ajax/ajaxdirtree.php b/htdocs/core/ajax/ajaxdirtree.php index 21487924b91..012da1f25a6 100644 --- a/htdocs/core/ajax/ajaxdirtree.php +++ b/htdocs/core/ajax/ajaxdirtree.php @@ -120,18 +120,18 @@ if (file_exists($fullpathselecteddir)) if ($tmpval['fullrelativename'] == (($selecteddir != '/'?$selecteddir.'/':'').$file)) // We found equivalent record into database { $val=$tmpval; - $resarray=tree_showpad($sqltree,$key,1); + $resarray=tree_showpad($sqltree,$key,1); + + // Refresh cache for this subdir + if (isset($val['cachenbofdoc']) && $val['cachenbofdoc'] < 0) // Cache is not up to date, so we update it for this directory t + { + $result=$ecmdirstatic->fetch($val['id']); + $ecmdirstatic->ref=$ecmdirstatic->label; + + $result=$ecmdirstatic->refreshcachenboffile(0); + $val['cachenbofdoc']=$result; + } - // Refresh cache for this subdir - if (isset($val['cachenbofdoc']) && $val['cachenbofdoc'] < 0) // Cache is not up to date, so we update it for this directory t - { - $result=$ecmdirstatic->fetch($val['id']); - $ecmdirstatic->ref=$ecmdirstatic->label; - - $result=$ecmdirstatic->refreshcachenboffile(0); - $val['cachenbofdoc']=$result; - } - $a=$resarray[0]; $nbofsubdir=$resarray[1]; $nboffilesinsubdir=$resarray[2]; diff --git a/htdocs/core/ajax/box.php b/htdocs/core/ajax/box.php index c8b852d4e87..1176df5c391 100644 --- a/htdocs/core/ajax/box.php +++ b/htdocs/core/ajax/box.php @@ -1,6 +1,6 @@ - * Copyright (C) 2007-2012 Laurent Destailleur +/* Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2007-2012 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index 12aadcf4a94..84d49c468b1 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -72,10 +72,13 @@ class ModeleBoxes // Can't be abtract as it is instanciated to build "empty" */ function fetch($rowid) { + global $conf; + // Recupere liste des boites d'un user si ce dernier a sa propre liste $sql = "SELECT b.rowid, b.box_id, b.position, b.box_order, b.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."boxes as b"; - $sql.= " WHERE b.rowid = ".$rowid; + $sql.= " WHERE b.entity = ".$conf->entity; + $sql.= " AND b.rowid = ".$rowid; dol_syslog(get_class($this)."::fetch rowid=".$rowid); $resql = $this->db->query($sql); diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 2485e26e15d..8f3a1080111 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -269,7 +269,7 @@ class Conf // External modules storage if (! empty($this->modules_parts['dir'])) { - foreach($this->modules_parts['dir'] as $module => $dirs) + foreach($this->modules_parts['dir'] as $module => $dirs) { foreach($dirs as $type => $name) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 3325b31e547..1901ff59652 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1001,7 +1001,7 @@ class Form { if (! empty($conf->multicompany->transverse_mode)) { - $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ug"; + $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ug"; $sql.= " WHERE ug.fk_user = u.rowid"; $sql.= " AND ug.entity = ".$conf->entity; } diff --git a/htdocs/core/class/infobox.class.php b/htdocs/core/class/infobox.class.php index 8c9fd112013..3d0a0f2d692 100644 --- a/htdocs/core/class/infobox.class.php +++ b/htdocs/core/class/infobox.class.php @@ -50,7 +50,7 @@ class InfoBox $sql.= " d.rowid as box_id, d.file, d.note, d.tms"; $sql.= " FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as d"; $sql.= " WHERE b.box_id = d.rowid"; - $sql.= " AND d.entity = ".$conf->entity; + $sql.= " AND b.entity = ".$conf->entity; if ($zone >= 0) $sql.= " AND b.position = ".$zone; if ($user->id && ! empty($user->conf->$confuserzone)) $sql.= " AND b.fk_user = ".$user->id; else $sql.= " AND b.fk_user = 0"; @@ -60,7 +60,15 @@ class InfoBox { $sql = "SELECT d.rowid as box_id, d.file, d.note, d.tms"; $sql.= " FROM ".MAIN_DB_PREFIX."boxes_def as d"; - $sql.= " WHERE entity = ".$conf->entity; + if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) { + + $sql.= " WHERE entity IN (1,".$conf->entity.")"; // TODO add method for define another master entity + + } else { + + $sql.= " WHERE entity = ".$conf->entity; + + } } dol_syslog(get_class()."::listBoxes get default box list sql=".$sql, LOG_DEBUG); @@ -176,11 +184,9 @@ class InfoBox // Delete all lines $sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes"; - $sql.= " USING ".MAIN_DB_PREFIX."boxes, ".MAIN_DB_PREFIX."boxes_def"; - $sql.= " WHERE ".MAIN_DB_PREFIX."boxes.box_id = ".MAIN_DB_PREFIX."boxes_def.rowid"; - $sql.= " AND ".MAIN_DB_PREFIX."boxes_def.entity = ".$conf->entity; - $sql.= " AND ".MAIN_DB_PREFIX."boxes.fk_user = ".$userid; - $sql.= " AND ".MAIN_DB_PREFIX."boxes.position = ".$zone; + $sql.= " WHERE entity = ".$conf->entity; + $sql.= " AND fk_user = ".$userid; + $sql.= " AND position = ".$zone; dol_syslog(get_class()."::saveboxorder sql=".$sql); $result = $db->query($sql); @@ -204,12 +210,13 @@ class InfoBox $i++; $ii=sprintf('%02d',$i); $sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes"; - $sql.= "(box_id, position, box_order, fk_user)"; + $sql.= "(box_id, position, box_order, fk_user, entity)"; $sql.= " values ("; $sql.= " ".$id.","; $sql.= " ".$zone.","; $sql.= " '".$colonne.$ii."',"; - $sql.= " ".$userid; + $sql.= " ".$userid.","; + $sql.= " ".$conf->entity; $sql.= ")"; dol_syslog(get_class()."::saveboxorder sql=".$sql); diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 84ad7f1ff15..af964d92ff1 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -58,8 +58,8 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil if (! is_object($hookmanager)) { if (! class_exists('HookManager')) { - // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array - require DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array + require DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; $hookmanager=new HookManager($db); } } @@ -82,7 +82,7 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil 'sortorder' => $sortorder, 'loaddate' => $loaddate, 'loadsize' => $loadsize - ); + ); $reshook=$hookmanager->executeHooks('getNodesList', $parameters); // $reshook may contain returns stacked by other modules @@ -94,103 +94,103 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil } else { - if (! is_dir($newpath)) return array(); - - if ($dir = opendir($newpath)) - { - $filedate=''; - $filesize=''; - $file_list = array(); - - while (false !== ($file = readdir($dir))) - { - if (! utf8_check($file)) $file=utf8_encode($file); // To be sure data is stored in utf8 in memory - - $qualified=1; - - // Define excludefilterarray - $excludefilterarray=array('^\.'); - if (is_array($excludefilter)) - { - $excludefilterarray=array_merge($excludefilterarray,$excludefilter); - } - else if ($excludefilter) $excludefilterarray[]=$excludefilter; - // Check if file is qualified - foreach($excludefilterarray as $filt) - { - if (preg_match('/'.$filt.'/i',$file)) { - $qualified=0; break; - } - } - - if ($qualified) - { - $isdir=is_dir(dol_osencode($path."/".$file)); - // Check whether this is a file or directory and whether we're interested in that type - if ($isdir && (($types=="directories") || ($types=="all") || $recursive)) - { - // Add entry into file_list array - if (($types=="directories") || ($types=="all")) - { - if ($loaddate || $sortcriteria == 'date') $filedate=dol_filemtime($path."/".$file); - if ($loadsize || $sortcriteria == 'size') $filesize=dol_filesize($path."/".$file); - - if (! $filter || preg_match('/'.$filter.'/i',$path.'/'.$file)) - { - $file_list[] = array( - "name" => $file, - "fullname" => $path.'/'.$file, - "date" => $filedate, - "size" => $filesize, - "type" => 'dir' - ); - } - } - - // if we're in a directory and we want recursive behavior, call this function again - if ($recursive) - { - $file_list = array_merge($file_list,dol_dir_list($path."/".$file, $types, $recursive, $filter, $excludefilter, $sortcriteria, $sortorder, $mode)); - } - } - else if (! $isdir && (($types == "files") || ($types == "all"))) - { - // Add file into file_list array - if ($loaddate || $sortcriteria == 'date') $filedate=dol_filemtime($path."/".$file); - if ($loadsize || $sortcriteria == 'size') $filesize=dol_filesize($path."/".$file); - - if (! $filter || preg_match('/'.$filter.'/i',$path.'/'.$file)) - { - $file_list[] = array( - "name" => $file, - "fullname" => $path.'/'.$file, - "date" => $filedate, - "size" => $filesize, - "type" => 'file' - ); - } - } - } - } - closedir($dir); - - // Obtain a list of columns - if (! empty($sortcriteria)) - { - $myarray=array(); - foreach ($file_list as $key => $row) - { - $myarray[$key] = (isset($row[$sortcriteria])?$row[$sortcriteria]:''); - } - // Sort the data - if ($sortorder) array_multisort($myarray, $sortorder, $file_list); - } - - return $file_list; - } - else - { - return array(); + if (! is_dir($newpath)) return array(); + + if ($dir = opendir($newpath)) + { + $filedate=''; + $filesize=''; + $file_list = array(); + + while (false !== ($file = readdir($dir))) + { + if (! utf8_check($file)) $file=utf8_encode($file); // To be sure data is stored in utf8 in memory + + $qualified=1; + + // Define excludefilterarray + $excludefilterarray=array('^\.'); + if (is_array($excludefilter)) + { + $excludefilterarray=array_merge($excludefilterarray,$excludefilter); + } + else if ($excludefilter) $excludefilterarray[]=$excludefilter; + // Check if file is qualified + foreach($excludefilterarray as $filt) + { + if (preg_match('/'.$filt.'/i',$file)) { + $qualified=0; break; + } + } + + if ($qualified) + { + $isdir=is_dir(dol_osencode($path."/".$file)); + // Check whether this is a file or directory and whether we're interested in that type + if ($isdir && (($types=="directories") || ($types=="all") || $recursive)) + { + // Add entry into file_list array + if (($types=="directories") || ($types=="all")) + { + if ($loaddate || $sortcriteria == 'date') $filedate=dol_filemtime($path."/".$file); + if ($loadsize || $sortcriteria == 'size') $filesize=dol_filesize($path."/".$file); + + if (! $filter || preg_match('/'.$filter.'/i',$path.'/'.$file)) + { + $file_list[] = array( + "name" => $file, + "fullname" => $path.'/'.$file, + "date" => $filedate, + "size" => $filesize, + "type" => 'dir' + ); + } + } + + // if we're in a directory and we want recursive behavior, call this function again + if ($recursive) + { + $file_list = array_merge($file_list,dol_dir_list($path."/".$file, $types, $recursive, $filter, $excludefilter, $sortcriteria, $sortorder, $mode)); + } + } + else if (! $isdir && (($types == "files") || ($types == "all"))) + { + // Add file into file_list array + if ($loaddate || $sortcriteria == 'date') $filedate=dol_filemtime($path."/".$file); + if ($loadsize || $sortcriteria == 'size') $filesize=dol_filesize($path."/".$file); + + if (! $filter || preg_match('/'.$filter.'/i',$path.'/'.$file)) + { + $file_list[] = array( + "name" => $file, + "fullname" => $path.'/'.$file, + "date" => $filedate, + "size" => $filesize, + "type" => 'file' + ); + } + } + } + } + closedir($dir); + + // Obtain a list of columns + if (! empty($sortcriteria)) + { + $myarray=array(); + foreach ($file_list as $key => $row) + { + $myarray[$key] = (isset($row[$sortcriteria])?$row[$sortcriteria]:''); + } + // Sort the data + if ($sortorder) array_multisort($myarray, $sortorder, $file_list); + } + + return $file_list; + } + else + { + return array(); } } } @@ -554,44 +554,43 @@ function dol_unescapefile($filename) return trim(basename($filename), ".\x00..\x20"); } -/** - * Make control on an uploaded file from an GUI page and move it to final destination. - * If there is errors (virus found, antivir in error, bad filename), file is not moved. +/** + * Make control on an uploaded file from an GUI page and move it to final destination. + * If there is errors (virus found, antivir in error, bad filename), file is not moved. * Note: This function can be used only into a HTML page context. Use dol_move if you are outside. - * - * @param string $src_file Source full path filename ($_FILES['field']['tmp_name']) - * @param string $dest_file Target full path filename ($_FILES['field']['name']) - * @param int $allowoverwrite 1=Overwrite target file if it already exists - * @param int $disablevirusscan 1=Disable virus scan - * @param string $uploaderrorcode Value of PHP upload error code ($_FILES['field']['error']) + * + * @param string $src_file Source full path filename ($_FILES['field']['tmp_name']) + * @param string $dest_file Target full path filename ($_FILES['field']['name']) + * @param int $allowoverwrite 1=Overwrite target file if it already exists + * @param int $disablevirusscan 1=Disable virus scan + * @param string $uploaderrorcode Value of PHP upload error code ($_FILES['field']['error']) * @param int $notrigger Disable all triggers - * @param string $upload_dir Directory where to store uploaded file (note: also find in first part of dest_file) - * @param array $upload_file Values of uploaded file ($_FILES['field']) + * @param string $varfiles _FILES var name * @return int >0 if OK, <0 or string if KO - * @see dolCheckUploadedFile, dol_move - */ -function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $notrigger=0, $upload_dir='', $upload_file=null) -{ + * @see dolCheckUploadedFile, dol_move + */ +function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $notrigger=0, $varfiles='addedfile') +{ global $db, $hookmanager; - global $object; - - $error=0; - - // Check uploaded file - $dest_file=dolCheckUploadedFile($src_file, $dest_file, $disablevirusscan, $uploaderrorcode); + global $object; + + $error=0; + + // Check uploaded file + $dest_file=dolCheckUploadedFile($src_file, $dest_file, $disablevirusscan, $uploaderrorcode); if (is_array($dest_file) && isset($dest_file['error'])) return $dest_file['error']; - if (! is_object($hookmanager)) - { - if (! class_exists('HookManager')) { - // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array - require DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; - $hookmanager=new HookManager($db); - } - } - $hookmanager->initHooks(array('fileslib')); - - $parameters=array('upload_dir' => $upload_dir, 'upload_file' => $upload_file, 'allowoverwrite' => $allowoverwrite, 'notrigger' => $notrigger); + if (! is_object($hookmanager)) + { + if (! class_exists('HookManager')) { + // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array + require DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager=new HookManager($db); + } + } + $hookmanager->initHooks(array('fileslib')); + + $parameters=array('dest_file' => $dest_file, 'varfiles' => $varfiles, 'allowoverwrite' => $allowoverwrite, 'notrigger' => $notrigger); $reshook=$hookmanager->executeHooks('dolMoveUploadedFile', $parameters, $object); if (empty($reshook)) { @@ -599,92 +598,92 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable } } -/** - * Check an uploaded file. - * If there is errors (virus found, antivir in error, bad filename), file is not moved. - * - * @param string $src_file Source full path filename ($_FILES['field']['tmp_name']) - * @param string $dest_file Target full path filename ($_FILES['field']['name']) - * @param int $disablevirusscan 1=Disable virus scan - * @param string $uploaderrorcode Value of PHP upload error code ($_FILES['field']['error']) +/** + * Check an uploaded file. + * If there is errors (virus found, antivir in error, bad filename), file is not moved. + * + * @param string $src_file Source full path filename ($_FILES['field']['tmp_name']) + * @param string $dest_file Target full path filename ($_FILES['field']['name']) + * @param int $disablevirusscan 1=Disable virus scan + * @param string $uploaderrorcode Value of PHP upload error code ($_FILES['field']['error']) * @return int >0 if OK, <0 or string if KO - * @see dol_move_uploaded_file - */ -function dolCheckUploadedFile($src_file, $dest_file, $disablevirusscan=0, $uploaderrorcode=0) -{ - global $conf; - - $file_name = $dest_file; - // If an upload error has been reported - if ($uploaderrorcode) - { - switch($uploaderrorcode) - { - case UPLOAD_ERR_INI_SIZE: // 1 - return array('error' => 'ErrorFileSizeTooLarge'); - break; - case UPLOAD_ERR_FORM_SIZE: // 2 - return array('error' => 'ErrorFileSizeTooLarge'); - break; - case UPLOAD_ERR_PARTIAL: // 3 - return array('error' => 'ErrorPartialFile'); - break; - case UPLOAD_ERR_NO_TMP_DIR: // - return array('error' => 'ErrorNoTmpDir'); - break; - case UPLOAD_ERR_CANT_WRITE: - return array('error' => 'ErrorFailedToWriteInDir'); - break; - case UPLOAD_ERR_EXTENSION: - return array('error' => 'ErrorUploadBlockedByAddon'); - break; - default: - break; - } - } - - // If we need to make a virus scan - if (empty($disablevirusscan) && file_exists($src_file) && ! empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) - { - if (! class_exists('AntiVir')) { - require DOL_DOCUMENT_ROOT.'/core/class/antivir.class.php'; - } - $antivir=new AntiVir($db); - $result = $antivir->dol_avscan_file($src_file); - if ($result < 0) // If virus or error, we stop here - { - $reterrors=$antivir->errors; - dol_syslog('Files.lib::dol_move_uploaded_file File "'.$src_file.'" (target name "'.$file_name.'") KO with antivirus: result='.$result.' errors='.join(',',$antivir->errors), LOG_WARNING); - return array('error' => 'ErrorFileIsInfectedWithAVirus: '.join(',',$reterrors)); - } - } - - // Security: - // Disallow file with some extensions. We renamed them. - // Car si on a mis le rep documents dans un rep de la racine web (pas bien), cela permet d'executer du code a la demande. - if (preg_match('/\.htm|\.html|\.php|\.pl|\.cgi$/i',$file_name)) - { - $file_name.= '.noexe'; - } - - // Security: - // On interdit fichiers caches, remontees de repertoire ainsi que les pipes dans les noms de fichiers. - if (preg_match('/^\./',$src_file) || preg_match('/\.\./',$src_file) || preg_match('/[<>|]/',$src_file)) - { - dol_syslog("Refused to deliver file ".$src_file, LOG_WARNING); - return array('error' => -1); - } - - // Security: - // On interdit fichiers caches, remontees de repertoire ainsi que les pipe dans - // les noms de fichiers. - if (preg_match('/^\./',$dest_file) || preg_match('/\.\./',$dest_file) || preg_match('/[<>|]/',$dest_file)) - { - dol_syslog("Refused to deliver file ".$dest_file, LOG_WARNING); - return array('error' => -2); - } - - return $file_name; + * @see dol_move_uploaded_file + */ +function dolCheckUploadedFile($src_file, $dest_file, $disablevirusscan=0, $uploaderrorcode=0) +{ + global $conf; + + $file_name = $dest_file; + // If an upload error has been reported + if ($uploaderrorcode) + { + switch($uploaderrorcode) + { + case UPLOAD_ERR_INI_SIZE: // 1 + return array('error' => 'ErrorFileSizeTooLarge'); + break; + case UPLOAD_ERR_FORM_SIZE: // 2 + return array('error' => 'ErrorFileSizeTooLarge'); + break; + case UPLOAD_ERR_PARTIAL: // 3 + return array('error' => 'ErrorPartialFile'); + break; + case UPLOAD_ERR_NO_TMP_DIR: // + return array('error' => 'ErrorNoTmpDir'); + break; + case UPLOAD_ERR_CANT_WRITE: + return array('error' => 'ErrorFailedToWriteInDir'); + break; + case UPLOAD_ERR_EXTENSION: + return array('error' => 'ErrorUploadBlockedByAddon'); + break; + default: + break; + } + } + + // If we need to make a virus scan + if (empty($disablevirusscan) && file_exists($src_file) && ! empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) + { + if (! class_exists('AntiVir')) { + require DOL_DOCUMENT_ROOT.'/core/class/antivir.class.php'; + } + $antivir=new AntiVir($db); + $result = $antivir->dol_avscan_file($src_file); + if ($result < 0) // If virus or error, we stop here + { + $reterrors=$antivir->errors; + dol_syslog('Files.lib::dol_move_uploaded_file File "'.$src_file.'" (target name "'.$file_name.'") KO with antivirus: result='.$result.' errors='.join(',',$antivir->errors), LOG_WARNING); + return array('error' => 'ErrorFileIsInfectedWithAVirus: '.join(',',$reterrors)); + } + } + + // Security: + // Disallow file with some extensions. We renamed them. + // Car si on a mis le rep documents dans un rep de la racine web (pas bien), cela permet d'executer du code a la demande. + if (preg_match('/\.htm|\.html|\.php|\.pl|\.cgi$/i',$file_name)) + { + $file_name.= '.noexe'; + } + + // Security: + // On interdit fichiers caches, remontees de repertoire ainsi que les pipes dans les noms de fichiers. + if (preg_match('/^\./',$src_file) || preg_match('/\.\./',$src_file) || preg_match('/[<>|]/',$src_file)) + { + dol_syslog("Refused to deliver file ".$src_file, LOG_WARNING); + return array('error' => -1); + } + + // Security: + // On interdit fichiers caches, remontees de repertoire ainsi que les pipe dans + // les noms de fichiers. + if (preg_match('/^\./',$dest_file) || preg_match('/\.\./',$dest_file) || preg_match('/[<>|]/',$dest_file)) + { + dol_syslog("Refused to deliver file ".$dest_file, LOG_WARNING); + return array('error' => -2); + } + + return $file_name; } /** @@ -1052,7 +1051,7 @@ function dol_add_file_process($upload_dir,$allowoverwrite=0,$donotupdatesession= { if (dol_mkdir($upload_dir) >= 0) { - $resupload = dol_move_uploaded_file($_FILES[$varfiles]['tmp_name'], $upload_dir . "/" . $_FILES[$varfiles]['name'], $allowoverwrite, 0, $_FILES[$varfiles]['error'], 0, $upload_dir, $_FILES[$varfiles]); + $resupload = dol_move_uploaded_file($_FILES[$varfiles]['tmp_name'], $upload_dir . "/" . $_FILES[$varfiles]['name'], $allowoverwrite, 0, $_FILES[$varfiles]['error'], 0, $varfiles); if (is_numeric($resupload) && $resupload > 0) { if (empty($donotupdatesession)) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 333b601cb34..6683128ef90 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2728,7 +2728,7 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="") // Some test to guess with no need to make database access if ($local == 1 && ! $thirdparty_seller->localtax1_assuj) return 0; if ($local == 2 && ! $thirdparty_seller->localtax2_assuj) return 0; - //if ($local == 0 && ! $thirdparty_seller->localtax1_assuj && ! $thirdparty_seller->localtax2_assuj) return array('localtax1'=>0,'localtax2'=>0); + //if ($local == 0 && ! $thirdparty_seller->localtax1_assuj && ! $thirdparty_seller->localtax2_assuj) return array('localtax1'=>0,'localtax2'=>0); $code_country=$thirdparty_seller->country_code; diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 199f06c43de..6a6b85c953f 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -615,8 +615,8 @@ abstract class DolibarrModules { $lastid=$this->db->last_insert_id(MAIN_DB_PREFIX."boxes_def","rowid"); - $sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (box_id,position,box_order,fk_user)"; - $sql.= " VALUES (".$lastid.", 0, '0', 0)"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (box_id,position,box_order,fk_user,entity)"; + $sql.= " VALUES (".$lastid.", 0, '0', 0, ".$conf->entity.")"; dol_syslog(get_class($this)."::insert_boxes sql=".$sql); $resql=$this->db->query($sql); @@ -671,7 +671,7 @@ abstract class DolibarrModules $sql.= " USING ".MAIN_DB_PREFIX."boxes, ".MAIN_DB_PREFIX."boxes_def"; $sql.= " WHERE ".MAIN_DB_PREFIX."boxes.box_id = ".MAIN_DB_PREFIX."boxes_def.rowid"; $sql.= " AND ".MAIN_DB_PREFIX."boxes_def.file = '".$this->db->escape($file)."'"; - $sql.= " AND ".MAIN_DB_PREFIX."boxes_def.entity = ".$conf->entity; + $sql.= " AND ".MAIN_DB_PREFIX."boxes.entity = ".$conf->entity; dol_syslog(get_class($this)."::delete_boxes sql=".$sql); $resql=$this->db->query($sql); diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 721bb2d3612..5b3742b5e92 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -808,7 +808,7 @@ class pdf_einstein extends ModelePDFCommandes } $pdf->SetDrawColor(128,128,128); - $pdf->SetFont('','', $default_font_size - 1); + $pdf->SetFont('','', $default_font_size - 1); // Output Rect $this->printRect($pdf,$this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param diff --git a/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php index 3b434d237fe..fed09e1dd9c 100644 --- a/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php @@ -250,52 +250,52 @@ class pdf_expedition_rouget extends ModelePdfExpedition $nexY+=2; // Passe espace entre les lignes - // Detect if some page were added automatically and output _tableau for past pages - while ($pagenb < $pageposafter) - { - if ($pagenb == 1) - { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); - } - else - { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); - } - $this->_pagefoot($pdf,$object,$outputlangs); - $pagenb++; - $pdf->setPage($pagenb); - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. - } - if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) - { - if ($pagenb == 1) - { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); - } - else - { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); - } - $this->_pagefoot($pdf,$object,$outputlangs); - // New page - $pdf->AddPage(); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); - $pagenb++; + // Detect if some page were added automatically and output _tableau for past pages + while ($pagenb < $pageposafter) + { + if ($pagenb == 1) + { + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); + } + else + { + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); + } + $this->_pagefoot($pdf,$object,$outputlangs); + $pagenb++; + $pdf->setPage($pagenb); + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + } + if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) + { + if ($pagenb == 1) + { + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); + } + else + { + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); + } + $this->_pagefoot($pdf,$object,$outputlangs); + // New page + $pdf->AddPage(); + if (! empty($tplidx)) $pdf->useTemplate($tplidx); + $pagenb++; } } - // Show square - if ($pagenb == 1) - { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot, 0, $outputlangs, 0, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1; - } - else - { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot, 0, $outputlangs, 1, 0); - $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1; - } - + // Show square + if ($pagenb == 1) + { + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot, 0, $outputlangs, 0, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1; + } + else + { + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot, 0, $outputlangs, 1, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1; + } + // Pied de page $this->_pagefoot($pdf,$object,$outputlangs); $pdf->AliasNbPages(); @@ -343,7 +343,7 @@ class pdf_expedition_rouget extends ModelePdfExpedition // Amount in (at tab_top - 1) $pdf->SetTextColor(0,0,0); - $pdf->SetFont('','',$default_font_size - 1); + $pdf->SetFont('','',$default_font_size - 1); // Output Rect $this->printRect($pdf,$this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param diff --git a/htdocs/core/modules/mailings/xinputuser.modules.php b/htdocs/core/modules/mailings/xinputuser.modules.php index 20462806bcb..994bac804c4 100644 --- a/htdocs/core/modules/mailings/xinputuser.modules.php +++ b/htdocs/core/modules/mailings/xinputuser.modules.php @@ -145,9 +145,9 @@ class mailing_xinputuser extends MailingTargets } else { - $langs->load("errors"); + $langs->load("errors"); $this->error = $langs->trans("ErrorBadEMail",$email); - return -1; + return -1; } } else diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php index 7c36423468d..0e8066f7a68 100644 --- a/htdocs/core/modules/modHoliday.class.php +++ b/htdocs/core/modules/modHoliday.class.php @@ -222,45 +222,45 @@ class modHoliday extends DolibarrModules 'target'=>'', 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both $r++; - $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=holiday,fk_leftmenu=holiday', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry) - 'type'=>'left', // This is a Left menu entry - 'titre'=>'MenuConfCP', - 'mainmenu'=>'holiday', + $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=holiday,fk_leftmenu=holiday', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry) + 'type'=>'left', // This is a Left menu entry + 'titre'=>'MenuConfCP', + 'mainmenu'=>'holiday', 'leftmenu'=>'holiday_conf', - 'url'=>'/holiday/define_holiday.php?mainmenu=holiday&action=request', - 'langs'=>'holiday', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>102, - 'enabled'=>'$conf->holiday->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. - 'perms'=>'$user->rights->holiday->define_holiday', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both - $r++; - $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=holiday,fk_leftmenu=holiday', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry) - 'type'=>'left', // This is a Left menu entry - 'titre'=>'MenuLogCP', - 'mainmenu'=>'holiday_def', - 'url'=>'/holiday/view_log.php?mainmenu=holiday&action=request', + 'url'=>'/holiday/define_holiday.php?mainmenu=holiday&action=request', + 'langs'=>'holiday', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position'=>102, + 'enabled'=>'$conf->holiday->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. + 'perms'=>'$user->rights->holiday->define_holiday', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + 'target'=>'', + 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both + $r++; + $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=holiday,fk_leftmenu=holiday', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry) + 'type'=>'left', // This is a Left menu entry + 'titre'=>'MenuLogCP', + 'mainmenu'=>'holiday_def', + 'url'=>'/holiday/view_log.php?mainmenu=holiday&action=request', 'leftmenu'=>'holiday', - 'langs'=>'holiday', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>103, - 'enabled'=>'$conf->holiday->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. - 'perms'=>'$user->rights->holiday->view_log', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both - $r++; - $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=holiday,fk_leftmenu=holiday', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry) - 'type'=>'left', // This is a Left menu entry - 'titre'=>'MenuReportMonth', - 'mainmenu'=>'holiday', + 'langs'=>'holiday', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position'=>103, + 'enabled'=>'$conf->holiday->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. + 'perms'=>'$user->rights->holiday->view_log', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + 'target'=>'', + 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both + $r++; + $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=holiday,fk_leftmenu=holiday', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry) + 'type'=>'left', // This is a Left menu entry + 'titre'=>'MenuReportMonth', + 'mainmenu'=>'holiday', 'leftmenu'=>'holiday_report', - 'url'=>'/holiday/month_report.php?mainmenu=holiday&action=request', - 'langs'=>'holiday', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>104, - 'enabled'=>'$conf->holiday->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. - 'perms'=>'$user->rights->holiday->view_log', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both - $r++; + 'url'=>'/holiday/month_report.php?mainmenu=holiday&action=request', + 'langs'=>'holiday', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position'=>104, + 'enabled'=>'$conf->holiday->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. + 'perms'=>'$user->rights->holiday->view_log', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + 'target'=>'', + 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both + $r++; // Exports $r=1; diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 399b224a392..33511e12071 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -251,7 +251,7 @@ class pdf_azur extends ModelePDFPropales $pageposbefore=$pdf->getPage(); // Description of product line - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage + $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage $curX = $this->posxdesc-1; pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc,0,$hookmanager); @@ -842,7 +842,7 @@ class pdf_azur extends ModelePDFPropales } $pdf->SetDrawColor(128,128,128); - $pdf->SetFont('','',$default_font_size - 1); + $pdf->SetFont('','',$default_font_size - 1); // Output Rect $this->printRect($pdf,$this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index 7c4eb44d2b9..2d62bf720cd 100755 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -635,7 +635,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices } $pdf->SetDrawColor(128,128,128); - $pdf->SetFont('','', $default_font_size - 1); + $pdf->SetFont('','', $default_font_size - 1); // Output Rect $this->printRect($pdf,$this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index d25ee5fe863..89cc3e2c408 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -817,7 +817,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders } $pdf->SetDrawColor(128,128,128); - $pdf->SetFont('','', $default_font_size - 1); + $pdf->SetFont('','', $default_font_size - 1); // Output Rect $this->printRect($pdf,$this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index a8455abcb31..c4bf12d8b32 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -118,7 +118,7 @@ if (! empty($hookmanager->resArray['options'])) { foreach ($hookmanager->resArray['options'] as $format => $option) { if ($format == 'table') { - echo ''; + echo ''; echo $option; } } diff --git a/htdocs/core/tpl/objectline_add.tpl.php b/htdocs/core/tpl/objectline_add.tpl.php index a9e01947861..4fa3a8274df 100644 --- a/htdocs/core/tpl/objectline_add.tpl.php +++ b/htdocs/core/tpl/objectline_add.tpl.php @@ -139,7 +139,8 @@ if (! empty($conf->margin->enabled)) { require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $nbrows=ROWS_2; if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; - $doleditor=new DolEditor('product_desc', GETPOST('product_desc'), '', 150, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_DETAILS, $nbrows, 70); + $enable=(isset($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0); + $doleditor=new DolEditor('product_desc', GETPOST('product_desc'), '', 150, 'dolibarr_details', '', false, true, $enable, $nbrows, 70); $doleditor->Create(); ?> @@ -192,10 +193,11 @@ if (! empty($conf->margin->enabled)) { > global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE:''); echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; - echo $form->select_date('','date_start',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,"addproduct"); + echo $form->select_date('','date_start',$hourmin,$hourmin,1,"addproduct"); echo ' '.$langs->trans('to').' '; - echo $form->select_date('','date_end',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,"addproduct"); + echo $form->select_date('','date_end',$hourmin,$hourmin,1,"addproduct"); ?> diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 6cfbd4d802e..baf07f67455 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -60,7 +60,7 @@ - fk_product > 0) { ?> + fk_product > 0) { ?> product_label); ?> -
- + + +
global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('product_desc',$line->description,'',164,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,$nbrows,70); + $enable=(isset($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0); + $doleditor=new DolEditor('product_desc',$line->description,'',164,'dolibarr_details','',false,true,$enable,$nbrows,70); $doleditor->Create(); ?> @@ -135,9 +135,10 @@ > trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; ?> select_date($line->date_start,'date_start',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$line->date_start?0:1,"updateligne"); + $hourmin=(isset($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE:''); + echo $form->select_date($line->date_start,'date_start',$hourmin,$hourmin,$line->date_start?0:1,"updateligne"); echo ' '.$langs->trans('to').' '; - echo $form->select_date($line->date_end,'date_end',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$line->date_end?0:1,"updateligne"); + echo $form->select_date($line->date_end,'date_end',$hourmin,$hourmin,$line->date_end?0:1,"updateligne"); ?> diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php index e786e4ce69a..5234949629c 100644 --- a/htdocs/core/tpl/passwordforgotten.tpl.php +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -34,25 +34,25 @@ print ' print ''."\n"; if (constant('JS_JQUERY_UI')) print ''."\n"; // JQuery else print ''."\n"; // JQuery -// CSS forced by modules (relative url starting with /) -if (isset($conf->modules_parts['css'])) -{ - $arraycss=(array) $conf->modules_parts['css']; - foreach($arraycss as $modcss => $filescss) - { - $filescss=(array) $filescss; // To be sure filecss is an array - foreach($filescss as $cssfile) - { - // cssfile is a relative path - print ''."\n"; - } - } +// CSS forced by modules (relative url starting with /) +if (isset($conf->modules_parts['css'])) +{ + $arraycss=(array) $conf->modules_parts['css']; + foreach($arraycss as $modcss => $filescss) + { + $filescss=(array) $filescss; // To be sure filecss is an array + foreach($filescss as $cssfile) + { + // cssfile is a relative path + print ''."\n"; + } + } } // JQuery. Must be before other includes -$ext='.js'; +$ext='.js'; if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x01)) $ext='.jgz'; print ''."\n"; if (constant('JS_JQUERY')) print ''."\n"; @@ -91,9 +91,9 @@ print ' if (! empty($hookmanager->resArray['options'])) { foreach ($hookmanager->resArray['options'] as $format => $option) { - if ($format == 'table') { - echo ''; - echo $option; + if ($format == 'table') { + echo ''; + echo $option; } } } diff --git a/htdocs/document.php b/htdocs/document.php index 910456aca7e..22240663b19 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -76,16 +76,16 @@ $type = 'application/octet-stream'; if (GETPOST('type','alpha')) $type=GETPOST('type','alpha'); else $type=dol_mimetype($original_file); -// Define attachment (attachment=true to force choice popup 'open'/'save as') -$attachment = true; +// Define attachment (attachment=true to force choice popup 'open'/'save as') +$attachment = true; if (preg_match('/\.(html|htm)$/i',$original_file)) $attachment = false; -if (isset($_GET["attachment"])) $attachment = GETPOST("attachment")?true:false; -if (! empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment=false; +if (isset($_GET["attachment"])) $attachment = GETPOST("attachment")?true:false; +if (! empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment=false; -// Suppression de la chaine de caractere ../ dans $original_file -$original_file = str_replace("../","/", $original_file); - -// Find the subdirectory name as the reference +// Suppression de la chaine de caractere ../ dans $original_file +$original_file = str_replace("../","/", $original_file); + +// Find the subdirectory name as the reference $refname=basename(dirname($original_file)."/"); // Security check @@ -343,12 +343,12 @@ if ($modulepart) $original_file=$conf->admin->dir_output.'/'.$original_file; } - // Wrapping for upload file test - else if ($modulepart == 'admin_temp') - { - if ($user->admin) - $accessallowed=1; - $original_file=$conf->admin->dir_temp.'/'.$original_file; + // Wrapping for upload file test + else if ($modulepart == 'admin_temp') + { + if ($user->admin) + $accessallowed=1; + $original_file=$conf->admin->dir_temp.'/'.$original_file; } // Wrapping pour BitTorrent diff --git a/htdocs/ecm/ajax/ecmdatabase.php b/htdocs/ecm/ajax/ecmdatabase.php new file mode 100644 index 00000000000..6bc9adc8843 --- /dev/null +++ b/htdocs/ecm/ajax/ecmdatabase.php @@ -0,0 +1,171 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/ecm/ajax/ecmdatabases.php + * \brief File to build ecm database + */ + +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); +//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); +if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); +if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); + +require '../../main.inc.php'; +require DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; + +$action = GETPOST('action','alpha'); +$element = GETPOST('element', 'alpha'); + +/* + * View + */ + +top_httphead(); + +//print ''."\n"; + +// Load original field value +if (isset($action) && ! empty($action)) +{ + $error=0; + + if ($action == 'build' && ! empty($element)) + { + require DOL_DOCUMENT_ROOT . '/ecm/class/ecmdirectory.class.php'; + + $ecmdirstatic = new EcmDirectory($db); + + clearstatcache(); + + $diroutputslash=str_replace('\\', '/', $conf->$element->dir_output); + $diroutputslash.='/'; + + // Scan directory tree on disk + $disktree=dol_dir_list($conf->$element->dir_output,'directories',1,'',array('^temp$'),'','',0); + + // Scan directory tree in database + $sqltree=$ecmdirstatic->get_full_arbo(0); + + $adirwascreated=0; + + // Now we compare both trees to complete missing trees into database + //var_dump($disktree); + //var_dump($sqltree); + foreach($disktree as $dirdesc) // Loop on tree onto disk + { + set_time_limit(0); // To force restarts the timeout counter from zero + + $dirisindatabase=0; + foreach($sqltree as $dirsqldesc) + { + if ($conf->$element->dir_output.'/'.$dirsqldesc['fullrelativename'] == $dirdesc['fullname']) + { + $dirisindatabase=1; + break; + } + } + + if (! $dirisindatabase) + { + $txt="Directory found on disk ".$dirdesc['fullname'].", not found into database so we add it"; + dol_syslog($txt); + + // We must first find the fk_parent of directory to create $dirdesc['fullname'] + $fk_parent=-1; + $relativepathmissing=str_replace($diroutputslash,'',$dirdesc['fullname']); + $relativepathtosearchparent=$relativepathmissing; + //dol_syslog("Try to find parent id for directory ".$relativepathtosearchparent); + if (preg_match('/\//',$relativepathtosearchparent)) + //while (preg_match('/\//',$relativepathtosearchparent)) + { + $relativepathtosearchparent=preg_replace('/\/[^\/]*$/','',$relativepathtosearchparent); + $txt="Is relative parent path ".$relativepathtosearchparent." for ".$relativepathmissing." found in sql tree ?"; + dol_syslog($txt); + //print $txt." -> "; + $parentdirisindatabase=0; + foreach($sqltree as $dirsqldesc) + { + if ($dirsqldesc['fullrelativename'] == $relativepathtosearchparent) + { + $parentdirisindatabase=$dirsqldesc['id']; + break; + } + } + if ($parentdirisindatabase > 0) + { + dol_syslog("Yes with id ".$parentdirisindatabase); + //print "Yes with id ".$parentdirisindatabase."
\n"; + $fk_parent=$parentdirisindatabase; + //break; // We found parent, we can stop the while loop + } + else + { + dol_syslog("No"); + //print "No
\n"; + } + } + else + { + dol_syslog("Parent is root"); + $fk_parent=0; // Parent is root + } + + if ($fk_parent >= 0) + { + $ecmdirtmp=new EcmDirectory($db); + $ecmdirtmp->ref = 'NOTUSEDYET'; + $ecmdirtmp->label = dol_basename($dirdesc['fullname']); + $ecmdirtmp->description = ''; + $ecmdirtmp->fk_parent = $fk_parent; + + $txt="We create directory ".$ecmdirtmp->label." with parent ".$fk_parent; + dol_syslog($txt); + //print $txt."
\n"; + $id = $ecmdirtmp->create($user); + if ($id > 0) + { + $newdirsql=array('id'=>$id, + 'id_mere'=>$ecmdirtmp->fk_parent, + 'label'=>$ecmdirtmp->label, + 'description'=>$ecmdirtmp->description, + 'fullrelativename'=>$relativepathmissing); + $sqltree[]=$newdirsql; // We complete fulltree for following loops + //var_dump($sqltree); + $adirwascreated=1; + } + else + { + dol_syslog("Failed to create directory ".$ecmdirtmp->label, LOG_ERR); + } + } + else { + $txt="Parent of ".$dirdesc['fullname']." not found"; + dol_syslog($txt); + //print $txt."
\n"; + } + } + } + + $sql="UPDATE ".MAIN_DB_PREFIX."ecm_directories set cachenbofdoc = -1 WHERE cachenbofdoc < 0"; // If pb into cahce counting, we set to value -1 = "unknown" + $db->query($sql); + } +} + +?> diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index 17b00274582..c15fc75023c 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -24,6 +24,7 @@ */ if (! defined('REQUIRE_JQUERY_LAYOUT')) define('REQUIRE_JQUERY_LAYOUT','1'); +if (! defined('REQUIRE_JQUERY_BLOCKUI')) define('REQUIRE_JQUERY_BLOCKUI', 1); require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; @@ -430,8 +431,9 @@ else print ''; print '
'; } -print ''; -print ''; +$url=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&module='.$module:'').($section?'&section='.$section:''))); +print ''; +print ''; print ''; print ''; @@ -565,57 +567,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti print ''; // Show filemanager tree - print '
'; - - print '
'; - - $openeddir='/'; - ?> - - - '; if ($action == 'deletefile') print $form->formconfirm('eeeee', $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', '', 'deletefile'); @@ -815,7 +767,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirpreview.php'; // To attach new file -if (empty($conf->global->MAIN_ECM_DISABLE_JS) || ! empty($section)) +if ((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) || ! empty($section)) { $formfile=new FormFile($db); $formfile->form_attach_new_file(DOL_URL_ROOT.'/ecm/index.php', 'none', 0, ($section?$section:-1), $user->rights->ecm->upload, 48); @@ -832,6 +784,9 @@ else print ' '; use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) { + include 'tpl/builddatabase.tpl.php'; +} llxFooter(); diff --git a/htdocs/ecm/tpl/builddatabase.tpl.php b/htdocs/ecm/tpl/builddatabase.tpl.php new file mode 100644 index 00000000000..462c1d33fb1 --- /dev/null +++ b/htdocs/ecm/tpl/builddatabase.tpl.php @@ -0,0 +1,82 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +$openeddir='/'; + +// TODO: just use ajaxdirtree.php for load database after ajax refresh and not scan directories +// too slow every page loaded ! + +?> + + + + \ No newline at end of file diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index a033813c93d..3a476b109a5 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -21,7 +21,7 @@ * \ingroup holiday * \brief Class file of the module paid holiday. */ -require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; +require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; /** diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 3870945387b..41a955f64c3 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -41,7 +41,7 @@ $action=GETPOST('action'); * View */ -$form = new Form($db); +$form = new Form($db); llxHeader(array(),$langs->trans('CPTitreMenu')); @@ -113,23 +113,23 @@ elseif($action == 'add_event') $var=true; $i = 0; -$cp_events = $holiday->fetchEventsCP(); - +$cp_events = $holiday->fetchEventsCP(); + if($cp_events == 1) -{ - print '
'."\n"; - print ''; - +{ + print '
'."\n"; + print ''; + print_fiche_titre($langs->trans('DefineEventUserCP'),'',''); - - print $langs->trans('MotifCP').' : '; - print $holiday->selectEventCP(); - print '   '.$langs->trans('UserCP').' : '; - print $form->select_users('',"userCP",1,"",0,''); - print ' '; - - print '

'; -} + + print $langs->trans('MotifCP').' : '; + print $holiday->selectEventCP(); + print '   '.$langs->trans('UserCP').' : '; + print $form->select_users('',"userCP",1,"",0,''); + print ' '; + + print '
'; +} dol_fiche_head(); diff --git a/htdocs/holiday/fiche.php b/htdocs/holiday/fiche.php index 4c6e0799053..11ba6d0eb3e 100644 --- a/htdocs/holiday/fiche.php +++ b/htdocs/holiday/fiche.php @@ -27,8 +27,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; -require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; +require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php'; // Get parameters $myparam = GETPOST("myparam"); @@ -891,16 +891,16 @@ elseif(isset($_GET['id'])) print ''; // Status - print ''; - print ''.$langs->trans('StatutCP').''; - print ''.$cp->getStatutCP($cp->statut).''; - print ''; - if($cp->statut == 5) { - print ''; - print ''.$langs->trans('DetailRefusCP').''; - print ''.$cp->detail_refuse.''; - print ''; - } + print ''; + print ''.$langs->trans('StatutCP').''; + print ''.$cp->getStatutCP($cp->statut).''; + print ''; + if($cp->statut == 5) { + print ''; + print ''.$langs->trans('DetailRefusCP').''; + print ''.$cp->detail_refuse.''; + print ''; + } // Description if(!$edit) { diff --git a/htdocs/holiday/index.php b/htdocs/holiday/index.php index ce466d1807a..c2c865dc1a6 100644 --- a/htdocs/holiday/index.php +++ b/htdocs/holiday/index.php @@ -27,34 +27,34 @@ require('../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; -require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; -require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; +require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php'; // Protection if external user if ($user->societe_id > 0) accessforbidden(); -$sortfield = GETPOST("sortfield"); -$sortorder = GETPOST("sortorder"); -$page = GETPOST("page"); -$page = is_numeric($page) ? $page : 0; -$page = $page == -1 ? 0 : $page; - -if (! $sortfield) $sortfield="cp.rowid"; -if (! $sortorder) $sortorder="DESC"; -$offset = $conf->liste_limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; - -$search_ref = GETPOST('search_ref'); -$month_create = GETPOST('month_create'); -$year_create = GETPOST('year_create'); -$month_start = GETPOST('month_start'); -$year_start = GETPOST('year_start'); -$month_end = GETPOST('month_end'); -$year_end = GETPOST('year_end'); -$search_employe = GETPOST('search_employe'); -$search_valideur = GETPOST('search_valideur'); -$search_statut = GETPOST('select_statut'); +$sortfield = GETPOST("sortfield"); +$sortorder = GETPOST("sortorder"); +$page = GETPOST("page"); +$page = is_numeric($page) ? $page : 0; +$page = $page == -1 ? 0 : $page; + +if (! $sortfield) $sortfield="cp.rowid"; +if (! $sortorder) $sortorder="DESC"; +$offset = $conf->liste_limit * $page ; +$pageprev = $page - 1; +$pagenext = $page + 1; + +$search_ref = GETPOST('search_ref'); +$month_create = GETPOST('month_create'); +$year_create = GETPOST('year_create'); +$month_start = GETPOST('month_start'); +$year_start = GETPOST('year_start'); +$month_end = GETPOST('month_end'); +$year_end = GETPOST('year_end'); +$search_employe = GETPOST('search_employe'); +$search_valideur = GETPOST('search_valideur'); +$search_statut = GETPOST('select_statut'); /* @@ -74,7 +74,7 @@ $min_year = 10; llxHeader(array(),$langs->trans('CPTitreMenu')); -$order = $db->order($sortfield,$sortorder).$db->plimit($conf->liste_limit + 1, $offset); +$order = $db->order($sortfield,$sortorder).$db->plimit($conf->liste_limit + 1, $offset); // WHERE if(!empty($search_ref)){ diff --git a/htdocs/holiday/month_report.php b/htdocs/holiday/month_report.php index 1349ef1e364..ef0ff913bf8 100644 --- a/htdocs/holiday/month_report.php +++ b/htdocs/holiday/month_report.php @@ -25,8 +25,8 @@ require('../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php'; // Protection if external user if ($user->societe_id > 0) accessforbidden(); diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index ef21ee4cde1..4731b29d956 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -24,8 +24,8 @@ */ require('../main.inc.php'); -require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; -require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; +require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php'; // Protection if external user if ($user->societe_id > 0) accessforbidden(); diff --git a/htdocs/install/etape5.php b/htdocs/install/etape5.php index ffccf5f04a8..f045c2a4a58 100644 --- a/htdocs/install/etape5.php +++ b/htdocs/install/etape5.php @@ -33,7 +33,7 @@ require_once $dolibarr_main_document_root . '/core/lib/security.lib.php'; // for $setuplang=GETPOST("selectlang",'',3)?GETPOST("selectlang",'',3):'auto'; $langs->setDefaultLang($setuplang); -$versionfrom=GETPOST("versionfrom",'',3)?GETPOST("versionfrom",'',3):(empty($argv[1])?'':$argv[1]); +$versionfrom=GETPOST("versionfrom",'',3)?GETPOST("versionfrom",'',3):(empty($argv[1])?'':$argv[1]); $versionto=GETPOST("versionto",'',3)?GETPOST("versionto",'',3):(empty($argv[2])?'':$argv[2]); $action=GETPOST('action', 'alpha'); diff --git a/htdocs/install/mysql/migration/3.2.0-3.3.0.sql b/htdocs/install/mysql/migration/3.2.0-3.3.0.sql index dbf3e85ef9d..8f9fde953cf 100755 --- a/htdocs/install/mysql/migration/3.2.0-3.3.0.sql +++ b/htdocs/install/mysql/migration/3.2.0-3.3.0.sql @@ -89,6 +89,8 @@ ALTER TABLE llx_actioncomm MODIFY elementtype VARCHAR(32); -- TASK #107 ALTER TABLE llx_ecm_directories MODIFY COLUMN label varchar(64) NOT NULL; +ALTER TABLE llx_ecm_directories ADD COLUMN fullpath varchar(255) AFTER cachenbofdoc; +ALTER TABLE llx_ecm_directories ADD COLUMN extraparams varchar(255) AFTER fullpath; ALTER TABLE llx_ecm_directories ADD COLUMN acl text; ALTER TABLE llx_ecm_directories ADD INDEX idx_ecm_directories_fk_user_c (fk_user_c); ALTER TABLE llx_ecm_directories ADD INDEX idx_ecm_directories_fk_user_m (fk_user_m); @@ -105,6 +107,7 @@ ALTER TABLE llx_ecm_documents DROP COLUMN cipher; ALTER TABLE llx_ecm_documents CHANGE COLUMN fullpath_dol fullpath varchar(255) NOT NULL; ALTER TABLE llx_ecm_documents MODIFY COLUMN filemime varchar(128) NOT NULL; ALTER TABLE llx_ecm_documents ADD COLUMN metadata text after description; +ALTER TABLE llx_ecm_documents ADD COLUMN extraparams varchar(255) AFTER fk_directory; ALTER TABLE llx_ecm_documents ADD UNIQUE INDEX idx_ecm_documents_ref (ref, fk_directory, entity); ALTER TABLE llx_ecm_documents ADD INDEX idx_ecm_documents_fk_create (fk_create); ALTER TABLE llx_ecm_documents ADD INDEX idx_ecm_documents_fk_update (fk_update); @@ -192,3 +195,10 @@ INSERT INTO llx_holiday_config (rowid ,name ,value) VALUES (NULL , 'AlertValidat INSERT INTO llx_holiday_config (rowid ,name ,value) VALUES (NULL , 'nbHolidayDeducted', '1'); INSERT INTO llx_holiday_config (rowid ,name ,value) VALUES (NULL , 'nbHolidayEveryMonth', '2.08334'); + +DELETE FROM llx_document_model WHERE (nom = 'oursin' AND type ='invoice') OR (nom = 'edison' AND type ='order') OR (nom = 'jaune' AND type ='propal'); + +ALTER TABLE llx_boxes DROP INDEX uk_boxes; +ALTER TABLE llx_boxes ADD COLUMN entity integer NOT NULL DEFAULT 1 AFTER rowid; +ALTER TABLE llx_boxes ADD UNIQUE INDEX uk_boxes (entity, box_id, position, fk_user); +UPDATE llx_boxes as b SET b.entity = (SELECT bd.entity FROM llx_boxes_def as bd WHERE bd.rowid = b.box_id); diff --git a/htdocs/install/mysql/tables/llx_boxes.key.sql b/htdocs/install/mysql/tables/llx_boxes.key.sql index 3daaa0d07c7..cd89f1086af 100644 --- a/htdocs/install/mysql/tables/llx_boxes.key.sql +++ b/htdocs/install/mysql/tables/llx_boxes.key.sql @@ -1,5 +1,6 @@ -- =================================================================== --- Copyright (C) 2006-2009 Laurent Destailleur +-- Copyright (C) 2006-2009 Laurent Destailleur +-- Copyright (C) 2006-2012 Regis Houssin -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by @@ -17,7 +18,7 @@ -- =================================================================== -ALTER TABLE llx_boxes ADD UNIQUE INDEX uk_boxes (box_id, position, fk_user); +ALTER TABLE llx_boxes ADD UNIQUE INDEX uk_boxes (entity, box_id, position, fk_user); -- Supprime orphelins pour permettre montee de la cle -- V4 DELETE llx_boxes FROM llx_boxes LEFT JOIN llx_boxes_def ON llx_boxes.box_id = llx_boxes_def.rowid WHERE llx_boxes_def.rowid IS NULL; diff --git a/htdocs/install/mysql/tables/llx_boxes.sql b/htdocs/install/mysql/tables/llx_boxes.sql index 1ab57d9c0b6..0eeecc2474b 100644 --- a/htdocs/install/mysql/tables/llx_boxes.sql +++ b/htdocs/install/mysql/tables/llx_boxes.sql @@ -1,6 +1,7 @@ -- ============================================================================ --- Copyright (C) 2003 Rodolphe Quiedeville --- Copyright (C) 2006-2012 Laurent Destailleur +-- Copyright (C) 2003 Rodolphe Quiedeville +-- Copyright (C) 2006-2012 Laurent Destailleur +-- Copyright (C) 2006-2012 Regis Houssin -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by @@ -24,10 +25,12 @@ create table llx_boxes ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - box_id integer NOT NULL, - position smallint NOT NULL, - box_order varchar(3) NOT NULL, - fk_user integer default 0 NOT NULL, - maxline integer NULL + rowid integer AUTO_INCREMENT PRIMARY KEY, + entity integer NOT NULL DEFAULT 1, + box_id integer NOT NULL, + position smallint NOT NULL, + box_order varchar(3) NOT NULL, + fk_user integer default 0 NOT NULL, + maxline integer NULL + )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_ecm_directories.sql b/htdocs/install/mysql/tables/llx_ecm_directories.sql index ea4da6e4a36..7e11694ad0b 100644 --- a/htdocs/install/mysql/tables/llx_ecm_directories.sql +++ b/htdocs/install/mysql/tables/llx_ecm_directories.sql @@ -23,10 +23,12 @@ create table llx_ecm_directories ( rowid integer AUTO_INCREMENT PRIMARY KEY, label varchar(64) NOT NULL, - entity integer DEFAULT 1 NOT NULL, -- multi company id + entity integer DEFAULT 1 NOT NULL, -- multi company id fk_parent integer, description varchar(255) NOT NULL, cachenbofdoc integer NOT NULL DEFAULT 0, + fullpath varchar(255), -- can be NULL for virtual directory + extraparams varchar(255), -- for stock other parameters with json format date_c datetime, date_m timestamp, fk_user_c integer, diff --git a/htdocs/install/mysql/tables/llx_ecm_documents.sql b/htdocs/install/mysql/tables/llx_ecm_documents.sql index 876262dcb7c..b1d8ecd3bba 100644 --- a/htdocs/install/mysql/tables/llx_ecm_documents.sql +++ b/htdocs/install/mysql/tables/llx_ecm_documents.sql @@ -30,6 +30,7 @@ create table llx_ecm_documents metadata text, fullpath varchar(255) NOT NULL, fk_directory integer, + extraparams varchar(255), -- for stock other parameters with json format fk_create integer NOT NULL, fk_update integer, date_c datetime NOT NULL, diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index 1ee92b5444d..4b1ce7697ad 100644 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -48,8 +48,8 @@ $versionfrom=GETPOST("versionfrom",'',3)?GETPOST("versionfrom",'',3):(empty($arg $versionto=GETPOST("versionto",'',3)?GETPOST("versionto",'',3):(empty($argv[2])?'':$argv[2]); $langs->load("admin"); -$langs->load("install"); -$langs->load("errors"); +$langs->load("install"); +$langs->load("errors"); if ($dolibarr_main_db_type == "mysql") $choix=1; if ($dolibarr_main_db_type == "mysqli") $choix=1; @@ -155,16 +155,16 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) dolibarr_install_syslog("upgrade: ".$langs->transnoentities("ServerVersion")." : $version"); // Test database version - $versionmindb=getStaticMember(get_class($db),'versionmin'); + $versionmindb=getStaticMember(get_class($db),'versionmin'); //print join('.',$versionarray).' - '.join('.',$versionmindb); - if (count($versionmindb) && count($versionarray) + if (count($versionmindb) && count($versionarray) && versioncompare($versionarray,$versionmindb) < 0) { // Warning: database version too low. - print "".$langs->trans("ErrorDatabaseVersionTooLow",join('.',$versionarray),join('.',$versionmindb))."".$langs->trans("Error")."\n"; - dolibarr_install_syslog("upgrade: ".$langs->transnoentities("ErrorDatabaseVersionTooLow",join('.',$versionarray),join('.',$versionmindb))); - $ok=0; - } + print "".$langs->trans("ErrorDatabaseVersionTooLow",join('.',$versionarray),join('.',$versionmindb))."".$langs->trans("Error")."\n"; + dolibarr_install_syslog("upgrade: ".$langs->transnoentities("ErrorDatabaseVersionTooLow",join('.',$versionarray),join('.',$versionmindb))); + $ok=0; + } } @@ -311,7 +311,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) $dir = "mysql/migration/"; // We use mysql migration scripts whatever is database driver // For minor version - $newversionfrom=preg_replace('/(\.[0-9]+)$/i','.0',$versionfrom); + $newversionfrom=preg_replace('/(\.[0-9]+)$/i','.0',$versionfrom); $newversionto=preg_replace('/(\.[0-9]+)$/i','.0',$versionto); $filelist=array(); diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 6fec576dbdb..516c19b9c80 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -963,11 +963,11 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs print ''."\n"; print ''."\n"; } - // jQuery blockUI - if (! empty($conf->global->MAIN_USE_JQUERY_BLOCKUI) || defined('REQUIRE_JQUERY_BLOCKUI')) - { + // jQuery blockUI + if (! empty($conf->global->MAIN_USE_JQUERY_BLOCKUI) || defined('REQUIRE_JQUERY_BLOCKUI')) + { print ''."\n"; - print ''."\n"; + print ''."\n"; } // Flot if (empty($conf->global->MAIN_DISABLE_JQUERY_FLOT)) diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 0e8b2b6502d..34dd9ad8dca 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -78,7 +78,7 @@ if (defined('TEST_DB_FORCE_TYPE')) $conf->db->type=constant('TEST_DB_FORCE_TYPE' $conf->file->strict_mode = empty($dolibarr_strict_mode)?'':$dolibarr_strict_mode; // Force Multi-Company transverse mode $conf->multicompany->transverse_mode = empty($multicompany_transverse_mode)?'':$multicompany_transverse_mode; -// Force entity in login page +// Force entity in login page $conf->multicompany->force_entity = empty($multicompany_force_entity)?'':(int) $multicompany_force_entity; // Chargement des includes principaux de librairies communes diff --git a/htdocs/product/admin/product_tools.php b/htdocs/product/admin/product_tools.php index cec370c1e2c..5962d4ded9b 100644 --- a/htdocs/product/admin/product_tools.php +++ b/htdocs/product/admin/product_tools.php @@ -40,7 +40,7 @@ $oldvatrate=GETPOST('oldvatrate'); $newvatrate=GETPOST('newvatrate'); //$price_base_type=GETPOST('price_base_type'); -$objectstatic = new Product($db); +$objectstatic = new Product($db); /* @@ -96,7 +96,7 @@ if ($action == 'convert') if ($newminprice > $newprice) $newminprice=$newprice; $newvat=str_replace('*','',$newvatrate); $newnpr=$objectstatic->recuperableonly; - $newlevel=0; + $newlevel=0; $ret=$objectstatic->updatePrice($objectstatic->id, $newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); if ($ret < 0) $error++; @@ -106,7 +106,7 @@ if ($action == 'convert') } - $i++; + $i++; } if (! $error) diff --git a/htdocs/product/ajax/products.php b/htdocs/product/ajax/products.php index 4cfece08d34..d1874d11eaa 100644 --- a/htdocs/product/ajax/products.php +++ b/htdocs/product/ajax/products.php @@ -69,7 +69,7 @@ if (! empty($action) && $action == 'fetch' && ! empty($id)) $found=false; // Multiprice - if ($price_level >= 1) // If we need a particular price level (from 1 to 6) + if (isset($price_level) && $price_level >= 1) // If we need a particular price level (from 1 to 6) { $sql = "SELECT price, price_ttc, price_base_type, tva_tx"; $sql.= " FROM ".MAIN_DB_PREFIX."product_price "; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 0d80a5bbc7b..5b9d06cb8cc 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1028,14 +1028,14 @@ class Product extends CommonObject $this->_log_price($user,$level); - // Appel des triggers - include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('PRODUCT_PRICE_MODIFY',$this,$user,$langs,$conf); + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('PRODUCT_PRICE_MODIFY',$this,$user,$langs,$conf); if ($result < 0) - { - $error++; $this->errors=$interface->errors; - } + { + $error++; $this->errors=$interface->errors; + } // Fin appel triggers } else diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 417430ae1b0..f265c9b7ca5 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -262,31 +262,31 @@ if ($action == 'add') $result=$adh->send_an_email($conf->global->ADHERENT_AUTOREGISTER_MAIL,$conf->global->ADHERENT_AUTOREGISTER_MAIL_SUBJECT,array(),array(),array(),"","",0,-1); } - // Send email to the foundation to say a new member subscribed with autosubscribe form - if (! empty($conf->global->MAIN_INFO_SOCIETE_MAIL) && ! empty($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT) && - ! empty($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL) ) + // Send email to the foundation to say a new member subscribed with autosubscribe form + if (! empty($conf->global->MAIN_INFO_SOCIETE_MAIL) && ! empty($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT) && + ! empty($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL) ) { $to=$adh->makeSubstitution($conf->global->MAIN_INFO_SOCIETE_MAIL); - $from=$conf->global->ADHERENT_MAIL_FROM; - $mailfile = new CMailFile( - $conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT, - $to, - $from, - $adh->makeSubstitution($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL), - array(), - array(), - array(), - "", - "", - 0, - -1 - ); - - if (! $mailfile->sendfile()) - { - dol_syslog($langs->trans("ErrorFailedToSendMail",$from,$to), LOG_ERR); - } - } + $from=$conf->global->ADHERENT_MAIL_FROM; + $mailfile = new CMailFile( + $conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT, + $to, + $from, + $adh->makeSubstitution($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL), + array(), + array(), + array(), + "", + "", + 0, + -1 + ); + + if (! $mailfile->sendfile()) + { + dol_syslog($langs->trans("ErrorFailedToSendMail",$from,$to), LOG_ERR); + } + } if (! empty($backtopage)) $urlback=$backtopage; else if ($conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION) diff --git a/htdocs/theme/bureau2crea/tpl/login.tpl.php b/htdocs/theme/bureau2crea/tpl/login.tpl.php index 67c96b12da7..5af36b446b5 100644 --- a/htdocs/theme/bureau2crea/tpl/login.tpl.php +++ b/htdocs/theme/bureau2crea/tpl/login.tpl.php @@ -56,7 +56,7 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S print ''."\n"; if (constant('JS_JQUERY')) print ''."\n"; else print ''."\n"; -print ''."\n"; +print ''."\n"; print '