';
}
}
- // Other attributes
- $parameters=array('colspan' => ' colspan="3"');
- $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$salpayment,$action); // Note that $action and $object may have been modified by hook
+ // Other attributes
+ $parameters=array('colspan' => ' colspan="3"');
+ $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$salpayment,$action); // Note that $action and $object may have been modified by hook
print '
';
print '';
$i++;
diff --git a/htdocs/core/boxes/box_ficheinter.php b/htdocs/core/boxes/box_ficheinter.php
index 81cba912dff..cc7464ec3e9 100644
--- a/htdocs/core/boxes/box_ficheinter.php
+++ b/htdocs/core/boxes/box_ficheinter.php
@@ -72,8 +72,10 @@ class box_ficheinter extends ModeleBoxes
$sql.= ", ".MAIN_DB_PREFIX."fichinter as f";
$sql.= " WHERE f.fk_soc = s.rowid ";
$sql.= " AND f.entity = ".$conf->entity;
- if (! $user->rights->societe->client->voir)
+ if (! $user->rights->societe->client->voir && !$user->societe_id)
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+ if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
+
$sql.= " ORDER BY f.tms DESC";
$sql.= $db->plimit($max, 0);
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index c35fad153b4..b522e811515 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -674,6 +674,7 @@ class ExtraFields
$out = '';
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT && ! $forcecombo)
{
+ include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out.= ajax_combobox('options_'.$key.$keyprefix, $event, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
}
@@ -693,6 +694,7 @@ class ExtraFields
$out = '';
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT && ! $forcecombo)
{
+ include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out.= ajax_combobox('options_'.$key.$keyprefix, $event, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
}
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 3574c841339..4b9f8c4cda0 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -732,9 +732,9 @@ class Form
* @return string HTML string with
* @deprecated Use select_thirdparty instead
*/
- function select_company($selected='', $htmlname='socid', $filter='', $showempty=0, $showtype=0, $forcecombo=0, $events=array())
+ function select_company($selected='', $htmlname='socid', $filter='', $showempty=0, $showtype=0, $forcecombo=0, $events=array(), $limit=0)
{
- return $this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events);
+ return $this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, '', 0, $limit);
}
/**
@@ -752,7 +752,7 @@ class Form
* @param int $limit Limit number of answers
* @return string HTML string with
*/
- function select_thirdparty_list($selected='',$htmlname='socid',$filter='',$showempty=0, $showtype=0, $forcecombo=0, $events=array(), $filterkey='', $outputmode=0, $limit=20)
+ function select_thirdparty_list($selected='',$htmlname='socid',$filter='',$showempty=0, $showtype=0, $forcecombo=0, $events=array(), $filterkey='', $outputmode=0, $limit=0)
{
global $conf,$user,$langs;
@@ -774,33 +774,33 @@ class Form
$sql.=" AND (";
if (! empty($conf->global->COMPANY_DONOTSEARCH_ANYWHERE)) // Can use index
{
- $sql.="(s.name LIKE '".$filterkey."%'";
- $sql.=")";
+ $sql.="(s.name LIKE '".$this->db->escape($filterkey)."%')";
}
else
{
// For natural search
$scrit = explode(' ', $filterkey);
foreach ($scrit as $crit) {
- $sql.=" AND (s.name LIKE '%".$crit."%'";
- $sql.=")";
+ $sql.=" AND (s.name LIKE '%".$this->db->escape($crit)."%')";
}
}
if (! empty($conf->barcode->enabled))
{
- $sql .= " OR s.barcode LIKE '".$filterkey."'";
+ $sql .= " OR s.barcode LIKE '".$this->db->escape($filterkey)."%'";
}
$sql.=")";
}
- $sql.= " ORDER BY nom ASC";
-
+ $sql.=$this->db->order("nom","ASC");
+ if ($limit > 0) $sql.=$this->db->plimit($limit);
+
dol_syslog(get_class($this)."::select_thirdparty_list sql=".$sql);
$resql=$this->db->query($sql);
if ($resql)
{
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT && ! $forcecombo)
{
- $out.= ajax_combobox($htmlname, $events, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
+ include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
+ $out.= ajax_combobox($htmlname, $events, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
}
// Construct $out and $outarray
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 4cb9f65f3b4..42c300ab56d 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -1162,7 +1162,7 @@ function dol_print_url($url,$target='_blank',$max=32)
* @param string $email EMail to show (only email, without 'Name of recipient' before)
* @param int $cid Id of contact if known
* @param int $socid Id of third party if known
- * @param int $addlink 0=no link to create action
+ * @param int $addlink 0=no link, 1=email has a html email link (+ link to create action if constant AGENDA_ADDACTIONFOREMAIL is on)
* @param int $max Max number of characters to show
* @param int $showinvalid Show warning if syntax email is wrong
* @return string HTML Link
diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php
index 7838a3597d1..9316c2bcf68 100644
--- a/htdocs/core/lib/project.lib.php
+++ b/htdocs/core/lib/project.lib.php
@@ -342,12 +342,12 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
// Date start
print '
';
// Planned Workload
diff --git a/htdocs/core/modules/modOpenSurvey.class.php b/htdocs/core/modules/modOpenSurvey.class.php
index b8c38d1fb45..e780b235677 100644
--- a/htdocs/core/modules/modOpenSurvey.class.php
+++ b/htdocs/core/modules/modOpenSurvey.class.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2014 Marcos García
+/* Copyright (C) 2013-2014 Laurent Destailleur
+ * Copyright (C) 2014 Marcos García
*
* 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
@@ -76,7 +76,7 @@ class modOpenSurvey extends DolibarrModules
$this->depends = array(); // List of modules id that must be enabled if this module is enabled
$this->requiredby = array(); // List of modules id to disable if this one is disabled
$this->phpmin = array(4,1); // Minimum version of PHP required by module
- $this->need_dolibarr_version = array(2,4); // Minimum version of Dolibarr required by module
+ $this->need_dolibarr_version = array(3,4,0); // Minimum version of Dolibarr required by module
// Constants
$this->const = array(); // List of parameters
@@ -121,7 +121,7 @@ class modOpenSurvey extends DolibarrModules
// Main menu entries
$this->menus = array(); // List of menus to add
$r=0;
-
+ /*
$this->menu[$r]=array( 'fk_menu'=>0, // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'top',
'titre'=>'Surveys',
@@ -133,14 +133,14 @@ class modOpenSurvey extends DolibarrModules
'perms'=>'$user->rights->opensurvey->read',
'target'=>'',
'user'=>0);
- $r++;
+ $r++;*/
- $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
+ $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left',
'titre'=>'Survey',
- 'mainmenu'=>'opensurvey',
+ 'mainmenu'=>'tools',
'leftmenu'=>'opensurvey',
- 'url'=>'/opensurvey/index.php?mainmenu=opensurvey&leftmenu=opensurvey',
+ 'url'=>'/opensurvey/index.php?mainmenu=tools&leftmenu=opensurvey',
'langs'=>'opensurvey',
'position'=>200,
'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled.
@@ -149,10 +149,10 @@ class modOpenSurvey extends DolibarrModules
'user'=>0);
$r++;
- $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=opensurvey,fk_leftmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
+ $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools,fk_leftmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left',
'titre'=>'NewSurvey',
- 'mainmenu'=>'opensurvey',
+ 'mainmenu'=>'tools',
'leftmenu'=>'opensurvey_new',
'url'=>'/opensurvey/wizard/index.php',
'langs'=>'opensurvey',
@@ -163,10 +163,10 @@ class modOpenSurvey extends DolibarrModules
'user'=>0);
$r++;
- $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=opensurvey,fk_leftmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
+ $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools,fk_leftmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left',
'titre'=>'List',
- 'mainmenu'=>'opensurvey',
+ 'mainmenu'=>'tools',
'leftmenu'=>'opensurvey_list',
'url'=>'/opensurvey/list.php',
'langs'=>'opensurvey',
diff --git a/htdocs/expedition/class/expeditionbatch.class.php b/htdocs/expedition/class/expeditionbatch.class.php
index cf57929ca0f..e361548309d 100644
--- a/htdocs/expedition/class/expeditionbatch.class.php
+++ b/htdocs/expedition/class/expeditionbatch.class.php
@@ -17,7 +17,7 @@
*/
/**
- * \file expedtion/class/productbatch.class.php
+ * \file expedition/class/productbatch.class.php
* \ingroup productbatch
* \brief This file implements CRUD method for managing product's shipment
* with batch record
diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php
index bfc444faf56..7ed44102a4c 100644
--- a/htdocs/expedition/fiche.php
+++ b/htdocs/expedition/fiche.php
@@ -856,7 +856,7 @@ if ($action == 'create')
if (($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES)) || $defaultqty < 0) $defaultqty=0;
}
- if (empty($conf->productbatch->enabled) || ! $product->hasbatch()) {
+ if (empty($conf->productbatch->enabled) || ! ($product->hasbatch() and is_array($product->stock_warehouse[GETPOST('entrepot_id','int')] ))) {
// Quantity to send
print '